/* Fundo branco; layout centrado sem título ou instruções */
:root {
  --bg: transparent;

  /* base container colors are now driven by side tones */
  --left-tone: #2f80f6;
  /* mem-icon blue accent */
  --right-tone: #ff8a00;
  /* okla-icon orange accent */

  --container-bg: #0b0b0b;
  /* base dark for contrast under gradient */
  --card-bg: #0d0d0d;
  --max-width: 1100px;
  --horizontal-padding: 24px;
  --container-height: 72px;
  /* pequeno vertical */
  --corner-large: 24px;
  --corner-small: 8px;

  --expand-duration: .28s;
  /* main container expand */
  --card-duration: .32s;
  /* inner card slide (smoother/longer) */
  --card-delay: calc(var(--expand-duration));
  /* card shows after expand */
  --container_collapse_delay: calc(var(--card-duration));
  /* main waits for card hide */

  /* dynamic logo controls */
  --nba-logo-size: 48px;
  --nba-logo-opacity: 1;
  --nba-logo-distance: 0px;

  /* inner-card dynamic ratios */
  --inner-card-w-ratio: 0.0833;
  /* fraction of max-width for inner-card compact */
  --inner-card-h-ratio: 0.46;
  /* fraction of container-height for inner-card visible */
  --scoreboard-x: 0px;
  --scoreboard-y: 0px;
  --table-x: 0px;
  --table-y: 0px;
  --table-logo-size: 46px;
}

html,
body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
}

.center-wrap {
  /* centraliza o container na tela (vertical e horizontal) */
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  position: relative;
  overflow: visible;
}

/* MAIN BLACK CONTAINER */
.black-container {
  background: var(--container-bg);
  width: 100%;
  max-width: calc(var(--max-width) * .1428571429);
  /* 1/7th initial */
  height: var(--container-height);
  border-radius: var(--corner-large) var(--corner-small) var(--corner-large) var(--corner-small);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  touch-action: manipulation;
  overflow: visible;
  /* allow inner-card to appear outside the container */
  transition:
    width .46s cubic-bezier(.2, .85, .2, 1),
    max-width .46s cubic-bezier(.2, .85, .2, 1),
    height .46s cubic-bezier(.2, .85, .2, 1),
    border-radius .42s cubic-bezier(.2, .85, .2, 1),
    box-shadow .18s ease,
    opacity .22s ease,
    transform .34s cubic-bezier(.2, .85, .2, 1),
    visibility .22s ease;
  cursor: default;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transform: translate(var(--scoreboard-x), var(--scoreboard-y)) scale(1);
  visibility: visible;
  z-index: 2;
  /* keep main container above the secondary inner-card */
}

.black-container.widget-hidden {
  opacity: 0;
  transform: translate(var(--scoreboard-x), calc(var(--scoreboard-y) + 12px)) scale(.96);
  pointer-events: none;
  visibility: hidden;
}

body.ctrl-ready .black-container:not(.widget-hidden),
body.ctrl-ready .table-widget.table-active {
  cursor: grab;
}

body.ctrl-moving,
body.ctrl-moving * {
  cursor: grabbing !important;
  user-select: none;
}

.black-container.widget-dragging,
.table-widget.widget-dragging {
  transition: box-shadow .18s ease, opacity .18s ease, clip-path .18s ease;
  box-shadow: 0 14px 36px rgba(0, 0, 0, .26), 0 0 0 1px rgba(255, 255, 255, .24);
  will-change: transform;
}

.black-container.widget-align-pulse,
.table-widget.widget-align-pulse {
  animation: widgetAlignPulse .58s cubic-bezier(.2, .85, .2, 1);
}

@keyframes widgetAlignPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(96, 165, 250, 0), 0 6px 18px rgba(0, 0, 0, .12);
  }

  42% {
    box-shadow: 0 0 0 4px rgba(96, 165, 250, .28), 0 14px 34px rgba(0, 0, 0, .22);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(96, 165, 250, 0), 0 6px 18px rgba(0, 0, 0, .12);
  }
}

/* gradient overlay driven by --left-tone and --right-tone */
.black-container::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(105deg, var(--left-tone) -40%, transparent 42%, transparent 58%, var(--right-tone) 140%);
  opacity: .25;
  pointer-events: none;
  z-index: 0;
  transition: opacity .3s ease;
}

.black-container.expanded::before {
  opacity: .38;
}

/* clip-mask: created so only image content is cropped to the main card bounds */
.clip-mask {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  /* only images inside this wrapper will be clipped */
  pointer-events: none;
  z-index: 1;
  /* sits above container bg but below interactive content like numbers */
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transform: scale(1);
  transition: opacity .22s ease, transform .32s cubic-bezier(.2, .85, .2, 1);
  /* ensure the NBA logo is perfectly centered inside the card */
}

/* Center switch container holds both logo and timer and crossfades between them */
.center-switch {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  width: 100%;
  height: 100%;
}

/* NBA logo centered inside the main container */
.nba-logo {
  max-height: var(--nba-logo-size);
  width: auto;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  filter: none;
  position: absolute;
  left: 50%;
  top: calc(50% + var(--nba-logo-distance));
  transform: translate(-50%, -50%);
  opacity: var(--nba-logo-opacity);
  transition: opacity .28s ease, transform .28s ease;
  z-index: 2;
}

