/* ==========================================================================
   Science S1 — visual system
   Dark deep-space UI · cyan / electric-blue accents · cinematic artwork
   ========================================================================== */

/* ---------- Fonts (self-hosted, Greek + Latin) ---------- */
@font-face { font-family: "Manrope"; font-weight: 400; font-display: swap; src: url("assets/fonts/manrope-greek-400-normal.woff2") format("woff2"); unicode-range: U+0370-03FF; }
@font-face { font-family: "Manrope"; font-weight: 500; font-display: swap; src: url("assets/fonts/manrope-greek-500-normal.woff2") format("woff2"); unicode-range: U+0370-03FF; }
@font-face { font-family: "Manrope"; font-weight: 600; font-display: swap; src: url("assets/fonts/manrope-greek-600-normal.woff2") format("woff2"); unicode-range: U+0370-03FF; }
@font-face { font-family: "Manrope"; font-weight: 700; font-display: swap; src: url("assets/fonts/manrope-greek-700-normal.woff2") format("woff2"); unicode-range: U+0370-03FF; }
@font-face { font-family: "Manrope"; font-weight: 800; font-display: swap; src: url("assets/fonts/manrope-greek-800-normal.woff2") format("woff2"); unicode-range: U+0370-03FF; }
@font-face { font-family: "Manrope"; font-weight: 400; font-display: swap; src: url("assets/fonts/manrope-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2190-21FF, U+2212; }
@font-face { font-family: "Manrope"; font-weight: 500; font-display: swap; src: url("assets/fonts/manrope-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2190-21FF, U+2212; }
@font-face { font-family: "Manrope"; font-weight: 600; font-display: swap; src: url("assets/fonts/manrope-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2190-21FF, U+2212; }
@font-face { font-family: "Manrope"; font-weight: 700; font-display: swap; src: url("assets/fonts/manrope-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2190-21FF, U+2212; }
@font-face { font-family: "Manrope"; font-weight: 800; font-display: swap; src: url("assets/fonts/manrope-latin-800-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2190-21FF, U+2212; }

/* ---------- Tokens ---------- */
:root {
  --bg: #040a19;
  --bg-2: #071229;
  --sidebar: #050d1f;
  --panel: rgba(8, 19, 42, 0.78);
  --card-top: #0d1e3d;
  --card-bot: #091630;
  --line: rgba(104, 162, 255, 0.30);
  --line-soft: rgba(104, 162, 255, 0.16);
  --line-strong: rgba(120, 190, 255, 0.62);

  --text: #f2f6ff;
  --text-2: #cdd8ee;
  --muted: #93a4c6;

  --cyan: #3fd4f5;
  --blue: #2f7bff;
  --blue-2: #1f5fe0;
  --blue-deep: #1a3fa8;
  --violet: #7357ff;
  --violet-2: #9a86ff;
  --gold: #f6b42b;
  --amber-line: #9a6420;
  --green: #2fd27a;
  --red: #ff6b6b;

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;

  --sidebar-w: 276px;
  --gutter: clamp(16px, 1.6vw, 24px);

  --shadow-card: 0 14px 34px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  --glow-blue: 0 0 0 1px rgba(90, 170, 255, 0.55), 0 0 26px rgba(47, 123, 255, 0.35);

  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

  /* type scale */
  --fs-eyebrow: 12.5px;
  --fs-small: 14px;
  --fs-body: 16px;
  --fs-lead: clamp(15px, 0.6vw + 11px, 17px);
  --fs-card-title: clamp(16px, 0.55vw + 10px, 18.5px);
  --fs-card-de: clamp(14px, 0.45vw + 9px, 16px);
  --fs-h1: clamp(26px, 1.4vw + 12px, 33px);
  --fs-question: clamp(22px, 1.1vw + 14px, 32px);
  --fs-answer: clamp(16px, 0.2vw + 14.5px, 18px);
  --fs-feedback: clamp(15px, 0.15vw + 14px, 17px);

  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.55;
  color: var(--text);
  background: var(--bg) url("assets/ui/space-bg.webp") center top / cover fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
ol, ul { margin: 0; padding: 0; list-style: none; }
figure { margin: 0; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; border-radius: 6px; }
[tabindex="-1"]:focus { outline: none; }

.ico { width: 24px; height: 24px; flex: none; }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--blue); color: #fff; padding: 10px 14px; border-radius: var(--r-sm);
}
.skip-link:focus { top: 12px; }
.noscript { padding: 40px; text-align: center; }

.eyebrow {
  color: var(--cyan);
  font-weight: 600;
  font-size: clamp(14px, 0.3vw + 12px, 17px);
  letter-spacing: 0.01em;
}
.eyebrow-sm {
  font-size: var(--fs-eyebrow);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Layout ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}
.main {
  position: relative;
  min-width: 0;
  padding: 22px var(--gutter) 28px;
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(32, 88, 200, 0.20), transparent 60%),
    linear-gradient(180deg, rgba(4, 10, 25, 0.25), rgba(4, 10, 25, 0.55));
}
.view { position: relative; z-index: 1; max-width: 1360px; margin: 0 auto; }
.view:focus { outline: none; }

/* header decoration (planet + rocket, from the approved mockup) */
.main-decor { position: absolute; inset: 0 0 auto auto; width: 520px; height: 190px; pointer-events: none; z-index: 0; overflow: hidden; }
.decor-planet {
  position: absolute; right: 0; top: 0; width: 176px; height: auto;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 22%);
  mask-image: linear-gradient(to right, transparent 0, #000 22%);
  opacity: .95;
}
.decor-rocket {
  position: absolute; right: 268px; top: 86px; width: 112px; height: auto;
  -webkit-mask-image: radial-gradient(ellipse 58% 56% at 50% 50%, #000 55%, transparent 100%);
  mask-image: radial-gradient(ellipse 58% 56% at 50% 50%, #000 55%, transparent 100%);
}
body:not([data-view="chapter"]) .decor-rocket { display: none; }
body[data-view="lesson"] .main-decor, body[data-view="quiz"] .main-decor, body[data-view="boss"] .main-decor { display: none; }

/* ==========================================================================
   Sidebar
   ========================================================================== */
.sidebar {
  position: sticky; top: 0;
  height: 100vh;
  display: flex; flex-direction: column;
  background:
    linear-gradient(180deg, rgba(7, 16, 36, 0.96), rgba(4, 10, 24, 0.98)),
    var(--sidebar);
  border-right: 1px solid var(--line-soft);
  z-index: 5;
  overflow: hidden;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px 14px 14px; }
.brand-logo { width: 66px; height: auto; filter: drop-shadow(0 0 10px rgba(63, 160, 255, .5)); }
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-name { font-weight: 800; font-size: 28px; letter-spacing: 0.01em; color: #fff; white-space: nowrap; }
.brand-name b { color: var(--cyan); font-weight: 800; }
.brand-tag { margin-top: 8px; font-size: 11.5px; letter-spacing: 0.2em; color: var(--text-2); font-weight: 500; white-space: nowrap; }

.side-nav { display: flex; flex-direction: column; gap: 2px; padding: 4px 0 8px; overflow-y: auto; scrollbar-width: none; }
.side-nav::-webkit-scrollbar { display: none; }

.side-link {
  display: flex; align-items: center; gap: 22px;
  min-height: 54px; padding: 0 24px;
  font-size: 17px; font-weight: 500; color: var(--text);
  border-radius: var(--r); margin: 0 10px; padding-left: 14px;
  transition: background .18s, color .18s;
}
.side-link .ico { width: 28px; height: 28px; color: #e8efff; }
.side-link:hover { background: rgba(47, 123, 255, 0.10); }
.side-link.is-active { background: rgba(47, 123, 255, 0.16); box-shadow: inset 0 0 0 1px var(--line); }
.side-link.nav-boss .ico { color: #b9a6ff; }

.side-ch {
  position: relative;
  display: flex; align-items: flex-start; gap: 20px;
  margin: 2px 10px; padding: 12px 12px 12px 14px;
  border-radius: var(--r);
  border: 1px solid transparent;
  transition: background .18s, border-color .18s;
}
.side-ch:hover { background: rgba(47, 123, 255, 0.08); }
.side-ch-icon { width: 30px; height: 34px; display: grid; place-items: center; margin-top: 2px; flex: none; }
.side-ch-icon .ico { width: 28px; height: 28px; }
.side-ch-icon .ch-raster { width: 26px; height: auto; }
.side-ch-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.side-ch-label { font-size: 16.5px; font-weight: 600; color: var(--text); }
.side-ch.is-complete .side-ch-label { color: var(--cyan); }
.side-ch-title { font-size: 14px; color: var(--text-2); line-height: 1.35; margin-top: 2px; }
.side-ch-progress { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.side-ch-progress .bar { flex: 1; }
.side-ch-progress .pct { font-size: 12.5px; color: var(--text-2); min-width: 30px; text-align: right; }
.side-ch-check {
  position: absolute; right: 12px; top: 13px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--green); color: #04220f; display: grid; place-items: center;
}
.side-ch-check .ico { width: 15px; height: 15px; stroke-width: 3; }
.side-ch.is-active {
  background: linear-gradient(135deg, #1b43b8 0%, #2662ea 70%, #2a6cf2 100%);
  border-color: rgba(120, 180, 255, 0.75);
  box-shadow: 0 0 26px rgba(38, 98, 234, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.side-ch.is-active .side-ch-label { color: #fff; }
.side-ch.is-active .side-ch-title { color: #dce7ff; }

.side-sep { border: 0; height: 1px; background: var(--line-soft); margin: 10px 14px 8px; }

.side-scene {
  position: relative;
  margin-top: auto;
  flex: 1 1 auto;
  min-height: 150px;
  max-height: 360px;
}
.side-astronaut {
  position: absolute; inset: auto 0 0 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 28%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 28%);
}
.xp-box {
  position: absolute; left: 8px; right: 12px; bottom: 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px;
  background: rgba(5, 13, 30, 0.86);
  border: 1px solid var(--line);
  border-radius: var(--r);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .45);
}
.xp-stat { display: flex; align-items: center; gap: 10px; line-height: 1.1; }
.xp-star { width: 44px; height: 44px; border-radius: 50%; overflow: hidden; flex: none; }
.xp-star img { width: 100%; height: 100%; object-fit: cover; }
.xp-label { display: block; font-size: 16px; color: var(--text-2); }
.xp-value { display: block; font-size: 22px; font-weight: 700; color: var(--gold); }
.xp-divider { width: 1px; align-self: stretch; background: var(--line-soft); }
.xp-trend { color: var(--gold); }
.xp-trend .ico { width: 30px; height: 30px; stroke-width: 2.2; }
.xp-chapters { display: block; font-size: 20px; font-weight: 600; }
.xp-sub { display: block; font-size: 12.5px; color: var(--text-2); }

/* mobile top bar & tab bar hidden on desktop */
.topbar, .tabbar { display: none; }

/* ==========================================================================
   Progress bars
   ========================================================================== */
.bar {
  position: relative; display: block; height: 6px; border-radius: 99px;
  background: rgba(120, 160, 230, 0.16); overflow: hidden;
}
.bar > span {
  position: absolute; inset: 0 auto 0 0; border-radius: inherit;
  background: linear-gradient(90deg, var(--blue-2), var(--cyan));
  box-shadow: 0 0 10px rgba(63, 212, 245, .55);
  transition: width .5s ease;
}
.progress-row { display: flex; align-items: center; gap: 14px; }
.progress-row .bar { flex: 1; }
.progress-row b { font-size: 19px; font-weight: 700; min-width: 44px; text-align: right; }

/* ==========================================================================
   Chapter dashboard
   ========================================================================== */
.ch-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 4px 22px;
  margin: 0 0 16px;
}
.ch-head-icon { width: 60px; display: grid; place-items: center; padding-top: 8px; color: var(--cyan); }
.ch-head-icon .ch-raster { width: 56px; height: auto; filter: drop-shadow(0 0 12px rgba(80, 140, 255, .55)); }
.ch-head-icon .ico { width: 54px; height: 54px; stroke-width: 1.4; filter: drop-shadow(0 0 10px rgba(63, 212, 245, .55)); }
.ch-head-text { min-width: 0; }
.ch-head h1, .page-head h1, .hero h1 {
  font-size: var(--fs-h1);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.012em;
  margin-top: 2px;
  text-wrap: balance;
}
.lede { margin-top: 8px; color: var(--text-2); font-size: var(--fs-lead); max-width: 680px; line-height: 1.5; }

.progress-box {
  width: 310px;
  margin: 0 170px 0 0;
  padding: 9px 18px 10px;
  background: rgba(6, 16, 38, 0.78);
  border: 1px solid var(--line);
  border-radius: 10px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.progress-label { display: block; font-size: 14.5px; color: var(--text); margin-bottom: 2px; }

.ch-switch { display: none; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px 16px;
}
.card { position: relative; min-width: 0; }
.card-link {
  display: flex; flex-direction: column; height: 100%;
  background: linear-gradient(180deg, var(--card-top), var(--card-bot));
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
}
.card-link:hover, .card-link:focus-visible {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-card), var(--glow-blue);
  outline: none;
}

/* artwork slot — real raster images only */
.art { position: relative; overflow: hidden; background: radial-gradient(120% 120% at 30% 20%, #142a52, #0a1530 70%); }
.art img { width: 100%; height: 100%; object-fit: cover; }
.art-fallback {
  position: absolute; inset: 0; display: none; place-items: center; align-content: center; gap: 8px;
  color: rgba(170, 200, 255, .55); font-size: 13px; text-align: center;
}
.art-fallback .ico { width: 34px; height: 34px; margin: 0 auto; }
.art.is-missing .art-fallback { display: grid; }

.card-art { aspect-ratio: 16 / 8.8; }
.card-art img { transition: transform .5s ease; }
.card-link:hover .card-art img { transform: scale(1.045); }
.card-art::after { /* soft blend into the text area */
  content: ""; position: absolute; inset: auto 0 0 0; height: 28%;
  background: linear-gradient(to bottom, transparent, rgba(9, 22, 48, .55));
  pointer-events: none;
}

.badge {
  position: absolute; left: 9px; top: 9px; z-index: 2;
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700; font-size: 18px; color: #fff; line-height: 1;
  background:
    linear-gradient(#070d1e, #070d1e) padding-box,
    linear-gradient(140deg, #46d9ff, #4f7dff 45%, #9b6bff) border-box;
  border: 2.5px solid transparent;
  box-shadow: 0 0 12px rgba(80, 150, 255, .55);
}
.badge--lg { width: 46px; height: 46px; font-size: 22px; left: 14px; top: 14px; }
.card.is-done .badge {
  background:
    linear-gradient(#06180f, #06180f) padding-box,
    linear-gradient(140deg, #5ff0a6, #2fd27a) border-box;
  box-shadow: 0 0 12px rgba(47, 210, 122, .55);
}
.done-mark {
  position: absolute; right: 10px; top: 10px; z-index: 2;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--green); color: #04220f; display: grid; place-items: center;
  box-shadow: 0 0 12px rgba(47, 210, 122, .6);
}
.done-mark .ico { width: 17px; height: 17px; stroke-width: 3; }

.card-body {
  flex: 1;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px 14px 16px;
  min-height: 76px;
}
.card-text { flex: 1; min-width: 0; }
.card-title { font-size: var(--fs-card-title); font-weight: 600; line-height: 1.25; color: #fff; }
.card-de { margin-top: 3px; font-size: var(--fs-card-de); color: var(--text-2); line-height: 1.3; }

.go {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1.6px solid var(--blue);
  background: rgba(20, 60, 160, 0.25);
  color: #fff;
  box-shadow: 0 0 12px rgba(47, 123, 255, .28);
  transition: background .2s, transform .2s;
}
.go .ico { width: 20px; height: 20px; stroke-width: 2.2; }
.card-link:hover .go { background: var(--blue); transform: translateX(2px); }

/* CTA row */
.cta-row {
  display: grid;
  grid-template-columns: minmax(0, 1.24fr) minmax(0, 1fr);
  gap: 22px;
  margin-top: 18px;
}
.cta {
  display: flex; align-items: center; gap: 18px;
  min-height: 90px; padding: 14px 22px 14px 18px;
  border-radius: var(--r);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s;
}
.cta:hover { transform: translateY(-2px); }
.cta-icon { width: 58px; height: auto; flex: none;
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 52%, transparent 72%);
  mask-image: radial-gradient(circle at 50% 50%, #000 52%, transparent 72%); }
.cta-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.cta-text b { font-size: 17.5px; font-weight: 600; color: #fff; }
.cta-meta { display: flex; flex-wrap: wrap; gap: 4px 0; font-size: 14px; color: var(--text-2); }
.cta-meta span + span::before { content: "·"; margin: 0 8px; color: var(--muted); }
.cta-go {
  flex: none; width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center; color: #fff;
}
.cta-go .ico { width: 22px; height: 22px; stroke-width: 2.2; }

.cta-quiz {
  background: linear-gradient(95deg, #1f1056 0%, #331a86 55%, #2a1572 100%);
  border: 1px solid rgba(124, 92, 255, 0.75);
  box-shadow: 0 12px 30px rgba(30, 10, 90, .45), inset 0 1px 0 rgba(255, 255, 255, .06);
}
.cta-quiz .cta-meta { color: #cfc4ff; }
.cta-quiz .cta-go { background: linear-gradient(135deg, #7b62ff, #5a3df0); border: 1.5px solid #b3a3ff; box-shadow: 0 0 18px rgba(123, 98, 255, .65); }
.cta-quiz:hover { box-shadow: 0 12px 30px rgba(30, 10, 90, .45), 0 0 0 1px #9a86ff, 0 0 30px rgba(115, 87, 255, .35); }

.cta-boss {
  background: linear-gradient(95deg, #24170a 0%, #34230d 50%, #2b1d0d 100%);
  border: 1px solid var(--amber-line);
  box-shadow: 0 12px 30px rgba(40, 20, 0, .45), inset 0 1px 0 rgba(255, 220, 160, .05);
}
.cta-boss .cta-meta { color: #e9d6b4; }
.cta-boss .cta-go { border: 1.6px solid #c98a2a; background: rgba(201, 138, 42, .16); color: var(--gold); }
.cta-boss:hover { box-shadow: 0 12px 30px rgba(40, 20, 0, .45), 0 0 0 1px #c98a2a, 0 0 28px rgba(246, 180, 43, .25); }
.cta-boss.is-won .cta-go { background: var(--gold); color: #2a1a05; }

/* ==========================================================================
   Lesson view
   ========================================================================== */
.lesson { padding-bottom: 8px; }
.lesson-top { display: flex; align-items: center; gap: 18px; margin-bottom: 18px; }
.back-link {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 600; color: var(--text-2);
  padding: 8px 14px 8px 10px; border-radius: 99px;
  border: 1px solid var(--line-soft); background: rgba(6, 16, 38, .6);
  transition: color .2s, border-color .2s;
}
.back-link .ico { width: 18px; height: 18px; }
.back-link:hover { color: #fff; border-color: var(--line-strong); }
.dots { display: flex; gap: 6px; flex: 1; justify-content: center; flex-wrap: wrap; }
.dot {
  width: 26px; height: 6px; border-radius: 99px;
  background: rgba(120, 160, 230, 0.2);
  transition: background .2s, width .2s;
}
.dot.is-done { background: rgba(47, 210, 122, .65); }
.dot.is-current { width: 42px; background: linear-gradient(90deg, var(--blue), var(--cyan)); box-shadow: 0 0 10px rgba(63, 212, 245, .6); }
.dot:hover { background: rgba(120, 180, 255, .55); }
.step-count { font-size: 14px; font-weight: 600; color: var(--muted); letter-spacing: .08em; }

.lesson-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(20px, 3vw, 44px);
  align-items: start;
}
.lesson-art-wrap { position: relative; position: sticky; top: 20px; }
.lesson-glow {
  position: absolute; inset: 8% 6% -6%;
  background-size: cover; background-position: center;
  filter: blur(46px) saturate(1.4);
  opacity: .55;
  border-radius: 40px;
  z-index: 0;
}
.lesson-art {
  position: relative; z-index: 1;
  aspect-ratio: 16 / 10;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .03) inset;
}
.lesson-content { min-width: 0; padding-top: 4px; }
.lesson-title {
  font-size: clamp(28px, 2vw + 14px, 42px);
  font-weight: 700; line-height: 1.12; margin-top: 6px;
  text-wrap: balance;
}
.chip-de {
  display: inline-block; margin-top: 12px;
  padding: 6px 14px; border-radius: 99px;
  font-size: 15px; font-weight: 600; color: #bfeeff;
  background: rgba(63, 212, 245, 0.10);
  border: 1px solid rgba(63, 212, 245, 0.45);
}
.lesson-text { margin-top: 20px; display: grid; gap: 14px; font-size: clamp(16px, .3vw + 15px, 18.5px); line-height: 1.65; color: #e3eaf8; max-width: 62ch; }

.note {
  margin-top: 18px; padding: 16px 18px;
  border-radius: var(--r);
  font-size: 16px; line-height: 1.6;
}
.note-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 6px; }
.note-title .ico { width: 20px; height: 20px; }
.note-observe { background: rgba(47, 123, 255, .10); border: 1px solid rgba(90, 160, 255, .38); }
.note-observe .note-title { color: #8fc2ff; }
.note-remember { background: rgba(246, 180, 43, .08); border: 1px solid rgba(246, 180, 43, .38); }
.note-remember .note-title { color: var(--gold); }

.checks { margin-top: 22px; }
.block-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--violet-2); margin-bottom: 10px; }
.block-title .ico { width: 20px; height: 20px; }
.check {
  border: 1px solid rgba(154, 134, 255, .35);
  background: rgba(115, 87, 255, .08);
  border-radius: var(--r);
  margin-top: 10px;
  overflow: hidden;
}
.check summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 16px; font-size: 16px; font-weight: 600;
}
.check summary::-webkit-details-marker { display: none; }
.check .reveal { flex: none; font-size: 13px; font-weight: 600; color: var(--violet-2); padding: 5px 10px; border-radius: 99px; border: 1px solid rgba(154, 134, 255, .45); }
.check[open] .reveal { opacity: .5; }
.check p { padding: 0 16px 16px; color: #dcd5ff; font-size: 16px; }

.lesson-nav {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 28px; padding-top: 18px;
  border-top: 1px solid var(--line-soft);
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 50px; padding: 0 22px;
  border-radius: 99px;
  font-size: 16px; font-weight: 600; line-height: 1.2;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .2s ease, background .2s, border-color .2s;
  -webkit-tap-highlight-color: transparent;
}
.btn .ico { width: 20px; height: 20px; stroke-width: 2.1; }
.btn:active { transform: scale(.98); }
.btn-primary { background: linear-gradient(135deg, #2f7bff, #1f56d6); border-color: rgba(140, 190, 255, .6); box-shadow: 0 8px 22px rgba(31, 86, 214, .45); color: #fff; }
.btn-primary:hover { box-shadow: 0 8px 22px rgba(31, 86, 214, .45), 0 0 0 1px #8ec0ff, 0 0 26px rgba(63, 160, 255, .45); }
.btn-ghost { background: rgba(8, 20, 46, .7); border-color: var(--line); color: var(--text); }
.btn-ghost:hover { border-color: var(--line-strong); }
.btn-gold { background: linear-gradient(135deg, #f6b42b, #d98a12); color: #241503; box-shadow: 0 8px 22px rgba(217, 138, 18, .35); }
.btn-danger { background: rgba(255, 107, 107, .12); border-color: rgba(255, 107, 107, .55); color: #ffd2d2; }
.btn-complete { background: rgba(47, 210, 122, .10); border-color: rgba(47, 210, 122, .55); color: #c9f7dc; min-width: 180px; }
.btn-complete:hover { background: rgba(47, 210, 122, .2); }
.btn-complete.is-done { background: var(--green); color: #04220f; border-color: var(--green); cursor: default; }

/* ==========================================================================
   Quiz
   ========================================================================== */
.quiz { max-width: 920px; margin: 0 auto; }
.quiz-head { display: flex; align-items: center; flex-wrap: wrap; gap: 14px 18px; margin-bottom: 20px; }
.quiz-head-title { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 220px; }
.quiz-head-title img, .result-art { -webkit-mask-image: radial-gradient(circle, #000 52%, transparent 72%); mask-image: radial-gradient(circle, #000 52%, transparent 72%); }
.quiz-head-title img { width: 48px; height: auto; }
.quiz-head .eyebrow { font-size: var(--fs-eyebrow); text-transform: uppercase; letter-spacing: .1em; }
.quiz-head-ch { font-size: 17px; font-weight: 600; }

.quiz-card {
  position: relative;
  padding: clamp(20px, 3vw, 36px);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, rgba(14, 30, 62, .92), rgba(8, 18, 40, .92));
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
}
.quiz--boss .quiz-card { border-color: rgba(201, 138, 42, .55); background: linear-gradient(180deg, rgba(40, 26, 10, .9), rgba(14, 14, 26, .94)); }
.quiz-meta { display: flex; align-items: center; gap: 16px; }
.quiz-bar { flex: 1; height: 6px; border-radius: 99px; background: rgba(120, 160, 230, .16); overflow: hidden; }
.quiz-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--violet), var(--cyan)); transition: width .4s ease; }
.quiz--boss .quiz-bar span { background: linear-gradient(90deg, #d98a12, var(--gold)); }

.q-text {
  margin: 24px 0 22px;
  font-size: var(--fs-question);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.005em;
  text-wrap: balance;
}
.options { display: grid; gap: 12px; }
.option {
  width: 100%;
  display: flex; align-items: center; gap: 14px;
  min-height: 62px; padding: 12px 18px 12px 12px;
  text-align: left;
  font-size: var(--fs-answer); font-weight: 500; line-height: 1.4;
  background: rgba(10, 24, 54, .85);
  border: 1px solid var(--line);
  border-radius: var(--r);
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
}
.option:hover:not(:disabled) { border-color: var(--line-strong); background: rgba(24, 52, 110, .7); transform: translateX(2px); }
.opt-key {
  flex: none; width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  font-size: 15px; font-weight: 700;
  background: rgba(47, 123, 255, .16); border: 1px solid rgba(90, 160, 255, .45); color: #bcd7ff;
}
.opt-text { flex: 1; }
.opt-ico { width: 24px; height: 24px; stroke-width: 2.6; }
.option:disabled { cursor: default; }
.option.is-correct { border-color: var(--green); background: rgba(47, 210, 122, .14); }
.option.is-correct .opt-key { background: var(--green); color: #04220f; border-color: var(--green); }
.option.is-correct .opt-ico { color: var(--green); }
.option.is-wrong { border-color: var(--red); background: rgba(255, 107, 107, .12); }
.option.is-wrong .opt-key { background: var(--red); color: #2a0606; border-color: var(--red); }
.option.is-wrong .opt-ico { color: var(--red); }
.option.is-dim { opacity: .55; }

.feedback {
  margin-top: 20px; padding: 16px 18px;
  border-radius: var(--r);
  font-size: var(--fs-feedback); line-height: 1.6;
}
.feedback.is-right { background: rgba(47, 210, 122, .10); border: 1px solid rgba(47, 210, 122, .45); }
.feedback.is-wrong { background: rgba(255, 107, 107, .08); border: 1px solid rgba(255, 107, 107, .45); }
.feedback-title { font-weight: 700; margin-bottom: 4px; font-size: var(--fs-feedback); }
.feedback.is-right .feedback-title { color: #7ff0b0; }
.feedback.is-wrong .feedback-title { color: #ffaaaa; }
.feedback-text { color: var(--text-2); }
.quiz-actions { display: flex; justify-content: flex-end; margin-top: 18px; }

/* Results */
.result { text-align: center; padding-top: clamp(28px, 4vw, 48px); padding-bottom: clamp(28px, 4vw, 44px); }
.r-stars { display: flex; justify-content: center; gap: 10px; margin-bottom: 18px; }
.r-star { width: 64px; height: 64px; border-radius: 50%; overflow: hidden; filter: grayscale(1) brightness(.45); transition: filter .4s; }
.r-star.is-on { filter: none; box-shadow: 0 0 22px rgba(246, 180, 43, .55); }
.r-star:nth-child(2) { transform: translateY(-10px) scale(1.12); }
.r-star img { width: 100%; height: 100%; object-fit: cover; }
.result-art { width: 96px; height: auto; margin: 0 auto 14px; filter: drop-shadow(0 0 24px rgba(246, 180, 43, .55)); }
.result:not(.is-won) .result-art { filter: grayscale(.6) brightness(.8); }
.locked-card .result-art { filter: grayscale(.8) brightness(.7); }
.result-title { font-size: var(--fs-question); font-weight: 700; line-height: 1.25; }
.result-score { margin-top: 10px; font-size: 18px; color: var(--text-2); }
.result-score b { font-size: 28px; color: #fff; }
.result-text { margin: 10px auto 0; max-width: 52ch; color: var(--text-2); font-size: var(--fs-feedback); }
.result-text b { color: var(--gold); }
.result-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin-top: 26px; }

/* ==========================================================================
   Home, progress & settings
   ========================================================================== */
.hero {
  position: relative;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: end;
  padding: clamp(24px, 3vw, 40px);
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(6, 14, 34, 1) 0%, rgba(6, 14, 34, .9) 50%, rgba(6, 14, 34, .2) 82%, rgba(6, 14, 34, 0) 100%),
    url("assets/ui/astronaut.webp") right center / auto 100% no-repeat,
    #0a1631;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  margin-right: 150px;
}
.hero-text { max-width: 560px; }
.hero .btn { margin-top: 22px; }
.hero-stats { display: flex; gap: 12px; }
.stat {
  min-width: 96px; padding: 12px 14px; text-align: center;
  border-radius: var(--r); border: 1px solid var(--line);
  background: rgba(5, 13, 30, .8);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.stat b { display: block; font-size: 24px; font-weight: 700; color: var(--gold); }
.stat span { font-size: 13px; color: var(--text-2); }
.hero-stats--wide { margin: 20px 0 22px; flex-wrap: wrap; }
.hero-stats--wide .stat { flex: 1; min-width: 120px; }

.section-title { margin: 30px 0 14px; font-size: 20px; font-weight: 600; }
.home-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.home-ch-link {
  display: flex; flex-direction: column; height: 100%;
  border-radius: var(--r); overflow: hidden;
  background: linear-gradient(180deg, var(--card-top), var(--card-bot));
  border: 1px solid var(--line); box-shadow: var(--shadow-card);
  transition: transform .22s, box-shadow .22s, border-color .22s;
}
.home-ch-link:hover { transform: translateY(-3px); border-color: var(--line-strong); box-shadow: var(--shadow-card), var(--glow-blue); }
.home-ch-art { aspect-ratio: 16 / 9; }
.home-ch-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.home-ch-body .eyebrow { font-size: 14px; display: flex; align-items: center; gap: 10px; }
.home-ch-body h3 { font-size: 19px; font-weight: 600; line-height: 1.25; }
.home-ch-body .de { color: var(--text-2); font-size: 15px; margin-bottom: 10px; }
.home-ch-body .progress-row { margin-top: auto; }
.done-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--green); font-weight: 700; }
.done-tag .ico { width: 15px; height: 15px; stroke-width: 3; }

.page { max-width: 1040px; }
.page-head { margin-bottom: 8px; }
.prog-list { display: grid; gap: 14px; }
.prog-link {
  display: grid; grid-template-columns: 180px minmax(0, 1fr) auto; gap: 20px; align-items: center;
  padding: 12px; padding-right: 22px;
  border-radius: var(--r); border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--card-top), var(--card-bot)); box-shadow: var(--shadow-card);
  transition: border-color .2s;
}
.prog-link:hover { border-color: var(--line-strong); }
.prog-art { aspect-ratio: 16 / 9; border-radius: var(--r-sm); }
.prog-main h3 { font-size: 18px; font-weight: 600; margin: 2px 0 10px; }
.prog-main .eyebrow { font-size: 14px; }
.prog-facts { display: flex; gap: 26px; margin: 0; }
.prog-facts div { text-align: center; }
.prog-facts dt { font-size: 12.5px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.prog-facts dd { margin: 6px 0 0; font-size: 18px; font-weight: 700; min-height: 28px; display: flex; justify-content: center; align-items: center; gap: 2px; }
.prog-facts dd .ico { width: 22px; height: 22px; color: var(--muted); }
.mini-star { width: 22px; height: 22px; border-radius: 50%; filter: grayscale(1) brightness(.45); }
.mini-star.is-on { filter: none; }

.panel {
  margin-top: 18px; padding: 22px 24px;
  border-radius: var(--r); border: 1px solid var(--line);
  background: var(--panel);
}
.panel h2 { font-size: 19px; font-weight: 600; margin-bottom: 6px; }
.panel p { color: var(--text-2); max-width: 64ch; }
.confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 16px; }
.confirm-text { width: 100%; color: #ffd2d2 !important; font-weight: 600; }

/* ---------- Toasts ---------- */
.toast-region { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 50; display: grid; gap: 8px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px 10px 10px; border-radius: 99px;
  background: rgba(10, 22, 50, .95); border: 1px solid rgba(246, 180, 43, .6);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5), 0 0 20px rgba(246, 180, 43, .25);
  font-weight: 700; color: #ffe2a6;
  animation: toast-in .3s ease both;
}
.toast img { width: 28px; height: 28px; border-radius: 50%; }
.toast.is-out { animation: toast-out .4s ease both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* ==========================================================================
   Responsive
   ========================================================================== */

/* Large laptop: keep 4 columns, tighten header */
@media (max-width: 1380px) {
  .progress-box { margin-right: 130px; width: 280px; }
  .hero { margin-right: 120px; }
}

/* Laptop / landscape tablet: 3 columns */
@media (max-width: 1240px) {
  .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ch-head { grid-template-columns: auto minmax(0, 1fr); }
  .progress-box { grid-column: 2; margin: 8px 0 0; width: min(340px, 100%); }
  .main-decor { width: 300px; }
  .decor-rocket { display: none; }
  .hero { margin-right: 0; }
}

/* Tablet: icon rail sidebar */
@media (max-width: 1060px) {
  :root { --sidebar-w: 92px; }
  .brand { justify-content: center; padding: 18px 8px 12px; }
  .sidebar .brand-text { display: none; }
  .brand-logo { width: 56px; }
  .side-link, .side-ch { justify-content: center; margin: 2px 10px; padding: 12px 0; gap: 0; }
  .side-link span, .side-ch-text { display: none; }
  .side-ch-check { right: 6px; top: 6px; width: 18px; height: 18px; }
  .side-ch-check .ico { width: 12px; height: 12px; }
  .side-scene { display: none; }
  .lesson-stage { grid-template-columns: 1fr; }
  .lesson-art-wrap { position: relative; top: 0; max-width: 760px; }
  .home-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cta-row { grid-template-columns: 1fr; gap: 12px; }
}

/* Small tablet / large phone: 2 columns */
@media (max-width: 860px) {
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .prog-link { grid-template-columns: 140px minmax(0, 1fr); }
  .prog-facts { grid-column: 1 / -1; justify-content: space-around; padding-top: 6px; border-top: 1px solid var(--line-soft); }
}

/* Phone: a dedicated mobile layout */
@media (max-width: 720px) {
  :root { --gutter: 16px; }
  body { background-attachment: scroll; }
  .app { display: block; }
  .sidebar { display: none; }

  .topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; justify-content: space-between;
    padding: calc(8px + env(safe-area-inset-top)) 12px 8px 8px;
    background: rgba(4, 10, 25, .86);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line-soft);
  }
  .brand--compact { padding: 0; gap: 6px; }
  .brand--compact .brand-logo { width: 44px; }
  .brand--compact .brand-name { font-size: 21px; }
  .topbar-right { display: flex; align-items: center; gap: 8px; }
  .xp-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 12px 4px 4px; border-radius: 99px;
    background: rgba(8, 20, 46, .9); border: 1px solid var(--line);
    font-size: 14px; color: var(--text-2);
  }
  .xp-pill img { width: 26px; height: 26px; border-radius: 50%; }
  .xp-pill b { color: var(--gold); font-size: 16px; }
  .icon-btn { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line-soft); }

  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    display: grid; grid-template-columns: repeat(5, 1fr);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: rgba(4, 10, 25, .94);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--line-soft);
  }
  .tab {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-height: 54px; border-radius: 12px;
    font-size: 11.5px; font-weight: 600; color: var(--muted);
  }
  .tab .ico { width: 24px; height: 24px; }
  .tab.is-active { color: #fff; background: rgba(47, 123, 255, .16); }
  .tab.is-active .ico { color: var(--cyan); }

  .main { padding: 16px var(--gutter) calc(96px + env(safe-area-inset-bottom)); }
  .main-decor { display: none !important; }

  .ch-head { grid-template-columns: auto minmax(0, 1fr); gap: 4px 14px; margin-bottom: 14px; }
  .ch-head-icon { width: 40px; padding-top: 4px; }
  .ch-head-icon .ch-raster { width: 38px; }
  .ch-head-icon .ico { width: 38px; height: 38px; }
  .ch-head h1 { font-size: 25px; }
  .ch-head .lede { font-size: 15px; }
  .progress-box { grid-column: 1 / -1; width: 100%; margin-top: 12px; }

  .ch-switch {
    display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
    margin: 0 calc(var(--gutter) * -1) 14px; padding: 2px var(--gutter);
  }
  .ch-switch::-webkit-scrollbar { display: none; }
  .ch-pill {
    flex: none; padding: 9px 16px; border-radius: 99px; font-size: 14px; font-weight: 600;
    border: 1px solid var(--line); background: rgba(8, 20, 46, .8); color: var(--text-2);
  }
  .ch-pill.is-active { background: linear-gradient(135deg, #1b43b8, #2a6cf2); color: #fff; border-color: rgba(120, 180, 255, .75); }
  .quiz-head .ch-switch { width: 100%; margin-bottom: 0; }

  /* cards stay big: one per row, artwork full width */
  .card-grid { grid-template-columns: 1fr; gap: 14px; }
  .card-art { aspect-ratio: 16 / 8.5; }
  .card-body { min-height: 72px; padding: 12px 14px 14px 16px; }
  .card-title { font-size: 18px; }
  .card-de { font-size: 15.5px; }
  .go { width: 44px; height: 44px; }

  .cta { padding: 14px 16px; gap: 14px; }
  .cta-icon { width: 48px; }
  .cta-meta { font-size: 13px; }

  .lesson-top { gap: 10px; flex-wrap: wrap; }
  .dots { order: 3; width: 100%; justify-content: flex-start; gap: 5px; }
  .dot { width: 18px; }
  .dot.is-current { width: 30px; }
  .step-count { margin-left: auto; }
  .lesson-art-wrap { margin: 0 calc(var(--gutter) * -1); }
  .lesson-art { border-radius: 0; border-left: 0; border-right: 0; aspect-ratio: 16 / 10; }
  .lesson-glow { display: none; }
  .badge--lg { width: 40px; height: 40px; font-size: 19px; }
  .lesson-title { font-size: 28px; }
  .lesson-nav {
    position: sticky; bottom: calc(72px + env(safe-area-inset-bottom)); z-index: 5;
    margin: 22px calc(var(--gutter) * -1) 0; padding: 10px var(--gutter);
    background: rgba(4, 10, 25, .92);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  }
  .lesson-nav .btn { min-height: 50px; padding: 0 16px; }
  .lesson-nav .btn-complete { flex: 1; min-width: 0; }
  .hide-sm { display: none; }

  .quiz-card { padding: 20px 16px 22px; border-radius: 16px; }
  .q-text { font-size: 22px; margin: 18px 0 16px; }
  .option { min-height: 58px; font-size: 16px; padding: 10px 14px 10px 10px; }
  .quiz-actions .btn { width: 100%; }
  .result-actions .btn { flex: 1 1 100%; }

  .hero { grid-template-columns: 1fr; background-position: right -40px center, 0 0; background-size: auto 115%, auto; }
  .hero-stats { width: 100%; }
  .hero-stats .stat { flex: 1; min-width: 0; }
  .hero .btn { width: 100%; }
  .home-grid { grid-template-columns: 1fr; }

  .prog-link { grid-template-columns: 110px minmax(0, 1fr); gap: 14px; padding-right: 12px; }
  .prog-facts { gap: 10px; }

  .toast-region { bottom: calc(86px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
