:root {
  --navy-950: #07111f;
  --navy-900: #0b1728;
  --navy-850: #0f1d31;
  --navy-800: #13253c;
  --navy-700: #1d3554;
  --blue-500: #2d8cff;
  --blue-300: #89c2ff;
  --gold-500: #d8aa47;
  --gold-300: #f1d690;
  --ink: #f5f8fc;
  --muted: #b8c5d8;
  --soft: #eaf0f7;
  --dark-text: #182235;
  --success: #4fd18b;
  --danger: #ff756f;
  --line: rgba(255, 255, 255, 0.12);
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  line-height: 1.5;
}

body {
  overflow-x: hidden;
}

button,
select {
  font: inherit;
}

button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

button:focus-visible,
select:focus-visible,
.flashcard:focus-visible {
  outline: 3px solid var(--gold-300);
  outline-offset: 3px;
}

.app-shell {
  width: 100%;
  min-height: auto;
  padding: 18px;
  background:
    radial-gradient(circle at top left, rgba(45, 140, 255, 0.18), transparent 32rem),
    linear-gradient(145deg, var(--navy-950), var(--navy-900) 45%, #08101c);
}

.layout {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
}

.hero,
.study-panel,
.summary-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 29, 49, 0.92);
  box-shadow: var(--shadow);
}

.hero {
  display: grid;
  gap: 24px;
  padding: clamp(22px, 4vw, 44px);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--gold-300);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 920px;
  margin-bottom: 14px;
  font-size: clamp(2rem, 5vw, 4.2rem);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 10px;
  font-size: clamp(1.45rem, 3vw, 2.35rem);
  line-height: 1.08;
}

h3 {
  margin-bottom: 8px;
  font-size: 1.08rem;
}

.lead {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.18rem);
}

.metric-grid,
.progress-grid,
.block-grid {
  display: grid;
  gap: 12px;
}

.metric-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metric,
.progress-card,
.block-card,
.disclaimer,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 17, 31, 0.42);
}

.metric,
.progress-card {
  padding: 16px;
}

.metric span,
.progress-card span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
}

.metric strong,
.progress-card strong {
  display: block;
  margin-top: 4px;
  font-size: clamp(1.4rem, 3vw, 2rem);
  line-height: 1.1;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  color: var(--ink);
  background: var(--navy-700);
  font-weight: 800;
  text-align: center;
  transition: transform 150ms ease, background 150ms ease, color 150ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  background: #27476d;
}

.btn-primary {
  color: #0b1728;
  background: linear-gradient(180deg, var(--gold-300), var(--gold-500));
}

.btn-primary:hover {
  background: linear-gradient(180deg, #ffe4a5, #d9a33c);
}

.btn-blue {
  background: linear-gradient(180deg, #46a0ff, var(--blue-500));
}

.btn-danger {
  background: #642b35;
}

.btn-danger:hover {
  background: #7c3340;
}

.btn-ghost {
  border: 1px solid var(--line);
  background: transparent;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
}

.progress-panel {
  display: grid;
  gap: 14px;
}

.progress-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.bar {
  width: 100%;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.bar-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold-500), var(--blue-500));
  transition: width 220ms ease;
}

.disclaimer {
  padding: 14px 16px;
  color: var(--muted);
  font-size: 0.92rem;
}

.screen-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.study-panel,
.summary-panel {
  padding: clamp(16px, 2.4vw, 28px);
}

.study-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  font-size: 0.88rem;
  font-weight: 700;
}

.pill-strong {
  color: #101827;
  background: var(--gold-300);
}

.flashcard-wrap {
  display: flex;
  justify-content: center;
  perspective: 1400px;
  margin: 16px 0 12px;
}

.flashcard {
  position: relative;
  width: min(100%, 430px);
  aspect-ratio: 1 / 1;
  min-height: 0;
  border: 1px solid rgba(216, 170, 71, 0.35);
  border-radius: 8px;
  background: transparent;
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.32);
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform 420ms ease;
}

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

.card-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
  padding: clamp(22px, 4vw, 36px);
  border-radius: 8px;
  backface-visibility: hidden;
  overflow: hidden;
}

.card-front {
  color: var(--dark-text);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(232, 240, 250, 0.96)),
    var(--soft);
}

.card-back {
  color: var(--ink);
  background:
    linear-gradient(145deg, rgba(19, 37, 60, 0.98), rgba(7, 17, 31, 0.98)),
    var(--navy-800);
  transform: rotateY(180deg);
}

.face-label {
  color: var(--gold-500);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card-front .face-label {
  color: #9a6a12;
}

.card-text {
  margin: 0;
  font-size: clamp(1.2rem, 2.8vw, 1.9rem);
  font-weight: 850;
  line-height: 1.18;
}

.card-back .card-text {
  font-size: clamp(1rem, 2vw, 1.28rem);
  font-weight: 650;
}

.card-status {
  min-height: 24px;
  margin-bottom: 10px;
  color: var(--muted);
  font-weight: 700;
}

.study-actions {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.block-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.block-card {
  display: grid;
  gap: 10px;
  padding: 18px;
  color: var(--ink);
  text-align: left;
}

.block-card strong {
  font-size: 1.12rem;
}

.block-card span {
  color: var(--muted);
}

.block-card:hover {
  background: rgba(45, 140, 255, 0.14);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 22px 0;
}

.empty-state {
  padding: 24px;
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 900px) {
  .metric-grid,
  .progress-grid,
  .block-grid,
  .summary-grid,
  .study-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .screen-head {
    display: grid;
  }
}

@media (max-width: 620px) {
  .app-shell {
    padding: 12px;
  }

  .hero,
  .study-panel,
  .summary-panel {
    padding: 18px;
  }

  .metric-grid,
  .progress-grid,
  .block-grid,
  .summary-grid,
  .study-actions {
    grid-template-columns: 1fr;
  }

  .actions .btn,
  .study-actions .btn {
    width: 100%;
  }

  .flashcard {
    width: min(100%, 360px);
  }
}