/* Timer shown when card is compact (not hovered). Hidden when hovered. */
.timer {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(1);
  color: var(--number-color);
  font: 700 28px/1 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  letter-spacing: 1.5px;
  /* Removed background to make timer sit cleanly on the card */
  padding: 2px 6px;
  border-radius: 6px;
  opacity: 1;
  transition: opacity .28s ease, transform .28s ease;
  z-index: 1;
  pointer-events: none;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6);
  /* improve contrast on dark bg */
}

.final-total-time {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(.96);
  color: #f4f4f5;
  font: 800 18px/1 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  letter-spacing: .5px;
  opacity: 0;
  transition: opacity .28s ease, transform .28s ease;
  z-index: 3;
  pointer-events: none;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .65);
}

/* When expanded: show logo, hide timer */
.black-container.expanded .nba-logo {
  opacity: var(--nba-logo-opacity);
  transform: translate(-50%, -50%) scale(1);
  transition-delay: 0s;
}

.black-container.expanded .timer {
  opacity: 0;
  transform: translate(-50%, -50%) scale(.98);
  transition-delay: 0s;
}

/* When collapsed: hide logo and show timer */
.black-container:not(.expanded) .nba-logo {
  opacity: 0;
  transform: translate(-50%, -50%) scale(.96);
  transition-delay: 0s;
}

.black-container:not(.expanded) .timer {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  transition-delay: 0s;
}

.black-container.game-ended {
  --logo-gap: 136px;
  max-width: min(var(--max-width), 640px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .16);
  transition-delay: 0s;
}

.black-container.game-ended::before {
  opacity: .44;
}

.black-container.game-ended .timer,
.black-container.game-ended .quarter-label,
.black-container.game-ended .side-icon {
  opacity: 0;
  transform: translate(-50%, -50%) scale(.96);
  transition-delay: 0s;
}

.black-container.game-ended .side-number {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  transition-delay: 0s;
}

.black-container.game-ended .nba-logo {
  opacity: var(--nba-logo-opacity);
  transform: translate(-50%, -50%) scale(1);
}

.black-container.game-ended .final-total-time {
  opacity: 0;
  transform: translate(-50%, -50%) scale(.96);
}

.black-container.game-ended.show-final-time .nba-logo {
  opacity: 0;
  transform: translate(-50%, -50%) scale(.96);
}

.black-container.game-ended.show-final-time .final-total-time {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* Side numbers that appear to left/right of the logo when expanded */
:root {
  --logo-gap: 140px;
  /* tightened distance so side numbers sit closer to the NBA logo */
  --number-size: 68px;
  /* increased visible size so scores are more prominent */
  --number-color: #eaeaea;
  /* use a cleaner UI typeface and enforce bold weight for better emphasis */
  --number-font: 700 56px/1 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  /* move side icons modestly away from the numbers but keep them inside the card bounds */
  --side-icon-distance: 92px;
  /* slightly reduced so icons remain visible without overlapping */
  --side-icon-size: 78px;
  /* reduced base size to avoid cropping */
  --side-icon-opacity: 0.12;
  /* lowered visible opacity for both icons */
  --okla-scale: 1.2;
  /* slightly reduced OKLA scale for better fit when raised */
}

.side-number {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%) scale(.96);
  opacity: 0;
  color: var(--number-color);
  font: var(--number-font);
  width: calc(var(--number-size) * 1.55);
  height: var(--number-size);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: opacity .24s cubic-bezier(.2, .85, .2, 1), transform .34s cubic-bezier(.2, .85, .2, 1);
  z-index: 3;
  /* ensure numbers sit above the oversized, faded icons */
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6);
  overflow: hidden;
  isolation: isolate;
  border-radius: 10px;
  font-variant-numeric: tabular-nums;
  gap: 0;
}

/* left positioned at 50px to the left of the logo center; right at 50px to the right */
.side-number.left {
  left: calc(50% - var(--logo-gap));
}

.side-number.right {
  left: calc(50% + var(--logo-gap));
}

.score-digit {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: .58em;
  height: 1em;
  line-height: 1;
  overflow: hidden;
  flex: 0 0 auto;
}

.score-digit.blank {
  min-width: .22em;
}

.score-digit-old,
.score-digit-new {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  will-change: transform, opacity;
}

.score-digit.changing .score-digit-old {
  animation: scoreDigitExitUp .56s cubic-bezier(.2, .85, .2, 1) forwards;
}

.score-digit.changing .score-digit-new {
  transform: translateY(112%);
  opacity: 0;
  animation: scoreDigitEnterUp .56s cubic-bezier(.2, .85, .2, 1) forwards;
}

.score-burst {
  position: absolute;
  top: 50%;
  z-index: 6;
  pointer-events: none;
  color: #ffffff;
  font: 900 18px/1 "Inter", system-ui, sans-serif;
  letter-spacing: 0;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .55);
  transform: translate(-50%, 12px) scale(.92);
  animation: scoreBurstRise .95s cubic-bezier(.18, .88, .2, 1) forwards;
}

.score-burst.left {
  left: calc(50% - var(--logo-gap));
  color: #bfdbfe;
}

.score-burst.right {
  left: calc(50% + var(--logo-gap));
  color: #fed7aa;
}

@keyframes scoreBurstRise {
  0% {
    opacity: 0;
    transform: translate(-50%, 14px) scale(.9);
  }

  18% {
    opacity: 1;
  }

  76% {
    opacity: 1;
    transform: translate(-50%, -42px) scale(1.08);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -58px) scale(1.08);
  }
}

