/* ===== ScoreWave — design system =====
 * Dark navy + neon blue admin (Waveform Media brand).
 * Scoreboard view uses dynamic team hex colors injected inline.
 */

:root {
  --sw-bg-0: #060F1F;        /* deepest */
  --sw-bg-1: #0A1828;        /* canvas */
  --sw-bg-2: #0F2138;        /* card */
  --sw-bg-3: #14304F;        /* elevated */
  --sw-border: #1E3A5F;
  --sw-border-soft: #15273F;
  --sw-text: #E8F0FF;
  --sw-text-muted: #7A8DA8;
  --sw-text-dim: #4D6383;

  /* brand */
  --sw-blue: #3B90ED;        /* PANTONE 636 */
  --sw-cyan: #28C1E5;        /* primary cyan */
  --sw-purple: #8B61E1;      /* tertiary */
  --sw-deep-purple: #330BC2;

  /* neon glow accents */
  --sw-neon-glow: 0 0 0 1px rgba(59, 144, 237, 0.55), 0 0 24px rgba(40, 193, 229, 0.18);
  --sw-neon-edge: linear-gradient(135deg, #28C1E5 0%, #3B90ED 50%, #8B61E1 100%);

  --sw-radius: 10px;
  --sw-radius-lg: 14px;
  --sw-radius-sm: 6px;
  --sw-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);

  --sw-font: "Space Grotesk", -apple-system, system-ui, sans-serif;
  --sw-font-display: "Barlow Condensed", "Oswald", system-ui, sans-serif;
  --sw-font-mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--sw-bg-1);
  color: var(--sw-text);
  font-family: var(--sw-font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

#root { min-height: 100vh; }

button { font-family: inherit; cursor: pointer; border: none; }
input, textarea { font-family: inherit; }

/* ====================================================================
 * ADMIN
 * ==================================================================== */
.sw-admin {
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(59, 144, 237, 0.08), transparent 60%),
    radial-gradient(900px 500px at 10% 110%, rgba(139, 97, 225, 0.06), transparent 60%),
    var(--sw-bg-1);
  padding: 28px 32px 80px;
  max-width: 1600px;
  margin: 0 auto;
}

/* Header */
.sw-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-bottom: 24px;
}

.sw-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.sw-logo-mark {
  width: 44px;
  height: 44px;
  filter: brightness(0) invert(1) drop-shadow(0 0 12px rgba(40, 193, 229, 0.45));
}
.sw-brand-text h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.02em;
  font-weight: 700;
  background: linear-gradient(90deg, #FFFFFF 0%, #28C1E5 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.sw-brand-text span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--sw-text-muted);
}

.sw-header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.sw-btn-primary {
  background: linear-gradient(135deg, #3B90ED 0%, #28C1E5 100%);
  color: #03101F;
  font-weight: 700;
  padding: 11px 18px;
  border-radius: var(--sw-radius);
  font-size: 13px;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  box-shadow: 0 4px 18px rgba(40, 193, 229, 0.35);
  transition: transform 0.12s, box-shadow 0.12s;
}
.sw-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(40, 193, 229, 0.5);
}
.sw-rec-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #FF3B5C;
  box-shadow: 0 0 8px rgba(255, 59, 92, 0.8);
  animation: sw-pulse 1.4s infinite;
}
@keyframes sw-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.sw-btn-ghost {
  background: var(--sw-bg-2);
  color: var(--sw-text);
  padding: 10px 14px;
  border-radius: var(--sw-radius);
  border: 1px solid var(--sw-border);
  font-size: 13px;
  transition: all 0.12s;
}
.sw-btn-ghost:hover {
  background: var(--sw-bg-3);
  border-color: var(--sw-blue);
}
.sw-btn-danger { color: #ff7a85; }
.sw-btn-danger:hover { border-color: #ff7a85; }

.sw-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--sw-bg-2);
  border: 1px solid var(--sw-border);
  border-radius: var(--sw-radius);
  font-size: 12px;
  color: var(--sw-text-muted);
  cursor: pointer;
}
.sw-toggle input { accent-color: var(--sw-cyan); }

