/* Copyright (c) 2026 Yoda Games. All rights reserved.
   Darts — the reset, the colours and the page frame: navy background, the stage, and the grid that
   places the board and the scoreboard (#game). The whole game fits the viewport (100dvh, no page
   scroll). #app carries classes from js/main.js:
     .mode-wide — the board left, the panel right, as tall as the board: bar, cards stacked, this
                  visit, the helper and the leg's visits (js/ui/layout.js picks the bigger board)
     .mode-tall — a column: bar, cards side by side, board, this visit, the helper
     .narrow    — under 420 px wide (smaller type in the cards)
     .is-fit    — a screen under 440 px high: laid out 440 px high and scaled down whole
   The sizes from js/ui/layout.js arrive as custom properties on #app: --side (the board's side),
   --panel-w, --btn (a bar button), --gap, --col-gap, --card-h, --visit-h, --help-h.
   Also here: the pill buttons (.ctl), the square icon buttons (.hbtn), the toast, .sr-only. */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; border: 0; background: none; cursor: pointer; color: inherit; }
button:disabled { cursor: default; }
ol, ul { list-style: none; }

:root {
  --navy: #0b1521;
  --navy-2: #14273f;
  --panel: #16283f;
  --panel-2: #1b3150;
  --ink: #eef4fb;
  --muted: #a9bccf;
  --gold: #ffd700;
  --gold-2: #ffa500;
  --gold-soft: #ffd166;
  --mint: #7ef0a6;
  --cpu: #7cc8ff;
  --bad: #ff7a72;
  --line-soft: rgba(255, 255, 255, 0.16);
  --chip: rgba(255, 255, 255, 0.07);
  --chip-hover: rgba(255, 255, 255, 0.14);
  --gutter: 12px;
}
#app.narrow { --gutter: 8px; }

html { background: var(--navy); }
html, body { overflow: hidden; }
body { overflow: clip; }
body {
  background: radial-gradient(1000px 640px at 50% -160px, var(--navy-2), var(--navy)) fixed;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.35;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

#app {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: var(--gutter) var(--gutter) calc(var(--gutter) + env(safe-area-inset-bottom, 0px));
  overflow: hidden;
  touch-action: manipulation;
}
#app.is-fit { position: fixed; top: 0; left: 0; transform-origin: 0 0; padding: 8px; }

#stage { flex: 1 1 auto; min-height: 0; min-width: 0; display: flex; align-items: center; justify-content: center; }

/* ── The grid: where the board and the scoreboard go ── */
#game { display: grid; min-width: 0; }
#app.mode-wide #game {
  grid-template-columns: var(--side) var(--panel-w);
  grid-template-rows: var(--btn) auto var(--visit-h) var(--help-h) minmax(0, 1fr);
  grid-template-areas: "arena bar" "arena cards" "arena visit" "arena helper" "arena log";
  column-gap: var(--col-gap);
  row-gap: var(--gap);
  height: var(--side);
}
#app.mode-tall #game {
  grid-template-columns: var(--side);
  grid-template-rows: var(--btn) var(--card-h) var(--side) var(--visit-h) var(--help-h);
  grid-template-areas: "bar" "cards" "arena" "visit" "helper";
  row-gap: var(--gap);
}
#arena { grid-area: arena; }
#bar { grid-area: bar; }
#cards { grid-area: cards; }
#visit { grid-area: visit; }
#helper { grid-area: helper; }
#log { grid-area: log; }
#app.mode-tall #log { display: none; }

/* ── Buttons ── */
.ctl {
  min-height: 44px;
  padding: 0 20px;
  border-radius: 22px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.3px;
  color: var(--ink);
  background: var(--chip);
  border: 1px solid var(--line-soft);
  white-space: nowrap;
  transition: transform 0.1s, background 0.15s;
}
@media (hover: hover) { .ctl:not(:disabled):hover { background: var(--chip-hover); } }
.ctl:not(:disabled):active { transform: scale(0.96); }
.ctl:disabled { opacity: 0.38; }
.ctl--main {
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  color: #2a1a00;
  border: none;
  box-shadow: 0 0 18px rgba(255, 215, 0, 0.25);
}
@media (hover: hover) { .ctl--main:not(:disabled):hover { background: linear-gradient(135deg, #ffe14a, #ffb02e); } }
.hbtn {
  flex: none;
  width: var(--btn, 44px);
  height: var(--btn, 44px);
  border-radius: 12px;
  display: inline-grid;
  place-items: center;
  background: var(--chip);
  border: 1px solid var(--line-soft);
  transition: background 0.15s, transform 0.1s;
}
.hbtn svg { width: 22px; height: 22px; fill: none; stroke: var(--gold-soft); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hbtn svg .fill { fill: var(--gold-soft); stroke: none; }
@media (hover: hover) { .hbtn:hover { background: var(--chip-hover); } }
.hbtn:active { transform: scale(0.95); }
.ctl:focus-visible, .hbtn:focus-visible, .link:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.link { color: var(--gold-soft); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; min-height: 44px; }

/* ── Toast: a short note that moves nothing, over this visit and the helper (never the board) ── */
.toast {
  grid-row: visit-start / helper-end;
  grid-column: visit-start / visit-end;
  align-self: center;
  justify-self: center;
  z-index: 5;
  max-width: 100%;
  padding: 10px 16px;
  border-radius: 14px;
  background: rgba(10, 20, 34, 0.96);
  border: 1px solid rgba(255, 215, 0, 0.45);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  pointer-events: none;
  animation: toast-in 0.2s ease both;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }

.boot-error {
  position: fixed;
  inset: auto 16px 40% 16px;
  z-index: 100;
  padding: 16px;
  border-radius: 14px;
  background: #3a1620;
  border: 1px solid #ff7a72;
  color: #fff;
  font-size: 17px;
  text-align: center;
}
@media (prefers-reduced-motion: reduce) {
  .toast, .ctl, .hbtn { animation: none; transition: none; }
}