@keyframes scoreDigitExitUp {
  0% {
    transform: translateY(0);
    opacity: 1;
  }

  58% {
    opacity: 1;
  }

  100% {
    transform: translateY(-112%);
    opacity: 0;
  }
}

@keyframes scoreDigitEnterUp {
  0% {
    transform: translateY(112%);
    opacity: 0;
  }

  24% {
    opacity: 1;
  }

  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Side icons placed relative to the numbers */
.side-icon {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%) scale(1);
  width: var(--side-icon-size);
  height: var(--side-icon-size);
  object-fit: cover;
  /* show only the team image area inside the card */
  pointer-events: none;
  user-select: none;
  opacity: 0;
  /* hidden by default until hover */
  transition: opacity .2s ease, transform .28s cubic-bezier(.2, .85, .2, 1);
  z-index: 1;
  /* sit behind numbers but inside the main card (cropped by overflow:hidden) */
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
  will-change: transform, opacity;
}

/* left icon moved further toward the left edge and slightly lowered to reduce cropping */
.side-icon.left-icon {
  left: calc(50% - var(--logo-gap) - var(--side-icon-distance));
  top: 64%;
  transform: translate(-50%, -40%) scale(1);
  width: var(--side-icon-size);
  height: var(--side-icon-size);
}

/* right icon moved further toward the right edge and slightly lowered for visual balance */
.side-icon.right-icon {
  left: calc(50% + var(--logo-gap) + var(--side-icon-distance));
  top: 48%;
  /* raised OKLA icon for better vertical alignment with logo */
  transform: translate(-50%, -60%) scale(1);
  /* make OKLA icon larger than the left icon while still respecting the card clipping */
  width: calc(var(--side-icon-size) * var(--okla-scale));
  height: calc(var(--side-icon-size) * var(--okla-scale));
}

/* Reveal numbers and icons smoothly when container is expanded */
.black-container.expanded .side-number {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  transition-delay: var(--card-delay);
}

.black-container.expanded .side-icon {
  opacity: var(--side-icon-opacity);
  transform: translate(-50%, -50%) scale(1.02);
  transition-delay: calc(var(--card-delay) + .04s);
}

/* Hide numbers and icons when collapsed */
.black-container:not(.expanded) .side-number,
.black-container:not(.expanded) .side-icon {
  transition-delay: 0s;
  transform: translate(-50%, -50%) scale(.96);
  opacity: 0;
}

/* ensure inner-card stays behind the main card (never rises above it) */
.inner-card {
  z-index: 0;
  /* visible but stays behind the main container (which is z-index:2) */
}

/* When expanded: grow to full width */
.black-container.expanded {
  max-width: var(--max-width);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  transition-delay: 0s;
}

/* When collapsed: delay shrink so inner card hides first */
.black-container:not(.expanded) {
  transition-delay: var(--container_collapse_delay);
}

/* INNER BOTTOM-ATTACHED CARD (compact, bottom-attached, black) */
.inner-card {
  /* custom vars to allow distinct show/hide behavior */
  --card-show-duration: var(--card-duration);
  --card-show-timing: cubic-bezier(.2, .85, .2, 1);
  --card-hide-duration: var(--card-show-duration);
  --card-hide-timing: var(--card-show-timing);
  /* return uses same smooth timing as show */

  position: absolute;
  left: 50%;
  /* start hidden inside the main container (centered vertically) */
  top: 50%;
  transform: translate(-50%, -50%);
  /* smaller initial size so it's not visible as a separate element */
  width: min(calc(var(--max-width) / 12), 72px);
  height: calc(var(--container-height) * 0.5);
  /* keep it fully inside the main container initially */
  background: var(--container-bg);
  /* same black as main container */
  border-radius: 6px;
  /* subtle radius while hidden */
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  box-sizing: border-box;
  /* default use show timing; overridden on hide state for dynamic return */
  transition:
    transform var(--card-show-duration) var(--card-show-timing),
    height var(--card-show-duration) var(--card-show-timing),
    top var(--card-show-duration) var(--card-show-timing),
    border-radius var(--card-show-duration) ease;
  pointer-events: none;
  will-change: transform, height, top;
  opacity: 1;
  /* keep opacity constant (no fade) */
}

/* Show the inner-card only after the main finished expanding (use delay) */
/* animate from the center of the main downward into its final flush position */
.black-container.expanded .inner-card {
  top: 100%;
  transform: translate(-50%, 0);
  height: calc(var(--container-height) * var(--inner-card-h-ratio));
  width: min(calc(var(--max-width) * var(--inner-card-w-ratio)), 90px);
  border-radius: 0 0 12px 12px;
  transition-delay: var(--card-delay);
  transition:
    transform var(--card-show-duration) var(--card-show-timing),
    height var(--card-show-duration) var(--card-show-timing),
    top var(--card-show-duration) var(--card-show-timing),
    border-radius var(--card-show-duration) ease;
  pointer-events: auto;
}

.black-container:not(.expanded) .inner-card {
  transition-delay: 0s;
  transition:
    transform var(--card-hide-duration) var(--card-hide-timing),
    height var(--card-hide-duration) var(--card-hide-timing),
    top var(--card-hide-duration) var(--card-hide-timing),
    border-radius var(--card-hide-duration) ease;
  top: 50%;
  transform: translate(-50%, -50%);
  height: calc(var(--container-height) * 0.5);
  width: min(calc(var(--max-width) / 12), 72px);
  border-radius: 6px;
  pointer-events: none;
}

