/* ---------- Tokens ---------- */
:root {
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  -webkit-text-size-adjust: 100%;
}
*, *::before, *::after { box-sizing: inherit; }
html { scroll-padding-top: env(safe-area-inset-top, 0px); }
body { margin: 0; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

/* Newspaper */
[data-theme="paper"] {
  --bg: #E6E1D3;       /* newsprint */
  --ink: #1E1C18;
  --muted: #5C5648;
  --rule: #1E1C18;
  --red: #8E1B1B;      /* edition stamp */
  --serif-head: "Old Standard TT", "Times New Roman", Georgia, serif;
  --serif-body: "Libre Caslon Text", Georgia, "Times New Roman", serif;
  --blackletter: "UnifrakturCook", "Old English Text MT", "Times New Roman", serif;
  --ui: var(--serif-head);
  --panel: transparent;
  --ok: #2F6B3A; --bad: #8E1B1B; --warn: #9A6A12;
  --tile-correct: #2F6B3A; --tile-present: #B08A2E; --tile-absent: #7A7466;
}

/* Modern */
[data-theme="modern"] {
  --bg: #FFFFFF;
  --ink: #1C1C1E;
  --muted: #6E6E73;
  --rule: #E3E3E8;
  --card: #F2F2F7;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", Roboto, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --c-top: #D7263D;
  --c-world: #1B6EC2; --c-pakistan: #01693A; --c-us: #3A4BA8; --c-business: #0E8A5F; --c-technology: #7B3FE4;
  --ui: var(--sans);
  --panel: var(--card);
  --ok: #1E8E3E; --bad: #D93025; --warn: #E8A317;
  --tile-correct: #1E8E3E; --tile-present: #D9A520; --tile-absent: #8E8E93;
  --c-science: #00838F; --c-health: #D2347F; --c-climate: #4C8C2B; --c-sports: #E07A10; --c-culture: #B8336A; --c-food: #C0392B; --c-travel: #0B7A9E; --c-space: #4B3FA8; --c-entertainment: #C2185B;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="modern"] { --bg: #000000; --ink: #F5F5F7; --muted: #98989D; --rule: #2C2C2E; --card: #1C1C1E; }
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif-body, var(--sans));
  transition: background-color .2s;
}

/* ---------- Toolbar ---------- */
.bar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5;
  display: flex; justify-content: flex-end; align-items: center; gap: 4px;
  padding: 6px 10px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.icon-btn {
  width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent;
  display: grid; place-items: center; cursor: pointer; font-weight: 700; font-size: 15px;
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.spin svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin svg { animation: none; opacity: .5; } }

.notice {
  margin: 0 auto 8px; max-width: 1200px; padding: 10px 16px; font-size: 14px;
  background: color-mix(in srgb, var(--ink) 8%, transparent); border-radius: 8px; width: calc(100% - 24px);
}
.notice a { text-decoration: underline; }
.loading, .empty { text-align: center; padding: 30vh 24px; color: var(--muted); font-style: italic; }

main { max-width: 1200px; margin: 0 auto; padding: 0 16px calc(96px + env(safe-area-inset-bottom, 0px)); }
.bar-spacer { flex: 1; }
[hidden] { display: none !important; }
[data-size="s"] main { zoom: .9; }
[data-size="l"] main { zoom: 1.15; }

.pay {
  font-size: .78em; padding: 0 5px; border: 1px solid currentColor; border-radius: 3px; white-space: nowrap;
}
.also { margin-top: 6px; font-size: 13px; color: var(--muted); }
.also summary { cursor: pointer; list-style: none; text-decoration: underline; text-underline-offset: 2px; }
.also summary::-webkit-details-marker { display: none; }
.also p { margin: 4px 0 0; }
.also a { text-decoration: underline; }

/* =========================================================
   NEWSPAPER THEME
   ========================================================= */
[data-theme="paper"] main { padding-top: 0; }

