/* The look every game page shares: the top bar, buttons, dialogs, the results stats and week
   strip, the countdown, the banner, the toast and the screen-reader text. Linked before the game's
   own css/style.css, which sets the tokens these use and everything that is the game's own:

     --bg, --panel (translucent), --panel-solid, --line, --ink, --muted
     --accent, --accent-deep, --accent-ink     the game's colour, and the text on it
     --display, --text                         the heading and body fonts
     --display-weight                          the weight its display font has (default 700;
                                               400 for one-weight fonts like Lilita One)
     --heading                                 dialog headings' colour, if the accent is too
                                               light for text (default --accent-deep, dark --accent)

   A game's own rule for the same selector, later in the cascade, still wins: keep those for what
   is truly the game's (its kicker colour, a toast that must sit above its board). Echo, Flyby and
   Pokédaily don't load this file. When changing a rule, check every game that links it, light and
   dark, at phone and desktop width. */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
button, a { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { display: block; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Top bar: the side groups of icon buttons either side of the title, and the sound toggle. */
.top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.top-side { display: flex; gap: 6px; }
.top-side.end { justify-content: flex-end; }
.title { text-align: center; }
.icon-btn {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  font: var(--display-weight, 700) 1.15rem/1 var(--display);
  text-decoration: none;
  transition: transform 0.12s ease, background 0.12s ease;
}
.icon-btn:hover { background: var(--panel-solid); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
#btnSound .ico-off { display: none; }
#btnSound.muted .ico-on { display: none; }
#btnSound.muted .ico-off { display: block; }

/* The banner over the board: archive replays, practice, a new day ready. */
.banner { padding: 10px 14px; border-radius: 14px; background: var(--panel-solid); border: 1px solid var(--line); text-align: center; font-size: 0.92rem; }
.banner[hidden] { display: none; }
.banner a { color: var(--accent-deep); font-weight: 800; }

/* Buttons */
.btn {
  appearance: none;
  border: 1.5px solid transparent;
  border-radius: 14px;
  padding: 11px 14px;
  font-family: inherit;
  font-weight: 800;
  font-size: 0.95rem;
  line-height: 1.1;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  text-decoration: none;
  transition: transform 0.12s, background 0.12s, filter 0.12s;
}
.btn:not(.small) { min-height: 44px; }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn[hidden] { display: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 3px 0 var(--accent-deep); }
.btn.primary:not(:disabled):active { transform: translateY(3px); box-shadow: 0 0 0 var(--accent-deep); }
.btn.ghost { background: var(--panel); border-color: var(--line); }
.btn.ghost:not(:disabled):hover { background: var(--panel-solid); }
.btn.ghost:not(:disabled):active { transform: scale(0.97); }
.btn.small { padding: 8px 12px; font-size: 0.85rem; border-radius: 11px; }
.btn.wide { width: 100%; }

/* Dialogs, and the help inside them */
.dialog {
  width: min(440px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 22px 20px 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel-solid);
  color: var(--ink);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.5);
  overflow: auto;
}
.dialog::backdrop { background: rgba(12, 14, 24, 0.45); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.dialog[open] { animation: dailys-pop 0.25s cubic-bezier(0.2, 1.3, 0.4, 1); }
@keyframes dailys-pop { from { opacity: 0; transform: scale(0.95); } }
.dialog h2 { margin: 0 0 8px; padding-right: 30px; font: var(--display-weight, 700) 1.7rem/1.1 var(--display); color: var(--heading, var(--accent-deep)); }
.dialog h2:focus { outline: none; }
@media (prefers-color-scheme: dark) { .dialog h2 { color: var(--heading, var(--accent)); } }
.close {
  float: right;
  margin: -8px -6px 0 0;
  width: 36px; height: 36px;
  border: 0; border-radius: 10px;
  background: transparent;
  font-size: 26px; line-height: 1;
  color: var(--muted);
}
.close:hover { background: var(--line); }
.lede { margin: 0 0 10px; }
.how-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.rule-note { margin: 0; font-size: 14px; }
kbd {
  display: inline-block;
  min-width: 22px;
  padding: 1px 6px;
  margin: 0 1px;
  border-radius: 6px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  background: var(--panel);
  font: 700 0.75rem/1.5 var(--text);
  text-align: center;
  color: var(--ink);
}

/* The day's-done card */
.cd-kicker { margin: 0; font: 400 22px/1.1 var(--display); color: var(--accent-deep); }
.cd-time { margin: 6px 0 0; font: 400 46px/1 var(--display); font-variant-numeric: tabular-nums; }
.cd-line { margin: 6px 0 0; color: var(--muted); font-weight: 600; font-size: 14px; }
.cd-btns { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }

/* Results: kicker, stats grid and week strip (hub/results.js builds them), actions, countdown */
.kicker { margin: 0 0 4px; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px; border-radius: 14px; background: var(--line); text-align: center; }
.stat b { font: var(--display-weight, 700) 1.4rem/1.1 var(--display); font-variant-numeric: tabular-nums; }
.stat small { font-size: 0.68rem; color: var(--ink); opacity: 0.75; line-height: 1.2; } /* --muted is too faint on the tinted cell */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 12px; }
.wd { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 0.7rem; font-weight: 800; color: var(--muted); }
.wd i { display: grid; place-items: center; width: 100%; height: 32px; border-radius: 10px; background: var(--line); font: 600 0.78rem/1 var(--text); font-style: normal; color: var(--ink); font-variant-numeric: tabular-nums; }
.progress-note { margin: 4px 0 0; }
.res-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.res-actions .btn { flex: 1 1 140px; }
.global { margin-top: 14px; }
.global:empty { display: none; }
.countdown { margin: 16px 0 0; text-align: center; color: var(--muted); font-size: 0.9rem; }
.countdown b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* Toast (hub/ui.js) */
.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 700;
  font-size: 0.92rem;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 10;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* Reduced motion, from the device or the site-wide setting (hub/prefs.js) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
