@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap");

* { box-sizing: border-box; }
html {
  /* Keep document scrollable on mobile (avoid clipped stream cards / Watch links). */
  height: auto;
  min-height: 100%;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-x: clip;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
body {
  font-family: Poppins, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  margin: 0;
  padding: 0;
  min-height: 100%;
  width: 100%;
  max-width: 100%;
  background: #1a1b26;
  color: #c0caf5;
  line-height: 1.4;
  overflow-x: hidden;
  overflow-x: clip;
  overflow-y: visible;
}
header {
  padding: 1rem 1.25rem;
  background: #16161e;
  border-bottom: 1px solid #292e42;
}
.mobile-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.mobile-header-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  flex: 1;
}
.mobile-header-row h1 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.25;
}
.conn-status {
  position: relative;
  flex-shrink: 0;
  width: 1.35rem;
  height: 1.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #f7768e;
  cursor: default;
}
.conn-status .conn-icon {
  position: absolute;
  width: 1.35rem;
  height: 1.35rem;
  display: none;
  fill: currentColor;
}
.conn-status.connected { color: #9ece6a; }
.conn-status.waiting { color: #e0af68; }
.conn-status.reconnecting { color: #e0af68; }
.conn-status.disconnected { color: #f7768e; }
.conn-status.connected .conn-icon-connected,
.conn-status.waiting .conn-icon-waiting,
.conn-status.reconnecting .conn-icon-waiting,
.conn-status.disconnected .conn-icon-disconnected {
  display: block;
}
.mobile-header-row .btn { margin: 0; flex-shrink: 0; font-size: 0.85rem; padding: 0.4rem 0.75rem; }
h1 { margin: 0 0 0.25rem; font-size: 1.35rem; }
.subtitle { margin: 0; opacity: 0.75; font-size: 0.9rem; }
main { padding: 1rem 1.25rem; max-width: 720px; margin: 0 auto; }
.hidden { display: none !important; }
.btn {
  background: #414868;
  color: #c0caf5;
  border: none;
  padding: 0.55rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  margin: 0.25rem 0;
}
.btn.primary { background: #7aa2f7; color: #1a1b26; font-weight: 600; }
.btn.block { display: block; width: 100%; }
.btn.danger { background: #f7768e; color: #1a1b26; }
.btn.success,
.btn.save {
  background: #9ece6a;
  color: #1a1b26;
  font-weight: 600;
}
.btn.cancel {
  background: #414868;
  color: #f7768e;
  border: 1px solid rgba(247, 118, 142, 0.45);
}
.btn.cancel:hover {
  background: rgba(247, 118, 142, 0.16);
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.monitor-active { background: #f7768e; color: #1a1b26; font-weight: 600; }
.btn.replay-active { background: #e0af68; color: #1a1b26; font-weight: 600; }
.btn.stream-active { background: #f7768e; color: #1a1b26; font-weight: 600; }
.btn.stats-active {
  background: #7aa2f7;
  color: #1a1b26;
  font-weight: 600;
  opacity: 1;
  border-color: rgba(122, 162, 247, 0.85);
}
.btn.stats-inactive {
  background: rgba(36, 40, 59, 0.72);
  color: #565f89;
  border-color: rgba(86, 95, 137, 0.35);
  opacity: 0.72;
  font-weight: 500;
}
.btn.stats-inactive:hover {
  opacity: 0.95;
  color: #a9b1d6;
  border-color: rgba(169, 177, 214, 0.45);
}
.stream-section { margin-top: 0.35rem; }
.stream-section .share-links-heading { margin-top: 0.75rem; }
.stream-stats-mode-row {
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
}
.stream-stats-mode-row > .btn {
  width: 100%;
  box-sizing: border-box;
}
#streamStatsSection.stream-stats-disabled {
  opacity: 0.55;
}
#streamStatsSection.stream-stats-disabled .hint {
  opacity: 1;
}
.stream-stats-panel {
  margin: 0.65rem 0 0.25rem;
  padding: 0.75rem 0.85rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
}
.stream-stats-title {
  margin: 0 0 0.55rem;
  font-size: 1.05rem;
  font-weight: 700;
  text-align: center;
  color: #c0caf5;
}
.stream-stats-title.stream-stats-player-name {
  font-size: 1.2rem;
  letter-spacing: 0.01em;
}
.stream-stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.stream-stats-table th,
.stream-stats-table td {
  padding: 0.35rem 0.4rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.stream-stats-table thead th {
  color: #a9b1d6;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.stream-stats-row-even td { background: rgba(255, 255, 255, 0.02); }
.stream-stats-row-odd td { background: transparent; }
.stream-stats-h2h-table .stream-stats-col-player {
  text-align: center;
  width: 28%;
}
.stream-stats-h2h-table .stream-stats-col-label {
  text-align: center;
  color: #a9b1d6;
  font-size: 0.82rem;
}
.stream-stats-h2h-table .stream-stats-col-value {
  text-align: center;
  font-weight: 700;
  color: #c0caf5;
}
.stream-stats-player-table .stream-stats-col-label {
  text-align: left;
  color: #a9b1d6;
}
.stream-stats-player-table .stream-stats-col-value {
  text-align: right;
  font-weight: 700;
  color: #c0caf5;
}
.stream-stats-col-value.stream-stats-danger { color: #f7768e; }
.stream-stats-col-value.stream-stats-safe { color: #9ece6a; }
.stream-stats-empty {
  text-align: center;
  color: #a9b1d6;
  padding: 0.5rem 0.25rem;
  font-size: 0.9rem;
}
.row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 0.5rem 0; }
.row.clips {
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
}
.row.clips > .btn {
  width: 100%;
  /* Match .clip-wrap height (play button stretched to .clip-clear) */
  min-height: calc(1.25rem + 1.1rem);
  box-sizing: border-box;
}
.clip-wrap {
  display: flex;
  align-items: stretch;
  gap: 0.25rem;
  width: 100%;
  flex: none;
}
.clip-wrap .btn[data-cmd="play_clip"] { flex: 1; margin: 0.25rem 0; }
.clip-wrap .clip-clear {
  flex: 0 0 2.5rem;
  padding: 0.55rem 0;
  margin: 0.25rem 0;
  font-size: 1.25rem;
  line-height: 1;
  font-weight: 700;
}
.panel {
  background: #24283b;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.panel h2 { margin: 0 0 0.5rem; font-size: 1rem; }
input, select {
  width: 100%;
  padding: 0.5rem;
  border-radius: 6px;
  border: 1px solid #414868;
  background: #1a1b26;
  color: #c0caf5;
  margin-bottom: 0.5rem;
}
.hint { font-size: 0.85rem; opacity: 0.85; margin: 0 0 0.75rem; line-height: 1.35; }
.btn.secondary { background: #444; color: #eee; margin-top: 0.5rem; }
.error { color: #f7768e; margin-top: 0.75rem; }
.btn.selected { outline: 2px solid #7aa2f7; background: #565f89; }
.live-board {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #16161e;
  border: 1px solid #292e42;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.85rem;
}
.live-ball-section {
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid #292e42;
}
.live-score-controls {
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px solid #292e42;
}
.live-meta {
  margin: 0 0 0.45rem;
  font-size: 0.75rem;
  opacity: 0.75;
  text-align: center;
}
.live-inline-panel {
  margin: 0.35rem 0 0;
  padding: 0.55rem 0.65rem;
  background: #1a1b26;
  border-radius: 8px;
}
.live-inline-panel h2 {
  margin: 0 0 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0.9;
}
#playerSlotQuestion {
  text-align: center;
}
.ball-grid-live {
  justify-content: center;
}
.rack-foul-counter {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin: 0.45rem 0 0;
  font-size: 0.85rem;
  line-height: 1.2;
  opacity: 0.95;
}
.rack-foul-counter.hidden { display: none; }
.rack-stat-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.4rem 0.55rem;
}
.rack-stat-row.hidden { display: none; }
.rack-break-group,
.rack-remaining-group {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.rack-break-group.hidden,
.rack-foul-sep.hidden { display: none; }
.rack-stat-value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.rack-break-balls {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.rack-break-ball {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 50%;
  border: 2px solid var(--break-ball-color, #90a4ae);
  color: var(--break-ball-color, #90a4ae);
  background: transparent;
  font-size: 0.65rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  box-sizing: border-box;
}
.rack-foul-heading {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  opacity: 0.7;
}
.rack-foul-player {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
}
.rack-foul-name {
  max-width: 20ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.85;
}
.rack-foul-count {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 0.9em;
  text-align: center;
}
.rack-foul-sep { opacity: 0.45; font-weight: 700; }
.rack-foul-player.is-active .rack-foul-name,
.rack-foul-player.is-active .rack-foul-count { opacity: 1; }
.rack-foul-player:not(.is-active) { opacity: 0.55; }
.dev-login { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #414868; }
.dash-login-pane {
  margin-top: 0.75rem;
}
.dash-login-intro {
  margin: 0 0 1rem;
}
.dash-login-intro p {
  margin: 0 0 0.65rem;
}
.dash-login-intro p:last-child {
  margin-bottom: 0;
}
.dash-login-intro ul {
  margin: 0 0 0.65rem;
  padding-left: 1.25rem;
}
.dash-login-intro li {
  margin: 0.2rem 0;
}
.dash-login-switch {
  margin: 0.85rem 0 0;
}
.dash-text-link {
  color: #7aa2f7;
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.92em;
}
.dash-text-link:hover {
  color: #9ece6a;
}
.password-field {
  position: relative;
  display: flex;
  align-items: stretch;
  margin: 0.35rem 0 0.5rem;
}
.password-field input {
  flex: 1;
  width: 100%;
  margin: 0;
  padding-right: 2.6rem;
}
.password-toggle {
  position: absolute;
  right: 0.25rem;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #a9b1d6;
  cursor: pointer;
}
.password-toggle:hover,
.password-toggle:focus-visible {
  color: #c0caf5;
  background: rgba(122, 162, 247, 0.12);
  outline: none;
}
.password-toggle svg {
  width: 1.1rem;
  height: 1.1rem;
  display: block;
}
code { font-size: 0.8rem; word-break: break-all; }
ul { padding-left: 1.2rem; }
.stream-list { list-style: none; padding: 0; margin: 0; }
.stream-card {
  background: #24283b;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  overflow: visible;
}
.stream-card h3 {
  margin: 0 0 0.35rem;
  word-break: break-word;
}
.stream-card .score { font-size: 1.25rem; font-weight: 700; margin: 0.25rem 0; }
.stream-card a,
.stream-card .stream-watch {
  display: inline-block;
  color: #7aa2f7;
  margin-top: 0.5rem;
  padding: 0.35rem 0;
  /* Large tap target; keep visible above mobile browser chrome */
  min-height: 2.5rem;
  line-height: 1.4;
}
.mobile .score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  margin: 0.3rem 0;
}
.mobile .score-row > span:first-child {
  flex: 1;
  min-width: 0;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mobile .score-row .score-value {
  min-width: 2rem;
  text-align: center;
  font-weight: 700;
  font-size: 1.15rem;
}
.mobile .score-row .btn {
  min-width: 2.4rem;
  padding: 0.4rem 0.55rem;
  font-size: 1rem;
}
.field-row {
  display: flex;
  gap: 0.4rem;
  align-items: stretch;
  margin-bottom: 0.5rem;
}
.field-row input,
.field-row select {
  flex: 1;
  width: auto;
  margin-bottom: 0;
  font-size: 1rem;
}
.field-row .autocomplete-wrapper {
  flex: 1;
  position: relative;
  min-width: 0;
}
.field-row .autocomplete-wrapper input {
  width: 100%;
}
.autocomplete-wrapper {
  position: relative;
}
.autocomplete-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 20;
  margin-top: 0.15rem;
  background: #1a1b26;
  border: 1px solid #414868;
  border-radius: 6px;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
.autocomplete-list.autocomplete-browse {
  max-height: 280px;
}
.autocomplete-item {
  padding: 0.55rem 0.65rem;
  cursor: pointer;
  border-bottom: 1px solid #292e42;
  font-size: 0.9rem;
}
.autocomplete-item:last-child {
  border-bottom: none;
}
.autocomplete-item:hover,
.autocomplete-item.autocomplete-active {
  background: #414868;
}
.autocomplete-name {
  display: block;
  font-weight: 600;
}
.autocomplete-preview {
  display: block;
  font-size: 0.75rem;
  opacity: 0.75;
  margin-top: 0.1rem;
}
.autocomplete-new {
  color: #7aa2f7;
  font-style: italic;
}
.setup-variant-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.setup-option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 44px;
  padding: 0.55rem 0.75rem;
  border: 1px solid #414868;
  border-radius: 6px;
  background: #1a1b26;
  cursor: pointer;
  margin: 0;
  font-size: 1rem;
  font-weight: 400;
  color: #c0caf5;
  box-sizing: border-box;
}
.setup-option-row span {
  flex: 1;
  min-width: 0;
}
.setup-option-check {
  width: 1.35rem;
  height: 1.35rem;
  margin: 0;
  flex-shrink: 0;
  accent-color: #7aa2f7;
  cursor: pointer;
}
.setup-option-row:has(.setup-option-check:checked) {
  border-color: #7aa2f7;
  background: rgba(122, 162, 247, 0.1);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.panel-head h2 { margin: 0; }
.icon-btn {
  flex: 0 0 2.75rem;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 6px;
  background: #414868;
  color: #c0caf5;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn svg {
  width: 1.3rem;
  height: 1.3rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-btn img { width: 1.5rem; height: 1.5rem; display: block; }
.icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.icon-btn.save-pending {
  background: #9ece6a;
  color: #1a1b26;
}
.icon-btn.save-pending:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.row.equal { display: flex; flex-wrap: nowrap; gap: 0.4rem; margin: 0.35rem 0; }
.row.equal .btn { flex: 1; margin: 0; min-width: 0; font-size: 0.85rem; padding: 0.55rem 0.35rem; }
.row.equal .btn.rack-breaker-inactive { opacity: 0.35; }
.row.equal .btn.rack-breaker-current:disabled {
  opacity: 1;
  cursor: default;
}
.row.equal .btn.rack-breaker-match-locked { opacity: 0.55; }
#playerSlotP1Btn,
#playerSlotP2Btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}
#playerSlotP1Btn .slot-name,
#playerSlotP2Btn .slot-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#playerSlotP1Btn .slot-ball,
#playerSlotP2Btn .slot-ball {
  width: 1.35rem;
  height: 1.35rem;
  flex: 0 0 auto;
  border-radius: 50%;
  object-fit: contain;
}
#playerSlotP1Btn.rack-breaker-last-winner .slot-name,
#playerSlotP2Btn.rack-breaker-last-winner .slot-name,
#playerSlotP1Btn.rack-breaker-last-winner,
#playerSlotP2Btn.rack-breaker-last-winner {
  text-decoration: underline;
  text-underline-offset: 0.18em;
}
.ball-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.ball-btn {
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}
.ball-btn img { width: 100%; height: 100%; display: block; pointer-events: none; }
.ball-btn.faded { opacity: 0.2; }
.ball-btn:disabled,
.ball-btn.is-disabled {
  opacity: 0.35;
  cursor: not-allowed;
  filter: grayscale(0.4);
  pointer-events: none;
}
.ball-btn.ball-cooldown:disabled,
.ball-btn.ball-cooldown.is-disabled {
  opacity: 0.35;
  filter: grayscale(0.4);
}
.ball-btn.ball-clicked {
  opacity: 0.25;
  transform: scale(0.92);
}
.ball-grid.awaiting-breaker .ball-btn:not(.undo-ball) {
  opacity: 0.35;
  pointer-events: none;
  cursor: default;
  filter: grayscale(0.4);
}
.ball-grid-hint {
  font-size: 0.8rem;
  opacity: 0.8;
  margin: 0 0 0.4rem;
}
.ball-btn.undo-ball { opacity: 1; filter: none; }
.ball-btn.undo-ball:disabled { opacity: 0.35; filter: grayscale(0.4); }
.clips { flex-wrap: wrap; }

/* Landing + dashboard */
.site-header {
  padding: 1rem 1.25rem;
  background: #16161e;
  border-bottom: 1px solid #292e42;
}
.site-header-inner {
  max-width: var(--content-max, 720px);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.site-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.site-version {
  margin-left: 0.35rem;
  font-size: 0.72em;
  font-weight: 600;
  color: #a9b1d6;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.site-nav {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
/* Home already has Dashboard + Browse Live Streams in the hero — don't duplicate in the header. */
body.landing-home .site-nav {
  display: none;
}
/* On /streams you're already viewing the list — keep only Sign In / Dashboard. */
body.streams-page .site-nav-streams {
  display: none;
}
.site-nav .btn,
.hero-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin: 0;
  box-sizing: border-box;
  line-height: 1.2;
  font-size: 1rem;
  padding: 0.55rem 1rem;
}
.site-nav .btn .site-nav-icon,
.hero-actions .btn .site-nav-icon {
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
  display: block;
}
.site-nav .btn.account-menu-btn[aria-expanded="true"] {
  outline: 2px solid #7aa2f7;
  outline-offset: 0;
}
@media (max-width: 720px) {
  .site-nav .btn {
    min-width: 2.5rem;
    padding: 0.55rem 0.65rem;
  }
  .site-nav .site-nav-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
}
.header-user-email {
  margin: 0;
  font-size: 0.85rem;
  opacity: 0.85;
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-menu {
  position: relative;
}
.account-menu-panel {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  z-index: 30;
  min-width: 14rem;
  padding: 0.75rem;
  background: #16161e;
  border: 1px solid #292e42;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.account-menu-email {
  margin: 0 0 0.65rem;
  font-size: 0.85rem;
  word-break: break-all;
  opacity: 0.9;
}
.landing-main,
.dashboard-main {
  max-width: var(--content-max, 720px);
  width: 100%;
  margin: 0 auto;
  padding: 1rem 1.25rem calc(2.5rem + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
  min-width: 0;
  overflow-x: hidden;
  overflow-x: clip;
}
/* Dashboard: phone-friendly by default, room to breathe on desktop */
.dashboard-main {
  --content-max: 720px;
}
@media (min-width: 900px) {
  .dashboard-main {
    --content-max: 1100px;
  }
}
body.streams-page .landing-marketing {
  display: none;
}
body.streams-page .live-now-panel {
  margin-top: 0;
}
body.streams-page .landing-main {
  /* Extra bottom space so the last Watch Stream control is scrollable into view on phones */
  padding-bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
}
.stream-meta, .stream-subscore {
  font-size: 0.85rem;
  opacity: 0.8;
  margin: 0.35rem 0 0;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}
/*
 * App shell when signed in: header + scrollable main + in-flow tab bar.
 * Avoids position:fixed — wide tables on Android expand the layout viewport
 * and drag fixed footers off-screen both horizontally and vertically.
 */
body.has-dash-nav {
  --content-max: 720px;
  display: flex;
  flex-direction: column;
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}
@media (min-width: 900px) {
  body.has-dash-nav {
    --content-max: 1100px;
  }
}
body.has-dash-nav > .site-header {
  flex: 0 0 auto;
}
body.has-dash-nav > .site-header .site-header-inner {
  max-width: var(--content-max);
}
body.has-dash-nav > .dashboard-main {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 1rem 1.25rem 1rem;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
body.has-dash-nav > .dash-tabs {
  flex: 0 0 auto;
  position: static;
  left: auto;
  right: auto;
  bottom: auto;
  width: 100%;
  max-width: none;
  display: flex;
}
body.has-dash-nav .dash-tabs[hidden] {
  display: none;
}
#dashboardSection,
.dash-tab-panel,
.stats-subpanel {
  max-width: 100%;
  min-width: 0;
}
.hero h2 { margin-top: 0; }
.hero-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}
.feature-grid {
  display: grid;
  gap: 0.75rem;
  margin: 1rem 0;
}
@media (min-width: 640px) {
  .feature-grid { grid-template-columns: repeat(3, 1fr); }
}
.dash-tabs {
  display: none;
  position: static;
  z-index: 20;
  gap: 0.25rem;
  margin: 0;
  padding: 0.5rem 0.4rem calc(0.5rem + env(safe-area-inset-bottom, 0px));
  background: #16161e;
  border-top: 1px solid #292e42;
  width: 100%;
  box-sizing: border-box;
}
.dash-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  margin: 0;
  padding: 0.4rem 0.2rem 0.45rem;
  border: none;
  border-radius: 8px;
  background: #24283b;
  color: #c0caf5;
  cursor: pointer;
  font-size: 0.65rem;
  font-weight: 600;
  min-height: 3rem;
  min-width: 0;
}
.dash-tab span {
  line-height: 1.1;
}
.dash-tab-icon {
  width: 1.2rem;
  height: 1.2rem;
  fill: currentColor;
  flex-shrink: 0;
}
.dash-tab.active {
  background: #414868;
  outline: 2px solid #7aa2f7;
  color: #c0caf5;
}
.account-email {
  margin: 0 0 0.75rem;
  word-break: break-all;
  opacity: 0.9;
}
.account-session-actions {
  margin: 0.25rem 0 0.75rem;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 0.75rem;
}
.account-session-actions .btn {
  margin: 0;
}
.account-session-actions .btn.secondary {
  margin-top: 0;
}
#tabSettings .panel .account-session-actions .btn {
  margin-right: 0;
  margin-bottom: 0;
}
.dash-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  white-space: nowrap;
}
.dash-action-icon {
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
  display: block;
}
.dash-action-label {
  line-height: 1.1;
}
#tabSettings .panel .btn {
  margin-right: 0.5rem;
  margin-bottom: 0.5rem;
}
@media (max-width: 720px) {
  .account-session-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .account-session-actions .dash-action-btn,
  .token-list-actions .dash-action-btn {
    min-width: 2.75rem;
    padding: 0.5rem 0.65rem;
  }
  .account-session-actions .dash-action-label,
  .token-list-actions .dash-action-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
}
.table-cards {
  display: grid;
  gap: 0.75rem;
}
.admin-search {
  max-width: 28rem;
  margin: 0.75rem 0;
}
#adminAccountsTable tbody tr {
  cursor: pointer;
}
#adminAccountsTable tbody tr:hover,
#adminAccountsTable tbody tr:focus-visible {
  background: rgba(122, 162, 247, 0.12);
}
#adminAccountsTable tbody tr.admin-row-selected {
  background: rgba(122, 162, 247, 0.2);
}
.admin-detail-meta {
  display: grid;
  gap: 0.35rem;
  margin: 0 0 1rem;
  font-size: 0.9rem;
}
.admin-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0 1rem;
}
.admin-trial-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem;
  margin: 0.5rem 0 1rem;
}
.admin-trial-form label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
}
.admin-trial-form input {
  width: 5rem;
}
.admin-key-list,
.admin-room-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.admin-key-list li,
.admin-room-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.admin-stats-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0.5rem 0 0;
}
.admin-stats-summary span {
  font-size: 0.85rem;
  opacity: 0.85;
}
a.table-card {
  display: block;
  color: inherit;
  text-decoration: none;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
  cursor: pointer;
}
a.table-card:hover,
a.table-card:focus-visible {
  border-color: #7aa2f7;
  outline: none;
}
.table-card h3 {
  margin: 0.2rem 0 0.45rem;
  font-size: 1rem;
}
.table-status {
  margin: 0;
  font-size: 0.75rem;
  opacity: 0.7;
}
.table-status.online { color: #9ece6a; opacity: 1; }
.table-account-email,
.stats-account-email {
  margin: 0.1rem 0 0;
  font-size: 0.78rem;
  font-weight: 500;
  opacity: 0.75;
  word-break: break-word;
}
.table-players { margin: 0.15rem 0; font-weight: 600; }
.table-score { margin: 0; font-size: 1.15rem; font-weight: 700; }
.table-score-current {
  margin-top: 0.15rem;
  font-size: 1rem;
  font-weight: 600;
  opacity: 0.92;
}
.table-score-primary {
  margin-top: 0.1rem;
}
.user-email { opacity: 0.9; margin-bottom: 0.25rem; }
.copy-notice {
  margin: 0.35rem 0 0.5rem;
  font-size: 0.85rem;
  color: #9ece6a;
}
.api-key-summary {
  word-break: break-all;
}
.api-key-summary.is-revealed {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  color: #c0caf5;
}
.api-key-summary.is-revealed:hover,
.api-key-summary.is-revealed:focus-visible {
  color: #7aa2f7;
  outline: none;
}
.api-key-summary .api-key-copy-icon {
  flex-shrink: 0;
  width: 0.95rem;
  height: 0.95rem;
  opacity: 0.85;
}
.api-key-summary.is-copied {
  color: #9ece6a;
  font-family: inherit;
  font-size: inherit;
  cursor: default;
}
.token-list-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
  flex-wrap: wrap;
  align-items: center;
}
.token-list-actions .btn {
  margin: 0;
}
.token-list-actions .btn.secondary {
  margin-top: 0;
}
.token-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.token-list-item .btn {
  margin: 0;
  flex-shrink: 0;
  font-size: 0.85rem;
  padding: 0.35rem 0.65rem;
}

/* Mobile snooker foul picker */
.mobile-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.mobile-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}
.mobile-modal-sheet {
  position: relative;
  width: 100%;
  max-width: 720px;
  max-height: 85vh;
  overflow: auto;
  background: #24283b;
  border-radius: 12px 12px 0 0;
  padding: 0.85rem 1rem 1.25rem;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.35);
}
.mobile-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.mobile-modal-head h2 {
  margin: 0;
  font-size: 1rem;
}
.mobile-modal-close {
  flex: 0 0 2.5rem;
  width: 2.5rem;
  height: 2.5rem;
  font-size: 1.5rem;
  line-height: 1;
}
.snooker-foul-hint {
  min-height: 1.25rem;
  margin: 0 0 0.65rem;
  font-size: 0.85rem;
  color: #7aa2f7;
  text-align: center;
}
.confirm-modal-message {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  line-height: 1.45;
  opacity: 0.92;
}
.confirm-modal-actions { margin-top: 0.25rem; }
.snooker-foul-targets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}
.foul-target-btn {
  width: 3.25rem;
  height: 3.25rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}
.foul-target-btn img {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}
.ball-btn.freeball-btn:not(:disabled):not(.is-disabled) {
  box-shadow: 0 0 0 2px #7aa2f7;
}

body.mobile.has-mobile-nav {
  padding-bottom: calc(4.25rem + env(safe-area-inset-bottom, 0px));
}
.mobile-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem 0.4rem calc(0.5rem + env(safe-area-inset-bottom, 0px));
  background: #16161e;
  border-top: 1px solid #292e42;
}
.mobile-nav-btn {
  flex: 1;
  margin: 0;
  padding: 0.4rem 0.2rem 0.45rem;
  border: none;
  border-radius: 8px;
  background: #24283b;
  color: #c0caf5;
  font-size: 0.65rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-height: 3rem;
  min-width: 0;
}
.mobile-nav-btn span {
  line-height: 1.1;
}
.mobile-nav-icon {
  width: 1.2rem;
  height: 1.2rem;
  fill: currentColor;
  flex-shrink: 0;
}
.mobile-nav-btn.active {
  background: #414868;
  outline: 2px solid #7aa2f7;
}
a.mobile-nav-btn {
  display: flex;
}
.mobile-view { min-height: 1px; }
/* Pause scoring/setup/replay while waiting for dock or disconnected; Share stays usable. */
body.controls-locked #viewControl,
body.controls-locked #viewSetup,
body.controls-locked #viewReplay {
  opacity: 0.55;
  pointer-events: none;
  user-select: none;
}
/* Keep reconnect CTA tappable while scoring is locked. */
body.controls-locked #reconnectBanner {
  opacity: 1;
  pointer-events: auto;
}
.reconnect-banner {
  margin: 0 0 0.85rem;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(247, 118, 142, 0.45);
  background: rgba(247, 118, 142, 0.12);
  text-align: center;
}
.reconnect-banner p {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
}
.reconnect-banner .btn {
  margin: 0;
}
.share-panel h2 { margin-top: 0; text-align: center; }
.share-limitations { text-align: center; margin-bottom: 1rem; }
.share-qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin: 0.75rem 0;
}
.share-qr-wrap.dash-guest-qr-wrap {
  flex-direction: row;
  justify-content: center;
}
.share-qr {
  width: 220px;
  height: 220px;
  background: #fff;
  border-radius: 8px;
  padding: 0.5rem;
}
.share-url {
  font-size: 0.8rem;
  word-break: break-all;
  text-align: center;
  opacity: 0.85;
  margin: 0.5rem 0 0.75rem;
}
.share-actions { margin-top: 0.25rem; }
.share-links-heading {
  margin: 1.25rem 0 0.35rem;
  font-size: 1rem;
}
.guest-link-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  width: 100%;
  text-align: left;
}
.token-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.55rem 0;
  border-top: 1px solid #292e42;
  font-size: 0.85rem;
}
.token-list-item.guest-link-item {
  cursor: pointer;
  border-radius: 6px;
  padding: 0.55rem 0.5rem;
  border-top: 1px solid #292e42;
  transition: background 0.15s ease;
}
.token-list-item.guest-link-item:hover {
  background: rgba(125, 207, 255, 0.08);
}
.token-list-item.guest-link-item.is-current {
  background: rgba(125, 207, 255, 0.14);
  outline: 1px solid rgba(125, 207, 255, 0.35);
}
.token-list-item > .api-key-summary,
.token-list-item > span {
  flex: 1 1 auto;
  min-width: 0;
  word-break: break-word;
}
.token-list-item.is-current span {
  color: #7dcfff;
}
.dash-guest-panel .share-links-heading {
  margin-top: 1.5rem;
}
.dash-guest-room-filter {
  margin: 0.75rem 0 0.25rem;
  max-width: 28rem;
}
.dash-guest-qr-wrap {
  position: relative;
  min-height: 244px;
  justify-content: center;
}
.dash-guest-qr-placeholder {
  width: 220px;
  height: 220px;
  border-radius: 8px;
  background:
    repeating-linear-gradient(
      -45deg,
      rgba(255, 255, 255, 0.06),
      rgba(255, 255, 255, 0.06) 8px,
      rgba(0, 0, 0, 0.2) 8px,
      rgba(0, 0, 0, 0.2) 16px
    );
  border: 1px solid rgba(255, 255, 255, 0.12);
  filter: blur(6px);
}
.dash-guest-qr-wrap.is-obscured .share-qr {
  filter: blur(14px);
  opacity: 0.45;
  pointer-events: none;
}
.dash-guest-reveal-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.dash-guest-reveal-overlay .btn {
  pointer-events: auto;
}
.dash-guest-qr-wrap:not(.is-obscured) .dash-guest-reveal-overlay {
  align-items: flex-start;
  justify-content: flex-end;
  padding: 0.5rem 0.5rem 0 0;
}
.dash-guest-url.is-obscured {
  color: rgba(255, 255, 255, 0.55);
  font-style: italic;
}
.dash-guest-owner-badge {
  flex-shrink: 0;
  font-size: 0.75rem;
  opacity: 0.75;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.dash-guest-link-meta {
  flex: 1 1 auto;
  min-width: 0;
  word-break: break-word;
}
.dash-guest-create-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0.75rem 0 0.25rem;
}
.dash-guest-create-row input {
  flex: 1 1 12rem;
  min-width: 0;
  padding: 0.55rem 0.7rem;
  border-radius: 6px;
  border: 1px solid #3a415c;
  background: #161925;
  color: inherit;
  font: inherit;
}
.dash-guest-share-actions {
  justify-content: center;
  gap: 0.5rem;
}
.dash-guest-revoke-all {
  margin-top: 1.25rem;
  padding-top: 0.75rem;
  border-top: 1px solid #292e42;
}
.token-list-item .btn {
  flex-shrink: 0;
  margin: 0;
}
@media (max-width: 720px) {
  .token-list-item {
    align-items: flex-start;
  }
  .token-list-item > .api-key-summary,
  .token-list-item > span:first-child,
  .token-list-item > .debug-room-meta {
    flex: 1 1 100%;
  }
  .token-list-actions {
    flex: 1 1 100%;
    justify-content: flex-start;
  }
}
.debug-room-item {
  align-items: flex-start;
}
.debug-room-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1;
  min-width: 0;
  font-size: 0.82rem;
}
.debug-room-title-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}
.debug-room-title {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.25;
  color: #c0caf5;
  overflow-wrap: anywhere;
}
.debug-room-details {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.debug-room-rename-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
}
.debug-room-rename-inline input {
  flex: 1 1 10rem;
  min-width: 8rem;
  max-width: 20rem;
}
.dash-share-key-actions {
  flex-wrap: wrap;
}
.stats-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin: 0 0 0.85rem;
}
.stats-divider {
  border: none;
  border-top: 1px solid #292e42;
  margin: 0 0 0.85rem;
}
#statsPlayerSummary.stats-summary {
  grid-template-columns: repeat(var(--stats-summary-cols, 3), minmax(0, 1fr));
}
.stats-summary-card {
  background: #1a1b26;
  border: 1px solid #292e42;
  border-radius: 8px;
  padding: 0.65rem 0.7rem;
  text-align: center;
}
.stats-summary-card strong {
  display: block;
  font-size: 1.25rem;
  color: #7aa2f7;
}
.stats-summary-card span {
  font-size: 0.75rem;
  opacity: 0.75;
}
.stats-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  margin-bottom: 0.75rem;
}
.stats-player-search {
  min-width: 12rem;
  flex: 1 1 12rem;
  max-width: 18rem;
}
.stats-player-search input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  background: #1a1b26;
  color: #c0caf5;
  border: 1px solid #414868;
  border-radius: 6px;
  font-size: 1rem;
  line-height: 1.15;
  padding: 0.55rem 0.75rem;
  min-height: 2.25rem;
  margin: 0.25rem 0;
}
.stats-player-heading {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0.35rem 0 0.85rem;
  min-height: 2.25rem;
}
.stats-player-title-view {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  max-width: 100%;
}
.stats-player-title-view.hidden {
  display: none;
}
#statsPlayerTitle {
  margin: 0;
  text-align: center;
  overflow-wrap: anywhere;
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.25;
}
.stats-player-edit-btn {
  appearance: none;
  background: transparent;
  border: none;
  color: #7aa2f7;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stats-player-edit-btn:hover {
  color: #89b4fa;
  background: rgba(122, 162, 247, 0.16);
}
.stats-player-delete-btn {
  color: #f7768e;
}
.stats-player-delete-btn:hover {
  color: #ff9db0;
  background: rgba(247, 118, 142, 0.16);
}
.stats-player-edit-btn svg {
  width: 1.15rem;
  height: 1.15rem;
  display: block;
}
.stats-player-rename-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  max-width: 28rem;
}
.stats-player-rename-inline.hidden {
  display: none;
}
.stats-player-rename-inline input {
  flex: 1 1 10rem;
  min-width: 8rem;
  background: #1a1b26;
  color: #c0caf5;
  border: 1px solid #414868;
  border-radius: 6px;
  padding: 0.4rem 0.55rem;
  font-size: 1.05rem;
  font-weight: 600;
  text-align: center;
}
.stats-player-rename-inline.is-busy {
  cursor: wait;
  opacity: 0.85;
}
.stats-player-rename-inline.is-busy input,
.stats-player-rename-inline.is-busy .btn {
  cursor: wait;
}
.stats-player-filters {
  justify-content: space-between;
  align-items: flex-end;
  width: 100%;
  flex-wrap: nowrap;
}
@media (max-width: 640px) {
  .stats-player-filters {
    flex-wrap: wrap;
  }
}
.stats-player-filters .stats-filter-end {
  margin-left: auto;
  text-align: right;
}
.stats-player-filters .stats-filter-end select {
  text-align: left;
}
.stats-filter {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.75rem;
  opacity: 0.95;
}
.stats-filter select,
.stats-filter input {
  min-width: 10rem;
  background: #1a1b26;
  color: #c0caf5;
  border: 1px solid #414868;
  border-radius: 6px;
  padding: 0.4rem 0.5rem;
}
.stats-filter .autocomplete-wrapper {
  min-width: 12rem;
}
.stats-filter .autocomplete-wrapper input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.stats-section-title {
  margin: 1rem 0 0.45rem;
  font-size: 0.95rem;
}
.stats-subtabs {
  display: flex;
  gap: 0.35rem;
  margin: 0.85rem 0 0.65rem;
}
.stats-subtab {
  flex: 1;
  box-sizing: border-box;
  padding: 0.55rem 1rem;
  border: none;
  border-radius: 6px;
  background: #414868;
  color: #c0caf5;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  min-height: 2.25rem;
  line-height: 1.15;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}
