/* Cro Darts 2.0: a late-night darts room in red, white and navy.
   The motif is the šahovnica: the band under the header, the keypad (first field red, as on the
   coat of arms), the dartboard mark and the progress meters are all red and white squares. */
:root {
  --noc: #0a1029;        /* night navy, the page */
  --noc-2: #121a3f;      /* surfaces */
  --noc-3: #1e2a5e;      /* raised, empty meter */
  --line: #2b3972;       /* borders */
  --crvena: #e3202d;     /* šahovnica red */
  --crvena-2: #a8121c;   /* pressed red, arcade shadow */
  --bijela: #f6f5f1;     /* šahovnica white */
  --plava: #2f5bff;      /* double ring */
  --zlatna: #f4b73a;     /* treble ring, the player on the oche */
  --ink: #f6f5f1;
  --muted: #a7b0d6;
  --dim: #7782b5;
  --kocka: 6px;          /* one checker square in the band and meters */
  --head: 58px;
  --band: 12px;
  --gutter: 16px;
  --display: 'Big Shoulders Display', 'Arial Narrow', Impact, sans-serif;
  --body: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --checker: repeating-conic-gradient(var(--bijela) 0 25%, var(--crvena) 0 50%);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  /* a real, always-visible scrollbar on desktop (Windows 11 otherwise hides it until hover) */
  scrollbar-color: #4a5894 var(--noc);
}
html.dragging, html.dragging * { cursor: grabbing; user-select: none; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--noc);
  color: var(--ink);
  font: 16px/1.45 var(--body);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; opacity: .4; }
:focus-visible { outline: 3px solid var(--zlatna); outline-offset: 2px; }
svg { width: 1.25em; height: 1.25em; flex: none; }

/* ---------- header ---------- */
.bar {
  position: sticky; top: 0; z-index: 5;
  height: calc(var(--head) + var(--band) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) var(--gutter) var(--band);
  display: flex; align-items: center; gap: 10px;
  background: var(--noc);
}
.bar::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: var(--band);
  background: var(--checker) 0 0 / calc(var(--kocka) * 2) calc(var(--kocka) * 2);
}
.brand {
  display: flex; align-items: center; gap: 8px; flex: none;
  background: none; border: 0; padding: 0 20px 0 0;
  font: 900 25px/1 var(--display); letter-spacing: .005em; color: var(--bijela); white-space: nowrap;
}
.brand-mark { width: 30px; height: 30px; display: block; }
.brand span { position: relative; }
/* "2.0" is a sticker slapped on the corner of the name */
.brand b {
  position: absolute; right: -21px; top: -9px;
  font-weight: 900; font-size: 12px; padding: 2px 4px 1px; border-radius: 3px;
  background: var(--crvena); color: var(--bijela); transform: rotate(-8deg);
}
.tabs { margin-left: auto; display: flex; gap: 2px; }
.tabs button {
  background: none; border: 0; padding: 8px 10px; border-radius: 999px;
  font-weight: 600; font-size: 15px; color: var(--muted);
}
.tabs button[aria-current='page'] { color: var(--noc); background: var(--bijela); }
.mute {
  width: 42px; height: 42px; display: grid; place-items: center;
  background: var(--noc-2); border: 1px solid var(--line); border-radius: 50%; color: var(--bijela);
}
.mute .cross { display: none; }
.mute[aria-pressed='true'] { color: var(--crvena); border-color: var(--crvena); }
.mute[aria-pressed='true'] .waves { display: none; }
.mute[aria-pressed='true'] .cross { display: inline; }

main { outline: none; }
main > section { max-width: 520px; margin: 0 auto; padding: 20px var(--gutter) calc(28px + env(safe-area-inset-bottom)); }
h1 {
  font: 900 54px/.9 var(--display); letter-spacing: -.005em; margin: 4px 0 18px; color: var(--bijela);
  text-shadow: 3px 3px 0 var(--crvena);
}

