/* Out-Sort Tim — zen garden meets Python */
:root {
  --bg: #f3ecdc;
  --bg2: #ebe2cc;
  --surface: #fbf7ee;
  --surface2: #f6f0e2;
  --ink: #1f2a2e;
  --muted: #56625f;
  --line: #d8ccb3;
  --blue: #3776ab;
  --blue-text: #2a5d8c;
  --yellow: #ffd43b;
  --moss: #4f7343;
  --clay: #8a5a2e;
  --tim: #7a5a1e;
  --danger: #a33a2a;
  --shadow: 0 1px 2px rgba(60, 45, 20, .08), 0 6px 20px rgba(60, 45, 20, .08);
  --radius: 16px;
  --font: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --rake: rgba(120, 95, 50, .07);
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #111618;
  --bg2: #161d20;
  --surface: #1b2326;
  --surface2: #20292d;
  --ink: #ece4d2;
  --muted: #a9b2ae;
  --line: #2f3a3e;
  --blue: #6ea9df;
  --blue-text: #8cbcea;
  --yellow: #ffd43b;
  --moss: #94b884;
  --clay: #d89a63;
  --tim: #e2b660;
  --danger: #f08470;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .3);
  --rake: rgba(255, 240, 210, .035);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--bg);
  background-image: repeating-linear-gradient(176deg, transparent 0 14px, var(--rake) 14px 16px);
  overflow-x: hidden;
}
img, svg { max-width: 100%; }
a { color: var(--blue-text); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
code, kbd, pre { font-family: var(--mono); font-size: .9em; }
code { background: var(--surface2); border: 1px solid var(--line); border-radius: 6px; padding: 0 .3em; }
kbd { border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 .35em; background: var(--surface); font-size: .8em; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(2.2rem, 7vw, 4.2rem); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 4vw, 2.1rem); font-weight: 700; }
h3 { font-size: 1.2rem; font-weight: 700; }
p { margin: 0 0 1em; }
.wrap { width: min(1120px, 100% - 2rem); margin-inline: auto; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.center { text-align: center; }
.error { color: var(--danger); }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 6px; }

