/* ==========================================================
   Plate 1491 — design system
   Palette: husk cream, maize gold, chili red, Atlantic teal
   ========================================================== */
:root {
  --bg: #fbf3e4;
  --bg-2: #f4e6cc;
  --surface: #fffaf1;
  --surface-2: #fdf1dc;
  --ink: #24180e;
  --ink-2: #4a3a2a;
  --muted: #6e5a45;
  --line: #e2cfae;
  --maize: #e8a317;
  --maize-ink: #8a5a00;
  --chili: #b8321f;
  --sea: #1d6b74;
  --sea-deep: #143c48;
  --am: #b8321f;       /* Americas */
  --am-soft: #f6d9cf;
  --ow: #1d6b74;       /* Afro-Eurasia */
  --ow-soft: #d3e9ea;
  --both: #7a6a55;
  --both-soft: #ebe1d1;
  --good: #2e7d32;
  --bad: #c62828;
  --shadow: 0 1px 2px rgba(60, 35, 10, .08), 0 8px 24px rgba(60, 35, 10, .10);
  --shadow-lg: 0 2px 4px rgba(60, 35, 10, .10), 0 18px 48px rgba(60, 35, 10, .18);
  --radius: 18px;
  --radius-sm: 10px;
  --font-display: "Fraunces", "Georgia", "Times New Roman", serif;
  --font-body: "Work Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --plate-rim: #f3ece0;
  --plate-well: #fffdf8;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #15110d;
  --bg-2: #1d1712;
  --surface: #221b15;
  --surface-2: #2a2119;
  --ink: #f6ead6;
  --ink-2: #e2d3bb;
  --muted: #b9a68c;
  --line: #3b2f24;
  --maize: #f2b83a;
  --maize-ink: #f2b83a;
  --chili: #ff7a5c;
  --sea: #5fc1c9;
  --sea-deep: #0d2b33;
  --am: #ff7a5c;
  --am-soft: #47231b;
  --ow: #5fc1c9;
  --ow-soft: #163a3f;
  --both: #c9b79c;
  --both-soft: #3a3027;
  --good: #7bd389;
  --bad: #ff8a80;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, .35), 0 18px 48px rgba(0, 0, 0, .5);
  --plate-rim: #3a3129;
  --plate-well: #2d261f;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  overflow-x: hidden;
}
img, svg, canvas { max-width: 100%; display: block; }
a { color: var(--sea); text-underline-offset: 3px; }
a:hover { color: var(--chili); }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; margin: 0 0 .5em; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.1rem, 6vw, 3.6rem); font-variation-settings: "SOFT" 50, "WONK" 1; }
h2 { font-size: clamp(1.6rem, 4vw, 2.3rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--maize); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--bg); padding: .5rem 1rem; z-index: 100; }
.skip:focus { left: 1rem; top: 1rem; }

.wrap { width: min(1160px, 100% - 2rem); margin-inline: auto; }
.narrow { width: min(760px, 100% - 2rem); margin-inline: auto; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: .75rem; min-height: 62px; }
.brand { display: flex; align-items: center; gap: .5rem; text-decoration: none; color: var(--ink); font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; white-space: nowrap; }
.brand svg { width: 34px; height: 34px; }
.brand b { color: var(--chili); }
.nav { margin-left: auto; display: flex; gap: .25rem; align-items: center; }
.nav a { text-decoration: none; color: var(--ink-2); padding: .45rem .7rem; border-radius: 999px; font-weight: 500; font-size: .95rem; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--ink); color: var(--bg); }
.icon-btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  width: 40px; height: 40px; border-radius: 50%; cursor: pointer; font-size: 1.1rem;
  display: inline-grid; place-items: center; flex: none;
}
.icon-btn:hover { border-color: var(--maize); }
.menu-btn { display: none; }
@media (max-width: 820px) {
  .menu-btn { display: inline-grid; margin-left: auto; }
  .nav {
    position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; align-items: stretch;
    background: var(--surface); border-bottom: 1px solid var(--line); padding: .5rem 1rem 1rem;
    display: none; box-shadow: var(--shadow);
  }
  .nav.open { display: flex; }
  .nav a { padding: .7rem 1rem; }
}

