:root {
  color-scheme: dark;
  --ink: #f7fbf9;
  --muted: #9eaaa4;
  --panel: #141816;
  --panel-strong: #0b0e0c;
  --line: rgba(255, 255, 255, 0.14);
  --home: #1f6fd1;
  --away: #d83a24;
  --accent: #f2b632;
  --green: #47c977;
  --danger: #ff503f;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: auto;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background:
    linear-gradient(135deg, rgba(31, 111, 209, 0.22), transparent 28%),
    linear-gradient(225deg, rgba(216, 58, 36, 0.2), transparent 30%),
    #090b0a;
  color: var(--ink);
  -webkit-overflow-scrolling: touch;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #202622;
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
}

button:hover {
  border-color: rgba(255, 255, 255, 0.34);
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

select {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #202622;
  color: var(--ink);
  font-weight: 900;
}

input {
  width: 100%;
  border: 0;
  border-bottom: 2px solid rgba(255, 255, 255, 0.28);
  background: transparent;
  color: white;
  text-align: center;
  font-size: clamp(1.2rem, 2vw, 2rem);
  font-weight: 950;
  outline: none;
}

input[readonly] {
  cursor: default;
  user-select: none;
}

input[readonly]:focus {
  border-bottom-color: rgba(255, 255, 255, 0.28);
}

.auth-locked {
  overflow: hidden;
}

.auth-locked .scoreboard,
.auth-locked .toast {
  filter: blur(10px);
  pointer-events: none;
  user-select: none;
}

.login-dialog {
  width: min(420px, calc(100vw - 28px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.login-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.login-panel {
  position: relative;
  padding: clamp(22px, 4vw, 34px);
  display: grid;
  gap: 18px;
  background: var(--panel-strong);
}

.dialog-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 38px;
  min-height: 38px;
  border-radius: 999px;
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.86);
  font-size: 1.45rem;
  line-height: 1;
  z-index: 2;
}

.dialog-close:hover {
  border-color: rgba(242, 182, 50, 0.75);
  color: var(--accent);
}

.mode-exit-btn {
  width: 34px;
  min-height: 30px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.92);
  font-size: 1.75rem;
  line-height: 1;
  padding: 0;
  transform: translate(14px, -6px);
}

.mode-exit-btn:hover {
  background: transparent;
  color: var(--danger);
  transform: translate(14px, -7px);
}

.login-panel h1 {
  font-size: clamp(2.2rem, 8vw, 4rem);
}

.login-panel label {
  display: grid;
  gap: 8px;
}

.login-panel span {
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.78rem;
  font-weight: 950;
  text-transform: uppercase;
}

.login-panel input {
  min-height: 54px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #202622;
  text-align: left;
  font-size: 1.15rem;
}

.login-panel button {
  min-height: 54px;
}

.login-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mode-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.mode-actions button {
  border-color: rgba(242, 182, 50, 0.7);
  background: rgba(242, 182, 50, 0.14);
  color: var(--accent);
  text-transform: uppercase;
}

.tournament-field-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.login-error {
  min-height: 1.3em;
  margin: 0;
  color: var(--danger);
  font-weight: 900;
}

.scoreboard {
  width: min(1500px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(12px, 2vw, 28px);
  display: grid;
  align-content: center;
  gap: clamp(12px, 1.6vw, 22px);
}

.match-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
}

.header-controls {
  display: flex;
  align-items: end;
  gap: 12px;
}

.scoreboard-status-stack {
  display: grid;
  justify-items: center;
  gap: 2px;
}

.class-control {
  display: grid;
  justify-items: center;
  gap: 6px;
}

.class-control-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  line-height: 1;
  text-transform: uppercase;
}

.division-select {
  min-width: 112px;
  min-height: 54px;
  padding: 0 14px;
  border-color: rgba(242, 182, 50, 0.7);
  background: #202622;
  color: var(--accent);
  font-size: 1.1rem;
  text-align: center;
  text-transform: uppercase;
}

.division-select:disabled {
  -webkit-text-fill-color: var(--accent);
  appearance: none;
  background-image: none;
  border-color: rgba(134, 195, 255, 0.92);
  cursor: not-allowed;
  opacity: 1;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

.league-name {
  width: min(520px, 100%);
  margin: 0 0 6px;
  border-bottom: 1px solid transparent;
  color: var(--accent);
  text-align: left;
  font-size: 0.78rem;
  font-weight: 950;
  text-transform: uppercase;
}

.league-name:focus {
  border-bottom-color: var(--accent);
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 4.5rem);
  line-height: 0.98;
}

