/* idle.py website — official PSF Python brand palette
   Brand blue:        #4B8BBE  (the "blue snake" body, PSF style guide)
   Brand blue dark:   #306998  (the darker python.org link/header blue)
   Brand yellow:      #FFD43B  (the "yellow snake" body)
   Brand yellow soft: #FFE873  (secondary, used on python.org for highlights)
*/

:root {
  /* Surfaces — refined to match python.org's hero / nav navy */
  --bg: #1B3A5C;            /* python.org-style hero navy (cooler than the old #192C50) */
  --bg-deep: #0E2138;       /* very deep python navy for code blocks + scientific contrast */
  --panel: #306998;         /* PSF DARK BLUE — used by python.org for nav + emphasis */
  --panel-alt: #4B8BBE;     /* PSF PRIMARY BRAND BLUE — the canonical "Python blue" */
  --border: #4B8BBE;        /* same — gives every panel the python-blue rim */
  --border-soft: #5C9BC8;   /* lighter tint for hover states, keeps the family */

  /* Text */
  --text: #FFFFFF;
  --text-dim: #B5CADD;      /* slightly cooler than before; less green tint, more python-blue */

  /* Accents — Python yellow stays canonical */
  --accent: #FFD43B;        /* PSF PRIMARY YELLOW */
  --accent-soft: #FFE873;   /* PSF SECONDARY YELLOW */
  --accent-dim: #E5B931;    /* warmer disabled-yellow (was olive #D4AA1A) */

  /* Feedback */
  --good: #76C043;
  --warn: #FFE873;
  --bad: #E74C3C;

  /* Code blocks — readable on the new navy */
  --code: #0E2138;
  --code-text: #FFD43B;

  /* Effects */
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --glow-yellow: 0 0 24px rgba(255, 212, 59, 0.55);
  --glow-blue: 0 0 22px rgba(75, 139, 190, 0.55);

  /* The signature dual-snake gradient — blue snake → yellow snake.
     Use sparingly: brand text, hero icon halo, key CTAs. This is the one
     visual cue that says "Python" instantly without showing the logo. */
  --python-snake: linear-gradient(135deg, #4B8BBE 0%, #FFD43B 100%);

  --radius: 14px;
  --radius-sm: 8px;
  --max-width: 1100px;
}

* {
  box-sizing: border-box;
}

/* Eliminate touch latency on every interactive surface. Without this,
   mobile browsers can hold the click event for ~300ms looking for a
   double-tap-to-zoom — that delay made the demo feel "unresponsive". */
button,
a,
[role="button"],
.stats-bar,
.gen-buy,
.qty-btn,
.buy-all,
.quiz-opt,
.tier,
.hbtn,
.btn {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Universal click-feedback shake — applied transiently when an action
   can't fire (e.g., not enough FLOPs to BUY). Tells the user "I heard
   your click, it just didn't do anything" instead of a silent ignore. */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-4px); }
  40%      { transform: translateX(4px); }
  60%      { transform: translateX(-3px); }
  80%      { transform: translateX(2px); }
}
.shake { animation: shake 0.36s ease; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  /* Layered radial-gradient hero glow that mirrors python.org:
     - top-right primary brand blue bloom (#4B8BBE)
     - left mid soft yellow whisper (#FFD43B at low opacity)
     - bottom darker python navy fade for depth */
  background:
    radial-gradient(1200px 600px at 80% -100px, rgba(75, 139, 190, 0.45), transparent 60%),
    radial-gradient(900px 500px at -10% 40%, rgba(255, 212, 59, 0.08), transparent 60%),
    radial-gradient(1400px 700px at 50% 110%, rgba(48, 105, 152, 0.45), transparent 70%),
    var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

/* ---------- Drifting code background ---------- */
.code-rain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  opacity: 0.55;
}

.code-rain span {
  position: absolute;
  top: -10%;
  font-family: "SF Mono", Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  color: rgba(75, 139, 190, 0.4);
  white-space: nowrap;
  animation: drift linear infinite;
  text-shadow: 0 0 10px rgba(75, 139, 190, 0.4);
}

.code-rain span.hot {
  color: rgba(255, 212, 59, 0.45);
  text-shadow: 0 0 10px rgba(255, 212, 59, 0.35);
}

@keyframes drift {
  0% { transform: translateY(0) translateX(0); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateY(110vh) translateX(20px); opacity: 0; }
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
  /* Subtle python.org-style nav band: deeper navy at top fading to a touch
     of brand blue at the bottom edge, with a thin brand-blue underline. */
  background: linear-gradient(180deg, rgba(14, 33, 56, 0.92), rgba(48, 105, 152, 0.55));
  border-bottom: 1px solid rgba(75, 139, 190, 0.55);
  box-shadow: 0 1px 0 rgba(255, 212, 59, 0.08);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  padding-bottom: 14px;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 20px;
  color: var(--text);
  letter-spacing: -0.01em;
}

.brand img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  animation: bob 4s ease-in-out infinite;
  box-shadow: 0 0 0 1px rgba(75, 139, 190, 0.5), 0 0 18px rgba(255, 212, 59, 0.18);
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

/* "idle" gets the python brand blue, ".py" gets the python yellow —
   the two-snake split. Subtle, but unmistakably Python. */
.brand .word-idle {
  background: linear-gradient(180deg, #FFFFFF 0%, #B5CADD 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand .dot-py {
  color: var(--accent);
  text-shadow: 0 0 12px rgba(255, 212, 59, 0.5);
}

.nav {
  display: flex;
  gap: 22px;
  align-items: center;
}

.nav a {
  color: var(--text-dim);
  font-size: 15px;
}

.nav a:hover {
  color: var(--accent);
  text-decoration: none;
}

.live-flops {
  font-family: "SF Mono", Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  color: var(--accent);
  background: rgba(255, 212, 59, 0.12);
  border: 1px solid rgba(255, 212, 59, 0.4);
  padding: 4px 10px;
  border-radius: 999px;
  display: none;
  white-space: nowrap;
}

.live-flops.show {
  display: inline-block;
}

.live-flops .blip {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: var(--good);
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
  animation: blip 1.4s ease-in-out infinite;
}

@keyframes blip {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.25); }
}

