/* The shared design system for every daily game, in the spirit of a
   newspaper's games section: white page, flat shapes, thin rules, a slab
   serif for names, a Franklin-style sans for everything else. A game's
   identity is one color (--game) and its icon, nothing more.
   Pages load: Libre Franklin 400-800 + Zilla Slab 600/700. */

:root {
  --ink: #121212;
  --paper: #ffffff;
  --wash: #f4f4f4;
  --rule: #dcdcdc;
  --muted: #6f6f6f;
  --green: #6aaa64;
  --yellow: #c9b458;
  --gray: #787c7e;
  --red: #d64534;
  --game: #e3e3e3;
  --ui: 'Libre Franklin', 'Franklin Gothic Medium', Arial, sans-serif;
  --slab: 'Zilla Slab', Rockwell, Georgia, serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }
/* no double-tap zoom anywhere (fast tapping on tiles and keys zoomed the page);
   pinch zoom still works */
html { -webkit-text-size-adjust: 100%; touch-action: manipulation; }
body {
  margin: 0; min-height: 100dvh;
  background: var(--paper); color: var(--ink);
  font-family: var(--ui); font-size: 16px; line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; }
/* hidden means hidden, even on things styled as flex or grid (.btn, .pad-hint...) */
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ── top bar ── */
.g-top {
  position: sticky; top: 0; z-index: 10;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  height: 56px; padding: 0 8px; padding-top: env(safe-area-inset-top); box-sizing: content-box;
  background: var(--paper); border-bottom: 1px solid var(--rule);
}
.g-name { margin: 0; font: 700 24px/1 var(--slab); letter-spacing: -0.01em; }
.g-actions { display: flex; justify-content: flex-end; }
.g-icon-btn {
  display: grid; place-items: center; width: 44px; height: 44px;
  border: 0; border-radius: 50%; background: none; color: var(--ink); cursor: pointer;
}
.g-icon-btn:hover { background: var(--wash); }
.g-icon-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.g-main {
  max-width: 500px; margin: 0 auto;
  padding: 20px 16px max(28px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 20px;
}
.g-note { margin: 0; padding: 10px 12px; border-radius: 6px; background: var(--wash); font-size: 14px; text-align: center; }

/* ── buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 48px; padding: 0 24px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--ink); background: var(--paper); color: var(--ink);
  font: 600 16px var(--ui); letter-spacing: 0.01em; text-decoration: none;
  transition: background 0.12s;
}
.btn:hover { background: var(--wash); }
.btn.solid { background: var(--ink); color: var(--paper); }
.btn.solid:hover { background: #333; }
.btn.small { height: 40px; padding: 0 18px; font-size: 15px; }
.btn:disabled { border-color: var(--rule); color: #b3b3b3; background: var(--paper); cursor: default; }
.btn.solid:disabled { background: #e6e6e6; border-color: #e6e6e6; color: #9a9a9a; }

/* ── splash (shown on every visit, like a front page) ── */
.splash {
  position: fixed; inset: 0; z-index: 40;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  padding: 24px 24px max(24px, env(safe-area-inset-bottom)); text-align: center;
  background: var(--game); color: var(--ink);
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
}
.splash.out { opacity: 0; transform: translateY(-8px); pointer-events: none; }
.splash .s-icon { width: 72px; height: 72px; margin-bottom: 18px; }
.splash h1 { margin: 0 0 8px; font: 700 44px/1 var(--slab); letter-spacing: -0.01em; }
.splash .s-by { margin: -2px 0 12px; font-size: 15px; font-weight: 600; opacity: 0.75; }
.splash .s-tag { margin: 0 0 30px; max-width: 300px; font-size: 22px; line-height: 1.25; font-weight: 400; }
.splash .s-btns { display: flex; flex-direction: column; gap: 12px; width: 180px; }
.splash .s-btns .btn { width: 100%; background: transparent; }
.splash .s-btns .btn.solid { background: var(--ink); }
.splash .s-meta { margin-top: 30px; font-size: 15px; line-height: 1.5; }
.splash .s-meta b { display: block; font-weight: 700; }
.splash .s-back { position: absolute; top: max(14px, env(safe-area-inset-top)); left: 14px; font-size: 14px; font-weight: 600; color: var(--ink); text-decoration: none; }

/* ── toast ── */
.d-toast {
  position: fixed; left: 50%; top: 76px; z-index: 60;
  transform: translate(-50%, -8px); opacity: 0;
  max-width: calc(100vw - 32px); padding: 12px 16px; border-radius: 4px;
  background: var(--ink); color: var(--paper);
  font: 700 14px/1.3 var(--ui); text-align: center;
  transition: opacity 0.18s, transform 0.18s var(--ease);
  pointer-events: none;
}
.d-toast.on { transform: translate(-50%, 0); opacity: 1; }

/* ── modal ── */
.d-modal {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center; padding: 16px;
  background: rgba(255, 255, 255, 0.55);
  opacity: 0; transition: opacity 0.18s;
}
.d-modal.on { opacity: 1; }
.d-sheet {
  position: relative; width: 100%; max-width: 500px; max-height: calc(100dvh - 32px); overflow: auto;
  padding: 32px 28px 28px; border-radius: 8px;
  background: var(--paper); color: var(--ink);
  box-shadow: 0 4px 23px rgba(0, 0, 0, 0.2);
  transform: translateY(12px); transition: transform 0.22s var(--ease);
}
.d-sheet:focus { outline: none; }
.d-modal.on .d-sheet { transform: none; }
.d-x {
  position: absolute; top: 12px; right: 12px; width: 40px; height: 40px;
  border: 0; border-radius: 50%; background: none; color: var(--ink);
  font-size: 28px; font-weight: 300; line-height: 1; cursor: pointer;
}
.d-x:hover { background: var(--wash); }
.d-title { margin: 0 32px 16px 0; font: 700 28px/1.1 var(--slab); }
.d-body { font-size: 16px; line-height: 1.45; }
.d-body p { margin: 0 0 12px; }
.d-body h3 { margin: 20px 0 8px; font: 700 13px var(--ui); letter-spacing: 0.04em; text-transform: uppercase; }
.d-body ul, .d-body ol { margin: 0 0 12px; padding-left: 20px; }
.d-body li { margin-bottom: 6px; }

.d-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 8px 0 20px; text-align: center; }
.d-stats b { display: block; font: 400 34px/1.1 var(--ui); font-variant-numeric: tabular-nums; }
.d-stats span { display: block; font-size: 12px; line-height: 1.25; }

