/* =========================================================
   Scoreboard: setup screen, team editor, results, full-screen scorer
   ========================================================= */

/* ---------- Setup screen ---------- */
.sb-card { margin-top: 14px; }
.sb-card:first-of-type { margin-top: 0; }
.sb-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.sb-card-head h3 { font-size: 15px; letter-spacing: 0.2px; }
.sb-empty { text-align: center; color: var(--muted); padding: 22px 8px; font-size: 13.5px; }
.sb-loading { display: flex; justify-content: center; padding: 30px 0; }

.sb-opts { display: flex; flex-direction: column; gap: 8px; }
.sb-opt {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: left; width: 100%;
  background: var(--navy); border: 1.5px solid var(--navy-3); border-radius: 14px; padding: 12px 14px; color: var(--white);
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease), transform 0.12s var(--ease);
}
.sb-opt:hover { border-color: var(--navy-4); }
.sb-opt:active { transform: scale(0.99); }
.sb-opt.selected { border-color: var(--ice); background: var(--ice-tint); }
.sb-opt-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sb-opt-main b { font-size: 14px; font-weight: 600; }
.sb-opt-main small { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-opt-meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; white-space: nowrap; flex-shrink: 0; }
.sb-pasttoggle { align-self: flex-start; }

.sb-notice {
  background: var(--warn-tint); border: 1px solid rgba(224, 167, 47, 0.35); color: var(--warn);
  border-radius: 12px; padding: 9px 12px; font-size: 13px; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.sb-syncbtn { border: none; cursor: pointer; }

/* The one thing you need at the start of a game, right at the top of the page. */
.sb-start {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: linear-gradient(135deg, var(--navy-3), var(--navy-2)); border: 1px solid var(--navy-4); border-radius: 18px; padding: 14px 16px;
  box-shadow: 0 18px 40px -22px rgba(0, 0, 0, 0.8);
}
.sb-start.live { border-color: rgba(230, 57, 44, 0.6); box-shadow: 0 0 0 1px rgba(230, 57, 44, 0.2), 0 18px 40px -22px rgba(230, 57, 44, 0.55); }
.sb-start-info { display: flex; flex-direction: column; gap: 3px; flex: 1 1 0; min-width: 0; }
.sb-start-scope { color: var(--muted-2); font-size: 11px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-start-info b { font-size: 17px; }
.sb-start-teams { color: var(--muted); font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sb-start-teams i { font-style: normal; color: var(--red); font-weight: 700; padding: 0 3px; }
.sb-start-hint { font-style: normal; color: var(--muted-2); font-size: 12px; }
.sb-start-actions { display: flex; flex-direction: column; align-items: stretch; gap: 8px; flex-shrink: 0; }
.sb-go { padding: 15px 24px; font-size: 16px; }

/* ---------- Tabs ---------- */
.sb-tabs { display: flex; background: var(--navy); border: 1px solid var(--navy-3); border-radius: 12px; padding: 3px; gap: 3px; margin-bottom: 12px; }
.sb-tabs button { flex: 1; border: none; background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 600; padding: 8px 6px; border-radius: 9px; transition: all 0.15s var(--ease); }
.sb-tabs button em { font-style: normal; background: var(--navy-3); border-radius: 999px; padding: 1px 7px; font-size: 11px; margin-left: 4px; }
.sb-tabs button.active { background: var(--navy-3); color: var(--ice); }
.sb-seg { display: flex; background: var(--navy); border: 1px solid var(--navy-3); border-radius: 12px; padding: 3px; gap: 3px; }
.sb-seg button { flex: 1; border: none; background: transparent; color: var(--muted); font-weight: 600; padding: 9px; border-radius: 9px; }
.sb-seg button.active { background: var(--ice); color: var(--navy); }

/* ---------- Team editor ---------- */
.sb-editor { display: flex; flex-direction: column; gap: 14px; }
.sb-edit-court { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: stretch; }
.sb-edit-team { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.sb-edit-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.sb-edit-title em { font-style: normal; color: var(--ice); text-transform: none; letter-spacing: 0; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-edit-vs { align-self: center; font-family: var(--font-display); color: var(--red); letter-spacing: 2px; }
.sb-bench-list { display: flex; flex-wrap: wrap; gap: 8px; }
.sb-chip {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; min-width: 0;
  background: var(--navy); border: 1.5px solid var(--navy-3); color: var(--white); border-radius: 12px; padding: 8px 10px; font-size: 13.5px;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.sb-bench-list .sb-chip { width: auto; }
.sb-chip .avatar { margin-right: 0; flex-shrink: 0; }
.sb-chip .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.sb-chip:hover { border-color: var(--navy-4); }
.sb-chip.selected { border-color: var(--ice); background: var(--ice-tint); box-shadow: 0 0 0 3px var(--ice-tint); }
.sb-chip.empty { border-style: dashed; color: var(--muted-2); justify-content: center; min-height: 44px; }
.sb-guest { font-style: normal; font-size: 10px; letter-spacing: 0.5px; text-transform: uppercase; color: var(--warn); background: var(--warn-tint); border-radius: 999px; padding: 1px 6px; }
.sb-selbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  background: var(--ice-tint); border: 1px solid rgba(143, 217, 212, 0.35); border-radius: 12px; padding: 10px 12px; font-size: 13px;
}
.sb-selbtns { display: flex; gap: 6px; flex-wrap: wrap; }
.sb-edit-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.sb-mlist { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; max-height: 42vh; overflow-y: auto; }
.sb-mrow { display: flex; align-items: center; gap: 10px; text-align: left; background: var(--navy); border: 1px solid var(--navy-3); border-radius: 12px; padding: 9px 12px; color: var(--white); font-size: 14px; }
.sb-mrow:hover { border-color: var(--ice); }
.sb-mrow .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.sb-mrow small { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.sb-mhead { font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); margin: 10px 2px 2px; }
.sb-mhead:first-child { margin-top: 2px; }
.sb-pe-row { display: flex; gap: 8px; }
.sb-pe-row .input { flex: 1; min-width: 0; }

/* ---------- Rules ---------- */
.sb-rules { display: flex; flex-direction: column; gap: 16px; }
.sb-sec h4 { font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; font-weight: 700; }
.sb-rot { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sb-rotbtn { display: flex; flex-direction: column; gap: 3px; text-align: left; background: var(--navy); border: 1.5px solid var(--navy-3); color: var(--white); border-radius: 12px; padding: 10px 12px; transition: all 0.15s var(--ease); }
.sb-rotbtn b { font-size: 13.5px; }
.sb-rotbtn small { color: var(--muted); font-size: 11.5px; line-height: 1.3; }
.sb-rotbtn.active { border-color: var(--ice); background: var(--ice-tint); }
.sb-rotbtn.active b { color: var(--ice); }
.sb-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 0; border-top: 1px solid var(--navy-3); }
.sb-row:first-child { border-top: none; }
.sb-row div { display: flex; flex-direction: column; gap: 2px; }
.sb-row b { font-size: 14px; font-weight: 600; }
.sb-row small { color: var(--muted); font-size: 12px; }
.sb-switch { position: relative; width: 46px; height: 26px; flex-shrink: 0; }
.sb-switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.sb-switch span { position: absolute; inset: 0; background: var(--navy-4); border-radius: 26px; transition: background 0.2s var(--ease); }
.sb-switch span::before { content: ''; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; border-radius: 50%; background: var(--muted); transition: transform 0.2s var(--ease), background 0.2s var(--ease); }
.sb-switch input:checked + span { background: var(--red); }
.sb-switch input:checked + span::before { transform: translateX(20px); background: #fff; }
.sb-stepper { display: flex; align-items: center; gap: 14px; }
.sb-stepper b { font-family: var(--font-display); letter-spacing: 1px; font-size: 20px; min-width: 90px; text-align: center; }
.sb-danger { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Results & leaderboards ---------- */
.sb-export { margin-top: 6px; }
.sb-game { background: var(--navy); border: 1px solid var(--navy-3); border-radius: 14px; padding: 12px; margin-bottom: 10px; }
.sb-game-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid var(--navy-3); }
.sb-game-set { font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.sb-game-score { font-family: var(--font-display); font-size: 24px; letter-spacing: 2px; display: inline-flex; gap: 6px; align-items: baseline; }
.sb-game-score i { font-style: normal; color: var(--muted-2); }
.sb-game-score b { font-weight: 400; color: var(--muted); }
.sb-game-score b.win { color: var(--ice); }
.sb-game-meta { color: var(--muted-2); font-size: 12px; margin-left: auto; }
.sb-x { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--navy-4); background: transparent; color: var(--muted); font-size: 12px; }
.sb-x:hover { border-color: var(--red); color: var(--red); }
.sb-game-teams { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: start; }
.sb-game-vs { align-self: center; color: var(--muted-2); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; }
.sb-game-team { background: var(--navy-2); border-radius: 10px; padding: 8px 10px; border-left: 3px solid transparent; min-width: 0; }
.sb-game-team.win { border-left-color: var(--ice); }
.sb-game-tname { font-size: 12px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-game-team.win .sb-game-tname { color: var(--ice); }
.sb-game-pl { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; padding: 2px 0; }
.sb-game-pl span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-game-pl b { color: var(--muted); }
.sb-game-team.win .sb-game-pl b { color: var(--ice); }
.sb-game-by { color: var(--muted-2); font-size: 11.5px; margin-top: 8px; }
.sb-game-err { color: var(--red); font-size: 12px; margin-top: 6px; }
.sb-lb-row { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-top: 1px solid var(--navy-3); font-size: 13.5px; }
.sb-lb-row:first-child { border-top: none; }
.sb-lb-rank { width: 26px; height: 26px; border-radius: 50%; background: var(--navy-3); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; flex-shrink: 0; }
.sb-lb-rank.top1 { background: #e0a72f; color: #2a1d00; }
.sb-lb-rank.top2 { background: #c3ccd6; color: #1c2430; }
.sb-lb-rank.top3 { background: #c98a58; color: #2a1706; }
.sb-lb-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-lb-wl { white-space: nowrap; color: var(--muted); font-size: 12.5px; }
.sb-lb-wl b.w { color: var(--good); }
.sb-lb-pct { color: var(--ice); font-weight: 700; min-width: 40px; text-align: right; }
.sb-lb-pts { color: var(--muted-2); font-size: 12px; min-width: 52px; text-align: right; white-space: nowrap; }
.sb-rt-num { font-family: var(--font-display); font-size: 17px; letter-spacing: 0.5px; color: var(--ice); min-width: 44px; text-align: right; }
.sb-rt-up, .sb-rt-down, .sb-rt-same { font-size: 11.5px; font-weight: 700; min-width: 44px; text-align: right; white-space: nowrap; }
.sb-rt-up { color: var(--good); }
.sb-rt-down { color: var(--red); }
.sb-rt-same { color: var(--muted-2); }

/* =========================================================
   Full-screen scorer
   ========================================================= */
body.sb-lock { overflow: hidden; }

.sb-court {
  position: fixed; inset: 0; z-index: 90; display: flex; flex-direction: column; color: var(--white);
  background:
    radial-gradient(ellipse 60% 45% at 12% 50%, rgba(143, 217, 212, 0.09), transparent 70%),
    radial-gradient(ellipse 60% 45% at 88% 50%, rgba(230, 57, 44, 0.1), transparent 70%),
    var(--navy);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  overscroll-behavior: contain; touch-action: manipulation; -webkit-user-select: none; user-select: none;
  animation: sbIn 0.25s var(--ease);
  outline: none;
}
.sb-court::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0.045;
  background: url('/img/logo.png') center 58% / min(72vmin, 620px) no-repeat;
}
.sb-court input { -webkit-user-select: text; user-select: text; }
.sb-main { position: relative; flex: 1; display: flex; flex-direction: column; min-height: 0; }
@keyframes sbIn { from { opacity: 0; transform: scale(0.985); } to { opacity: 1; transform: none; } }

.sb-top { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px 10px; align-items: center; padding: 10px 12px 4px; flex-shrink: 0; }
.sb-ibtn {
  width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--navy-4); background: var(--navy-2); color: var(--white);
  font-size: 18px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background 0.15s var(--ease), transform 0.12s var(--ease);
}
.sb-ibtn:active { transform: scale(0.94); background: var(--navy-3); }
.sb-title { display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 0; line-height: 1.15; }
.sb-title b { font-family: var(--font-display); font-weight: 400; letter-spacing: 1.5px; font-size: 20px; text-transform: uppercase; }
.sb-title span { color: var(--muted); font-size: 12px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-strip { grid-column: 1 / -1; display: flex; gap: 10px; align-items: stretch; justify-content: space-between; }
.sb-lbl { font-size: 9.5px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted-2); font-weight: 700; }
.sb-call, .sb-timer { background: var(--navy-2); border: 1px solid var(--navy-3); border-radius: 14px; padding: 6px 12px; display: flex; }
.sb-call { flex-direction: column; justify-content: center; gap: 0; min-width: 118px; flex: 1 1 auto; }
.sb-call b { font-family: var(--font-display); font-weight: 400; font-size: 32px; letter-spacing: 3px; color: var(--ice); line-height: 1.05; white-space: nowrap; text-shadow: 0 0 22px rgba(143, 217, 212, 0.35); }
.sb-call small { color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-timer { flex-direction: row; align-items: center; gap: 10px; }
.sb-timer .sb-lbl { align-self: flex-start; padding-top: 2px; }
.sb-timer b { font-family: var(--font-display); font-weight: 400; font-size: 30px; letter-spacing: 2px; min-width: 76px; text-align: center; color: var(--white); font-variant-numeric: tabular-nums; }
.sb-timer b.low { color: var(--red); animation: sbPulseText 1s ease-in-out infinite; }
.sb-tbtns { display: flex; gap: 6px; }
.sb-tbtn { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--navy-4); background: var(--navy); color: var(--ice); font-size: 13px; display: inline-flex; align-items: center; justify-content: center; }
.sb-tbtn:active { background: var(--navy-3); }

.sb-teams { flex: 1; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; padding: 6px 12px 8px; }
.sb-team {
  position: relative; min-height: 0; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 4px;
  background: linear-gradient(180deg, var(--navy-2), rgba(22, 39, 74, 0.55)); border: 1px solid var(--navy-3); border-radius: 20px; padding: 10px 14px 12px;
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.sb-team.serving {
  border-color: rgba(230, 57, 44, 0.75);
  background: linear-gradient(180deg, rgba(230, 57, 44, 0.17), var(--navy-2) 72%);
  box-shadow: 0 16px 44px -20px rgba(230, 57, 44, 0.65);
}
.sb-team.serving::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--red); box-shadow: 0 0 20px var(--red); }
.sb-team.won { border-color: var(--ice); box-shadow: 0 0 0 2px rgba(143, 217, 212, 0.35), 0 16px 44px -20px rgba(143, 217, 212, 0.6); }
.sb-ribbon { position: absolute; top: 12px; right: -34px; transform: rotate(35deg); background: var(--ice); color: var(--navy); font-size: 11px; font-weight: 800; letter-spacing: 1px; padding: 3px 40px; text-transform: uppercase; }
.sb-team-head { width: 100%; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.sb-tname {
  flex: 1; min-width: 0; background: transparent; border: none; border-bottom: 2px solid var(--navy-4); color: var(--white); outline: none; border-radius: 0;
  font-family: var(--font-display); font-size: clamp(16px, 4.4vw, 24px); letter-spacing: 1.5px; text-transform: uppercase; padding: 0 0 2px; transition: border-color 0.2s;
}
.sb-tname:focus { border-color: var(--ice); }
.sb-won { color: var(--muted); font-size: 11px; white-space: nowrap; }
.sb-won b { color: var(--ice); font-size: 13px; }
.sb-serving { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--red); min-height: 26px; }
.sb-serving i { width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 10px var(--red); animation: sbPulseText 1.4s ease-in-out infinite; }
.sb-serving b { background: var(--red); color: #fff; border-radius: 6px; padding: 1px 7px; letter-spacing: 0.5px; }
.sb-setserve { min-height: 26px; border: 1.5px solid var(--navy-4); background: transparent; color: var(--muted); border-radius: 999px; padding: 3px 16px; font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.sb-setserve:hover, .sb-setserve:active { border-color: var(--red); color: var(--red); }
.sb-score {
  font-family: var(--font-display); font-weight: 400; line-height: 0.95; letter-spacing: 2px; font-variant-numeric: tabular-nums;
  font-size: clamp(64px, 21vmin, 210px); color: rgba(244, 248, 248, 0.6); transition: color 0.2s var(--ease);
}
.sb-team.serving .sb-score { color: #fff; text-shadow: 0 0 44px rgba(230, 57, 44, 0.55); }
/* The number fills whatever height is left in its card, so the +/- and server buttons can never be pushed out of view. */
@supports (container-type: size) {
  .sb-score { flex: 1 1 0; min-height: 0; width: 100%; container-type: size; display: flex; align-items: center; justify-content: center; }
  .sb-score > span { display: block; font-size: min(calc(100cqh / 0.95), 92cqw); line-height: 0.95; }
}
.sb-flash { animation: sbPop 0.28s var(--ease); }
@keyframes sbPop { 0% { transform: scale(0.82); opacity: 0.5; } 60% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
.sb-shake { animation: sbShake 0.36s ease; }
@keyframes sbShake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-7px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
@keyframes sbPulseText { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
.sb-pm { display: flex; gap: 10px; width: 100%; max-width: 440px; }
.sb-minus { width: 60px; height: 58px; border-radius: 16px; border: 1px solid var(--navy-4); background: var(--navy-3); color: var(--muted); font-size: 30px; line-height: 1; flex-shrink: 0; }
.sb-minus:active { background: var(--navy-4); }
.sb-plus {
  flex: 1; height: 58px; border: none; border-radius: 16px; background: var(--red); color: #fff; font-size: 40px; font-weight: 700; line-height: 1;
  box-shadow: 0 12px 28px -12px rgba(230, 57, 44, 0.9); transition: transform 0.1s var(--ease), background 0.15s var(--ease);
}
.sb-plus:active:not(:disabled) { transform: scale(0.97); background: var(--red-dark); }
.sb-plus.off { background: var(--navy-3); color: var(--muted-2); box-shadow: none; }
.sb-plus:disabled { opacity: 0.3; cursor: not-allowed; }
.sb-servers { display: flex; gap: 8px; width: 100%; max-width: 440px; justify-content: center; }
.sb-srv {
  flex: 1; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 6px; background: transparent; border: 1.5px solid var(--navy-4); color: var(--muted);
  border-radius: 12px; padding: 7px 10px; font-size: 13px; font-weight: 600; transition: all 0.15s var(--ease);
}
.sb-srv span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-srv small { font-size: 10px; letter-spacing: 1px; opacity: 0.7; }
/* The number on a name is that player's points this game (a point goes to whoever is serving). */
.sb-srv > span:first-child { flex: 1 1 auto; min-width: 0; text-align: left; }
.sb-pts {
  flex-shrink: 0; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--ice-tint); color: var(--ice); font-size: 12px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums;
}
.sb-pts.zero { opacity: 0.45; }
.sb-team.serving .sb-srv.active .sb-pts { background: rgba(230, 57, 44, 0.32); color: #fff; }
.dd-ghost .sb-pts { display: none; } /* the copy that follows a dragging finger carries the name only: points stay with the spot */
/* Names on the court: tap = who is serving, hold = change the player, drag onto another name = swap places (see dragdrop.js).
   touch-action: none lets a finger drag them without the page trying to scroll. */
.sb-srv { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; cursor: grab; }
.sb-srv.dd-source { opacity: 0.35; border-style: dashed; }
.sb-court .sb-srv.dd-target { border-color: var(--ice) !important; background: rgba(143, 217, 212, 0.18) !important; color: var(--white) !important; transform: scale(1.05); box-shadow: 0 0 0 3px var(--ice-tint); }
.dd-ghost {
  position: fixed; left: 0; top: 0; z-index: 150; margin: 0; pointer-events: none; opacity: 0.96; transition: none; will-change: transform;
  background: var(--navy-2) !important; border-color: var(--ice) !important; color: var(--white) !important;
  box-shadow: 0 16px 34px -8px rgba(0, 0, 0, 0.75), 0 0 0 3px var(--ice-tint);
}
body.dd-dragging, body.dd-dragging * { cursor: grabbing !important; }
.sb-team:not(.serving) .sb-srv.active { border-color: rgba(143, 217, 212, 0.45); background: rgba(143, 217, 212, 0.07); color: var(--white); }
.sb-team.serving .sb-srv.active { border-color: var(--red); background: rgba(230, 57, 44, 0.18); color: #fff; }

.sb-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.sb-act {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 58px; padding: 6px 4px; text-align: center;
  background: var(--navy-2); border: 1px solid var(--navy-4); border-radius: 14px; color: var(--white); font-size: 12px; transition: transform 0.1s var(--ease), background 0.15s var(--ease);
}
.sb-act .ic { font-size: 16px; line-height: 1; color: var(--ice); }
.sb-act b { font-weight: 600; font-size: 12px; }
.sb-act small { font-size: 10px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-act:active:not(:disabled) { transform: scale(0.96); background: var(--navy-3); }
.sb-act:disabled { opacity: 0.38; }
.sb-act.fault { border-color: rgba(224, 167, 47, 0.55); }
.sb-act.fault .ic { color: var(--warn); }
.sb-act.save { background: var(--ice); border-color: var(--ice); color: var(--navy); }
.sb-act.save .ic { color: var(--navy); }
.sb-act.save.pulse { animation: sbGlow 1.3s ease-in-out infinite; }
@keyframes sbGlow { 0%, 100% { box-shadow: 0 0 0 0 rgba(143, 217, 212, 0.6); } 50% { box-shadow: 0 0 0 9px rgba(143, 217, 212, 0); } }

.sb-foot {
  flex-shrink: 0; display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; overflow-x: auto; white-space: nowrap; padding: 9px 14px;
  background: rgba(14, 27, 51, 0.88); border: none; border-top: 1px solid var(--navy-3); color: var(--muted); scrollbar-width: none;
}
.sb-foot::-webkit-scrollbar { display: none; }
.sb-gchip { display: inline-flex; align-items: baseline; gap: 4px; background: var(--navy-2); border: 1px solid var(--navy-3); border-radius: 999px; padding: 3px 10px; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.sb-gchip em { font-style: normal; color: var(--muted-2); font-size: 10.5px; margin-right: 2px; }
.sb-gchip b { font-weight: 600; color: var(--muted); }
.sb-gchip b.w { color: var(--ice); }
.sb-gchip.more { color: var(--muted); }
.sb-none { font-size: 12px; color: var(--muted-2); }
.sb-rule { margin-left: auto; font-size: 11.5px; color: var(--muted-2); padding-left: 12px; }

/* ---------- In-game menu sheet ---------- */
.sb-sheet-host { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.sb-scrim { position: absolute; inset: 0; background: rgba(5, 10, 20, 0.62); backdrop-filter: blur(2px); pointer-events: auto; animation: sbFade 0.2s var(--ease); }
@keyframes sbFade { from { opacity: 0; } to { opacity: 1; } }
.sb-sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 90%; pointer-events: auto; display: flex; flex-direction: column;
  background: var(--navy-2); border: 1px solid var(--navy-3); border-bottom: none; border-radius: 22px 22px 0 0; box-shadow: 0 -20px 60px -20px rgba(0, 0, 0, 0.8);
  animation: sbUp 0.26s var(--ease); -webkit-user-select: text; user-select: text;
}
@keyframes sbUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes sbSide { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sb-sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 6px; }
.sb-sheet-head b { font-family: var(--font-display); font-weight: 400; letter-spacing: 1.5px; font-size: 20px; text-transform: uppercase; }
.sb-sheet-tabs { margin: 6px 14px 0; }
.sb-sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 14px 16px calc(18px + env(safe-area-inset-bottom)); flex: 1; -webkit-overflow-scrolling: touch; }
.sb-help { display: flex; flex-direction: column; gap: 12px; }
.sb-helprow b { font-size: 13.5px; color: var(--ice); }
.sb-helprow p { margin: 3px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }

/* ---------- Points this game (in the win / save dialogs) ---------- */
.sb-ptsum { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.sb-ptsum-team { background: var(--navy); border: 1px solid var(--navy-3); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.sb-ptsum-team.win { border-color: var(--ice); background: var(--ice-tint); }
.sb-ptsum-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding-bottom: 6px; margin-bottom: 4px; border-bottom: 1px solid var(--navy-3); }
.sb-ptsum-head b { min-width: 0; font-size: 11.5px; letter-spacing: 0.5px; text-transform: uppercase; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-ptsum-head span { font-family: var(--font-display); font-size: 24px; line-height: 1; letter-spacing: 1px; }
.sb-ptsum-team.win .sb-ptsum-head b { color: var(--ice); }
.sb-ptsum-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 3px 0; font-size: 14px; }
.sb-ptsum-row span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-ptsum-row b { color: var(--ice); font-variant-numeric: tabular-nums; }
.sb-ptsum-row i { font-style: normal; color: var(--warn); }
@media (max-width: 380px) { .sb-ptsum { grid-template-columns: 1fr; } }

/* ---------- Layout: wide / landscape ---------- */
@media (min-aspect-ratio: 5/4) {
  .sb-top { grid-template-columns: auto minmax(0, 1fr) auto auto auto; padding: 8px 12px 2px; }
  .sb-strip { display: contents; }
  .sb-title { align-items: flex-start; text-align: left; }
  .sb-call { order: 3; flex: none; min-width: 150px; padding: 4px 12px; }
  .sb-timer { order: 4; padding: 4px 12px; }
  .sb-ibtn.menu { order: 5; }
  .sb-call b { font-size: 28px; }
  .sb-timer b { font-size: 26px; }
  .sb-teams { grid-template-rows: minmax(0, 1fr); grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); padding: 6px 12px 8px; }
  .sb-actions { grid-template-columns: none; grid-auto-flow: row; grid-auto-rows: minmax(52px, auto); align-content: center; width: clamp(104px, 13vw, 150px); }
  .sb-score { font-size: clamp(64px, 34vmin, 230px); }
  .sb-pm, .sb-servers { max-width: 380px; }
  .sb-minus, .sb-plus { height: 52px; }
  .sb-sheet { left: auto; top: 0; bottom: 0; right: 0; width: min(460px, 94vw); max-height: none; border-radius: 22px 0 0 22px; border: 1px solid var(--navy-3); border-right: none; animation: sbSide 0.26s var(--ease); }
}

/* Short screens (landscape phones): tighten everything so the score stays huge */
@media (max-height: 480px) {
  .sb-top { padding-top: 6px; padding-bottom: 0; }
  .sb-ibtn { width: 38px; height: 38px; }
  .sb-title b { font-size: 17px; }
  .sb-call {
    display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: 'n l' 'n s'; column-gap: 10px; row-gap: 0;
    align-items: center; min-width: 0; padding: 3px 12px;
  }
  .sb-call .sb-lbl { grid-area: l; align-self: end; }
  .sb-call b { grid-area: n; font-size: 26px; }
  .sb-call small { grid-area: s; align-self: start; }
  .sb-timer b { font-size: 24px; }
  .sb-team { padding: 6px 12px 8px; gap: 2px; border-radius: 16px; }
  .sb-tname { font-size: 19px; }
  .sb-serving, .sb-setserve { min-height: 20px; font-size: 11px; }
  .sb-score { font-size: clamp(44px, calc((100vh - 260px) / 0.95), 230px); }
  .sb-minus, .sb-plus { height: 44px; font-size: 32px; }
  .sb-minus { width: 52px; }
  .sb-srv { padding: 4px 8px; font-size: 12px; }
  .sb-pts { height: 17px; min-width: 19px; padding: 0 5px; font-size: 11px; }
  .sb-foot { padding: 5px 12px; }
  .sb-act { min-height: 44px; }
  .sb-act small { display: none; }
  .sb-won { display: none; }
}
@supports (height: 100dvh) {
  @media (max-height: 480px) {
    .sb-score { font-size: clamp(44px, calc((100dvh - 260px) / 0.95), 230px); }
  }
}

/* Narrow portrait phones: keep the call and the timer on one line */
@media (max-width: 380px) and (orientation: portrait) {
  .sb-call { min-width: 104px; }
  .sb-call b { font-size: 28px; }
  .sb-timer .sb-lbl { display: none; }
  .sb-timer b { font-size: 24px; min-width: 64px; }
  .sb-tbtn { width: 30px; height: 30px; }
  .sb-timer { gap: 6px; padding: 6px 8px; }
  .sb-act b { font-size: 11px; }
}
@media (max-width: 340px) and (orientation: portrait) {
  .sb-tbtn { width: 28px; height: 28px; }
  .sb-timer b { font-size: 22px; min-width: 56px; }
}

/* Portrait: minus, score and plus share one row so the score can be as big as the card allows */
@media (max-aspect-ratio: 99/80) {
  .sb-team {
    display: grid; grid-template-columns: minmax(76px, 22%) minmax(0, 1fr) minmax(76px, 22%); grid-template-rows: auto auto minmax(0, 1fr) auto;
    grid-template-areas: 'head head head' 'badge badge badge' 'minus score plus' 'srv srv srv';
    align-items: center; justify-content: stretch; column-gap: 8px; row-gap: 4px; padding: 10px 12px 12px;
  }
  .sb-team-head { grid-area: head; }
  .sb-serving, .sb-setserve { grid-area: badge; justify-self: center; }
  .sb-score { grid-area: score; align-self: stretch; min-width: 0; font-size: clamp(48px, calc((50vh - 215px) / 0.95), 150px); }
  .sb-pm { display: contents; }
  .sb-minus { grid-area: minus; width: 100%; height: clamp(52px, 100%, 88px); }
  .sb-plus { grid-area: plus; width: 100%; height: clamp(52px, 100%, 88px); }
  .sb-servers { grid-area: srv; max-width: none; }
}
/* ...and when there isn't much height either (most phones while the browser toolbars are showing), tighten the chrome */
@media (max-aspect-ratio: 99/80) and (max-height: 799px) {
  .sb-top { padding: 8px 12px 0; gap: 6px 10px; }
  .sb-strip { gap: 8px; }
  .sb-call { flex: 1 1 auto; min-width: 104px; padding: 3px 10px; }
  .sb-call .sb-lbl, .sb-timer .sb-lbl { display: none; }
  .sb-call b { font-size: 26px; }
  .sb-timer { padding: 4px 8px; gap: 8px; }
  .sb-teams { gap: 6px; padding: 6px 12px; }
  .sb-team { padding: 8px 12px 10px; }
  .sb-serving, .sb-setserve { min-height: 22px; }
  .sb-srv { padding: 5px 9px; }
  .sb-act { min-height: 52px; padding: 4px; }
  .sb-foot { padding: 6px 14px; }
}
/* ...and squeeze a little more out of very short screens (an iPhone SE with Safari's bars showing) */
@media (max-aspect-ratio: 99/80) and (max-height: 620px) {
  .sb-title span, .sb-call small, .sb-act small { display: none; }
  .sb-top { padding-top: 6px; }
  .sb-ibtn { width: 38px; height: 38px; }
  .sb-call b { font-size: 24px; }
  .sb-team { padding: 6px 12px 8px; row-gap: 2px; }
  .sb-tname { font-size: 18px; }
  .sb-serving, .sb-setserve { min-height: 20px; font-size: 11px; }
  .sb-srv { padding: 3px 9px; font-size: 12px; }
  .sb-pts { height: 17px; min-width: 19px; padding: 0 5px; font-size: 11px; }
  .sb-minus, .sb-plus { height: clamp(44px, 100%, 88px); }
  .sb-act { min-height: 44px; }
  .sb-foot { padding: 4px 14px; }
}

@media (max-width: 860px) {
  .sb-opt-meta { flex-direction: column; align-items: flex-end; gap: 4px; }
  .sb-edit-court { grid-template-columns: 1fr; }
  .sb-edit-vs { display: none; }
}
@media (max-width: 520px) {
  .sb-start { flex-direction: column; align-items: stretch; gap: 12px; }
  .sb-start-actions { flex-direction: row; align-items: center; }
  .sb-start-actions .sb-go { flex: 1; }
  .sb-game-teams { grid-template-columns: 1fr; }
  .sb-game-vs { display: none; }
  .sb-rot { grid-template-columns: 1fr; }
  .sb-go { padding: 13px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .sb-court, .sb-sheet, .sb-scrim, .sb-flash, .sb-shake, .sb-serving i, .sb-timer b.low, .sb-act.save.pulse { animation: none; }
}

/* A small link at the end of a leaderboard row (the DUPR tab's "DUPR ↗"), and in its footnotes. */
.sb-lb-link { color: var(--ice); font-size: 12px; font-weight: 600; white-space: nowrap; text-decoration: none; }
.sb-lb-link:hover { text-decoration: underline; }

/* "Won't be sent to DUPR" notes: in the save dialogs, and under the teams on the Start card. They only inform. */
.sb-dupr-warn { margin-top: 12px; font-size: 12.5px; line-height: 1.45; color: var(--warn); background: var(--warn-tint); border: 1px solid rgba(224, 167, 47, 0.35); border-radius: var(--radius-sm); padding: 9px 11px; }
.sb-start-hint.warn { color: var(--warn); }