.stats-subtab-icon {
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
  display: block;
}
.stats-subtab.active {
  background: #7aa2f7;
  color: #1a1b26;
}
.stats-subpanel.hidden {
  display: none;
}
.stats-pos {
  width: 2.5rem;
  opacity: 0.8;
  font-variant-numeric: tabular-nums;
}
.stats-table-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
.dash-stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.dash-stats-table th,
.dash-stats-table td {
  text-align: left;
  padding: 0.4rem 0.45rem;
  border-bottom: 1px solid #292e42;
}
.dash-stats-table th {
  font-size: 0.75rem;
  opacity: 0.75;
  font-weight: 600;
}
.dash-stats-table th.stats-sortable {
  cursor: pointer;
  user-select: none;
  white-space: normal;
  line-height: 1.15;
  vertical-align: bottom;
  max-width: 5.5rem;
}
.dash-stats-table th.stats-sortable[data-sort-key="name"] {
  max-width: 8rem;
}
.dash-stats-table th.stats-sortable:hover,
.dash-stats-table th.stats-sortable.is-sorted {
  opacity: 1;
  color: #c0caf5;
}
.dash-stats-table th.stats-sortable .stats-th-lines {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.05rem;
}
.dash-stats-table th.stats-sortable .stats-th-primary {
  display: inline-flex;
  align-items: baseline;
  gap: 0.15rem;
}
.dash-stats-table th.stats-sortable .stats-th-secondary {
  font-weight: 500;
  opacity: 0.85;
  font-size: 0.92em;
}
.dash-stats-table th.stats-sortable .sort-arrow {
  display: inline-block;
  font-size: 0.85em;
  opacity: 0.95;
  vertical-align: middle;
}
.stats-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.65rem;
  font-size: 0.8rem;
  opacity: 0.9;
}
.stats-pager .stats-pager-label {
  flex: 1 1 auto;
  min-width: 8rem;
}
.stats-pager .btn {
  padding: 0.25rem 0.65rem;
  font-size: 0.8rem;
}
.dash-stats-empty {
  text-align: center;
  opacity: 0.7;
}
.stats-winner {
  font-weight: 700;
  color: #9ece6a;
}
.stats-draw {
  font-weight: 600;
  opacity: 0.75;
  font-size: 0.92em;
}
.dash-stats-table tbody tr:nth-child(even) {
  background: rgba(65, 72, 104, 0.35);
}
.dash-stats-table tbody tr.stats-row-clickable {
  cursor: pointer;
}
.dash-stats-table tbody tr.stats-row-clickable:hover {
  background: #292e42;
}
.stats-match-when {
  white-space: nowrap;
  line-height: 1.25;
  vertical-align: middle;
}
.stats-match-date {
  display: block;
  font-weight: 600;
}
.stats-match-time {
  display: block;
  margin-top: 0.12rem;
  font-size: 0.78em;
  opacity: 0.75;
}
.stats-match-duration {
  display: block;
  margin-top: 0.12rem;
  font-size: 0.78em;
  opacity: 0.65;
  font-variant-numeric: tabular-nums;
}
.stats-match-event {
  max-width: 10rem;
  min-width: 4.5rem;
  vertical-align: middle;
}
.stats-match-event-cell {
  min-width: 0;
}
.stats-match-event-game {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}
.stats-match-event-name {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  margin-top: 0.15rem;
  font-size: 0.82em;
  opacity: 0.8;
  line-height: 1.25;
}
.stats-match-event-text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.stats-match-pair-cell {
  vertical-align: middle;
  text-align: center;
  white-space: nowrap;
  min-width: 7rem;
}
.stats-match-pair {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.1rem;
  line-height: 1.25;
  min-width: 0;
  max-width: 100%;
}
.stats-match-player {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stats-match-player-link {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  color: #c0caf5;
}
.stats-match-player-link.stats-winner {
  color: #9ece6a;
  font-weight: 700;
}
.stats-match-player-link:hover {
  opacity: 0.85;
}
.stats-match-player-link:focus-visible {
  outline: 2px solid #7aa2f7;
  outline-offset: 2px;
  border-radius: 2px;
}
.stats-match-vs {
  display: block;
  font-size: 0.78em;
  opacity: 0.55;
  font-weight: 600;
  text-transform: lowercase;
}
.stats-match-draw {
  display: block;
  margin-top: 0.1rem;
}
.stats-match-score {
  white-space: nowrap;
  vertical-align: middle;
  text-align: center;
}
.stats-match-score-stack {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.05rem;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  /* Fixed width so 1-digit and 3-digit scores share the same center axis. */
  min-width: 3ch;
  width: 3ch;
  margin: 0 auto;
  text-align: center;
}
.stats-match-score-stack > span {
  display: block;
  width: 100%;
  text-align: center;
}
.stats-match-score-sep {
  opacity: 0.55;
  font-weight: 600;
  line-height: 1;
}
.stats-match-live-label {
  font-weight: 700;
  color: #7aa2f7;
}
.stats-match-live-link {
  font-weight: 700;
  color: #7aa2f7;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.stats-match-live-link:hover {
  opacity: 0.85;
}
.stats-match-live-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #7aa2f7;
  opacity: 0.95;
  padding: 0.35rem 0.4rem;
}
.stats-match-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  justify-content: flex-end;
  gap: 0.35rem;
  vertical-align: middle;
  min-width: 8.5rem;
}
.stats-match-actions > .btn,
.stats-match-actions > .stats-match-live-badge {
  flex: 0 0 auto;
  width: auto;
  max-width: none;
  align-self: stretch;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  text-align: center;
  white-space: nowrap;
  line-height: 1.15;
  margin: 0.2rem 0;
  min-height: 0;
  padding: 0.4rem 0.65rem;
  box-sizing: border-box;
}
/* Compact stacked tiles only on narrow viewports */
@media (max-width: 899px) {
  .stats-match-actions > .btn,
  .stats-match-actions > .stats-match-live-badge {
    flex: 0 0 4.55rem;
    width: 4.55rem;
    max-width: 4.55rem;
    flex-direction: column;
    gap: 0.25rem;
    white-space: normal;
    min-height: 3.25rem;
    padding: 0.35rem 0.45rem;
  }
}
.stats-action-icon {
  width: 1.15rem;
  height: 1.15rem;
  flex-shrink: 0;
  display: block;
}
.stats-action-btn.edit,
.stats-action-btn.stats-action-edit {
  background: rgba(122, 162, 247, 0.18);
  color: #7aa2f7;
}
.stats-action-btn.edit:hover,
.stats-action-btn.stats-action-edit:hover {
  background: rgba(122, 162, 247, 0.28);
  color: #89b4fa;
}
.stats-action-btn.danger {
  background: rgba(247, 118, 142, 0.18);
  color: #f7768e;
}
.stats-action-btn.danger:hover {
  background: rgba(247, 118, 142, 0.28);
  color: #ff9db0;
}
.stats-action-btn.success,
.stats-action-btn.save {
  background: rgba(158, 206, 106, 0.18);
  color: #9ece6a;
}
.stats-action-btn.success:hover,
.stats-action-btn.save:hover {
  background: rgba(158, 206, 106, 0.28);
  color: #b9f27c;
}
.stats-action-label {
  font-size: 0.78rem;
}
.stats-match-racks-toggle {
  opacity: 0.92;
}
.stats-match-racks-toggle[aria-expanded="true"] {
  opacity: 1;
}
@media (max-width: 720px) {
  .stats-match-actions {
    min-width: 0;
  }
  .stats-match-actions > .btn {
    flex: 0 0 2.75rem;
    width: 2.75rem;
    max-width: 2.75rem;
    min-width: 2.6rem;
    padding: 0.45rem 0.5rem;
  }
  .stats-action-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
}
.stats-match-racks-row td {
  padding-top: 0;
  padding-bottom: 0.75rem;
  background: rgba(0, 0, 0, 0.12);
  border-top: none;
}
.stats-match-racks-wrap {
  margin: 0.15rem 0 0.25rem 0.25rem;
  max-width: 100%;
  min-width: 0;
}
.stats-rack-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-width: 100%;
}
.stats-rack-card {
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.85rem;
  min-width: 0;
}
.stats-rack-primary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.65rem;
  min-width: 0;
}
.stats-rack-num {
  font-weight: 600;
  opacity: 0.9;
  flex: 0 0 auto;
}
.stats-rack-score {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.stats-rack-outcome {
  font-weight: 600;
  min-width: 0;
  overflow-wrap: anywhere;
}
.stats-rack-dur {
  margin-left: auto;
  opacity: 0.85;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.stats-rack-players {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-top: 0.3rem;
  font-size: 0.8rem;
  opacity: 0.88;
  font-variant-numeric: tabular-nums;
}
.stats-rack-player-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.75rem;
  min-width: 0;
}
.stats-rack-player-name {
  font-weight: 600;
  opacity: 0.95;
  min-width: 0;
  overflow-wrap: anywhere;
}
.stats-rack-player-id {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  min-width: 0;
}
.stats-rack-broke-icon {
  width: 0.95em;
  height: 0.95em;
  object-fit: contain;
  flex: 0 0 auto;
  vertical-align: middle;
}
.stats-rack-secondary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.85rem;
  margin-top: 0.2rem;
  font-size: 0.8rem;
  opacity: 0.8;
  font-variant-numeric: tabular-nums;
}
.stats-rack-flag {
  font-weight: 600;
  opacity: 1;
  color: #7dcfff;
}
.stats-rack-breaker {
  font-weight: 400;
  opacity: 0.9;
  min-width: 0;
  overflow-wrap: anywhere;
}
.stats-match-duration-footer {
  margin: 0.35rem 0 0.1rem;
  font-size: 0.82rem;
  opacity: 0.85;
}
.dash-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1.25rem 1rem;
  background: rgba(0, 0, 0, 0.55);
  overflow: auto;
}
/* Confirm must stack above account/share modals (same base z-index, earlier in DOM). */
#dashConfirmModal {
  z-index: 50;
}
.dash-modal.is-busy {
  cursor: wait;
}
.dash-modal.is-busy .btn {
  cursor: wait;
  opacity: 0.75;
}
.dash-modal.hidden {
  display: none;
}
.dash-confirm-card {
  max-width: 28rem;
  width: 100%;
  margin-top: 12vh;
}
.dash-confirm-message {
  margin: 0 0 1rem;
  line-height: 1.45;
  opacity: 0.92;
  white-space: pre-wrap;
}
.dash-confirm-actions {
  justify-content: flex-end;
  gap: 0.5rem;
}
.dash-confirm-actions .btn {
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}
.dash-role-field {
  margin: 0.5rem 0 1rem;
}
.dash-role-field .stats-filter {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: 100%;
}
.dash-role-field select {
  width: 100%;
  max-width: 22rem;
}
.dash-role-desc {
  margin: 0.45rem 0 0;
  line-height: 1.45;
  max-width: 40rem;
}
.dash-role-access-title {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 600;
  opacity: 0.95;
}
.dash-role-access-list {
  margin: 0;
  padding-left: 1.2rem;
}
.dash-role-access-list li {
  margin: 0.15rem 0;
}
.stats-match-game-info {
  margin-top: 0.15rem;
  font-size: 0.85em;
  opacity: 0.75;
  line-height: 1.3;
}
.stats-match-score-summary {
  margin: 0.65rem 0 0.45rem;
  font-weight: 600;
}
.stats-match-racks-editor-wrap {
  margin: 0.35rem 0 0.85rem;
  max-width: 100%;
  min-width: 0;
}
.stats-match-racks-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.4rem;
  font-weight: 600;
}
.stats-match-racks-editor {
  max-width: 100%;
  min-width: 0;
  max-height: 14rem;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
.stats-match-racks-editor-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.5rem;
}
.stats-match-racks-editor-footer .btn {
  margin: 0;
}
.stats-match-form-actions {
  justify-content: flex-end;
  margin-top: 0.85rem;
  margin-bottom: 0;
}
.stats-match-form-actions .btn {
  margin: 0;
}
.stats-rack-edit-table {
  width: 100%;
  font-size: 0.85rem;
}
.stats-rack-edit-table th,
.stats-rack-edit-table td {
  padding: 0.25rem 0.35rem;
  vertical-align: middle;
}
.stats-rack-edit-table .stats-rack-edit-actions-col,
.stats-rack-edit-table .stats-rack-edit-actions {
  width: 2.25rem;
  text-align: center;
  white-space: nowrap;
}
.stats-rack-edit-table .stats-rack-delete-btn {
  margin: 0 auto;
}
.stats-rack-edit-table .stats-rack-delete-btn .dash-action-icon {
  width: 1.05rem;
  height: 1.05rem;
}
.stats-rack-edit-table input[type="number"] {
  width: 4.5rem;
  max-width: 100%;
}
.stats-rack-edit-table select.stats-rack-winner {
  width: 14rem;
  min-width: 11rem;
  max-width: 100%;
}
.dash-modal-card {
  width: min(48rem, 100%);
  margin-top: 1.5rem;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.dash-modal-card h2 {
  margin-bottom: 0.85rem;
}
.dash-modal-card .stats-filter {
  width: 100%;
  margin-bottom: 0.65rem;
}
.dash-modal-card .stats-filter input,
.dash-modal-card .stats-filter select {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.google-auth-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  align-items: stretch;
  margin: 0.75rem 0 0.35rem;
  max-width: 20rem;
}
.gsi-btn-mount {
  display: flex;
  justify-content: flex-start;
  width: 100%;
  max-width: 20rem;
  min-height: 40px;
}
/* Author display:flex would otherwise override the [hidden] UA rule and leave an empty gap */
.gsi-btn-mount[hidden] {
  display: none !important;
}
.gsi-btn-mount iframe {
  margin: 0 !important;
}
.dash-login-google-hint {
  margin: 0 0 0.75rem;
}
.dash-login-legal {
  margin: 0.35rem 0 0.5rem;
}
.dash-login-legal a {
  color: #7aa2f7;
}
.dash-login-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: stretch;
  margin: 0.65rem 0 0.35rem;
}
.dash-login-actions .btn {
  flex: 1 1 10rem;
  margin: 0;
  min-width: 0;
}
.dash-login-actions .dash-action-btn {
  justify-content: center;
}
/* Google Identity–style button (light theme) — branding guidelines */
.gsi-btn {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-height: 40px;
  width: 100%;
  max-width: 20rem;
  margin: 0;
  padding: 0 12px 0 12px;
  border: 1px solid #747775;
  border-radius: 4px;
  background: #ffffff;
  color: #1f1f1f;
  cursor: pointer;
  font-family: Poppins, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.15px;
  line-height: 20px;
  text-align: center;
  user-select: none;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}