/* ---------- Hero ---------- */
.hero {
  padding: 70px 0 50px;
  text-align: center;
}

.hero-icon {
  width: 110px;
  height: 110px;
  border-radius: 24px;
  margin-bottom: 24px;
  /* Dual-snake halo: brand-blue ring at the rim, yellow bloom underneath. */
  box-shadow:
    0 0 0 2px rgba(75, 139, 190, 0.55),
    0 10px 30px rgba(0, 0, 0, 0.35),
    0 0 70px rgba(255, 212, 59, 0.28),
    0 -8px 40px rgba(75, 139, 190, 0.35);
  animation: bob 4s ease-in-out infinite;
}

.hero h1 {
  font-size: clamp(36px, 6vw, 64px);
  margin: 0 0 14px;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

/* Headline "accent" word uses the python-snake gradient instead of flat
   yellow — same blue→yellow flow as the Python logo's two snakes. */
.hero h1 .accent {
  background: var(--python-snake);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 0 24px rgba(255, 212, 59, 0.28));
}

.cursor {
  display: inline-block;
  width: 0.6ch;
  background: var(--accent);
  margin-left: 2px;
  animation: caret 1s steps(1) infinite;
  vertical-align: -0.1em;
  height: 1em;
}

@keyframes caret {
  50% { opacity: 0; }
}

.hero .tagline {
  font-size: clamp(17px, 2.4vw, 22px);
  color: var(--text-dim);
  max-width: 680px;
  margin: 0 auto 36px;
}

.hero .tagline code {
  background: rgba(14, 33, 56, 0.7);
  border: 1px solid rgba(75, 139, 190, 0.4);
  padding: 2px 7px;
  border-radius: 6px;
  color: var(--accent);
  font-size: 0.9em;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 22px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 15px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease;
  font-family: inherit;
}

.btn:hover {
  transform: translateY(-1px);
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
  box-shadow: var(--glow-yellow);
}