/* Inner card content styling (simple, subtle) */
.inner-card-content {
  width: 100%;
  display: flex;
  gap: 12px;
  align-items: center;
  color: #e9e9e9;
}

.pill {
  width: 44px;
  height: 44px;
  background: #1a1a1a;
  border-radius: 10px;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.3);
}

.text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.line {
  height: 10px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.06));
  border-radius: 6px;
}

.line.short {
  width: 32%;
}

.line.long {
  width: 70%;
  height: 12px;
}

/* Inner-card timer: small card displays the running match time, styled to be clear and legible */
.inner-card {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 8px;
  box-sizing: border-box;
}

/* the timer shown inside the small bottom-attached card */
.inner-timer {
  color: var(--number-color);
  font: 700 16px/1 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  letter-spacing: 1px;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6);
  pointer-events: none;
  user-select: none;
  -webkit-font-smoothing: antialiased;
  /* animate opacity and scale so the inner timer softly appears/disappears */
  transition: opacity .28s cubic-bezier(.2, .85, .2, 1), transform .28s cubic-bezier(.2, .85, .2, 1), color .18s ease;
  opacity: 0;
  /* start visually disabled until inner-card is shown */
  transform: scale(.98);
  will-change: opacity, transform;
}

/* When expanded, show the inner timer */
.black-container.expanded .inner-timer {
  opacity: 1;
  transform: scale(1);
  transition-delay: var(--card-delay);
}

/* When collapsed, hide the inner timer */
.black-container:not(.expanded) .inner-timer {
  opacity: 0;
  transform: scale(.98);
  transition-delay: 0s;
}

.black-container.game-ended .inner-card {
  top: 100%;
  width: 154px;
  height: 31px;
  transform: translate(-50%, 0);
  border-radius: 0 0 12px 12px;
  transition-delay: 0s;
}

.black-container.game-ended .inner-timer {
  opacity: 1;
  transform: scale(1);
  color: #f4f4f5;
  font-size: 12px;
  letter-spacing: .9px;
  text-transform: uppercase;
  transition-delay: 0s;
}

/* make the inner-card timer slightly larger and bolder on touch/mobile for readability */
@media (max-width:420px) {
  .inner-timer {
    font-size: 18px;
    letter-spacing: 1.4px;
  }
}

/* Ajustes para telas muito pequenas */
@media (max-width:420px) {
  :root {
    --container-height: 64px;
    --horizontal-padding: 12px;
    --corner-large: 18px;
    --corner-small: 6px;
  }

  .black-container {
    border-radius: var(--corner-large) var(--corner-small) var(--corner-large) var(--corner-small);
  }

  .inner-card {
    width: 72%;
    height: 32px;
    border-radius: 12px;
    top: 50%;
    transform: translate(-50%, -50%);
  }

  .pill {
    width: 40px;
    height: 40px;
  }
}

/* ---------- expand toggle (inside tab bar) ---------- */
#expand-toggle.sp-play {
  color: #60a5fa;
  font-size: 11px;
  padding: 5px 9px 6px;
}

#expand-toggle.sp-play:hover {
  color: #93c5fd;
  background: rgba(96, 165, 250, .1);
}

#expand-toggle.active {
  color: #f87171;
}

.sp-tab-divider {
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, .08);
  align-self: center;
  flex-shrink: 0;
}

.widget-switch {
  height: 25px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 8px;
  background: rgba(255, 255, 255, .035);
  align-self: center;
}

.widget-switch-btn {
  height: 19px;
  padding: 0 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #71717a;
  font: 800 9px/1 "Inter", system-ui, sans-serif;
  letter-spacing: .4px;
  cursor: pointer;
  transition: background .16s ease, color .16s ease, transform .1s ease;
}

.widget-switch-btn:hover {
  color: #d4d4d8;
  background: rgba(255, 255, 255, .06);
}

.widget-switch-btn:active {
  transform: scale(.96);
}

.widget-switch-btn.active {
  color: #dbeafe;
  background: rgba(96, 165, 250, .18);
}

/* ================================================================
   SETTINGS PANEL — compact bottom strip with icon tabs
   ================================================================ */

/* ---------- toggle button ---------- */
#settings-toggle,
#preview-toggle {
  position: fixed;
  bottom: 14px;
  z-index: 10000;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 50%;
  background: rgba(18, 18, 18, .8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #999;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .3s cubic-bezier(.2, .85, .2, 1), background .15s, color .15s, box-shadow .2s;
  box-shadow: 0 1px 8px rgba(0, 0, 0, .25);
}

#settings-toggle {
  right: 14px;
}

#preview-toggle {
  right: 58px;
}

#settings-toggle:hover,
#preview-toggle:hover {
  background: rgba(28, 28, 28, .92);
  color: #e4e4e7;
  box-shadow: 0 2px 14px rgba(0, 0, 0, .4);
}

#settings-toggle.active {
  transform: rotate(135deg);
  color: #60a5fa;
  background: rgba(20, 20, 22, .92);
}

#preview-toggle.active {
  color: #86efac;
  background: rgba(20, 22, 20, .92);
}

html.preview-mode,
html.preview-mode body {
  overflow: hidden;
}

html.preview-mode #settings-toggle,
html.preview-mode #preview-toggle,
html.preview-mode #settings-panel,
html.preview-mode .period-gate {
  display: none !important;
}

