@font-face {
  font-family: 'Fraunces';
  src: url('fonts/fraunces.woff2') format('woff2');
  font-weight: 300 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Fraunces';
  src: url('fonts/fraunces-italic.woff2') format('woff2');
  font-weight: 300 700; font-style: italic; font-display: swap;
}
@font-face {
  font-family: 'Anton';
  src: url('fonts/anton.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('fonts/plex-mono-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Anton';
  src: url('fonts/anton.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('fonts/plex-mono-500.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}


:root {
  --wood: #dcae72;
  --deep: #14233b;
  --navy: #1b2f4f;
  --chalk: #fbf6ea;
  --ink: #14233b;
  --soft: rgba(20, 35, 59, .78);
  --rule: rgba(20, 35, 59, .35);
  --orange: #c9440b;
  --serif: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  user-select: none; -webkit-user-select: none;
  background: var(--wood);
  color: var(--ink);
  font-family: var(--serif);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
p, h1, ul { margin: 0; padding: 0; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

#floor { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#court { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
#court:active { cursor: grabbing; }
.grain {
  position: fixed; inset: 0; pointer-events: none; opacity: .1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0  0 0 0 0 .08  0 0 0 0 .05  0 0 0 .9 -.25'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* The words at the foot of the court. Only the links take clicks, so a shot can start anywhere. */
.info {
  position: fixed; z-index: 2;
  left: max(22px, 6vw); bottom: calc(max(26px, 5vh) + env(safe-area-inset-bottom, 0px));
  width: min(27rem, calc(100vw - 44px));
  pointer-events: none;
  transition: opacity .3s ease;
}
.lede { font-size: clamp(1.05rem, 1.4vw, 1.25rem); line-height: 1.45; text-wrap: pretty; font-weight: 500; }
.links { list-style: none; display: flex; flex-wrap: wrap; gap: .3rem 1.6rem; margin-top: 1rem; }
.links a {
  pointer-events: auto;
  font: 500 12px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; text-decoration: none;
  display: inline-block; padding: 9px 0 6px;
  border-bottom: 1.5px solid var(--ink);
}
.links a::after { content: ' ↗'; color: var(--orange); }
.links a:hover { color: var(--orange); border-color: var(--orange); }
.note { margin-top: .8rem; font-style: italic; color: var(--soft); font-size: .95rem; }
body[data-state='play'] .info { opacity: .6; }
body[data-state='over'] .info { opacity: .25; }

/* Scoreboard */
.hud {
  position: fixed; z-index: 2;
  top: calc(22px + env(safe-area-inset-top, 0px));
  left: max(22px, 6vw); right: max(22px, 6vw);
  display: flex; justify-content: space-between; align-items: flex-start;
  pointer-events: none;
  transition: opacity .3s ease, visibility .3s;
}
.hud-score { display: flex; flex-direction: column; gap: 7px; background: rgba(251, 246, 234, .9); border: 1px solid var(--ink); padding: 8px 12px 9px; }
.num { font: 500 2.3rem/1 var(--mono); letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.unit, .stat, .hud-side button { font: 500 10.5px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; }
.unit { color: var(--soft); }
.hud-side { display: flex; align-items: center; gap: 14px; background: rgba(251, 246, 234, .9); border: 1px solid var(--ink); padding: 6px 6px 6px 12px; }
.strikes { display: flex; gap: 6px; }
.strikes i { width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid var(--ink); }
.strikes i.on { background: var(--orange); border-color: var(--orange); }
.stat b { font-weight: 500; color: var(--orange); }
.hud-side button { pointer-events: auto; border: 1px solid var(--rule); padding: 8px 10px; white-space: nowrap; }
.hud-side { flex-shrink: 0; }
.hud-side button:hover { background: var(--ink); color: var(--chalk); }
body[data-state='idle'] .hud { opacity: 0; visibility: hidden; }

.over {
  position: fixed; z-index: 4; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: min(24rem, calc(100vw - 48px));
  padding: 28px;
  text-align: center;
  background: rgba(20, 35, 59, .96);
  color: var(--chalk);
  border: 1px solid var(--chalk);
  outline: 1px solid var(--chalk); outline-offset: 4px;
  transition: opacity .3s ease, transform .3s ease, visibility .3s;
}
.eyebrow { font: 500 11px/1.4 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--soft); }
.over .eyebrow, .over .unit, .over .detail { color: rgba(251, 246, 234, .75); }
.over .detail.new { color: #ff9a5c; }
.result { margin: 12px 0 10px; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.result .num { font-size: clamp(3.6rem, 16vw, 5rem); }
.detail { font-style: italic; color: var(--soft); line-height: 1.5; }
.detail.new { color: var(--orange); font-weight: 600; }
.over-btns { margin-top: 20px; display: flex; flex-direction: column; gap: 9px; }
.btn {
  font: 500 12px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase;
  border: 1px solid var(--chalk); padding: 14px 16px;
}
.btn:hover { background: var(--chalk); color: var(--deep); }
.btn.main { background: #ee6420; border-color: #ee6420; color: #1d0c04; }
.btn.main:hover { background: var(--chalk); border-color: var(--chalk); }
body:not([data-state='over']) .over { opacity: 0; visibility: hidden; transform: translate(-50%, -46%); }

@media (max-width: 699px) {
  .lede { font-size: 1rem; }
  .stat { display: none; }
  .num { font-size: 2rem; }
  .hud .unit { letter-spacing: .08em; }
}
@media (max-height: 480px) {
  .note { display: none; }
  .lede { font-size: .92rem; }
  .info { bottom: 18px; width: min(24rem, 55vw); }
  .links { margin-top: .5rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; }
}

/* Pages without the game (404, no script): the name is ordinary text. */
.plain { overflow: auto; touch-action: auto; user-select: auto; -webkit-user-select: auto; }
.plain main { min-height: 100%; display: flex; flex-direction: column; justify-content: center; padding: 8vh max(22px, 6vw); }
.plain h1 { font: 400 clamp(3.4rem, 16vw, 11rem)/.95 Anton, Impact, sans-serif; text-transform: uppercase; margin: .2em 0 .25em; }
.plain .info { position: static; pointer-events: auto; }
