:root{
 --paper:#f4efe6; --card:#efe7d8; --ink:#2b2620; --ink-soft:#5c5348;
 --accent:#c96f2f; --accent-deep:#a8541d; --water:#7fa8a4; --water-deep:#6e9995;
 --line:#d8cdb8; --ok:#4d7a54;
}
*{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%}
body{background:var(--paper);color:var(--ink);font:16px/1.5 system-ui,-apple-system,"Segoe UI",sans-serif;display:flex;flex-direction:column;min-height:100dvh}
main{flex:1;width:100%;max-width:520px;margin:0 auto;padding:14px 16px 96px;display:flex;flex-direction:column;gap:10px}
header{display:flex;align-items:center;justify-content:space-between}
h1{font:italic 700 1.6rem/1.1 Georgia,"Times New Roman",serif;letter-spacing:.01em}
h1 span{color:var(--accent)}
.info-btn{width:40px;height:40px;border-radius:50%;border:1.5px solid var(--line);background:var(--card);color:var(--ink-soft);font:italic 700 1.05rem Georgia,serif;cursor:pointer}
.info-btn:focus-visible,.info-btn:hover{outline:none;border-color:var(--accent);color:var(--accent)}
.stage-wrap{position:relative}
#stage{width:100%;border-radius:14px;background:var(--card);border:1px solid var(--line);outline:none;touch-action:pan-y}
#stage svg{display:block;width:100%;height:auto;border-radius:14px}
#stage:focus-visible{box-shadow:0 0 0 2px var(--accent)}
.frame-bg{fill:#efe7d8;stroke:#d8cdb8;stroke-width:1.5}
.caption-wrap{min-height:86px}
#stepTitle{font:700 1.22rem/1.25 system-ui;letter-spacing:.005em;outline:none}
#stepCaption{margin-top:4px;color:var(--ink-soft);font-size:1rem}
/* quiz step: the question owns the whole stage area */
#quiz{background:var(--card);border:1px solid var(--line);border-radius:14px;padding:22px 18px;display:flex;flex-direction:column;gap:14px}
#quiz h2{font-size:1.28rem;line-height:1.3}
#quizOpts{display:flex;flex-direction:column;gap:10px}
#quizOpts button{min-height:52px;padding:12px 14px;text-align:left;font-size:1.02rem;border-radius:12px;border:1.5px solid var(--line);background:var(--paper);color:var(--ink);cursor:pointer;transition:border-color .18s ease,background .18s ease,transform .18s ease}
#quizOpts button:hover:not(:disabled){border-color:var(--accent)}
#quizOpts button:disabled{cursor:default}
#quizOpts button.picked-wrong{border-color:#b14a3a;background:#f3e2dc;color:#7d3428;opacity:.75}
#quizOpts button.picked-right{border-color:var(--ok);background:#e3ecdd}
#quizVerdict{min-height:24px;font-size:.98rem;color:var(--ink-soft)}
#quizVerdict.good{color:var(--ok)}
#quizAfter svg{display:block;width:100%;height:auto;border-radius:10px}
/* dock */
.dock{position:sticky;bottom:0;background:color-mix(in srgb,var(--paper) 92%,transparent);backdrop-filter:blur(6px);border-top:1px solid var(--line);padding:10px 12px calc(10px + env(safe-area-inset-bottom))}
.dock-inner{max-width:520px;margin:0 auto;display:flex;align-items:center;gap:8px;flex-wrap:wrap}
button{font:inherit}
.quiet{border:1.5px solid var(--line);background:transparent;color:var(--ink-soft);border-radius:999px;padding:9px 14px;cursor:pointer;min-height:44px}
.quiet:hover:not(:disabled){border-color:var(--accent);color:var(--accent)}
.quiet:disabled{opacity:.4;cursor:default}
.play{width:48px;height:48px;border-radius:50%;font-size:1.05rem;color:var(--accent);border-color:var(--accent);padding:0}
.dots{display:flex;gap:7px;align-items:center;padding:0 4px}
.dots i{width:8px;height:8px;border-radius:50%;background:var(--line);transition:background .2s ease,transform .2s ease}
.dots i.on{background:var(--accent);transform:scale(1.25)}
.counter{font-size:.86rem;color:var(--ink-soft);min-width:36px;text-align:center}
.hint{flex:1;text-align:right;font-size:.84rem;color:var(--accent-deep);min-height:1em}
.primary{margin-left:auto;border:none;background:var(--accent);color:#fff;border-radius:999px;padding:12px 22px;min-height:48px;font-weight:650;font-size:1rem;cursor:pointer;transition:background .18s ease,transform .18s ease}
.primary:hover:not(:disabled){background:var(--accent-deep)}
.primary:disabled{opacity:.55;cursor:default}
/* slider inside svg scenes */
input.time{width:100%;appearance:none;height:34px;background:transparent;margin-top:2px}
input.time::-webkit-slider-runnable-track{height:6px;border-radius:3px;background:var(--line)}
input.time::-webkit-slider-thumb{appearance:none;width:26px;height:26px;border-radius:50%;background:var(--accent);border:3px solid #fff;box-shadow:0 1px 4px rgba(0,0,0,.25);margin-top:-10px}
input.time::-moz-range-track{height:6px;border-radius:3px;background:var(--line)}
input.time::-moz-range-thumb{width:22px;height:22px;border-radius:50%;background:var(--accent);border:3px solid #fff}
/* svg scene classes */
.ink{stroke:#6e4f33;stroke-width:1.6;stroke-linejoin:round;stroke-linecap:round}
.lbl{font:italic 12.5px Georgia,serif;fill:#6a5c48}
.lbl-strong{font:italic 600 13px Georgia,serif;fill:#4a3f2f}
.tick{stroke:#8a7350;stroke-width:1.4;stroke-linecap:round}
.volc{fill:#8a5a36;stroke:#6e4f33;stroke-width:1.2}
.lake{fill:var(--water)}
.glow{fill:none;stroke:var(--accent);stroke-width:2.4;stroke-linecap:round;opacity:.85}
.riftline{fill:none;stroke:var(--accent);stroke-width:3;stroke-linecap:round}
.arrow{fill:none;stroke:var(--accent-deep);stroke-width:2.6;stroke-linecap:round}
.hint-arrow{animation:nudge 1.6s ease-in-out infinite}
@keyframes nudge{0%,100%{transform:translateX(0)}50%{transform:translateX(-7px)}}
.plume-pulse{animation:pulse 2.8s ease-in-out infinite}
@keyframes pulse{0%,100%{opacity:.75}50%{opacity:1}}
.smoke{fill:none;stroke:#a29383;stroke-width:1.6;stroke-linecap:round;opacity:.7}
.waveline{fill:none;stroke:#5f8f8b;stroke-width:1.5;stroke-linecap:round}
.fadein{animation:fade .45s ease both}
@keyframes fade{from{opacity:0}to{opacity:1}}
/* dialog */
dialog{border:1px solid var(--line);border-radius:16px;background:var(--paper);color:var(--ink);max-width:min(480px,92vw);padding:22px 20px}
dialog::backdrop{background:rgba(43,38,32,.35)}
dialog h2{font-size:1.15rem;margin-bottom:8px}
dialog h3{font-size:.95rem;margin:14px 0 6px;color:var(--ink-soft)}
dialog p{font-size:.95rem;color:var(--ink);margin-bottom:8px}
#sources{display:flex;flex-direction:column;gap:6px;margin-top:4px}
#sources a{color:var(--accent-deep);font-size:.92rem}
.dialog-actions{display:flex;justify-content:flex-end;margin-top:16px}
.dialog-actions button{border:1.5px solid var(--line);background:var(--card);border-radius:999px;padding:9px 18px;cursor:pointer}
@media (max-width:560px){
 main{padding:10px 12px 150px}
 .hint{flex-basis:100%;text-align:left;order:6}
 .primary{margin-left:auto}
}
@media (prefers-reduced-motion:reduce){
 *,*::before,*::after{animation:none!important;transition:none!important}
}
.timebox{padding:0 12px 10px}
.ma-label{display:block;text-align:center;font:italic 12.5px Georgia,serif;color:var(--ink-soft)}
#quiz[hidden]{display:none}
#quizAfter{max-width:280px;margin:0 auto;width:100%}
#stage{box-shadow:0 1px 0 rgba(110,79,51,.06),0 10px 26px -18px rgba(110,79,51,.35)}
/* polish iteration 2: motion life */
.waveline{animation:drift 3.2s ease-in-out infinite alternate}
@keyframes drift{from{transform:translateX(0)}to{transform:translateX(7px)}}
.smoke{animation:smokeup 3.6s ease-in-out infinite}
@keyframes smokeup{0%,100%{opacity:.45;transform:translateY(0)}50%{opacity:.8;transform:translateY(-3px)}}
.hint-arrow{animation:nudge 1.6s ease-in-out infinite}
/* polish iteration 3: finish detail */
#dock{backdrop-filter:blur(6px);background:rgba(244,239,230,.88)}
button:focus-visible,input:focus-visible{outline:2px solid var(--accent,#c96f3b);outline-offset:2px}
.cap{line-height:1.5}
h1{letter-spacing:-.01em}
input.time{accent-color:#c96f3b}