.masthead { text-align: center; border-bottom: 4px double var(--rule); margin-bottom: 18px; }
.masthead h1 {
  font-family: var(--blackletter); font-weight: 700; margin: 4px 0 10px; line-height: .95;
  font-size: clamp(42px, 11vw, 112px); letter-spacing: -.01em;
}
.dateline {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 16px;
  border-top: 1px solid var(--rule); padding: 6px 2px; font-family: var(--serif-head);
  font-size: 13px; font-style: italic;
}
.dateline .ed { color: var(--red); font-style: normal; font-weight: 700; font-variant: small-caps; letter-spacing: .04em; }

[data-theme="paper"] h2, [data-theme="paper"] h3 { font-family: var(--serif-head); font-weight: 700; margin: 0; }
[data-theme="paper"] p { line-height: 1.55; hyphens: auto; -webkit-hyphens: auto; }
[data-theme="paper"] .credit { display: block; font-size: 12px; font-style: italic; color: var(--muted); }
[data-theme="paper"] a h2:hover, [data-theme="paper"] a h3:hover { text-decoration: underline; text-decoration-thickness: 1px; }

.halftone {
  width: 100%; margin: 10px 0; aspect-ratio: 16 / 9; object-fit: cover;
  filter: grayscale(1) contrast(1.2) brightness(1.02); mix-blend-mode: multiply;
}

.front { display: grid; gap: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--rule); }
.lead h2 { font-size: clamp(30px, 6vw, 54px); line-height: 1.04; letter-spacing: -.015em; }
.lead .deck { font-size: 18px; margin: 8px 0 6px; }
.top .brief { padding: 12px 0; border-top: 1px solid var(--rule); }
.top .brief:first-child { border-top: 0; padding-top: 0; }
.brief h3 { font-size: 20px; line-height: 1.15; }
.brief p { font-size: 15px; margin: 6px 0; }

@media (min-width: 720px) {
  .front { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
  .top { border-left: 1px solid var(--rule); padding-left: 20px; }
}

.section { padding-top: 22px; }
.section-head {
  display: flex; align-items: center; gap: 12px; margin-bottom: 14px !important;
  font-size: 22px; font-style: italic; font-weight: 400 !important;
}
.section-head::before, .section-head::after { content: ""; flex: 1; border-top: 1px solid var(--rule); }

.cols { column-count: 1; column-gap: 28px; column-rule: 1px solid color-mix(in srgb, var(--rule) 45%, transparent); }
@media (min-width: 600px) { .cols { column-count: 2; } }
@media (min-width: 980px) { .cols { column-count: 3; } }
.item { break-inside: avoid; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid color-mix(in srgb, var(--rule) 30%, transparent); }
.item h3 { font-size: 18px; line-height: 1.18; }
.item.first h3 { font-size: 24px; line-height: 1.1; }
.item p { font-size: 15px; margin: 6px 0; }

.colophon { margin-top: 30px; padding-top: 10px; border-top: 4px double var(--rule); text-align: center; font-size: 12px; font-style: italic; color: var(--muted); }

/* =========================================================
   MODERN THEME
   ========================================================= */
[data-theme="modern"] body { font-family: var(--sans); }
[data-theme="modern"] main { max-width: 760px; }
[data-theme="modern"] h1, [data-theme="modern"] h2, [data-theme="modern"] h3 { margin: 0; }

.today { display: flex; justify-content: space-between; align-items: flex-end; padding: 4px 0 14px; }
.today h1 { font-size: 36px; font-weight: 800; letter-spacing: -.02em; }
.today p { margin: 0; text-align: right; font-size: 14px; font-weight: 600; color: var(--muted); line-height: 1.35; }
.today .sub { font-weight: 400; }

[data-theme="modern"] .src { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 3px; }

.hero { margin-bottom: 26px; }
.hero-link { display: block; position: relative; border-radius: 16px; overflow: hidden; background: var(--card); }
.hero-img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.hero-text { padding: 16px; }
.hero-link:has(img) .hero-text {
  position: absolute; inset: auto 0 0 0; padding: 60px 16px 16px; color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, .78));
}
.hero-link:has(img) .src { color: rgba(255, 255, 255, .85) !important; }
.hero h2 { font-size: clamp(24px, 6vw, 32px); line-height: 1.12; font-weight: 800; letter-spacing: -.01em; }
.hero-deck { font-size: 16px; line-height: 1.45; color: var(--muted); margin: 10px 2px 0; }