/* Tabs */
.sw-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-bottom: 1px solid var(--sw-border-soft);
  padding-bottom: 6px;
  margin-bottom: 22px;
  align-items: center;
}
.sw-tab {
  display: inline-flex;
  align-items: stretch;
  background: var(--sw-bg-2);
  border: 1px solid var(--sw-border-soft);
  border-radius: var(--sw-radius);
  overflow: hidden;
  transition: all 0.12s;
}
.sw-tab-active {
  border-color: var(--sw-blue);
  box-shadow: var(--sw-neon-glow);
}
.sw-tab-main {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  background: transparent;
  color: var(--sw-text);
  font-size: 13px;
  font-weight: 500;
}
.sw-tab-dot {
  width: 6px; height: 18px; border-radius: 2px;
  display: inline-block;
}
.sw-tab-input {
  background: transparent;
  border: none;
  color: var(--sw-text);
  font-weight: 600;
  width: 120px;
  outline: none;
}
.sw-tab-input:focus { border-bottom: 1px dashed var(--sw-cyan); }
.sw-tab-score {
  font-family: var(--sw-font-mono);
  color: var(--sw-text-muted);
  font-size: 11px;
  margin-left: 4px;
}
.sw-tab-x {
  padding: 0 12px;
  background: transparent;
  color: var(--sw-text-muted);
  font-size: 16px;
  border-left: 1px solid var(--sw-border-soft);
}
.sw-tab-x:hover { color: var(--sw-text); background: var(--sw-bg-3); }
.sw-tab-add {
  padding: 9px 14px;
  background: transparent;
  color: var(--sw-cyan);
  border: 1px dashed var(--sw-border);
  border-radius: var(--sw-radius);
  font-size: 13px;
  font-weight: 500;
}
.sw-tab-add:hover { border-color: var(--sw-cyan); }

/* Section heads */
.sw-section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}
.sw-section-head h2 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--sw-text-muted);
  font-weight: 600;
  margin: 0;
}
.sw-checker-note {
  font-size: 11px;
  color: var(--sw-text-dim);
  font-family: var(--sw-font-mono);
}