html.preview-mode .center-wrap {
  padding: 0;
}

/* ---------- panel ---------- */
#settings-panel {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(calc(100% + 8px));
  z-index: 9995;
  width: auto;
  max-width: min(940px, calc(100vw - 18px));
  min-width: 320px;
  background: rgba(12, 12, 14, .88);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  border: 1px solid rgba(255, 255, 255, .06);
  border-bottom: none;
  border-radius: 14px 14px 0 0;
  transition: transform .28s cubic-bezier(.22, .9, .36, 1), opacity .22s ease;
  opacity: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, .3);
}

#settings-panel.open {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* ---------- tab bar ---------- */
.sp-tabs {
  display: flex;
  justify-content: center;
  gap: 2px;
  padding: 6px 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, .05);
  flex-shrink: 0;
}

.sp-tab {
  background: none;
  border: none;
  color: #555;
  font-size: 12px;
  padding: 6px 9px 7px;
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  transition: color .15s, background .15s;
  position: relative;
  line-height: 1;
}

.sp-tab:hover {
  color: #aaa;
  background: rgba(255, 255, 255, .04);
}

.sp-tab.active {
  color: #d4d4d8;
  background: rgba(255, 255, 255, .06);
}

.sp-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 20%;
  right: 20%;
  height: 2px;
  background: #60a5fa;
  border-radius: 1px;
}

.scope-hidden {
  display: none !important;
}

/* ---------- pane body ---------- */
.sp-body {
  padding: 8px 12px 10px;
  min-height: 36px;
}

.sp-pane {
  display: none;
}

.sp-pane.active {
  display: block;
}

/* ---------- group row (inline) ---------- */
.sp-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.sp-group+.sp-group {
  margin-top: 6px;
}

.sp-group>label {
  color: #71717a;
  font: 500 10px/1 "Inter", system-ui, sans-serif;
  letter-spacing: .2px;
  flex-shrink: 0;
  text-transform: uppercase;
}

.sp-sep {
  color: #444;
  font: 700 12px/1 "Inter", system-ui, sans-serif;
  margin: 0 -2px;
}

/* ---------- inputs ---------- */

.sp-num {
  width: 38px;
  padding: 3px 4px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 5px;
  color: #d4d4d8;
  font: 600 11px/1 "Inter", system-ui, sans-serif;
  text-align: center;
  outline: none;
  transition: border-color .12s;
}

.sp-num:focus {
  border-color: rgba(96, 165, 250, .45);
}

.sp-text {
  min-width: 0;
  height: 22px;
  padding: 0 7px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 5px;
  color: #d4d4d8;
  font: 700 10px/1 "Inter", system-ui, sans-serif;
  outline: none;
  box-sizing: border-box;
  transition: border-color .12s, background .12s;
}

.sp-text:focus {
  border-color: rgba(96, 165, 250, .45);
  background: rgba(255, 255, 255, .085);
}

.sp-text-xs {
  width: 72px;
}

.sp-text-sm {
  width: 104px;
}

.sp-text-lg {
  width: min(220px, 34vw);
}

.sp-check-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #71717a;
  font: 700 10px/1 "Inter", system-ui, sans-serif;
  text-transform: uppercase;
  cursor: pointer;
}

.sp-check-label input {
  width: 13px;
  height: 13px;
  accent-color: #60a5fa;
  margin: 0;
}

.sp-select {
  padding: 3px 6px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 5px;
  color: #d4d4d8;
  font: 600 11px/1 "Inter", system-ui, sans-serif;
  outline: none;
  cursor: pointer;
}

.sp-select option {
  background: #1a1a1a;
  color: #d4d4d8;
}

.sp-range {
  -webkit-appearance: none;
  appearance: none;
  width: 72px;
  height: 3px;
  background: rgba(255, 255, 255, .1);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  flex-shrink: 1;
  min-width: 48px;
}

.sp-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #60a5fa;
  border: 1.5px solid rgba(0, 0, 0, .25);
  box-shadow: 0 0 4px rgba(96, 165, 250, .3);
  cursor: grab;
  transition: transform .12s;
}

.sp-range::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.sp-range::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #60a5fa;
  border: 1.5px solid rgba(0, 0, 0, .25);
  cursor: grab;
}

.sp-val {
  color: #555;
  font: 500 9px/1 "Inter", system-ui, sans-serif;
  min-width: 22px;
  text-align: right;
  flex-shrink: 0;
}

.sp-color {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 20px;
  border: 1.5px solid rgba(255, 255, 255, .1);
  border-radius: 4px;
  background: none;
  cursor: pointer;
  padding: 0;
}

.sp-color::-webkit-color-swatch-wrapper {
  padding: 1px;
}

.sp-color::-webkit-color-swatch {
  border: none;
  border-radius: 2px;
}

.sp-color:hover {
  border-color: rgba(255, 255, 255, .22);
}

.sp-file-label {
  display: inline-flex;
  align-items: center;
  padding: 3px 7px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 5px;
  color: #71717a;
  font: 500 10px/1 "Inter", system-ui, sans-serif;
  cursor: pointer;
  transition: background .12s, color .12s;
}

.sp-file-label:hover {
  background: rgba(255, 255, 255, .1);
  color: #d4d4d8;
}

.sp-file-label input[type="file"] {
  display: none;
}