/* ---------- shared controls ---------- */
.seg {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px;
  padding: 4px; background: var(--noc-2); border: 1px solid var(--line); border-radius: 14px;
}
.seg button {
  min-height: 44px; border: 0; border-radius: 10px; background: none;
  font-weight: 600; color: var(--muted); padding: 0 6px;
}
.seg button[aria-checked='true'] { background: var(--bijela); color: var(--noc); }
.primary, .secondary {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 56px; border-radius: 14px;
}
.primary {
  background: var(--crvena); color: var(--bijela); border: 0;
  font: 800 26px/1 var(--display); letter-spacing: .02em;
  box-shadow: 0 5px 0 var(--crvena-2);
  transition: transform .08s ease-out, box-shadow .08s ease-out;
}
.primary:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--crvena-2); }
.secondary { background: none; color: var(--ink); border: 2px solid var(--line); font-weight: 600; font-size: 17px; }
.link { background: none; border: 0; padding: 6px 0; color: var(--zlatna); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.icon {
  width: 44px; height: 44px; display: grid; place-items: center;
  background: var(--noc-3); border: 0; border-radius: 12px; color: var(--bijela);
}
.icon.ghost { background: none; color: var(--muted); }
input, select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px;
  background: var(--noc-2); border: 1.5px solid var(--line); border-radius: 12px;
}
textarea { resize: vertical; line-height: 1.4; }
input::placeholder, textarea::placeholder { color: var(--dim); }
input:focus, select:focus, textarea:focus { border-color: var(--zlatna); outline: none; }