/* Preview frame — checker pattern shows transparent areas */
.sw-preview-section { margin-bottom: 28px; }
.sw-preview-frame {
  border-radius: var(--sw-radius-lg);
  border: 1px solid var(--sw-border-soft);
  background-color: #0a0a0a;
  background-image:
    linear-gradient(45deg, #1a1a1a 25%, transparent 25%),
    linear-gradient(-45deg, #1a1a1a 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #1a1a1a 75%),
    linear-gradient(-45deg, transparent 75%, #1a1a1a 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
  padding: 20px;
  overflow: hidden;
}

/* Controls grid */
.sw-controls { margin-bottom: 32px; }
.sw-controls-grid {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr 1fr 1fr;
  gap: 14px;
}
@media (max-width: 1300px) {
  .sw-controls-grid { grid-template-columns: 1fr 1fr; }
}

.sw-control-card {
  background: var(--sw-bg-2);
  border: 1px solid var(--sw-border);
  border-radius: var(--sw-radius-lg);
  overflow: hidden;
  border-top-width: 2px;
}
.sw-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.sw-card-head-neutral {
  background: var(--sw-bg-3);
  color: var(--sw-text);
}
.sw-card-score {
  font-family: var(--sw-font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0;
}

/* Score buttons */
.sw-btn-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 14px;
}
.sw-btn-grid .sw-btn-neg { grid-column: span 3; }

.sw-btn {
  background: var(--sw-bg-3);
  color: var(--sw-text);
  border: 1px solid var(--sw-border);
  border-radius: var(--sw-radius);
  padding: 14px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: all 0.1s;
  position: relative;
  overflow: hidden;
}
.sw-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(40,193,229,0.18), transparent 60%);
  opacity: 0;
  transition: opacity 0.12s;
}
.sw-btn:hover { transform: translateY(-1px); border-color: var(--sw-blue); }
.sw-btn:hover::before { opacity: 1; }
.sw-btn:active { transform: translateY(1px); }

.sw-btn-val {
  font-family: var(--sw-font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--sw-cyan);
  line-height: 1;
}
.sw-btn-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--sw-text-muted);
}
.sw-btn-neg { background: transparent; }
.sw-btn-neg .sw-btn-val { color: #FF7A85; font-size: 20px; }

/* Game / Timer pills */
.sw-game-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sw-sub {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--sw-text-dim);
  margin-top: 4px;
}
.sw-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.sw-pill {
  background: var(--sw-bg-3);
  color: var(--sw-text);
  border: 1px solid var(--sw-border);
  border-radius: var(--sw-radius);
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.1s;
}
.sw-pill:hover { border-color: var(--sw-blue); }
.sw-pill-on {
  background: linear-gradient(135deg, rgba(59,144,237,0.25), rgba(40,193,229,0.15));
  border-color: var(--sw-blue);
  color: var(--sw-cyan);
}
.sw-pill-cta {
  padding: 14px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.sw-pill-go {
  background: linear-gradient(135deg, #1f9c5b, #2bd47e);
  border-color: transparent;
  color: #04140A;
}
.sw-pill-stop {
  background: linear-gradient(135deg, #c73a4f, #ff5c75);
  border-color: transparent;
  color: #1F0608;
}
.sw-pill-final.sw-pill-on {
  background: linear-gradient(135deg, #FF6B3D, #FFB13D);
  border-color: transparent;
  color: #1F0F00;
}
.sw-pill-buzz:hover { color: #FFB13D; border-color: #FFB13D; }
.sw-pill-danger:hover { color: #FF7A85; border-color: #FF7A85; }

.sw-timer-display {
  text-align: center;
  font-family: var(--sw-font-display);
  font-size: 48px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--sw-cyan);
  text-shadow: 0 0 24px rgba(40, 193, 229, 0.5);
  padding: 8px 0;
  font-variant-numeric: tabular-nums;
}

/* Setup section */
.sw-setup { margin-bottom: 24px; }
.sw-setup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 900px) {
  .sw-setup-grid { grid-template-columns: 1fr; }
}

.sw-panel {
  background: var(--sw-bg-2);
  border: 1px solid var(--sw-border);
  border-radius: var(--sw-radius-lg);
  padding: 20px;
}
.sw-panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--sw-border-soft);
}
.sw-side-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  padding: 4px 8px;
  border-radius: 4px;
}
.sw-side-home {
  background: rgba(59, 144, 237, 0.15);
  color: var(--sw-blue);
  border: 1px solid rgba(59, 144, 237, 0.3);
}
.sw-side-away {
  background: rgba(139, 97, 225, 0.15);
  color: var(--sw-purple);
  border: 1px solid rgba(139, 97, 225, 0.3);
}
.sw-side-timer {
  background: rgba(40, 193, 229, 0.15);
  color: var(--sw-cyan);
  border: 1px solid rgba(40, 193, 229, 0.3);
}
.sw-side-tweak {
  background: rgba(255, 107, 61, 0.15);
  color: #FF8E5C;
  border: 1px solid rgba(255, 107, 61, 0.3);
}
.sw-display-style-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 900px) {
  .sw-display-style-grid { grid-template-columns: 1fr; }
}
.sw-toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 13px;
  color: var(--sw-text);
  cursor: pointer;
}
.sw-toggle-row input { accent-color: var(--sw-cyan); width: 16px; height: 16px; }
.sw-slider-val {
  float: right;
  font-family: var(--sw-font-mono);
  color: var(--sw-cyan);
  font-size: 12px;
}
.sw-slider {
  width: 100%;
  accent-color: var(--sw-cyan);
  margin: 4px 0 2px;
}
.sw-slider-ticks {
  display: flex;
  justify-content: space-between;
  font-family: var(--sw-font-mono);
  font-size: 10px;
  color: var(--sw-text-dim);
  padding: 0 2px;
}
.sw-panel-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--sw-text);
}

