:root {
  --cov-ink: #0b1b22;
  --cov-panel: #11262d;
  --cov-control: #17343a;
  --cov-rim: #507a7b;
  --cov-paper: #fff6e4;
  --cov-muted: #bdd3d1;
  --cov-mint: #75d7c7;
  --cov-gold: #f1c365;
}

.control-hint {
  position:absolute;
  right:calc(var(--safe-right) + var(--action-right));
  bottom:calc(var(--safe-bottom) + var(--action-bottom) + var(--action-cell) + var(--action-size) + var(--action-tactic) + 2 * var(--action-gap) + 8px);
  max-width:min(205px, 48vw);
  padding:4px 7px;
  color:#cee2dd;
  background:#0b1b22db;
  border-left:2px solid #75d7c777;
  font-size:10px;
  line-height:1.4;
  pointer-events:none;
  text-align:right;
}

#dialog {
  color: var(--cov-paper);
  background: var(--cov-panel);
  border: 1px solid var(--cov-rim);
  border-top: 3px solid var(--cov-mint);
  border-radius: 10px;
  box-shadow: 0 18px 54px #030f17a6;
  overflow: auto;
  scrollbar-color: var(--cov-rim) var(--cov-ink);
}
#dialog::backdrop { background: #07151cc9; }
#dialog-content { padding: clamp(14px, 4.5vw, 23px); }
#dialog .dialog-head {
  align-items: center;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid #456768;
}
#dialog .dialog-head h2 {
  margin: 0;
  font-size: clamp(22px, 6vw, 27px);
  line-height: 1.22;
  letter-spacing: .035em;
}
#dialog .dialog-copy,
#dialog .guide { color: var(--cov-muted); font-size: 13px; line-height: 1.65; }
#dialog :is(.dialog-copy a, .guide strong) { color: var(--cov-mint); }
#dialog .guide { padding-left: 21px; }
#dialog .guide li { padding-left: 3px; margin: 0 0 10px; }
#dialog .guide li::marker { color: var(--cov-mint); font-weight: 750; }
#dialog fieldset { min-width: 0; margin: 14px 0; }
#dialog legend { color: var(--cov-muted); font-size: 13px; font-weight: 650; line-height: 1.45; }

#dialog :is(.dialog-actions button, .pause-tools button, .zone-grid button, .close, .options label) {
  min-height: 45px;
  color: var(--cov-paper);
  background: var(--cov-control);
  border: 1px solid var(--cov-rim);
  border-radius: 5px 5px 9px 5px;
  font-weight: 700;
}
#dialog .close {
  width: 45px;
  flex: 0 0 45px;
  line-height: 1;
  font-size: 23px;
  color: var(--cov-muted);
}
#dialog .dialog-actions { gap: 8px; margin-top: 17px; }
#dialog .dialog-actions button { flex: 1 1 115px; padding: 8px 12px; white-space: normal; }
#dialog .dialog-actions .accent {
  color: var(--cov-ink);
  background: var(--cov-gold);
  border-color: var(--cov-gold);
  font-weight: 850;
  box-shadow: inset 3px 0 #ffe19d;
}
#dialog .pause-tools { gap: 7px; }
#dialog .pause-tools button { min-width: 0; padding: 6px 7px; }
#dialog .audio-settings { display: grid; gap: 7px; }
#dialog .setting-note { margin: 7px 0 0; color: #a8bfbc; font-size: 11px; line-height: 1.5; }
#dialog #ai-advanced {
  border: 1px solid var(--cov-rim);
  border-radius: 5px;
  padding-inline: 11px;
  background: #122830;
}
#dialog #ai-advanced summary {
  align-content: center;
  min-height: 44px;
  color: var(--cov-paper);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
