/* ==========================================================================
   Carivium Mathematics · Gamified Notes Study Engine
   Matches Carivium's dark-gold Wonderland / Chess Descent design language.
   ========================================================================== */

:root {
  --black: #0b0b0b;
  --void: #050505;
  --twilight: #131312;
  --surface: #161614;
  --surface-elev: #1d1c19;
  --ink: #f2ede0;
  --ink-soft: #d5cfc0;
  --muted: #9a9486;
  --gold: #c9a24d;
  --gold-bright: #e6c17a;
  --gold-deep: #7a5c2e;
  --gold-line: rgba(201, 162, 77, 0.24);
  --gold-glow: rgba(201, 162, 77, 0.16);
  --green: #2f6f5e;
  --green-bright: #49a087;
  --green-bg: rgba(47, 111, 94, 0.18);
  --rose: #b85c68;
  --rose-bg: rgba(184, 92, 104, 0.14);
  --serif: 'Playfair Display', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
  --radius: 10px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at 50% 14%, #181714 0%, #0b0b0b 52%, #050505 100%);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 3px; }
button { font-family: inherit; }

/* Subtle ambient frame & chess watermark (matches Carivium descent pages) */
.page-frame {
  position: fixed;
  inset: 1.8vh 1.8vw;
  z-index: 0;
  pointer-events: none;
  border: 1px solid rgba(201, 162, 77, 0.18);
}
body[data-intensity="methods"] .page-frame::before {
  content: '';
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(201, 162, 77, 0.09);
}
body[data-intensity="specialist"] {
  background: radial-gradient(ellipse at 50% 14%, #1a1314 0%, #0b0b0b 52%, #050505 100%);
}
body[data-intensity="specialist"] .topic-hero h1 {
  background: linear-gradient(115deg, var(--gold) 0%, var(--gold-bright) 35%, var(--gold) 50%, var(--gold-bright) 65%, var(--gold) 100%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  animation: shimmerTitle 7s ease-in-out infinite;
}
@keyframes shimmerTitle {
  0% { background-position: 0% 0; }
  50% { background-position: 100% 0; }
  100% { background-position: 0% 0; }
}
.piece-watermark {
  position: fixed;
  top: 52%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--serif);
  font-size: min(52vw, 340px);
  line-height: 1;
  color: transparent;
  background: linear-gradient(160deg, var(--gold-deep), var(--gold-bright) 48%, var(--gold) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  opacity: 0.065;
  pointer-events: none;
  z-index: 0;
  user-select: none;
}

/* ---------- Sticky Top HUD ---------- */
.hud-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(9, 9, 8, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--gold-line);
}
.hud-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0.85rem 1.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.crumb-nav {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.crumb-nav a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.25s ease;
}
.crumb-nav a:hover { color: var(--gold-bright); }
.crumb-sep { color: rgba(201, 162, 77, 0.45); user-select: none; }
.crumb-current { color: var(--gold-bright); font-weight: 500; }

.hud-stats {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  padding: 0.34rem 0.72rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(201, 162, 77, 0.24);
  font-size: 0.78rem;
  color: var(--ink);
  white-space: nowrap;
}
.stat-pill .icon { color: var(--gold-bright); font-size: 0.88rem; line-height: 1; }
.stat-pill.mastery .icon { color: var(--green-bright); }
.stat-pill strong { font-weight: 600; color: var(--gold-bright); }
.stat-pill.mastery strong { color: var(--green-bright); }

.sound-toggle {
  background: none;
  border: 1px solid rgba(201, 162, 77, 0.22);
  color: var(--muted);
  border-radius: 999px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 0.82rem;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.sound-toggle:hover { border-color: var(--gold); color: var(--gold-bright); }
.sound-toggle[aria-pressed="false"] { opacity: 0.55; }

.account-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.34rem 0.72rem;
  border-radius: 999px;
  background: rgba(201, 162, 77, 0.08);
  border: 1px solid rgba(201, 162, 77, 0.28);
  color: var(--ink-soft);
  font-size: 0.74rem;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}
.account-pill:hover {
  border-color: var(--gold-bright);
  color: var(--gold-bright);
  background: rgba(201, 162, 77, 0.16);
}
.account-pill[hidden] { display: none; }

/* ---------- Main Path Container ---------- */
.path-shell {
  position: relative;
  z-index: 1;
  max-width: 740px;
  margin: 0 auto;
  padding: 2.8rem 1.4rem 5.5rem;
}

.topic-hero {
  text-align: center;
  margin-bottom: 2.4rem;
  animation: fadeUp 0.75s ease forwards;
}
.topic-kicker {
  margin: 0 0 0.55rem;
  font-size: 0.74rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--green-bright);
}
.topic-hero h1 {
  margin: 0 0 0.7rem;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2rem, 6vw, 3.1rem);
  line-height: 1.15;
  background: linear-gradient(115deg, var(--gold) 0%, var(--gold-bright) 48%, var(--gold) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.topic-subtitle {
  margin: 0 auto 1.4rem;
  max-width: 54ch;
  color: var(--ink-soft);
  font-size: 0.96rem;
}
.notes-only-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.38rem 0.9rem;
  border-radius: 999px;
  background: var(--green-bg);
  border: 1px solid rgba(73, 160, 135, 0.35);
  color: #9be0ca;
  font-size: 0.76rem;
  letter-spacing: 0.06em;
}

/* Overall Mastery Progress Bar */
.mastery-panel {
  margin: 1.6rem auto 0;
  max-width: 480px;
  background: rgba(20, 20, 18, 0.8);
  border: 1px solid var(--gold-line);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
}
.mastery-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.78rem;
  margin-bottom: 0.55rem;
}
.mastery-label {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}
.mastery-count { color: var(--gold-bright); font-weight: 500; }
.mastery-track {
  height: 7px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 999px;
  overflow: hidden;
}
.mastery-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright), var(--green-bright));
  border-radius: 999px;
  transition: width 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}