.skip { position: absolute; left: -9999px; top: 0; background: var(--ink); color: var(--bg); padding: .5rem 1rem; z-index: 100; }
.skip:focus { left: 1rem; top: 1rem; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: .75rem; min-height: 60px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .5rem; text-decoration: none; color: var(--ink); font-family: var(--serif); font-weight: 800; font-size: 1.25rem; }
.brand em { color: var(--blue-text); font-style: italic; }
.site-nav { display: flex; gap: .25rem; margin-left: auto; }
.site-nav a { text-decoration: none; color: var(--ink); padding: .4rem .7rem; border-radius: 999px; font-weight: 700; font-size: .95rem; }
.site-nav a:hover { background: var(--surface2); }
.site-nav a[aria-current="page"] { background: var(--ink); color: var(--bg); }
.header-tools { display: flex; gap: .4rem; align-items: center; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-size: 1.1rem; cursor: pointer; line-height: 1;
}
.icon-btn:hover { background: var(--surface2); }
.icon-btn.muted { opacity: .55; }
.nav-toggle { display: none; }
@media (max-width: 820px) {
  .nav-toggle { display: inline-block; order: 3; }
  .header-tools { margin-left: auto; order: 2; }
  .brand { order: 1; }
  .site-nav { order: 4; display: none; width: 100%; flex-direction: column; margin: 0 0 .6rem; }
  .site-nav.open { display: flex; }
  .site-nav a { padding: .6rem .8rem; }
}
@media (max-width: 420px) {
  .brand span { font-size: 1.05rem; }
  .header-inner { gap: .4rem; }
  #sound-toggle { display: none; }
  .header-tools .btn-small { padding: .35rem .6rem; }
  .icon-btn { width: 36px; height: 36px; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: 700 1rem var(--font); color: var(--ink); background: var(--surface);
  border: 2px solid var(--ink); border-radius: 999px; padding: .55rem 1.1rem;
  cursor: pointer; text-decoration: none; transition: transform .12s ease, background .15s ease, box-shadow .15s ease;
  box-shadow: 0 3px 0 var(--ink);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--blue); color: #fff; border-color: var(--ink); }
[data-theme="dark"] .btn-primary { background: #2f6aa0; }
.btn-ghost { background: transparent; box-shadow: none; border-color: var(--line); }
.btn-ghost:active { box-shadow: none; }
.btn-small { padding: .35rem .8rem; font-size: .9rem; box-shadow: 0 2px 0 var(--ink); }
.btn-big { font-size: 1.15rem; padding: .8rem 1.6rem; }

/* ---------- hero ---------- */
.hero { padding: clamp(2rem, 6vw, 4.5rem) 0 2rem; position: relative; }
.hero-inner { max-width: 860px; }
.ribbon {
  display: inline-block; font-weight: 700; font-size: .9rem; letter-spacing: .04em;
  padding: .3rem .8rem; border-radius: 999px; background: var(--ink); color: var(--bg);
}
.hl { background: linear-gradient(transparent 62%, var(--yellow) 62%); padding: 0 .1em; }
[data-theme="dark"] .hl { color: var(--ink); background: linear-gradient(transparent 62%, rgba(255, 212, 59, .45) 62%); }
.lead { font-size: clamp(1.05rem, 2.4vw, 1.25rem); max-width: 720px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: .8rem; margin: 1.4rem 0; }
.hero-facts { list-style: none; padding: 0; margin: 0; display: flex; gap: 1.5rem; flex-wrap: wrap; color: var(--muted); }
.hero-facts b { font-family: var(--serif); font-size: 1.5rem; color: var(--ink); margin-right: .2rem; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(1rem, 3vw, 1.6rem); }

.challenge {
  display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between;
  background: var(--yellow); color: #1f2a2e; border: 2px solid #1f2a2e; border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom: 1.5rem;
}
.challenge p { margin: 0; font-weight: 700; }

/* ---------- levels ---------- */
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .5rem; margin-bottom: 1rem; }
.section-head h2 { margin: 0; }
.level-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .8rem; }
.level-card {
  position: relative; text-align: left; font: inherit; color: var(--ink); cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: .9rem .9rem .8rem 3.2rem;
  display: flex; flex-direction: column; gap: .1rem; min-height: 104px;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.level-card:hover { transform: translateY(-2px); border-color: var(--blue); box-shadow: var(--shadow); }
.lc-num {
  position: absolute; left: .8rem; top: .9rem; width: 1.9rem; height: 1.9rem; border-radius: 50%;
  display: grid; place-items: center; font-family: var(--serif); font-weight: 800;
  background: var(--bg2); border: 1px solid var(--line);
}
.level-card.played .lc-num { background: var(--ink); color: var(--bg); }
.lc-title { font-family: var(--serif); font-weight: 700; font-size: 1.05rem; line-height: 1.2; }
.lc-meta { font-size: .82rem; color: var(--muted); }
.lc-stars { margin-top: auto; letter-spacing: .1em; }
.lc-stars i { font-style: normal; color: var(--line); }
.lc-stars i.on { color: #d79b00; }
.lc-best { position: absolute; right: .7rem; bottom: .7rem; font-size: .75rem; color: var(--muted); }
.levels.compact .level-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.levels.compact .level-card { min-height: 0; padding-top: .6rem; padding-bottom: .6rem; }
.levels.compact .lc-meta, .levels.compact .lc-best { display: none; }
.levels.compact .lc-num { top: .6rem; }

.freeplay { margin: 1.2rem 0 .5rem; background: var(--surface); border: 1px dashed var(--line); border-radius: 14px; padding: .7rem 1rem; }
.freeplay summary { cursor: pointer; font-weight: 700; }
.fp-row { display: flex; flex-wrap: wrap; gap: .7rem 1rem; align-items: center; margin-top: .8rem; }
.fp-row input[type="range"] { width: 160px; accent-color: var(--blue); }
select, input[type="text"] {
  font: inherit; color: var(--ink); background: var(--surface2); border: 1px solid var(--line); border-radius: 10px; padding: .45rem .7rem; max-width: 100%;
}

/* ---------- game ---------- */
.game { margin: 1.5rem 0; scroll-margin-top: 70px; }
.game-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; }
.game-head > div:first-child { flex: 1 1 380px; }
.story { max-width: 640px; }
.counters { display: flex; gap: .6rem; align-items: stretch; }
.counter {
  min-width: 112px; text-align: center; border-radius: 14px; padding: .5rem .8rem; border: 2px solid var(--ink);
  display: flex; flex-direction: column; justify-content: center;
}
.counter span { font-family: var(--serif); font-weight: 800; font-size: 2.3rem; line-height: 1; }
.counter small { font-size: .78rem; color: var(--muted); }
.counter.mine span { color: var(--blue-text); }
.counter.tim span { color: var(--tim); }

.arena { display: grid; grid-template-columns: minmax(260px, 380px) 1fr; gap: 1.2rem; align-items: start; margin-top: 1rem; }
@media (max-width: 860px) { .arena { grid-template-columns: 1fr; } }
.scale-fig { margin: 0; background: var(--surface2); border-radius: 14px; padding: .6rem; border: 1px solid var(--line); position: sticky; top: 72px; z-index: 2; }
@media (max-width: 860px) {
  .scale-fig { top: 62px; padding: .3rem; }
  #scale { max-height: 150px; display: block; margin: 0 auto; }
}
#scale { width: 100%; height: auto; overflow: visible; }
#beam { transform-box: view-box; transform-origin: 200px 70px; transition: transform .45s cubic-bezier(.3, 1.6, .5, 1); }
#pan-left, #pan-right { transition: transform .45s cubic-bezier(.3, 1.6, .5, 1); }
.sc-shadow { fill: rgba(0, 0, 0, .12); }
.sc-base, .sc-post { fill: var(--clay); }
.sc-beam { fill: var(--ink); }
.sc-pin { fill: var(--yellow); stroke: var(--ink); stroke-width: 2; }
.sc-hub { fill: var(--yellow); stroke: var(--ink); stroke-width: 3; }
.sc-hub-text { font: 700 13px var(--mono); fill: #1f2a2e; }
.sc-string { stroke: var(--muted); stroke-width: 2; fill: none; }
.sc-pan { fill: var(--blue); stroke: var(--ink); stroke-width: 3; }
.pan-letter { font: 800 30px var(--font); fill: #fff; paint-order: stroke; stroke: rgba(0, 0, 0, .35); stroke-width: 3px; }
.scale-msg { text-align: center; font-weight: 700; min-height: 3.2em; padding: .3rem .4rem 0; font-size: .98rem; }

.board-h { font-family: var(--font); font-size: 1rem; margin: .2rem 0 .5rem; }
.board-h small { font-weight: 400; color: var(--muted); }
.stones { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: .5rem; }
@media (max-width: 420px) { .stones { grid-template-columns: repeat(4, 1fr); gap: .35rem; } }
.stone {
  position: relative; font: inherit; color: var(--ink); cursor: pointer;
  background: var(--surface2); border: 2px solid var(--line); border-radius: 14px; padding: .3rem .2rem .45rem;
  display: flex; flex-direction: column; align-items: center; gap: 0;
  transition: transform .18s ease, border-color .15s ease, background .15s ease;
}
.stone:hover { border-color: var(--blue); }
.stone svg { width: 100%; max-width: 64px; height: auto; display: block; }
.stone-shadow { fill: rgba(0, 0, 0, .15); }
.stone-sheen { fill: none; stroke: rgba(255, 255, 255, .28); stroke-width: 3; transform: translate(-2px, -3px) scale(.98); transform-origin: 50px 50px; }
.stone-letter { font: 800 26px var(--font); fill: #fff; paint-order: stroke; stroke: rgba(0, 0, 0, .3); stroke-width: 3px; }
.stone-pos { position: absolute; top: 2px; left: 6px; font-size: .68rem; color: var(--muted); }
.stone-range { font: 600 .82rem var(--mono); }
.stone-weight { font: 600 .75rem var(--mono); color: var(--clay); }
.stone-track { width: 80%; height: 5px; background: var(--line); border-radius: 3px; position: relative; margin-top: 3px; overflow: hidden; }
.stone-bar { position: absolute; top: 0; bottom: 0; background: var(--blue); border-radius: 3px; }
.stone.selected { transform: translateY(-6px); border-color: var(--blue); background: color-mix(in srgb, var(--blue) 14%, var(--surface2)); box-shadow: 0 6px 0 var(--blue); }
.stone.settled { border-color: var(--moss); background: color-mix(in srgb, var(--moss) 12%, var(--surface2)); }
.stone.settled .stone-range { color: var(--moss); font-weight: 700; }
.stone.hinted { animation: hintpulse 1.4s ease 2; }
@keyframes hintpulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 212, 59, 0); } 50% { box-shadow: 0 0 0 6px rgba(255, 212, 59, .9); } }

.know { display: flex; align-items: center; gap: .8rem; margin: .8rem 0; }
.knowbar-wrap { flex: 1; height: 10px; background: var(--bg2); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.knowbar { height: 100%; width: 0; background: linear-gradient(90deg, var(--blue), var(--moss)); transition: width .4s ease; }
.lineup { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: .3rem; }
.slot { height: 46px; border: 2px dashed var(--line); border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.slot-num { color: var(--muted); font-size: .8rem; }
.slot.filled { border-style: solid; border-color: var(--moss); background: color-mix(in srgb, var(--moss) 15%, transparent); animation: pop .3s ease; }
.slot-letter { font-weight: 800; font-size: 1.1rem; line-height: 1; }
.slot-w { font: .65rem var(--mono); color: var(--clay); }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.game-tools { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1.2rem 0 .8rem; }
.logbox summary { cursor: pointer; font-weight: 700; }
.log { list-style: none; padding: 0; margin: .5rem 0; max-height: 220px; overflow: auto; font-size: .95rem; border-top: 1px solid var(--line); }
.log li { padding: .3rem .2rem; border-bottom: 1px solid var(--line); }
.log li.wasted { color: var(--danger); }
.log-n { display: inline-block; min-width: 2em; font: .8rem var(--mono); color: var(--muted); }
.log-free { font-size: .8rem; color: var(--moss); font-weight: 700; }
.log-waste { font-size: .8rem; font-weight: 700; }
.log-empty { color: var(--muted); }

/* ---------- results ---------- */
.results { margin: 1.5rem 0; text-align: center; scroll-margin-top: 70px; border: 2px solid var(--ink); animation: rise .5s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.r-stars { font-size: 3rem; letter-spacing: .15em; line-height: 1; }
.star { color: var(--line); display: inline-block; }
.star.on { color: #e0a400; animation: starpop .5s ease backwards; }
.star.on:nth-child(2) { animation-delay: .15s; }
.star.on:nth-child(3) { animation-delay: .3s; }
@keyframes starpop { from { transform: scale(0) rotate(-40deg); } to { transform: scale(1); } }
.r-score { display: flex; justify-content: center; align-items: center; gap: 1.5rem; margin: .8rem 0; flex-wrap: wrap; }
.r-score > div { display: flex; flex-direction: column; align-items: center; }
.big { font-family: var(--serif); font-weight: 800; font-size: 4rem; line-height: 1; }
.big.mine { color: var(--blue-text); }
.big.tim { color: var(--tim); }
.vs { font-family: var(--serif); font-style: italic; color: var(--muted); font-size: 1.4rem; }
.verdict { font-family: var(--serif); font-size: 1.35rem; font-weight: 700; }
.r-order { display: flex; flex-wrap: wrap; justify-content: center; gap: .2rem; align-items: center; margin: .6rem 0 1rem; }
.ord { display: inline-flex; flex-direction: column; align-items: center; background: var(--surface2); border: 1px solid var(--line); border-radius: 8px; padding: .1rem .4rem; min-width: 2.4rem; }
.ord small { font: .7rem var(--mono); color: var(--clay); }
.ord-sep { color: var(--muted); }
.lesson { text-align: left; background: var(--surface2); border-left: 4px solid var(--yellow); border-radius: 10px; padding: .8rem 1rem; margin: 1rem auto; max-width: 760px; }
.lesson h3 { font-size: 1rem; margin-bottom: .3rem; }
.lesson p { margin: 0; }
.r-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; }
.replay { text-align: left; margin: 1.2rem auto 0; max-width: 640px; }
.replay-head { display: flex; gap: .8rem; align-items: center; }
.replay-list { max-height: 260px; }

/* ---------- how ---------- */
.how { margin: 3rem 0; }
.how-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.how-grid .card p { margin: 0; }

/* ---------- generic page bits ---------- */
.page-hero { padding: clamp(1.8rem, 5vw, 3.5rem) 0 1rem; }
.page-hero .lead { color: var(--ink); }
.section { margin: 2rem 0 3rem; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.pill { display: inline-block; padding: .1rem .6rem; border-radius: 999px; background: var(--surface2); border: 1px solid var(--line); font-size: .85rem; }
.tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.tab { font: 700 .95rem var(--font); color: var(--ink); background: transparent; border: 2px solid var(--line); border-radius: 999px; padding: .4rem .9rem; cursor: pointer; }
.tab[aria-selected="true"], .tab[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ---------- lab ---------- */
.lab-controls { display: flex; flex-wrap: wrap; gap: .7rem 1.2rem; align-items: end; margin-bottom: 1rem; }
.lab-controls label { display: flex; flex-direction: column; font-size: .85rem; font-weight: 700; gap: .2rem; }
.lab-controls input[type="range"] { accent-color: var(--blue); width: 150px; }
.viz { width: 100%; height: 280px; display: block; background: var(--surface2); border: 1px solid var(--line); border-radius: 12px; }
@media (max-width: 500px) { .viz { height: 200px; } }
.lab-stats { display: flex; flex-wrap: wrap; gap: .5rem 1.4rem; margin: .8rem 0; font-size: .95rem; }
.lab-stats b { font-family: var(--mono); }
.lab-note { min-height: 1.6em; font-family: var(--mono); font-size: .88rem; color: var(--muted); }
.stackviz { display: flex; gap: 4px; align-items: flex-end; min-height: 48px; padding: .4rem; background: var(--surface2); border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; }
.stackviz span { display: inline-flex; align-items: flex-end; justify-content: center; min-width: 26px; background: var(--blue); color: #fff; border-radius: 4px 4px 0 0; font: 600 .7rem var(--mono); padding: 2px; }
.gallop-flag { display: inline-block; padding: .1rem .6rem; border-radius: 999px; font-weight: 700; font-size: .85rem; background: var(--bg2); color: var(--muted); border: 1px solid var(--line); }
.gallop-flag.on { background: var(--yellow); color: #1f2a2e; border-color: #1f2a2e; }
.legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .85rem; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: .3rem; vertical-align: -1px; }
.race-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .8rem; }
.race-cell { background: var(--surface2); border: 1px solid var(--line); border-radius: 12px; padding: .6rem; }
.race-cell canvas { width: 100%; height: 120px; display: block; }
.race-cell h4 { margin: 0 0 .3rem; display: flex; justify-content: space-between; font-size: .95rem; }
.race-cell h4 b { font-family: var(--mono); color: var(--blue-text); }
.race-cell.winner { border-color: var(--moss); box-shadow: 0 0 0 2px var(--moss); }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { text-align: left; padding: .45rem .6rem; border-bottom: 1px solid var(--line); }
th { font-family: var(--font); background: var(--surface2); }
td.num, th.num { text-align: right; font-family: var(--mono); }
td.best { color: var(--moss); font-weight: 700; }

/* ---------- zen ---------- */
.zen-text { font-family: var(--mono); font-size: .95rem; line-height: 1.75; white-space: pre-wrap; background: #1f2a2e; color: #ece4d2; border-radius: 12px; padding: 1rem 1.2rem; overflow-x: auto; }
.zen-text .prompt { color: #ffd43b; }
.quiz-q { font-family: var(--serif); font-size: clamp(1.2rem, 3vw, 1.6rem); font-weight: 700; margin: .5rem 0 1rem; }
.quiz-code { font-family: var(--mono); font-size: .88rem; white-space: pre; background: #1f2a2e; color: #ece4d2; border-radius: 10px; padding: .8rem 1rem; overflow-x: auto; margin-bottom: 1rem; }
.choices { display: grid; gap: .6rem; }
.choice {
  text-align: left; font: inherit; color: var(--ink); cursor: pointer;
  background: var(--surface2); border: 2px solid var(--line); border-radius: 12px; padding: .7rem 1rem;
}
.choice:hover:not(:disabled) { border-color: var(--blue); }
.choice.right { border-color: var(--moss); background: color-mix(in srgb, var(--moss) 18%, var(--surface2)); }
.choice.wrong { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, var(--surface2)); }
.choice:disabled { cursor: default; }
.quiz-top { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; color: var(--muted); font-weight: 700; }
.quiz-feedback { min-height: 3em; margin-top: 1rem; }
.progress { height: 8px; background: var(--bg2); border-radius: 4px; overflow: hidden; margin: .5rem 0 1rem; }
.progress > div { height: 100%; background: var(--blue); width: 0; transition: width .3s ease; }
.gen-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: 1rem; }
.gen-row input { flex: 1 1 200px; }
.rot { font-family: var(--mono); font-size: 1rem; background: var(--surface2); border: 1px solid var(--line); border-radius: 10px; padding: .8rem 1rem; word-break: break-word; min-height: 3.2em; }
.rot .dec { color: var(--blue-text); font-weight: 700; }

/* ---------- tribute ---------- */
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 4.6rem; top: 0; bottom: 0; width: 3px; background: var(--line); border-radius: 2px; }
.timeline li { display: grid; grid-template-columns: 4rem 1fr; gap: 1.4rem; margin-bottom: 1.2rem; position: relative; }
.timeline li::before { content: ""; position: absolute; left: calc(4.6rem - 6px); top: .45rem; width: 15px; height: 15px; border-radius: 50%; background: var(--yellow); border: 3px solid var(--ink); }
.tl-year { font-family: var(--serif); font-weight: 800; font-size: 1.05rem; text-align: right; overflow-wrap: anywhere; }
.adopt span { display: block; color: var(--muted); }
.tl-body h3 { font-size: 1.05rem; margin: 0 0 .2rem; }
.tl-body p { margin: 0; }
.tl-tag { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
blockquote { margin: 1rem 0; padding: .8rem 1.2rem; border-left: 4px solid var(--blue); background: var(--surface2); border-radius: 0 12px 12px 0; font-family: var(--serif); font-size: 1.15rem; }
blockquote cite { display: block; font-family: var(--font); font-size: .85rem; color: var(--muted); font-style: normal; margin-top: .3rem; }
.adopt { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.adopt div { background: var(--surface2); border: 1px solid var(--line); border-radius: 12px; padding: .6rem .8rem; }
.adopt b { display: block; font-family: var(--serif); font-size: 1.1rem; }
.sources li { margin-bottom: .3rem; word-break: break-word; }

/* ---------- footer, toast ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 2rem 0; margin-top: 3rem; color: var(--muted); }
.site-footer p { margin: .3rem 0; }
.toast {
  position: fixed; left: 50%; bottom: 1.2rem; transform: translate(-50%, 150%); z-index: 200;
  background: var(--ink); color: var(--bg); padding: .7rem 1.2rem; border-radius: 999px; font-weight: 700;
  max-width: calc(100% - 2rem); transition: transform .3s ease; box-shadow: var(--shadow); text-align: center;
}
.toast.show { transform: translate(-50%, 0); }

[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
