/* 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 Dozen's own board. */
:root {
  color-scheme: light dark;
  --bg: #f4f6ef;
  --bg-2: #e7ecdf;
  --panel: rgba(255, 255, 255, 0.8);
  --panel-solid: #ffffff;
  --ink: #1b2417;
  --muted: #566150;
  --line: rgba(27, 36, 23, 0.13);
  --accent: #2f7d4f; /* white text on it is 5.2:1 */
  --accent-deep: #22603b;
  --accent-ink: #ffffff;
  --made: #2f7d4f;
  --made-ink: #ffffff;
  --shown: #d9ddd3;
  --shown-ink: #4a5444;
  --good: #2f7d4f;
  --bad: #c2412f;
  --shadow: rgba(40, 70, 30, 0.16);
  --display: Fredoka, 'Arial Rounded MT Bold', system-ui, sans-serif;
  --text: Nunito, system-ui, -apple-system, 'Segoe UI', sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12160f;
    --bg-2: #181e14;
    --panel: rgba(38, 46, 33, 0.74);
    --panel-solid: #232b1f;
    --ink: #ebf1e4;
    --muted: #aab5a0;
    --line: rgba(235, 241, 228, 0.13);
    --accent: #7fd39c;
    --accent-deep: #5cbf7d;
    --accent-ink: #0d2416;
    --made: #4fae72;
    --made-ink: #0b1d11;
    --shown: #3a4234;
    --shown-ink: #c3ccba;
    --good: #7fd39c;
    --bad: #ff8a78;
    --shadow: rgba(0, 0, 0, 0.42);
  }
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--ink);
  font: 600 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)) 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---------------------------------------------------------------- header */
.logo { margin: 0; font: 700 2.1rem/1 var(--display); color: var(--accent-deep); }
@media (prefers-color-scheme: dark) { .logo { color: var(--accent); } }
.day { margin: 4px 0 0; font-size: 0.78rem; color: var(--muted); }

/* ---------------------------------------------------------------- the twelve targets */
.play { display: flex; flex-direction: column; gap: 10px; }
.meta { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.85rem; color: var(--muted); padding: 0 4px; }
.clock { font: 600 1rem/1 var(--display); font-variant-numeric: tabular-nums; color: var(--ink); }
.targets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.target {
  position: relative;
  min-height: 62px;
  padding: 6px 4px 5px;
  border: 1.5px dashed var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: background 0.2s, color 0.2s;
}
.target b { font: 600 1.55rem/1 var(--display); font-variant-numeric: tabular-nums; }
.target small { font-size: 0.66rem; font-weight: 700; line-height: 1.1; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: 0.9; }
.target.made { border: 1.5px solid transparent; background: var(--made); color: var(--made-ink); }
.target.shown { border: 1.5px solid transparent; background: var(--shown); color: var(--shown-ink); }
.target.pop { animation: pop-in 0.35s cubic-bezier(0.3, 1.6, 0.5, 1); }
@keyframes pop-in { from { transform: scale(0.7); } }

/* ---------------------------------------------------------------- building a sum */
.maker { padding: 14px 12px 12px; border-radius: 22px; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 14px 40px -24px var(--shadow); text-align: center; }
.expr { margin: 0; min-height: 1.3em; font: 600 1.9rem/1.3 var(--display); letter-spacing: 0.04em; word-break: break-all; }
.expr.empty { opacity: 0; }
.value { margin: 0 0 12px; min-height: 1.4em; font-size: 1rem; color: var(--muted); }
.value.bad { color: var(--bad); }
.value.hint { font-size: 0.88rem; }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 10px; }
.tile {
  height: 64px;
  border: 0;
  border-radius: 16px;
  background: var(--accent);
  color: var(--accent-ink);
  font: 600 2rem/1 var(--display);
  box-shadow: 0 4px 0 var(--accent-deep);
  transition: transform 0.08s, opacity 0.15s, box-shadow 0.08s;
}
.tile:not(:disabled):active { transform: translateY(3px); box-shadow: 0 1px 0 var(--accent-deep); }
.tile.used { opacity: 0.25; box-shadow: none; transform: translateY(3px); }
@media (prefers-color-scheme: dark) { .tile { box-shadow: 0 4px 0 #2e6b44; } }
.ops { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.op {
  height: 50px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--panel-solid);
  color: var(--ink);
  font: 600 1.4rem/1 var(--display);
}
.op:not(:disabled):active { transform: scale(0.94); }
.op svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vertical-align: middle; }
.acts { display: flex; justify-content: center; gap: 8px; margin-top: 10px; }
.acts .btn { min-width: 0; }
.foot { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------------------------------------------------------------- help */
.how { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 10px; text-align: left; }
.how li { font-size: 0.92rem; }
.how-ex { display: block; font: 600 1.05rem/1.3 var(--display); color: var(--accent-deep); }
@media (prefers-color-scheme: dark) { .how-ex { color: var(--accent); } }
.btn.wide { margin-top: 16px; }

/* ---------------------------------------------------------------- results */
.kicker { color: var(--muted); }
.res-line { margin: 0 0 12px; font-size: 1.05rem; }
.res-made { list-style: none; margin: 0 0 10px; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 12px; text-align: left; }
.res-made li { display: flex; gap: 8px; align-items: baseline; font-size: 0.86rem; font-variant-numeric: tabular-nums; }
.res-made b { min-width: 1.6em; text-align: right; font: 600 1rem/1 var(--display); color: var(--good); }
.res-made li.shown b, .res-made li.shown span { color: var(--muted); }
.res-note { margin: 0 0 10px; font-size: 0.9rem; color: var(--muted); }
.wd.today i { outline: 2px dashed var(--accent); outline-offset: -2px; }
.wd.full i { background: var(--made); color: var(--made-ink); }
.wd.done i { background: var(--shown); color: var(--shown-ink); }

.toast { z-index: 10; }

@media (max-width: 380px) {
  .app { padding-left: 12px; padding-right: 12px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .target { min-height: 56px; }
  .target small { font-size: 0.6rem; }
  .ops { gap: 4px; }
  .op { height: 46px; font-size: 1.25rem; }
}