/* ---------- Buttons & chips ---------- */
.btn {
  --b: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font: 600 1rem/1 var(--font-body);
  padding: .85rem 1.3rem; border-radius: 999px; border: 2px solid var(--b);
  background: var(--b); color: var(--bg); cursor: pointer; text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease, background .15s;
  min-height: 46px;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); color: var(--bg); }
.btn:active { transform: translateY(1px); }
.btn.primary { --b: var(--chili); color: #fff; }
.btn.primary:hover { color: #fff; }
[data-theme="dark"] .btn.primary { color: #1a0f0a; }
.btn.sea { --b: var(--sea); color: #fff; }
[data-theme="dark"] .btn.sea { color: #0b1f24; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--ink); color: var(--ink); }
.btn.small { padding: .55rem .9rem; font-size: .9rem; min-height: 38px; }
.btn.big { padding: 1.05rem 1.8rem; font-size: 1.15rem; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; }

.chip {
  display: inline-flex; align-items: center; gap: .35rem;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  padding: .4rem .8rem; border-radius: 999px; font: 500 .9rem/1.2 var(--font-body); cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip:hover { border-color: var(--ink-2); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }

.tag { display: inline-flex; align-items: center; gap: .3rem; font-size: .78rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; letter-spacing: .01em; white-space: nowrap; }
.tag.am { background: var(--am-soft); color: var(--am); }
.tag.ow { background: var(--ow-soft); color: var(--ow); }
.tag.both { background: var(--both-soft); color: var(--both); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.pad { padding: clamp(1rem, 3vw, 1.75rem); }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; font-weight: 700; color: var(--chili); margin-bottom: .4rem; display: block; }
.muted { color: var(--muted); }
.center { text-align: center; }

input[type="search"], input[type="text"], select {
  font: 500 1rem var(--font-body); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 999px; padding: .7rem 1rem; width: 100%; min-height: 44px;
}
input:focus, select:focus { outline: 3px solid var(--maize); outline-offset: 1px; }

/* ---------- Hero ---------- */
.hero { position: relative; padding: clamp(1.5rem, 5vw, 3.5rem) 0 1rem; overflow: hidden; }
.hero .lede { font-size: clamp(1.05rem, 2.4vw, 1.3rem); color: var(--ink-2); max-width: 46ch; }
.hero h1 em { font-style: italic; color: var(--chili); }
.datebar { display: inline-flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.datebar span { font-size: .8rem; font-weight: 600; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: .2rem .65rem; color: var(--ink-2); }

/* ---------- Ocean & plate stage ---------- */
.stage {
  position: relative;
  border-radius: 26px;
  background:
    radial-gradient(120% 80% at 50% 0%, color-mix(in srgb, var(--sea) 22%, transparent), transparent 60%),
    linear-gradient(180deg, color-mix(in srgb, var(--sea) 14%, var(--surface)), color-mix(in srgb, var(--sea) 30%, var(--surface)));
  border: 1px solid var(--line);
  overflow: hidden;
  padding: 1rem;
  box-shadow: var(--shadow-lg);
}
.stage::after { /* waves */
  content: ""; position: absolute; inset: auto 0 0 0; height: 70px; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='20' viewBox='0 0 120 20'%3E%3Cpath d='M0 10 Q15 0 30 10 T60 10 T90 10 T120 10' fill='none' stroke='%231d6b74' stroke-opacity='.25' stroke-width='2'/%3E%3C/svg%3E") repeat-x;
  background-size: 120px 20px; opacity: .9;
  animation: waves 9s linear infinite;
}
@keyframes waves { to { background-position: 120px 0; } }
.stage-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; position: relative; z-index: 2; flex-wrap: wrap; }
.stage-title { display: flex; align-items: center; gap: .6rem; }
.stage-title .big-emoji { font-size: 2.4rem; line-height: 1; }
.stage-title h2 { margin: 0; font-size: clamp(1.35rem, 3.6vw, 2rem); }
.stage-title p { margin: 0; color: var(--ink-2); font-size: .95rem; }
.year { font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; padding: .2rem .8rem; border-radius: 12px; background: var(--ink); color: var(--bg); letter-spacing: .02em; transition: background .4s; }
.year.past { background: var(--chili); color: #fff; }

.scene { position: relative; display: grid; grid-template-columns: 1fr minmax(0, 420px) 1fr; align-items: center; gap: .5rem; margin-top: .5rem; z-index: 1; }
.shore { align-self: stretch; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .25rem; min-height: 120px; border-radius: 16px; padding: .5rem; text-align: center; }
.shore .shore-name { font-family: var(--font-display); font-weight: 700; font-size: .95rem; }
.shore .shore-icon { font-size: 2rem; }
.shore.am { color: var(--am); }
.shore.ow { color: var(--ow); }
.shore .dock { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; font-size: 1.25rem; min-height: 1.5rem; max-width: 140px; }
.shore .dock span { animation: dock-in .5s ease both; }
@keyframes dock-in { from { transform: scale(0); } to { transform: scale(1); } }

.plate {
  position: relative; width: 100%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, var(--plate-well) 0 52%, var(--plate-rim) 53% 64%, color-mix(in srgb, var(--plate-rim) 80%, #000) 64.5% 65.5%, var(--plate-rim) 66% 100%);
  box-shadow: 0 18px 30px rgba(20, 40, 50, .3), inset 0 -6px 14px rgba(0, 0, 0, .08), inset 0 4px 10px rgba(255, 255, 255, .5);
  margin-inline: auto;
}
[data-theme="dark"] .plate { box-shadow: 0 18px 30px rgba(0, 0, 0, .55), inset 0 -6px 14px rgba(0, 0, 0, .3), inset 0 2px 6px rgba(255, 255, 255, .06); }
.plate::before { /* rim pattern */
  content: ""; position: absolute; inset: 4%; border-radius: 50%;
  border: 2px dashed color-mix(in srgb, var(--maize) 55%, transparent);
  pointer-events: none;
}
.plate-center {
  position: absolute; inset: 34%; border-radius: 50%; display: grid; place-items: center; text-align: center;
  font-family: var(--font-display); color: var(--ink); pointer-events: none;
}
.plate-center .pct { font-size: clamp(1.6rem, 6vw, 2.6rem); font-weight: 800; line-height: 1; }
.plate-center .pct-label { font-size: clamp(.6rem, 1.8vw, .75rem); font-family: var(--font-body); color: var(--muted); text-transform: uppercase; letter-spacing: .1em; font-weight: 600; }
.plate-center .dish-emoji { font-size: clamp(2.2rem, 9vw, 3.6rem); line-height: 1; }

.token {
  position: absolute; width: 17%; aspect-ratio: 1; transform: translate(-50%, -50%);
  border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--tint, #ddd) 55%, #fff), var(--tint, #ddd));
  border: 2px solid color-mix(in srgb, var(--tint, #ddd) 60%, #000);
  box-shadow: 0 4px 8px rgba(0, 0, 0, .18);
  font-size: clamp(1.1rem, 4.6vw, 1.9rem); line-height: 1;
  transition: transform .9s cubic-bezier(.5, -0.3, .4, 1.2), opacity .9s ease, left .9s ease, top .9s ease, filter .5s;
  cursor: default; user-select: none;
}
.token .em { filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .25)); }
.token.lost-am { transform: translate(-50%, -50%) translateX(-60vw) rotate(-200deg) scale(.4); opacity: 0; }
.token.lost-ow { transform: translate(-50%, -50%) translateX(60vw) rotate(200deg) scale(.4); opacity: 0; }
.token.swap-in { animation: swap-in .8s .6s cubic-bezier(.3, 1.5, .5, 1) both; outline: 3px dashed var(--maize); outline-offset: 2px; }
@keyframes swap-in { from { transform: translate(-50%, -50%) scale(0) rotate(-90deg); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
.token.kept-pulse { animation: kept .6s ease; }
@keyframes kept { 50% { transform: translate(-50%, -50%) scale(1.12); } }
.token.enter { animation: token-enter .5s cubic-bezier(.3, 1.4, .5, 1) both; }
@keyframes token-enter { from { transform: translate(-50%, -50%) scale(0); opacity: 0; } }

.stage-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; position: relative; z-index: 2; }

@media (max-width: 640px) {
  .scene { grid-template-columns: 1fr; }
  .shore { flex-direction: row; min-height: 0; padding: .35rem .6rem; justify-content: flex-start; gap: .5rem; }
  .shore .shore-icon { font-size: 1.4rem; }
  .shore .dock { max-width: none; justify-content: flex-start; }
  .shore.left { order: 0; }
  .plate-cell { order: 1; }
  .shore.right { order: 2; }
  .token.lost-am { transform: translate(-50%, -50%) translateY(-60vh) rotate(-200deg) scale(.4); }
  .token.lost-ow { transform: translate(-50%, -50%) translateY(60vh) rotate(200deg) scale(.4); }
}

/* ---------- Ingredient list ---------- */
.ing-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.ing-list li { display: flex; align-items: center; gap: .55rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .45rem .6rem; transition: opacity .4s, background .4s; }
.ing-list li .e { font-size: 1.35rem; width: 1.8rem; text-align: center; flex: none; }
.ing-list li .nm { font-weight: 600; line-height: 1.2; font-size: .95rem; }
.ing-list li .sub { font-size: .78rem; color: var(--muted); line-height: 1.2; }
.ing-list li .tag { margin-left: auto; }
.ing-list li.is-lost { opacity: .55; text-decoration: line-through; text-decoration-color: var(--chili); }
.ing-list li.is-lost .tag { text-decoration: none; }
.ing-list li.is-swap { border-style: dashed; border-color: var(--maize); background: color-mix(in srgb, var(--maize) 12%, var(--surface)); }

/* ---------- Result panel ---------- */
.result { display: grid; gap: 1rem; grid-template-columns: 1fr; margin-top: 1.25rem; }
@media (min-width: 900px) { .result { grid-template-columns: 1.1fr 1fr; } }
.verdict .tier { display: inline-flex; align-items: center; gap: .4rem; font-weight: 700; padding: .3rem .8rem; border-radius: 999px; background: var(--maize); color: #2a1a00; margin-bottom: .6rem; }
.verdict h3 { font-size: clamp(1.4rem, 3.5vw, 1.9rem); margin-bottom: .4rem; }
.verdict .remix { font-size: 1.05rem; color: var(--ink-2); }
.factline { border-left: 4px solid var(--maize); padding: .4rem .8rem; background: var(--surface-2); border-radius: 0 10px 10px 0; font-size: .95rem; }
.hidden { display: none !important; }

/* ---------- Dish picker ---------- */
.picker-tools { display: grid; gap: .7rem; margin-bottom: 1rem; }
@media (min-width: 760px) { .picker-tools { grid-template-columns: 320px 1fr; align-items: center; } }
.dish-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .55rem; }
.dish-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: .15rem; text-align: left;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 14px; padding: .7rem .75rem;
  cursor: pointer; font: inherit; position: relative; transition: transform .12s, border-color .12s, box-shadow .12s;
}
.dish-btn:hover { transform: translateY(-2px); border-color: var(--maize); box-shadow: var(--shadow); }
.dish-btn[aria-pressed="true"] { border: 2px solid var(--chili); }
.dish-btn .de { font-size: 1.6rem; line-height: 1; }
.dish-btn .dn { font-weight: 600; font-size: .92rem; line-height: 1.2; }
.dish-btn .dc { font-size: .75rem; color: var(--muted); }
.dish-btn .seen { position: absolute; top: .45rem; right: .5rem; font-size: .75rem; color: var(--good); }
.dish-btn .meter { width: 100%; height: 5px; border-radius: 3px; background: var(--line); margin-top: .3rem; overflow: hidden; }
.dish-btn .meter i { display: block; height: 100%; background: var(--sea); border-radius: 3px; }

.progress-line { display: flex; align-items: center; gap: .6rem; font-size: .9rem; color: var(--muted); flex-wrap: wrap; }
.progress-bar { flex: 1; min-width: 120px; height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.progress-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--maize), var(--chili)); width: 0; transition: width .6s; }

/* ---------- Ranking chart ---------- */
.rank-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .3rem; }
.rank-list li button {
  width: 100%; display: grid; grid-template-columns: 2rem minmax(0, 11rem) 1fr 3.2rem; align-items: center; gap: .5rem;
  background: none; border: 0; padding: .3rem .25rem; color: var(--ink); font: inherit; cursor: pointer; border-radius: 8px; text-align: left;
}
.rank-list li button:hover { background: var(--surface-2); }
.rank-list .rk-e { font-size: 1.25rem; text-align: center; }
.rank-list .rk-n { font-size: .9rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-list .rk-bar { height: 14px; background: var(--line); border-radius: 7px; overflow: hidden; display: flex; }
.rank-list .rk-bar .lost { background: var(--chili); height: 100%; border-radius: 7px 0 0 7px; }
.rank-list .rk-v { font-variant-numeric: tabular-nums; font-weight: 700; font-size: .9rem; text-align: right; }
@media (max-width: 520px) {
  .rank-list li button { grid-template-columns: 1.6rem minmax(0, 7.5rem) 1fr 2.8rem; }
}

/* ---------- Sections ---------- */
.section { padding: clamp(2rem, 6vw, 4rem) 0; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.section-head p { margin: 0; max-width: 60ch; color: var(--ink-2); }
.grid-3 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.feature-card { text-decoration: none; color: var(--ink); display: block; transition: transform .15s; }
.feature-card:hover { transform: translateY(-3px); color: var(--ink); }
.feature-card .fe { font-size: 2.2rem; }
.feature-card h3 { margin: .4rem 0 .3rem; }
.feature-card p { margin: 0; color: var(--ink-2); font-size: .95rem; }

.legend { display: flex; gap: .8rem; flex-wrap: wrap; font-size: .85rem; color: var(--ink-2); align-items: center; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: .3rem; }

/* ---------- Plate builder ---------- */
.builder { display: grid; gap: 1.2rem; grid-template-columns: 1fr; }
@media (min-width: 960px) { .builder { grid-template-columns: 1fr 1fr; align-items: start; } .builder .sticky { position: sticky; top: 76px; } }
.palette-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: .4rem; max-height: 520px; overflow: auto; padding: .2rem; }
.pal-btn {
  display: flex; flex-direction: column; align-items: center; gap: .1rem; text-align: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .5rem .3rem; cursor: pointer; font: inherit; color: var(--ink);
  position: relative; min-height: 78px;
}
.pal-btn .pe { font-size: 1.5rem; line-height: 1.1; }
.pal-btn .pn { font-size: .74rem; line-height: 1.15; font-weight: 600; }
.pal-btn .dot { position: absolute; top: 6px; right: 6px; width: 9px; height: 9px; border-radius: 50%; }
.dot.am { background: var(--am); } .dot.ow { background: var(--ow); } .dot.both { background: var(--both); }
.pal-btn[aria-pressed="true"] { border: 2px solid var(--chili); background: color-mix(in srgb, var(--maize) 16%, var(--surface)); }
.pal-btn:hover { border-color: var(--maize); }
.split-bar { display: flex; height: 26px; border-radius: 13px; overflow: hidden; background: var(--line); }
.split-bar span { display: grid; place-items: center; color: #fff; font-size: .75rem; font-weight: 700; transition: width .5s ease; white-space: nowrap; overflow: hidden; }
.split-bar .am { background: var(--am); } .split-bar .ow { background: var(--ow); } .split-bar .both { background: var(--both); }
[data-theme="dark"] .split-bar span { color: #111; }
.rewind-cols { display: grid; gap: .8rem; grid-template-columns: 1fr; }
@media (min-width: 560px) { .rewind-cols { grid-template-columns: 1fr 1fr; } }
.rewind-col { border-radius: 14px; padding: .9rem; border: 1px solid var(--line); background: var(--surface-2); }
.rewind-col h4 { font-size: 1rem; margin: 0 0 .4rem; }
.rewind-col .emo-row { font-size: 1.35rem; letter-spacing: 2px; min-height: 1.8rem; word-break: break-all; }
.rewind-col .emo-row.lostrow { opacity: .5; }
.rewind-col p { font-size: .9rem; margin: .3rem 0 0; }

/* ---------- Game ---------- */
.mode-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.mode-card { text-align: left; font: inherit; color: var(--ink); cursor: pointer; border: 2px solid var(--line); }
.mode-card:hover { border-color: var(--maize); transform: translateY(-2px); }
.mode-card .me { font-size: 2.2rem; }
.mode-card .best { font-size: .85rem; color: var(--muted); margin-top: .4rem; }
.hud { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .8rem; }
.hud .stat { font-family: var(--font-display); font-weight: 800; font-size: 1.3rem; }
.hud .stat small { display: block; font: 600 .7rem var(--font-body); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.timer { height: 10px; border-radius: 5px; background: var(--line); overflow: hidden; margin-bottom: 1rem; }
.timer i { display: block; height: 100%; background: linear-gradient(90deg, var(--chili), var(--maize)); width: 100%; transition: width .25s linear; }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: .55rem; }
.tile {
  font: inherit; color: var(--ink); background: var(--surface); border: 2px solid var(--line); border-radius: 14px;
  padding: .7rem .4rem; display: flex; flex-direction: column; align-items: center; gap: .2rem; cursor: pointer; min-height: 96px;
  position: relative; transition: transform .1s, border-color .1s, background .15s;
}
.tile .te { font-size: 1.9rem; line-height: 1.1; }
.tile .tn { font-size: .82rem; font-weight: 600; line-height: 1.15; text-align: center; }
.tile:hover { border-color: var(--maize); }
.tile[aria-pressed="true"] { border-color: var(--chili); background: color-mix(in srgb, var(--chili) 14%, var(--surface)); transform: scale(.97); }
.tile[aria-pressed="true"]::after { content: "⛵"; position: absolute; top: 4px; right: 6px; font-size: .9rem; }
.tile.r-correct { border-color: var(--good); background: color-mix(in srgb, var(--good) 16%, var(--surface)); }
.tile.r-wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, var(--surface)); }
.tile.r-missed { border-style: dashed; border-color: var(--bad); }
.tile .mark { position: absolute; top: 4px; left: 6px; font-size: .9rem; font-weight: 800; }
.tile .org { font-size: .68rem; }
.feedback { margin-top: 1rem; }
.flash { font-family: var(--font-display); font-weight: 800; font-size: 1.4rem; }
.flash.good { color: var(--good); } .flash.bad { color: var(--bad); }
.tf-btns { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin-top: 1rem; }
.tf-btns .btn { min-height: 64px; font-size: 1.1rem; }
.statement { font-family: var(--font-display); font-size: clamp(1.3rem, 3.6vw, 1.85rem); line-height: 1.3; margin: .5rem 0 0; }
.challenge { background: var(--maize); color: #2a1a00; border-radius: 14px; padding: .8rem 1rem; font-weight: 600; margin-bottom: 1rem; }
.big-score { font-family: var(--font-display); font-weight: 800; font-size: clamp(3rem, 12vw, 5rem); line-height: 1; color: var(--chili); }

/* ---------- Atlas ---------- */
.atlas-tools { display: grid; gap: .7rem; margin-bottom: 1.2rem; }
@media (min-width: 760px) { .atlas-tools { grid-template-columns: 1fr auto 220px; align-items: center; } }
.atlas-grid { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.atlas-card { padding: 1rem; display: flex; flex-direction: column; gap: .35rem; border-top: 6px solid var(--tint, var(--line)); }
.atlas-card .ah { display: flex; align-items: center; gap: .6rem; }
.atlas-card .ae { font-size: 2rem; line-height: 1; }
.atlas-card h3 { margin: 0; font-size: 1.1rem; }
.atlas-card .meta { font-size: .85rem; color: var(--ink-2); }
.atlas-card .meta b { color: var(--ink); }
.atlas-card p { font-size: .92rem; margin: 0; }
.atlas-card .in { font-size: .8rem; color: var(--muted); margin-top: auto; padding-top: .3rem; }
.atlas-card .in a { color: var(--sea); }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; margin-bottom: 1.5rem; }
.stat-box { padding: 1rem; text-align: center; }
.stat-box .n { font-family: var(--font-display); font-weight: 800; font-size: 2.2rem; line-height: 1; }
.stat-box .l { font-size: .85rem; color: var(--muted); }

.timeline { list-style: none; margin: 0; padding: 0 0 0 1.5rem; position: relative; }
.timeline::before { content: ""; position: absolute; left: .55rem; top: .3rem; bottom: .3rem; width: 3px; background: linear-gradient(var(--maize), var(--chili), var(--sea)); border-radius: 2px; }
.timeline li { position: relative; padding: 0 0 1.4rem 1.2rem; }
.timeline li::before { content: attr(data-e); position: absolute; left: -1.55rem; top: -.1rem; width: 2.1rem; height: 2.1rem; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--maize); border-radius: 50%; font-size: 1rem; }
.timeline .ty { font-weight: 700; color: var(--chili); font-size: .85rem; letter-spacing: .04em; text-transform: uppercase; }
.timeline h3 { margin: .1rem 0 .2rem; font-size: 1.15rem; }
.timeline p { margin: 0; color: var(--ink-2); font-size: .95rem; }
.timeline li.key h3 { color: var(--chili); }

/* ---------- Prose ---------- */
.prose h2 { margin-top: 2rem; }
.prose ul { padding-left: 1.2rem; }
.prose li { margin-bottom: .4rem; }
.note { border: 1px solid var(--line); border-left: 5px solid var(--sea); background: var(--surface); padding: 1rem 1.2rem; border-radius: 0 14px 14px 0; }
.sources li { word-break: break-word; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 2rem 0 3rem; margin-top: 2rem; color: var(--muted); font-size: .9rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; }
.site-footer a { color: var(--ink-2); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 150%);
  background: var(--ink); color: var(--bg); padding: .75rem 1.2rem; border-radius: 999px; font-weight: 600;
  z-index: 100; transition: transform .3s ease; box-shadow: var(--shadow-lg); max-width: calc(100% - 2rem); text-align: center;
}
.toast.show { transform: translate(-50%, 0); }

/* ---------- Confetti (seeds) ---------- */
.seed { position: fixed; top: -20px; font-size: 1.3rem; pointer-events: none; z-index: 90; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .token.lost-am, .token.lost-ow { transform: translate(-50%, -50%); opacity: 0; }
  .seed { display: none; }
}