.group { margin-bottom: 28px; }
.group-head { font-size: 22px; font-weight: 800; color: var(--c); padding-bottom: 6px; letter-spacing: -.01em; }

.row { display: flex; gap: 14px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--rule); }
.row-text { flex: 1; min-width: 0; }
.row h3 { font-size: 17px; line-height: 1.25; font-weight: 700; }
.row .when { display: block; margin-top: 5px; font-size: 13px; color: var(--muted); }
.thumb-link { flex: none; }
.thumb { width: 92px; height: 92px; object-fit: cover; border-radius: 10px; background: var(--card); }

.feature { padding: 4px 0 14px; }
.feature-img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 12px; margin-bottom: 10px; background: var(--card); }
.feature h3 { font-size: 20px; line-height: 1.2; font-weight: 800; }
.feature p { margin: 6px 0 0; font-size: 15px; line-height: 1.45; color: var(--muted); }

[data-theme="modern"] .colophon { border-top: 1px solid var(--rule); font-style: normal; }

/* Big inner screen of a foldable or a tablet: two columns of groups */
@media (min-width: 900px) {
  [data-theme="modern"] main { max-width: 1100px; }
  [data-theme="modern"] main { display: grid; grid-template-columns: 1fr 1fr; column-gap: 32px; }
  [data-theme="modern"] .today, [data-theme="modern"] .hero, [data-theme="modern"] .colophon { grid-column: 1 / -1; }
  .hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; align-items: end; }
}

/* ---------- Install sheet ---------- */
dialog {
  border: 0; border-radius: 16px; padding: 0; max-width: 460px; width: calc(100% - 32px);
  background: var(--bg); color: var(--ink);
}
dialog::backdrop { background: rgba(0, 0, 0, .45); }
.sheet { padding: 20px 22px; font-family: var(--sans, var(--serif-body)); line-height: 1.5; }
.sheet h2 { margin: 0 0 6px; font-size: 22px; }
.sheet h3 { margin: 16px 0 4px; font-size: 16px; }
.sheet ol { margin: 0; padding-left: 20px; }
.sheet .fine { font-size: 13px; color: var(--muted); }
.primary { width: 100%; margin-top: 10px; padding: 12px; border: 0; border-radius: 10px; background: var(--ink); color: var(--bg); font-weight: 700; cursor: pointer; }

/* ---------- Urdu stories (right-to-left) ---------- */
[lang="ur"] h2, [lang="ur"] h3, [lang="ur"] p, [lang="ur"] .hero-deck {
  font-family: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", "Urdu Typesetting", "Noto Naskh Arabic", serif !important;
  font-weight: 400 !important; letter-spacing: 0 !important; hyphens: manual;
}
[lang="ur"] h2 { line-height: 1.9 !important; font-size: clamp(24px, 5vw, 38px) !important; }
[lang="ur"] h3 { line-height: 1.9 !important; font-size: 18px !important; }
[lang="ur"] p { line-height: 2.1 !important; font-size: 15px !important; }
[lang="ur"] .credit, [lang="ur"] .when, [lang="ur"] .src, [lang="ur"] .also { direction: ltr; text-align: right; }
[data-theme="paper"] .top [lang="ur"] { text-align: right; }

/* =========================================================
   APP CHROME: tabs, buttons, panels (both themes)
   ========================================================= */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px 4px env(safe-area-inset-bottom, 0px);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid color-mix(in srgb, var(--ink) 18%, transparent);
  font-family: var(--ui);
}
.tabs a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0 6px; font-size: 11px; color: var(--muted); }
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabs a[aria-current="page"] { color: var(--ink); font-weight: 700; }
.tabs a[aria-current="page"] svg { stroke-width: 2.3; }
[data-theme="modern"] .tabs a[aria-current="page"] { color: var(--c-top); }
@media (min-width: 900px) { .tabs { left: 50%; right: auto; transform: translateX(-50%); width: 520px; border: 1px solid color-mix(in srgb, var(--ink) 18%, transparent); border-radius: 16px; bottom: 12px; padding-bottom: 6px; } }