.scoreboard-title {
  width: min(780px, 100%);
  border-bottom-color: transparent;
  text-align: left;
  font-size: clamp(2rem, 4vw, 4.5rem);
  line-height: 0.98;
}

.scoreboard-title:focus {
  border-bottom-color: var(--accent);
}

.settings-btn {
  width: 54px;
  min-width: 54px;
  min-height: 54px;
  border-color: rgba(242, 182, 50, 0.7);
  background: rgba(242, 182, 50, 0.12);
  color: var(--accent);
  font-size: 1.35rem;
  line-height: 1;
}

.settings-btn:hover {
  border-color: var(--accent);
  background: rgba(242, 182, 50, 0.2);
}

.audio-settings-menu {
  position: relative;
  z-index: 20;
}

.audio-settings-menu summary {
  list-style: none;
  display: grid;
  place-items: center;
}

.audio-settings-menu summary::-webkit-details-marker {
  display: none;
}

.audio-settings-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(360px, calc(100vw - 28px));
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  gap: 12px;
  background: rgba(11, 14, 12, 0.98);
  box-shadow: var(--shadow);
  text-align: left;
}

.audio-settings-popover strong {
  color: var(--accent);
  font-size: 0.9rem;
  text-transform: uppercase;
}

.audio-settings-popover label {
  display: grid;
  gap: 6px;
}

