/* Needful — styles. Tokens first; dark mode mirrors them. */
:root {
  --paper: #fbf6ec;
  --paper-2: #f3ead8;
  --card: #fffdf8;
  --ink: #1d2433;
  --ink-2: #4a5263;
  --ink-3: #7a8091;
  --line: #e4d8bf;
  --accent: #d9480f;      /* saffron stamp ink */
  --accent-ink: #ffffff;
  --gold: #f2a900;
  --green: #138a52;
  --blue: #2b59c3;
  --rose: #c2255c;
  --hl-in: #ffe8a3;
  --hl-reg: #ffd7c2;
  --hl-intl: #d6e4ff;
  --hl-sap: #d2f2e2;
  --hl-hist: #ead9ff;
  --dark-band: #1d2433;
  --dark-band-ink: #f3ead8;
  --shadow: 0 1px 2px rgba(60, 40, 10, .06), 0 6px 20px rgba(60, 40, 10, .07);
  --radius: 14px;
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #14181f; --paper-2: #1b2029; --card: #1f2530; --ink: #f1ead9; --ink-2: #c3bcab; --ink-3: #8f8a7e;
    --line: #333a47; --accent: #ff7a3d; --accent-ink: #1a0f08; --gold: #ffc53d; --green: #3ccf8e; --blue: #7aa2ff; --rose: #ff6b9a;
    --hl-in: #5a4710; --hl-reg: #5c3320; --hl-intl: #253a66; --hl-sap: #1b4a37; --hl-hist: #42305f;
    --dark-band: #0d1015; --dark-band-ink: #f1ead9; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #14181f; --paper-2: #1b2029; --card: #1f2530; --ink: #f1ead9; --ink-2: #c3bcab; --ink-3: #8f8a7e;
  --line: #333a47; --accent: #ff7a3d; --accent-ink: #1a0f08; --gold: #ffc53d; --green: #3ccf8e; --blue: #7aa2ff; --rose: #ff6b9a;
  --hl-in: #5a4710; --hl-reg: #5c3320; --hl-intl: #253a66; --hl-sap: #1b4a37; --hl-hist: #42305f;
  --dark-band: #0d1015; --dark-band-ink: #f1ead9; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation: none !important; transition: none !important; } }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 16px/1.6 var(--sans); overflow-x: hidden;
  background-image: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--ink) 6%, transparent) 1px, transparent 0);
  background-size: 22px 22px;
}
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { font-family: var(--display); line-height: 1.12; margin: 0; letter-spacing: -.01em; }
p { margin: 0 0 .8em; }
pre { white-space: pre-wrap; word-break: break-word; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 50; background: var(--ink); color: var(--paper); padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 8px; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 16px; }