#dialog #ai-advanced summary:focus-visible { outline: 2px solid var(--cov-mint); }
#dialog #ai-advanced fieldset { margin-block: 8px 12px; }
#dialog .practice-courses { display: grid; gap: 9px; }
#dialog .practice-courses button { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; min-height: 62px; padding: 11px 14px; border-radius: 5px; border-color: var(--cov-rim); background: var(--cov-control); }
#dialog .practice-courses strong { font-size: 17px; color: var(--cov-paper); }
#dialog .practice-courses span { font-size: 11px; color: var(--cov-muted); }
@media (max-width: 360px) and (max-height: 650px) and (orientation: portrait) {
  #dialog .practice-courses { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #dialog .practice-courses button { padding-inline: 9px; }
  #dialog .practice-courses [data-dialog="free-practice"] { font-size: 14px; }
}
#dialog .volume-control { display: grid; gap: 4px; color: var(--cov-muted); font-size: 13px; }
#dialog .volume-control > span { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
#dialog .volume-control output { font-variant-numeric: tabular-nums; color: var(--cov-paper); }
#dialog .volume-control input { width: 100%; min-height: 38px; margin: 0; accent-color: var(--cov-mint); touch-action: none; }
#dialog .options { gap: 5px; }
#dialog .options label {
  display: grid;
  place-items: center;
  flex: 1 1 0;
  min-width: 0;
  padding: 5px 3px;
  line-height: 1.25;
  cursor: pointer;
}
#dialog :is(.options input:checked + label, .zone-grid button[data-selected]) {
  color: var(--cov-ink);
  background: var(--cov-mint);
  border-color: var(--cov-mint);
  box-shadow: inset 0 -3px #3c8d82;
  font-weight: 850;
}
#dialog .zone-grid { gap: 6px; }
#dialog .zone-grid button { padding: 5px 3px; }
#dialog :is(button, a):focus-visible,
#dialog .options input:focus-visible + label,
.app[data-screen="play"] #pause:focus-visible,
.circle-actions button:focus-visible,
#replay-skip:focus-visible {
  outline: 2px solid var(--cov-gold);
  outline-offset: 3px;
}
#dialog button:active:not(:disabled), #dialog .options label:active {
  filter: brightness(1.22);
  box-shadow: inset 0 0 0 2px #fff6e478;
}
#dialog :is(button:disabled, .options input:disabled + label) { opacity: .52; cursor: default; }
@media (hover: hover) {
  #dialog button:hover:not(:disabled), #dialog .options label:hover { border-color: var(--cov-mint); }
  #dialog .dialog-actions .accent:hover:not(:disabled) { border-color: #fff2c9; }
}

