@font-face {
  font-family: Inter;
  src: url('/inter-latin.woff2') format('woff2');
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'Space Grotesk';
  src: url('/space-grotesk.ttf') format('truetype');
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
}

:root {
  color-scheme: dark;
  font-family: Inter, system-ui, sans-serif;
  --display: 'Space Grotesk', Inter, system-ui, sans-serif;
  --background: #090915;
  --border: #302e4b;
  --ink: #f7f6ff;
  --muted: #bcb9d1;
  --violet: #bbaeff;
  --lime: #d5fa93;
  --rose: #ffc6a5;
  --hero-ink: #c4b7ff;
  --ambient-glow: #282052;
  --ambient-edge: #171e36;
  --header-line: #b9a7ef26;
  --nav-base: #101020bf;
  --nav-hover: #292443;
  --panel-edge: #ad97f958;
  --setup-panel: linear-gradient(145deg, #201a38, #101023 62%);
  --label: #e4dff4;
  --surface: #131225;
  --select-edge: #8f7dc2;
  --selected-edge: #b4a1fa;
  --selected-bg: #2a2348;
  --selected-shadow: inset 0 0 16px #aa8dfc1b, 0 0 12px #a383ff14;
  --field-bg: #0c0c1b;
  --placeholder: #a19db7;
  --button-base: #1a1830;
  --button-hover: #27213f;
  --primary-edge: #c2aaff;
  --primary-bg: #b9a5fe;
  --primary-ink: #160d2e;
  --primary-glow: #a487ff3e;
  --primary-hover: #d0beff;
  --primary-hover-glow: #ad8fff65;
  --court-labels: #131125;
  --score-panel: radial-gradient(ellipse at 85% 1%, #291f44 0%, transparent 63%), #131227;
  --status-bg: #241d3d;
  --status-ink: #e6dfff;
  --positive-bg: #d5fa93;
  --error: #ffc0b9;
  --pending: #f6ccac;
  --celebration-bg: linear-gradient(112deg, #293b2a, #1f2531 75%);
  --celebration-alt-bg: linear-gradient(112deg, #4b2c34, #262238 75%);
  --cube-near: #161331;
  --cube-far: #111228;
  --cube-top: 111, 89, 188;
  --cube-edge: 173, 146, 252;
  --radius: 24px;
  color: var(--ink);
  background: var(--background);
}


:root[data-theme="ocean"] {
  --background: #071a24;
  --border: #28505b;
  --ink: #f1fffd;
  --muted: #b3cfd0;
  --violet: #89f0dc;
  --hero-ink: #89f0dc;
  --ambient-glow: #144b51;
  --ambient-edge: #193a52;
  --header-line: #91ecde38;
  --nav-base: #0c242ed9;
  --nav-hover: #19424b;
  --panel-edge: #74ccbf55;
  --setup-panel: linear-gradient(145deg, #163b43, #0b242e 62%);
  --label: #e2f4f3;
  --surface: #102a35;
  --select-edge: #67b2b2;
  --selected-edge: #89f0dc;
  --selected-bg: #214e55;
  --selected-shadow: inset 0 0 16px #89f0dc2a;
  --field-bg: #091c26;
  --placeholder: #a0bcc0;
  --button-base: #153841;
  --button-hover: #24545b;
  --primary-edge: #a6f7e7;
  --primary-bg: #86edda;
  --primary-ink: #0e3434;
  --primary-glow: #47bbae38;
  --primary-hover: #a9f4e6;
  --primary-hover-glow: #64ead66a;
  --court-labels: #0b2833;
  --score-panel: radial-gradient(ellipse at 85% 1%, #1c4851 0%, transparent 63%), #0c2731;
  --status-bg: #19454c;
  --status-ink: #defbf6;
  --celebration-bg: linear-gradient(112deg, #27472f, #163845 75%);
  --celebration-alt-bg: linear-gradient(112deg, #523438, #203646 75%);
  --cube-near: #15323c;
  --cube-far: #0c2634;
  --cube-top: 76, 185, 174;
  --cube-edge: 110, 219, 221;
}

:root[data-theme="sand"] {
  color-scheme: light;
  --background: #f5f2ea;
  --border: #c6cec1;
  --ink: #152f36;
  --muted: #48605f;
  --violet: #285e53;
  --lime: #445e18;
  --rose: #873e2b;
  --hero-ink: #286052;
  --ambient-glow: #fffdf5;
  --ambient-edge: #e6eee4;
  --header-line: #24463e24;
  --nav-base: #fffdf4d9;
  --nav-hover: #eaf0e4;
  --panel-edge: #c9d4c6;
  --setup-panel: linear-gradient(145deg, #fffef9, #fafbf4 72%);
  --label: #264541;
  --surface: #fcfbf6;
  --select-edge: #688379;
  --selected-edge: #39715e;
  --selected-bg: #e9f1e5;
  --selected-shadow: inset 0 0 0 1px #39715e20;
  --field-bg: #fffefa;
  --placeholder: #5c6c65;
  --button-base: #fafbf3;
  --button-hover: #eaf0e4;
  --primary-edge: #8a9d3f;
  --primary-bg: #d6ee62;
  --primary-ink: #172e29;
  --primary-glow: #79983924;
  --primary-hover: #e3f588;
  --primary-hover-glow: #7998393b;
  --status-bg: #e5eee2;
  --status-ink: #284a40;
  --positive-bg: #d6ee62;
  --error: #922c35;
  --pending: #784521;
  --celebration-bg: linear-gradient(112deg, #e5edca, #f7f9ed 80%);
  --cube-near: #c1cbb213;
  --cube-far: #c9bda21a;
  --cube-top: 248, 246, 233;
  --cube-edge: 122, 144, 119;
  --cube-ripple-scale: .55;
}

:root[data-theme="sand"] #cube-grid {
  mask-image: linear-gradient(#000 2%, #0009 28%, transparent 73%);
}
:root[data-theme="sand"] body:has(#match:not([hidden])) #cube-grid { opacity: .45; }
:root[data-theme="sand"] :is(.setup-form, .app-dialog, .court, .scoreboard, .preview-court) {
  box-shadow: 0 16px 40px #17382b19, 0 2px 7px #17382b0d;
}
:root[data-theme="sand"] .preview-court { border-color: #c8d1bb; }
:root[data-theme="sand"] .preview-court::after {
  background: linear-gradient(180deg, #fff0c91a, transparent 48%, #142b2d55);
}
:root[data-theme="sand"] .app-dialog::backdrop { background: #112d377d; }
:root[data-theme="sand"] .wizard-progress li[aria-current="step"] { border-color: var(--selected-edge); }
:root[data-theme="sand"] .device-choice input { accent-color: var(--selected-edge); }
:root[data-theme="sand"] :is(.court, .scoreboard) {
  color-scheme: dark;
  --ink: #fffdf5;
  --muted: #d3e3d9;
  --lime: #d6ee62;
  --rose: #ffbd91;
  --panel-edge: #46685f;
}
:root[data-theme="sand"] .court {
  --court-labels: #112d37;
  --celebration-bg: linear-gradient(120deg, #234337, #112d37 80%);
  --celebration-alt-bg: linear-gradient(120deg, #49352f, #112d37 80%);
}
:root[data-theme="sand"] .scoreboard {
  --score-panel: radial-gradient(ellipse at 100% 0%, #1e4548 0%, transparent 72%), #112d37;
  --status-bg: #234337;
  --status-ink: #fffdf5;
  color: var(--ink);
}
:root[data-theme="sand"] .award {
  background: linear-gradient(120deg, #d6ee62, #ecf5b3);
  border-color: #a8ba59;
}
:root[data-theme="sand"] .award-two {
  background: linear-gradient(120deg, #ffbd91, #ffdec6);
  border-color: #d99a77;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { min-height: 100vh; margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button, a, summary { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .45; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 4px; }

.ambient-scene {
  position: fixed;
  z-index: -1;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  background: radial-gradient(ellipse at 28% 12%, var(--ambient-glow) 0%, transparent 51%),
    radial-gradient(ellipse at 84% 28%, var(--ambient-edge) 0%, transparent 42%), var(--background);
}
#cube-grid {
  width: 100%;
  height: min(96vh, 890px);
  display: block;
  mask-image: linear-gradient(#000 25%, #000a 58%, transparent 100%);
}
body:has(#match:not([hidden])) #cube-grid { opacity: .65; }
.shell { width: min(100% - 64px, 1280px); margin-inline: auto; padding-bottom: 42px; }
.presentation .shell, :fullscreen .shell { width: min(100% - 28px, 1680px); }
.top {
  min-height: 77px;
  display: grid;
  grid-template-columns: minmax(max-content, 1fr) auto minmax(max-content, 1fr);
  grid-template-areas: "brand nav actions";
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--header-line);
}

.brand {
  grid-area: brand;
  display: block;
  width: clamp(114px, 20vw, 178px);
}
.brand img { display: block; width: 100%; height: auto; }
.site-actions {
  grid-area: actions;
  justify-self: end;
  display: inline-flex;
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--nav-base);
}
.site-actions:not(:has(> :not([hidden]))) { display: none; }
.top-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 44px;
  min-height: 44px;
  padding: 5px 7px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--label);
  font-size: .78rem;
  font-weight: 670;
  white-space: nowrap;
  transition: background-color 160ms, border-color 160ms, color 160ms;
}
.top-control svg {
  flex: none;
  width: 19px;
  height: 19px;
  fill: none;
  stroke: var(--violet);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.top-control:hover { background: var(--nav-hover); color: var(--ink); }
.top-control:focus-visible { outline-offset: -2px; }
.top-control[aria-pressed="true"], .top-control-account {
  border-color: var(--panel-edge);
  background: var(--selected-bg);
  color: var(--ink);
}
.top-control[aria-pressed="false"] .top-icon-exit,
.top-control[aria-pressed="true"] .top-icon-enter { display: none; }
.top-nav {
  grid-area: nav;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--nav-base);
}
.top-nav a {
  display: grid;
  place-items: center;
  padding: 8px clamp(8px, 1.2vw, 14px);
  border-radius: inherit;
  font-size: .79rem;
  font-weight: 650;
  text-align: center;
  color: var(--muted);
}
.top-nav a:hover, .top-nav a[aria-current="page"] { background: var(--nav-hover); color: var(--ink); }
.connection {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  font-size: .75rem;
  font-weight: 650;
  color: var(--muted);
}
.connection i { width: 7px; height: 7px; border-radius: 50%; background: #f6ac79; }
.connection[data-online="true"] i { background: var(--lime); box-shadow: 0 0 12px #bfff7990; }

h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--display); }
h1 { font-size: clamp(2rem, 4.75vw, 4.15rem); line-height: .99; letter-spacing: -.063em; }
h2 { font-size: clamp(1.36rem, 2.8vw, 1.8rem); line-height: 1.12; letter-spacing: -.045em; }
.setup {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(14px, 2.4vw, 30px);
  --setup-padding: clamp(14px, 2.2vw, 28px);
  align-items: stretch;
  padding-block: clamp(25px, 4.1vw, 56px) 36px;
}
.intro {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: clamp(12px, 1.8vw, 20px);
  padding: var(--setup-padding);
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius);
  background: var(--setup-panel);
}
.intro h1 { font-size: clamp(1.86rem, 4vw, 4rem); line-height: 1; }
.intro h1 span { color: var(--hero-ink); white-space: nowrap; }
.intro p {
  margin-top: .65em;
  font-size: clamp(.82rem, 1.5vw, 1rem);
  line-height: 1.45;
  color: var(--muted);
}
.preview-court {
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: clamp(150px, 21vw, 280px);
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid #c6aebd60;
  background: #292340 url('/arena.webp') center 65% / cover;
  box-shadow: 0 18px 64px #080515ae, 0 0 40px #8f76ff19;
}
.preview-court::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #4b37682b, transparent 38%, #130c30a0);
  pointer-events: none;
}
.setup-preview-court:has(.setup-preview:not([hidden])) {
  min-height: clamp(156px, 24vw, 280px);
}
.setup-preview-court:has(.setup-preview:not([hidden])) .setup-preview-photo { display: none; }
.setup-preview {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 4px;
  align-content: end;
  align-items: end;
  padding: 22% clamp(5px, 1.25vw, 15px) clamp(6px, 1.25vw, 12px);
}
.setup-preview-side, .setup-preview-player { display: contents; }
.setup-preview-side[data-team="0"] { --player-preview-accent: #d9ef91; }
.setup-preview-side[data-team="1"] { --player-preview-accent: #ffc8a8; }
.setup-preview [data-player-sprite] {
  grid-row: 1;
  justify-self: center;
  width: min(100%, 130px);
  height: 100%;
  min-height: 0;
  object-fit: contain;
  object-position: bottom center;
  filter: drop-shadow(0 3px 4px #251b249e);
}
#setup-preview-right [data-player-sprite] { transform: scaleX(-1); }
.setup-preview [data-player-name] {
  display: grid;
  place-items: center;
  grid-row: 2;
  align-self: stretch;
  min-width: 0;
  padding: 5px 3px;
  border: 1px solid var(--player-preview-accent, #faf6e6);
  border-radius: 7px;
  background: #17282ff0;
  color: #fffdf7;
  text-align: center;
  font: 700 clamp(.7rem, 1.32vw, .93rem)/1.12 var(--display);
  overflow-wrap: anywhere;
}
.setup-preview-player[data-serving="true"] [data-player-name] {
  background: var(--player-preview-accent, #d9ef91);
  color: #1e2c28;
}
.setup-form {
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius);
  padding: var(--setup-padding);
  min-width: 0;
  background: var(--setup-panel);
  box-shadow: 0 24px 56px #07050f8e, inset 0 1px #d3c4ff1e;
}

.setup-form h2 { margin-bottom: 17px; }
.wizard-progress {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 5px;
  padding: 0;
  margin: 0 0 18px;
  list-style: none;
  color: var(--muted);
}
.wizard-progress li {
  display: grid;
  place-items: center;
  padding: 7px 0;
  border-bottom: 2px solid var(--border);
  text-align: center;
  font-size: clamp(.57rem, 1.18vw, .76rem);
  font-weight: 630;
  overflow-wrap: anywhere;
}
.wizard-progress li[aria-current="step"] {
  border-color: var(--primary-bg);
  background: var(--selected-bg);
  border-radius: 5px 5px 0 0;
  color: var(--ink);
  font-weight: 760;
}
.team-members {
  min-width: 0;
  margin: 0;
  padding: 8px 10px 10px;
  border: 1px solid var(--border);
  border-radius: 11px;
}
.team-members legend { padding-inline: 5px; }
.team-members label + label { margin-top: 7px; }
.doubles-list { display: grid; gap: 8px; margin: 4px 0 8px; }
.double-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 9px; }
.double-fields label + label { margin-top: 0; }
.doubles-list .team-members .quiet { margin-top: 8px; min-height: 34px; color: var(--error); }

fieldset { min-width: 0; border: 0; padding: 0; margin: 18px 0 0; }
.mode-fieldset { margin: 0; }
legend { padding: 0; font-size: .83rem; font-weight: 700; color: var(--label); }
.modes, .categories, .formats { display: grid; gap: 7px; margin-top: 8px; }
.modes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.categories { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.modes label, .categories label, .formats label {
  position: relative;
  min-height: 43px;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 160ms, background-color 160ms, box-shadow 160ms;
}
.modes label:hover, .categories label:hover, .formats label:hover { border-color: var(--select-edge); }
.modes label:has(:checked), .categories label:has(:checked), .formats label:has(:checked) {
  border-color: var(--selected-edge);
  background: var(--selected-bg);
  box-shadow: var(--selected-shadow);
}
.modes input, .categories input, .formats input { flex: none; margin: 0; width: 14px; aspect-ratio: 1; accent-color: var(--violet); }
.modes b, .formats b { display: block; font-size: .86rem; }
.modes small, .formats small { display: block; margin-top: 3px; color: var(--muted); font-size: .73rem; line-height: 1.34; }
.categories label { justify-content: center; font-size: .83rem; font-weight: 700; padding-inline: 6px; }
.categories input { position: absolute; opacity: 0; inset-inline-start: 4px; }
.categories label:has(:focus-visible) { outline: 2px solid var(--lime); outline-offset: 3px; }
.teams, .event-fields { margin-top: 16px; }
.teams, .correction-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.event-fields { display: grid; gap: 10px; }
.service-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.service-side {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  align-content: stretch;
  gap: 8px;
  min-width: 0;
  padding: clamp(7px, 1.2vw, 12px);
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.service-side h3 { text-align: center; font-size: clamp(.92rem, 1.7vw, 1.18rem); }
.service-side[data-team="0"] { border-top-color: var(--lime); }
.service-side[data-team="1"] { border-top-color: var(--rose); }
.service-fields .service-side select { margin-top: 0; padding-inline: 7px; }
.service-players { display: grid; grid-template-rows: repeat(2, 1fr); gap: 4px; margin: 0; }
.service-players legend { min-height: 2.25em; font-size: .7rem; line-height: 1.15; }
.service-players:disabled label,
.service-players:not(:disabled) .service-player-name { display: none; }
.service-side label,
.service-player-name {
  display: flex;
  align-items: center;
  gap: clamp(4px, 1vw, 8px);
  min-width: 0;
  min-height: 38px;
  padding: 5px 6px;
  color: var(--ink);
  font-size: .76rem;
  font-weight: 660;
  line-height: 1.26;
  overflow-wrap: anywhere;
}
.service-player-name { margin: 0; border: 1px solid transparent; }
.service-side label {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--button-base);
  cursor: pointer;
}
.service-side label:has(:checked) { background: var(--selected-bg); border-color: var(--selected-edge); }
.service-side label:has(:focus-visible) { outline: 2px solid var(--selected-edge); outline-offset: 2px; }
.service-side input { flex: none; margin: 0; accent-color: var(--selected-edge); }
.service-side .service-start {
  grid-row: 4;
  min-height: 42px;
  justify-content: center;
  text-align: center;
  background: #ffe1cb;
  border-color: #b97c53;
  color: #623b28;
}
.service-side .service-start:has(:checked) { background: var(--primary-bg); border-color: var(--primary-edge); color: var(--primary-ink); }
#service-event-hint { margin-top: 10px; }
.actions.wizard-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.actions.wizard-actions:has(#wizard-back[hidden]) { grid-template-columns: minmax(0, 1fr); }
.wizard-actions > * { min-height: 48px; }
.wizard-resume { display: flex; margin-top: 8px; }
.setup-form:not([data-step="0"]) .wizard-resume { display: none; }
.layout-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.layout-choice {
  position: relative;
  display: grid;
  align-content: start;
  gap: 5px;
  min-width: 0;
  padding: clamp(7px, 1.2vw, 12px);
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
}
.layout-choice:has(:checked) { border-color: var(--selected-edge); background: var(--selected-bg); }
.layout-choice:has(:focus-visible) { outline: 2px solid var(--selected-edge); outline-offset: 2px; }
.layout-choice input { position: absolute; inset: auto 9px 9px auto; margin: 0; accent-color: var(--selected-edge); }
.layout-choice strong { font-size: .9rem; }
.layout-choice small { padding-right: 17px; color: var(--muted); font-size: .72rem; line-height: 1.25; }
.layout-sample {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 1.65em;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 3px;
  aspect-ratio: 2.25;
  padding: 6px;
  border: 1px solid #ffffff25;
  border-radius: 6px;
  background: #111a2d;
  font: 700 clamp(.58rem, 1.3vw, .78rem)/1 var(--display);
}
.layout-sample i { grid-row: 1 / -1; border-radius: 3px; background: #cf934e url('/quadra.webp') center / cover; }
.layout-sample b { display: grid; place-items: center; border-radius: 2px; background: #d9ef91; color: #182318; }
.layout-sample b:last-child { background: #ffc8a8; }
.sample-basic { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sample-basic i {
  grid-column: 1 / -1;
  grid-row: 1;
  justify-self: center;
  width: 66%;
  background: url('/quadra-basica.webp') center / contain no-repeat;
}
.teams label, .event-fields label, .correction label, .device-field label {
  display: block;
  color: var(--label);
  font-size: .83rem;
  font-weight: 700;
}
.teams input, .event-fields input, .event-fields textarea, .share-address,
.correction input, .correction select, .service-fields select, .device-field select {
  display: block;
  width: 100%;
  min-width: 0;
  margin-top: 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: var(--field-bg);
  color: var(--ink);
  font-size: .88rem;
}
.service-fields select, .device-field select { min-height: 44px; }
.event-fields textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--placeholder); }
.actions, .header-actions, .share-row, .control-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.actions { margin-top: 17px; }
.primary, .quiet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--button-base);
  color: var(--ink);
  font-size: .82rem;
  font-weight: 720;
  transition: background-color 160ms, border-color 160ms, box-shadow 160ms;
}
.primary {
  min-height: 48px;
  padding-inline: 17px;
  border-color: var(--primary-edge);
  background: var(--primary-bg);
  color: var(--primary-ink);
  box-shadow: 0 0 20px var(--primary-glow);
}
.primary:hover:not(:disabled) { background: var(--primary-hover); box-shadow: 0 0 26px var(--primary-hover-glow); }
.quiet:hover:not(:disabled) { border-color: var(--select-edge); background: var(--button-hover); }

.match-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: end;
  gap: 14px;
  padding: clamp(17px, 3vw, 35px) 0 17px;
}
.match-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 14px; margin-bottom: 7px; }
.format-line { margin: 0 0 7px; color: var(--violet); font-size: .82rem; font-weight: 700; line-height: 1.45; overflow-wrap: anywhere; }
.match-meta .format-line { margin-bottom: 0; }
.header-actions { justify-content: flex-end; }
.live-board { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; gap: 13px; }
.court, .scoreboard {
  min-width: 0;
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 14px 44px #0605128e;
}
.court { position: relative; overflow: hidden; align-self: stretch; display: flex; flex-direction: column; }
.arena-visual {
  position: relative;
  flex: 1 0 auto;
  min-height: 194px;
  aspect-ratio: 1.95;
  overflow: hidden;
  background: #33283d url('/arena.webp') center 64% / cover;
}
.arena-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, #14102336 0%, transparent 45%, #160f201a 100%);
  pointer-events: none;
}
.rally-player {
  position: absolute;
  z-index: 2;
  left: var(--x);
  top: var(--y);
  width: 16.4%;
  height: 42%;
  transform: translate(-50%, -100%);
}
.rally-player[data-slot="back-left"] { --x: 20%; --y: 61%; }
.rally-player[data-slot="near-left"] { --x: 36%; --y: 78%; }
.rally-player[data-slot="back-right"] { --x: 80%; --y: 61%; }
.rally-player[data-slot="near-right"] { --x: 64%; --y: 78%; }
.rally-player::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: auto 21% 0;
  height: 9%;
  background: #2d1b23b0;
  border-radius: 50%;
  filter: blur(3px);
}
.rally-player img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 4px 3px #21162975);
  transition: opacity 90ms;
}
.rally-player[data-slot$="right"] img { transform: scaleX(-1); }
.rally-player .rally-hit { opacity: 0; }
.rally-player.is-striking .rally-ready { opacity: 0; }
.rally-player.is-striking .rally-hit { opacity: 1; }
.rally-ball {
  position: absolute;
  z-index: 3;
  left: 0;
  top: 0;
  width: clamp(6px, 1.05vw, 11px);
  aspect-ratio: 1;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 24%, #faffb2 0%, #d9f454 44%, #799000 100%);
  box-shadow: 0 0 9px #eeff64ba, 0 2px 4px #302018a0;
  will-change: transform;
  opacity: 0;
}
.rally-ball[data-active="true"] { opacity: 1; }
.rally-toggle {
  position: absolute;
  z-index: 4;
  top: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 35px;
  padding: 5px 9px;
  border: 1px solid #d8cee36b;
  border-radius: 999px;
  background: #111023d9;
  color: #fff;
  font-size: .71rem;
  font-weight: 700;
}
.rally-toggle:hover { border-color: var(--lime); }
.rally-toggle-icon { width: 9px; height: 10px; border-inline: 2px solid currentColor; }
.rally-toggle[aria-pressed="true"] .rally-toggle-icon { width: 0; height: 0; border: 5px solid transparent; border-right: 0; border-left: 8px solid currentColor; }
.court-teams {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  overflow: hidden;
  border-top: 1px solid var(--panel-edge);
  background: var(--court-labels);
}
.court-teams::after { content: ""; position: absolute; inset: 0 auto 0 50%; border-left: 1px solid var(--panel-edge); }
.court-teams span {
  display: grid;
  place-items: center;
  min-height: 64px;
  padding: 9px 12px;
  text-align: center;
  font: 700 clamp(1.3rem, 2.9vw, 2.35rem)/1.05 var(--display);
  letter-spacing: -.035em;
  overflow-wrap: anywhere;
}
.court-teams span[data-team="0"] { color: var(--lime); background: linear-gradient(145deg, #c9f69c15, transparent 80%); }
.court-teams span[data-team="1"] { color: var(--rose); background: linear-gradient(145deg, #ffb58f16, transparent 80%); }

.scoreboard {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(13px, 2.1vw, 26px);
  background: var(--score-panel);
}
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.score-table thead th { text-align: center; padding: 7px 2px 12px; color: var(--muted); font-size: clamp(.7rem, 1.3vw, .85rem); font-weight: 700; }
.score-table thead th:first-child { width: 46%; text-align: left; }
.score-table tbody tr { border-top: 1px solid var(--panel-edge); }
.score-table tbody th {
  padding: 12px 5px 12px 0;
  color: var(--ink);
  font: 700 clamp(1.06rem, 2.55vw, 2.18rem)/1.04 var(--display);
  letter-spacing: -.035em;
  text-align: left;
  overflow-wrap: anywhere;
}
.score-table tbody td {
  padding: 7px 0 10px;
  text-align: center;
  font: 700 clamp(1.65rem, 4.1vw, 4rem)/1 var(--display);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.05em;
}
.score-table td.points { color: var(--lime); font-size: clamp(2.4rem, 5.5vw, 5.45rem); }
#match[data-layout="basic"] .live-board { grid-template-columns: minmax(0, 1fr); width: min(100%, 760px); margin-inline: auto; gap: 7px; }
#match[data-layout="basic"] :is(.court, .scoreboard) { background: #111a2d; border-color: #344457; color: #fffaf0; }
#match[data-layout="basic"] .arena-visual {
  display: grid;
  place-items: center;
  min-height: 0;
  aspect-ratio: auto;
  padding: clamp(8px, 1.5vw, 14px);
  background: radial-gradient(ellipse at 50% 58%, #27374d, #111a2d 72%);
}
#match[data-layout="basic"] .arena-visual::before {
  position: static;
  width: min(100%, 438px);
  aspect-ratio: 2.5;
  background: url('/quadra-basica.webp') center / contain no-repeat;
}
#match[data-layout="basic"] :is(.rally-player, .rally-ball, .team-dot) { display: none; }
#match[data-layout="basic"] .court-teams { background: #17263a; --panel-edge: #344457; }
#match[data-layout="basic"] .court-teams span { min-height: 31px; padding: 5px; font-size: clamp(.76rem, 2vw, 1.02rem); }
#match[data-layout="basic"] .court-teams span[data-team="0"] { color: #d9ef91; }
#match[data-layout="basic"] .court-teams span[data-team="1"] { color: #ffc8a8; }
#match[data-layout="basic"] .scoreboard { --ink: #fffaf0; --muted: #c3cad8; --panel-edge: #344457; }
#match[data-layout="basic"] .score-table tbody th span:last-child,
#match[data-layout="basic"] .score-table td.points span {
  display: inline-block;
  padding: .19em .35em;
  border-radius: .26em;
  background: #d9ef91;
  color: #162416;
  line-height: 1;
}
#match[data-layout="basic"] .score-table tr:last-child :is(th span:last-child, td.points span) { background: #ffc8a8; color: #352320; }
#match[data-layout="basic"] .score-table td.points { font-size: clamp(1.9rem, 6.4vw, 3.7rem); }
#match[data-layout="basic"] :is(.controls, .correction, .tools) { width: min(100%, 760px); margin-inline: auto; }
.team-dot { display: inline-block; width: .34em; height: .34em; margin-right: .38em; vertical-align: .14em; border-radius: 50%; background: var(--lime); }
.team-two { background: var(--rose); }
.score-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px 10px;
  min-height: 39px;
  padding: 8px 11px;
  margin-top: 7px;
  border: 1px solid var(--panel-edge);
  border-radius: 9px;
  background: var(--status-bg);
  color: var(--status-ink);
  overflow-wrap: anywhere;
}
.score-footer.highlight { background: var(--positive-bg); border-color: var(--positive-bg); color: #1b250f; }
.notice { font-size: clamp(.76rem, 1.3vw, .88rem); font-weight: 750; }
.serve-area {
  display: flex;
  align-items: flex-end;
  gap: 8px 14px;
  flex-wrap: wrap;
  min-width: 0;
}
.serve-status {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  color: var(--muted);
  font-size: clamp(.95rem, 2vw, 1.22rem);
  font-weight: 700;
  overflow-wrap: anywhere;
}
.serve-status strong { color: var(--violet); font: 750 clamp(1.55rem, 4vw, 2.7rem)/1.08 var(--display); }
.serve-status[aria-level="1"] strong { font-size: clamp(2.15rem, 6vw, 4.3rem); }
.serve-area > .quiet { margin-bottom: 2px; }
#set-results { display: flex; flex-wrap: wrap; gap: 5px; margin: 0; padding: 0; list-style: none; }
#set-results li { padding: 2px 5px; border: 1px solid currentColor; border-radius: 4px; font-size: .69rem; font-weight: 700; }
.controls { margin-top: 12px; }
.start-game { display: grid; justify-items: center; margin-top: 14px; }
.start-game .primary { width: min(100%, 330px); }
.point-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.award {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  min-height: 61px;
  padding: 9px clamp(9px, 2vw, 19px);
  border: 1px solid #dbffa6;
  border-radius: 14px;
  background: linear-gradient(120deg, #a8df75, #ddffa3);
  color: #192812;
  text-align: left;
  box-shadow: 0 4px 22px #c4ff801a;
}
.award-two { background: linear-gradient(120deg, #ffb0a7, #ffccae); border-color: #f9c4ac; color: #382019; }
.award:active:not(:disabled) { filter: brightness(.86); }
.award span { font: 700 clamp(1rem, 2.4vw, 1.5rem)/1.1 var(--display); overflow-wrap: anywhere; }
.award b { font: 700 clamp(1.4rem, 3vw, 2rem)/1 var(--display); }
.control-actions { margin-top: 8px; }
#pending { color: var(--pending); font-size: .82rem; font-weight: 700; }
details { border: 1px solid var(--border); border-radius: 12px; padding: 8px 12px; background: var(--surface); }
summary { padding-block: 6px; cursor: pointer; font-size: .87rem; font-weight: 720; }
details p, .loading p { color: var(--muted); font-size: .87rem; line-height: 1.55; margin: 7px 0; }
.tools { display: grid; gap: 7px; margin-top: 8px; }
.share-row { margin-top: 9px; }
.watch-counts { display: flex; flex-wrap: wrap; gap: 6px; }
.watch-counts span { padding: 5px 8px; border-radius: 6px; background: var(--status-bg); color: var(--status-ink); font-size: .82rem; font-weight: 700; }
.correction { margin-top: 9px; }
#correction-fields { display: grid; gap: 8px; margin: 9px 0; }
.correction label:has(select) { max-width: 340px; }
.error { color: var(--error); margin-top: 7px; font-size: .84rem; font-weight: 650; }


.game-directory, .setup, .history { scroll-margin-top: 18px; }
.game-directory, .history, .competition { margin-top: 24px; }
.dashboard { padding: clamp(20px, 4vw, 48px) 0 36px; }
.dashboard-hero {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(16px, 3.4vw, 42px);
  align-items: stretch;
  padding: clamp(12px, 2.8vw, 33px);
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius);
  background: var(--setup-panel);
}
.dashboard-intro { align-self: center; padding: clamp(9px, 1.6vw, 20px); }
.dashboard-intro h1 { font-size: clamp(2.4rem, 6.3vw, 5.9rem); }
.dashboard-intro h1 span { color: var(--hero-ink); white-space: nowrap; }
.dashboard-intro p { margin: 12px 0 0; color: var(--muted); line-height: 1.45; }
.dashboard-court {
  min-height: clamp(180px, 26vw, 350px);
  border: 1px solid var(--panel-edge);
  border-radius: calc(var(--radius) - 6px);
  background: #282231 url('/arena.webp') center 66% / cover no-repeat;
}
.dashboard-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin: 13px 0 23px;
}
.dashboard-summary > div {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: clamp(10px, 2vw, 21px);
  border: 1px solid var(--border);
  border-radius: 13px;
  background: color-mix(in srgb, var(--state-ink) 9%, var(--surface));
}
.dashboard-summary dt { color: var(--muted); font-size: clamp(.72rem, 1.6vw, .89rem); font-weight: 650; }
.dashboard-summary dd { margin: auto 0 0; color: var(--state-ink); font: 750 clamp(1.75rem, 4vw, 3rem)/1 var(--display); font-variant-numeric: tabular-nums; }
.dashboard-modes, .dashboard-live { margin: 22px 0 0; }
.dashboard-game-lists { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.dashboard-game-lists > section { min-width: 0; }
.dashboard-modes h2, .dashboard-live h2 { margin-bottom: 10px; }
.mode-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.mode-grid a {
  position: relative;
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 13px 26px 13px 12px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--mode-ink);
  border-radius: 12px;
  background: var(--surface);
}
.mode-grid a:hover { background: var(--button-hover); }
.mode-grid strong { color: var(--mode-ink); font-size: clamp(.84rem, 1.9vw, 1.09rem); overflow-wrap: anywhere; }
.mode-grid span { color: var(--muted); font-size: .79rem; }
.mode-grid i { position: absolute; right: 10px; top: 12px; font-style: normal; color: var(--mode-ink); }
.history-row.dashboard-match {
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 9px;
  overflow-wrap: anywhere;
}
.dashboard-match .game-actions { justify-content: flex-start; }
.mode-grid [data-mode="friendly"], .directory-section[data-mode="friendly"] { --mode-ink: #98eabb; }
.mode-grid [data-mode="super8"], .directory-section[data-mode="super8"] { --mode-ink: #c8b4ff; }
.mode-grid [data-mode="tournament"], .directory-section[data-mode="tournament"] { --mode-ink: #f7c990; }
.mode-grid [data-mode="championship"], .directory-section[data-mode="championship"] { --mode-ink: #9cdbfe; }
[data-status="active"] { --state-ink: #9febb8; }
[data-status="waiting"] { --state-ink: #f5d2a0; }
[data-status="finished"] { --state-ink: #b5cafb; }
:root[data-theme="sand"] [data-mode="friendly"] { --mode-ink: #176447; }
:root[data-theme="sand"] [data-mode="super8"] { --mode-ink: #58438f; }
:root[data-theme="sand"] [data-mode="tournament"] { --mode-ink: #8a4721; }
:root[data-theme="sand"] [data-mode="championship"] { --mode-ink: #245e77; }
:root[data-theme="sand"] [data-status="active"] { --state-ink: #165b3c; }
:root[data-theme="sand"] [data-status="waiting"] { --state-ink: #78451e; }
:root[data-theme="sand"] [data-status="finished"] { --state-ink: #35588e; }
.directory-section {
  display: grid;
  gap: 8px;
  padding: clamp(10px, 2vw, 17px);
  margin-bottom: 5px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: color-mix(in srgb, var(--mode-ink) 5%, var(--surface));
  scroll-margin-block-start: 12px;
}
.directory-section-heading { display: flex; align-items: center; gap: 8px; color: var(--mode-ink); }
.directory-section-heading h2 { font-size: clamp(1.12rem, 2.8vw, 1.58rem); }
.directory-count, .directory-status { border-radius: 999px; font-size: .72rem; font-weight: 730; }
.directory-count { padding: 3px 7px; background: color-mix(in srgb, var(--mode-ink) 12%, var(--surface)); }
.directory-section-list { display: grid; gap: 7px; }
.directory-card {
  border-left: 4px solid var(--state-ink);
  background: color-mix(in srgb, var(--state-ink) 7%, var(--surface));
}
.directory-status {
  display: inline-block;
  margin: 4px 0 0 6px;
  padding: 4px 7px;
  background: color-mix(in srgb, var(--state-ink) 15%, var(--surface));
  color: var(--state-ink);
  vertical-align: middle;
}
@media (max-width: 710px) {
  .dashboard-hero { grid-template-columns: minmax(0, 1fr); }
  .dashboard-game-lists { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .dashboard-court { min-height: 150px; }
  .mode-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.directory-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: end;
  gap: 10px 16px;
  margin-bottom: 14px;
}
.directory-header h1 { font-size: clamp(1.75rem, 3.7vw, 3.2rem); }
.directory-subheading { margin-top: 11px; }
.history h2, .event-content h2 { margin-bottom: 10px; }
.history-list, .event-round { display: grid; gap: 8px; }
.history-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 14px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.history-row strong { overflow-wrap: anywhere; }
.history-meta { color: var(--muted); margin-top: 3px; font-size: .79rem; line-height: 1.49; }
.history-actions { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.history-actions:empty { display: none; }
.history-actions .quiet { text-align: center; }
.history .history-actions button { color: var(--error); }
.history-actions.game-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.history-actions.game-actions .icon-action { width: 42px; flex: 0 0 42px; padding: 8px; }
.icon-action svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.game-actions button[data-action="delete"] { color: var(--error); }
.game-actions [data-action="start"] { border-color: var(--primary-edge); background: var(--primary-bg); color: var(--primary-ink); }
.game-actions [data-action="start"]:hover { border-color: var(--primary-edge); background: var(--primary-hover); }
@media (max-width: 710px) {
  .history-row.directory-card { grid-template-columns: minmax(0, 1fr); }
  .history-actions.game-actions { justify-content: flex-start; }
}
.event-header h1 { margin: 12px 0; overflow-wrap: anywhere; }
.event-header p { color: var(--muted); font-size: .88rem; line-height: 1.55; }
.event-content { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; margin-top: 20px; align-items: start; }
.event-content:has(#event-ranking:not([hidden])) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.event-round { margin-bottom: 13px; }
.event-round h3 { margin-top: 7px; color: var(--violet); font-size: .85rem; }
.ranking-table { overflow-x: auto; padding: 7px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.ranking-table thead th, .ranking-table td, .ranking-table tbody th { color: var(--ink); font-size: .77rem; padding: 8px 3px; }
.ranking-table tbody tr { border-top: 1px solid var(--border); }
.ranking-table thead th:first-child { width: 34%; }
.ranking-table tbody th { text-align: left; overflow-wrap: anywhere; }
.ranking-table td { text-align: center; font-variant-numeric: tabular-nums; }
.loading { padding-block: 42px; }
.loading a { margin-top: 6px; }


.app-dialog {
  box-sizing: border-box;
  width: min(calc(100% - 24px), 420px);
  max-height: calc(100dvh - 30px);
  overflow: auto;
  padding: clamp(13px, 4vw, 22px);
  border: 1px solid var(--panel-edge);
  border-radius: 19px;
  background: var(--setup-panel);
  color: var(--ink);
  box-shadow: 0 20px 90px #0706128a;
}
.app-dialog::backdrop { background: #070613b0; }
.dialog-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.app-dialog p {
  color: var(--muted);
  margin-block: 6px;
  font-size: .84rem;
  line-height: 1.45;
}
.app-dialog .dialog-message { margin-bottom: 0; font-weight: 690; }
.reset-open { width: 100%; margin-top: 13px; color: var(--error); }
.reset-form { display: grid; gap: 8px; margin-top: 14px; }
.reset-form label { display: block; color: var(--label); font-size: .86rem; }
.reset-form input {
  display: block;
  width: 100%;
  min-height: 44px;
  margin-bottom: 5px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--field-bg);
  color: var(--ink);
}
.actions.reset-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.reset-confirm { border-color: var(--error); color: var(--error); }
.reset-success { margin-bottom: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--status-bg); color: var(--status-ink); }
.dialog-message:empty { display: none; }
.app-dialog fieldset { margin: 0 0 14px; }
.voice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.voice-card, .voice-off {
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
}
.voice-card:has(:checked), .voice-off:has(:checked) {
  border-color: var(--selected-edge);
  background: var(--selected-bg);
  box-shadow: var(--selected-shadow);
}
.voice-card label, .voice-off {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
}
.voice-card label { flex: 1; min-width: 0; min-height: 56px; padding: 8px 0 8px 8px; }
.voice-card strong, .voice-card small { display: block; overflow-wrap: anywhere; }
.voice-card strong { font-size: .92rem; }
.voice-card small { margin-top: 2px; color: var(--muted); font-size: .72rem; }
.voice-off { margin-top: 8px; min-height: 42px; padding: 7px 9px; font-size: .8rem; font-weight: 690; }
.voice-card input, .voice-off input { flex: none; margin: 0; accent-color: var(--primary-bg); }
.voice-preview {
  display: grid;
  place-items: center;
  flex: 0 0 36px;
  height: 36px;
  margin-right: 7px;
  padding: 0;
  border: 1px solid var(--panel-edge);
  border-radius: 50%;
  background: var(--status-bg);
  color: var(--violet);
}
.voice-preview::before {
  content: "";
  margin-left: 2px;
  border-block: 5px solid transparent;
  border-left: 8px solid currentColor;
}
.voice-preview:hover { background: var(--button-hover); border-color: var(--select-edge); }
.settings-subscription {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.settings-subscription h3 { font-size: 1rem; }
.settings-subscription-counts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}
.settings-subscription-counts > div { padding: 8px; border-radius: 8px; background: var(--status-bg); color: var(--status-ink); }
.settings-subscription-counts dt { font-size: .76rem; line-height: 1.3; }
.settings-subscription-counts dd {
  margin: 2px 0 0;
  font: 750 1.3rem/1 var(--display);
  font-variant-numeric: tabular-nums;
}
.settings-subscription p { margin: 0; }
.device-settings {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 9px 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
}
.device-settings > button { grid-column: 1 / -1; }
.device-settings strong { font-size: .85rem; }
.device-settings p { margin-block: 2px 0; }
.settings-help { display: grid; grid-template-columns: repeat(auto-fit, minmax(124px, 1fr)); gap: 8px; margin-top: 10px; }
.app-dialog.tour-dialog { width: min(calc(100% - 24px), 470px); }
.tour-progress { display: grid; gap: 6px; margin-bottom: 18px; font-size: .8rem; color: var(--muted); }
.tour-progress progress { width: 100%; height: 8px; accent-color: var(--selected-edge); }
.tour-copy { min-height: 100px; }
.tour-copy p { line-height: 1.55; }
.tour-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.device-dialog { width: min(calc(100% - 24px), 560px); }
.device-dialog h2 { font-size: clamp(1.34rem, 4.5vw, 1.9rem); }
#devices-form { margin-top: 16px; }
#devices-form .actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
#devices-form .actions .quiet { min-height: 48px; }
.device-modes, .device-brands {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.device-choice {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
}
.device-choice:hover { border-color: var(--select-edge); }
.device-choice:has(:checked) { border-color: var(--selected-edge); background: var(--selected-bg); box-shadow: var(--selected-shadow); }
.device-choice:has(:focus-visible) { outline: 2px solid var(--violet); outline-offset: 2px; }
.device-choice input {
  position: absolute;
  inset: 11px 11px auto auto;
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--primary-bg);
}
.device-choice strong { font-size: .91rem; line-height: 1.3; }
.device-choice small { color: var(--muted); font-size: .76rem; line-height: 1.3; }
.device-glyphs {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 33px;
  padding: 3px 6px;
  color: var(--violet);
  background: var(--status-bg);
  border: 1px solid var(--panel-edge);
  border-radius: 8px;
}
.device-choice .device-glyphs { margin-bottom: 3px; }
.device-glyph { position: relative; display: inline-block; flex: none; border: 1.5px solid currentColor; }
.glyph-phone, .glyph-tablet { border-radius: 3px; }
.glyph-phone { width: 11px; height: 21px; }
.glyph-tablet { width: 23px; height: 16px; }
.glyph-phone::after, .glyph-tablet::after {
  content: "";
  position: absolute;
  inset: auto 25% 2px;
  border-bottom: 1px solid currentColor;
}
.glyph-watch { width: 13px; height: 15px; border-radius: 4px; }
.glyph-watch::before, .glyph-watch::after {
  content: "";
  position: absolute;
  left: calc(50% - 3px);
  width: 6px;
  height: 4px;
  border-radius: 1px;
  background: currentColor;
}
.glyph-watch::before { top: -5px; }
.glyph-watch::after { bottom: -5px; }
.device-field {
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}
.device-brands:has(#device-tablet[hidden], #device-phone[hidden]) { grid-template-columns: minmax(0, 1fr); }
#watch-options { grid-column: 1 / -1; }
.device-field label > span { display: flex; align-items: center; gap: 7px; min-height: 22px; }
.device-field .device-glyph { color: var(--violet); transform: scale(.76); }
.device-field p { margin-bottom: 0; }
@media (max-width: 480px) { .device-brands { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 350px) { .voice-grid { grid-template-columns: minmax(0, 1fr); } }
.theme-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
}
.theme-options label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px 5px;
  align-items: center;
  padding: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 9px;
  font-size: .79rem;
  cursor: pointer;
}
.theme-options label:has(:checked) { background: var(--selected-bg); border-color: var(--selected-edge); }
.theme-options input { margin: 0; accent-color: var(--violet); }
.theme-swatch {
  grid-column: 1 / -1;
  grid-row: 1;
  display: block;
  height: 32px;
  border-radius: 5px;
}
.swatch-violet { background: linear-gradient(125deg, #161328 48%, #b9a5fe 49%); }
.swatch-ocean { background: linear-gradient(125deg, #14333d 48%, #89f0dc 49%); }
.swatch-sand {
  background: linear-gradient(125deg, #f5f2ea 0 43%, #112d37 44% 77%, #d6ee62 78% 100%);
  border: 1px solid #b8c6b1;
}
.qr-dialog canvas {
  display: block;
  box-sizing: content-box;
  width: min(100%, 252px);
  height: auto;
  margin: 12px auto;
  border-radius: 7px;
  background: #fff;
  image-rendering: pixelated;
}
.qr-dialog .share-address { margin-bottom: 8px; }

@media (max-width: 1180px) {
  .top {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "brand actions" "nav nav";
    row-gap: 8px;
    padding-block: 9px;
  }
}
@media (max-width: 860px) {
  .live-board { grid-template-columns: minmax(0, 1.23fr) minmax(0, 1fr); }
  .shell { width: min(100% - 36px, 1280px); }
  .setup { gap: 22px; }
  .modes label, .formats label { gap: 6px; padding-inline: 8px; }
}
@media (min-width: 711px) and (max-width: 860px) and (orientation: portrait) {
  .live-board { grid-template-columns: minmax(0, 1fr); }
  .court-teams span { font-size: clamp(1.45rem, 4vw, 2.35rem); }
  .score-table tbody th { font-size: clamp(1.35rem, 3.4vw, 2.18rem); }
}
@media (max-width: 710px) {
  .setup, .live-board, .event-content:has(#event-ranking:not([hidden])) { grid-template-columns: minmax(0, 1fr); }
  .top { min-height: 65px; }
  .setup-form { grid-row: 1; }
  .intro h1 { font-size: clamp(1.75rem, 6.4vw, 2.5rem); }
  .preview-court { aspect-ratio: 2.4; }
  .arena-visual { min-height: 165px; }
  .court-teams span { min-height: 53px; }
  .score-table tbody th { font-size: clamp(1.04rem, 4.8vw, 2rem); }
  .score-table tbody td { font-size: clamp(1.65rem, 7vw, 3.65rem); }
  .score-table td.points { font-size: clamp(2.1rem, 9.5vw, 4.65rem); }
}
@media (max-width: 560px) {
  .top-control-label { display: none; }
}
@media (max-width: 480px) {
  .top { column-gap: 8px; }
  .top-nav { width: 100%; justify-content: space-between; }
  .top-nav a { padding-inline: 8px; font-size: .73rem; }
  .teams, .double-fields { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 420px) {
  .shell { width: calc(100% - 24px); }
  .setup { padding-top: 22px; }
  .match-header { flex-wrap: wrap; }
  .header-actions { justify-content: flex-start; }
  .history-row { grid-template-columns: minmax(0, 1fr); }
  .history-actions { justify-self: start; grid-auto-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; }
}

.score-celebration, .final-result {
  border: 1px solid var(--celebration-ink, var(--lime));
  color: var(--celebration-ink, var(--lime));
  background: var(--celebration-bg);
  border-radius: 12px;
}
.score-celebration {
  position: absolute;
  z-index: 4;
  top: 48px;
  left: 10px;
  max-width: calc(100% - 20px);
  pointer-events: none;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 5px 11px;
  padding: 8px 11px;
  overflow-wrap: anywhere;
}
.score-celebration[data-team="1"] {
  --celebration-ink: var(--rose);
  background: var(--celebration-alt-bg);
}
.score-celebration strong {
  font: 700 clamp(.94rem, 1.75vw, 1.16rem)/1.17 var(--display);
}
.score-celebration span, .final-result li { font-size: .82rem; font-weight: 680; }
.score-celebration.celebration-pop { animation: celebration-pop 570ms ease-out; }
.scoreboard[data-scoring-team="0"] tbody tr:first-child,
.scoreboard[data-scoring-team="1"] tbody tr:last-child {
  animation: score-pulse 830ms ease-out;
}
@keyframes celebration-pop {
  from { transform: translateY(5px) scale(.98); opacity: .6; box-shadow: 0 0 22px #dcffa366; }
  to { transform: none; opacity: 1; box-shadow: none; }
}
@keyframes score-pulse {
  20% { background-color: #d5fa9335; }
  to { background-color: transparent; }
}

.final-result {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px 18px;
  margin-bottom: 12px;
  padding: 13px clamp(13px, 2.6vw, 24px);
}
.final-result p { font-size: .76rem; font-weight: 740; }
.final-result h2 { margin-top: 3px; color: var(--ink); overflow-wrap: anywhere; }
.final-result ul { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.final-result li {
  padding: 5px 7px;
  border: 1px solid var(--panel-edge);
  border-radius: 6px;
  color: var(--ink);
}

@media (prefers-reduced-motion: reduce) {
  .score-celebration.celebration-pop,
  .scoreboard[data-scoring-team] tbody tr { animation: none; }
}