/* ---------- buttons ---------- */
.sp-btn {
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 5px;
  background: rgba(255, 255, 255, .05);
  color: #a1a1aa;
  font: 600 10px/1 "Inter", system-ui, sans-serif;
  cursor: pointer;
  transition: background .12s, color .12s, transform .1s;
  user-select: none;
}

.sp-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, .1);
  color: #e4e4e7;
  transform: translateY(-1px);
}

.sp-btn:active:not(:disabled) {
  transform: scale(.96);
}

.sp-btn:disabled {
  opacity: .25;
  cursor: default;
}

.sp-btn.accent {
  background: rgba(96, 165, 250, .12);
  border-color: rgba(96, 165, 250, .2);
  color: #93c5fd;
}

.sp-btn.accent:hover:not(:disabled) {
  background: rgba(96, 165, 250, .22);
}

.sp-btn.danger {
  background: rgba(239, 68, 68, .08);
  border-color: rgba(239, 68, 68, .15);
  color: #fca5a5;
}

.sp-btn.danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, .18);
}

.sp-hint {
  color: #3f3f46;
  font: 400 9px/1 "Inter", system-ui, sans-serif;
  letter-spacing: .3px;
  margin-left: 4px;
}

/* ---------- score controls ---------- */
.sp-score-row {
  gap: 5px;
}

.sp-score-label {
  color: #71717a;
  font: 700 10px/1 "Inter", system-ui, sans-serif;
  letter-spacing: .5px;
  text-transform: uppercase;
  min-width: 22px;
}

.sp-score-num {
  width: 42px;
  font-size: 12px;
  font-weight: 700;
}

.sp-score-btn {
  padding: 4px 6px;
  font-size: 10px;
  font-weight: 700;
  min-width: 26px;
  text-align: center;
}

.sp-score-divider {
  width: 1px;
  height: 18px;
  background: rgba(255, 255, 255, .08);
  flex-shrink: 0;
  margin: 0 4px;
}

/* ---------- players editor ---------- */
.players-pane {
  width: min(900px, calc(100vw - 36px));
}

.table-settings-pane {
  width: min(900px, calc(100vw - 36px));
}

.table-copy-row {
  flex-wrap: nowrap;
}

.players-editor {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.players-edit-team {
  min-width: 0;
  padding: 8px;
  border-radius: 9px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .07);
}

.players-edit-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 7px;
  margin-bottom: 7px;
}

.players-edit-head strong {
  min-width: 0;
  color: #d4d4d8;
  font: 900 10px/1 "Inter", system-ui, sans-serif;
  letter-spacing: .7px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.players-edit-head span {
  color: #71717a;
  font: 800 9px/1 "Inter", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}

.player-add-btn {
  width: 24px;
  height: 22px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.players-edit-list {
  max-height: 214px;
  overflow-y: auto;
  padding-right: 2px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .16) transparent;
}

.player-edit-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px 22px;
  gap: 5px;
  align-items: center;
}

.player-name-input,
.player-odds-input {
  min-width: 0;
  height: 22px;
  padding: 0 7px;
  border: 1px solid rgba(255, 255, 255, .075);
  border-radius: 6px;
  background: rgba(0, 0, 0, .2);
  color: #e4e4e7;
  font: 800 10px/1 "Inter", system-ui, sans-serif;
  outline: none;
  box-sizing: border-box;
  transition: border-color .14s ease, background .14s ease;
}

.player-odds-input {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.player-name-input:focus,
.player-odds-input:focus {
  border-color: rgba(96, 165, 250, .45);
  background: rgba(0, 0, 0, .3);
}

.player-remove-btn {
  width: 22px;
  height: 22px;
  border: 1px solid rgba(239, 68, 68, .13);
  border-radius: 6px;
  background: rgba(239, 68, 68, .07);
  color: #fca5a5;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background .14s ease, color .14s ease, transform .1s ease;
}

.player-remove-btn:hover {
  background: rgba(239, 68, 68, .18);
  color: #fecaca;
}

.player-remove-btn:active {
  transform: scale(.94);
}

/* quarter label on widget */
.quarter-label {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, .45);
  font: 700 10px/1 "Inter", system-ui, sans-serif;
  letter-spacing: 1px;
  text-transform: uppercase;
  pointer-events: none;
  z-index: 4;
  opacity: 0;
  transition: opacity .24s ease;
}

.black-container.expanded .quarter-label {
  opacity: 1;
  transition-delay: var(--card-delay);
}

.black-container:not(.expanded) .quarter-label {
  opacity: 0;
  transition-delay: 0s;
}

.black-container.expanded.game-ended,
.black-container.game-ended {
  max-width: min(var(--max-width), 640px);
  transition-delay: 0s;
}

.black-container.expanded.game-ended .quarter-label,
.black-container.expanded.game-ended .side-icon,
.black-container.game-ended .quarter-label,
.black-container.game-ended .side-icon {
  opacity: 0;
  transition-delay: 0s;
}

.black-container.expanded.game-ended .side-number {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  transition-delay: 0s;
}

