/* Online darts scoreboard (/darts-scoreboard/). Builds on site.css: same
   palette, .seg, .keypad, .chip and .btn. Phone first: big numbers and tap
   targets for use at the board; two columns from tablet width up. */

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.sb-head h1 { margin-bottom: .4rem; }
.sb-lede { margin-bottom: 1rem; }
@media (max-width: 40rem) {
  .sb-head h1 { font-size: 1.6rem; }
  .sb-lede { font-size: .98rem; }
  .sb-playing .sb-lede { display: none; }
}

.sb { scroll-margin-top: .5rem; margin-bottom: 1.5rem; }
.sb button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.sb button:disabled { opacity: .38; cursor: default; }
.sb [hidden] { display: none !important; }
.sb .btn { color: var(--on-red); }
.sb .btn-ghost { color: var(--text); }

/* ---------- Setup ---------- */
.sb-setup { display: grid; gap: 1rem; max-width: 34rem; }
.seg-opts.four { grid-template-columns: repeat(4, 1fr); }
.sb-row { display: grid; gap: 1rem; grid-template-columns: 1.4fr 1fr; align-items: end; }
.sb-row .sb-out[hidden] + .sb-legs { grid-column: 1 / -1; }
.sb-label { display: block; font-weight: 600; color: var(--muted); margin-bottom: .3rem; font-size: .95rem; }
.sb-stepper { display: grid; grid-template-columns: 52px 1fr 52px; align-items: center; background: var(--surface-2); border-radius: 12px; min-height: 52px; }
.sb-stepper button { border: 0; background: none; font-size: 1.5rem; font-weight: 700; min-height: 52px; border-radius: 12px; }
.sb-stepper output { text-align: center; font-weight: 700; white-space: nowrap; }
.sb-names { display: grid; gap: .5rem; grid-template-columns: 1fr 1fr; }
.sb-names input {
  width: 100%; font: inherit; font-size: 1.05rem; font-weight: 600; min-height: 50px; padding: 0 .8rem;
  border-radius: 12px; border: 2px solid var(--line); background: var(--bg); color: var(--text);
}
.sb-names input:focus-visible { border-color: var(--focus); outline: none; }
.sb-order { margin: -.3rem 0 0; }
.sb-start { width: 100%; font-size: 1.15rem; }
@media (max-width: 26rem) { .sb-row { grid-template-columns: 1fr; } }

/* ---------- Game ---------- */
.sb-game { display: grid; gap: .7rem; }
.sb-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.sb-title { margin: 0; color: var(--muted); font-weight: 600; font-size: .95rem; }
.sb-link { background: none; border: 0; padding: .55rem .2rem; min-height: 44px; font-weight: 700; color: var(--link) !important; text-decoration: underline; text-decoration-color: var(--link-line); text-underline-offset: .18em; text-decoration-thickness: 2px; }