.hero-actions {
  margin-top: 1.25rem;
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Buttons */
.btn-gold {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: linear-gradient(155deg, var(--gold-bright), var(--gold));
  color: var(--void);
  border: none;
  border-radius: 6px;
  padding: 0.72rem 1.45rem;
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(201, 162, 77, 0.22);
  transition: transform 0.18s ease, filter 0.2s ease, box-shadow 0.2s ease;
}
.btn-gold:hover { filter: brightness(1.07); transform: translateY(-1px); box-shadow: 0 8px 28px rgba(201, 162, 77, 0.32); }
.btn-gold:active { transform: translateY(0); }
.btn-gold:disabled { opacity: 0.35; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  background: transparent;
  color: var(--ink);
  border: 1px solid rgba(201, 162, 77, 0.35);
  border-radius: 6px;
  padding: 0.68rem 1.2rem;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}
.btn-ghost:hover { border-color: var(--gold-bright); color: var(--gold-bright); background: rgba(201, 162, 77, 0.06); }

/* ---------- Section Banners & Winding Duolingo Path ---------- */
.path-section {
  margin-top: 2.8rem;
}
.section-banner {
  position: relative;
  background: linear-gradient(135deg, rgba(24, 23, 20, 0.94), rgba(14, 17, 15, 0.92));
  border: 1px solid var(--gold-line);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius);
  padding: 1.15rem 1.4rem;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.section-banner-meta {
  font-size: 0.7rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--green-bright);
  margin-bottom: 0.2rem;
}
.section-banner h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.32rem;
  color: var(--gold-bright);
}
.section-banner p {
  margin: 0.25rem 0 0;
  font-size: 0.84rem;
  color: var(--muted);
}
.section-progress-chip {
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--gold-bright);
  padding: 0.32rem 0.72rem;
  border-radius: 999px;
  border: 1px solid rgba(201, 162, 77, 0.28);
  background: rgba(5, 5, 5, 0.55);
}
.section-progress-chip.complete {
  color: #9be0ca;
  border-color: rgba(73, 160, 135, 0.5);
  background: var(--green-bg);
}