.credit-row, .row-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.row-meta .also { margin-top: 0; }
.save {
  flex: none; width: 34px; height: 34px; margin: -4px -6px -4px 0; border: 0; background: transparent; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer; color: var(--muted);
}
.save svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.save[aria-pressed="true"] { color: var(--ink); }
.save[aria-pressed="true"] svg { fill: currentColor; }
[data-theme="modern"] .save[aria-pressed="true"] { color: var(--c-top); }
.save:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.read h2, .read h3 { opacity: .6; }

.view-head { padding: 4px 0 14px; font-family: var(--ui); }
.view-head h1 { margin: 0; font-size: 34px; font-weight: 800; letter-spacing: -.01em; }
[data-theme="paper"] .view-head h1 { font-family: var(--serif-head); font-weight: 700; border-bottom: 4px double var(--rule); padding-bottom: 6px; }
.view-head p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.empty-small { color: var(--muted); font-style: italic; padding: 24px 0; line-height: 1.5; }
[data-theme="modern"] .empty-small { font-style: normal; }
.list { margin-bottom: 18px; }
.list-head { font-family: var(--ui); font-size: 15px; margin: 10px 0 2px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
[data-theme="paper"] .row h3 { font-family: var(--serif-head); }
[data-theme="paper"] .src { display: block; font-size: 12px; font-style: italic; color: var(--muted); }
[data-theme="paper"] .row .when { font-size: 12px; font-style: italic; color: var(--muted); }
[data-theme="paper"] .thumb { filter: grayscale(1) contrast(1.15); mix-blend-mode: multiply; border-radius: 0; }

.toolbar { display: flex; gap: 8px; margin-bottom: 8px; }
input[type="search"], .add input {
  flex: 1; min-width: 0; padding: 10px 12px; font: inherit; font-size: 16px; color: var(--ink);
  background: color-mix(in srgb, var(--ink) 6%, transparent); border: 1px solid color-mix(in srgb, var(--ink) 20%, transparent); border-radius: 10px;
}
[data-theme="paper"] input[type="search"], [data-theme="paper"] .add input { border-radius: 2px; background: transparent; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--ink);
  background: var(--ink); color: var(--bg); font-family: var(--ui); font-weight: 700; font-size: 15px; cursor: pointer; white-space: nowrap;
}
.btn.ghost { background: transparent; color: var(--ink); }
[data-theme="paper"] .btn { border-radius: 2px; }
.buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.link-btn { border: 0; background: none; padding: 0; text-decoration: underline; cursor: pointer; color: inherit; font: inherit; }

.panel { background: var(--panel); border-radius: 14px; padding: 14px 16px; margin-bottom: 14px; font-family: var(--ui); }
[data-theme="paper"] .panel { border-top: 1px solid var(--rule); border-radius: 0; padding: 14px 0; }
.panel h2 { margin: 0 0 6px; font-size: 19px; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.45; margin: 0 0 8px; }
.sub-head { font-size: 14px; margin: 14px 0 4px; }
.field { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid color-mix(in srgb, var(--ink) 25%, transparent); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 7px 12px; font: inherit; font-size: 14px; cursor: pointer; color: var(--ink); }
.seg button + button { border-left: 1px solid color-mix(in srgb, var(--ink) 25%, transparent); }
.seg [aria-checked="true"], .seg [aria-selected="true"] { background: var(--ink); color: var(--bg); font-weight: 700; }
.seg.small button { padding: 5px 9px; font-size: 13px; }
[data-theme="paper"] .seg { border-radius: 2px; }

