:root {
  --grass: #1f7a3a;
  --grass-2: #23853f;
  --grass-dark: #0f3d1e;
  --chalk: #ffffff;
  --ink: #13261a;
  --card: #ffffff;
  --muted: #5d6f63;
  --gold: #ffcc33;
  --red: #e5484d;
  --amber: #f5a524;
  --green: #22a356;
  --blue: #2f7bf6;
  --line: #d9e3dc;
  --shadow: 0 6px 24px rgba(0, 0, 0, .18);
  --radius: 16px;
  --display: 'Lilita One', 'Arial Black', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Nunito', system-ui, -apple-system, Segoe UI, sans-serif;
  color: var(--ink);
  background:
    repeating-linear-gradient(90deg, var(--grass) 0 80px, var(--grass-2) 80px 160px),
    var(--grass);
  min-height: 100vh;
  display: flex; flex-direction: column;
}
a { color: inherit; }
h1, h2, h3 { font-family: var(--display); font-weight: 400; letter-spacing: .3px; margin: 0 0 .4em; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  background: var(--grass-dark); color: var(--chalk);
  box-shadow: 0 2px 10px rgba(0,0,0,.3);
}
.brand { font-family: var(--display); font-size: 22px; text-decoration: none; white-space: nowrap; }
.scoreboard { margin-left: auto; display: flex; gap: 14px; align-items: center; font-size: 14px; flex-wrap: wrap; justify-content: flex-end; }
.scoreboard b { color: var(--gold); font-size: 16px; }
.due-pill { background: var(--gold); color: var(--ink); padding: 3px 10px; border-radius: 99px; font-weight: 800; text-decoration: none; }
.icon-btn { background: none; border: 0; font-size: 22px; cursor: pointer; padding: 4px; }
@media (max-width: 560px) { .brand span { display: none; } .scoreboard { gap: 8px; font-size: 12px; } }

