:root {
  color-scheme: dark;
  --page: #171323;
  --panel: #252031;
  --ink: #fff4e4;
  --muted: #cfc0c9;
  --line: #605266;
  --orange: #ff9a49;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  font: 16px/1.5 system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); }
[hidden] { display: none !important; }
a { color: var(--orange); }
button, input, textarea { font: inherit; }
button, input { min-height: 2.75rem; border: 1px solid var(--line); border-radius: .2rem; padding: .48rem .7rem; }
button { background: var(--panel); color: var(--ink); cursor: pointer; font-weight: 800; }
button:hover { border-color: var(--orange); }
button.primary { background: var(--orange); color: #26170e; border-color: #ffc58f; }
button.primary:hover { background: #ffb878; }
:focus-visible { outline: 3px solid #fff2b8; outline-offset: 3px; }
.shell { width: min(54rem, calc(100% - 1.5rem)); margin-inline: auto; }
.mast { border-bottom: 1px solid var(--line); }
.mast .shell { display: flex; align-items: center; justify-content: space-between; gap: .75rem; min-height: 3.35rem; }
.brand { color: var(--ink); display: inline-flex; align-items: center; gap: .5rem; font-weight: 850; letter-spacing: .09em; text-decoration: none; }
.back { font-size: .9rem; }
.hero { padding: clamp(1rem, 4vw, 2.1rem) 0 .95rem; }
.kicker { color: var(--orange); font: 800 .75rem/1.25 var(--mono); margin: 0 0 .3rem; letter-spacing: .12em; text-transform: uppercase; }
h1 { font: 900 clamp(2.7rem, 9vw, 5.5rem)/.95 var(--mono); letter-spacing: .02em; text-transform: uppercase; text-shadow: 2px 2px #a84320, -2px -1px #36627c; margin: 0; }
.hero p:last-child { margin: .65rem 0 0; color: var(--muted); max-width: 40rem; }
.arena { border: 1px solid var(--line); border-radius: .45rem; overflow: hidden; }
.scoreboard { display: flex; align-items: center; justify-content: space-between; gap: .45rem; padding: .4rem .7rem; background: #1d1728; }
.scoreboard p { margin: 0; }
.scoreboard b { display: block; color: var(--orange); font: 800 clamp(.95rem, 3vw, 1.35rem)/1.35 var(--mono); white-space: nowrap; }
.scoreboard p:last-child { text-align: end; }
.label { color: var(--muted); font: 750 .7rem/1.25 var(--mono); letter-spacing: .05em; }
.steps { display: flex; gap: 3px; }
.steps span { width: clamp(.45rem, 2vw, .8rem); height: .75rem; border: 1px solid #827285; }
[data-grade="current"] { background: var(--orange); }
[data-grade="miss"] { background: #332637; }
[data-grade="0"] { background: #e1d6c8; }
[data-grade="1"] { background: #7fc9e8; }
[data-grade="2"] { background: #58c47f; }
[data-grade="3"] { background: #f29a47; }
[data-grade="4"] { background: #f47872; }
[data-grade="5"] { background: #f4d569; }

.court {
  --sky: #633952;
  --back: #37283c;
  --ground: #296158;
  position: relative;
  isolation: isolate;
  min-height: clamp(8rem, 29vw, 15.5rem);
  overflow: hidden;
  background: linear-gradient(#221d36 0, var(--sky) 70%, #b6745c 100%);
}
.court[data-zone="1"] { --sky: #825240; --back: #463431; --ground: #9b6447; }
.court[data-zone="2"] { --sky: #2f5d6e; --back: #213d55; --ground: #334c78; }
.court[data-zone="3"] { --sky: #694078; --back: #422d60; --ground: #584079; }
.court[data-zone="4"] { --sky: #665549; --back: #473e3e; --ground: #7d3e36; }
.court[data-zone="5"] { --sky: #775843; --back: #4b3b3c; --ground: #8c694b; }
.court::before {
  content: "";
  position: absolute;
  inset: 22% 0 34%;
  background: repeating-linear-gradient(90deg, transparent 0 24px, #fff3b22f 24px 28px, transparent 28px 42px),
    repeating-linear-gradient(0deg, var(--back) 0 10px, #19192b 10px 14px);
  clip-path: polygon(0 26%, 12% 26%, 12% 39%, 22% 39%, 22% 10%, 40% 10%, 40% 29%, 51% 29%, 51% 48%, 64% 48%, 64% 19%, 78% 19%, 78% 1%, 92% 1%, 92% 34%, 100% 34%, 100% 100%, 0 100%);
}
.court-lines {
  position: absolute;
  inset: 62% 0 0;
  border-top: 3px solid #e6ad88;
  background: repeating-linear-gradient(115deg, transparent 0 95px, #d5e1c68c 95px 98px, transparent 98px 142px),
    linear-gradient(transparent 47%, #d5e1c65e 47% 51%, transparent 51%),
    linear-gradient(120deg, var(--ground) 76%, #171c28 76%);
}
.hoop {
  position: absolute;
  right: 12%;
  bottom: 36%;
  width: 8px;
  height: 40%;
  border: 2px solid #516575;
  background: #9ab2b4;
}
.hoop::before { content: ""; position: absolute; right: 0; top: 0; width: 31px; height: 20px; background: #e9d7c2; border: 3px solid #66566c; }
.hoop::after { content: ""; position: absolute; right: 13px; top: 19px; width: 22px; height: 11px; border: 2px solid #dac9b9; border-top: 4px solid #e77651; transform: skewX(12deg); }
.runner { position: absolute; left: 15%; bottom: 24%; width: 36px; height: 58px; image-rendering: pixelated; }
.runner rect:nth-of-type(1) { fill: #f1a06a; }
.runner rect:nth-of-type(2), .runner rect:nth-of-type(6) { fill: #6c3b32; }
.runner rect:nth-of-type(3) { fill: #ffd096; }
.runner rect:nth-of-type(4) { fill: #e47445; }
.runner rect:nth-of-type(5) { fill: #ebe0be; }
.zone { position: absolute; bottom: .15rem; right: .5rem; color: #fff1d5; font: 800 .7rem/1.35 var(--mono); text-shadow: 1px 1px #18131d; }
.court[data-phase="setup"] { min-height: clamp(5.1rem, 19vw, 11rem); }
.pane { background: var(--panel); padding: .8rem clamp(.65rem, 3vw, 1.1rem) .95rem; }
.pane h2 { margin: 0 0 .5rem; font-size: clamp(1.08rem, 4vw, 1.5rem); line-height: 1.25; overflow-wrap: anywhere; }
.pane p { margin: .4rem 0 .55rem; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; }
.timer-line { display: flex; align-items: center; gap: .7rem; margin-bottom: .45rem; }
.timer-line progress { accent-color: var(--orange); width: 100%; }
.timer-line strong { font: 800 1.2rem/1.1 var(--mono); color: var(--orange); min-width: 2ch; }
.answer-label { display: block; margin: .35rem 0 .2rem; font-size: .9rem; }
.input-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .45rem; }
.input-row input, textarea { width: 100%; background: #171422; color: var(--ink); }
textarea { min-height: 5rem; padding: .45rem; }
.feedback { color: #ffc09e; min-height: 1.2em; }
.result-list { padding-left: 1.4rem; }
.result-list li { padding: .4rem .2rem; border-bottom: 1px solid var(--line); }
.result-list span { display: block; color: var(--muted); }
.minor { color: var(--muted); }
.daily-stats { background: #1d1728; border-top: 1px solid var(--line); padding: .55rem clamp(.65rem, 3vw, 1.1rem); }
.daily-stats dl { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; margin: 0; }
.daily-stats dt { color: var(--muted); font: 750 .68rem/1.2 var(--mono); letter-spacing: .04em; text-transform: uppercase; }
.daily-stats dd { margin: .12rem 0 0; color: var(--orange); font: 800 1.05rem/1.2 var(--mono); }
#save-note { margin: .35rem .75rem; }
#save-note:empty { display: none; }
.guide { max-width: 46rem; margin: 1.65rem 0; }
.guide p { color: var(--muted); }
.guide details { border-top: 1px solid var(--line); padding: .65rem 0; }
.guide summary { font-weight: 800; cursor: pointer; }
.grades { border-collapse: collapse; font-size: .9rem; max-width: 26rem; width: 100%; margin: .5rem 0 1rem; }
.grades :is(th, td) { text-align: start; padding: .3rem .35rem; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.languages { display: flex; flex-wrap: wrap; gap: .45rem 1rem; padding-block: .8rem; }
.languages a[aria-current] { color: var(--ink); text-decoration: none; }
@media (max-width: 30rem) {
  .court[data-phase="question"] { min-height: 7rem; }
  .arena { display: flex; flex-direction: column; }
  .court[data-phase="setup"] { order: 2; }
  .daily-stats { order: 3; }
  .daily-stats dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .input-row button { padding-inline: .55rem; }
}