.trail-nodes {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.45rem;
  padding: 0.5rem 0 1.2rem;
}
/* Subtle central spine line */
.trail-nodes::before {
  content: '';
  position: absolute;
  top: 24px;
  bottom: 24px;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: repeating-linear-gradient(
    to bottom,
    rgba(201, 162, 77, 0.26) 0,
    rgba(201, 162, 77, 0.26) 6px,
    transparent 6px,
    transparent 13px
  );
  pointer-events: none;
}

.node-row {
  position: relative;
  z-index: 1;
  width: 100%;
  display: flex;
  justify-content: center;
  transform: translateX(var(--offset, 0px));
}

.lesson-node {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1.1rem;
  width: min(100%, 440px);
  padding: 0.95rem 1.2rem;
  text-align: left;
  background: linear-gradient(155deg, rgba(24, 24, 21, 0.95), rgba(12, 12, 11, 0.95));
  border: 1px solid rgba(201, 162, 77, 0.22);
  border-radius: 14px;
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}
.lesson-node:hover {
  transform: translateY(-2px);
  border-color: rgba(230, 193, 122, 0.62);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45), 0 0 22px rgba(201, 162, 77, 0.12);
}

/* Medallion circle inside each node */
.node-medallion {
  position: relative;
  flex-shrink: 0;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  background: radial-gradient(circle at 35% 30%, #26231b, #11110f);
  border: 2px solid rgba(201, 162, 77, 0.42);
  color: var(--gold-bright);
  box-shadow: inset 0 0 12px rgba(201, 162, 77, 0.12);
}

/* Current / Next recommended lesson */
.lesson-node.is-next {
  border-color: var(--gold);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5), 0 0 26px rgba(201, 162, 77, 0.18);
}
.lesson-node.is-next .node-medallion {
  background: linear-gradient(155deg, var(--gold-bright), var(--gold));
  color: var(--void);
  border-color: #fff2cc;
  box-shadow: 0 0 0 5px rgba(201, 162, 77, 0.18), 0 0 22px rgba(230, 193, 122, 0.45);
  animation: pulseHalo 2.4s ease-in-out infinite;
}
.next-beacon {
  position: absolute;
  top: -11px;
  right: 16px;
  padding: 0.16rem 0.62rem;
  border-radius: 999px;
  background: linear-gradient(140deg, var(--gold-bright), var(--gold));
  color: var(--void);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* Completed lesson */
.lesson-node.is-done {
  border-color: rgba(73, 160, 135, 0.45);
  background: linear-gradient(155deg, rgba(19, 27, 24, 0.92), rgba(11, 14, 13, 0.95));
}
.lesson-node.is-done .node-medallion {
  background: linear-gradient(155deg, var(--green-bright), var(--green));
  border-color: #9be0ca;
  color: var(--void);
  font-family: var(--sans);
  font-size: 1.2rem;
}

.node-body { flex: 1; min-width: 0; }
.node-title {
  font-family: var(--serif);
  font-size: 1.08rem;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.28;
  margin-bottom: 0.18rem;
}
.lesson-node:hover .node-title { color: var(--gold-bright); }
.node-desc {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}
.node-meta {
  margin-top: 0.42rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
}
.lesson-node.is-done .node-meta { color: var(--green-bright); }
.node-arrow {
  color: rgba(201, 162, 77, 0.55);
  font-family: var(--serif);
  font-size: 1.15rem;
  transition: transform 0.2s ease, color 0.2s ease;
}
.lesson-node:hover .node-arrow { transform: translateX(4px); color: var(--gold-bright); }

/* ---------- Phase 2 Deluxe Vault Teaser ---------- */
.deluxe-card {
  margin-top: 3.4rem;
  padding: 1.8rem 1.8rem;
  border-radius: 14px;
  border: 1px dashed rgba(201, 162, 77, 0.38);
  background: radial-gradient(ellipse at top right, rgba(201, 162, 77, 0.08), rgba(12, 12, 11, 0.92) 60%);
  text-align: center;
}
.deluxe-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.7rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold-bright);
  margin-bottom: 0.55rem;
}
.deluxe-card h3 {
  margin: 0 0 0.55rem;
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 500;
  color: var(--ink);
}
.deluxe-card p {
  margin: 0 auto 1.2rem;
  max-width: 52ch;
  font-size: 0.88rem;
  color: var(--muted);
}
.deluxe-perks {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 1.2rem;
}
.deluxe-perk {
  font-size: 0.76rem;
  color: var(--ink-soft);
  padding: 0.34rem 0.75rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.09);
}
.deluxe-price-pill {
  display: inline-block;
  padding: 0.42rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(201, 162, 77, 0.4);
  color: var(--gold-bright);
  font-size: 0.76rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* ==========================================================================
   INTERACTIVE LESSON STAGE (DUOLINGO-STYLE CARD RUNNER)
   ========================================================================== */
.stage-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: radial-gradient(ellipse at 50% 10%, #171612 0%, #090908 65%, #050505 100%);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.stage-overlay[hidden] { display: none; }

.stage-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(9, 9, 8, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(201, 162, 77, 0.18);
  padding: 0.95rem 1.4rem;
}
.stage-header-inner {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.stage-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(201, 162, 77, 0.28);
  background: transparent;
  color: var(--ink-soft);
  font-size: 1.2rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.stage-close:hover { border-color: var(--gold-bright); color: var(--gold-bright); }

.stage-progress-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.stage-lesson-name {
  display: flex;
  justify-content: space-between;
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.stage-lesson-name span:last-child { color: var(--gold-bright); }
.stage-progress-track {
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}
.stage-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright), var(--green-bright));
  transition: width 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}

.stage-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.4rem 2.5rem;
}
.step-card {
  width: 100%;
  max-width: 680px;
  background: linear-gradient(165deg, rgba(23, 22, 19, 0.96), rgba(12, 12, 11, 0.98));
  border: 1px solid rgba(201, 162, 77, 0.28);
  border-radius: 16px;
  padding: 2rem 2.1rem;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(230, 193, 122, 0.08);
  animation: cardIn 0.32s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.step-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--green-bright);
  padding: 0.24rem 0.65rem;
  border-radius: 999px;
  background: var(--green-bg);
  border: 1px solid rgba(73, 160, 135, 0.32);
  margin-bottom: 0.9rem;
}
.step-badge.is-gold {
  color: var(--gold-bright);
  background: rgba(201, 162, 77, 0.12);
  border-color: rgba(201, 162, 77, 0.32);
}