/* ---------- top bar ---------- */
.bar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.bar-inner { max-width: 1160px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); flex: none; }
.brand-seal { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; border: 2.5px solid var(--accent); color: var(--accent); font-weight: 900; transform: rotate(-12deg); }
.brand-word { font-family: var(--display); font-weight: 900; font-size: 1.35rem; letter-spacing: -.02em; }
.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; mask-image: linear-gradient(90deg, #000 90%, transparent); }
.nav::-webkit-scrollbar { display: none; }
.nav a { white-space: nowrap; text-decoration: none; color: var(--ink-2); font-size: .9rem; font-weight: 500; padding: 6px 10px; border-radius: 999px; }
.nav a:hover { background: var(--paper-2); color: var(--ink); }
.theme-btn { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-size: 1.1rem; }

/* ---------- hero ---------- */
.hero { position: relative; overflow-x: clip; overflow-clip-margin: 16px; max-width: 1160px; margin: 0 auto; padding: 64px 16px 48px; display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; }
.kicker { font-family: var(--mono); font-size: .82rem; color: var(--ink-3); margin-bottom: 18px; }
.kicker-flag { background: var(--rose); color: #fff; padding: 1px 6px; border-radius: 4px; font-weight: 600; animation: blink 1.6s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }
.hero-title { font-size: clamp(3rem, 9vw, 6.6rem); font-weight: 900; letter-spacing: -.035em; line-height: .95; }
.hero-title em { font-style: italic; font-weight: 700; color: var(--accent); position: relative; white-space: nowrap; }
.hero-title em::after { content: ""; position: absolute; left: 2%; right: 2%; bottom: .04em; height: .12em; background: var(--gold); border-radius: 4px; z-index: -1; transform: skewX(-12deg); }
.hero-rotator { font-family: var(--display); font-style: italic; font-size: clamp(1.25rem, 3vw, 1.9rem); color: var(--ink-2); margin: 14px 0 22px; min-height: 1.4em; }
#rotator { display: inline-block; transition: opacity .25s, transform .25s; }
#rotator.out { opacity: 0; transform: translateY(-8px); }
.lede { font-size: 1.08rem; max-width: 62ch; color: var(--ink-2); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 30px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0; max-width: 760px; }
.stats div { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stats dt { font-family: var(--display); font-weight: 900; font-size: 1.7rem; color: var(--accent); line-height: 1.1; }
.stats dd { margin: 2px 0 0; font-size: .78rem; color: var(--ink-3); line-height: 1.35; }

.stamp { width: 230px; height: 230px; border-radius: 50%; border: 6px double var(--accent); color: var(--accent); display: flex; flex-direction: column; align-items: center; justify-content: center; text-transform: uppercase; font-family: var(--display); font-weight: 900; transform: rotate(-14deg); opacity: .9; cursor: pointer; user-select: none;
  animation: stampin .55s cubic-bezier(.2,1.6,.4,1) .5s both;
  -webkit-mask-image: radial-gradient(circle at 30% 40%, #000 60%, rgba(0,0,0,.75) 61%, #000 70%); mask-image: radial-gradient(circle at 30% 40%, #000 60%, rgba(0,0,0,.75) 61%, #000 70%); }
.stamp.again { animation: stampin .55s cubic-bezier(.2,1.6,.4,1) both; }
.stamp-top, .stamp-mid { font-size: .85rem; letter-spacing: .18em; }
.stamp-big { font-size: 3.3rem; letter-spacing: .04em; line-height: 1; margin: 4px 0; border-top: 3px solid currentColor; border-bottom: 3px solid currentColor; padding: 2px 10px; }
@keyframes stampin { 0% { transform: rotate(-14deg) scale(2.4); opacity: 0; } 70% { opacity: .95; } 100% { transform: rotate(-14deg) scale(1); opacity: .9; } }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 16px; border-radius: 999px; border: 1.5px solid var(--ink); background: var(--card); color: var(--ink); font-weight: 600; text-decoration: none; cursor: pointer; transition: transform .12s, box-shadow .12s; box-shadow: 3px 3px 0 var(--ink); }
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); text-decoration: none; }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--ink); }
.btn-small { padding: 7px 12px; font-size: .88rem; box-shadow: 2px 2px 0 var(--ink); }