.sw-field {
  margin-bottom: 12px;
}
.sw-field label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--sw-text-muted);
  margin-bottom: 6px;
}
.sw-field input,
.sw-field textarea {
  width: 100%;
  background: var(--sw-bg-1);
  border: 1px solid var(--sw-border);
  border-radius: var(--sw-radius);
  padding: 10px 12px;
  color: var(--sw-text);
  font-size: 13px;
  outline: none;
  transition: border-color 0.12s;
}
.sw-field input:focus { border-color: var(--sw-cyan); }

/* Hex picker */
.sw-hex {
  display: grid;
  grid-template-columns: 36px 1fr;
  grid-template-rows: auto auto;
  gap: 4px 10px;
  align-items: center;
  background: var(--sw-bg-1);
  border: 1px solid var(--sw-border);
  border-radius: var(--sw-radius);
  padding: 8px 10px;
}
.sw-hex-swatch {
  width: 36px;
  height: 36px;
  grid-row: 1 / 3;
  border-radius: var(--sw-radius-sm);
  border: 1px solid rgba(255,255,255,0.08);
  position: relative;
  cursor: pointer;
  overflow: hidden;
}
.sw-hex-swatch input[type="color"] {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  opacity: 0; cursor: pointer;
  border: none;
}
.sw-hex-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--sw-text-muted);
}
.sw-hex-text {
  background: transparent;
  border: none;
  color: var(--sw-text);
  font-family: var(--sw-font-mono);
  font-size: 12px;
  outline: none;
  padding: 0;
  width: 100%;
}