main { width: 100%; max-width: 920px; margin: 0 auto; padding: 20px 16px 40px; flex: 1; outline: none; }
.foot { text-align: center; color: rgba(255,255,255,.75); font-size: 12px; padding: 16px; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: 800 16px 'Nunito', system-ui, sans-serif;
  background: var(--gold); color: var(--ink);
  border: 0; border-bottom: 4px solid #c99a12;
  border-radius: 12px; padding: 10px 18px;
  cursor: pointer; text-decoration: none;
  transition: transform .08s;
}
.btn:active { transform: translateY(2px); border-bottom-width: 2px; }
.btn:focus-visible, .opt:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.btn.big { font-size: 18px; padding: 14px 22px; }
.btn.alt { background: #fff; border-bottom-color: #c9d3cc; }
.btn.ghost { background: #eef3ef; border-bottom-color: #cbd6ce; }
.btn.small { font-size: 14px; padding: 7px 12px; }
.btn.danger { background: var(--red); color: #fff; border-bottom-color: #a32a2e; }
.btn:disabled { opacity: .5; cursor: default; }
.pill { display: inline-block; padding: 10px 16px; border-radius: 99px; font-weight: 800; background: #fff; }
.pill.ok { background: #dff5e7; color: #136c36; }

/* home */
.hero {
  background: var(--card); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
  border-top: 8px solid var(--gold);
}
.hero h1 { font-size: clamp(26px, 5vw, 38px); }
.hero p { margin: 0 0 14px; font-size: 17px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.topic-head { color: #fff; margin: 28px 0 10px; font-size: 26px; text-shadow: 0 2px 0 rgba(0,0,0,.25); }
.topic-head span { background: rgba(0,0,0,.25); padding: 2px 8px; border-radius: 8px; font-size: 18px; vertical-align: middle; }
.fixtures { display: grid; gap: 10px; }
.fixture {
  display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: center;
  background: var(--card); border-radius: 14px; padding: 12px 14px; text-decoration: none;
  box-shadow: 0 3px 0 rgba(0,0,0,.18); transition: transform .1s;
}
.fixture:hover { transform: translateY(-2px); }
.fixture.locked { opacity: .65; filter: grayscale(.7); }
.fixture.won { background: linear-gradient(90deg, #fff 60%, #fff6d6); }
.fx-emoji { font-size: 34px; text-align: center; }
.fx-main small { color: var(--muted); display: block; font-weight: 700; }
.fx-main em { color: #8a4dd6; font-style: normal; }
.fx-main b { font-size: 18px; display: block; margin-bottom: 6px; }
.bar { display: block; height: 8px; background: #e7eee9; border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--green), var(--gold)); border-radius: 99px; }
.fx-status { text-align: right; font-weight: 800; font-size: 14px; white-space: nowrap; }
.fx-status small { display: block; color: var(--muted); font-weight: 700; }
@media (max-width: 480px) {
  .fixture { grid-template-columns: 40px 1fr; }
  .fx-emoji { font-size: 28px; }
  .fx-status { grid-column: 2; text-align: left; }
  .fx-status small { display: inline; margin-left: 6px; }
}

/* section header */
.sec-head { color: #fff; margin-bottom: 14px; }
.sec-head .back { color: #fff; opacity: .85; text-decoration: none; font-weight: 800; }
.sec-head h1 { font-size: clamp(24px, 5vw, 36px); margin-top: 8px; text-shadow: 0 2px 0 rgba(0,0,0,.25); }
.sec-head h1 small { font-size: .55em; opacity: .8; }
.sec-head .intro { font-size: 17px; margin: 0 0 12px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs a {
  background: rgba(0,0,0,.25); color: #fff; padding: 9px 14px; border-radius: 12px 12px 0 0;
  text-decoration: none; font-weight: 800;
}
.tabs a.on { background: var(--card); color: var(--ink); }
.tabs small { background: var(--gold); color: var(--ink); border-radius: 99px; padding: 0 7px; margin-left: 4px; }

/* scene */
.scene, .flash, .done-card {
  background: var(--card); border-radius: 0 var(--radius) var(--radius) var(--radius); padding: 18px; box-shadow: var(--shadow);
}
.scene-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.scene-top h2 { font-size: 24px; }
.stage {
  position: relative; width: 100%; aspect-ratio: 16 / 10; overflow: hidden;
  container-type: inline-size;
  --u: 1cqw;
  border-radius: 12px;
  background:
    radial-gradient(circle at 50% 50%, transparent 17%, rgba(255,255,255,.55) 17.4%, rgba(255,255,255,.55) 18%, transparent 18.4%),
    linear-gradient(90deg, transparent calc(50% - 1px), rgba(255,255,255,.55) calc(50% - 1px), rgba(255,255,255,.55) calc(50% + 1px), transparent calc(50% + 1px)),
    repeating-linear-gradient(90deg, #2e9a4c 0 10%, #2a8e46 10% 20%);
  color: #fff;
  font-size: calc(var(--u) * 2.2);
}
.stage > * { position: absolute; }
.commentator {
  margin: 14px 0 0; padding: 12px 14px; background: #fff7d6; border-left: 6px solid var(--gold);
  border-radius: 10px; font-style: italic; font-weight: 700;
}
.scene-text { font-size: 17px; line-height: 1.55; margin: 12px 0; }
.keyfact { background: #e8f1ff; border-left: 6px solid var(--blue); padding: 10px 14px; border-radius: 10px; font-size: 16px; }
.keyfact b { display: block; font-family: var(--display); font-weight: 400; color: var(--blue); margin-bottom: 2px; }
.scene-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; gap: 8px; }
.dots { display: flex; justify-content: center; gap: 8px; margin-top: 12px; }
.dots a { width: 12px; height: 12px; border-radius: 50%; background: #cfdcd3; }
.dots a.on { background: var(--green); transform: scale(1.25); }

/* scene animation helpers */
.pop { opacity: 0; animation: pop .55s cubic-bezier(.2,1.4,.4,1) forwards; }
.slide-in { opacity: 0; animation: slideIn .55s ease-out forwards; }
.fade { opacity: 0; animation: fade .7s ease-out forwards; }
.bounce { display: inline-block; animation: bounce 1.1s ease-in-out infinite; }
@keyframes pop { from { opacity: 0; scale: .3; } to { opacity: 1; scale: 1; } }
@keyframes slideIn { from { opacity: 0; translate: 0 18px; } to { opacity: 1; translate: 0 0; } }
@keyframes fade { to { opacity: 1; } }
@keyframes bounce { 0%, 100% { translate: 0 0; } 50% { translate: 0 -22%; } }
.centered { transform: translate(-50%, -50%); }

.token {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  background: rgba(15, 61, 30, .82); border: calc(var(--u) * .2) solid rgba(255,255,255,.7);
  border-radius: calc(var(--u) * 1.4); padding: calc(var(--u) * .6) calc(var(--u) * 1); max-width: calc(var(--u) * 22);
}
.tok-emoji { font-size: calc(var(--u) * 4.2); line-height: 1.1; }
.tok-label { overflow-wrap: break-word; font-weight: 800; font-size: calc(var(--u) * 1.9); line-height: 1.15; }
.tok-note { font-size: calc(var(--u) * 1.5); opacity: .9; line-height: 1.15; }
.token.big .tok-emoji { font-size: calc(var(--u) * 6); }
.token.big .tok-label { font-size: calc(var(--u) * 2.4); }

.st-caption {
  left: 3%; right: 3%; bottom: 3%; min-height: 14%;
  background: rgba(0,0,0,.6); border-radius: calc(var(--u) * 1.2); padding: calc(var(--u) * 1) calc(var(--u) * 1.6);
  font-weight: 800; font-size: calc(var(--u) * 2.3); display: flex; align-items: center; justify-content: center; text-align: center;
}
.flash { }
.st-caption.flash, .cycle-detail.flash { animation: fade .5s ease-out; }

/* squad */
.cell { border: calc(var(--u) * .5) solid #ffd6e0; background: rgba(255, 182, 193, .25); border-radius: 48% 52% 45% 55% / 50% 45% 55% 50%; }
.cell-plant { border: calc(var(--u) * 1.4) solid #7bc96f; outline: calc(var(--u) * .4) solid #3d8b33; background: rgba(160, 230, 150, .25); border-radius: calc(var(--u) * 1); }
.cell-bacteria { border: calc(var(--u) * .9) solid #c9a7ff; background: rgba(200, 170, 255, .2); border-radius: calc(var(--u) * 30); top: 22% !important; height: 56% !important; }
.flagellum { position: absolute; right: -calc(var(--u) * 9); top: 45%; width: calc(var(--u) * 9); height: calc(var(--u) * 2); border-top: calc(var(--u) * .5) dashed #c9a7ff; border-radius: 50%; }
.squad-list { display: flex; flex-direction: column; gap: calc(var(--u) * .8); overflow: hidden; }
.squad-item { display: flex; gap: calc(var(--u) * 1); align-items: flex-start; background: rgba(0,0,0,.45); border-radius: calc(var(--u) * 1); padding: calc(var(--u) * .7) calc(var(--u) * 1); font-size: calc(var(--u) * 1.85); line-height: 1.25; }
.squad-item > span { font-size: calc(var(--u) * 3); line-height: 1; }

/* versus */
.vs-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: calc(var(--u) * 2); }
.vs-team { background: rgba(0,0,0,.5); border-radius: calc(var(--u) * 1.4); padding: calc(var(--u) * 1); text-align: center; font-family: var(--display); font-size: calc(var(--u) * 3); }
.vs-team span { display: block; font-size: calc(var(--u) * 4.6); }
.vs-vs { font-family: var(--display); font-size: calc(var(--u) * 5); color: var(--gold); text-shadow: 0 calc(var(--u) * .3) 0 rgba(0,0,0,.4); }
.vs-rows { display: flex; flex-direction: column; gap: calc(var(--u) * .8); justify-content: center; }
.vs-row { display: grid; grid-template-columns: 1fr 1.2fr 1fr; gap: calc(var(--u) * 1); align-items: center; background: rgba(0,0,0,.42); border-radius: calc(var(--u) * 1); padding: calc(var(--u) * .8) calc(var(--u) * 1); font-size: calc(var(--u) * 2.1); }
.vs-f { text-align: center; font-weight: 800; color: var(--gold); }
.vs-l, .vs-r { text-align: center; }

/* flow */
.flow-canvas { inset: 0; width: 100%; height: 100%; }
.flow-label, .flow-count { text-align: center; font-weight: 800; font-size: calc(var(--u) * 2.2); background: rgba(0,0,0,.45); border-radius: calc(var(--u) * 1); padding: calc(var(--u) * .5); }
.flow-count { background: rgba(255,255,255,.9); color: var(--ink); top: 83% !important; }
.flow-mem { text-align: center; font-size: calc(var(--u) * 1.7); font-weight: 800; top: 92% !important; }
.stage .flow-canvas ~ .st-caption { bottom: auto; top: 11%; min-height: 0; background: rgba(0,0,0,.45); font-size: calc(var(--u) * 2); left: 20%; right: 20%; }

/* split */
.split-wrap > * { position: absolute; transition: all 1s ease-in-out; }
.split-wrap.no-trans > * { transition: none; }
.split-cell { border: calc(var(--u) * .5) solid #ffd6e0; background: rgba(255,182,193,.3); border-radius: 50%; }
.split-cell.binary { border-color: #c9a7ff; background: rgba(200,170,255,.25); border-radius: calc(var(--u) * 30); }
.split-bit.chromo { border-radius: calc(var(--u) * 1); box-shadow: 0 0 0 calc(var(--u) * .2) rgba(0,0,0,.25); }
.split-bit.loop { border: calc(var(--u) * .55) solid #ffcc33; border-radius: 50%; }
.split-bit.plasmid { border: calc(var(--u) * .45) solid #ff8fab; border-radius: 50%; }

/* cycle */
.cycle-ring { border: calc(var(--u) * .7) dashed rgba(255,255,255,.75); border-radius: 50%; height: auto !important; }
.cycle-node {
  position: absolute; transform: translate(-50%, -50%);
  background: rgba(15,61,30,.9); border: calc(var(--u) * .3) solid #fff; border-radius: calc(var(--u) * 1.4); padding: calc(var(--u) * .8) calc(var(--u) * 1.2);
  font-weight: 800; font-size: calc(var(--u) * 2); text-align: center; max-width: calc(var(--u) * 18); transition: all .4s;
}
.cycle-node.on { background: var(--gold); color: var(--ink); scale: 1.12; }
.cycle-ball { position: absolute; transform: translate(-50%, -50%); font-size: calc(var(--u) * 4); transition: left 1s ease-in-out, top 1s ease-in-out; }
.cycle-detail { background: rgba(0,0,0,.5); border-radius: calc(var(--u) * 1.4); padding: calc(var(--u) * 2); font-size: calc(var(--u) * 2.3); display: flex; flex-direction: column; justify-content: center; }
.cycle-detail h4 { font-family: var(--display); font-weight: 400; font-size: calc(var(--u) * 3.6); margin: calc(var(--u) * .5) 0; color: var(--gold); }
.cycle-detail p { margin: 0; line-height: 1.35; }
.cycle-step { font-weight: 800; opacity: .8; }

/* ladder */
.ladder { display: flex; flex-direction: column; justify-content: center; gap: calc(var(--u) * .9); }
.ladder-row { display: grid; grid-template-columns: calc(var(--u) * 5) calc(var(--u) * 20) 1fr calc(var(--u) * 15); gap: calc(var(--u) * 1.2); align-items: center; background: rgba(0,0,0,.42); border-radius: calc(var(--u) * 1); padding: calc(var(--u) * .6) calc(var(--u) * 1); font-size: calc(var(--u) * 2.1); }
.ladder-emoji { font-size: calc(var(--u) * 3.4); text-align: center; }
.ladder-name { font-weight: 800; }
.ladder-bar { height: calc(var(--u) * 1.8); background: rgba(255,255,255,.2); border-radius: 99px; overflow: hidden; }
.ladder-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), #ff8a3d); border-radius: 99px; }
.ladder-size { text-align: right; font-weight: 800; }
.ladder-size small { display: block; font-weight: 700; opacity: .8; font-size: calc(var(--u) * 1.7); }

/* triangle */
.tri-svg { width: 100%; height: 100%; }
.tri-svg polygon { fill: rgba(0,0,0,.4); stroke: #fff; stroke-width: 3; }
.tri-svg line { stroke: #fff; stroke-width: 3; }
.tri-t { position: absolute; transform: translate(-50%, -50%); font-weight: 800; font-size: calc(var(--u) * 2.2); text-align: center; width: 42%; line-height: 1.15; transition: all .3s; padding: calc(var(--u) * .3); border-radius: calc(var(--u) * .6); }
.tri-top { left: 50%; top: 40%; }
.tri-left { left: 30%; top: 75%; }
.tri-right { left: 70%; top: 75%; }
.tri-t.covered { background: var(--gold); color: var(--ink); scale: 1.15; }
.tri-side { display: flex; flex-direction: column; justify-content: center; gap: calc(var(--u) * 1); }
.tri-line { background: rgba(0,0,0,.45); border-radius: calc(var(--u) * 1); padding: calc(var(--u) * .9) calc(var(--u) * 1.4); font-size: calc(var(--u) * 2.3); }
.tri-line b { color: var(--gold); }
.tri-line.ex { background: rgba(255,255,255,.92); color: var(--ink); font-weight: 700; font-size: calc(var(--u) * 2.1); }

/* branch */
.branch-svg { inset: 0; width: 100%; height: 100%; }
.branch-line { stroke: #fff; stroke-width: .5; stroke-dasharray: 100; stroke-dashoffset: 100; animation: draw 1s ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* chain */
.chain { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; align-content: center; gap: calc(var(--u) * 1.2); }
.chain-step { display: flex; flex-direction: column; align-items: center; text-align: center; background: rgba(15,61,30,.85); border: calc(var(--u) * .25) solid rgba(255,255,255,.8); border-radius: calc(var(--u) * 1.4); padding: calc(var(--u) * 1); width: calc(var(--u) * 17); position: relative !important; }
.chain-step b { font-size: calc(var(--u) * 2); line-height: 1.15; }
.chain-step small { font-size: calc(var(--u) * 1.55); line-height: 1.2; opacity: .9; margin-top: calc(var(--u) * .3); }
.chain-arrow { font-size: calc(var(--u) * 3.6); color: var(--gold); position: relative !important; }
.chain > * { position: relative; }

/* growth */
.growth { display: flex; align-items: flex-end; gap: calc(var(--u) * 1); }
.growth-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; }
.growth-col i { display: block; width: 100%; background: linear-gradient(180deg, #c9a7ff, #8a4dd6); border-radius: calc(var(--u) * .8) calc(var(--u) * .8) 0 0; transform-origin: bottom; scale: 1 0; animation: grow .6s ease-out forwards; }
.growth-n { font-weight: 800; font-size: calc(var(--u) * 1.7); opacity: 0; animation: fade .5s forwards; }
.growth-t { font-size: calc(var(--u) * 1.6); margin-top: calc(var(--u) * .4); }
@keyframes grow { to { scale: 1 1; } }
.growth-formula { background: rgba(255,255,255,.92); color: var(--ink); border-radius: calc(var(--u) * 1.2); padding: calc(var(--u) * 1) calc(var(--u) * 1.6); font-size: calc(var(--u) * 2.3); text-align: center; font-weight: 700; }
.growth-formula b { color: #8a4dd6; }

/* cubes */
.cubes { display: flex; gap: calc(var(--u) * 2); align-items: stretch; justify-content: center; }
.cube-col { flex: 1; display: flex; flex-direction: column; gap: calc(var(--u) * 1); position: relative !important; }
.cube-wrap { flex: 1; display: flex; align-items: flex-end; justify-content: center; }
.cube { aspect-ratio: 1; background: linear-gradient(135deg, #ffe08a, #f5a524); border: calc(var(--u) * .3) solid #fff; border-radius: calc(var(--u) * .6); box-shadow: calc(var(--u) * 1.2) -calc(var(--u) * 1.2) 0 rgba(255,255,255,.25); }
.cube-stats { background: rgba(0,0,0,.5); border-radius: calc(var(--u) * 1); padding: calc(var(--u) * 1); display: flex; flex-direction: column; font-size: calc(var(--u) * 1.9); text-align: center; }
.cube-r { margin-top: calc(var(--u) * .5); color: var(--gold); font-weight: 800; font-size: calc(var(--u) * 2.4); }

/* commentary */
.comm-emoji { display: flex; justify-content: center; gap: calc(var(--u) * 3); font-size: calc(var(--u) * 8); }
.comm-lines { display: flex; flex-direction: column; gap: calc(var(--u) * 1.2); justify-content: center; }
.comm-line { background: rgba(0,0,0,.5); border-radius: calc(var(--u) * 1.2); padding: calc(var(--u) * 1) calc(var(--u) * 1.6); font-size: calc(var(--u) * 2.4); font-weight: 700; }

/* training */
.pitch-progress {
  position: relative; height: 44px; margin: 0 0 6px; border-radius: 12px;
  background: repeating-linear-gradient(90deg, #2e9a4c 0 10%, #2a8e46 10% 20%);
  border: 3px solid #fff;
}
.pp-ball { position: absolute; top: 50%; transform: translateY(-50%); font-size: 26px; transition: left .6s cubic-bezier(.3,1.5,.5,1); }
.pp-goal { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); font-size: 28px; }
.pitch-progress + .muted { color: #e9f5ec; margin-bottom: 12px; font-weight: 700; }
.flash { border-radius: var(--radius); }
.stage-tag { display: flex; align-items: center; gap: 6px; font-weight: 800; color: var(--muted); font-size: 14px; margin-bottom: 8px; }
.stage-tag i { width: 14px; height: 14px; border-radius: 50%; background: #e1e8e3; display: inline-block; }
.stage-tag i.got { background: var(--green); }
.stage-tag i.now { background: var(--gold); box-shadow: 0 0 0 3px #fff3c4; }
.q { font-size: clamp(20px, 4vw, 26px); font-weight: 800; line-height: 1.3; margin: 6px 0 16px; }
.options { display: grid; gap: 10px; }
.opt {
  text-align: left; font: 700 17px 'Nunito', system-ui, sans-serif; color: var(--ink);
  background: #f3f7f4; border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer;
}
.opt:hover:not(:disabled) { border-color: var(--green); }
.opt kbd { display: inline-block; min-width: 22px; text-align: center; background: #fff; border: 1px solid var(--line); border-radius: 6px; margin-right: 6px; font: 800 13px 'Nunito', sans-serif; padding: 1px 4px; }
.opt.right { background: #dff5e7; border-color: var(--green); }
.opt.wrong { background: #fde3e4; border-color: var(--red); }
.opt:disabled { cursor: default; }
.typed { display: flex; gap: 8px; }
.typed input { flex: 1; min-width: 0; font: 700 18px 'Nunito', sans-serif; padding: 12px 14px; border: 2px solid var(--line); border-radius: 12px; }
.typed input:focus { outline: none; border-color: var(--blue); }
.typed input.right { border-color: var(--green); background: #dff5e7; }
.typed input.wrong { border-color: var(--red); background: #fde3e4; }
.feedback { margin-top: 12px; }
.verdict { font-family: var(--display); font-size: 26px; }
.verdict.ok { color: var(--green); }
.verdict.no { color: var(--red); }
.model { background: #f3f7f4; border-radius: 10px; padding: 10px 14px; margin-top: 8px; font-size: 17px; }
.model.big { font-size: 20px; font-weight: 800; background: #fff7d6; }
.why { margin-top: 8px; background: #e8f1ff; border-radius: 10px; padding: 10px 14px; font-size: 16px; }
.card-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 14px; }
.grade.no { background: #fde3e4; border-bottom-color: #e5a5a8; }
.grade.meh { background: #fff1d6; border-bottom-color: #e8c57c; }
.grade.ok { background: #dff5e7; border-bottom-color: #93d3aa; }
@media (max-width: 480px) { .card-actions .grade { flex: 1; padding: 10px 6px; font-size: 14px; } }

.done-card { text-align: center; border-radius: var(--radius); }
.done-card .trophy { font-size: 72px; animation: bounce 1.2s ease-in-out infinite; display: inline-block; }
.done-card .hero-actions { justify-content: center; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50;
  background: var(--grass-dark); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 800;
  box-shadow: var(--shadow); transition: opacity .4s; max-width: calc(100vw - 32px); text-align: center;
}
.toast.out { opacity: 0; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 40; overflow: hidden; }
.confetti span { position: absolute; top: -40px; animation: fall 3s linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }

/* settings */
dialog { border: 0; border-radius: var(--radius); padding: 0; max-width: min(480px, calc(100vw - 32px)); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(0,0,0,.5); }
.settings-body { padding: 20px; }
.settings-body h3 { font-size: 18px; margin-top: 18px; }
.settings-body textarea { width: 100%; font: 12px ui-monospace, monospace; border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.gap { gap: 8px; margin-top: 8px; }
.row.end { justify-content: flex-end; margin-top: 18px; }

@media (prefers-reduced-motion: reduce) {
  .pop, .slide-in, .fade { animation-duration: .01s !important; }
  .bounce { animation: none; }
}

/* phones: taller stage and bigger text inside the animations */
@media (max-width: 640px) {
  .stage { aspect-ratio: 1 / 1; --u: 1.45cqw; }
  .scene { padding: 12px; }
}

/* ladder: true-scale zoom + powers-of-ten ruler */
.zoom-view { overflow: hidden; }
.zoom-group { position: absolute; inset: 0; transition: transform 1.3s ease-in, opacity .5s ease-in .9s; }
.zc { position: absolute; transform: translateX(-50%); border-radius: 50%; border: 2px solid #fff; display: flex; align-items: center; justify-content: center; line-height: 1; }
.zc.big { background: rgba(255, 204, 51, .35); }
.zc.small { background: rgba(255, 143, 171, .6); }
.zc.tiny { border: 0; background: #ff8fab; box-shadow: 0 0 0 3px rgba(255,143,171,.5); animation: ping 1.2s ease-in-out infinite; }
@keyframes ping { 50% { box-shadow: 0 0 0 9px rgba(255,143,171,0); } }
.zl { position: absolute; transform: translateX(-50%); text-align: center; font-weight: 800; font-size: calc(var(--u) * 1.9); white-space: nowrap; line-height: 1.1; }
.zl small { display: block; font-weight: 700; opacity: .85; font-size: .85em; }
.zl.tiny-note { color: #ffd6e0; animation: bounce 1s ease-in-out infinite; }
.zoom-cap { background: rgba(0,0,0,.55); border-radius: calc(var(--u) * 1.2); padding: calc(var(--u) * 1) calc(var(--u) * 1.6); font-size: calc(var(--u) * 2.1); line-height: 1.3; text-align: center; transition: opacity .4s; }
.zoom-cap .hl { color: var(--gold); }
.ruler-title { position: absolute; left: 0; right: 0; top: 0; text-align: center; font-size: calc(var(--u) * 1.5); font-weight: 700; opacity: .9; }
.ruler-line { position: absolute; left: 0; right: 0; top: 58%; height: 3px; background: #fff; border-radius: 3px; }
.ruler-tick { position: absolute; top: 50%; height: 20%; width: 2px; background: #fff; transform: translateX(-50%); }
.ruler-tl { position: absolute; top: 72%; transform: translateX(-50%); font-size: calc(var(--u) * 1.35); font-weight: 700; white-space: nowrap; }
.ruler-mark { position: absolute; top: 22%; transform: translateX(-50%); font-size: calc(var(--u) * 2.4); opacity: .45; transition: opacity .3s, scale .3s; }
.ruler-mark.on { opacity: 1; scale: 1.35; }

/* step-by-step scene controls */
.hold { animation: none !important; opacity: 0 !important; visibility: hidden !important; }
.stage { cursor: pointer; user-select: none; -webkit-user-select: none; }
.step-bar { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.step-info { flex: 1; font-weight: 800; color: var(--muted); }
.step-bar #stepNext { font-size: 17px; }
.step-hint { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
@media (hover: none) { .step-hint { display: none; } }
#nextScene.ready { animation: nudge 1.4s ease-in-out infinite; box-shadow: 0 0 0 4px rgba(255, 204, 51, .45); }
@keyframes nudge { 50% { translate: 3px 0; } }

/* tap-to-define glossary */
.term { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: help; text-decoration: underline dotted 2px; text-decoration-color: var(--blue); text-underline-offset: 3px; }
.term:hover, .term:focus-visible { background: #e8f1ff; border-radius: 3px; outline: none; }
.term-pop {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 60;
  width: min(460px, calc(100vw - 32px)); background: #fff; color: var(--ink);
  border-radius: 14px; border-top: 6px solid var(--blue); box-shadow: 0 10px 40px rgba(0,0,0,.35); padding: 14px 40px 12px 16px;
}
.term-pop[hidden] { display: none; }
.term-pop p { margin: 4px 0 6px; font-size: 16px; line-height: 1.4; }
.term-pop small { color: var(--muted); font-weight: 700; }
.term-close { position: absolute; top: 8px; right: 8px; border: 0; background: #eef3ef; border-radius: 50%; width: 28px; height: 28px; cursor: pointer; font-size: 14px; }
.step-hint + .commentator { margin-top: 10px; }