.sections, .sources { list-style: none; margin: 0; padding: 0; }
.sections li, .sources li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-top: 1px solid color-mix(in srgb, var(--ink) 10%, transparent); }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; flex: 1; min-height: 32px; }
.check input { width: 20px; height: 20px; accent-color: var(--ink); }
[data-theme="modern"] .check input { accent-color: var(--c-top); }
.move { display: flex; gap: 2px; }
.icon-sm { width: 34px; height: 34px; border: 0; border-radius: 8px; background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink); cursor: pointer; font-size: 16px; }
.icon-sm:disabled { opacity: .3; cursor: default; }
.add { display: flex; gap: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { border: 1px solid color-mix(in srgb, var(--ink) 25%, transparent); background: transparent; color: var(--ink); border-radius: 999px; padding: 5px 11px; font: inherit; font-size: 14px; cursor: pointer; }
.status { font-size: 12px; white-space: nowrap; }
.status::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.status.ok { color: var(--muted); } .status.ok::before { background: var(--ok); }
.status.bad { color: var(--bad); font-weight: 700; } .status.bad::before { background: var(--bad); }

.toast {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); z-index: 9;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-family: var(--ui); font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* =========================================================
   PUZZLES
   ========================================================= */
.game-grid { display: grid; gap: 12px; margin-bottom: 18px; }
@media (min-width: 700px) { .game-grid { grid-template-columns: repeat(3, 1fr); } }
.game-card { display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: 14px; background: var(--panel); font-family: var(--ui); min-height: 130px; }
[data-theme="paper"] .game-card { border: 1px solid var(--rule); border-radius: 0; }
[data-theme="paper"] .game-card:first-child { border-width: 2px; }
.game-name { font-size: 20px; font-weight: 800; }
[data-theme="paper"] .game-name { font-family: var(--serif-head); font-weight: 700; font-size: 22px; }
.game-blurb { color: var(--muted); font-size: 14px; line-height: 1.4; flex: 1; }
.game-status { font-weight: 700; font-size: 14px; }
.game-card:not(.done) .game-status::after { content: " \2192"; }
.game-card.done .game-status { color: var(--ok); }
.game-card[aria-disabled="true"] { opacity: .5; pointer-events: none; }

.board-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.board-head h2 { margin: 0; }
.ranks { list-style: none; margin: 0; padding: 0; }
.ranks li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid color-mix(in srgb, var(--ink) 10%, transparent); }
.ranks .pos { width: 22px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.ranks .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranks .pts { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.ranks .pts b { font-size: 17px; font-variant-numeric: tabular-nums; }
.ranks .pts small { color: var(--muted); font-size: 11px; }
.ranks li.you { font-weight: 700; }
.ranks li:nth-child(1) .pos { color: var(--warn); font-weight: 800; }
.me { margin-top: 12px; font-size: 14px; color: var(--muted); }

.back { display: inline-block; font-family: var(--ui); font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.game { max-width: 520px; margin: 0 auto; text-align: center; font-family: var(--ui); }
.game-title { margin: 0 0 4px; font-size: 28px; }
[data-theme="paper"] .game-title { font-family: var(--serif-head); }
.big { font-size: 20px; font-weight: 800; margin: 14px 0 8px; }
.from { font-size: 14px; line-height: 1.45; }
.from a { text-decoration: underline; }
.result { padding: 6px 0 10px; }
.feedback { min-height: 22px; font-size: 15px; margin: 8px 0; }

.gallows { width: 130px; height: 130px; margin: 6px auto 0; display: block; }
.gallows path { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.gallows .beam { stroke-width: 4; }
.slots { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 14px 0 6px; }
.slot { width: 30px; height: 40px; border-bottom: 3px solid var(--ink); font-size: 26px; font-weight: 800; line-height: 40px; }
.lives { margin: 4px 0 10px; letter-spacing: 3px; }

.kbd { display: flex; flex-direction: column; gap: 6px; margin: 12px auto 0; user-select: none; }
.kbd-row { display: flex; justify-content: center; gap: 5px; }
.key {
  flex: 1; max-width: 44px; height: 52px; border: 0; border-radius: 6px; font: inherit; font-weight: 700; font-size: 16px;
  background: color-mix(in srgb, var(--ink) 12%, transparent); color: var(--ink); cursor: pointer; touch-action: manipulation;
}
.key.wide { flex: 1.6; max-width: 70px; font-size: 13px; }
.key.hit, .key.correct { background: var(--tile-correct); color: #fff; }
.key.present { background: var(--tile-present); color: #fff; }
.key.miss { background: var(--tile-absent); color: #fff; }
.key:disabled { cursor: default; }
.key.off { opacity: .25; }

.w-grid { display: grid; gap: 6px; justify-content: center; margin: 14px 0 4px; }
.w-row { display: grid; grid-template-columns: repeat(5, 54px); gap: 6px; }
.tile { height: 54px; display: grid; place-items: center; font-size: 26px; font-weight: 800; border: 2px solid color-mix(in srgb, var(--ink) 18%, transparent); text-transform: uppercase; }
.tile.typed { border-color: var(--ink); }
.tile.correct, .tile.present, .tile.absent { color: #fff; border-color: transparent; }
.tile.correct { background: var(--tile-correct); }
.tile.present { background: var(--tile-present); }
.tile.absent { background: var(--tile-absent); }
@media (max-width: 360px) { .w-row { grid-template-columns: repeat(5, 46px); } .tile { height: 46px; } }

.prompt { font-size: 22px; line-height: 1.35; margin: 18px 0; text-align: left; }
[data-theme="paper"] .prompt { font-family: var(--serif-head); font-weight: 700; }
.blank { display: inline-block; min-width: 3em; border-bottom: 3px solid var(--ink); text-align: center; padding: 0 4px; }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.option { padding: 14px 10px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--ink) 25%, transparent); background: transparent; color: var(--ink); font: inherit; font-size: 16px; font-weight: 700; cursor: pointer; }
.option.right { background: var(--ok); color: #fff; border-color: transparent; }
.option.wrong { background: var(--bad); color: #fff; border-color: transparent; }
.option:disabled:not(.right):not(.wrong) { opacity: .5; }
[data-theme="paper"] .option { border-radius: 2px; }
.recap { text-align: left; padding-left: 22px; line-height: 1.45; }
.recap li { margin-bottom: 8px; }
.recap li.ok::marker { color: var(--ok); }
.recap li.bad::marker { color: var(--bad); }
.recap a { text-decoration: underline; }

/* =========================================================
   LESS SCROLLING: jump bar, More, headlines-only
   ========================================================= */
.jump {
  flex: 1; min-width: 0; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px 4px 2px 0;
  font-family: var(--ui); -webkit-mask-image: linear-gradient(90deg, #000 90%, transparent);
}
.jump::-webkit-scrollbar { display: none; }
.jump a { flex: none; padding: 6px 12px; border-radius: 999px; font-size: 14px; white-space: nowrap; color: var(--muted); border: 1px solid transparent; }
.jump a.on { color: var(--ink); border-color: color-mix(in srgb, var(--ink) 30%, transparent); font-weight: 700; }
[data-theme="modern"] .jump a.on { background: var(--ink); color: var(--bg); border-color: transparent; }
[data-theme="paper"] .jump a { border-radius: 0; font-style: italic; }
[data-theme="paper"] .jump a.on { font-style: normal; border-width: 0 0 2px; border-color: var(--ink); }
.section, .group, #top { scroll-margin-top: calc(64px + env(safe-area-inset-top, 0px)); }

section:not(.open) > .cols > .extra, section:not(.open) > .extra { display: none; }
.more-btn {
  display: block; width: 100%; margin: 4px 0 8px; padding: 10px; border: 1px solid color-mix(in srgb, var(--ink) 22%, transparent);
  background: transparent; color: var(--ink); font-family: var(--ui); font-size: 14px; font-weight: 700; cursor: pointer; border-radius: 10px;
}
[data-theme="paper"] .more-btn { border-radius: 0; border-width: 1px 0; font-style: italic; font-weight: 400; }

/* Headlines only */
[data-layout="headlines"] .deck, [data-layout="headlines"] .brief > p, [data-layout="headlines"] .item > p,
[data-layout="headlines"] .item .halftone, [data-layout="headlines"] .hero-deck, [data-layout="headlines"] .feature p,
[data-layout="headlines"] main .also { display: none; }
[data-layout="headlines"] .lead .halftone { aspect-ratio: 21 / 9; }
[data-layout="headlines"] .brief, [data-layout="headlines"] .item { padding-bottom: 8px; margin-bottom: 8px; }
[data-layout="headlines"] .top .brief { padding: 8px 0; }
[data-layout="headlines"] .item.first h3 { font-size: 20px; }
[data-layout="headlines"] .feature-img { aspect-ratio: 21 / 9; }
[data-layout="headlines"] .thumb { width: 64px; height: 64px; }
[data-layout="headlines"] .row { padding: 9px 0; }
[data-layout="headlines"] .hero-img { aspect-ratio: 16 / 9; }

/* =========================================================
   STORY PREVIEW SHEET
   ========================================================= */
.sheet-dialog {
  margin: auto auto 0; width: 100%; max-width: 640px; max-height: 88vh; max-height: 88dvh; border-radius: 20px 20px 0 0;
  padding: 0; overflow-y: auto; background: var(--bg); color: var(--ink);
}
.sheet-dialog[open] { animation: up .22s ease-out; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sheet-dialog[open] { animation: none; } }
@media (min-width: 760px) { .sheet-dialog { margin: auto; border-radius: 16px; } }
[data-theme="paper"] .sheet-dialog { border-radius: 0; border-top: 4px double var(--ink); }
.sheet-body { position: relative; padding: 16px 18px calc(18px + env(safe-area-inset-bottom, 0px)); }
.sheet-close { position: absolute; top: 10px; right: 10px; z-index: 2; width: 36px; height: 36px; border-radius: 50%; border: 0; background: color-mix(in srgb, var(--bg) 80%, var(--ink) 20%); color: var(--ink); font-size: 16px; cursor: pointer; }
[dir="rtl"] .sheet-close { right: auto; left: 10px; }
.sheet-img { max-width: none; width: calc(100% + 36px); margin: -16px -18px 14px; aspect-ratio: 16 / 9; object-fit: cover; }
[data-theme="paper"] .sheet-img { filter: grayscale(1) contrast(1.15); }
.kicker { margin: 4px 44px 6px 0; font-family: var(--ui); font-size: 13px; color: var(--muted); }
.sheet-body h2 { margin: 0 0 10px; font-size: 24px; line-height: 1.2; }
[data-theme="paper"] .sheet-body h2 { font-family: var(--serif-head); font-size: 28px; }
[data-theme="modern"] .sheet-body h2 { font-weight: 800; }
.sheet-summary { font-size: 17px; line-height: 1.55; margin: 0 0 14px; }
.sheet-also h3 { font-family: var(--ui); font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 6px; }
.sheet-also ul { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-wrap: wrap; gap: 6px; }
.sheet-also a { display: inline-block; padding: 6px 11px; border: 1px solid color-mix(in srgb, var(--ink) 25%, transparent); border-radius: 999px; font-family: var(--ui); font-size: 14px; }
.sheet-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; position: sticky; bottom: 0; padding-top: 10px; background: var(--bg); }
.sheet-actions .btn:first-child { flex: 1; }
.sheet-actions .save { width: 44px; height: 44px; margin: 0; }
.sheet-actions .save svg { width: 22px; height: 22px; }

/* =========================================================
   WELCOME
   ========================================================= */
.no-scroll { overflow: hidden; }
.welcome { position: fixed; inset: 0; z-index: 20; background: var(--bg); overflow-y: auto; padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px); }
.w-inner { max-width: 520px; margin: 0 auto; padding: 24px 22px 40px; position: relative; font-family: var(--ui); }
.w-skip { position: absolute; top: 18px; right: 18px; border: 0; background: none; color: var(--muted); font: inherit; text-decoration: underline; cursor: pointer; }
.w-dots { display: flex; gap: 6px; margin-bottom: 26px; }
.w-dots span { width: 22px; height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--ink) 18%, transparent); }
.w-dots span.on { background: var(--ink); }
.welcome h1 { font-size: 26px; line-height: 1.2; margin: 0 0 10px; font-weight: 700; }
.w-mast { font-family: var(--blackletter, var(--ui)); font-size: 40px; }
[data-theme="modern"] .w-mast { font-weight: 800; letter-spacing: -.02em; }
.welcome h2 { font-size: 19px; margin: 24px 0 8px; }
.welcome p { color: var(--muted); line-height: 1.5; margin: 0 0 8px; }
.w-choices { display: grid; gap: 8px; }
.w-choice, .w-card {
  text-align: left; padding: 14px 16px; border-radius: 12px; border: 2px solid color-mix(in srgb, var(--ink) 18%, transparent);
  background: transparent; color: var(--ink); font: inherit; font-size: 16px; font-weight: 700; cursor: pointer;
}
.w-choice[aria-pressed="true"], .w-card[aria-pressed="true"] { border-color: var(--ink); background: color-mix(in srgb, var(--ink) 7%, transparent); }
.w-choice[aria-pressed="true"]::after, .w-card[aria-pressed="true"] b::after { content: "  \2713"; }
.w-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.w-sec { font-size: 15px; padding: 8px 14px; }
.w-sec[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.w-sec[aria-pressed="false"] { opacity: .55; text-decoration: line-through; }
.w-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.w-card { display: flex; flex-direction: column; gap: 6px; min-height: 120px; }
.w-card span { font-weight: 400; font-size: 13px; color: var(--muted); }
.paper-card b { font-family: "Old Standard TT", Georgia, serif; font-size: 20px; }
.modern-card b { font-family: -apple-system, Roboto, "Segoe UI", sans-serif; font-weight: 800; font-size: 19px; }
.w-label { display: block; font-weight: 700; margin: 18px 0 6px; }
.w-input { width: 100%; padding: 12px; font: inherit; font-size: 16px; color: var(--ink); background: transparent; border: 1px solid color-mix(in srgb, var(--ink) 30%, transparent); border-radius: 10px; }
.w-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 30px; }
.w-nav .btn { min-width: 120px; }

/* =========================================================
   IDEAS, FEEDBACK, ADMIN
   ========================================================= */
textarea { width: 100%; margin-top: 10px; padding: 10px 12px; font: inherit; font-size: 16px; color: var(--ink); background: transparent; border: 1px solid color-mix(in srgb, var(--ink) 25%, transparent); border-radius: 10px; resize: vertical; }
.select, select { padding: 8px 10px; font: inherit; font-size: 15px; color: var(--ink); background: var(--bg); border: 1px solid color-mix(in srgb, var(--ink) 25%, transparent); border-radius: 8px; }
.ideas { margin-top: 12px; }
.idea { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid color-mix(in srgb, var(--ink) 10%, transparent); }
.idea p { margin: 0 0 4px; line-height: 1.4; }
.idea.done p { text-decoration: line-through; opacity: .6; }
.vote { flex: none; width: 48px; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 0; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--ink) 22%, transparent); background: transparent; color: var(--ink); cursor: pointer; font: inherit; font-size: 12px; }
.vote b { font-size: 16px; }
.vote[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.badge { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 12px; font-weight: 700; background: color-mix(in srgb, var(--ink) 10%, transparent); color: var(--ink); }
.badge.bug { background: color-mix(in srgb, var(--bad) 18%, transparent); color: var(--bad); }
.badge.praise { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; font-family: var(--ui); }
.stat { background: var(--panel); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; }
[data-theme="paper"] .stat { border: 1px solid var(--rule); border-radius: 0; }
.stat b { font-size: 28px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--muted); }
.fb { padding: 10px 0; border-top: 1px solid color-mix(in srgb, var(--ink) 10%, transparent); }
.fb.done { opacity: .55; }
.fb-top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fb p { margin: 6px 0; line-height: 1.45; }
.small-check { flex: none; font-size: 14px; }
.colophon a { text-decoration: underline; }