/* Logo upload */
.sw-logo-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.sw-logo-preview {
  width: 56px;
  height: 56px;
  border-radius: var(--sw-radius);
  background: var(--sw-bg-1);
  border: 1px solid var(--sw-border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.sw-logo-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.sw-logo-empty {
  font-size: 9px;
  color: var(--sw-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.sw-logo-actions {
  display: flex;
  gap: 6px;
}
.sw-logo-size {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  font-size: 11px;
  color: var(--sw-text-muted);
}
.sw-stepper {
  width: 26px; height: 26px;
  background: var(--sw-bg-3);
  border: 1px solid var(--sw-border);
  color: var(--sw-text);
  border-radius: 4px;
  font-size: 14px;
  line-height: 1;
}
.sw-stepper:hover { border-color: var(--sw-cyan); }
.sw-size-val { font-family: var(--sw-font-mono); font-size: 12px; min-width: 32px; text-align: center; }

/* Saved teams */
.sw-saved-list {
  margin-top: 10px;
  padding: 10px;
  background: var(--sw-bg-1);
  border: 1px solid var(--sw-border-soft);
  border-radius: var(--sw-radius);
  max-height: 220px;
  overflow-y: auto;
}
.sw-empty {
  color: var(--sw-text-dim);
  font-size: 12px;
  text-align: center;
  padding: 12px 0;
  margin: 0;
}
.sw-saved-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  border-bottom: 1px solid var(--sw-border-soft);
}
.sw-saved-item:last-child { border-bottom: none; }
.sw-saved-swatch {
  width: 28px; height: 28px;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.sw-saved-swatch img { max-width: 100%; max-height: 100%; }
.sw-saved-name { flex: 1; font-size: 13px; }
.sw-link {
  background: transparent;
  border: none;
  color: var(--sw-cyan);
  font-size: 12px;
  text-decoration: underline;
  padding: 4px 6px;
}
.sw-link-danger { color: #ff7a85; }

/* Footer */
.sw-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--sw-border-soft);
  font-size: 11px;
  color: var(--sw-text-dim);
}
.sw-foot-keys { font-family: var(--sw-font-mono); font-size: 10px; }

/* Modal */
.sw-modal {
  position: fixed; inset: 0;
  background: rgba(3, 8, 16, 0.78);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
}
.sw-modal-card {
  background: var(--sw-bg-2);
  border: 1px solid var(--sw-blue);
  border-radius: var(--sw-radius-lg);
  padding: 28px;
  max-width: 560px;
  width: 100%;
  box-shadow: var(--sw-shadow), var(--sw-neon-glow);
  position: relative;
}
.sw-modal-card-wide { max-width: 880px; }
.sw-share-preview-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--sw-text-muted);
  margin: 18px 0 8px;
}
.sw-share-preview {
  border-radius: var(--sw-radius);
  border: 1px solid var(--sw-border-soft);
  background-color: #0a0a0a;
  background-image:
    linear-gradient(45deg, #1a1a1a 25%, transparent 25%),
    linear-gradient(-45deg, #1a1a1a 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #1a1a1a 75%),
    linear-gradient(-45deg, transparent 75%, #1a1a1a 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
  overflow: hidden;
  height: 100px;
  padding: 0;
}
.sw-share-preview .sw-board {
  transform: scale(0.42);
  transform-origin: left top;
  width: 238%;
}
.sw-share-hint-small { font-size: 10px !important; opacity: 0.7; }
.sw-modal-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
  color: var(--sw-cyan);
}
.sw-modal-card p {
  color: var(--sw-text-muted);
  font-size: 13px;
  line-height: 1.5;
  margin: 0 0 16px;
}
.sw-share-url {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.sw-share-url input {
  flex: 1;
  background: var(--sw-bg-1);
  border: 1px solid var(--sw-border);
  border-radius: var(--sw-radius);
  padding: 10px 12px;
  color: var(--sw-cyan);
  font-family: var(--sw-font-mono);
  font-size: 12px;
}
.sw-share-url button {
  background: var(--sw-blue);
  color: white;
  border-radius: var(--sw-radius);
  padding: 10px 16px;
  font-weight: 600;
}
.sw-share-hint {
  font-size: 11px !important;
  color: var(--sw-text-dim) !important;
}
.sw-modal-close {
  position: absolute;
  top: 14px; right: 14px;
  background: transparent;
  color: var(--sw-text-muted);
  font-size: 20px;
  width: 32px; height: 32px;
  border-radius: 6px;
}
.sw-modal-close:hover { background: var(--sw-bg-3); color: var(--sw-text); }

/* Tweaks panel */
.sw-tweaks {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 320px;
  background: var(--sw-bg-2);
  border: 1px solid var(--sw-blue);
  border-radius: var(--sw-radius-lg);
  box-shadow: var(--sw-shadow), var(--sw-neon-glow);
  z-index: 90;
  overflow: hidden;
}
.sw-tweaks-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--sw-bg-3);
  border-bottom: 1px solid var(--sw-border);
}
.sw-tweaks-head h3 {
  margin: 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--sw-cyan);
  font-weight: 700;
}
.sw-tweaks-close {
  background: transparent;
  color: var(--sw-text-muted);
  font-size: 18px;
  width: 24px; height: 24px;
  border-radius: 4px;
}
.sw-tweaks-close:hover { color: var(--sw-text); background: var(--sw-bg-1); }
.sw-tweaks-body { padding: 14px 16px; }
.sw-tweak-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.sw-tweak-row > label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--sw-text-muted);
}
.sw-seg {
  display: flex;
  background: var(--sw-bg-1);
  border: 1px solid var(--sw-border);
  border-radius: var(--sw-radius);
  padding: 3px;
  gap: 2px;
}
.sw-seg button {
  flex: 1;
  background: transparent;
  color: var(--sw-text-muted);
  padding: 7px 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-radius: 5px;
  transition: all 0.12s;
}
.sw-seg-on {
  background: var(--sw-blue) !important;
  color: white !important;
}
.sw-tweak-hint {
  font-size: 11px;
  color: var(--sw-text-dim);
  margin: 8px 0 0;
}

/* ====================================================================
 * SCOREBOARD (broadcast view) — uses dynamic team hex inline
 * ==================================================================== */
