/* Shuffleboard.  One stylesheet, no framework, no external font, no external image.
   ------------------------------------------------------------------------------------------
   ONE RULE HERE IS LOAD-BEARING AND IS WRITTEN THE WAY IT IS ON PURPOSE.  `[hidden]` is only
   a UA rule setting display:none, and ANY class rule that sets display beats it - which
   produces an invisible overlay that still swallows every click.  So .modal is never given a display of its own: it is given one
   only under :not([hidden]), so hiding it cannot fail.  tools-harness-page.js parses this file
   and asserts that. */

:root {
  --ink: #e8ecf3;
  --ink-dim: #99a3b4;
  --ink-faint: #6b7484;
  --bg: #0f1116;
  --panel: #171a21;
  --panel-2: #1d212a;
  --edge: #2a2f3a;
  --maple: #c9b27a;
  --red: #c73738;
  --blue: #3459b3;
  --go: #2f8f6b;
  --hot: #e08049;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 8px; top: 8px; background: var(--panel); padding: 8px 12px; z-index: 40; }

.bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px;
  padding: 10px 16px; border-bottom: 1px solid var(--edge); background: var(--panel);
}
.bar h1 {
  margin: 0; font-size: 19px; letter-spacing: 0.06em; text-transform: uppercase;
  font-weight: 650;
}
.scores { display: flex; gap: 14px; align-items: center; margin-left: auto; }
.side {
  display: flex; align-items: center; gap: 7px;
  padding: 3px 10px; border-radius: 999px; border: 1px solid transparent;
}
.side.is-turn { border-color: var(--maple); background: rgba(201,178,122,0.10); }
.side b { font-variant-numeric: tabular-nums; font-size: 18px; }
.side .who { color: var(--ink-dim); font-size: 13px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-a { background: var(--red); }
.dot-b { background: var(--blue); }
td.dot-a { color: var(--red); }
td.dot-b { color: var(--blue); }
.bar-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.btn {
  font: inherit; font-size: 13px; color: var(--ink);
  background: var(--panel-2); border: 1px solid var(--edge); border-radius: 6px;
  padding: 6px 11px; cursor: pointer;
}
.btn:hover { border-color: var(--maple); }
.btn:focus-visible { outline: 2px solid var(--maple); outline-offset: 1px; }
.btn.is-on { background: rgba(201,178,122,0.16); border-color: var(--maple); }
.btn-go { background: var(--go); border-color: #3aa77e; font-weight: 600; }
.btn-go:hover { background: #37a37c; }

main {
  display: grid; grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px; padding: 16px; align-items: start;
}
.stage { position: relative; min-width: 0; }
#court {
  width: 100%; height: auto; display: block; border-radius: 10px;
  border: 1px solid var(--edge); background: #0b0d11;
}
.nogl { padding: 24px; color: var(--ink-dim); }
.hud {
  position: absolute; left: 12px; right: 12px; bottom: 10px; margin: 0;
  font-size: 13px; color: var(--ink); background: rgba(15,17,22,0.78);
  border: 1px solid var(--edge); border-radius: 6px; padding: 7px 10px;
  min-height: 1.5em;
}
.panel { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.turn { margin: 0; font-size: 15px; font-weight: 600; }
.msg { margin: 0; font-size: 13px; color: var(--ink-dim); min-height: 1em; }
.card {
  background: var(--panel); border: 1px solid var(--edge); border-radius: 10px;
  padding: 12px 13px;
}
.card h2 {
  margin: 0 0 9px; font-size: 12px; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--ink-dim); font-weight: 650;
}
.hint { margin: 0 0 10px; font-size: 12px; color: var(--ink-faint); }
.small { font-size: 11px; }
.fld { display: block; font-size: 12px; color: var(--ink-dim); margin-bottom: 11px; }
.fld output { color: var(--ink); float: right; font-variant-numeric: tabular-nums; }
.fld input[type=range] { width: 100%; margin-top: 5px; accent-color: var(--maple); }
.fld select {
  width: 100%; margin-top: 5px; font: inherit; font-size: 13px; color: var(--ink);
  background: var(--panel-2); border: 1px solid var(--edge); border-radius: 6px; padding: 6px 8px;
}
.preview {
  margin: 4px 0 10px; font-size: 12px; color: var(--maple); min-height: 2.4em;
}
#section {
  width: 100%; height: auto; display: block; border-radius: 6px;
  border: 1px solid var(--edge); background: #14171d;
}
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 9px 0 0; }
.kv dt { color: var(--ink-faint); font-size: 12px; }
.kv dd { margin: 0; font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; }
table.board { width: 100%; border-collapse: collapse; font-size: 12px; }
table.board th {
  text-align: left; color: var(--ink-faint); font-weight: 500; padding: 3px 4px;
  border-bottom: 1px solid var(--edge);
}
table.board td { padding: 3px 4px; border-bottom: 1px solid rgba(42,47,58,0.5); }
table.board tbody tr:last-child td { border-bottom: none; }
tr.is-scoring td { background: rgba(47,143,107,0.16); }
.dim { color: var(--ink-faint); }
.mono { font-family: var(--mono); font-size: 12px; color: var(--maple); }

/* THE MODAL.  No display here - see the note at the top of this file. */
.modal {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(8,10,13,0.76); padding: 18px; overflow: auto;
}
.modal:not([hidden]) { display: flex; align-items: flex-start; justify-content: center; }
.sheet {
  background: var(--panel); border: 1px solid var(--edge); border-radius: 12px;
  padding: 18px 20px; max-width: 460px; width: 100%; margin: auto;
}
.sheet-wide { max-width: 760px; }
.sheet h2 { margin: 0 0 12px; font-size: 17px; }
.sheet h3 {
  margin: 18px 0 7px; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--maple);
}
.sheet p { margin: 0 0 10px; font-size: 13px; }
.row { display: flex; gap: 8px; margin-top: 14px; }
ul.cites { margin: 0 0 10px; padding-left: 18px; font-size: 12.5px; color: var(--ink-dim); }
ul.cites li { margin-bottom: 5px; }
ul.cites b { color: var(--ink); }
.foot { padding: 14px 16px 26px; border-top: 1px solid var(--edge); }
.foot p { margin: 0; font-size: 11.5px; color: var(--ink-faint); max-width: 78ch; }
.foot a { color: var(--ink-dim); }

@media (max-width: 900px) {
  main { grid-template-columns: minmax(0, 1fr); }
  .panel { order: 2; }
  .scores { margin-left: 0; }
}
/* On a phone the controls sit below the board, so the board stays pinned at the top while the
   player scrolls to the Slide button - otherwise the shot runs off-screen.  Not on a short
   (landscape) viewport, where a pinned board would leave no room for the controls. */
@media (max-width: 900px) and (min-height: 560px) {
  .stage { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 8px 0; margin-top: -8px; }
}