.btn-primary:hover {
  background: var(--accent);
  filter: brightness(1.05);
  box-shadow: 0 0 32px rgba(255, 212, 59, 0.7);
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: rgba(75, 139, 190, 0.15);
  box-shadow: var(--glow-blue);
}

.btn .badge-soon {
  font-size: 11px;
  background: rgba(27, 58, 92, 0.45);
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.btn-secondary .badge-soon {
  background: rgba(255, 212, 59, 0.18);
  color: var(--accent);
}

/* ---------- The mini-game (mirrors the real app's UI) ---------- */
.demo-frame {
  margin: 40px auto 10px;
  max-width: 460px;
  background: var(--bg);
  border: 1px solid rgba(75, 139, 190, 0.4);
  border-radius: 28px;
  padding: 14px 14px 18px;
  box-shadow: var(--shadow), 0 0 80px rgba(255, 212, 59, 0.08);
  text-align: left;
  position: relative;
}

.demo-tag {
  position: absolute;
  top: -12px;
  left: 22px;
  background: var(--accent);
  color: var(--bg);
  font-size: 11px;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 999px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: var(--glow-yellow);
}

/* App header (mirrors App.tsx header) */
.app-header {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  margin-top: 4px;
}

.app-header-title {
  flex: 1;
  text-align: right;
  padding-right: 10px;
}

.app-header-title .app-title {
  color: var(--text);
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 1px;
  font-family: "SF Mono", Menlo, Monaco, Consolas, monospace;
}

.app-header-title .app-sub {
  color: var(--text-dim);
  font-size: 11px;
  margin-top: 1px;
}

.app-header-buttons {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.app-header-buttons .hbtn {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
}

.app-header-buttons .hbtn.store {
  border-color: var(--accent);
  color: var(--accent);
}

/* StatsBar — the tap surface */
.stats-bar {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 10px;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.08s ease, box-shadow 0.18s ease;
}

.stats-bar:hover {
  box-shadow: 0 0 0 1px rgba(255, 212, 59, 0.35) inset, 0 0 24px rgba(255, 212, 59, 0.15);
}

.stats-bar.pressed {
  transform: scale(0.985);
  box-shadow: 0 0 0 2px rgba(255, 212, 59, 0.55) inset, 0 0 30px rgba(255, 212, 59, 0.25);
}

.stats-bar canvas.spark {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.85;
}

.stats-primary {
  text-align: center;
  margin-bottom: 8px;
  position: relative;
}

.stats-flops {
  color: var(--text);
  font-size: 36px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  font-family: "SF Mono", Menlo, Monaco, Consolas, monospace;
  line-height: 1;
}

.stats-unit {
  color: var(--text-dim);
  font-size: 12px;
  letter-spacing: 2px;
  margin-top: -2px;
}

.stats-row {
  display: flex;
  justify-content: space-around;
  position: relative;
}

.stats-row.row-spacer {
  margin-top: 10px;
}

.stat-cell {
  flex: 1;
  text-align: center;
}

.stat-cell .stat-val {
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-family: "SF Mono", Menlo, Monaco, Consolas, monospace;
}

.stat-cell .stat-val.good { color: var(--good); }
.stat-cell .stat-val.accent { color: var(--accent); }
.stat-cell .stat-val.warn { color: var(--warn); }

.stat-cell .stat-lbl {
  color: var(--text-dim);
  font-size: 10px;
  margin-top: 2px;
  letter-spacing: 1px;
}

.tap-hint {
  color: var(--text-dim);
  font-size: 11px;
  text-align: center;
  margin-top: 12px;
  font-style: italic;
  letter-spacing: 0.5px;
  position: relative;
}

/* Buy quantity row (mirrors App.tsx qtyRow) */
.qty-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 8px 0;
}

.qty-row .qty-label {
  color: var(--text-dim);
  font-size: 11px;
  letter-spacing: 1px;
  margin-right: 4px;
}

.qty-row .qty-btn {
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}

.qty-row .qty-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}

.qty-row .spacer { flex: 1; }

