:root {
  color-scheme: dark;
  --bg: #111a24;
  --panel: #1b2936;
  --line: #394b5a;
  --ink: #edf5f4;
  --muted: #b6c8cf;
  --lime: #d7ed9f;
  --pink: #f5a782;
  --spin-flat: #ffffff;
  --spin-back: #58b6ff;
  --spin-left: #69e285;
  --spin-right: #ff6a6e;
  --spin-top: #ffe365;
  font-family: system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  scroll-padding-top: 5rem;
}
*, *::before, *::after { box-sizing: border-box }
body { margin: 0 }
a { color: inherit; text-underline-offset: .24em }
button, select { font: inherit }
button, select, summary { cursor: pointer }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px }
.wrap { width: min(100% - 2rem, 1060px); margin-inline: auto }
.header { position: sticky; top: 0; z-index: 3; background: var(--bg); border-bottom: 1px solid var(--line) }
.bar, nav { display: flex; align-items: center; gap: clamp(.85rem, 4vw, 2rem) }
.bar { justify-content: space-between; min-height: 3.6rem }
.brand { font-size: 1.15rem; font-weight: 850; text-transform: uppercase; text-decoration: none; white-space: nowrap }
.brand b, h1 span, nav [aria-current] { color: var(--lime) }
nav a { font-size: .9rem; font-weight: 650; text-decoration: none }
nav a:hover, .jump:hover { color: var(--lime) }
.intro { display: flex; justify-content: space-between; align-items: end; gap: 1rem; margin-block: clamp(1.7rem, 4vw, 3.5rem) 1.2rem }
h1, h2 { margin: 0; letter-spacing: -.055em; line-height: .96 }
h1 { font-size: min(7.7vw, 4.65rem); font-weight: 850; white-space: nowrap }
h2 { font-size: clamp(2rem, 5vw, 3.6rem) }
.intro p { margin: .9rem 0 0; color: var(--muted) }
.jump { white-space: nowrap; padding-bottom: .25rem }
.arena { display: grid; grid-template-columns: minmax(0, 1fr) 17rem; align-items: start; gap: 1rem; max-width: 930px }
.court, .panel, .facts, .rulebook { border: 1px solid var(--line); background: var(--panel); border-radius: .9rem }
.court { overflow: hidden }
.score { min-height: 3.45rem; display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line) }
.team { display: flex; align-items: center; gap: .55rem; padding: .55rem .85rem }
.team + .team { border-left: 1px solid var(--line) }
.team span { font-size: .86rem; font-weight: 650 }
.team i { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; background: var(--lime) }
.rival i { background: var(--pink) }
.spin-options [data-spin="auto"] { grid-column: 1 / -1 }
.team strong { font-variant-numeric: tabular-nums; font-size: 1.6rem; line-height: 1 }
.team small { margin-left: auto; color: var(--lime) }
.rival small { color: var(--pink) }
.shot-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-bottom: 1px solid var(--line); background: #152430 }
.shot { display: grid; gap: .12rem; padding: .38rem .85rem; min-width: 0 }
.shot + .shot { border-left: 1px solid var(--line) }
.shot span { font-size: .73rem; color: var(--muted) }
.shot strong { font-size: .88rem; font-weight: 690 }
[data-spin=flat] { --shot-color: var(--spin-flat) }
[data-spin=top] { --shot-color: var(--spin-top) }
[data-spin=back] { --shot-color: var(--spin-back) }
[data-spin=left] { --shot-color: var(--spin-left) }
[data-spin=right] { --shot-color: var(--spin-right) }
.shot strong { color: var(--shot-color, var(--ink)) }
.spin-legend { display: flex; flex-wrap: wrap; gap: .35rem .7rem; margin: 0; padding: 0; list-style: none; font-size: .79rem }
.spin-legend li::before { content: ''; display: inline-block; width: .62rem; height: .62rem; margin-right: .26rem; border-radius: 50%; background: var(--shot-color) }
.turn { margin: 0; min-height: 2.2rem; padding: .48rem .85rem; background: #192d3b; color: var(--lime); font-size: .87rem }
.table-space { position: relative }
#queued-spin {
  position: absolute;
  z-index: 1;
  inset-block-start: .5rem;
  inset-inline-start: 50%;
  transform: translateX(-50%);
  margin: 0;
  padding: .32rem .65rem;
  border-radius: .4rem;
  background: #14202c;
  color: var(--lime);
  font-size: .88rem;
  width: max-content;
  max-width: calc(100% - 1rem);
  pointer-events: none;
}
canvas { display: block; width: 100%; height: auto; background: #101923; touch-action: none; cursor: crosshair }
canvas:focus-visible { outline-offset: -3px }
#status { padding: .7rem .85rem; margin: 0; border-top: 1px solid var(--line); font-size: .92rem; min-height: 3rem }
.panel { padding: 1rem; display: grid; gap: .9rem }
.action-row, .spin-options { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem }
button, select { min-height: 2.45rem; width: 100%; padding: .38rem .55rem; border: 1px solid var(--line); border-radius: .45rem; background: #14202c; color: var(--ink) }
button:hover:not(:disabled), select:hover { border-color: var(--lime) }
button:disabled { opacity: .46; cursor: default }
button.action, button[aria-pressed=true] { background: var(--lime); border-color: var(--lime); color: #162020; font-weight: 720 }
.action-row { padding: .5rem; border-top: 1px solid var(--line); grid-template-columns: minmax(0, 1fr) auto auto }
.action-row button { padding-inline: clamp(.35rem, 1.2vw, .9rem) }
.difficulty { display: grid; gap: .35rem }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0 }
legend { margin-bottom: .35rem }
.panel p, .source { color: var(--muted); line-height: 1.5; font-size: .88rem; margin: 0 }
.panel details p { margin-top: .5rem }
.equipment-options { margin-top: .75rem; display: grid; gap: .75rem }
.equipment-options fieldset { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem }
.equipment-options legend, .equipment-options label { font-size: .79rem }
.equipment-options label { display: grid; gap: .2rem; min-width: 0 }
.equipment-options select { font-size: .78rem; padding-inline: .28rem }
.panel-buttons { display: flex; flex-wrap: wrap; gap: .45rem }
.panel-buttons button { width: auto }
.rules { margin-top: clamp(3rem, 8vw, 6rem); max-width: 930px }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); margin: 1.4rem 0 1rem }
.facts div { display: grid; gap: .25rem; padding: .9rem }
.facts div + div { border-left: 1px solid var(--line) }
.facts strong { color: var(--lime) }
.facts span { font-size: .85rem; color: var(--muted) }
.rulebook details { padding: .9rem 1rem }
.rulebook details + details { border-top: 1px solid var(--line) }
.rulebook summary { font-weight: 720 }
.rulebook p { line-height: 1.6; margin-bottom: 0 }
.source { margin-block: .85rem }
.footer { padding-block: 1.5rem 2rem; color: var(--muted) }
@media (max-width: 690px) {
  .arena { grid-template-columns: minmax(0, 1fr); max-width: 510px }
  .panel { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: .7rem; gap: .65rem }
  fieldset { grid-column: 1 / -1 }
  .spin-options { grid-template-columns: repeat(4, minmax(0, 1fr)) }
  .panel p, .panel details, .spin-legend { grid-column: 1 / -1 }
  .panel-buttons { grid-column: 1 / -1 }
  .jump { display: none }
  .team { padding-inline: .5rem; gap: .35rem }
  .team small { font-size: .66rem }
}
@media (max-width: 380px) {
  .wrap { width: calc(100% - 1rem) }
  .spin-options button { padding-inline: .2rem; font-size: .84rem }
}

