:root {
  --bg: #0f172a;
  --bg-2: #020617;
  --panel: rgba(15, 23, 42, 0.88);
  --card: #1e293b;
  --card-2: #111827;
  --text: #f8fafc;
  --muted: #94a3b8;
  --line: #334155;
  --accent: #38bdf8;
  --accent-2: #22c55e;
  --danger: #f87171;
  --success: #86efac;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.20), transparent 36rem),
    radial-gradient(circle at bottom right, rgba(34, 197, 94, 0.14), transparent 34rem),
    var(--bg);
}

button, select, input[type="file"] {
  font: inherit;
}

button, select {
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text);
  border-radius: 0.85rem;
  padding: 0.7rem 0.9rem;
}

button {
  cursor: pointer;
  transition: border-color 150ms ease, transform 150ms ease, background 150ms ease;
}

button:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

select {
  min-width: 14rem;
  width: 100%;
}

input[type="file"] {
  max-width: 100%;
}

.boot {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: linear-gradient(135deg, #020617, #0f172a 65%, #082f49);
}

.boot-box {
  width: min(46rem, 94vw);
  border: 1px solid var(--line);
  border-radius: 1.5rem;
  padding: 2rem;
  background: rgba(17, 24, 39, 0.96);
  box-shadow: 0 1.5rem 5rem rgba(0,0,0,0.55);
}

.boot-box h1, .hero h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1;
}

.eyebrow {
  margin: 0 0 0.65rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  font-size: 0.78rem;
}

.progress {
  height: 1.1rem;
  margin: 1.2rem 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-2);
  overflow: hidden;
}

#barFill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 160ms ease;
}

.boot-actions,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

#bootLog {
  display: none;
  max-height: 18rem;
  overflow: auto;
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  background: var(--bg-2);
  color: #cbd5e1;
  white-space: pre-wrap;
  font-size: 0.85rem;
}

.app {
  width: min(70rem, 94vw);
  margin: 0 auto;
  padding: 2rem 0 3rem;
}

.hero {
  margin: 1.2rem 0 1.4rem;
}

.hero p:not(.eyebrow) {
  max-width: 48rem;
  color: #cbd5e1;
  font-size: 1.08rem;
  line-height: 1.55;
}

.panel {
  margin: 1rem 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 1.2rem;
  background: var(--panel);
  backdrop-filter: blur(10px);
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
  margin-bottom: 0.9rem;
}

label span {
  display: block;
  margin-bottom: 0.35rem;
  color: #cbd5e1;
  font-weight: 700;
}

.deck-info,
.muted {
  color: var(--muted);
}

.deck-info {
  margin: 0.8rem 0 0;
}

summary {
  cursor: pointer;
  font-weight: 700;
}

.example-json {
  overflow: auto;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  background: var(--bg-2);
  color: #e2e8f0;
}

.flashcard-wrap {
  perspective: 1400px;
  margin: 2rem auto 1rem;
  width: min(52rem, 100%);
}

.flashcard {
  position: relative;
  min-height: 21rem;
  transform-style: preserve-3d;
  transition: transform 420ms ease;
  cursor: pointer;
  outline: none;
}

.flashcard:focus-visible {
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.35);
  border-radius: 1.6rem;
}

.flashcard.flipped {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  gap: 0.9rem;
  min-height: 21rem;
  padding: clamp(1.5rem, 5vw, 3rem);
  border: 1px solid var(--line);
  border-radius: 1.6rem;
  background:
    linear-gradient(160deg, rgba(56,189,248,0.10), transparent 42%),
    var(--card);
  box-shadow: 0 1.25rem 3rem rgba(0,0,0,0.35);
  text-align: center;
  backface-visibility: hidden;
}

.card-back {
  transform: rotateY(180deg);
  background:
    linear-gradient(160deg, rgba(34,197,94,0.12), transparent 42%),
    var(--card-2);
}

.card-label {
  margin: 0;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.13em;
  font-size: 0.78rem;
  font-weight: 800;
}

.card-text {
  margin: 0;
  font-size: clamp(1.45rem, 4vw, 2.25rem);
  line-height: 1.25;
}

.card-text.answer {
  font-size: clamp(1.25rem, 3vw, 1.85rem);
  line-height: 1.42;
}

.card-nav {
  justify-content: center;
}

.good { color: var(--success); }
.bad { color: var(--danger); }

@media (max-width: 760px) {
  .control-grid {
    grid-template-columns: 1fr;
  }

  select {
    min-width: 100%;
  }

  .flashcard,
  .card-face {
    min-height: 26rem;
  }
}

.lloyd-banner {
  margin: 0 auto 1.2rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background:
    linear-gradient(135deg, rgba(56, 189, 248, 0.18), rgba(34, 197, 94, 0.12)),
    var(--panel);
  color: var(--text);
  box-shadow: 0 1rem 2.5rem rgba(0,0,0,0.25);
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
}

.lloyd-banner span {
  font-weight: 800;
  color: var(--accent);
}

.lloyd-banner small {
  color: var(--muted);
}

@media (max-width: 640px) {
  .lloyd-banner {
    align-items: flex-start;
    flex-direction: column;
  }
}