.qty-row .buy-all {
  padding: 6px 14px;
  border-radius: 8px;
  background: var(--good);
  border: 1px solid var(--good);
  color: var(--bg);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.5px;
  cursor: pointer;
  font-family: inherit;
}

.qty-row .buy-all.dimmed {
  background: var(--panel);
  border-color: var(--border);
  opacity: 0.6;
  color: var(--text-dim);
}

.qty-row .buy-all:active {
  transform: scale(0.97);
}

.qty-row .buy-all.can-afford {
  animation: glint-good 1.6s ease-in-out infinite;
}

@keyframes glint-good {
  0%, 100% { box-shadow: 0 0 10px rgba(118, 192, 67, 0.35); }
  50%      { box-shadow: 0 0 20px rgba(118, 192, 67, 0.65); }
}

/* Generator list (mirrors GeneratorRow.tsx) */
.gen-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 480px;
  overflow-y: auto;
  padding-right: 2px;
}

.gen-row {
  display: flex;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.gen-row.locked {
  opacity: 0.6;
  background: var(--panel-alt);
}

.gen-row .gen-emoji-col {
  width: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-right: 8px;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
}

.gen-row .emoji {
  font-size: 30px;
  line-height: 1;
}

.gen-row .emoji-locked {
  font-size: 28px;
  margin-right: 12px;
}

/* Real-app SVG icons used in the demo (Compute Unit rows + locked rows).
   Sized to match the prior emoji glyphs so the layout doesn't shift. */
.gen-row .gen-svg {
  width: 36px;
  height: 36px;
  display: block;
  pointer-events: none;
}

.gen-row .gen-svg.locked-svg {
  opacity: 0.55;
  filter: grayscale(0.4);
}

/* Library / Store header buttons use inline SVG icons sourced from the
   real app's icon set, mirroring how the App.tsx header renders them. */
.app-header-buttons .hbtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.app-header-buttons .hbtn-svg {
  width: 14px;
  height: 14px;
  display: inline-block;
}

/* Achievement / milestone toast SVG icon. The toast .icon container is
   centred via flex above; this just scales the artwork into it. */
.toast .toast-svg {
  width: 28px;
  height: 28px;
  display: block;
}

.gen-row .owned-num {
  color: var(--text-dim);
  font-size: 12px;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
  font-family: "SF Mono", Menlo, Monaco, Consolas, monospace;
}

.gen-row .gen-mid {
  flex: 1;
  margin-right: 10px;
  min-width: 0;
}

.gen-row .gen-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.gen-row .gen-name {
  color: var(--text);
  font-weight: 700;
  font-size: 15px;
}

.gen-row .lv-badge {
  background: var(--accent-dim);
  color: #fff;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.gen-row .gen-desc {
  color: var(--text-dim);
  font-size: 11px;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gen-row .gen-rate {
  color: var(--good);
  font-size: 12px;
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
  font-family: "SF Mono", Menlo, Monaco, Consolas, monospace;
}

.gen-row .gen-next {
  color: var(--text-dim);
  font-size: 10px;
  margin-top: 1px;
  font-style: italic;
}

.gen-row .locked-title {
  color: var(--text-dim);
  font-weight: 700;
  font-size: 15px;
}

.gen-row .locked-hint {
  color: var(--text-dim);
  font-size: 12px;
  margin-top: 2px;
  white-space: normal;
}

.gen-row .gen-buy {
  background: var(--accent);
  color: #000;
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  min-width: 92px;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: filter 0.15s ease, transform 0.08s ease, box-shadow 0.18s ease;
}

.gen-row .gen-buy.afford:hover {
  filter: brightness(1.05);
  box-shadow: 0 0 16px rgba(255, 212, 59, 0.55);
}

.gen-row .gen-buy.afford:active {
  transform: scale(0.97);
}

.gen-row .gen-buy.no-afford {
  background: var(--panel-alt);
  opacity: 0.6;
  color: #000;
  /* Clickable! On press we either buy (if funds) or shake + toast.
     Cursor stays 'pointer' (inherited from .gen-buy) so the click is
     clearly invited. */
}

.gen-row .gen-buy.no-afford:active {
  transform: scale(0.97);
}

.gen-row .gen-buy .buy-label {
  font-weight: 700;
  font-size: 12px;
}

.gen-row .gen-buy .buy-cost {
  font-size: 12px;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
  font-family: "SF Mono", Menlo, Monaco, Consolas, monospace;
}

.gen-row .gen-buy.quiz-gate {
  background: var(--panel-alt);
  border: 1px solid var(--warn);
}

.gen-row .gen-buy.quiz-gate:hover {
  box-shadow: 0 0 14px rgba(255, 232, 115, 0.45);
}

.gen-row .gen-buy .buy-quiz-label {
  color: var(--warn);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.5px;
}

.gen-row .gen-buy .buy-quiz-sub {
  color: var(--text-dim);
  font-size: 10px;
  margin-top: 2px;
  font-style: italic;
}

.demo-footnote {
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
}

.demo-footnote .reset {
  background: none;
  border: 0;
  color: var(--text-dim);
  cursor: pointer;
  text-decoration: underline;
  font: inherit;
}

.demo-footnote .reset:hover {
  color: var(--accent);
}

/* Floater (+gain) — anchored to the click point */
.floater {
  position: fixed;
  pointer-events: none;
  font-family: "SF Mono", Menlo, Monaco, Consolas, monospace;
  font-weight: 800;
  color: var(--accent);
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.6), 0 0 14px rgba(255, 212, 59, 0.4);
  animation: float-up 0.9s ease-out forwards;
  font-size: 18px;
  z-index: 90;
  transform: translate(-50%, 0);
}

@keyframes float-up {
  0% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -70px); }
}