.step-title {
  margin: 0 0 0.85rem;
  font-family: var(--serif);
  font-size: clamp(1.38rem, 3.6vw, 1.82rem);
  font-weight: 500;
  line-height: 1.25;
  color: var(--gold-bright);
}
.step-body {
  color: var(--ink-soft);
  font-size: 0.97rem;
  line-height: 1.7;
}
.step-body p { margin: 0 0 0.9rem; }
.step-body p:last-child { margin-bottom: 0; }
.step-body strong { color: var(--ink); font-weight: 600; }

.formula-box {
  margin: 1.15rem 0;
  padding: 1rem 1.2rem;
  background: rgba(5, 5, 5, 0.72);
  border: 1px solid rgba(201, 162, 77, 0.28);
  border-left: 3px solid var(--gold);
  border-radius: 8px;
  text-align: center;
  font-size: 1.05rem;
  color: var(--ink);
  overflow-x: auto;
}
.formula-caption {
  display: block;
  margin-top: 0.45rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.bullet-list {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.bullet-list li {
  position: relative;
  padding-left: 1.35rem;
  font-size: 0.93rem;
  color: var(--ink-soft);
}
.bullet-list li::before {
  content: '◆';
  position: absolute;
  left: 0;
  top: 0.12rem;
  font-size: 0.62rem;
  color: var(--gold);
}

/* SVG Graph Diagram Container */
.diagram-frame {
  margin: 1.2rem 0;
  padding: 0.75rem;
  background: #090908;
  border: 1px solid rgba(201, 162, 77, 0.2);
  border-radius: 10px;
}
.diagram-frame svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 230px;
}
.diagram-caption {
  margin-top: 0.45rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  font-style: italic;
}

/* ---------- Reveal Flip Cards ---------- */
.reveal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
  margin-top: 1.15rem;
}
.reveal-tile {
  text-align: left;
  padding: 1rem 1.1rem;
  border-radius: 10px;
  background: rgba(10, 10, 9, 0.85);
  border: 1px solid rgba(201, 162, 77, 0.26);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.22s ease, background 0.22s ease, transform 0.18s ease;
}
.reveal-tile:hover { border-color: var(--gold-bright); transform: translateY(-1px); }
.reveal-tile.is-open {
  border-color: var(--green-bright);
  background: linear-gradient(160deg, rgba(47, 111, 94, 0.16), rgba(10, 12, 11, 0.95));
}
.reveal-front {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-family: var(--serif);
  font-size: 1rem;
  color: var(--gold-bright);
}
.reveal-tile.is-open .reveal-front { color: #9be0ca; }
.reveal-pill {
  font-family: var(--sans);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
}
.reveal-tile.is-open .reveal-pill { color: #9be0ca; border-color: rgba(73, 160, 135, 0.45); }
.reveal-back {
  display: none;
  margin-top: 0.7rem;
  padding-top: 0.7rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.88rem;
  color: var(--ink-soft);
  line-height: 1.55;
}
.reveal-tile.is-open .reveal-back { display: block; animation: fadeUp 0.24s ease forwards; }

/* ---------- Conceptual Choice & True/False ---------- */
.choice-list {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin-top: 1.2rem;
}
.choice-list.tf-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}
.choice-btn {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  text-align: left;
  padding: 0.95rem 1.15rem;
  border-radius: 10px;
  background: rgba(10, 10, 9, 0.85);
  border: 1px solid rgba(201, 162, 77, 0.24);
  color: var(--ink);
  font-size: 0.94rem;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}
.choice-list.tf-grid .choice-btn {
  justify-content: center;
  text-align: center;
  padding: 1.15rem 1rem;
  font-family: var(--serif);
  font-size: 1.1rem;
}
.choice-btn:hover:not(:disabled) {
  border-color: var(--gold-bright);
  background: rgba(201, 162, 77, 0.08);
  transform: translateY(-1px);
}
.choice-key {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--gold);
  border: 1px solid rgba(201, 162, 77, 0.35);
  background: rgba(201, 162, 77, 0.06);
}
.choice-btn.is-correct {
  border-color: var(--green-bright);
  background: var(--green-bg);
  color: #e6fff7;
}
.choice-btn.is-correct .choice-key {
  background: var(--green-bright);
  border-color: var(--green-bright);
  color: var(--void);
}
.choice-btn.is-wrong {
  border-color: var(--rose);
  background: var(--rose-bg);
  animation: gentleShake 0.32s ease;
}
.choice-btn.is-wrong .choice-key {
  border-color: var(--rose);
  color: #f3a6b0;
}

