/* Javelin - one page, no framework.  Dark stadium chrome over a full-bleed canvas. */
:root {
  --ink: #eef4f8;
  --dim: #9fb3c2;
  --bg: #0c1620;
  --panel: rgba(12, 22, 32, 0.86);
  --edge: rgba(150, 190, 220, 0.22);
  --accent: #f5c33b;
  --good: #6fd08c;
  --bad: #e8615a;
  --runway: #b1543a;
}
* { box-sizing: border-box; }
/* [hidden] must win over .modal's display:flex, or the Rules panel covers the game on load. */
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink);
  font: 15px/1.5 "Helvetica Neue", Helvetica, Arial, sans-serif; overflow: hidden; }
#wrap { position: relative; width: 100vw; height: 100dvh; }
#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

#topbar { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center;
  gap: 12px; padding: 10px 14px; background: linear-gradient(180deg, rgba(6,12,18,.82), rgba(6,12,18,0));
  pointer-events: none; flex-wrap: wrap; }
#topbar h1 { margin: 0; font-size: 20px; letter-spacing: .10em; text-transform: uppercase;
  font-weight: 700; }
#topbar .chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { font-size: 12px; padding: 3px 9px; border: 1px solid var(--edge); border-radius: 999px;
  color: var(--dim); background: rgba(10, 20, 30, .55); white-space: nowrap; }
#topbar nav { margin-left: auto; display: flex; gap: 8px; pointer-events: auto; flex-wrap: wrap; }

button { font: inherit; font-size: 13px; color: var(--ink); background: rgba(22, 38, 52, .92);
  border: 1px solid var(--edge); border-radius: 7px; padding: 6px 11px; cursor: pointer; }
button:hover { background: rgba(34, 56, 76, .95); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button[disabled] { opacity: .45; cursor: default; }
kbd { font: 12px/1 ui-monospace, Menlo, Consolas, monospace; border: 1px solid var(--edge);
  border-bottom-width: 2px; border-radius: 4px; padding: 2px 5px; background: rgba(0,0,0,.3); }

#controls, #board, #readout { position: absolute; background: var(--panel); border: 1px solid var(--edge);
  border-radius: 11px; padding: 12px 14px; backdrop-filter: blur(6px); }
#controls { left: 14px; top: 62px; width: 268px; }
#controls h2, #board h2, #readout h2 { margin: 0 0 8px; font-size: 12px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--dim); font-weight: 700; }
#controls label { display: flex; justify-content: space-between; align-items: baseline;
  font-size: 13px; margin-top: 9px; gap: 6px; }
#controls label .hint { flex: 1 1 100%; font-size: 11px; color: var(--dim); }
#controls output { font-variant-numeric: tabular-nums; color: var(--accent); font-weight: 700; }
input[type=range] { width: 100%; margin: 3px 0 0; accent-color: var(--accent); }

.release { margin-top: 14px; }
.release .bar { position: relative; height: 16px; border: 1px solid var(--edge); border-radius: 8px;
  background: rgba(0,0,0,.35); overflow: hidden; }
#releaseFill { position: absolute; left: 0; top: 0; bottom: 0; width: 0%;
  background: linear-gradient(90deg, #3d6b8e, var(--runway)); }
#releaseIdeal { position: absolute; top: 0; bottom: 0; width: 3px; background: var(--good);
  left: 62%; }
#releaseMsg { margin: 7px 0; font-size: 12px; color: var(--dim); }
#btnThrow { width: 100%; margin-top: 2px; font-weight: 700; }

.message { margin: 10px 0 0; font-size: 13px; padding: 7px 9px; border-radius: 7px;
  border: 1px solid var(--edge); }
.message.good { color: var(--good); border-color: rgba(111,208,140,.5); }
.message.bad { color: var(--bad); border-color: rgba(232,97,90,.5); }

#board { left: 14px; bottom: 14px; width: 460px; max-width: calc(100vw - 28px); }
#tblBoard { width: 100%; border-collapse: collapse; font-size: 12px;
  font-variant-numeric: tabular-nums; }
#tblBoard th, #tblBoard td { text-align: right; padding: 2px 4px; border-bottom: 1px solid rgba(150,190,220,.12); }
#tblBoard th:nth-child(2), #tblBoard td:nth-child(2) { text-align: left; }
#tblBoard th { color: var(--dim); font-weight: 600; }
#board tr.you td { color: var(--accent); font-weight: 700; }
#board tr.now td { background: rgba(245,195,59,.10); }
#board td.foul { color: var(--bad); }
#boardNote { margin: 7px 0 9px; font-size: 11px; color: var(--dim); min-height: 1.4em; }

