.shootout-page {
  --background: #141818;
  --surface: #1d2322;
  --line: #384442;
  --accent: #c7fa7f;
  --muted: #b8c4bd;
  --orange: #ff8356;
  padding-inline: env(safe-area-inset-left) env(safe-area-inset-right);
  padding-bottom: env(safe-area-inset-bottom);
}

.arcade { max-width: 1072px; }
.arcade-intro { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: 20px 0 18px; }
.arcade-intro h1 { font-size: clamp(2rem, 5vw, 3.8rem); }
.arcade-intro p { margin: 7px 0 0; color: var(--muted); }
.mode-picker, .game-toggles { display: flex; gap: 4px; }

.machine button, .mode-picker button {
  font: inherit;
  font-weight: 750;
  border-radius: 6px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.machine button:focus-visible, .mode-picker button:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.machine button:disabled { cursor: default; }
.machine button:active:not(:disabled), .mode-picker button:active:not(:disabled) { transform: translateY(1px); }

.mode-picker button, .game-toggles button {
  min-height: 44px;
  padding: 7px 12px;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--line);
}

.mode-picker button[aria-pressed="true"] { background: #293722; border-color: #69864b; color: var(--accent); }
.mode-picker button:disabled, .game-toggles button:disabled { opacity: .58; }
.machine { border: 1px solid #42504c; border-radius: 12px; overflow: hidden; background: var(--surface); }
.scoreboard { margin: 0; padding: 9px 0 10px; display: grid; grid-template-columns: repeat(4, 1fr); background: #202726; }
.scoreboard div { text-align: center; border-inline-end: 1px solid #42504c; min-width: 0; }
.scoreboard div:last-child { border-inline-end: 0; }
.scoreboard dt, .aim-label span:first-child { text-transform: uppercase; letter-spacing: .11em; font-size: .67rem; font-weight: 750; color: var(--muted); }
.scoreboard dd {
  margin: 1px 0 0;
  font: 800 clamp(1.45rem, 3.4vw, 2.3rem) / 1 ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}
.scoreboard dd.is-low { color: #ff9b77; }

.court-screen { position: relative; isolation: isolate; background: #183130; }
.court-screen canvas { display: block; width: 100%; height: auto; aspect-ratio: 24 / 11; }
.court-overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: 12px; background: #10181759; }
.court-overlay[hidden], .machine button[hidden] { display: none; }
.court-message { max-width: 100%; text-align: center; padding: clamp(10px, 2.7vw, 28px) clamp(12px, 4vw, 36px); border: 1px solid #708378; border-radius: 8px; background: #171e1df5; }
.court-message h2 { font-size: clamp(1.25rem, 3.5vw, 2.35rem); }
.court-message p { margin: 6px 0 11px; color: var(--muted); font-size: clamp(.78rem, 2.1vw, 1rem); }
.court-actions { display: flex; justify-content: center; gap: 8px; }
.court-actions .button { min-height: 44px; padding: 6px 14px; }
.court-reset { color: var(--ink); background: #26302c; border-color: #526159; }

.control-deck { display: grid; grid-template-columns: minmax(0, 1fr) minmax(140px, .48fr) auto; align-items: center; gap: clamp(10px, 2vw, 22px); padding: clamp(10px, 2.3vw, 20px); }
.aim-label { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; margin-bottom: 5px; }
#feedback { color: var(--accent); font-size: .82rem; font-weight: 650; text-align: right; }
.aim-track { position: relative; height: 16px; margin-inline: 2px; border-radius: 3px; background: #0e1515; border: 1px solid #586762; }
.aim-zone, .aim-cursor { position: absolute; top: 0; height: 100%; }
.aim-zone { left: 43%; width: 24%; background: #82b945; }
.aim-cursor { left: 0; top: -3px; width: 4px; height: 20px; border-radius: 2px; background: #fff5e2; box-shadow: 0 0 0 1px #101513; transform: translateX(-50%); }

.shoot-trigger {
  min-height: 54px;
  border: 1px solid #ffb086;
  background: var(--orange);
  color: #23140f;
  padding: 7px 12px;
  touch-action: none; /* A held shot owns this gesture. The rest of the page still scrolls. */
  user-select: none;
  -webkit-touch-callout: none;
}
.shoot-trigger.is-held { background: #ffd0a6; box-shadow: inset 0 3px #b75333; }
.shoot-trigger:disabled { border-color: #8a6857; background: #473a32; color: #d3b8a7; }
.mode-picker button, .game-toggles button, .court-actions button { touch-action: manipulation; }

.shoot-guide { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; padding: clamp(24px, 4vw, 44px) 0; }
.shoot-guide h2 { font-size: 1.2rem; }
.shoot-guide p { margin: 8px 0 0; color: var(--muted); font-size: .93rem; }

@media (hover: hover) and (pointer: fine) {
  .mode-picker button:hover:not(:disabled), .game-toggles button:hover:not(:disabled) { border-color: #a3b8aa; color: var(--ink); }
  .shoot-trigger:hover:not(:disabled) { background: #ffa576; }
}
@media (max-width: 690px) {
  .arcade-intro { align-items: start; flex-direction: column; margin-top: 13px; gap: 10px; }
  .control-deck { grid-template-columns: 1fr auto; }
  .aim-readout { grid-column: 1 / -1; }
  .shoot-guide { grid-template-columns: 1fr; gap: 16px; }
}
@media (max-width: 390px) {
  .header nav { gap: 8px; }
  .header nav a { font-size: .78rem; }
  .header .brand { font-size: .82rem; }
  .header .ball { width: 14px; flex-basis: 14px; }
  .game-toggles button { padding-inline: 7px; font-size: .86rem; }
}

@media (orientation: landscape) and (max-height: 500px) {
  .shootout-page .header { min-height: 48px; }
  .arcade-intro { align-items: center; margin: 5px 0 10px; }
  .arcade-intro h1 { font-size: clamp(1.55rem, 4vw, 2.1rem); }
  .arcade-intro p { display: none; }
  .machine { display: grid; grid-template-columns: minmax(0, 1fr) minmax(146px, .40fr); }
  .scoreboard { grid-column: 1 / -1; padding-block: 6px; }
  .scoreboard dd { font-size: 1.5rem; }
  .court-screen canvas { height: min(46svh, 220px); object-fit: contain; }
  .control-deck { display: flex; flex-direction: column; align-items: stretch; justify-content: center; border-inline-start: 1px solid var(--line); }
  .game-toggles button { flex: 1; padding-inline: 5px; }
}

.mode-controls { display: grid; gap: 8px; justify-items: end; }
.mode-picker { flex-wrap: wrap; }
.practice-level { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .85rem; }
.practice-level select { min-height: 42px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: var(--surface); font: 650 1rem system-ui, sans-serif; }
.practice-level[hidden], .scoreboard[hidden] { display: none; }
.solo-scoreboard { grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(64px, 1.15fr); }
.solo-scoreboard .difficulty-cell dd { padding: .14rem 2px; font-size: clamp(.94rem, 2.6vw, 1.8rem); }
.versus-scoreboard { grid-template-columns: minmax(0, 1fr) minmax(102px, .8fr) minmax(0, 1fr); padding-block: 0; }
.versus-scoreboard > div { padding-block: 7px; }
.team-one { --player: #ffad82; }
.team-two { --player: #a3def7; }
.versus-scoreboard .team dd:not(.turn-dots) { color: var(--player); }
.versus-scoreboard .is-turn { background: #2c3532; box-shadow: inset 0 -3px var(--player); }
.turn-dots { display: flex; justify-content: center; gap: 6px; padding-top: 4px; }
.shot-dot { width: 8px; height: 8px; border-radius: 50%; border: 1px solid #9aaba3; }
.shot-dot.is-made { border-color: var(--player); background: var(--player); }
.shot-dot.is-missed { border: 0; border-radius: 0; background: linear-gradient(45deg, transparent 43%, #b6c0bc 43% 57%, transparent 57%), linear-gradient(-45deg, transparent 43%, #b6c0bc 43% 57%, transparent 57%); }
.versus-scoreboard .match-info dd { font: 750 clamp(.76rem, 1.9vw, 1.13rem) / 1.25 system-ui, sans-serif; }
.versus-scoreboard #whose-turn { color: var(--ink); margin-top: 3px; }
.machine[data-player="2"] .shoot-trigger:not(:disabled) { background: #a3def7; border-color: #c2edff; }
.machine[data-player="2"] .shoot-trigger.is-held { background: #d1efff; box-shadow: inset 0 3px #4c94b4; }

@media (max-width: 690px) {
  .mode-controls { justify-items: start; }
}
@media (max-width: 375px) {
  .mode-picker button { padding-inline: 8px; font-size: .87rem; }
  .scoreboard dt { font-size: .59rem; }
  .solo-scoreboard dd { font-size: 1.3rem; }
}
@media (orientation: landscape) and (max-height: 500px) {
  .arcade-intro { flex-direction: row; justify-content: space-between; }
  .mode-controls { justify-items: end; }
  .versus-scoreboard > div { padding-block: 4px; }
  .versus-scoreboard .turn-dots { padding-top: 3px; }
}