/* ---------- Pair Matching Board ---------- */
.match-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-top: 1.15rem;
}
.match-col {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.match-col-head {
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.15rem;
}
.match-tile {
  padding: 0.8rem 0.95rem;
  border-radius: 9px;
  background: rgba(10, 10, 9, 0.9);
  border: 1px solid rgba(201, 162, 77, 0.24);
  color: var(--ink);
  font-size: 0.88rem;
  text-align: left;
  cursor: pointer;
  min-height: 52px;
  display: flex;
  align-items: center;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.15s ease, opacity 0.25s ease;
}
.match-tile:hover:not(:disabled) { border-color: var(--gold-bright); }
.match-tile.is-selected {
  border-color: var(--gold-bright);
  background: rgba(201, 162, 77, 0.16);
  box-shadow: 0 0 16px rgba(201, 162, 77, 0.2);
}
.match-tile.is-matched {
  border-color: rgba(73, 160, 135, 0.6);
  background: var(--green-bg);
  color: #b7f0dd;
  opacity: 0.72;
  cursor: default;
}
.match-tile.is-wrong {
  border-color: var(--rose);
  background: var(--rose-bg);
  animation: gentleShake 0.32s ease;
}

/* Feedback Banner */
.feedback-box {
  margin-top: 1.15rem;
  padding: 0.9rem 1.05rem;
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.55;
  display: none;
}
.feedback-box.show { display: block; animation: fadeUp 0.24s ease forwards; }
.feedback-box.ok {
  background: var(--green-bg);
  border-left: 3px solid var(--green-bright);
  color: #d6f7ec;
}
.feedback-box.hint {
  background: rgba(201, 162, 77, 0.1);
  border-left: 3px solid var(--gold);
  color: var(--ink-soft);
}
.feedback-box strong { color: #fff; }

/* Stage Footer */
.stage-footer {
  position: sticky;
  bottom: 0;
  z-index: 10;
  background: rgba(9, 9, 8, 0.94);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(201, 162, 77, 0.18);
  padding: 1rem 1.4rem;
}
.stage-footer-inner {
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.stage-hint-text {
  font-size: 0.78rem;
  color: var(--muted);
}

/* Completion Card */
.complete-card {
  text-align: center;
  padding: 2.5rem 2.1rem;
}
.complete-crest {
  width: 78px;
  height: 78px;
  margin: 0 auto 1.2rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 2rem;
  color: var(--void);
  background: linear-gradient(150deg, var(--gold-bright), var(--gold));
  box-shadow: 0 0 0 8px rgba(201, 162, 77, 0.14), 0 0 38px rgba(201, 162, 77, 0.35);
}
.complete-stats {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin: 1.5rem 0;
  flex-wrap: wrap;
}
.complete-stat {
  min-width: 118px;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  background: rgba(5, 5, 5, 0.65);
  border: 1px solid rgba(201, 162, 77, 0.24);
}
.complete-stat .val {
  display: block;
  font-family: var(--serif);
  font-size: 1.5rem;
  color: var(--gold-bright);
  line-height: 1.2;
}
.complete-stat .lbl {
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.complete-takeaways {
  text-align: left;
  margin: 1.3rem 0 1.7rem;
  padding: 1rem 1.2rem;
  border-radius: 10px;
  background: rgba(47, 111, 94, 0.1);
  border: 1px solid rgba(73, 160, 135, 0.25);
}
.complete-takeaways h4 {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--green-bright);
}
.complete-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Animations */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes pulseHalo {
  0%, 100% { box-shadow: 0 0 0 5px rgba(201, 162, 77, 0.16), 0 0 20px rgba(230, 193, 122, 0.4); }
  50% { box-shadow: 0 0 0 9px rgba(201, 162, 77, 0.08), 0 0 30px rgba(230, 193, 122, 0.6); }
}
@keyframes gentleShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* Responsive */
@media (max-width: 640px) {
  .page-frame { inset: 1vh 1.5vw; }
  .hud-inner { padding: 0.7rem 1rem; }
  .node-row { transform: none !important; }
  .section-banner { flex-direction: column; align-items: flex-start; }
  .step-card { padding: 1.45rem 1.25rem; }
  .match-board { grid-template-columns: 1fr; }
  .choice-list.tf-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