html.tt-expanded, html.tt-expanded body { overflow: hidden; overscroll-behavior: none }
.arena.is-immersive {
  --arena-gap: clamp(.5rem, 1.4vw, 1.55rem);
  position: fixed;
  inset: 0;
  z-index: 20;
  width: 100%;
  height: 100%;
  max-width: none;
  padding: var(--arena-gap);
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 940px) minmax(240px, 360px);
  justify-content: center;
  align-items: start;
  gap: var(--arena-gap);
  background: var(--bg);
  overflow: hidden;
  overscroll-behavior: none;
  color: var(--ink);
}
.arena.is-immersive .court {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.arena.is-immersive .court > :not(.table-space) { flex-shrink: 0 }
.arena.is-immersive .table-space {
  display: grid;
  place-items: center;
  flex: 1 1 0;
  min-height: 0;
  container-type: size;
  background: #101923;
}
.arena.is-immersive canvas {
  width: min(100cqw, calc(100cqh * 640 / 704));
  height: auto;
}
.arena.is-immersive #status { min-height: 3.2rem }
.arena.is-immersive .panel {
  min-height: 0;
  max-height: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: .85rem;
  gap: .65rem;
  overflow: auto;
  overscroll-behavior: contain;
}
.arena.is-immersive .panel > :not(label) { grid-column: 1 / -1 }
.arena.is-immersive .panel p { line-height: 1.36 }
.arena.is-immersive .equipment-options { margin-top: .55rem; gap: .45rem }
.arena.is-immersive #fullscreen { background: #14202c; border-color: var(--lime); color: var(--lime) }
@media (max-width: 720px) {
  .arena.is-immersive {
    grid-template: minmax(0, 1fr) minmax(5rem, 30%) / minmax(0, 1fr);
    gap: .35rem;
  }
  .arena.is-immersive .panel { padding: .5rem }
  .arena.is-immersive .score { min-height: 2.45rem }
  .arena.is-immersive .shot { padding-block: .2rem }
  .arena.is-immersive #status { min-height: 2.4rem; padding-block: .3rem }
}