/* ---------- independent table widget ---------- */
.table-widget {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(760px, calc(100vw - 32px));
  max-width: min(760px, calc(100vw - 32px));
  height: clamp(480px, 66vh, 540px);
  border-radius: 20px 8px 20px 8px;
  background: var(--container-bg);
  box-shadow: 0 10px 32px rgba(0, 0, 0, .18);
  opacity: 0;
  overflow: visible;
  pointer-events: none;
  visibility: hidden;
  transform: translate(calc(-50% + var(--table-x)), calc(-50% + var(--table-y) + 14px)) scale(.96);
  transition:
    opacity .24s ease,
    transform .38s cubic-bezier(.2, .85, .2, 1),
    clip-path .42s cubic-bezier(.2, .85, .2, 1),
    visibility .24s ease;
  z-index: 3;
  clip-path: inset(12% 8% 12% 8% round 18px);
}

.table-widget::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(112deg, var(--left-tone) -30%, transparent 42%, transparent 58%, var(--right-tone) 130%),
    radial-gradient(circle at 12% 16%, rgba(255, 255, 255, .12), transparent 24%);
  opacity: .42;
  pointer-events: none;
}

.table-widget.table-active {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
  transform: translate(calc(-50% + var(--table-x)), calc(-50% + var(--table-y))) scale(1);
  clip-path: inset(0 0 0 0 round 20px 8px 20px 8px);
}

.table-widget.table-closing {
  opacity: 0;
  pointer-events: none;
  visibility: visible;
  transform: translate(calc(-50% + var(--table-x)), calc(-50% + var(--table-y) - 22px)) scale(.94);
  clip-path: inset(0 0 100% 0 round 20px 8px 20px 8px);
}

.table-panel {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  box-sizing: border-box;
  opacity: 0;
  transform: translateY(12px) scale(.985);
  transform-origin: 50% 12%;
  filter: blur(0);
  pointer-events: none;
  transition: opacity .22s ease, transform .3s cubic-bezier(.2, .85, .2, 1), filter .22s ease;
}

.table-widget.table-active .table-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  transition-delay: .08s;
}

.table-widget.table-closing .table-panel {
  opacity: 0;
  transform: translateY(-18px) scale(.975);
  filter: blur(1.5px);
  pointer-events: none;
}

.table-header {
  min-height: 46px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.table-logo {
  width: var(--table-logo-size);
  height: var(--table-logo-size);
  object-fit: contain;
  border-radius: 8px;
  padding: 5px;
  box-sizing: border-box;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .08);
}

.table-badge.badge-hidden {
  display: none;
}