/* ---------- phrase of the day ---------- */
.potd { background: var(--gold); color: #1d2433; border-block: 2px solid var(--ink); }
.potd-inner { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 18px; padding-block: 14px; }
.potd-label { font-family: var(--mono); font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 600; }
.potd-phrase { font-family: var(--display); font-weight: 900; font-size: 1.5rem; color: #1d2433; text-decoration: none; }
.potd-phrase:hover { text-decoration: underline; }
.potd-meaning { margin: 0; font-style: italic; }

/* ---------- sections ---------- */
.section { padding: 72px 0; }
.section-alt { background: var(--paper-2); border-block: 1px solid var(--line); }
.section-dark { background: var(--dark-band); color: var(--dark-band-ink); }
.section-dark a { color: var(--gold); }
.section-head { max-width: 760px; margin-bottom: 28px; }
.eyebrow { font-family: var(--mono); font-size: .78rem; text-transform: uppercase; letter-spacing: .14em; color: var(--accent); font-weight: 600; margin-bottom: 8px; }
.section-dark .eyebrow { color: var(--gold); }
.section-head h2 { font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 900; margin-bottom: 12px; }
.section-lede { font-size: 1.05rem; color: var(--ink-2); }
.section-dark .section-lede { color: color-mix(in srgb, var(--dark-band-ink) 80%, transparent); }
.privacy { display: inline-block; background: var(--card); border: 1px dashed var(--green); color: var(--green); border-radius: 10px; padding: 6px 12px; font-size: .9rem; font-weight: 500; }

/* ---------- dictionary ---------- */
.dict-tools { position: sticky; top: 57px; z-index: 5; background: color-mix(in srgb, var(--paper) 94%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); padding: 12px 0 10px; margin: 0 -16px; padding-inline: 16px; border-bottom: 1px solid var(--line); }
.search { position: relative; margin-bottom: 10px; }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 1.3rem; color: var(--ink-3); pointer-events: none; }
.search input { width: 100%; font: inherit; font-size: 1.05rem; padding: 12px 14px 12px 42px; border-radius: 12px; border: 1.5px solid var(--ink); background: var(--card); color: var(--ink); box-shadow: 3px 3px 0 var(--ink); }
/* Chips wrap instead of scrolling sideways: a hidden-scrollbar strip hid categories. */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips + .chips { margin-top: 6px; }
.chip { white-space: nowrap; border: 1px solid var(--line); background: var(--card); color: var(--ink-2); padding: 5px 11px; border-radius: 999px; font-size: .86rem; cursor: pointer; font-weight: 500; }
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip-count { margin-left: 6px; font-size: .74rem; opacity: .65; }
.chip-ghost { background: transparent; }
.chips-ev .chip { font-size: .8rem; }
.result-count { font-size: .85rem; color: var(--ink-3); margin: 14px 0 12px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px 12px; box-shadow: var(--shadow); display: flex; flex-direction: column; transition: transform .15s, box-shadow .15s; }
.card:hover { transform: translateY(-2px); }
.card[hidden] { display: none; }
.card.flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 30% { box-shadow: 0 0 0 4px var(--gold), var(--shadow); transform: scale(1.02); } 100% { box-shadow: var(--shadow); transform: none; } }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.card-cat { font-size: .74rem; color: var(--ink-3); font-weight: 500; }
.badge { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 2px 8px; border-radius: 999px; color: var(--ink); white-space: nowrap; cursor: help; }
.ev-in { background: var(--hl-in); } .ev-reg { background: var(--hl-reg); } .ev-intl { background: var(--hl-intl); } .ev-sap { background: var(--hl-sap); } .ev-hist { background: var(--hl-hist); }
.chip.ev-in[aria-pressed="true"], .chip.ev-reg[aria-pressed="true"], .chip.ev-intl[aria-pressed="true"], .chip.ev-sap[aria-pressed="true"], .chip.ev-hist[aria-pressed="true"] { color: var(--ink); border-color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.card-phrase { font-size: 1.42rem; font-weight: 700; margin-bottom: 6px; }
.card-phrase a { color: var(--ink); text-decoration: none; }
.card-phrase a:hover { color: var(--accent); }
.card-meaning { font-size: 1rem; color: var(--ink); }
.row { border-left: 3px solid var(--line); padding: 2px 0 2px 10px; margin: 8px 0; }
.row-k { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--ink-3); }
.row-v { margin: 0; font-size: .93rem; color: var(--ink-2); }
.r-ex { border-color: var(--gold); } .r-ex .row-v { font-family: var(--mono); font-size: .84rem; }
.r-land { border-color: var(--rose); } .r-clear { border-color: var(--green); } .r-note { border-color: var(--blue); }
.card-variants { font-size: .82rem; color: var(--ink-3); margin: 6px 0 0; }
.card-variants .row-k { display: inline; }
.card-foot { margin-top: auto; padding-top: 10px; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.card-src { font-size: .82rem; }
.card-src summary { cursor: pointer; color: var(--ink-3); }
.card-src ul { margin: 6px 0 0; padding-left: 18px; }
.icon-btn { border: 1px solid var(--line); background: transparent; border-radius: 8px; width: 30px; height: 30px; cursor: pointer; color: var(--ink-3); flex: none; }
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.empty { text-align: center; font-size: 1.1rem; padding: 40px 0; color: var(--ink-2); }

/* ---------- decoder ---------- */
.decoder { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 20px; }
.preset-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.preset-label { font-size: .85rem; color: var(--ink-3); margin-right: 2px; }
textarea { width: 100%; font: .9rem/1.55 var(--mono); padding: 14px; border-radius: 12px; border: 1.5px solid var(--ink); background: var(--card); color: var(--ink); resize: vertical; box-shadow: 3px 3px 0 var(--ink); }
.meter { margin-top: 18px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.meter-head { display: flex; justify-content: space-between; font-size: .85rem; color: var(--ink-3); margin-bottom: 6px; }
.meter-head strong { color: var(--ink); font-family: var(--mono); }
.meter-track { height: 12px; border-radius: 999px; background: var(--paper-2); overflow: hidden; border: 1px solid var(--line); }
.meter-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--green), var(--gold) 55%, var(--accent)); transition: width .4s cubic-bezier(.2,.8,.2,1); }
.meter-verdict { margin: 8px 0 0; font-family: var(--display); font-style: italic; font-size: 1.05rem; }
.decoder-out { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; min-height: 420px; }
.tabs { display: flex; border-bottom: 1px solid var(--line); background: var(--paper-2); }
.tabs [role="tab"] { flex: 1; border: 0; background: transparent; padding: 12px 8px; font-weight: 600; font-size: .9rem; color: var(--ink-3); cursor: pointer; border-bottom: 3px solid transparent; }
.tabs [role="tab"][aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); background: var(--card); }
.pane { padding: 16px; flex: 1; }
.pane[hidden] { display: none; }
.pane-note { font-size: .86rem; color: var(--ink-3); }
#pane-hl { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.hl-text { white-space: pre-wrap; font: .9rem/1.9 var(--mono); word-break: break-word; }
.hl { font: inherit; border: 0; padding: 1px 3px; border-radius: 4px; cursor: pointer; color: var(--ink); box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--ink) 25%, transparent); }
.hl-in { background: var(--hl-in); } .hl-reg { background: var(--hl-reg); } .hl-intl { background: var(--hl-intl); } .hl-sap { background: var(--hl-sap); } .hl-hist { background: var(--hl-hist); }
.hl:hover, .hl.active { outline: 2px solid var(--accent); outline-offset: 1px; }
.hl-empty { color: var(--ink-3); font-style: italic; }
.explain { border-top: 1px dashed var(--line); padding-top: 12px; }
.explain-hint { color: var(--ink-3); font-size: .9rem; margin: 0; }
.explain-found { font-family: var(--display); font-weight: 700; font-size: 1.25rem; margin-bottom: 4px; }
.explain-head { margin-bottom: 6px; }
.explain-m { margin-bottom: 4px; }
.explain-link { font-weight: 600; font-size: .9rem; }
.rewrite { font: .9rem/1.7 var(--mono); background: var(--paper-2); padding: 14px; border-radius: 10px; border: 1px solid var(--line); margin: 0 0 12px; }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.checks li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); }
.checks li.ok { background: color-mix(in srgb, var(--green) 10%, transparent); }
.checks li.miss { background: color-mix(in srgb, var(--rose) 8%, transparent); }
.check-mark { font-weight: 900; font-size: 1.1rem; width: 1.2em; text-align: center; }
.ok .check-mark { color: var(--green); } .miss .check-mark { color: var(--rose); }
.checks strong { display: block; }
.check-desc { font-size: .88rem; color: var(--ink-2); }
.score { font-family: var(--display); font-style: italic; font-size: 1.1rem; margin-top: 12px; }