#readout { right: 14px; bottom: 14px; width: 260px; }
#readout dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 2px 10px;
  font-size: 12px; }
#readout dt { color: var(--dim); }
#readout dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

.back { position: fixed; inset: 0; background: rgba(4, 9, 14, .72); z-index: 20; }
.modal { position: fixed; z-index: 21; inset: 4vh 5vw; background: #0e1a26;
  border: 1px solid var(--edge); border-radius: 13px; display: flex; flex-direction: column;
  overflow: hidden; box-shadow: 0 22px 60px rgba(0,0,0,.55); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid var(--edge); }
.modal-head h2 { margin: 0; font-size: 16px; }
.modal-head button { margin-left: auto; }
.modal-body { overflow: auto; padding: 12px 18px 24px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; position: sticky; top: -12px;
  background: #0e1a26; padding: 6px 0 10px; }
.tab { font-size: 12px; }
.tab.on { border-color: var(--accent); color: var(--accent); }
.pane { display: none; max-width: 74ch; }
.pane.on { display: block; }
.pane h3 { font-size: 14px; margin: 18px 0 6px; letter-spacing: .04em; }
.pane ul { padding-left: 20px; }
.pane li { margin: 4px 0; }
.pane blockquote { margin: 10px 0; padding: 8px 14px; border-left: 3px solid var(--accent);
  color: var(--dim); font-size: 14px; }
.pane blockquote cite { display: block; margin-top: 6px; font-size: 12px; font-style: normal; }
.pane .note { color: var(--dim); font-size: 13px; }
.scrollx { overflow-x: auto; margin: 8px 0; }
.pane table { border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.pane th, .pane td { border: 1px solid rgba(150,190,220,.20); padding: 3px 8px; text-align: right;
  white-space: nowrap; }
.pane th:first-child, .pane td:first-child { text-align: left; }
.pane thead th { color: var(--accent); }

@media (max-width: 900px) {
  #controls { width: 232px; }
  #board { width: calc(100vw - 28px); }
  #readout { display: none; }
}
@media (max-width: 640px) {
  #topbar h1 { font-size: 16px; }
  #controls { top: 96px; }
}

/* Phones, portrait: a scrolling column - the game band, then the throw button, then the rest.
   Overlaid panels cannot fit a 320-390 px screen without covering each other. */
@media (max-width: 700px) and (min-height: 501px) {
  html, body { overflow: auto; height: auto; }
  #wrap { height: auto; min-height: 100dvh; display: flex; flex-direction: column; }
  #topbar { position: relative; order: 0; padding: 8px 12px; gap: 6px 10px;
    background: rgba(6,12,18,.92); pointer-events: auto; }
  #topbar nav { margin-left: 0; gap: 6px; }
  #topbar nav button { padding: 5px 9px; }
  #gl { position: relative; inset: auto; order: 1; height: 46dvh; min-height: 220px; flex: none; }
  #controls, #board, #readout { position: static; width: auto; max-width: none; margin: 10px 12px 0;
    backdrop-filter: none; }
  #controls { order: 2; display: flex; flex-direction: column; }
  #controls h2 { order: -2; }
  #controls .release, #controls .message { order: -1; }
  #controls .release { margin-top: 0; }
  #board { order: 3; overflow-x: auto; }
  #tblBoard { font-size: 11px; }
  #tblBoard th, #tblBoard td { padding: 2px 3px; white-space: nowrap; }
  #readout { order: 4; display: block; margin-bottom: 14px; }
}

/* Phones, landscape: keep the full-bleed game, put the delivery on the left and the scoreboard on
   the right, each scrolling inside the screen height instead of running off the bottom. */
@media (max-height: 500px) {
  #topbar { padding: 6px 10px; gap: 6px 8px; flex-wrap: nowrap; }
  #topbar h1 { font-size: 15px; }
  #topbar .chips { flex-wrap: nowrap; overflow: hidden; min-width: 0; }
  #topbar nav { flex-wrap: nowrap; flex: none; }
  #topbar nav button { padding: 4px 8px; font-size: 12px; }
  #controls, #board { top: 44px; bottom: auto; max-height: calc(100dvh - 52px); overflow-y: auto;
    padding: 8px 10px; }
  #controls { left: 8px; width: 214px; display: flex; flex-direction: column; }
  #controls h2 { order: -2; }
  #controls .release, #controls .message { order: -1; }
  #controls .release { margin-top: 0; }
  #controls label { margin-top: 5px; }
  #board { left: auto; right: 8px; width: min(400px, calc(100vw - 246px)); overflow-x: auto; }
  #readout { display: none; }
}
