:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { user-select: none; -webkit-user-select: none; }
.scoreboard { display: flex; position: relative; width: 100%; height: 100%; min-height: 100dvh; }
.team {
  flex: 1 1 50%; min-width: 0; position: relative; display: grid; place-items: center;
  touch-action: none; color: #fff; overflow: hidden; transition: filter 160ms ease;
}
.team--left { background: #168bb8; }
.team--right { background: #d94b57; }
.team.is-scored { filter: brightness(1.1); }
.team-content { width: 100%; padding: calc(72px + var(--safe-top)) 12px calc(44px + var(--safe-bottom)); text-align: center; }
.score { font-size: clamp(7rem, 34vw, 25rem); font-weight: 750; line-height: .9; letter-spacing: -.075em; font-variant-numeric: tabular-nums; text-shadow: 0 4px 24px rgb(0 0 0 / 12%); }
.team-name { margin-top: clamp(14px, 3vh, 28px); font-size: clamp(1.25rem, 4.2vw, 2.5rem); font-weight: 600; line-height: 1.15; overflow-wrap: anywhere; }
.gesture-hint { position: absolute; left: 12px; right: 12px; bottom: calc(14px + var(--safe-bottom)); text-align: center; font-size: clamp(.65rem, 2vw, .85rem); opacity: .72; }
.menu-wrap { position: absolute; z-index: 5; top: calc(14px + var(--safe-top)); left: 50%; transform: translateX(-50%); }
.menu-button {
  width: 54px; height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  border: 1px solid rgb(255 255 255 / 48%); border-radius: 16px; color: white; background: rgb(23 38 55 / 35%);
  box-shadow: 0 5px 18px rgb(0 0 0 / 16%); cursor: pointer; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.menu-button span { display: block; width: 21px; height: 2px; border-radius: 2px; background: currentColor; }
.menu-button:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.menu-panel {
  position: absolute; top: 64px; left: 50%; transform: translateX(-50%); width: min(310px, calc(100vw - 32px));
  padding: 14px; color: #202a36; background: #fff; border-radius: 16px; box-shadow: 0 14px 48px rgb(0 0 0 / 30%);
}
.menu-panel[hidden] { display: none; }
.menu-action, .save-button { width: 100%; min-height: 44px; padding: 10px 12px; border: 0; border-radius: 10px; font: inherit; font-weight: 650; cursor: pointer; }
.menu-action { color: #fff; background: #25384b; }
.team-form { display: grid; gap: 7px; padding-top: 14px; }
.team-form label { margin-top: 3px; font-size: .8rem; font-weight: 650; }
.team-form input { width: 100%; min-height: 42px; padding: 9px 10px; border: 1px solid #d4dbe2; border-radius: 9px; color: #202a36; background: #fff; font: inherit; user-select: text; -webkit-user-select: text; }
.save-button { margin-top: 4px; color: #fff; background: #25805e; }
.live-message { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 420px) {
  .menu-button { width: 48px; height: 48px; border-radius: 14px; }
  .menu-panel { top: 58px; }
  .team-content { padding-left: 6px; padding-right: 6px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: .01ms !important; } }