.ambiguity { margin-top: 40px; }
.ambiguity h3 { font-size: 1.5rem; margin-bottom: 14px; }
.amb-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border: 1.5px solid var(--ink); border-radius: var(--radius); overflow: hidden; background: var(--card); }
.amb-grid > div { padding: 16px; border-right: 1px solid var(--line); }
.amb-grid > div:last-child { border-right: 0; background: color-mix(in srgb, var(--green) 9%, var(--card)); }
.amb-k { display: block; font-family: var(--mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); font-weight: 600; margin-bottom: 6px; }
.amb-grid p { margin: 0; font-size: .95rem; }
.amb-quote { font-family: var(--display); font-style: italic; font-size: 1.1rem !important; }

/* ---------- needfulifier ---------- */
.parody-badge { display: inline-block; background: var(--rose); color: #fff; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 4px; letter-spacing: .08em; text-transform: uppercase; vertical-align: 2px; }
.nf { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 24px; align-items: start; }
.field-label { display: block; font-weight: 700; font-size: .85rem; margin-bottom: 6px; padding: 0; }
.levels { border: 0; padding: 0; margin: 16px 0; display: grid; gap: 6px; }
.levels label { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); cursor: pointer; }
.levels label:has(input:checked) { border-color: var(--ink); box-shadow: 2px 2px 0 var(--ink); }
.levels input { accent-color: var(--accent); width: 18px; height: 18px; }
.nf-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.mail { background: var(--card); border: 1.5px solid var(--ink); border-radius: var(--radius); box-shadow: 6px 6px 0 var(--ink); overflow: hidden; margin-bottom: 14px; }
.mail.pop { animation: pop .35s cubic-bezier(.2,1.4,.4,1); }
@keyframes pop { 0% { transform: scale(.97) rotate(-.4deg); } 100% { transform: none; } }
.mail-head { display: flex; align-items: center; gap: 6px; padding: 10px 14px; background: var(--paper-2); border-bottom: 1px solid var(--line); }
.mail-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--line); }
.mail-dot:nth-child(1) { background: #ff5f57; } .mail-dot:nth-child(2) { background: #febc2e; } .mail-dot:nth-child(3) { background: #28c840; }
.mail-parody { margin-left: auto; font-family: var(--mono); font-size: .7rem; letter-spacing: .14em; color: var(--rose); font-weight: 700; border: 1.5px solid var(--rose); padding: 1px 6px; border-radius: 4px; transform: rotate(-3deg); }
.mail-body { margin: 0; padding: 18px; font: .9rem/1.65 var(--mono); min-height: 280px; }

/* ---------- archaeology ---------- */
.timeline { list-style: none; margin: 0; padding: 0 0 0 28px; position: relative; display: grid; gap: 22px; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; background: repeating-linear-gradient(to bottom, var(--gold) 0 8px, transparent 8px 14px); }
.dig { position: relative; background: color-mix(in srgb, var(--dark-band-ink) 6%, transparent); border: 1px solid color-mix(in srgb, var(--dark-band-ink) 16%, transparent); border-radius: var(--radius); padding: 18px 20px; }
.dig::before { content: ""; position: absolute; left: -27px; top: 22px; width: 14px; height: 14px; border-radius: 50%; background: var(--dark-band); border: 3px solid var(--gold); }
.dig-feature { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 10%, transparent); }
.dig-feature::before { background: var(--gold); }
.dig-date { font-family: var(--mono); font-size: .8rem; color: var(--gold); display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.hist-tag { background: var(--hl-hist); color: #1d2433; border-radius: 999px; padding: 1px 8px; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.dig h3 { font-size: 1.45rem; margin-bottom: 10px; }
.dig p { color: color-mix(in srgb, var(--dark-band-ink) 85%, transparent); }
.dig-read { border-left: 3px solid var(--gold); padding-left: 10px; }
.dig-src { font-size: .88rem; margin: 0; }

/* ---------- etymology ---------- */
.articles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.article { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.article:first-child { grid-row: span 2; border-top: 5px solid var(--accent); }
.article h3 { font-size: 1.6rem; margin-bottom: 12px; }
.article:first-child h3 { font-size: 2rem; }
.article:first-child p:first-of-type::first-letter { float: left; font-family: var(--display); font-weight: 900; font-size: 3.6rem; line-height: .85; margin: 6px 8px 0 0; color: var(--accent); }
.art-src { font-size: .86rem; color: var(--ink-3); margin: 0; }

/* ---------- culture ---------- */
.culture { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.cul-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.cul-card h3 { font-size: 1.35rem; margin-bottom: 10px; }
.cul-card p:last-child { margin-bottom: 0; }
.cul-caution { border: 1.5px dashed var(--rose); }

/* ---------- bingo ---------- */
.bingo-wrap { display: grid; grid-template-columns: minmax(0, 640px) auto; gap: 24px; align-items: start; }
.bingo { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; background: var(--ink); padding: 6px; border-radius: var(--radius); box-shadow: 6px 6px 0 var(--accent); }
.bcell { aspect-ratio: 1; border: 0; border-radius: 8px; background: var(--card); color: var(--ink); font-size: clamp(.62rem, 1.7vw, .9rem); font-weight: 600; line-height: 1.2; padding: 4px; cursor: pointer; position: relative; overflow: hidden; transition: transform .1s; hyphens: auto; overflow-wrap: anywhere; }
.bcell:hover { transform: scale(1.04); z-index: 1; }
.bcell[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 16%, var(--card)); }
.bcell[aria-pressed="true"]::after { content: "✓"; position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--display); font-size: clamp(2rem, 6vw, 3.4rem); font-weight: 900; color: var(--accent); opacity: .55; transform: rotate(-14deg); animation: stampcell .3s cubic-bezier(.2,1.6,.4,1); }
@keyframes stampcell { from { transform: rotate(-14deg) scale(2); opacity: 0; } }
.bcell.free { background: var(--gold); color: #1d2433; cursor: default; }
.bcell.free::after { color: #1d2433; opacity: .3; }
.bcell.win { background: var(--accent); color: var(--accent-ink); }
.bcell.win::after { color: var(--accent-ink); opacity: .35; }
.bingo-status { font-family: var(--display); font-size: 1.4rem; font-weight: 700; max-width: 18ch; }

/* ---------- museum ---------- */
.museum { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.specimen { background: var(--card); border: 1px solid var(--line); border-radius: 4px; padding: 20px 18px; box-shadow: var(--shadow); position: relative; display: flex; flex-direction: column; transform: rotate(-.4deg); }
.specimen:nth-child(2) { transform: rotate(.5deg); }
.specimen::before { content: ""; position: absolute; top: -10px; left: 50%; width: 90px; height: 22px; transform: translateX(-50%) rotate(-2deg); background: color-mix(in srgb, var(--gold) 55%, transparent); border-radius: 2px; }
.spec-head { margin-bottom: 10px; }
.spec-tag { font-family: var(--mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); font-weight: 600; }
.spec-head h3 { font-size: 1.25rem; }
.spec-body { font: .8rem/1.6 var(--mono); color: var(--ink-2); flex: 1; margin: 0 0 14px; }
.specimen .btn { align-self: flex-start; }

/* ---------- footer ---------- */
.foot { background: var(--dark-band); color: var(--dark-band-ink); padding: 48px 0; }
.foot a { color: var(--gold); }
.foot-inner { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 32px; }
.foot-sig { font-family: var(--display); font-size: 1.4rem; font-style: italic; }
.foot-small { font-size: .85rem; opacity: .7; }
.foot-sources h2 { font-size: 1.2rem; margin-bottom: 10px; }
.foot-sources p { font-size: .9rem; opacity: .85; }

/* ---------- toast & confetti ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 999px; font-weight: 600; z-index: 60; box-shadow: var(--shadow); max-width: calc(100vw - 32px); text-align: center; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 55; overflow: hidden; }
.cf { position: absolute; top: -40px; animation: fall 2.2s cubic-bezier(.3,.6,.5,1) forwards; }
@keyframes fall { to { transform: translate(var(--dx), 110vh) rotate(var(--rot)); opacity: .9; } }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; padding-top: 40px; }
  .stamp { position: absolute; right: 12px; top: 18px; width: 120px; height: 120px; border-width: 4px; }
  .stamp-top, .stamp-mid { font-size: .48rem; }
  .stamp-big { font-size: 1.6rem; border-width: 2px; }
  .decoder, .nf { grid-template-columns: minmax(0, 1fr); }
  .amb-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .amb-grid > div:nth-child(2) { border-right: 0; }
  .amb-grid > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .museum { grid-template-columns: minmax(0, 1fr); }
  .bingo-wrap { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 700px) {
  .nav { display: none; }
  .bar-inner { justify-content: space-between; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .articles, .culture, .foot-inner { grid-template-columns: minmax(0, 1fr); }
  .article:first-child { grid-row: auto; }
  .amb-grid { grid-template-columns: minmax(0, 1fr); }
  .amb-grid > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .section { padding: 52px 0; }
  /* Wrapped chips make the filter block tall on phones: let it scroll away. */
  .dict-tools { position: static; backdrop-filter: none; -webkit-backdrop-filter: none; background: transparent; border-bottom: 0; }
  .chip { padding: 4px 9px; font-size: .8rem; }
  .chips-ev .chip { font-size: .76rem; }
  .hero-title { padding-right: 90px; }
  .kicker { padding-right: 104px; }
  .stamp { width: 96px; height: 96px; top: 10px; }
  .stamp-big { font-size: 1.25rem; }
  .stamp-top, .stamp-mid { font-size: .4rem; letter-spacing: .1em; }
}