.table-title {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.table-title span {
  color: #93c5fd;
  font: 800 10px/1 "Inter", system-ui, sans-serif;
  letter-spacing: 1px;
}

.table-title strong {
  color: #f4f4f5;
  font: 900 20px/1 "Inter", system-ui, sans-serif;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-badge {
  height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border-radius: 7px;
  color: #fde68a;
  background: rgba(250, 204, 21, .12);
  border: 1px solid rgba(250, 204, 21, .22);
  font: 900 9px/1 "Inter", system-ui, sans-serif;
  letter-spacing: .7px;
}

.table-rosters {
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.table-team {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 9px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .045);
  border: 1px solid rgba(255, 255, 255, .075);
  overflow: hidden;
}

.table-team-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding-bottom: 7px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.table-team-head span,
.table-team-head strong {
  font: 900 10px/1 "Inter", system-ui, sans-serif;
  letter-spacing: .8px;
}

.table-team-head span {
  min-width: 0;
  color: #f4f4f5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-team-left .table-team-head strong {
  color: #93c5fd;
}

.table-team-right .table-team-head strong {
  color: #fdba74;
}

.player-list {
  min-height: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.player-list li {
  min-height: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(0, 0, 0, .18);
  border: 1px solid rgba(255, 255, 255, .045);
}

.table-widget.table-active .player-list li {
  animation: tableRowIn .32s cubic-bezier(.2, .85, .2, 1) both;
  animation-delay: calc(.06s + (var(--row-i, 0) * 14ms));
}

.table-widget.table-closing .player-list li {
  animation: tableRowOut .2s ease both;
  animation-delay: calc(var(--row-i, 0) * 7ms);
}

@keyframes tableRowIn {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes tableRowOut {
  0% {
    opacity: 1;
    transform: translateY(0);
  }

  100% {
    opacity: 0;
    transform: translateY(-7px);
  }
}

.player-list li:nth-child(even) {
  background: rgba(255, 255, 255, .035);
}

.player-list span {
  min-width: 0;
  color: #d4d4d8;
  font: 800 9px/1 "Inter", system-ui, sans-serif;
  letter-spacing: .3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-list strong {
  color: #f4f4f5;
  font: 900 11px/1 "Inter", system-ui, sans-serif;
  letter-spacing: .3px;
  font-variant-numeric: tabular-nums;
}

.table-team-left .player-list strong {
  text-shadow: 0 0 12px rgba(96, 165, 250, .22);
}

.table-team-right .player-list strong {
  text-shadow: 0 0 12px rgba(255, 138, 0, .22);
}

.table-inner-card {
  position: absolute;
  left: 50%;
  top: 100%;
  width: 154px;
  height: 31px;
  transform: translate(-50%, 0);
  border-radius: 0 0 12px 12px;
  background: var(--container-bg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 8px;
  box-sizing: border-box;
  opacity: 0;
  pointer-events: auto;
  transition: opacity .22s ease, transform .32s cubic-bezier(.2, .85, .2, 1);
}

.table-widget.table-active .table-inner-card {
  opacity: 1;
  transform: translate(-50%, 0);
  transition-delay: .12s;
}

.table-widget.table-closing .table-inner-card {
  opacity: 0;
  transform: translate(-50%, -10px);
}

.table-inner-timer {
  color: var(--number-color);
  font: 700 16px/1 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  letter-spacing: 1px;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .6);
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

.table-widget.table-active .table-inner-timer {
  opacity: 1;
  transform: scale(1);
  transition-delay: .08s;
}

/* ---------- period start gate ---------- */
.period-gate {
  position: fixed;
  left: 50%;
  bottom: 58px;
  z-index: 9998;
  width: min(620px, calc(100vw - 28px));
  transform: translate(-50%, 18px) scale(.98);
  opacity: 0;
  pointer-events: none;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 12px;
  background:
    linear-gradient(105deg, rgba(96, 165, 250, .16), rgba(14, 14, 16, .94) 36%, rgba(14, 14, 16, .94) 64%, rgba(255, 138, 0, .14)),
    rgba(12, 12, 14, .92);
  backdrop-filter: blur(18px) saturate(1.25);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
  box-shadow: 0 10px 34px rgba(0, 0, 0, .34);
  transition: transform .24s cubic-bezier(.2, .85, .2, 1), opacity .2s ease, bottom .24s cubic-bezier(.2, .85, .2, 1);
}

.period-gate.open {
  transform: translate(-50%, 0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

#settings-panel.open~.period-gate {
  bottom: 118px;
}

.period-gate.overtime {
  background:
    linear-gradient(105deg, rgba(248, 113, 113, .18), rgba(14, 14, 16, .95) 36%, rgba(14, 14, 16, .95) 64%, rgba(250, 204, 21, .16)),
    rgba(12, 12, 14, .94);
}

.pg-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #dbeafe;
  background: rgba(96, 165, 250, .14);
  border: 1px solid rgba(96, 165, 250, .22);
  flex-shrink: 0;
}

.period-gate.overtime .pg-mark {
  color: #fde68a;
  background: rgba(250, 204, 21, .12);
  border-color: rgba(250, 204, 21, .22);
}

.pg-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.pg-kicker {
  color: #71717a;
  font: 700 9px/1 "Inter", system-ui, sans-serif;
  letter-spacing: .7px;
  text-transform: uppercase;
}

.pg-title {
  color: #f4f4f5;
  font: 800 14px/1 "Inter", system-ui, sans-serif;
  letter-spacing: 0;
}

.pg-subtitle {
  color: #a1a1aa;
  font: 500 10px/1.2 "Inter", system-ui, sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pg-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.pg-btn {
  height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 7px;
  background: rgba(255, 255, 255, .06);
  color: #d4d4d8;
  font: 700 10px/1 "Inter", system-ui, sans-serif;
  cursor: pointer;
  transition: transform .1s ease, background .14s ease, color .14s ease, opacity .14s ease;
}

.pg-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, .11);
  color: #ffffff;
  transform: translateY(-1px);
}

.pg-btn:active:not(:disabled) {
  transform: scale(.96);
}

.pg-btn:disabled {
  opacity: .38;
  cursor: default;
}

.pg-primary {
  color: #dbeafe;
  background: rgba(96, 165, 250, .18);
  border-color: rgba(96, 165, 250, .28);
}

/* ---------- responsive ---------- */
@media (max-width:760px) {
  .table-widget {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
    height: min(460px, calc(100vh - 78px));
  }

  .players-pane {
    width: min(560px, calc(100vw - 36px));
  }

  .table-settings-pane {
    width: min(560px, calc(100vw - 36px));
  }

  .table-copy-row {
    flex-wrap: wrap;
  }

  .players-editor {
    grid-template-columns: 1fr;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 2px;
  }

  .players-edit-list {
    max-height: 138px;
  }

  .table-panel {
    padding: 12px;
    gap: 10px;
  }

  .table-title strong {
    font-size: 16px;
  }

  .table-badge {
    display: none;
  }

  .player-list li {
    gap: 5px;
    padding: 4px 5px;
  }

  .player-list span {
    font-size: 9px;
  }

  .player-list strong {
    font-size: 10px;
  }
}

@media (max-width:480px) {
  #settings-panel {
    min-width: 280px;
    max-width: 95vw;
  }

  .sp-tabs {
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .sp-tabs::-webkit-scrollbar {
    display: none;
  }

  .widget-switch-btn {
    padding: 0 7px;
  }

  .players-pane {
    width: calc(100vw - 34px);
  }

  .table-settings-pane {
    width: calc(100vw - 34px);
  }

  .sp-text-lg,
  .sp-text-sm {
    width: 96px;
  }

  .player-edit-row {
    grid-template-columns: minmax(0, 1fr) 54px 22px;
  }

  .table-widget {
    height: min(500px, calc(100vh - 78px));
  }

  .table-header {
    gap: 8px;
  }

  .table-logo {
    width: 38px;
    height: 38px;
  }

  .table-title strong {
    font-size: 13px;
  }

  .table-rosters {
    gap: 8px;
  }

  .table-team {
    gap: 6px;
    padding: 8px;
  }

  .player-list {
    gap: 4px;
  }

  .player-list li {
    min-height: 18px;
  }

  .sp-range {
    width: 56px;
    min-width: 40px;
  }

  .sp-group {
    gap: 4px;
  }

  .period-gate {
    grid-template-columns: auto minmax(0, 1fr);
    bottom: 56px;
  }

  #settings-panel.open~.period-gate {
    bottom: 132px;
  }

  .pg-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .pg-subtitle {
    white-space: normal;
  }
}