.app[data-screen="play"] .scoreboard {
  color: var(--cov-paper);
  background: #0b1b22f2;
  border-color: var(--cov-rim);
  border-radius: 6px;
  box-shadow: 0 3px 10px #07151b73;
}
.app[data-screen="play"] .scoreboard .teal { color: var(--cov-mint); }
.app[data-screen="play"] .scoreboard .coral { color: #ffae98; }
.app[data-screen="play"] #pause {
  color: var(--cov-paper);
  border-color: var(--cov-rim);
  background: #0b1b22f0;
  box-shadow: 0 3px 10px #07151b73;
}
.app[data-screen="play"] #pause:active { color: var(--cov-ink); background: var(--cov-mint); }
#callout {
  color: var(--cov-paper);
  background: #0b1b22ee;
  border: 1px solid var(--cov-rim);
  border-radius: 5px;
}
#duty-label { position: absolute; top: calc(var(--safe-top) + 64px); left: 50%; transform: translateX(-50%); max-width: calc(100% - var(--safe-left) - var(--safe-right) - 30px); padding: 4px 9px; border-radius: 4px; background: #0b1b22dd; color: #cde4df; font-size: 11px; line-height: 1.4; white-space: nowrap; pointer-events: none; }
#duty-label:empty { display: none; }
.app[data-screen="play"] #callout { top: calc(var(--safe-top) + 96px); }
.point-actions { display: flex; gap: 8px; margin-top: 12px; }
.point-actions button { pointer-events: auto; flex: 1; min-height: 45px; border: 1px solid #527c79; background: #16353a; color: #e3f0e9; border-radius: 4px; font-size: 13px; }
.point-actions #point-next { background: var(--cov-gold); color: var(--cov-ink); border-color: var(--cov-gold); font-weight: 750; }
.point-actions button:disabled { opacity: .35; }
#drill-overlay { position: absolute; inset: 0; z-index: 16; pointer-events: none; }
#drill-overlay[hidden] { display: none; }
.drill-card { position: absolute; bottom: calc(var(--safe-bottom) + 20px); left: calc(var(--safe-left) + 16px); right: calc(var(--safe-right) + 16px); max-width: 420px; margin: auto; padding: 15px 17px; border: 1px solid var(--cov-rim); border-top: 3px solid var(--cov-mint); border-radius: 6px; background: #0b1b22f5; pointer-events: auto; }
.drill-card small { color: var(--cov-mint); font-size: 11px; }
.drill-card h2 { font-size: 23px; margin: 7px 0; color: var(--cov-paper); }
.drill-card p { font-size: 13px; line-height: 1.6; margin: 7px 0 13px; color: var(--cov-muted); }
.drill-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.drill-actions button { min-height: 46px; border-radius: 4px; border-color: var(--cov-rim); color: var(--cov-paper); background: var(--cov-control); }
.drill-actions #drill-menu, .drill-actions #drill-retry[hidden] ~ #drill-next { grid-column: 1 / -1; }
.drill-actions #drill-next { background: var(--cov-gold); color: var(--cov-ink); font-weight: 750; }
.app[data-drill] #scoreboard { visibility: hidden; }
.app[data-drill-wait] #controls { visibility: hidden; pointer-events: none; }
#drill-badge { position: absolute; top: calc(var(--safe-top) + 15px); left: 50%; transform: translateX(-50%); color: var(--cov-paper); border: 1px solid var(--cov-rim); background: #0b1b22ed; border-radius: 5px; padding: 9px 12px; font-size: 13px; white-space: nowrap; }
@media (orientation: landscape) { .drill-card { left: auto; width: min(360px, 49%); bottom: calc(var(--safe-bottom) + 12px); } .app[data-screen="play"] #duty-label { top: calc(var(--safe-top) + 55px); } }

.circle-actions button {
  --cov-action-bg: #122a32ef;
  --cov-action-rim: #93b8b7;
  border-color: var(--cov-action-rim);
  background: var(--cov-action-bg);
  color: var(--cov-paper);
  box-shadow: 0 3px 8px #05121772;
  text-shadow: none;
}
.circle-actions [data-gesture="receive"] {
  --cov-action-bg: #164343f0;
  --cov-action-rim: #83e0d0;
}
.circle-actions [data-gesture="set"] {
  --cov-action-bg: #233e53f0;
  --cov-action-rim: #a4cde3;
}
.circle-actions [data-gesture="attack"] {
  --cov-action-bg: #592c2bf0;
  --cov-action-rim: #ffa88e;
}
.controls[data-layout="serve"] .circle-actions :is(#toss, [data-gesture="attack"]):not(:disabled) {
  --cov-action-bg: var(--cov-gold);
  --cov-action-rim: #ffe4aa;
  color: var(--cov-ink);
}
.circle-actions button[data-down], .circle-actions button:active:not(:disabled) {
  filter: brightness(1.18);
  box-shadow: 0 2px 6px #05121772, inset 0 0 0 2px #fff6e4b3;
}
.circle-actions button:disabled { opacity: .53; filter: saturate(.55); }
.circle-actions button[data-standby]:disabled {
  opacity: .84;
  color: #c4d6d4;
  background: #14272ded;
  border-color: #759492;
  box-shadow: none;
  filter: none;
}
.circle-actions .standby-label {
  color: #acc2c0;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
}
@media (prefers-reduced-motion: no-preference) {
  .circle-actions button { transition: opacity 120ms ease-out, background-color 120ms ease-out; }
  .controls[data-layout="serve"] .circle-actions :is(#toss, [data-gesture="attack"]) { transition-property: opacity; }
}

#joystick {
  border-color: #b9e6dd91;
  background: #0b1b2259;
  box-shadow: inset 0 0 0 4px #0b1b222e;
}
#stick {
  border-color: #cdf3ebbf;
  background: #78b6aaa6;
  box-shadow: 0 3px 8px #05121773;
}

.replay-badge {
  color: var(--cov-paper);
  background: #0b1b22ef;
  border-color: var(--cov-rim);
  border-radius: 6px;
}
.replay-badge i { background: var(--cov-gold); box-shadow: none; }
#replay-skip {
  color: var(--cov-paper);
  background: #142e35f5;
  border-color: var(--cov-mint);
  border-radius: 6px 6px 11px 6px;
  box-shadow: 0 3px 10px #07151b73;
}
#replay-skip:active { color: var(--cov-ink); background: var(--cov-mint); }

/* Decisions keep the live court visible and reserve a clear referee close-up. */
#point-overlay { position: absolute; inset: 0; z-index: 14; pointer-events: none; }
#point-overlay[hidden] { display: none; }
.point-card {
  --point-color: #a3e4d5;
  position: absolute; left: 50%; top: max(calc(var(--safe-top) + 94px), 20%);
  transform: translateX(-50%); width: min(310px, calc(100% - 40px));
  padding: 16px 20px 12px; border: 1px solid #819b9c; border-top: 3px solid var(--point-color);
  border-radius: 5px; background: #0a1c24f5; color: #f5f1e3;
  box-shadow: 0 10px 30px #06161c80; text-align: left;
}
#point-overlay[data-team="1"] .point-card { --point-color: #ffad97; }
.point-heading { display: flex; align-items: center; justify-content: space-between; color: var(--point-color); }
.point-kicker { font-family: 'Barlow Condensed', sans-serif; font-size: 15px; letter-spacing: .16em; font-weight: 700; }
.point-plus { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
#point-team { margin: 0 0 9px; color: var(--point-color); font-size: clamp(26px, 7vw, 32px); line-height: 1.2; }
.point-score { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid #b9d1ce30; }
.point-score span { color: #b5cbc7; font-size: 12px; }
.point-score b { font-family: 'Barlow Condensed', sans-serif; font-size: 27px; line-height: 1; font-variant-numeric: tabular-nums; }
.point-score i { color: #7d9999; font-size: 20px; font-style: normal; }
.point-decision { display: grid; gap: 5px; padding-top: 11px; }
#point-reason { font-size: 17px; line-height: 1.3; }
#point-detail { color: #c7d3ce; font-size: 12px; line-height: 1.5; }
.point-next { display: block; margin-top: 12px; color: #91aaa7; font-size: 10px; letter-spacing: .06em; }
#referee-inset {
  position: absolute; right: calc(var(--safe-right) + 14px); bottom: max(calc(var(--safe-bottom) + 18px), 7%);
  width: clamp(144px, 47vw, 200px); aspect-ratio: 1.12;
  border: 1px solid #b0d0c9; border-radius: 3px; overflow: hidden;
  box-shadow: 0 5px 18px #03151d66; pointer-events: none;
}
#referee-label { position: absolute; left: 0; bottom: 0; right: 0; padding: 5px 7px; text-align: center; background: #0c202bed; color: #d3e5de; font-size: 10px; line-height: 1.3; }
.app[data-point] .controls, .app[data-point] #play-hud, .app[data-point] #gesture-hint { visibility: hidden; pointer-events: none; }
@media (max-height: 570px) and (orientation: landscape) {
  .point-card { top: max(calc(var(--safe-top) + 57px), 18%); width: min(285px, 45%); padding: 9px 16px; }
  #point-team { font-size: 25px; margin-bottom: 6px; }
  .point-score { padding-bottom: 7px; }
  .point-decision { padding-top: 7px; }
  .point-next { margin-top: 6px; }
  #referee-inset { width: 145px; bottom: calc(var(--safe-bottom) + 12px); }
}
@media (prefers-reduced-motion: no-preference) {
  #point-overlay:not([hidden]) .point-card { animation: decision-in 150ms ease-out both; }
  @keyframes decision-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
}

.point-feedback { display: block; margin-top: 4px; color: #ffe1a2; }
#point-overlay[data-style="quick"] .point-card {
  top: max(calc(var(--safe-top) + 76px), 13%);
  padding: 10px 14px;
}
#point-overlay[data-style="quick"] :is(.point-heading, .point-next, #referee-inset) { display: none; }
#point-overlay[data-style="quick"] #point-team { margin-bottom: 4px; font-size: 22px; }
#point-overlay[data-style="quick"] .point-score { padding-bottom: 5px; }
#point-overlay[data-style="quick"] .point-decision { padding-top: 5px; gap: 2px; }
#point-overlay[data-style="quick"] #point-reason { font-size: 14px; }
#point-overlay[data-style="quick"] .point-actions { margin-top: 8px; }
#point-overlay[data-style="quick"][data-stage="whistle"] .point-decision { visibility: hidden; }