/* Quiz modal — gates the BUY button on each tier */
.quiz-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(15, 25, 50, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.quiz-modal.open {
  display: flex;
  animation: fade 0.2s ease;
}

@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.quiz-card {
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: 16px;
  padding: 22px;
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow), var(--glow-yellow);
}

.quiz-card .quiz-close {
  float: right;
  background: none;
  border: 0;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  font-family: inherit;
}

.quiz-card h3 {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 20px;
}

.quiz-card .quiz-sub {
  color: var(--text-dim);
  font-size: 12px;
  margin-bottom: 14px;
  letter-spacing: 0.04em;
}

.quiz-card .quiz-body {
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 12px;
}

.quiz-card .quiz-code {
  background: var(--code);
  border: 1px solid rgba(75, 139, 190, 0.4);
  border-radius: 8px;
  color: var(--code-text);
  font-family: "SF Mono", Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  padding: 12px 14px;
  white-space: pre;
  overflow-x: auto;
  margin-bottom: 16px;
}

.quiz-card .quiz-question {
  color: var(--text);
  font-weight: 700;
  font-size: 15px;
  margin: 0 0 12px;
}

.quiz-card .quiz-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.quiz-card .quiz-opt {
  background: rgba(14, 33, 56, 0.6);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  text-align: left;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.quiz-card .quiz-opt:hover:not(:disabled) {
  background: rgba(255, 212, 59, 0.08);
  border-color: var(--accent);
}

.quiz-card .quiz-opt.right {
  background: var(--quizRightBg, #1C4630);
  border-color: var(--good);
  color: var(--good);
}

.quiz-card .quiz-opt.wrong {
  background: var(--quizWrongBg, #4A1D2A);
  border-color: var(--bad);
  color: var(--bad);
  cursor: not-allowed;
}

.quiz-card .quiz-opt:disabled {
  cursor: not-allowed;
}

.quiz-card .quiz-feedback {
  font-size: 13px;
  color: var(--text-dim);
  min-height: 18px;
  line-height: 1.4;
}

.quiz-card .quiz-feedback.good { color: var(--good); }
.quiz-card .quiz-feedback.bad { color: var(--bad); }

/* ---------- Toasts (achievements / milestones) ---------- */
.toast-stack {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: 320px;
}

.toast {
  background: linear-gradient(180deg, var(--panel), var(--panel-alt));
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: var(--shadow), var(--glow-yellow);
  animation: toast-in 0.4s ease, toast-out 0.4s ease 4.6s forwards;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  pointer-events: auto;
}

.toast .icon {
  font-size: 22px;
  line-height: 1;
}

.toast .title {
  font-weight: 700;
  color: var(--accent);
  font-size: 14px;
  letter-spacing: 0.04em;
}

.toast .body {
  color: var(--text);
  font-size: 13px;
  margin-top: 2px;
}

.toast .body .reward {
  color: var(--good);
  font-weight: 700;
}

@keyframes toast-in {
  0% { transform: translateX(120%); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}

@keyframes toast-out {
  0% { transform: translateX(0); opacity: 1; }
  100% { transform: translateX(120%); opacity: 0; }
}

@media (max-width: 600px) {
  .toast-stack { right: 12px; left: 12px; max-width: none; }
}

/* ---------- Confetti / particles ---------- */
.particle {
  position: fixed;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 90;
  animation: particle-fall 1.4s ease-out forwards;
}

@keyframes particle-fall {
  0% { opacity: 1; transform: translate(0, 0) rotate(0deg); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(540deg); }
}

/* ---------- Sections ---------- */
section {
  padding: 70px 0;
  position: relative;
}

.section-title {
  font-size: clamp(26px, 3.5vw, 36px);
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}

.section-title .accent {
  background: var(--python-snake);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.section-sub {
  color: var(--text-dim);
  margin: 0 0 40px;
  max-width: 720px;
}

/* ---------- Features ---------- */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.feature {
  background: linear-gradient(180deg, var(--panel), var(--panel-alt));
  border: 1px solid rgba(75, 139, 190, 0.55);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  position: relative;
  overflow: hidden;
}

.feature:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow), var(--glow-blue);
  border-color: var(--accent);
}

.feature::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: var(--radius);
  background: radial-gradient(400px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 212, 59, 0.18), transparent 40%);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.feature:hover::before {
  opacity: 1;
}

.feature .icon {
  font-size: 26px;
  margin-bottom: 10px;
  color: var(--accent);
  filter: drop-shadow(0 0 6px rgba(255, 212, 59, 0.4));
}

.feature h3 {
  margin: 0 0 6px;
  font-size: 18px;
}

.feature p {
  margin: 0;
  color: var(--text-dim);
  font-size: 15px;
}

/* ---------- Curriculum ---------- */
.curriculum-intro {
  text-align: center;
  margin-bottom: 30px;
}

.tier-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 36px;
}

.tier {
  background: var(--panel);
  border: 1px solid rgba(75, 139, 190, 0.55);
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.tier:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: var(--glow-blue);
}

.tier.open {
  border-color: var(--accent);
  box-shadow: var(--glow-yellow);
}

.tier .num {
  position: absolute;
  top: 6px;
  right: 10px;
  font-family: "SF Mono", Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  color: var(--text-dim);
  opacity: 0.6;
}

.tier .name {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 2px;
}

.tier .blurb {
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.4;
}

.tier .reveal {
  display: none;
  margin-top: 10px;
  background: var(--code);
  border: 1px solid rgba(75, 139, 190, 0.4);
  border-radius: 6px;
  padding: 8px 10px;
  font-family: "SF Mono", Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  color: var(--code-text);
  white-space: pre;
  overflow-x: auto;
}

.tier.open .reveal {
  display: block;
  animation: reveal 0.3s ease;
}

@keyframes reveal {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.basics {
  background: var(--panel);
  border: 1px solid rgba(75, 139, 190, 0.55);
  border-radius: var(--radius);
  padding: 24px;
}

.basics h3 {
  margin: 0 0 16px;
  color: var(--accent);
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.basics h3 .pill {
  background: rgba(118, 192, 67, 0.2);
  color: var(--good);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.basics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}

.basics-grid div {
  background: rgba(14, 33, 56, 0.5);
  border: 1px solid rgba(75, 139, 190, 0.3);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  color: var(--text-dim);
}

/* ---------- Achievements showcase ---------- */
.achievements {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.ach {
  background: linear-gradient(180deg, var(--panel), var(--panel-alt));
  border: 1px solid rgba(75, 139, 190, 0.55);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.ach .ach-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(255, 212, 59, 0.12);
  border: 1px solid rgba(255, 212, 59, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.ach .ach-name {
  font-weight: 700;
  font-size: 14px;
}

.ach .ach-desc {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

/* ---------- Final CTA ---------- */
.final-cta {
  background: linear-gradient(135deg, rgba(48, 105, 152, 0.7), rgba(14, 33, 56, 0.9));
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 40px;
  margin: 30px 0;
  text-align: center;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.final-cta::before {
  content: "";
  position: absolute;
  inset: -50%;
  background: conic-gradient(from 0deg, transparent, rgba(255, 212, 59, 0.05), transparent 30%);
  animation: spin 20s linear infinite;
  pointer-events: none;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.final-cta > * { position: relative; z-index: 1; }

.final-cta h2 {
  margin: 0 0 8px;
  font-size: clamp(24px, 3.5vw, 34px);
}

.final-cta p {
  color: var(--text-dim);
  margin: 0 0 24px;
}

/* ---------- Code block ---------- */
.code {
  background: var(--code);
  border: 1px solid rgba(75, 139, 190, 0.4);
  border-radius: var(--radius-sm);
  color: var(--code-text);
  font-family: "SF Mono", Menlo, Monaco, Consolas, monospace;
  font-size: 14px;
  padding: 16px 18px;
  overflow-x: auto;
  white-space: pre;
  margin: 16px 0;
}

/* ---------- Legal pages ---------- */
.legal {
  padding: 60px 0 90px;
}

.legal h1 {
  font-size: clamp(28px, 4vw, 40px);
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}

.legal .updated {
  color: var(--text-dim);
  font-size: 14px;
  margin-bottom: 32px;
}

.legal h2 {
  margin: 36px 0 10px;
  font-size: 22px;
  color: var(--accent);
}

.legal h3 {
  margin: 22px 0 8px;
  font-size: 17px;
}

.legal p,
.legal li {
  color: #E2EBF6;
  font-size: 16px;
}

.legal ul,
.legal ol {
  padding-left: 22px;
}

.legal table {
  border-collapse: collapse;
  margin: 16px 0;
  width: 100%;
}

.legal th,
.legal td {
  border: 1px solid rgba(75, 139, 190, 0.5);
  padding: 8px 12px;
  text-align: left;
  font-size: 15px;
}

.legal th {
  background: rgba(75, 139, 190, 0.2);
  color: var(--accent);
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid rgba(75, 139, 190, 0.4);
  padding: 36px 0 60px;
  margin-top: 40px;
  color: var(--text-dim);
  font-size: 14px;
  position: relative;
  z-index: 1;
}

.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  align-items: center;
}

.site-footer .links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.site-footer a {
  color: var(--text-dim);
}

.site-footer a:hover {
  color: var(--accent);
  text-decoration: none;
}

.repl-line {
  text-align: center;
  font-family: "SF Mono", Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 18px;
  opacity: 0.7;
}

.repl-line .prompt { color: var(--good); }
.repl-line .str { color: var(--accent); }

/* ---------- AGI mode (konami easter egg) ---------- */
body.agi-mode {
  animation: rainbow-bg 8s linear infinite;
}

@keyframes rainbow-bg {
  0% { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(360deg); }
}

body.agi-mode .tap-button {
  animation: rainbow-bg 2s linear infinite;
}

/* ---------- Mobile tweaks ---------- */
@media (max-width: 600px) {
  .nav { gap: 14px; }
  .nav a:not(.btn):not(.live-flops) { display: none; }
  .hero { padding: 50px 0 30px; }
  section { padding: 50px 0; }
  .demo { padding: 16px; }
  .demo-stats { gap: 8px; }
  .stat { padding: 8px 10px; }
  .stat .stat-value { font-size: 16px; }
  .final-cta { padding: 28px 22px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .code-rain { display: none; }
}