.audio-settings-popover span {
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.audio-settings-popover select {
  width: 100%;
  min-height: 44px;
  padding: 0 10px;
  border-color: rgba(255, 255, 255, 0.18);
  background: #202622;
  color: var(--ink);
  text-transform: none;
}

.audio-settings-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.dialog-audio-settings-menu {
  position: absolute;
  top: 10px;
  right: 58px;
}

.dialog-audio-settings-menu .settings-btn {
  width: 38px;
  min-width: 38px;
  min-height: 38px;
  border-radius: 999px;
  font-size: 1rem;
}

.dialog-audio-settings-menu .audio-settings-popover {
  right: -48px;
}

.dialog-settings-btn {
  position: absolute;
  top: 10px;
  right: 58px;
  width: 38px;
  min-width: 38px;
  min-height: 38px;
  border-radius: 999px;
  font-size: 1rem;
  z-index: 2;
}

.audio-settings-dialog {
  width: min(460px, calc(100vw - 28px));
}

.audio-settings-panel select {
  width: 100%;
  min-height: 54px;
  padding: 0 12px;
  border-color: rgba(255, 255, 255, 0.18);
  background: #202622;
  color: var(--ink);
  text-transform: none;
}

.phase-badge {
  min-width: 140px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #15120a;
  font-size: 1.1rem;
  font-weight: 950;
  text-transform: uppercase;
}

body[data-phase="live"] .phase-badge {
  background: var(--green);
}

body[data-phase="break"] .phase-badge {
  background: #ffffff;
}

body[data-phase="initial"] .phase-badge {
  background: #f2b632;
}

body[data-phase="overtime"] .phase-badge {
  background: #8ad7ff;
}

body[data-phase="timeout"] .phase-badge {
  background: var(--accent);
}

body[data-phase="finished"] .phase-badge {
  background: var(--danger);
  color: white;
}

.score-grid {
  display: grid;
  grid-template-columns: minmax(190px, 0.9fr) minmax(330px, 1.1fr) minmax(190px, 0.9fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

.team-panel,
.clock-panel {
  min-height: clamp(360px, 52vh, 520px);
  padding: clamp(14px, 1.8vw, 24px);
}

.team-panel {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 14px;
}

.team-panel.home {
  background: linear-gradient(160deg, #164271, var(--home));
}

.team-panel.away {
  background: linear-gradient(160deg, #711e16, var(--away));
}

.team-panel label,
.clock-label,
.break-board span,
.match-tools span,
.tool-label {
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.78rem;
  font-weight: 950;
  text-transform: uppercase;
}

.score {
  font-variant-numeric: tabular-nums;
  font-size: clamp(5rem, 16vw, 14rem);
  line-height: 0.85;
  font-weight: 950;
}

.score-controls,
.timeout-controls,
.control-deck,
.mini-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.score-controls button {
  min-width: 68px;
  min-height: 58px;
  background: rgba(255, 255, 255, 0.14);
  font-size: 1.5rem;
}

.score-controls [data-no-point] {
  min-width: 160px;
  padding: 0 16px;
  font-size: 1rem;
  text-transform: uppercase;
}

.timeout-controls {
  align-items: center;
  flex-direction: column;
  gap: 6px;
}

.timeout-controls button {
  min-width: 160px;
  padding: 0 16px;
  background: rgba(242, 182, 50, 0.18);
  color: var(--accent);
  font-size: 1rem;
  text-transform: uppercase;
}

.timeout-controls button[data-used="true"] {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.62);
  border-color: rgba(255, 255, 255, 0.18);
}

.timeout-controls small {
  color: rgba(255, 255, 255, 0.78);
  font-weight: 900;
  text-transform: uppercase;
}

.timeout-controls .next-game-preview {
  width: min(100%, 220px);
  padding: 5px 8px;
  border: 1px solid rgba(242, 182, 50, 0.28);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
  color: rgba(255, 255, 255, 0.9);
  font-size: clamp(0.58rem, 1vw, 0.72rem);
  line-height: 1.15;
  text-transform: uppercase;
}

.timeout-controls .next-game-preview[hidden] {
  display: none;
}

.team-select {
  width: min(280px, 100%);
  padding: 0 12px;
  text-align: center;
  text-transform: uppercase;
}

.clock-panel {
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  gap: 18px;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 44px),
    var(--panel-strong);
}

.main-clock {
  width: min(100%, 560px);
  border-bottom: 0;
  font-variant-numeric: tabular-nums;
  font-size: clamp(4rem, 9vw, 9rem);
  line-height: 0.9;
  font-weight: 950;
}

.main-clock:focus {
  border-bottom: 2px solid var(--accent);
}

.clock-actions {
  width: min(320px, 100%);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.switch-btn {
  min-width: 0;
  min-height: 38px;
  padding: 0 10px;
  border-color: rgba(242, 182, 50, 0.7);
  background: rgba(242, 182, 50, 0.14);
  color: var(--accent);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.timer-presets {
  width: min(360px, 100%);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.timer-presets button {
  min-height: 38px;
  padding: 0 8px;
  border-color: rgba(138, 215, 255, 0.52);
  background: rgba(138, 215, 255, 0.12);
  color: #8ad7ff;
  font-size: 0.8rem;
  font-weight: 950;
}

.timer-presets button:hover {
  border-color: rgba(138, 215, 255, 0.92);
  background: rgba(138, 215, 255, 0.22);
}

.interval-board {
  width: min(320px, 100%);
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
}

.initial-board {
  width: min(320px, 100%);
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.07);
}

.initial-board span {
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.78rem;
  font-weight: 950;
  text-transform: uppercase;
}

.initial-board input {
  width: 110px;
  border-bottom: 0;
  font-variant-numeric: tabular-nums;
  color: #8ad7ff;
  font-size: 2rem;
  font-weight: 950;
  text-align: right;
}

.initial-board input:focus {
  border-bottom: 2px solid var(--accent);
}

body[data-phase="initial"] .initial-board {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(242, 182, 50, 0.16);
}

.break-board {
  width: min(320px, 100%);
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.07);
}

.break-board output {
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  font-size: 2rem;
  font-weight: 950;
}

body[data-phase="break"] .break-board {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(242, 182, 50, 0.16);
}

.interval-board .initial-board,
.interval-board .break-board {
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  display: none;
}

body[data-interval-board="start"] .interval-board .initial-board,
body[data-interval-board="break"] .interval-board .break-board {
  display: flex;
}

body[data-interval-board="start"] .interval-board,
body[data-interval-board="break"] .interval-board {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(242, 182, 50, 0.16);
}

.control-deck {
  width: min(440px, 100%);
  flex-wrap: wrap;
  justify-content: center;
}

.control-deck button {
  min-width: 132px;
  padding: 0 16px;
}

button.primary {
  background: var(--green);
  color: #07100b;
}

button.danger {
  background: var(--danger);
  color: white;
}

.match-tools {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.match-tools article {
  min-height: 88px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  align-content: center;
  gap: 5px;
  background: var(--panel);
}

.match-tools span,
.match-tools .tool-label {
  font-size: 0.68rem;
  line-height: 1.05;
}

.match-tools strong {
  font-size: 1rem;
  line-height: 1.05;
}

.match-tools small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  line-height: 1.12;
}

.match-tools select,
.match-tools .team-select {
  min-height: 40px;
  font-size: 0.92rem;
}

.phase-select {
  width: 100%;
  padding: 0 12px;
  text-transform: uppercase;
}

.next-match-controls {
  display: grid;
  gap: 8px;
}

.next-match-controls .team-select {
  width: 100%;
}

.mini-controls {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.mini-controls button {
  width: 38px;
  min-height: 36px;
  padding: 0;
}

.network-panel {
  display: grid;
  grid-template-columns: minmax(240px, 1fr);
  gap: 14px;
}

.network-panel div {
  min-width: 0;
  min-height: 64px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  align-content: center;
  gap: 4px;
  background: var(--panel);
}

.network-panel span {
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.78rem;
  font-weight: 950;
  text-transform: uppercase;
}

.network-panel a {
  min-width: 0;
  color: var(--accent);
  font-size: clamp(0.76rem, 1.1vw, 0.95rem);
  font-weight: 900;
  line-height: 1.12;
  overflow-wrap: anywhere;
  text-decoration: none;
  word-break: break-word;
}

.network-panel a:hover {
  text-decoration: underline;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: min(380px, calc(100vw - 44px));
  border-radius: 8px;
  padding: 13px 16px;
  background: white;
  color: #0b0e0c;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: 180ms ease;
  font-weight: 900;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.guest-session .header-controls,
.guest-session .interval-board,
.guest-session .initial-board,
.guest-session .break-board,
.guest-session .clock-actions,
.guest-session .control-deck #breakBtn,
.guest-session .control-deck #resetBtn,
.guest-session .timeout-controls,
.guest-session .match-tools,
.guest-session .network-panel,
.guest-session [data-no-point] {
  display: none;
}

.guest-session .control-deck {
  width: min(240px, 100%);
}

.guest-session .guest-reset-btn {
  width: 100%;
  min-height: 52px;
  border-color: rgba(255, 255, 255, 0.22);
  background: #ff4d4d;
  color: #fff;
}

.guest-session .clock-panel {
  gap: 24px;
}

.copyright-line {
  width: min(1500px, 100%);
  margin: -12px auto 18px;
  padding: 0 clamp(12px, 2vw, 28px);
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
}

@media (max-width: 1040px) {
  .score-grid,
  .match-tools,
  .network-panel {
    grid-template-columns: 1fr;
  }

  .team-panel,
  .clock-panel {
    min-height: 320px;
  }
}

@media (max-width: 1180px) and (min-width: 1041px) {
  .match-tools {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .scoreboard {
    width: max(700px, 100vw);
    min-height: 500px;
    min-height: max(500px, 100dvh);
    max-width: none;
    padding: 16px;
    align-content: start;
  }

  .match-header {
    align-items: end;
    flex-direction: row;
  }

  .header-controls {
    align-items: end;
  }

  .division-select {
    flex: 0 0 auto;
  }

  .phase-badge {
    flex: 0 0 auto;
  }

  .score-grid {
    grid-template-columns: minmax(170px, 0.9fr) minmax(290px, 1.1fr) minmax(170px, 0.9fr);
  }

  .match-tools {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .network-panel {
    grid-template-columns: minmax(220px, 1fr);
  }

  .team-panel,
  .clock-panel {
    min-height: 280px;
    padding: 16px;
  }

  .control-deck button {
    flex: 1 1 140px;
  }

  .network-panel div {
    min-height: 60px;
    padding: 10px 12px;
  }
}

@media (max-width: 520px) {
  .score {
    font-size: clamp(5rem, 16vw, 14rem);
  }

  .main-clock {
    font-size: clamp(4rem, 9vw, 9rem);
  }
}

.field-device-page {
  min-height: 100vh;
  overflow-x: hidden;
}

.field-device-shell {
  width: min(760px, calc(100vw - 28px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  place-items: center;
  padding: 28px 0;
}

.field-device-card {
  width: 100%;
  padding: clamp(22px, 5vw, 44px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(20, 24, 22, 0.9);
  box-shadow: var(--shadow);
}

.field-device-card h1 {
  margin: 0;
  font-size: clamp(2.2rem, 8vw, 5rem);
  line-height: 0.92;
  letter-spacing: -0.05em;
  text-transform: uppercase;
}

.field-device-copy {
  max-width: 56ch;
  margin: 14px 0 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 1rem;
  font-weight: 750;
  line-height: 1.45;
}

.field-device-form {
  margin-top: 24px;
  display: grid;
  gap: 16px;
}

.field-device-form label {
  display: grid;
  gap: 8px;
}

.field-device-form span {
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.78rem;
  font-weight: 950;
  text-transform: uppercase;
}

.field-device-form input,
.field-device-form select {
  min-height: 54px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #202622;
  text-align: left;
  font-size: 1.08rem;
}

.field-device-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.field-device-link {
  min-height: 54px;
  padding: 0 18px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 950;
}

.primary-link,
.field-device-actions .primary {
  border-color: rgba(71, 201, 119, 0.75);
  background: var(--green);
  color: #06120a;
}

.login-error.is-success {
  color: var(--green);
}

@media (max-width: 620px) {
  .field-device-actions {
    grid-template-columns: 1fr;
  }
}

.offline-sync-panel {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.offline-sync-button {
  border: 1px solid rgba(49, 195, 255, 0.45);
  border-radius: 14px;
  background: rgba(49, 195, 255, 0.14);
  color: #e9f3ff;
  font: inherit;
  font-weight: 900;
  letter-spacing: 0.04em;
  padding: 0.7rem 1rem;
  text-transform: uppercase;
  cursor: pointer;
}

.offline-sync-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

#offlineSyncStatus {
  color: #9fb0c1;
  font-size: 0.88rem;
  font-weight: 800;
}

.event-display-page {
  min-height: 100vh;
  overflow-x: hidden;
}

.event-display-scoreboard {
  min-height: 100vh;
  align-content: center;
}

.event-display-title {
  max-width: min(900px, 100%);
}

.event-display-class {
  display: grid;
  place-items: center;
  text-decoration: none;
}

.event-display-grid .score-controls,
.event-display-grid .timeout-controls,
.event-display-clock .clock-actions,
.event-display-clock .timer-presets,
.event-display-clock .control-deck {
  display: none;
}

.event-display-team {
  gap: clamp(10px, 1.6vw, 18px);
  text-align: center;
}

.event-display-side {
  color: rgba(255, 255, 255, 0.72);
  font-size: clamp(0.85rem, 1.15vw, 1.15rem);
  font-weight: 950;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.event-display-team-name {
  width: 100%;
  color: #fff;
  font-size: clamp(2rem, 4.1vw, 4.8rem);
  line-height: 0.98;
  overflow-wrap: anywhere;
  text-transform: uppercase;
}

.event-display-clock {
  gap: clamp(12px, 1.7vw, 22px);
}

.event-display-clock .main-clock {
  display: block;
  color: #fff;
  text-align: center;
}

.event-display-interval {
  width: min(420px, 100%);
}

.event-display-interval .break-board {
  display: flex;
}

.event-display-status {
  color: var(--accent);
  font-size: clamp(1rem, 1.6vw, 1.65rem);
  line-height: 1.05;
  text-transform: uppercase;
}

.event-display-race {
  color: rgba(255, 255, 255, 0.72);
  font-size: clamp(0.95rem, 1.25vw, 1.25rem);
  font-weight: 900;
  text-transform: uppercase;
}

.event-display-tools {
  grid-template-columns: 0.9fr 0.9fr 0.8fr minmax(280px, 2fr);
}

.event-display-tools article {
  min-height: 76px;
}

.event-display-next-card strong {
  overflow-wrap: anywhere;
}

@media (max-width: 1040px) {
  .event-display-tools {
    grid-template-columns: 1fr;
  }
}

.obs-overlay-page {
  width: 100vw;
  height: 100vh;
  margin: 0;
  overflow: hidden;
  background: transparent !important;
}

.obs-overlay-page::before,
.obs-overlay-page::after {
  display: none !important;
}

.obs-overlay {
  width: 100vw;
  height: 100vh;
  padding: clamp(14px, 1.8vw, 34px);
  display: grid;
  align-content: end;
  gap: clamp(8px, 1vw, 14px);
  background: transparent;
  color: #fff;
  font-family: inherit;
}

.obs-overlay-bar {
  width: min(1780px, 96vw);
  min-height: clamp(86px, 10vw, 136px);
  margin: 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.58fr) minmax(0, 1fr);
  overflow: hidden;
  background: rgba(8, 13, 18, 0.78);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.46);
  backdrop-filter: blur(10px);
}

.obs-overlay-team {
  min-width: 0;
  display: grid;
  align-items: center;
  gap: clamp(10px, 1.4vw, 22px);
  padding: clamp(12px, 1.6vw, 26px);
}

.obs-overlay-home {
  grid-template-columns: minmax(0, 1fr) auto;
  background: linear-gradient(90deg, rgba(22, 66, 113, 0.96), rgba(22, 66, 113, 0.34));
}

.obs-overlay-away {
  grid-template-columns: auto minmax(0, 1fr);
  background: linear-gradient(90deg, rgba(113, 30, 22, 0.34), rgba(113, 30, 22, 0.96));
}

.obs-overlay-name {
  min-width: 0;
  color: #fff;
  font-size: clamp(1.4rem, 3.2vw, 4.2rem);
  font-weight: 950;
  line-height: 0.96;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 3px 14px rgba(0, 0, 0, 0.55);
  text-transform: uppercase;
  white-space: nowrap;
}

.obs-overlay-away .obs-overlay-name {
  text-align: right;
}

.obs-overlay-score {
  min-width: clamp(58px, 6.4vw, 118px);
  min-height: clamp(58px, 6.4vw, 118px);
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.94);
  color: #0a0d10;
  font-size: clamp(2.3rem, 5.4vw, 6.8rem);
  font-weight: 950;
  line-height: 1;
}

.obs-overlay-center {
  min-width: 0;
  padding: clamp(10px, 1.3vw, 20px);
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 4px;
  background: rgba(4, 8, 12, 0.84);
  text-align: center;
}

.obs-overlay-meta {
  max-width: 100%;
  display: flex;
  justify-content: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.72);
  font-size: clamp(0.58rem, 0.95vw, 0.86rem);
  font-weight: 950;
  letter-spacing: 0.08em;
  line-height: 1.1;
  overflow: hidden;
  text-transform: uppercase;
  white-space: nowrap;
}

.obs-overlay-meta strong {
  color: #31c3ff;
}

.obs-overlay-clock {
  color: #fff;
  font-size: clamp(2.2rem, 5vw, 6.2rem);
  font-weight: 950;
  line-height: 0.95;
  text-shadow: 0 4px 16px rgba(0, 0, 0, 0.58);
}

.obs-overlay-timer {
  min-width: min(220px, 100%);
  padding: 5px 10px;
  border-radius: 999px;
  display: flex;
  justify-content: center;
  gap: 8px;
  background: rgba(242, 182, 50, 0.16);
  color: #f2b632;
  font-size: clamp(0.72rem, 1vw, 1rem);
  font-weight: 950;
  line-height: 1;
  text-transform: uppercase;
}

.obs-overlay-status {
  display: flex;
  gap: 8px;
  color: rgba(255, 255, 255, 0.68);
  font-size: clamp(0.58rem, 0.82vw, 0.78rem);
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

body[data-phase="live"] .obs-overlay-timer {
  background: rgba(52, 211, 153, 0.18);
  color: #4ade80;
}

body[data-phase="break"] .obs-overlay-timer {
  background: rgba(239, 68, 68, 0.22);
  color: #ff6b6b;
}

body[data-phase="finished"] .obs-overlay-timer {
  background: rgba(239, 68, 68, 0.32);
  color: #fff;
}

.obs-overlay-next {
  width: min(1780px, 96vw);
  min-height: clamp(34px, 4vw, 54px);
  margin: 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  background: rgba(8, 13, 18, 0.72);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(8px);
}

.obs-overlay-next span,
.obs-overlay-next em {
  color: rgba(255, 255, 255, 0.62);
  font-size: clamp(0.66rem, 0.92vw, 0.9rem);
  font-style: normal;
  font-weight: 950;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.obs-overlay-next strong {
  min-width: 0;
  color: #fff;
  font-size: clamp(0.9rem, 1.5vw, 1.5rem);
  font-weight: 950;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

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

@media (max-width: 920px) {
  .obs-overlay-bar {
    grid-template-columns: 1fr;
  }

  .obs-overlay-center {
    order: -1;
  }

  .obs-overlay-next {
    grid-template-columns: 1fr;
    text-align: center;
  }
}