/* ---------- setup ---------- */
.players { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 10px; }
.player-row {
  display: grid; grid-template-columns: 44px 1fr 44px 36px; gap: 8px; align-items: start;
  padding: 10px; background: var(--noc-2); border: 1px solid var(--line); border-radius: 16px;
}
/* seat numbers as squares of the šahovnica: 1 red, 2 white, 3 red... */
.player-row .seat {
  width: 44px; height: 46px; display: grid; place-items: center; border-radius: 8px;
  font: 900 30px/1 var(--display); background: var(--crvena); color: var(--bijela);
}
.player-row:nth-child(even) .seat { background: var(--bijela); color: var(--crvena); }
.player-row .fields { display: grid; gap: 6px; }
.player-row input { background: var(--noc); }
.player-row input[data-field='name'] { font-weight: 700; font-size: 18px; }
.player-row input[data-field='say'] { min-height: 38px; font-size: 14px; padding: 6px 10px; }
.player-row .icon.ghost { width: 36px; }
.add { width: 100%; min-height: 46px; background: none; border: 2px dashed var(--line); border-radius: 14px; color: var(--muted); font-weight: 600; }
.opts { display: grid; gap: 14px; margin: 22px 0 18px; }
.opt > span { display: block; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.voice-line { margin: 0 0 20px; color: var(--muted); }
.voice-line b { color: var(--ink); }
.setup .primary { margin-bottom: 14px; }

/* ---------- game ---------- */
main > section.game {
  display: flex; flex-direction: column; gap: 10px;
  min-height: calc(100dvh - var(--head) - var(--band) - env(safe-area-inset-top));
  padding-top: 10px; padding-bottom: calc(10px + env(safe-area-inset-bottom));
}
.roster {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(min(var(--n), 4), 1fr); gap: 6px;
}
.roster li {
  display: grid; grid-template-columns: 1fr auto; align-items: baseline; column-gap: 6px;
  padding: 7px 9px 8px; border-radius: 12px; background: var(--noc-2); border: 1px solid var(--line);
  min-width: 0;
}
.roster .nm { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.roster .rm { font: 900 30px/.95 var(--display); grid-row: span 2; color: var(--bijela); font-variant-numeric: tabular-nums; }
.roster .av { font-size: 12px; color: var(--dim); }
/* how far from zero, as a strip of kockice */
.meter { grid-column: 1 / -1; height: var(--kocka); margin-top: 6px; background: var(--noc-3); border-radius: 2px; overflow: hidden; }
.meter i { display: block; height: 100%; width: calc(var(--p) * 100%); background: var(--checker) 0 0 / var(--kocka) var(--kocka); }
.roster .active { background: var(--bijela); border-color: var(--bijela); }
.roster .active .nm { color: var(--noc); }
.roster .active .rm { color: var(--crvena); }
.roster .active .av { color: #4b568c; }
.roster .active .meter { background: #d9dbe6; }

.hero { text-align: center; padding: 2px 0 0; }
.who { margin: 0; font: 800 24px/1.1 var(--display); color: var(--zlatna); letter-spacing: .01em; }
.who span { font: 500 15px var(--body); color: var(--muted); margin-left: 6px; letter-spacing: 0; }
.left {
  margin: 2px 0 0; font: 900 clamp(84px, 30vw, 128px)/.92 var(--display); color: var(--bijela);
  font-variant-numeric: tabular-nums; letter-spacing: .005em;
  text-shadow: 4px 4px 0 var(--crvena);
}
.slots { display: flex; justify-content: center; gap: 8px; margin-top: 8px; }
.slot {
  width: 64px; height: 32px; display: grid; place-items: center;
  border-radius: 8px; border: 2px dashed var(--line);
  font: 800 19px/1 var(--display); color: var(--bijela); letter-spacing: .02em;
}
.slot.hit { border: 0; background: var(--bijela); color: var(--noc); }
.route { margin: 6px 0 0; min-height: 24px; font: 700 20px/24px var(--display); color: var(--zlatna); letter-spacing: .03em; }

.caller {
  display: flex; align-items: center; gap: 10px; text-align: left;
  width: 100%; min-height: 56px; padding: 9px 12px 9px 9px;
  background: var(--bijela); color: var(--noc); border: 0; border-radius: 4px 16px 16px 16px;
  font-weight: 600; font-size: 16px; line-height: 1.3;
}
.caller .mic {
  width: 34px; height: 34px; flex: none; display: grid; place-items: center;
  border-radius: 50%; background: var(--crvena); color: var(--bijela);
}
.caller .mic svg { width: 18px; height: 18px; }

.mult { flex: none; }
.game[data-mult='2'] .mult button[aria-checked='true'] { background: var(--plava); color: var(--bijela); }
.game[data-mult='3'] .mult button[aria-checked='true'] { background: var(--zlatna); color: var(--noc); }

.pad {
  flex: 1; display: grid; grid-template-columns: repeat(5, 1fr);
  grid-auto-rows: minmax(48px, 1fr); gap: 6px;
}
.pad-row { display: grid; grid-template-columns: 1fr 1fr 1.4fr 1.2fr; gap: 6px; }
.key {
  min-height: 48px; border: 0; border-radius: 10px;
  font: 800 27px/1 var(--display); letter-spacing: .01em;
  transition: transform .06s ease-out, filter .06s;
}
.key:active { transform: scale(.94); filter: brightness(1.12); }
/* single: the keypad is the šahovnica, first field red (5 columns, so odd children alternate per row too) */
.game[data-mult='1'] .pad .key:nth-child(odd) { background: var(--crvena); color: var(--bijela); }
.game[data-mult='1'] .pad .key:nth-child(even) { background: var(--bijela); color: var(--crvena); }
/* double and treble: the whole pad changes colour, so the ring in play is impossible to miss */
.game[data-mult='2'] .pad .key { background: var(--plava); color: var(--bijela); box-shadow: inset 0 0 0 3px rgba(246, 245, 241, .28); }
.game[data-mult='3'] .pad .key { background: var(--zlatna); color: var(--noc); box-shadow: inset 0 0 0 3px rgba(10, 16, 41, .22); }
.game[data-mult='2'] .pad .key, .game[data-mult='3'] .pad .key { font-size: 24px; }
.bull-o { background: var(--noc-3); color: var(--bijela); box-shadow: inset 0 0 0 3px var(--crvena); }
.bull-i { background: var(--crvena); color: var(--bijela); }
.key.miss { background: var(--noc-2); color: var(--muted); font: 600 17px/1 var(--body); box-shadow: inset 0 0 0 1px var(--line); }
.key.undo { background: none; color: var(--zlatna); box-shadow: inset 0 0 0 2px var(--zlatna); font: 600 17px/1 var(--body); }

/* ---------- win ---------- */
.won .winner { display: grid; gap: 14px; text-align: center; padding-top: 8px; }
.zastava { display: grid; grid-template-columns: repeat(10, 1fr); width: min(100%, 300px); margin: 0 auto; }
.zastava i { aspect-ratio: 1; background: var(--bijela); animation: kocka .38s cubic-bezier(.2, .9, .3, 1.25) both; animation-delay: calc(var(--d) * 28ms); }
.zastava i:nth-child(-n+10):nth-child(odd), .zastava i:nth-child(n+11):nth-child(even) { background: var(--crvena); }
@keyframes kocka { from { transform: scale(0) rotate(-90deg); } }
.kicker { margin: 0; font: 800 22px/1 var(--display); color: var(--zlatna); letter-spacing: .02em; }
.won h1 { font-size: clamp(64px, 20vw, 108px); margin: 0; text-shadow: 5px 5px 0 var(--crvena); overflow-wrap: anywhere; }
.stats { width: 100%; border-collapse: collapse; font-size: 15px; }
.stats th { text-align: left; font-weight: 600; color: var(--muted); padding: 6px 4px; border-bottom: 1px solid var(--line); }
.stats td { text-align: left; padding: 8px 4px; border-bottom: 1px solid var(--noc-3); font-variant-numeric: tabular-nums; }

/* ---------- voice lab ---------- */
.lab .lede { margin: -6px 0 6px; color: var(--muted); max-width: 60ch; }
.using { margin: 0 0 14px; }
.using b { color: var(--zlatna); }
/* where the voice comes from: phone and our OpenRouter account up top, own keys below */
.pick { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.pick button {
  grid-column: span 2; min-height: 48px; padding: 8px 6px; border-radius: 12px;
  background: var(--noc-2); border: 1px solid var(--line); color: var(--muted);
  display: grid; align-content: center; gap: 2px; text-align: center; font-weight: 600; font-size: 15px; line-height: 1.15;
}
.pick button.big { grid-column: span 3; min-height: 64px; }
.pick button small { font-weight: 500; font-size: 12px; color: var(--dim); }
.pick button[aria-checked='true'] { background: var(--bijela); border-color: var(--bijela); color: var(--noc); }
.pick button[aria-checked='true'] small { color: #4b568c; }
.pick .sub { grid-column: 1 / -1; margin: 8px 0 0; font-size: 13px; color: var(--dim); }
.panel { display: grid; gap: 12px; padding: 16px 0 6px; }
.note { margin: 0; color: var(--muted); font-size: 15px; }
.warn { margin: 0; padding: 10px 12px; border-left: 3px solid var(--zlatna); background: var(--noc-2); font-size: 14px; border-radius: 0 10px 10px 0; }
.state { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 600; font-size: 15px; }
.state::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--dim); flex: none; }
.state.on::before { background: #39d98a; box-shadow: 0 0 0 4px rgba(57, 217, 138, .18); }
.state.off::before { background: var(--zlatna); }
.field { display: grid; gap: 6px; }
.field > span { font-weight: 600; color: var(--muted); display: flex; justify-content: space-between; gap: 10px; }
.field small { font-weight: 500; color: var(--dim); }
.field a { color: var(--zlatna); font-weight: 500; }
.check { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--muted); }
.check input { width: 22px; min-height: 22px; accent-color: var(--zlatna); }
.range { display: grid; gap: 2px; }
.range > span { display: flex; justify-content: space-between; font-weight: 600; color: var(--muted); font-size: 15px; }
.range output { color: var(--ink); font-variant-numeric: tabular-nums; }
.range input { min-height: 36px; padding: 0; background: none; border: 0; accent-color: var(--crvena); }
/* what it costs: one sentence, one game, a replay */
.cost { margin: 0; padding: 12px 14px; display: grid; gap: 8px; background: var(--noc-2); border: 1px solid var(--line); border-radius: 14px; }
.cost div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.cost dt { color: var(--muted); font-size: 15px; }
.cost dd { margin: 0; font: 800 22px/1 var(--display); color: var(--bijela); letter-spacing: .02em; white-space: nowrap; }
.cost dd.free { color: #39d98a; }
.approve { display: grid; gap: 8px; }
.approve > p { margin: 0; font-size: 15px; color: var(--muted); }
.approve > p b { color: var(--ink); }
.audition, .rate { display: grid; gap: 10px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.audition label { font-weight: 600; color: var(--muted); }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.actions .primary { font-size: 22px; }
.actions .secondary { font-size: 16px; }
.rate p { margin: 0; }
.stars { display: flex; gap: 4px; }
.stars button { width: 46px; height: 46px; display: grid; place-items: center; background: none; border: 0; color: var(--noc-3); }
.stars button svg { width: 30px; height: 30px; }
.stars button.on { color: var(--zlatna); }
.ratings { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 6px; }
.ratings li { display: grid; grid-template-columns: auto 1fr auto; gap: 2px 10px; align-items: center; padding: 8px 4px 8px 12px; background: var(--noc-2); border-radius: 12px; }
.ratings .st { color: var(--zlatna); letter-spacing: 1px; }
.ratings .rv { font-weight: 600; }
.ratings .rn { grid-column: 1 / 3; color: var(--muted); font-size: 14px; }
.ratings .icon { grid-row: 1 / span 2; grid-column: 3; }
.plan { margin-top: 22px; padding: 12px 14px; background: var(--noc-2); border: 1px solid var(--line); border-radius: 16px; }
.plan summary { font-weight: 700; cursor: pointer; }
.plan ol { margin: 10px 0 0; padding-left: 20px; display: grid; gap: 8px; color: var(--muted); }

/* ---------- toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 10;
  transform: translate(-50%, 140%); width: max-content; max-width: min(calc(100% - 32px), 480px);
  padding: 12px 16px; border-radius: 14px; background: var(--bijela); color: var(--noc); font-weight: 600;
  border-left: 6px solid var(--crvena);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5); transition: transform .2s ease-out, visibility .2s; pointer-events: none; visibility: hidden;
}
#toast.on { transform: translate(-50%, 0); visibility: visible; }

@media (max-width: 374px) {
  .bar { gap: 6px; }
  .brand { font-size: 21px; padding-right: 18px; }
  .brand-mark { width: 26px; height: 26px; }
  .tabs button { padding: 8px 8px; }
  .mute { width: 38px; height: 38px; }
}
@media (min-width: 560px) {
  .roster .nm { font-size: 14px; }
}
@media (max-height: 640px) {
  .left { font-size: 70px; }
  .roster .rm { font-size: 26px; }
  .pad { grid-auto-rows: minmax(42px, 1fr); }
  .key { min-height: 42px; }
}
/* desktop / laptop windows: the whole game, bottom key row included, fits without scrolling */
@media (min-width: 560px) and (max-height: 860px) {
  :root { --head: 52px; }
  .left { font-size: 80px; }
  .roster .rm { font-size: 26px; }
  .meter { margin-top: 4px; }
}
@media (min-width: 560px) and (max-height: 720px) {
  :root { --head: 48px; --band: 10px; --kocka: 5px; }
  main > section.game { gap: 6px; padding-top: 6px; }
  .who { font-size: 20px; }
  .left { font-size: 50px; text-shadow: 3px 3px 0 var(--crvena); }
  .slot { height: 28px; }
  .roster li { padding: 5px 9px 6px; }
  .roster .rm { font-size: 24px; }
  .meter { margin-top: 4px; }
  .slots { margin-top: 2px; }
  .route { margin-top: 2px; }
  .caller { min-height: 0; padding: 6px 12px 6px 7px; }
  .caller .mic { width: 28px; height: 28px; }
  .seg button { min-height: 36px; }
  .pad { grid-auto-rows: minmax(38px, 1fr); gap: 5px; }
  .pad-row { gap: 5px; }
  .key { min-height: 38px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
.noscript { padding: 24px; }