.sb-board { display: grid; gap: .7rem; align-content: start; }
.sb-players { list-style: none; margin: 0; padding: .4rem 0 0; display: grid; gap: .5rem; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); }
.sb-game[data-players="1"] .sb-players { --cols: 1; }
.sb-game[data-players="3"] .sb-players { --cols: 3; }
.sb-p {
  margin: 0; display: grid; justify-items: center; align-content: center; gap: .05rem; min-width: 0;
  padding: .55rem .4rem .6rem; border-radius: var(--radius); background: var(--surface); border: 3px solid var(--line);
  font-variant-numeric: tabular-nums; position: relative;
}
.sb-p.is-up { border-color: var(--red); background: var(--surface-2); }
.sb-p.is-up::before {
  content: "Throwing"; position: absolute; top: -.6rem; left: 50%; transform: translateX(-50%);
  background: var(--red); color: var(--on-red); font-size: .68rem; font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase; padding: .05rem .5rem; border-radius: 999px; white-space: nowrap;
}
.sb-name { font-weight: 700; font-size: 1rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-score { font-size: clamp(3.2rem, 17vw, 5.4rem); font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.sb-game[data-players="1"] .sb-score { font-size: clamp(4.5rem, 26vw, 7rem); }
.sb-game[data-players="3"] .sb-score,
.sb-game[data-players="4"] .sb-score { font-size: clamp(2.6rem, 12.5vw, 4.6rem); }
.sb-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 .7rem; color: var(--muted); font-size: .88rem; }
.sb-busted { color: var(--red-strong); font-weight: 700; }
@media (prefers-color-scheme: dark) { .sb-busted { color: #ff6b5e; } }

.sb-status { min-height: 3rem; display: grid; align-content: center; gap: .2rem; padding: .35rem .8rem; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-size: 1rem; }
.sb-status p { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .45rem; }
.sb-bustline { color: var(--red-strong); }
@media (prefers-color-scheme: dark) { .sb-bustline { color: #ff6b5e; } }
.sb-route { display: inline-flex; gap: .3rem; }
.sb-route .chip { min-width: 3.3rem; padding: .2rem .5rem; font-size: 1.15rem; border-radius: 9px; }

/* x01 entry */
.sb-pad { display: grid; gap: .5rem; align-content: start; }
.sb-display {
  display: flex; align-items: center; gap: .6rem; min-height: 58px; padding: 0 .4rem 0 .9rem;
  border-radius: var(--radius); background: var(--surface); border: 2px solid var(--line);
}
#sb-typed { font-size: 2.1rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
#sb-typed.is-empty { font-size: 1.15rem; font-weight: 600; color: var(--muted); }
.sb-hint { flex: 1; font-size: .9rem; font-weight: 600; color: var(--green); min-width: 0; }
.sb-hint.is-bad { color: var(--red-strong); }
@media (prefers-color-scheme: dark) { .sb-hint.is-bad { color: #ff6b5e; } }
.sb-undo, .sb-miss {
  margin-left: auto; border: 0; border-radius: 10px; background: var(--surface-2); min-height: 44px;
  padding: 0 .9rem; font-weight: 700 !important; white-space: nowrap;
}
.sb-quick { display: grid; grid-template-columns: repeat(5, 1fr); gap: .4rem; }
.sb-quick button {
  min-height: 48px; border-radius: 12px; border: 1px solid var(--line); background: transparent;
  font-weight: 700; font-size: 1.05rem; font-variant-numeric: tabular-nums; padding: 0;
}
.sb-quick .sb-bust { background: var(--surface-2); border-color: transparent; color: var(--red-strong) !important; }
@media (prefers-color-scheme: dark) { .sb-quick .sb-bust { color: #ff6b5e !important; } }
.sb-keypad button { min-height: 58px; }
.sb-keypad .sb-enter { background: var(--red-strong); color: var(--on-red) !important; font-size: 1.2rem; }
.sb-keypad button:active:not(:disabled), .sb-quick button:active:not(:disabled), .sb-hit button:active:not(:disabled) { filter: brightness(1.3); }

/* Cricket board: number, each player's marks, then the hit buttons */
.sb-ctable { width: 100%; margin: 0; border-collapse: separate; border-spacing: 0 4px; table-layout: fixed; }
.sb-ctable th, .sb-ctable td { border: 0; padding: 0; text-align: center; vertical-align: middle; }
.sb-ctable thead th { font-size: .78rem; color: var(--muted); font-weight: 700; padding-bottom: 2px; }
.sb-ctable thead th span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
.sb-ctable thead th.is-up { color: var(--text); }
.sb-ctable thead th:first-child { width: 3.1rem; }
.sb-ctable .sb-hit-h { width: 9.6rem; }
.sb-ctable tbody th { font-size: 1.35rem; font-weight: 800; background: var(--surface); border-radius: 10px 0 0 10px; height: 52px; }
.sb-ctable tbody th.bull { font-size: .95rem; }
.sb-mk { background: var(--surface); color: var(--text); }
.sb-mk.is-up { background: var(--surface-2); }
.sb-mk svg { width: 30px; height: 30px; display: block; margin: auto; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; }
.sb-mk.is-closed { color: var(--chip-d); }
@media (prefers-color-scheme: dark) { .sb-mk.is-closed { color: #3fbf7f; } }
.sb-ctable tr.is-dead th, .sb-ctable tr.is-dead .sb-mk { opacity: .4; }
.sb-hit { background: var(--surface); border-radius: 0 10px 10px 0; padding: 4px !important; }
.sb-hit > div { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.sb-hit > div.bull { grid-template-columns: 1fr 1fr; }
.sb-hit button { min-height: 44px; width: 100%; border: 0; border-radius: 8px; background: var(--surface-2); font-weight: 800; font-size: 1.05rem; padding: 0; }
.sb-hit button[data-dart$=".2"] { background: var(--chip-d); color: #fff !important; }
.sb-hit button[data-dart$=".3"] { background: var(--chip-t); color: #fff !important; }
.sb-darts { list-style: none; margin: 0; padding: 0; display: flex; gap: .35rem; }
.sb-darts li { margin: 0; min-width: 3.6rem; text-align: center; padding: .3rem .4rem; border-radius: 9px; background: var(--surface-2); font-weight: 800; }
.sb-darts li.is-empty { background: none; color: var(--muted); font-weight: 600; font-size: .85rem; border: 1px dashed var(--line); }
#sb-cpad .sb-display { padding-left: .45rem; gap: .4rem; }
#sb-cpad .sb-miss { margin-left: auto; }
#sb-cpad .sb-undo { margin-left: 0; }
@media (max-width: 26rem) {
  .sb-darts li { min-width: 2.9rem; padding: .3rem .2rem; }
  .sb-ctable thead th:first-child { width: 2.6rem; }
  .sb-ctable .sb-hit-h { width: 8.4rem; }
  .sb-ctable tbody th { font-size: 1.15rem; }
  .sb-mk svg { width: 24px; height: 24px; }
}

/* Two columns once there's room: scores left, entry right */
@media (min-width: 50rem) {
  .sb-game { grid-template-columns: minmax(0, 1.25fr) minmax(19rem, 1fr); align-items: start; column-gap: 1.2rem; }
  .sb-bar { grid-column: 1 / -1; }
  .sb-game.is-cricket { grid-template-columns: minmax(0, 1fr); max-width: 52rem; }
  .sb-game.is-cricket .sb-hit-h { width: 13rem; }
  .sb-game.is-cricket .sb-hit button { min-height: 48px; font-size: 1.15rem; }
  .sb-game[data-players="4"] .sb-players { --cols: 4; }
  .sb-game[data-players="4"] .sb-score { font-size: 3.6rem; }
  .sb-game[data-players="3"] .sb-score { font-size: 4.2rem; }
  .sb-score { font-size: clamp(5.6rem, 8.5vw, 8rem); }
  .sb-game[data-players="1"] .sb-score { font-size: clamp(7rem, 11vw, 10rem); }
  .sb-p { padding: 1rem .5rem 1.1rem; }
}
/* Landscape phones: short screen, keep everything on one page */
@media (orientation: landscape) and (max-height: 32rem) {
  .sb-head, .sb-bar { display: none; }
  .sb-game { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .sb-game.is-cricket { grid-template-columns: minmax(0, 1fr); }
  .sb-score, .sb-game[data-players] .sb-score { font-size: 2.8rem; }
  .sb-keypad button { min-height: 42px; font-size: 1.25rem; }
  .sb-quick button { min-height: 38px; }
  .sb-display { min-height: 46px; }
}

/* Overlay: leg win, match win, darts-used question */
.sb-overlay {
  position: fixed; inset: 0; z-index: 20; display: grid; grid-template-columns: minmax(0, 1fr); place-items: end center; padding: .8rem;
  background: rgba(0, 0, 0, .55); overflow-y: auto;
}
.sb-overlay[hidden] { display: none; }
@media (min-width: 40rem) { .sb-overlay { place-items: center; } }
.sb-dialog { width: min(100%, 34rem); padding: 1.3rem 1.2rem 1.1rem; box-shadow: 0 18px 60px rgba(0, 0, 0, .5); animation: sb-pop .22s ease-out; }
@keyframes sb-pop { from { transform: translateY(14px) scale(.98); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sb-dialog { animation: none; } }
.sb-dialog h2 { margin: 0 0 .3rem; font-size: 1.7rem; }
.sb-dialog > p { margin: 0 0 .8rem; }
.sb-kicker { color: var(--red-strong); font-weight: 800; text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; margin: 0 0 .2rem !important; }
@media (prefers-color-scheme: dark) { .sb-kicker { color: #ff6b5e; } }
.sb-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin-top: .9rem; }
.sb-actions .btn { flex: 1 1 8rem; }
.sb-actions .sb-link { flex-basis: 100%; text-align: center; }
.sb-dartsq { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.sb-dartsq .btn { font-size: 1.5rem; min-height: 60px; border-radius: 14px; }
.sb-legscore { list-style: none; padding: 0; margin: 0; display: grid; gap: .3rem; }
.sb-legscore li { display: flex; justify-content: space-between; margin: 0; padding: .45rem .7rem; border-radius: 10px; background: var(--surface-2); font-weight: 600; }
.sb-sum { margin: .2rem 0 0; font-size: .95rem; }
.sb-sum th, .sb-sum td { padding: .4rem .45rem; white-space: nowrap; }
.sb-sum abbr { text-decoration: none; }
.sb-sum tbody th { color: var(--text); font-size: .95rem; max-width: 8rem; overflow: hidden; text-overflow: ellipsis; }
.sb-upsell { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem 1rem; margin-top: 1.1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.sb-upsell > img { width: 56px; height: 56px; border-radius: 13px; }
.sb-upsell > div { flex: 1 1 14rem; }
.sb-upsell p { margin: .2rem 0 0; color: var(--muted); font-size: .92rem; line-height: 1.45; }
.sb-upsell .appstore-badge img { height: 44px; }

/* App strip under the tool */
.sb-strip { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; padding: .7rem .9rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.sb-strip > img { width: 40px; height: 40px; border-radius: 10px; }
.sb-strip p { flex: 1 1 15rem; margin: 0; font-size: .93rem; line-height: 1.45; }
.sb-strip .appstore-badge img { height: 40px; }

.sb-copy { margin: 1.4rem 0 0; padding: 0; }