.sw-display-root {
  /* Transparent so OBS chroma/luma keys cleanly. */
  background: transparent;
  min-height: 0;
  width: 100%;
}
body.sw-is-display,
html:has(body.sw-is-display) {
  background: transparent !important;
  margin: 0;
  padding: 0;
}

.sw-board {
  width: 100%;
  font-family: var(--sw-font-display);
  position: relative;
}
.sw-row {
  display: grid;
  /* logo + name + score | divider | score + name + logo | timer */
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 0;
}
.sw-team {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 8px 18px 28px;
  position: relative;
  min-height: 140px;
  overflow: hidden;
}
.sw-team-away {
  padding: 18px 28px 18px 8px;
}
.sw-team-side {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
  flex: 1;
}
.sw-team-side-away {
  justify-content: flex-end;
}
.sw-logo {
  height: 110px;
  width: 110px;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.35));
}
.sw-team-name {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}
.sw-team-name-away { align-items: flex-end; text-align: right; }
.sw-name-text {
  font-weight: 700;
  font-size: 78px;
  line-height: 0.95;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sw-record {
  font-family: var(--sw-font);
  font-weight: 500;
  font-size: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.78;
  margin-top: 4px;
}
.sw-score {
  font-weight: 700;
  font-size: 110px;
  line-height: 0.9;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.sw-divider {
  background: rgba(0, 0, 0, 0.85);
  color: rgba(255,255,255,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 80px;
  font-weight: 400;
  width: 28px;
  line-height: 1;
}
.sw-poss {
  position: absolute;
  top: 50%;
  left: 6px;
  transform: translateY(-50%);
  width: 6px;
  height: 60%;
  background: currentColor;
  border-radius: 3px;
  opacity: 0.85;
}
.sw-poss-right { left: auto; right: 6px; }

.sw-timer {
  background: #000;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 16px 36px;
  min-width: 240px;
}
.sw-time {
  font-size: 78px;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}
.sw-half {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-top: 4px;
  color: #FF6B3D;
}

/* Score animations */
.sw-num-wrap {
  display: inline-block;
  position: relative;
  perspective: 600px;
}
.sw-num {
  display: inline-block;
}
.sw-num-flip {
  animation: sw-flip var(--sw-anim-dur, 0.5s) cubic-bezier(.4,0,.2,1);
  transform-origin: 50% 60%;
  display: inline-block;
}
@keyframes sw-flip {
  0%   { transform: rotateX(0deg); }
  50%  { transform: rotateX(-90deg); }
  51%  { transform: rotateX(90deg); }
  100% { transform: rotateX(0deg); }
}
.sw-num-fade { animation: sw-fade var(--sw-anim-dur, 0.5s) ease-out; display: inline-block; }
@keyframes sw-fade {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}
.sw-num-slide {
  animation: sw-slide var(--sw-anim-dur, 0.5s) cubic-bezier(.2,.8,.2,1);
  display: inline-block;
}
@keyframes sw-slide {
  0%   { transform: translateY(-100%); }
  100% { transform: translateY(0); }
}

/* Buzzer flash */
.sw-buzz {
  position: absolute;
  inset: 0;
  background: rgba(255, 107, 61, 0.4);
  animation: sw-buzz 1.5s ease-out;
  pointer-events: none;
}
@keyframes sw-buzz {
  0%   { opacity: 0; }
  10%  { opacity: 1; }
  20%  { opacity: 0.4; }
  30%  { opacity: 1; }
  100% { opacity: 0; }
}

/* Scale the scoreboard down inside the preview frame for admin readability */
.sw-preview-frame .sw-board {
  transform: scale(0.62);
  transform-origin: left top;
  width: 161.3%; /* 100 / 0.62 */
}
.sw-preview-frame {
  height: 110px;
}
@media (max-width: 1100px) {
  .sw-preview-frame .sw-board { transform: scale(0.5); width: 200%; }
  .sw-preview-frame { height: 90px; }
}
