/* ═══════════════════════════════════════════════════
   InvestIQ — "Money skills that last a lifetime"
   Dark · warm · grown-up · data-as-hero
═══════════════════════════════════════════════════ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  /* LJUST TEMA (2026-06-27) — matchar dashboard-hemmet (home.js). Tokens vända
     mörkt→ljust så hela appen delar samma proffsiga ljusa look från en källa. */
  /* surfaces — warm off-white page, white cards */
  --bg:      #F4F6F1;
  --bg-soft: #ECEFE8;
  --surface: #FFFFFF;
  --surface-2:#F4F6F1;

  /* text — deep forest ink → sage greys */
  --ink:   #15241C;
  --ink-2: #5B6A61;
  --ink-3: #93A096;

  /* hairlines on light */
  --line:  #E8EBE3;
  --line-2:#DDE2D8;

  /* primary — emerald green */
  --green:   #2FA56B;
  --green-d: #1C7A4F;
  --green-l: #E9F4EE;

  /* accent — warm gold for "value that grows" */
  --gold:   #DC9A2A;
  --gold-d: #A9761A;
  --gold-l: #FAF1DD;

  --blue:   #3B8FD4;
  --blue-d: #2A6FA8;
  --blue-l: #E7F1FB;

  --coral:  #E37E66;
  --coral-d:#C25F3E;
  --coral-l:#FBEBE5;

  --purple: #8A6FD0;
  --purple-d:#6E54B8;

  --gray:   #ECEFE8;
  --gray-d: #DDE2D8;

  --font:    'Inter', system-ui, sans-serif;
  --display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --num:     'Space Grotesk', 'Inter', sans-serif;
  --mono:    'JetBrains Mono', ui-monospace, monospace;

  --r:    11px;
  --r-lg: 14px;
  --r-xl: 18px;
  --wrap: 1080px;
}

html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
::selection { background: var(--green); color: #06140D; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: 6px; }
#confetti-canvas { position: fixed; inset: 0; z-index: 9999; pointer-events: none; }

/* numbers always feel like a real tool */
/* Mono behålls bara för in-app-HUD:en. Landningens siffror använder nu
   Space Grotesk (--display) precis som dashboard-hemmet — se resp. regel nedan. */
.num, .hud-pill, .rs-val { font-family: var(--num); }


/* ═══════════════════════════════════════════════════
   SCREENS
═══════════════════════════════════════════════════ */
.screen { display: none; min-height: 100vh; flex-direction: column; position: relative; }
.screen.active { display: flex; animation: pop-in .35s cubic-bezier(.34,1.4,.64,1); }
@keyframes pop-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }


/* ═══════════════════════════════════════════════════
   BUTTONS — flat / premium (matchar dashboardens hd-knappar, inte 3D-Duolingo)
═══════════════════════════════════════════════════ */
.btn3d {
  --c: var(--green); --cd: var(--green-d); --ct: #06140D;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  background: var(--c); color: var(--ct);
  border: none; border-radius: var(--r);
  padding: 13px 24px;
  font-family: var(--font); font-size: .9rem; font-weight: 600;
  letter-spacing: .2px; white-space: nowrap;
  cursor: pointer; user-select: none;
  box-shadow: 0 1px 2px rgba(21,36,28,.10);
  transition: transform .12s ease, box-shadow .18s ease, filter .15s ease, background .15s;
}
.btn3d:hover { filter: brightness(.96); box-shadow: 0 8px 20px -10px rgba(21,36,28,.45); }
.btn3d:active { transform: translateY(1px); box-shadow: 0 1px 2px rgba(21,36,28,.12); }
.btn3d.green  { --c: var(--green);  --cd: var(--green-d); --ct: #06140D; }
.btn3d.blue   { --c: var(--blue);   --cd: var(--blue-d);  --ct: #04202E; }
.btn3d.gold   { --c: var(--gold);   --cd: var(--gold-d);  --ct: #2E2102; }
.btn3d.coral  { --c: var(--coral);  --cd: var(--coral-d); --ct: #2E1006; }
.btn3d.gray   { --c: var(--gray);   --cd: var(--gray-d);  --ct: var(--ink-3); cursor: not-allowed; box-shadow: none; }
.btn3d.white  { --c: var(--surface); --cd: transparent; --ct: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn3d.white:hover { background: var(--bg-soft); filter: none; box-shadow: inset 0 0 0 1px var(--line-2); }
.btn3d.white:active { transform: translateY(1px); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn3d-sm { padding: 10px 16px; font-size: .82rem; }
.btn3d-sm:active { transform: translateY(1px); }
.btn-wide { padding-left: 30px; padding-right: 30px; }
.btn-block { width: 100%; }


/* ═══════════════════════════════════════════════════
   MASCOT (kept for app result screens)
═══════════════════════════════════════════════════ */
.mascot-stage { display: inline-block; width: 230px; height: 230px; }
.mascot-stage svg { width: 100%; height: 100%; overflow: visible; }
.logo-mark { display: inline-flex; width: 26px; height: 26px; border-radius: 8px; background: var(--surface); border: 1px solid rgba(52,194,122,.4); align-items: center; justify-content: center; }
.logo-mark svg { width: 60%; height: 60%; }
.m-body-wrap { transform-origin: 110px 200px; animation: bob 3.4s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-9px) rotate(-1.5deg); } }
.m-sprout { transform-origin: 110px 70px; animation: sway 3.4s ease-in-out infinite; }
@keyframes sway { 0%,100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }


/* ═══════════════════════════════════════════════════
   NAV
═══════════════════════════════════════════════════ */
.site-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 36px; position: sticky; top: 0; z-index: 60;
  background: rgba(244,246,241,.85); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.logo {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--display); font-weight: 700; font-size: 1.3rem;
  color: var(--ink); text-decoration: none; letter-spacing: -.3px;
}
.logo .logo-mark svg { stroke: var(--green); }
.nav-right { display: flex; align-items: center; gap: 20px; }
.nav-links { display: flex; gap: 22px; }
.nav-link { font-size: .9rem; font-weight: 500; color: var(--ink-2); text-decoration: none; transition: color .15s; }
.nav-link:hover { color: var(--ink); }

/* language switcher */
.lang { position: relative; }
.lang-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink-2);
  font-family: var(--font); font-size: .82rem; font-weight: 500;
  padding: 8px 12px; border-radius: 999px; cursor: pointer; transition: all .15s;
}
.lang-btn:hover { color: var(--ink); border-color: var(--ink-3); }
.lang-btn .globe { width: 14px; height: 14px; }
.lang-btn .caret { width: 11px; height: 11px; transition: transform .2s; }
.lang.open .caret { transform: rotate(180deg); }
.lang-menu {
  position: absolute; top: calc(100% + 8px); right: 0; min-width: 150px;
  max-height: 70vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px;
  padding: 6px; display: none; flex-direction: column; gap: 2px; z-index: 80;
  box-shadow: 0 12px 30px rgba(0,0,0,.4);
}
.lang.open .lang-menu { display: flex; }
.lang-opt {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: none; border: none; color: var(--ink); cursor: pointer;
  font-family: var(--font); font-size: .86rem; font-weight: 500; text-align: left;
  padding: 9px 11px; border-radius: 8px; transition: background .12s;
}
.lang-opt:hover { background: var(--surface-2); }
.lang-opt .tick { color: var(--green); opacity: 0; }
.lang-opt.active .tick { opacity: 1; }


/* ═══════════════════════════════════════════════════
   HERO
═══════════════════════════════════════════════════ */
.hero {
  max-width: var(--wrap); margin: 0 auto; width: 100%;
  display: grid; grid-template-columns: 1.02fr .98fr; gap: 44px; align-items: center;
  padding: 56px 36px 64px; position: relative;
}
.hero-kicker {
  display: inline-block; font-family: var(--font); font-size: .74rem; font-weight: 600; letter-spacing: .2px;
  color: var(--green-d); background: var(--green-l); border: 1px solid rgba(47,165,107,.22);
  padding: 6px 13px; border-radius: 999px; margin-bottom: 20px;
}
.hero-copy h1 {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(2.1rem, 4.4vw, 3.2rem); line-height: 1.07;
  letter-spacing: -.8px; color: var(--ink); margin-bottom: 18px;
}
.hero-copy h1 .hl { color: var(--green); position: relative; white-space: nowrap; }
.hero-copy h1 .hl::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 4px; height: 9px;
  background: var(--gold); opacity: .32; border-radius: 6px; z-index: -1;
}
.hero-sub { font-size: 1.02rem; font-weight: 400; color: var(--ink-2); line-height: 1.62; max-width: 430px; margin-bottom: 28px; }
.hero-btns { display: flex; gap: 12px; flex-wrap: wrap; }