.gsi-btn:hover {
  background: #f8f9fa;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);
}
.gsi-btn:active {
  background: #f1f3f4;
  box-shadow: none;
}
.gsi-btn:focus-visible {
  outline: 2px solid #7aa2f7;
  outline-offset: 3px;
}
.gsi-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  background: #fff;
}
.gsi-btn-icon img {
  display: block;
  width: 20px;
  height: 20px;
}
.gsi-btn-label {
  flex: 0 1 auto;
  white-space: nowrap;
}
/* Legacy image-button class still used in older markup / dock fallbacks */
.google-brand-btn {
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  cursor: pointer;
  line-height: 0;
  border-radius: 4px;
}
.google-brand-btn:focus-visible {
  outline: 2px solid #7aa2f7;
  outline-offset: 3px;
}
.google-brand-btn img {
  display: block;
  width: min(240px, 100%);
  height: auto;
}
.billing-plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11.5rem, 1fr));
  gap: 0.75rem;
  margin: 0.75rem 0 1rem;
}
.billing-plan-card {
  border: 1px solid #414868;
  border-radius: 8px;
  padding: 0.85rem 0.9rem;
  background: rgba(26, 27, 38, 0.55);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 0;
}
.billing-plan-card h3 {
  margin: 0;
  font-size: 1rem;
}
.billing-plan-card .billing-plan-limits {
  margin: 0;
  font-size: 0.82rem;
  opacity: 0.88;
  line-height: 1.35;
  flex: 1;
}
.billing-plan-card.is-current {
  border-color: #7aa2f7;
}
.billing-terms-check {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  margin: 0 0 0.85rem;
}
.billing-terms-check input {
  margin-top: 0.2rem;
}
.plan-trial-badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.4rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #3d59a1;
  color: #c0caf5;
  vertical-align: middle;
}
.platform-account-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1.25rem;
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
}
.platform-account-filter-label {
  margin: 0;
  min-width: min(18rem, 100%);
}
.platform-account-filter-label select {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
}
.platform-account-filter #platformAccountFilterHint {
  margin: 0;
  flex: 1 1 14rem;
}

