/* The shared chrome (top bar, buttons, dialogs, stats grid, week strip, toast) is in
   hub/game.css, linked before this file. This sets the tokens it uses and the game's own look:
   chunky letter tiles on warm paper. */
:root {
  color-scheme: light dark;
  --bg: #f6f1ea;
  --bg-2: #ece4d8;
  --panel: rgba(255, 252, 247, 0.8);
  --panel-solid: #fffcf7;
  --ink: #2a211c;
  --muted: #6d625a;
  --line: rgba(42, 33, 28, 0.14);
  --accent: #f0654d; /* dark button text on it is 6.6:1 */
  --accent-deep: #b93a25;
  --accent-ink: #2b0b05;
  --heading: #a8331f;
  /* the marks: right place, elsewhere, not in the word. White text on each is 4.5:1 or more. */
  --right: #26804c;
  --else: #966600;
  --none: #756d66;
  --mark-ink: #ffffff;
  --key: #e3dacd;
  --shadow: rgba(90, 50, 30, 0.18);
  --display: Rubik, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display-weight: 800; /* the weight hub/game.css gives display text */
  --text: Rubik, system-ui, -apple-system, 'Segoe UI', sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16130f;
    --bg-2: #1d1914;
    --panel: rgba(44, 38, 31, 0.75);
    --panel-solid: #272119;
    --ink: #f3ece2;
    --muted: #a99d90;
    --line: rgba(243, 236, 226, 0.14);
    --accent: #ff8a73;
    --accent-deep: #e0654d;
    --accent-ink: #2b0b05;
    --heading: #ff8a73;
    --right: #26804c;
    --else: #966600;
    --none: #4d463f;
    --key: #5b534a;
    --shadow: rgba(0, 0, 0, 0.45);
  }
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--ink);
  font: 500 16px/1.4 var(--text);
  -webkit-font-smoothing: antialiased;
  background: linear-gradient(180deg, var(--bg), var(--bg-2)) fixed;
}
button { -webkit-tap-highlight-color: transparent; }

.app {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: max(10px, env(safe-area-inset-top)) 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ---------------------------------------------------------------- header */
.top { padding: 0 6px; }
.logo { margin: 0; font: 800 2.1rem/1 var(--display); letter-spacing: -0.01em; color: var(--heading); }
.day { margin: 4px 0 0; font-size: 0.78rem; color: var(--muted); }

/* ---------------------------------------------------------------- board */
.play { display: flex; flex-direction: column; gap: 12px; }
.board { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.rows { --tile: min(62px, (100vw - 20px - 4 * 6px) / 5, (100dvh - 392px) / 6); display: grid; gap: 6px; }
.row { display: grid; grid-template-columns: repeat(5, var(--tile)); gap: 6px; }
.tile {
  height: var(--tile);
  min-height: 34px;
  display: grid;
  place-items: center;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--panel-solid);
  font: 800 calc(var(--tile) * 0.52) / 1 var(--display);
  text-transform: uppercase;
}
.tile.typed { border-color: var(--muted); animation: typed 0.1s ease-out; }
@keyframes typed { from { transform: scale(0.88); } }
.tile.pending { border-color: var(--muted); }
.tile.g, .tile.y, .tile.n { border-color: transparent; color: var(--mark-ink); }
.tile.g { background: var(--right); }
.tile.y { background: var(--else); }
.tile.n { background: var(--none); }
.tile.flip { animation: flip 0.38s ease-out; }
@keyframes flip { from { transform: rotateX(90deg); } }
.row.shake { animation: shake 0.3s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.row.bounce .tile { animation: bounce 0.5s ease both; }
.row.bounce .tile:nth-child(2) { animation-delay: 70ms; }
.row.bounce .tile:nth-child(3) { animation-delay: 140ms; }
.row.bounce .tile:nth-child(4) { animation-delay: 210ms; }
.row.bounce .tile:nth-child(5) { animation-delay: 280ms; }
@keyframes bounce { 40% { transform: translateY(-22%); } 70% { transform: translateY(4%); } }
.answer { margin: 0; color: var(--muted); }
.answer b { color: var(--ink); font-weight: 800; letter-spacing: 0.08em; }
.answer[hidden] { display: none; }

/* ---------------------------------------------------------------- keyboard */
.keys { display: flex; flex-direction: column; gap: 6px; touch-action: manipulation; }
.krow { display: flex; justify-content: center; gap: 5px; }
.key {
  flex: 1 1 0;
  max-width: 44px;
  min-width: 0;
  height: 54px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: var(--key);
  color: var(--ink);
  font: 700 1.05rem/1 var(--text);
  transition: transform 0.08s, background 0.2s;
  user-select: none;
  -webkit-user-select: none;
}
.key.wide { flex: 1.6 1 0; max-width: 70px; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.02em; }
.key svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.key:not(:disabled):active { transform: scale(0.93); }
.key.g, .key.y, .key.n { color: var(--mark-ink); }
.key.g { background: var(--right); }
.key.y { background: var(--else); }
.key.n { background: var(--none); }
.key:disabled { cursor: default; }

/* ---------------------------------------------------------------- dialogs and results */
.help-marks { display: grid; gap: 8px; margin: 12px 0; }
.help-marks p { margin: 0; display: flex; align-items: center; gap: 12px; }
.tile.demo { flex: none; width: 40px; height: 40px; min-height: 0; font-size: 1.3rem; border-radius: 9px; }
.rule-note { margin: 0 0 10px; line-height: 1.45; font-size: 0.92rem; }
.btn.wide { margin-top: 8px; }
.kicker { color: var(--muted); }
.res-line { margin: 0 0 10px; font-size: 1.05rem; }
.res-word { font-weight: 800; letter-spacing: 0.08em; }
.res-grid { margin: 0 0 14px; font-size: 1.25rem; line-height: 1.15; letter-spacing: 0.06em; text-align: center; }
.wd.today i { outline: 2px dashed var(--accent); outline-offset: -2px; }
.wd.won i { background: var(--right); color: var(--mark-ink); }
.wd.lost i { color: var(--accent-deep); }
.countdown a { color: inherit; font-weight: 700; }

.toast { z-index: 10; top: 96px; bottom: auto; transform: translate(-50%, -12px); }
.toast.show { transform: translate(-50%, 0); }

@media (max-width: 380px) {
  .krow { gap: 4px; }
  .key { height: 50px; font-size: 1rem; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
/* Short screens: smaller keys leave the tiles more room. */
@media (max-height: 640px) {
  .rows { --tile: min(62px, (100vw - 20px - 4 * 6px) / 5, (100dvh - 330px) / 6); gap: 5px; }
  .row { gap: 5px; }
  .key { height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-delay: 0ms !important; }
}
/* the same for the site-wide Reduce motion setting (hub/prefs.js) */
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after { animation-delay: 0ms !important; }
