:root {
  --ink: #1c1916;
  --paper: #fff8ee;
  --deep: #10281c;
  --ball: #d6ee3e;
  --line: #e7efe4;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--deep);
  color: var(--ink);
  font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
}

body {
  min-height: 100dvh;
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden;
}

button, canvas { font-family: inherit; }

.app {
  max-width: 520px;
  margin: 0 auto;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px 8px;
  border-bottom: 3px solid var(--ink);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.ball-mark {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 35%, #f4ff9a 0 18%, transparent 19%),
    #d6ee3e;
  border: 2px solid var(--ink);
  box-shadow: inset -5px -3px 0 #b6cc2e;
  flex: none;
}

.brand-name {
  margin: 0;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1;
  letter-spacing: -0.03em;
}

.scoreboard {
  text-align: right;
}

.games, .sets {
  margin: 0;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.points {
  margin: 1px 0;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 0.95;
}

.dash { padding: 0 1px; }

.points span.pop {
  display: inline-block;
  animation: pop 0.28s ease;
}

@keyframes pop {
  50% { transform: scale(1.18); }
}

.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  background: #1b4332;
}

#court {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.panel {
  position: absolute;
  z-index: 2;
  left: 10px;
  right: 10px;
  top: 50%;
  transform: translateY(-52%);
  max-height: calc(100% - 16px);
  overflow: auto;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 20px;
  box-shadow: 0 6px 0 var(--ink);
  padding: 12px 12px 10px;
}

.panel[hidden] { display: none; }

.kicker {
  margin: 0;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h2 {
  margin: 2px 0 4px;
  font-size: 28px;
  letter-spacing: -0.04em;
  line-height: 1;
}

.lede {
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.35;
  font-weight: 600;
}

.coach-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.coach-pick {
  appearance: none;
  border: 3px solid var(--ink);
  background: #fff;
  border-radius: 16px;
  padding: 4px 4px 8px;
  box-shadow: 0 3px 0 var(--ink);
  cursor: pointer;
  color: var(--ink);
  text-align: center;
}

.coach-pick:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--ink);
}

.coach-pick:focus-visible,
.go:focus-visible,
.ghost:focus-visible {
  outline: 3px solid #12b3c4;
  outline-offset: 2px;
}

.coach-mini {
  width: 100%;
  height: auto;
  display: block;
}

.coach-name {
  display: block;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.coach-note {
  display: block;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  color: #3e4b43;
}

.panel-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.panel-actions button[hidden] { display: none; }

.go, .ghost {
  appearance: none;
  border: 3px solid var(--ink);
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

.go {
  background: var(--ball);
  box-shadow: 0 3px 0 var(--ink);
  color: var(--ink);
}

.go:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }

.ghost {
  background: #fff;
  color: var(--ink);
}

.dock {
  padding: 8px 12px 12px;
  border-top: 3px solid var(--ink);
  background: var(--paper);
}

.hint {
  margin: 0;
  text-align: center;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
  min-height: 1.2em;
}

.how {
  margin: 4px 0 0;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: #3e4b43;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.noscript {
  padding: 16px;
  font-weight: 700;
}

@media (max-height: 640px) {
  h2 { font-size: 22px; }
  .lede { font-size: 12px; margin-bottom: 6px; }
  .points { font-size: 22px; }
  .top { padding: 6px 12px; }
  .coach-note { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .points span.pop { animation: none; }
}