/* ═══════════════════════════════════════════════════
   INTERACTIVE PLOT (hero centerpiece)
═══════════════════════════════════════════════════ */
.plot { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 22px; box-shadow: 0 20px 44px -26px rgba(20,40,30,.4); }
.plot-head { display: flex; flex-direction: column; gap: 3px; margin-bottom: 14px; }
.plot-head-k { font-size: .76rem; font-weight: 500; color: var(--ink-3); }
.plot-figure { font-family: var(--num); font-weight: 700; font-size: 2.3rem; color: var(--ink); letter-spacing: -1px; line-height: 1; }
.plot-frame { position: relative; padding: 4px 4px 20px 40px; }
#plot-svg { display: block; width: 100%; height: 180px; overflow: visible; }
.plot-grid-line { stroke: var(--line); stroke-width: 1.5; }
.plot-grid-base { stroke: var(--line-2); stroke-width: 1.5; }
.plot-ghost { fill: none; stroke: var(--ink-3); stroke-width: 2; stroke-dasharray: 2 7; stroke-linecap: round; opacity: .55; }
.plot-area { fill: url(#plot-grad); }
.plot-curve { fill: none; stroke: var(--green); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.plot-dot-r { fill: var(--green); opacity: .22; }
.plot-dot { fill: var(--green); stroke: var(--surface); stroke-width: 3.5; }
.plot-axis-y { position: absolute; left: 0; top: 4px; bottom: 20px; width: 38px; display: flex; flex-direction: column-reverse; justify-content: space-between; }
.plot-axis-y span { font-family: var(--num); font-size: .58rem; font-weight: 500; color: var(--ink-3); text-align: right; }
.plot-axis-x { position: absolute; left: 40px; right: 4px; bottom: 0; display: flex; justify-content: space-between; }
.plot-axis-x span { font-family: var(--num); font-size: .58rem; font-weight: 500; color: var(--ink-3); }
.plot-control { margin-top: 10px; }
.plot-control-label { display: flex; align-items: baseline; justify-content: space-between; font-size: .8rem; font-weight: 500; color: var(--ink-2); margin-bottom: 10px; }
.plot-control-label strong { font-family: var(--num); font-size: 1.05rem; font-weight: 700; color: var(--green-d); }
.plot-control-foot { display: flex; justify-content: space-between; margin-top: 12px; font-size: .72rem; font-weight: 500; color: var(--ink-2); }
.plot-control-foot b { font-family: var(--num); color: var(--ink); font-weight: 700; }
.plot-control-foot .growth b { color: var(--gold); }
#years-range { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 999px; background: var(--gray); cursor: pointer; }
#years-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 22px; height: 22px; border-radius: 50%; background: var(--green); border: 4px solid var(--surface); box-shadow: 0 2px 0 var(--green-d); cursor: grab; }
#years-range::-webkit-slider-thumb:active { cursor: grabbing; }
#years-range::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--green); border: 4px solid var(--surface); box-shadow: 0 2px 0 var(--green-d); cursor: grab; }


/* ═══════════════════════════════════════════════════
   VALUE STRIP
═══════════════════════════════════════════════════ */
.values {
  max-width: var(--wrap); margin: 0 auto; width: 100%;
  display: grid; grid-template-columns: repeat(3,1fr); gap: 14px;
  padding: 0 36px 64px;
}
.value {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 18px 20px; box-shadow: 0 16px 36px -26px rgba(20,40,30,.35);
}
.value-ic { width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.value-ic svg { width: 22px; height: 22px; }
/* Mjuka tint-brickor som på dashboarden — grön/guld, ingen blå.
   Dubbelklass för att slå .value span (som annars sätter ikonfärgen). */
.value-ic.green-ic { background: var(--green-l); color: var(--green-d); }
.value-ic.gold-ic  { background: var(--gold-l);  color: var(--gold-d); }
.value-ic.blue-ic  { background: var(--green-l); color: var(--green-d); }
.value strong { display: block; font-size: .96rem; font-weight: 600; color: var(--ink); }
.value span { font-size: .8rem; font-weight: 400; color: var(--ink-2); }


/* ═══════════════════════════════════════════════════
   FEATURE ROWS
═══════════════════════════════════════════════════ */
.features { max-width: var(--wrap); margin: 0 auto; width: 100%; padding: 30px 36px; }
.row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: center;
  padding: 56px 0;
}
.row.reverse .row-art { order: 2; }
.row-copy h2 {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(1.5rem, 3.2vw, 2.1rem); line-height: 1.14; letter-spacing: -.5px;
  color: var(--ink); margin-bottom: 14px;
}
.row-copy p { font-size: 1rem; font-weight: 400; color: var(--ink-2); line-height: 1.62; margin-bottom: 22px; max-width: 420px; }


/* ── emblems ── */
.emblem { position: relative; border-radius: var(--r-xl); height: 320px; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1px solid var(--line); background: var(--surface); }
.emblem-streak { background: var(--surface); }
.flame { width: 64px; height: 64px; display: grid; place-items: center; filter: drop-shadow(0 10px 18px rgba(220,154,42,.30)); }
/* Subtil flimmer: liten svaj på hela flamman + långsam glöd-puls på inre kärnan,
   med olika perioder så det aldrig ser mekaniskt/repetitivt ut. Låg amplitud = proffsigt. */
.flame svg { width: 100%; height: 100%; transform-origin: 50% 92%; animation: flameSway 3.4s ease-in-out infinite; }
.flame svg path:last-child { transform-box: fill-box; transform-origin: 50% 85%; animation: flameCore 2.3s ease-in-out infinite; }
@keyframes flameSway {
  0%, 100% { transform: scale(1, 1); }
  30%      { transform: scale(1.015, .985) translateY(-.4px); }
  55%      { transform: scale(.99, 1.02); }
  80%      { transform: scale(1.008, .995) translateY(-.2px); }
}
@keyframes flameCore {
  0%, 100% { opacity: 1;   transform: scaleY(1); }
  40%      { opacity: .82; transform: scaleY(.94); }
  70%      { opacity: .93; transform: scaleY(1.03); }
}
@media (prefers-reduced-motion: reduce) {
  .flame svg, .flame svg path:last-child { animation: none; }
}
.streak-num { font-family: var(--num); font-weight: 700; font-size: 3.2rem; color: var(--gold); line-height: 1; margin-top: 6px; }
.streak-label { font-size: .82rem; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: 1px; }
.streak-days { display: flex; gap: 8px; margin-top: 20px; }
.sd { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .7rem; font-weight: 600; color: var(--ink-3); background: var(--bg-soft); border: 1px solid var(--line); }
.sd.on { background: var(--gold); border-color: var(--gold-d); color: #2E2102; }

.emblem-quiz { background: var(--surface); }
.quiz-card { width: 80%; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; }
.qc-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.qc-tag { font-family: var(--display); font-size: .62rem; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .5px; }
.qc-hearts { color: var(--coral); font-size: .6rem; letter-spacing: 1px; }
.qc-q { font-family: var(--display); font-weight: 500; font-size: 1rem; color: var(--ink); margin-bottom: 14px; }
.qc-opt { border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; font-size: .8rem; font-weight: 500; color: var(--ink-2); margin-bottom: 8px; }
.qc-opt.right { border-color: var(--green); background: var(--green-l); color: var(--green); margin-bottom: 0; }
.float-xp { position: absolute; top: 26px; right: 30px; background: var(--gold); color: #2E2102; font-weight: 700; font-size: .78rem; padding: 8px 14px; border-radius: 999px; box-shadow: 0 10px 22px -10px rgba(169,118,26,.55); }


/* ═══════════════════════════════════════════════════
   COURSES BAND
═══════════════════════════════════════════════════ */
.courses-band { background: var(--bg-soft); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 72px 36px; }
.band-head { max-width: var(--wrap); margin: 0 auto 36px; text-align: center; }
.band-head h2 { font-family: var(--display); font-weight: 600; font-size: clamp(1.7rem,3.4vw,2.4rem); letter-spacing: -.5px; color: var(--ink); margin-bottom: 10px; }
.band-head p { font-size: 1rem; font-weight: 400; color: var(--ink-2); }
.course-grid { max-width: var(--wrap); margin: 0 auto; display: grid; grid-template-columns: repeat(2,1fr); gap: 16px; }

.course-card {
  position: relative; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl);
  padding: 22px; display: flex; align-items: center; gap: 18px;
  box-shadow: 0 18px 40px -26px rgba(20,40,30,.35);
  transition: transform .1s, border-color .15s;
}
.course-card:hover { transform: translateY(-2px); border-color: var(--line-2); }
.course-card:active { transform: translateY(0); }
.cc-badge { width: 60px; height: 60px; border-radius: 16px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: #06140D; }
.cc-badge svg { width: 28px; height: 28px; }
/* Landningens kursbrickor: mjuka grön/guld-tinter (matchar dashboarden). */
.cc-badge-green { background: var(--green-l); color: var(--green-d); }
.cc-badge-gold  { background: var(--gold-l);  color: var(--gold-d); }
.cc-main { flex: 1; min-width: 0; }
.cc-title { font-family: var(--display); font-weight: 600; font-size: 1.18rem; color: var(--ink); margin-bottom: 3px; }
.cc-desc { font-size: .84rem; font-weight: 400; color: var(--ink-2); line-height: 1.45; margin-bottom: 12px; }
.cc-foot { display: flex; align-items: center; gap: 10px; }
.cc-track { flex: 1; height: 8px; background: var(--gray); border-radius: 999px; overflow: hidden; }
.cc-fill { height: 100%; border-radius: 999px; background: var(--cc); transition: width .5s ease; }
.cc-count { font-family: var(--display); font-size: .72rem; font-weight: 600; color: var(--ink-3); white-space: nowrap; }
.cc-done { color: var(--green); }


/* ═══════════════════════════════════════════════════
   STATS BAND
═══════════════════════════════════════════════════ */
.stats-band { max-width: var(--wrap); margin: 0 auto; width: 100%; display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; padding: 72px 36px; text-align: center; }
.stat-n { display: block; font-family: var(--num); font-weight: 700; font-size: 2.4rem; color: var(--green-d); letter-spacing: -1px; line-height: 1; margin-bottom: 6px; }
.stat-l { font-size: .8rem; font-weight: 400; color: var(--ink-2); }
.stat:nth-child(2) .stat-n { color: var(--gold); }
.stat:nth-child(3) .stat-n { color: var(--green-d); }
.stat:nth-child(4) .stat-n { color: var(--gold); }


/* ═══════════════════════════════════════════════════
   CTA
═══════════════════════════════════════════════════ */
.cta { background: var(--surface); border-top: 1px solid var(--line); text-align: center; padding: 68px 36px 76px; position: relative; overflow: hidden; }
/* Maskoten togs bort från landningens CTA — för lekfull för den proffsiga looken
   (behålls på resultat-/firande-skärmar). */
.cta-mascot { display: none; }
.cta h2 { font-family: var(--display); font-weight: 600; font-size: clamp(1.8rem,3.8vw,2.8rem); line-height: 1.08; letter-spacing: -.5px; color: var(--ink); margin-bottom: 14px; }
.cta p { font-size: 1.02rem; font-weight: 400; color: var(--ink-2); margin-bottom: 28px; }
.cta .btn3d.green { margin: 0 auto; }


/* ═══════════════════════════════════════════════════
   FOOTER
═══════════════════════════════════════════════════ */
.site-footer { display: flex; align-items: center; justify-content: space-between; max-width: var(--wrap); margin: 0 auto; width: 100%; padding: 26px 36px; border-top: 1px solid var(--line); }
.logo-sm { font-size: 1rem; }
.logo-sm .logo-mark { width: 22px; height: 22px; }
.footer-copy { font-family: var(--font); font-size: .72rem; font-weight: 500; color: var(--ink-3); }


/* ═══════════════════════════════════════════════════
   APP — top HUD
═══════════════════════════════════════════════════ */
.app-screen { background: var(--bg); }
#course-screen {
  background:
    radial-gradient(75% 30% at 50% -4%, rgba(52,194,122,.13), transparent 60%),
    radial-gradient(45% 24% at 88% 52%, rgba(233,180,60,.06), transparent 70%),
    radial-gradient(40% 24% at 10% 78%, rgba(79,176,232,.05), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
.app-nav { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: rgba(244,246,241,.9); backdrop-filter: blur(10px); z-index: 20; }
.back-btn { background: none; border: none; font-family: var(--font); font-size: .88rem; font-weight: 500; color: var(--ink-2); cursor: pointer; display: flex; align-items: center; gap: 6px; transition: color .15s; }
.back-btn:hover { color: var(--ink); }
.hud { display: flex; gap: 10px; }
.hud-pill { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: .95rem; padding: 5px 14px 5px 10px; border-radius: 999px; }
.hud-pill.streak { color: var(--gold); background: var(--gold-l); }
.hud-pill.xp { color: var(--green); background: var(--green-l); }
.hud-ic { font-size: .9rem; }

.app-body { flex: 1; max-width: 600px; width: 100%; margin: 0 auto; padding: 34px 22px 70px; }


/* COURSE SELECT */
.pick-head { text-align: center; margin-bottom: 20px; }

/* difficulty segmented control */
.level-pick { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 26px; }
.level-pick-label { font-family: var(--mono); font-size: .68rem; font-weight: 500; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-3); }
.level-seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 4px; gap: 4px; }
.level-opt { background: none; border: none; cursor: pointer; font-family: var(--font); font-size: .82rem; font-weight: 600; color: var(--ink-2); padding: 8px 16px; border-radius: 9px; transition: background .15s, color .15s; }
.level-opt:hover { color: var(--ink); }
.level-opt.active { background: var(--green); color: #06140D; }
.pick-head h1 { font-family: var(--display); font-weight: 600; font-size: clamp(1.6rem,5vw,2.2rem); line-height: 1.1; letter-spacing: -.5px; color: var(--ink); margin-bottom: 8px; }
.pick-head p { font-size: .9rem; font-weight: 400; color: var(--ink-2); }
.pick-list { display: flex; flex-direction: column; gap: 14px; }
.pick-row { display: flex; align-items: center; gap: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 18px; cursor: pointer; transition: transform .1s, border-color .15s; }
.pick-row:hover { transform: translateY(-2px); border-color: var(--line-2); }
.pick-row:active { transform: translateY(0); }
.pick-badge { width: 56px; height: 56px; border-radius: 16px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: #06140D; }
.pick-badge svg { width: 26px; height: 26px; }
.pick-main { flex: 1; min-width: 0; }
.pick-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 3px; }
.pick-title { font-family: var(--display); font-weight: 600; font-size: 1.12rem; color: var(--ink); }
.pick-tag { font-family: var(--mono); font-size: .62rem; font-weight: 500; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-3); background: var(--gray); padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.pick-tag.done { color: var(--green); background: var(--green-l); }
.pick-desc { font-size: .8rem; font-weight: 400; color: var(--ink-2); margin-bottom: 11px; }
.pick-foot { display: flex; align-items: center; gap: 10px; }
.pick-track { flex: 1; height: 8px; background: var(--gray); border-radius: 999px; overflow: hidden; }
.pick-fill { height: 100%; border-radius: 999px; background: var(--cc); transition: width .5s ease; }
.pick-count { font-family: var(--mono); font-size: .72rem; font-weight: 500; color: var(--ink-3); white-space: nowrap; }


/* ═══════════════════════════════════════════════════
   COURSE DETAIL — lesson path
═══════════════════════════════════════════════════ */
.course-banner { max-width: 600px; width: 100%; margin: 18px auto 0; display: flex; align-items: center; gap: 14px; background: var(--cc); color: #06140D; border-radius: var(--r-xl); padding: 18px 20px; box-shadow: 0 4px 0 var(--ccd); position: relative; }
.course-banner-back { background: rgba(0,0,0,.16); border: none; color: inherit; width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; transition: background .15s; }
.course-banner-back:hover { background: rgba(0,0,0,.26); }
.course-banner-main { flex: 1; min-width: 0; }
.course-banner-k { font-family: var(--mono); font-size: .66rem; font-weight: 500; text-transform: uppercase; letter-spacing: 1.2px; opacity: .8; margin-bottom: 2px; }
.course-banner-main h2 { font-family: var(--display); font-weight: 600; font-size: 1.35rem; line-height: 1.1; }
.course-banner-main p { font-size: .8rem; font-weight: 400; opacity: .85; margin-top: 3px; }
.course-banner-icon { width: 50px; height: 50px; flex-shrink: 0; opacity: .85; }
.course-banner-icon svg { width: 100%; height: 100%; }

.path { max-width: 600px; width: 100%; margin: 0 auto; padding: 44px 22px 90px; display: flex; flex-direction: column; align-items: center; gap: 32px; position: relative; }
.path-trail { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; overflow: visible; }
.trail-done { fill: none; stroke: var(--green); stroke-width: 4; stroke-linecap: round; opacity: .5; }
.trail-todo { fill: none; stroke: var(--line-2); stroke-width: 3; stroke-dasharray: 1 11; stroke-linecap: round; }
.node-wrap { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; }
/* checkpoint node sits apart as the course final */
.node-wrap-cp { margin-top: 18px; padding-top: 26px; }
.node-wrap-cp::before { content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 2px; height: 18px; background: var(--line-2); border-radius: 2px; }
.node-cp.done { background: var(--gold); box-shadow: 0 5px 0 var(--gold-d); color: #2E2102; }
.node-cp.done:active { box-shadow: 0 1px 0 var(--gold-d); }
.badge-crown { position: absolute; top: -9px; right: -9px; width: 24px; height: 24px; color: var(--gold); background: var(--surface); border: 1px solid var(--line-2); border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.badge-crown svg { width: 14px; height: 14px; }
.cc-badge, .pick-badge { position: relative; }
.node {
  width: 74px; height: 74px; border-radius: 50%; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; position: relative;
  font-family: var(--display); font-weight: 600; font-size: 1.4rem; color: #06140D;
  transition: transform .08s, box-shadow .08s;
}
.node svg { width: 30px; height: 30px; }
.node.done { background: var(--green); box-shadow: 0 5px 0 var(--green-d); color: #06140D; }
.node.open { background: var(--surface); box-shadow: 0 5px 0 var(--line-2); color: var(--green); border: 1px solid var(--line-2); }
.node.open:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--line-2); }
.node.current { background: var(--gold); box-shadow: 0 6px 0 var(--gold-d); color: #2E2102; animation: node-bounce 1.6s ease-in-out infinite; filter: drop-shadow(0 0 16px rgba(233,180,60,.4)); }
.node.locked { background: var(--gray); box-shadow: 0 5px 0 var(--gray-d); color: var(--ink-3); cursor: not-allowed; }
.node:not(.locked):hover { transform: translateY(-2px); }
.node:not(.locked):active { transform: translateY(4px); box-shadow: 0 1px 0 var(--green-d); }
.node.current:active { box-shadow: 0 1px 0 var(--gold-d); }
@keyframes node-bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
.node-ring { position: absolute; inset: -8px; border-radius: 50%; border: 3px solid var(--gold); opacity: .35; animation: ring-pulse 1.6s ease-in-out infinite; }
@keyframes ring-pulse { 0%,100% { transform: scale(1); opacity: .35; } 50% { transform: scale(1.12); opacity: 0; } }
.node-label { margin-top: 12px; font-size: .8rem; font-weight: 600; color: var(--ink-2); text-align: center; max-width: 150px; }
.node.locked + .node-label { color: var(--ink-3); }
.node-start { position: absolute; top: -26px; left: 50%; transform: translateX(-50%); z-index: 3; background: var(--gold); color: #2E2102; border: none; font-family: var(--mono); font-size: .6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; padding: 5px 11px; border-radius: 8px; white-space: nowrap; box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.node-start::after { content: ''; position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%); border: 5px solid transparent; border-top-color: var(--gold); }
.node-wrap:nth-child(2) { transform: translateX(-58px); }
.node-wrap:nth-child(3) { transform: translateX(-80px); }
.node-wrap:nth-child(4) { transform: translateX(-58px); }
.node-wrap:nth-child(5) { transform: translateX(0); }
.node-wrap:nth-child(6) { transform: translateX(58px); }
.node-wrap:nth-child(7) { transform: translateX(80px); }
.node-wrap.node-wrap-cp { transform: translateX(0); }


/* ═══════════════════════════════════════════════════
   QUIZ
═══════════════════════════════════════════════════ */
.lesson-topbar { display: flex; align-items: center; gap: 16px; padding: 16px 22px; max-width: 640px; width: 100%; margin: 0 auto; }
.close-btn { background: none; border: none; color: var(--ink-3); width: 44px; height: 44px; margin: -7px; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: color .15s; }
.close-btn:hover { color: var(--ink); }
.prog-track { flex: 1; height: 14px; background: var(--gray); border-radius: 999px; overflow: hidden; }
.prog-fill { height: 100%; border-radius: 999px; background: var(--green); transition: width .4s cubic-bezier(.34,1.4,.64,1); position: relative; }
.hearts { display: flex; gap: 5px; align-items: center; }
.heart { font-size: 1.1rem; line-height: 1; transition: transform .2s; }
.heart::before { content: '❤'; color: var(--coral); }
.heart.lost::before { content: '🤍'; filter: grayscale(1); opacity: .4; }
.heart.shake { animation: hshake .4s ease; }
@keyframes hshake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-4px) scale(.85)} 75%{transform:translateX(4px) scale(.85)} }

.question-area { flex: 1; max-width: 600px; width: 100%; margin: 0 auto; padding: 30px 22px 0; }
.q-step { font-family: var(--mono); font-size: .7rem; font-weight: 500; text-transform: uppercase; letter-spacing: 1.4px; color: var(--ink-3); margin-bottom: 14px; }
.question-text { font-family: var(--display); font-weight: 500; font-size: clamp(1.35rem,4vw,1.7rem); line-height: 1.28; color: var(--ink); margin-bottom: 28px; }
.options-list { display: flex; flex-direction: column; gap: 12px; }
.option-btn {
  background: var(--surface); border: 1px solid var(--line-2); border-bottom-width: 3px; border-radius: var(--r);
  padding: 16px 18px; text-align: left; cursor: pointer;
  font-family: var(--font); font-size: .96rem; font-weight: 500; color: var(--ink);
  display: flex; align-items: center; gap: 14px; line-height: 1.4;
  transition: transform .08s, border-color .12s, background .12s;
}
.option-btn:hover:not(:disabled) { background: var(--surface-2); }
.option-btn:active:not(:disabled) { transform: translateY(2px); border-bottom-width: 1px; }
.option-btn.selected { border-color: var(--green); background: var(--green-l); color: var(--ink); }
.option-btn.correct { border-color: var(--green) !important; background: var(--green-l) !important; color: var(--green) !important; }
.option-btn.wrong { border-color: var(--coral) !important; background: var(--coral-l) !important; color: var(--coral) !important; }
.option-btn:disabled { cursor: default; }
.opt-key { width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0; border: 1px solid var(--line-2); display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-weight: 500; font-size: .78rem; color: var(--ink-3); transition: all .12s; }
.option-btn.selected .opt-key { border-color: var(--green); color: var(--green); }
.option-btn.correct .opt-key { border-color: var(--green); background: var(--green); color: #06140D; }
.option-btn.wrong .opt-key { border-color: var(--coral); background: var(--coral); color: #2E1006; }

/* question-type badge (True/False, Scenario) */
.q-type-badge { display: inline-block; align-self: flex-start; margin-bottom: 12px; padding: 5px 12px; border-radius: 999px; background: var(--gold-l, rgba(233,180,60,.14)); color: var(--gold, #E9B43C); border: 1px solid rgba(233,180,60,.35); font-family: var(--mono); font-size: .68rem; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; }

/* True/False two-up layout */
.options-list.tf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.option-btn.tf-btn { flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; padding: 26px 14px; font-size: 1.05rem; font-weight: 600; }
.tf-mark { width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0; border: 1px solid var(--line-2); display: flex; align-items: center; justify-content: center; font-size: 1.15rem; color: var(--ink-3); transition: all .12s; }
.option-btn.tf-btn.selected .tf-mark { border-color: var(--green); color: var(--green); }
.option-btn.tf-btn.correct .tf-mark { border-color: var(--green); background: var(--green); color: #06140D; }
.option-btn.tf-btn.wrong .tf-mark { border-color: var(--coral); background: var(--coral); color: #2E1006; }
@media (max-width: 460px) { .options-list.tf-grid { grid-template-columns: 1fr 1fr; } .option-btn.tf-btn { padding: 20px 8px; font-size: .95rem; } }

/* Matching question: two columns of tap-to-link items */
.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.match-col { display: flex; flex-direction: column; gap: 10px; }
.match-item { position: relative; background: var(--surface); border: 1px solid var(--line-2); border-bottom-width: 3px; border-radius: var(--r); padding: 14px 14px 14px 40px; text-align: left; cursor: pointer; font-family: var(--font); font-size: .9rem; font-weight: 500; color: var(--ink); line-height: 1.35; transition: transform .08s, border-color .12s, background .12s; min-height: 56px; display: flex; align-items: center; }
.match-item:active { transform: translateY(2px); border-bottom-width: 1px; }
.match-item.selected { border-color: var(--gold, #E9B43C); background: rgba(233,180,60,.10); }
.match-item.paired { border-color: var(--green); background: var(--green-l); }
.match-item.correct { border-color: var(--green) !important; background: var(--green-l) !important; color: var(--green) !important; }
.match-item.wrong { border-color: var(--coral) !important; background: var(--coral-l) !important; color: var(--coral) !important; }
.match-badge { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: .72rem; font-weight: 600; color: #06140D; background: transparent; }
.match-item.paired .match-badge { background: var(--green); }
.match-item.correct .match-badge { background: var(--green); }
.match-item.wrong .match-badge { background: var(--coral); color: #2E1006; }

.check-wrap { max-width: 600px; width: 100%; margin: 0 auto; padding: 22px; }
#check-btn.ready { --c: var(--green); --cd: var(--green-d); --ct: #06140D; cursor: pointer; }

/* Kursfärgad accent på lektionsskärmen (--qc/--qcd sätts i renderQuestion) + luftigare komposition */
#lesson-screen { --qc: var(--green); --qcd: var(--green-d); }
#lesson-screen .question-area { display: flex; flex-direction: column; justify-content: safe center; overflow-y: auto; }
#lesson-screen .prog-fill { background: var(--qc); }
#lesson-screen .option-btn.selected { border-color: var(--qc); background: color-mix(in srgb, var(--qc) 12%, var(--surface)); }
#lesson-screen .option-btn.selected .opt-key { border-color: var(--qc); color: var(--qc); }
#lesson-screen .option-btn.tf-btn.selected .tf-mark { border-color: var(--qc); color: var(--qc); }
#lesson-screen .q-type-badge { background: color-mix(in srgb, var(--qc) 13%, #fff); color: var(--qc); border-color: color-mix(in srgb, var(--qc) 42%, transparent); }
#lesson-screen #check-btn.ready { --c: var(--qc); --cd: var(--qcd); }
@keyframes qfade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
#lesson-screen .question-text.qin { animation: qfade .4s cubic-bezier(.34,1.4,.64,1); }

/* feedback bottom-sheet */
.feedback-bar { position: fixed; left: 0; right: 0; bottom: 0; padding: 22px 22px 28px; transform: translateY(110%); transition: transform .35s cubic-bezier(.34,1.3,.64,1); z-index: 40; border-top: 1px solid transparent; }
.feedback-bar.show { transform: translateY(0); }
.feedback-bar.correct-feedback { background: #E9F4EE; border-color: rgba(47,165,107,.4); box-shadow: 0 -10px 34px -10px rgba(20,40,30,.14); }
.feedback-bar.wrong-feedback { background: #FBEBE5; border-color: rgba(226,127,102,.45); box-shadow: 0 -10px 34px -10px rgba(20,40,30,.14); }
.feedback-content { max-width: 600px; margin: 0 auto; }
.feedback-header { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.feedback-icon { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--surface); }
.correct-feedback .feedback-icon { color: var(--green); } .wrong-feedback .feedback-icon { color: var(--coral); }
.fb-icon { display: none; } .correct-feedback .fb-icon-correct { display: block; } .wrong-feedback .fb-icon-wrong { display: block; }
.feedback-label { font-family: var(--display); font-weight: 600; font-size: 1.25rem; }
.correct-feedback .feedback-label { color: var(--green); } .wrong-feedback .feedback-label { color: var(--coral); }
.feedback-explanation { font-size: .9rem; font-weight: 400; color: var(--ink-2); line-height: 1.55; margin-bottom: 16px; }
#feedback-btn { --c: var(--green); --cd: var(--green-d); --ct: #06140D; }
.wrong-feedback #feedback-btn { --c: var(--coral); --cd: var(--coral-d); --ct: #2E1006; }


/* ═══════════════════════════════════════════════════
   RESULTS / GAME OVER
═══════════════════════════════════════════════════ */
#results-screen, #gameover-screen { align-items: center; justify-content: center; padding: 24px; }
.result-card { background: transparent; max-width: 420px; width: 100%; text-align: center; padding: 12px 6px; animation: pop-in .45s cubic-bezier(.34,1.4,.64,1); }
.result-mascot { width: 150px; height: 150px; }
.result-title { font-family: var(--display); font-weight: 600; font-size: 1.8rem; color: var(--gold); letter-spacing: -.4px; margin-bottom: 4px; }
.result-sub { font-size: .92rem; font-weight: 400; color: var(--ink-2); margin-bottom: 26px; }
.result-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin-bottom: 14px; }
.result-stat { border-radius: var(--r-lg); padding: 14px 8px 12px; border: 1px solid; }
.result-stat .rs-label { display: block; font-family: var(--mono); font-size: .6rem; font-weight: 500; text-transform: uppercase; letter-spacing: .6px; margin-bottom: 6px; }
.result-stat .rs-val { font-weight: 700; font-size: 1.4rem; }
.gold-stat { background: var(--gold-l); border-color: rgba(233,180,60,.35); } .gold-stat .rs-label, .gold-stat .rs-val { color: var(--gold); }
.green-stat { background: var(--green-l); border-color: rgba(52,194,122,.35); } .green-stat .rs-label, .green-stat .rs-val { color: var(--green); }
.blue-stat { background: var(--blue-l); border-color: rgba(79,176,232,.35); } .blue-stat .rs-label, .blue-stat .rs-val { color: var(--blue); }
.result-correct-line { font-family: var(--mono); font-size: .82rem; font-weight: 500; color: var(--ink-3); margin-bottom: 24px; }
.result-btns { display: flex; flex-direction: column; gap: 12px; }
.go-text { font-size: .92rem; font-weight: 400; color: var(--ink-2); line-height: 1.55; margin: 8px 0 26px; }
#gameover-screen .result-title { color: var(--coral); }


/* ═══════════════════════════════════════════════════
   RESUME CARD (continue learning)
═══════════════════════════════════════════════════ */
.resume-card {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; cursor: pointer;
  background: linear-gradient(100deg, var(--green-l), transparent 70%), var(--surface);
  border: 1px solid var(--green-d); border-bottom-width: 3px; border-radius: var(--r-xl);
  padding: 16px 18px; margin-bottom: 22px; color: var(--ink);
  transition: transform .1s, border-color .15s, filter .15s;
}
.resume-card:hover { transform: translateY(-2px); filter: brightness(1.05); }
.resume-card:active { transform: translateY(0); border-bottom-width: 1px; }
.resume-ic { width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%; background: var(--green); color: #06140D; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 5px var(--green-l); }
.resume-ic svg { width: 18px; height: 18px; margin-left: 2px; }
.resume-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.resume-k { font-family: var(--mono); font-size: .64rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1.2px; color: var(--green); }
.resume-title { font-family: var(--display); font-weight: 600; font-size: 1.04rem; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.resume-arrow { width: 22px; height: 22px; flex-shrink: 0; color: var(--ink-3); }


/* ═══════════════════════════════════════════════════
   MILESTONES (achievements)
═══════════════════════════════════════════════════ */
.milestones-link {
  display: flex; align-items: center; justify-content: center; gap: 8px; margin: 22px auto 0;
  background: transparent; border: 1px solid var(--line-2); border-radius: 999px;
  color: var(--ink-2); font-family: var(--font); font-size: .82rem; font-weight: 600;
  padding: 9px 18px; cursor: pointer; transition: color .15s, border-color .15s, background .15s;
}
.milestones-link:hover { color: var(--gold); border-color: rgba(233,180,60,.4); background: var(--gold-l); }
.milestones-link svg { width: 15px; height: 15px; }

#ach-overlay { position: fixed; inset: 0; background: rgba(6,12,9,.66); backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center; z-index: 200; padding: 18px; }
#ach-overlay.show { display: flex; }
#ach-modal {
  position: relative; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-xl);
  padding: 26px 24px 22px; width: min(480px,94vw); max-height: 86vh; display: flex; flex-direction: column;
  color: var(--ink); box-shadow: 0 24px 60px -12px rgba(0,0,0,.7);
  animation: lb-pop .34s cubic-bezier(.34,1.4,.64,1);
}
#ach-close { position: absolute; top: 16px; right: 16px; width: 30px; height: 30px; display: grid; place-items: center; border: none; border-radius: 9px; cursor: pointer; background: transparent; color: var(--ink-2); font-size: 1.05rem; transition: background .15s, color .15s; }
#ach-close:hover { background: var(--surface-2); color: var(--ink); }
.ach-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.ach-head-ic { width: 42px; height: 42px; flex: none; display: grid; place-items: center; border-radius: 12px; background: var(--gold-l); color: var(--gold); border: 1px solid var(--line-2); }
.ach-head-ic svg { width: 22px; height: 22px; }
.ach-head-tx h3 { font-family: var(--display); font-size: 1.28rem; line-height: 1.1; margin-bottom: 3px; }
.ach-head-tx p { font-family: var(--mono); font-size: .76rem; color: var(--ink-2); }
.ach-grid { overflow-y: auto; display: flex; flex-direction: column; gap: 8px; margin: 0 -4px; padding: 0 4px; }
.ach-item { display: flex; align-items: center; gap: 13px; padding: 12px 13px; border-radius: var(--r); background: var(--bg-soft); border: 1px solid transparent; }
.ach-item.earned { border-color: rgba(233,180,60,.34); background: var(--gold-l); }
.ach-item.locked { opacity: .55; }
.ach-ic { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); color: var(--ink-3); }
.ach-ic svg { width: 20px; height: 20px; }
.ach-item.earned .ach-ic { background: rgba(233,180,60,.18); color: var(--gold); }
.ach-tx { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ach-t { font-family: var(--display); font-weight: 600; font-size: .98rem; color: var(--ink); }
.ach-item.earned .ach-t { color: var(--gold); }
.ach-d { font-size: .8rem; color: var(--ink-2); }

/* course-mastery crown on the results screen */
.mastery-badge { width: 70px; height: 70px; margin: 0 auto 6px; color: var(--gold); filter: drop-shadow(0 4px 14px rgba(233,180,60,.45)); animation: pop-in .5s cubic-bezier(.34,1.6,.64,1); }
.mastery-badge svg { width: 100%; height: 100%; }

/* milestone toast */
.ach-toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 130%);
  display: flex; align-items: center; gap: 12px; z-index: 9998;
  background: var(--surface); border: 1px solid var(--gold-d); border-radius: 14px;
  padding: 12px 18px 12px 14px; box-shadow: 0 14px 40px -8px rgba(0,0,0,.6);
  transition: transform .4s cubic-bezier(.34,1.4,.64,1); max-width: 92vw;
}
.ach-toast.show { transform: translate(-50%, 0); }
.ach-toast-ic { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--gold-l); border: 1px solid rgba(233,180,60,.4); color: var(--gold); }
.ach-toast-ic svg { width: 22px; height: 22px; }
.ach-toast-tx { display: flex; flex-direction: column; gap: 1px; }
.ach-toast-k { font-family: var(--mono); font-size: .62rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--gold); }
.ach-toast-t { font-family: var(--display); font-weight: 600; font-size: 1rem; color: var(--ink); }


/* ═══════════════════════════════════════════════════
   RTL (Arabic, Urdu)
═══════════════════════════════════════════════════ */
[dir="rtl"] body { text-align: right; }
/* keep numbers, money figures and the chart axes left-to-right */
[dir="rtl"] .plot-figure, [dir="rtl"] .stat-n, [dir="rtl"] .plot-head-k,
[dir="rtl"] .plot-control-foot, [dir="rtl"] .hud-pill, [dir="rtl"] .rs-val,
[dir="rtl"] .plot-axis-y span, [dir="rtl"] .plot-axis-x span,
[dir="rtl"] .result-correct-line, [dir="rtl"] .footer-copy { direction: ltr; }
[dir="rtl"] .hero-btns, [dir="rtl"] .plot-control-foot { flex-direction: row-reverse; }

/* — Explicit text-align:left declarations must be flipped back to right — */
[dir="rtl"] .lang-opt,
[dir="rtl"] .course-card,
[dir="rtl"] .option-btn,
[dir="rtl"] .match-item,
[dir="rtl"] .resume-card { text-align: right; }

/* — Language menu is right-anchored (LTR); anchor it left in RTL — */
[dir="rtl"] .lang-menu { right: auto; left: 0; }

/* — Quiz: matching question badge sits at the inline start — */
[dir="rtl"] .match-item { padding: 14px 40px 14px 14px; }
[dir="rtl"] .match-badge { left: auto; right: 10px; }

/* — Resume card: mirror the play triangle (+ its optical nudge) and the
   continue arrow so both point toward the inline start in RTL — */
[dir="rtl"] .resume-ic svg { margin-left: 0; margin-right: 2px; transform: scaleX(-1); }
[dir="rtl"] .resume-arrow { transform: scaleX(-1); }

/* — Landing: absolutely-positioned accents mirror to the other edge — */
[dir="rtl"] .float-xp { right: auto; left: 30px; }
[dir="rtl"] .badge-crown { right: auto; left: -9px; }


/* ═══════════════════════════════════════════════════
   REDUCED MOTION
═══════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}


/* ═══════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════ */
@media (max-width: 920px) {
  .hero { grid-template-columns: 1fr; gap: 32px; padding-top: 34px; }
  .hero-copy { text-align: center; }
  .hero-kicker { margin-left: auto; margin-right: auto; }
  .hero-sub { margin-left: auto; margin-right: auto; }
  .hero-btns { justify-content: center; }
  .hero-art { order: 2; }
  .row, .row.reverse { grid-template-columns: 1fr; gap: 28px; }
  .row.reverse .row-art { order: -1; }
  .row-art { order: -1; }
  .row-copy { text-align: center; }
  .row-copy p { margin-left: auto; margin-right: auto; }
}
@media (max-width: 700px) {
  .nav-links { display: none; }
  /* The hero + footer already have a "Get started" CTA, so the nav one is
     redundant on mobile — drop it to make room for login/leaderboard/lang. */
  .site-nav #nav-start-btn { display: none; }
  .values { grid-template-columns: 1fr; }
  .course-grid { grid-template-columns: 1fr; }
  .stats-band { grid-template-columns: repeat(2,1fr); gap: 30px 16px; }
}
/* Declutter the (injected) auth + leaderboard chips before things get tight */
@media (max-width: 560px) {
  .nav-right { gap: 8px; }
  .lang-btn { padding: 7px 9px; }
  #lb-btn span { display: none; }          /* trophy icon only */
  #lb-btn { padding: 8px 10px; }
  #auth-email { display: none !important; } /* avatar speaks for itself */
}
@media (max-width: 460px) {
  .site-nav { padding: 13px 16px; }
  .logo { font-size: 1.2rem; }
  .hero, .values, .features { padding-left: 18px; padding-right: 18px; }
  .courses-band, .stats-band { padding-left: 18px; padding-right: 18px; }
  /* hero CTAs go full width so long labels never overflow */
  .hero-btns { flex-direction: column; align-items: stretch; width: 100%; }
  .hero-btns .btn3d { width: 100%; }
  /* difficulty control fits a narrow screen */
  .level-seg { width: 100%; }
  .level-opt { flex: 1; padding: 8px 6px; font-size: .76rem; }
  .footer-copy { display: none; }

  /* iOS safe-area: keep feedback bar above home indicator */
  .feedback-bar { padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px)); }
}