.d-bars { display: grid; gap: 4px; margin: 0 0 20px; }
.d-bars div { display: grid; grid-template-columns: 18px 1fr; gap: 6px; align-items: center; font-size: 14px; font-weight: 700; }
.d-bars i { display: block; min-width: 24px; padding: 2px 8px; background: var(--gray); color: #fff; font: 700 13px/1.3 var(--ui); text-align: right; font-variant-numeric: tabular-nums; }
.d-bars .on i { background: var(--green); }
.d-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.d-btns .btn { width: 100%; height: 52px; }

.d-body .d-big { margin: 0 0 4px; font: 700 40px/1 var(--slab); text-align: center; }
.d-body .d-sub { margin: 0 0 18px; text-align: center; color: var(--muted); }
.d-share { width: 100%; height: 52px; }
.d-body .d-next, .d-next { margin: 18px 0 0; text-align: center; font-size: 14px; color: var(--muted); }
.d-next span { display: block; margin-top: 2px; font: 700 26px var(--ui); color: var(--ink); font-variant-numeric: tabular-nums; }

/* ── below the game: how to play + more games (plain HTML, for readers and search engines) ── */
.seo-about {
  max-width: 500px; margin: 28px auto 0; padding: 22px 16px max(36px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--rule); color: var(--muted); font-size: 14px; line-height: 1.55;
}
.seo-about h2 { margin: 0 0 8px; font: 700 18px/1.2 var(--slab); color: var(--ink); }
.seo-about h3 { margin: 16px 0 8px; font: 700 12px var(--ui); letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink); }
.seo-about p { margin: 0 0 10px; }
.seo-about ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.seo-about ul.more { display: flex; flex-wrap: wrap; gap: 8px; }
.seo-about ul.more a { display: inline-block; padding: 6px 12px; border: 1px solid var(--rule); border-radius: 999px; color: var(--ink); text-decoration: none; font-weight: 600; }
.seo-about ul.more a:hover { border-color: var(--ink); }
.seo-about li > a { color: var(--ink); font-weight: 700; }
.hub + .seo-about, main.hub ~ .seo-about { max-width: 760px; }
.seo-about .faq { margin: 0; }
.seo-about .faq dt { margin: 12px 0 2px; font-weight: 700; color: var(--ink); }
.seo-about .faq dd { margin: 0; }

@media (prefers-reduced-motion: reduce) {
  .splash, .d-toast, .d-modal, .d-sheet { transition: none; }
}
