:root{--ink:#16182b;--indigo:#252642;--paper:#fff3d5;--gold:#ffd05e;--coral:#ff7664;--muted:#c4c3d5;--accent:var(--gold);color-scheme:dark}
*{box-sizing:border-box}html,body{margin:0;width:100%;height:100%;overflow:hidden;background:var(--indigo);color:var(--paper);font-family:"PingFang SC","Microsoft YaHei","Noto Sans CJK SC",system-ui,sans-serif}button,input,summary{font:inherit}button,a,summary,input{touch-action:manipulation}button,summary{cursor:pointer}button{color:inherit}button:focus-visible,a:focus-visible,summary:focus-visible,input:focus-visible{outline:3px solid #fff;outline-offset:4px}button:disabled{cursor:default;filter:saturate(.45);opacity:.65}button:not(:disabled):active{transform:translateY(2px)}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}#game{height:100dvh;position:relative;isolation:isolate;background:var(--indigo)}#stage{position:absolute;inset:0;overflow:hidden;background:#c7aa8b}#stage canvas{display:block;width:100%;height:100%;image-rendering:auto}
.match-header{position:absolute;z-index:3;top:max(20px,env(safe-area-inset-top));left:max(24px,env(safe-area-inset-left));right:max(24px,env(safe-area-inset-right));display:flex;align-items:center;gap:20px;pointer-events:none}.match-brand{filter:drop-shadow(2px 3px 0 var(--ink));transform:rotate(-3deg)}.ground-id{display:block;width:max-content;padding:3px 8px;background:var(--ink);font-size:10px;font-weight:800;letter-spacing:.12em;color:var(--paper)}.match-brand strong{display:block;font-size:clamp(26px,3vw,42px);font-weight:950;font-style:italic;letter-spacing:.04em;line-height:1.25;-webkit-text-stroke:1px var(--ink);paint-order:stroke fill}.match-brand strong>span{color:var(--coral)}.score{display:flex;align-items:center;gap:9px;padding:8px 14px;background:var(--ink);border-bottom:3px solid var(--coral);transform:skew(-5deg);box-shadow:3px 3px 0 #fff3d5}.score>span{font-size:32px;line-height:1;font-weight:950;color:var(--gold);font-variant-numeric:tabular-nums}.score small{font-size:11px;font-weight:700;white-space:nowrap}.score small b{font-size:14px;margin-left:6px}.score-divider{opacity:.4;margin-left:5px}.tools{position:relative;margin-left:auto;align-self:flex-start;pointer-events:auto}.tools summary{list-style:none;display:flex;align-items:center;justify-content:center;gap:16px;min-width:92px;min-height:44px;padding:8px 13px;border:2px solid var(--ink);background:var(--paper);color:var(--ink);box-shadow:3px 3px 0 var(--ink);font-weight:900;font-size:12px}.tools summary::-webkit-details-marker{display:none}.tool-menu{position:absolute;top:52px;right:0;width:156px;padding:8px;background:var(--ink);border:2px solid var(--paper);box-shadow:4px 4px 0 var(--ink);display:grid;gap:4px}.tool-menu button,.tool-menu a{display:flex;align-items:center;justify-content:center;min-height:44px;border:0;border-radius:0;background:transparent;color:var(--paper);text-decoration:none;font-size:13px;font-weight:700}.tool-menu button:hover,.tool-menu a:hover{background:var(--indigo);color:var(--gold)}
.control{position:absolute;z-index:2;right:max(24px,env(safe-area-inset-right));bottom:max(24px,env(safe-area-inset-bottom));width:338px;max-width:calc(100% - 32px);padding:20px 23px 17px;background:var(--indigo);border:3px solid var(--ink);outline:2px solid var(--paper);box-shadow:7px 7px 0 var(--ink);border-radius:2px}.control:before{content:"";position:absolute;left:-5px;top:-5px;width:38px;height:7px;background:var(--coral);transform:rotate(-8deg);pointer-events:none}.desk-id{display:flex;justify-content:space-between;align-items:center;margin-bottom:15px;color:var(--muted);font-size:10px;font-weight:700;letter-spacing:.06em}.desk-id b{font-size:19px;font-style:italic;color:var(--paper)}.desk-id b>span:not(.sr-only){font-size:10px}.steps{display:flex;gap:0;margin-bottom:17px;border-bottom:2px solid #fff3d52b}.steps>span{flex:1;font-size:12px;font-weight:800;color:#a6a6bf;padding:0 0 9px}.steps>span+span{text-align:right}.steps .active{color:var(--accent);position:relative}.steps .active:after{content:"";position:absolute;left:0;right:0;bottom:-2px;height:3px;background:var(--accent)}.instruction strong{display:block;font-size:27px;line-height:1.25;font-weight:950;letter-spacing:.03em}.instruction #hint{display:block;min-height:16px;margin-top:6px;font-size:11px;color:var(--muted);line-height:1.5}.selector{display:grid;grid-template-columns:44px minmax(0,1fr) 44px;gap:6px;align-items:center;margin:13px 0 15px}.selector[hidden]{display:none}.selector #value{grid-column:1/-1;justify-self:center;font-size:17px;line-height:1.5;color:var(--accent);font-weight:900;font-variant-numeric:tabular-nums}.selector button{width:44px;height:44px;padding:0;border:2px solid #fff3d54d;background:var(--ink);border-radius:0;font-size:25px;line-height:1}.selector button:hover{border-color:var(--gold);color:var(--gold)}.direction-ruler{position:relative;min-width:0;padding-top:12px}.ruler-labels{display:flex;justify-content:space-between;position:absolute;top:-2px;left:5px;right:5px;color:var(--muted);font-size:9px;font-weight:700}.direction-ruler:before{content:"";position:absolute;pointer-events:none;left:9px;right:9px;top:29px;height:10px;background:repeating-linear-gradient(90deg,#fff3d56b 0 1px,transparent 1px 12.5%)}input[type=range]{appearance:none;-webkit-appearance:none;width:100%;height:44px;margin:0;background:transparent;position:relative;cursor:ew-resize}input[type=range]::-webkit-slider-runnable-track{height:2px;background:#fff3d580}input[type=range]::-moz-range-track{height:2px;background:#fff3d580}input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;width:17px;height:27px;margin-top:-13px;background:var(--accent);border:3px solid var(--ink);box-shadow:0 0 0 1px var(--paper);transform:skew(-8deg)}input[type=range]::-moz-range-thumb{width:13px;height:23px;border-radius:0;background:var(--accent);border:3px solid var(--ink)}#confirm{display:block;position:relative;min-height:55px;width:100%;padding:12px 10px;border:2px solid var(--ink);border-radius:0;background:var(--gold);box-shadow:3px 3px 0 var(--ink);color:var(--ink);font-weight:950;font-size:20px;letter-spacing:.1em}#confirm:hover:not(:disabled){filter:brightness(1.08)}#confirm kbd{font-family:inherit;font-size:10px;letter-spacing:0;margin-left:10px;padding:3px 5px;border:1px solid #16182b66;vertical-align:middle}.keyboard-hint{display:flex;justify-content:space-between;gap:8px;margin:12px 0 0;font-size:9px;color:#bebbd1}.control p{line-height:1.4}#game[data-phase=curve]{--accent:var(--coral)}#game[data-phase=curve] #confirm{font-size:24px}#game:is([data-phase=run],[data-phase=flight]) .steps{opacity:.5}#game:is([data-phase=run],[data-phase=flight]) #confirm{margin-top:18px}#result{position:absolute;z-index:2;top:24%;left:3%;right:calc(350px + 5%);text-align:center;font-size:clamp(34px,5vw,76px);font-weight:950;font-style:italic;letter-spacing:.08em;line-height:1.3;color:var(--paper);-webkit-text-stroke:2px var(--ink);paint-order:stroke fill;text-shadow:4px 5px 0 var(--ink),7px 8px 0 var(--coral);pointer-events:none}#result:empty{display:none}#error{position:absolute;z-index:10;top:35%;left:50%;transform:translateX(-50%);width:min(380px,90%);padding:24px;background:var(--ink);border:3px solid var(--coral);color:var(--paper);line-height:1.7}
@media(max-width:900px){#game{display:grid;grid-template-rows:auto minmax(0,1fr) auto}.match-header{position:relative;inset:auto;padding:10px max(14px,env(safe-area-inset-right)) 10px max(14px,env(safe-area-inset-left));gap:12px;background:var(--indigo);border-bottom:2px solid var(--ink);grid-row:1}.match-brand strong{font-size:24px}.ground-id{font-size:8px;padding:2px 4px}.score{padding:5px 8px;gap:5px;box-shadow:none;border-bottom-width:2px}.score>span{font-size:24px}.score small{font-size:9px;white-space:normal;max-width:65px;line-height:1.5}.score small b{font-size:11px;margin-left:0}.score-divider{margin:0}.tools{align-self:center}.tools summary{min-width:44px;padding:8px;font-size:11px;gap:6px;box-shadow:2px 2px 0 var(--ink)}#stage{position:relative;inset:auto;grid-row:2;min-height:0}.control{position:relative;inset:auto;transform:none;grid-row:3;max-width:none;width:100%;padding:13px max(20px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(20px,env(safe-area-inset-left));border-width:3px 0 0;outline:0;box-shadow:none}.control:before,.desk-id{display:none}.steps{margin-bottom:10px}.steps>span{font-size:11px;padding-bottom:7px}.instruction{display:flex;align-items:center;justify-content:space-between;gap:12px}.instruction strong{font-size:23px;white-space:nowrap}.instruction #hint{max-width:180px;font-size:10px;margin:0;text-align:right}.selector{margin:5px 0 9px;column-gap:12px;row-gap:1px}.selector #value{font-size:16px}#confirm{min-height:49px;padding:9px;font-size:19px}.keyboard-hint,#confirm kbd{display:none}#result{left:6%;right:6%;top:25%;font-size:43px}}
@media(max-width:900px) and (max-height:500px) and (orientation:landscape){#game{grid-template-columns:minmax(0,1fr) minmax(240px,32%);grid-template-rows:58px minmax(0,1fr)}.match-header{grid-column:1/-1;padding-top:5px;padding-bottom:5px}.match-brand strong{font-size:22px}.ground-id{display:none}#stage{grid-column:1;grid-row:2}.control{grid-column:2;grid-row:2;align-self:stretch;display:flex;flex-direction:column;justify-content:center;border-top:0;border-left:3px solid var(--ink);padding:10px 14px}.steps{margin-bottom:9px}.instruction{display:block}.instruction strong{font-size:22px}.instruction #hint{text-align:left;max-width:none;margin-top:3px}.selector{column-gap:6px;margin:5px 0 8px}.selector #value{font-size:14px}#confirm{min-height:46px;font-size:18px}#result{right:34%;top:30%;font-size:40px}}
@media(max-width:360px){.match-header{gap:8px;padding-left:10px;padding-right:10px}.match-brand strong{font-size:21px}.ground-id{font-size:7px}.score{padding:5px}.tools summary{font-size:0;gap:0}.tools summary span{font-size:18px}.control{padding-left:16px;padding-right:16px}.instruction #hint{max-width:145px}}
@media(prefers-reduced-motion:reduce){*,*:before,*:after{scroll-behavior:auto!important;transition:none!important;animation:none!important}}
/* Original generated artwork: nine-slice corners survive every viewport. */
.control{background:transparent;border:0;outline:0;box-shadow:none;border-image-source:url('./assets/hud/command-plate.webp');border-image-slice:110 270 110 270 fill;border-image-width:32px 78px;border-image-repeat:stretch;padding:29px 25px 25px}.control:before{display:none}#confirm{background:transparent url('./assets/hud/strike-strip.webp') center/100% 100% no-repeat;border:0;box-shadow:none;min-height:61px;padding:15px 22px;font-size:20px}#confirm kbd{margin-left:5px;font-size:9px}#game[data-phase=curve] #confirm{font-size:23px}
@media(max-width:900px){.control{padding:19px max(23px,env(safe-area-inset-right)) max(16px,env(safe-area-inset-bottom)) max(23px,env(safe-area-inset-left));border-image-width:24px 62px}.steps{margin-bottom:8px}.selector{margin-top:4px;margin-bottom:5px}#confirm{min-height:54px;padding:12px 25px}}
@media(max-width:900px) and (max-height:500px) and (orientation:landscape){.control{padding:20px 20px;border-image-width:28px 60px}.steps{margin-bottom:7px}.instruction strong{font-size:21px}#confirm{font-size:18px;min-height:51px}}
@media(max-width:900px) and (max-height:350px) and (orientation:landscape){.control{padding:14px 19px}.steps{margin-bottom:5px}.instruction #hint{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0)}.selector{margin-top:2px;margin-bottom:2px;row-gap:0}.direction-ruler{padding-top:8px}.ruler-labels{top:-3px}.direction-ruler:before{top:25px}#confirm{min-height:48px;padding-top:10px;padding-bottom:10px}}
#game:is([data-phase=loading],[data-phase=unavailable]) .instruction{display:block}#game:is([data-phase=loading],[data-phase=unavailable]) .instruction strong{font-size:20px;white-space:normal}#game:is([data-phase=loading],[data-phase=unavailable]) .instruction #hint{text-align:left;max-width:none;margin-top:6px}#game[data-phase=unavailable] .selector{display:none}
/* Fixed-size ink corners; only the quiet centre stretches on tablets. */
#confirm{background:none;border:0;border-image-source:url('./assets/hud/strike-strip.webp');border-image-slice:44 128 50 218 fill;border-image-width:14px 40px 16px 68px;border-image-repeat:stretch}
@media(max-width:900px){#confirm{border-image-width:12px 35px 14px 59px}.control>.steps,.control>.instruction,.control>.selector,.control>#confirm,.control>.keyboard-hint{width:100%;max-width:520px;margin-left:auto;margin-right:auto}}
@media(max-width:900px) and (max-height:500px) and (orientation:landscape){#confirm{border-image-width:11px 32px 12px 53px}}

/* On a GPU error this is a labelled static stadium view, never a simulated
   match. It also gives the brief loading state a legible game backdrop. */
#game:is([data-phase=loading],[data-phase=unavailable]) #stage{background:linear-gradient(120deg,#17172844,#15152b60),url('./assets/hud/stadium-preview.webp') center/cover no-repeat}
#game[data-phase=unavailable] #error{background:#19182bf5;border:0;border-left:5px solid var(--coral);box-shadow:4px 4px 0 #101020;color:var(--paper)}
@media(max-width:900px) and (max-height:500px) and (orientation:landscape){#game[data-phase=unavailable] #error{left:33%;width:min(52%,380px);top:40%}}

/* v21: precise three-step interaction; generated manga plate remains the HUD. */
#goal-target{position:absolute;z-index:2;touch-action:none;cursor:crosshair;border:1px solid #fff3d55c;outline-offset:6px;background:linear-gradient(180deg,#ffe1a507,#ffcf5b10);pointer-events:auto}
#goal-target[hidden]{display:none}#goal-target:focus-visible{outline:2px solid var(--gold)}
#goal-crosshair{position:absolute;left:50%;top:50%;width:30px;height:30px;transform:translate(-50%,-50%);border:2px solid var(--gold);border-radius:50%;box-shadow:0 0 0 2px #17182b,0 0 13px #ffd05e88;pointer-events:none}
#goal-crosshair:before,#goal-crosshair:after{content:"";position:absolute;background:var(--paper);box-shadow:0 0 0 1px #17182b}
#goal-crosshair:before{width:40px;height:2px;top:12px;left:-7px}#goal-crosshair:after{height:40px;width:2px;top:-7px;left:12px}
#goal-crosshair span{position:absolute;z-index:1;inset:9px;background:var(--gold);border-radius:50%}.goal-caption{position:absolute;left:50%;top:calc(100% + 14px);transform:translateX(-50%);padding:4px 8px;background:#17182bcc;font-size:10px;font-weight:700;color:var(--paper);white-space:nowrap;pointer-events:none}
.steps>span{font-size:11px}.steps>span+span{text-align:center}.steps>span:last-child{text-align:right}.steps>span.complete{color:#e4d9b7}.instruction strong{font-size:24px}
#target-readout{display:flex;flex-direction:column;gap:7px;margin:13px 0}.target-arrows{display:flex;justify-content:center;gap:7px}.target-arrows button{width:44px;height:44px;font-size:23px}
.precision-visual{position:relative;width:100%;margin:5px auto 12px;text-align:center}.precision-visual[hidden]{display:none}
.precision-visual canvas{display:block;max-width:100%;width:210px;height:210px;aspect-ratio:1;margin:auto;touch-action:none;cursor:crosshair}#power-ring{cursor:default}
.precision-caption{display:grid;gap:3px;font-size:12px;margin-top:-7px;pointer-events:none}.precision-caption b{color:var(--gold);font-size:14px}.precision-caption small{color:var(--muted);font-size:9px}
#game[data-phase=strike]{--accent:var(--coral)}#game[data-phase=timing]{--accent:#9aebcf}
#game:is([data-phase=run],[data-phase=flight]) .control{padding-top:24px;padding-bottom:23px}
#result{top:auto;bottom:24px;left:22px;right:auto;max-width:calc(100% - 410px);font-size:clamp(23px,3vw,40px);text-align:left;text-shadow:2px 3px 0 var(--ink),4px 4px 0 var(--coral)}
#perfect-word{position:absolute;z-index:4;left:6%;bottom:12%;color:var(--gold);font-size:clamp(34px,5.8vw,76px);line-height:1;font-weight:1000;font-style:italic;letter-spacing:-.04em;-webkit-text-stroke:3px var(--ink);paint-order:stroke fill;text-shadow:4px 4px 0 var(--coral),7px 7px 0 var(--ink);transform:rotate(-7deg);pointer-events:none}
#perfect-word span{display:block;font-size:13px;letter-spacing:.3em;font-style:normal;color:var(--paper);-webkit-text-stroke:0;text-shadow:2px 2px 0 var(--ink);margin-top:8px}
#perfect-word[hidden]{display:none}#perfect-flash{position:absolute;inset:0;z-index:3;background:#fff3d5;opacity:0;pointer-events:none}
@media(max-width:900px){
 .control{padding-top:17px;padding-bottom:14px}.steps{margin-bottom:7px}.instruction strong{font-size:20px}.instruction #hint{font-size:10px}
 .precision-visual{display:flex;align-items:center;justify-content:center;gap:14px;margin:1px auto 5px;height:148px}
 .precision-visual canvas{width:148px;height:148px;margin:0}.precision-caption{max-width:145px;margin:0;text-align:left;gap:7px}.precision-caption b{font-size:13px}
 #target-readout{flex-direction:row;justify-content:space-between;margin:8px 0;gap:5px}#target-readout #value{font-size:13px}.target-arrows{gap:3px}.target-arrows button{width:40px;height:42px;font-size:20px}
 #result{position:absolute;top:84px;bottom:auto;left:12px;right:12px;max-width:none;text-align:center;font-size:26px}
 #perfect-word{left:5%;bottom:8%;font-size:44px}.goal-caption{font-size:9px}
}
@media(max-width:900px) and (max-height:500px) and (orientation:landscape){
 .precision-visual{height:116px;gap:2px}.precision-visual canvas{width:116px;height:116px}.precision-caption{max-width:90px}.precision-caption b{font-size:11px}.precision-caption small{font-size:8px}
 .control{padding:15px 18px}.instruction strong{font-size:19px}.instruction #hint{font-size:9px}
 #target-readout{flex-direction:column;gap:3px;margin:4px 0}.target-arrows button{height:38px;width:40px}#confirm{min-height:46px;font-size:17px}
 #result{top:65px;right:34%;font-size:23px}
}
@media(max-width:360px){#target-readout{flex-direction:column;gap:3px}.precision-caption{max-width:122px}.precision-visual{height:138px}.precision-visual canvas{width:138px;height:138px}.steps>span{font-size:10px}}
#target-readout[hidden]{display:none}
.precision-caption b{font-size:13px;font-variant-numeric:tabular-nums;line-height:1.55}.precision-caption small{line-height:1.5}
@media(max-width:900px){
 .desk-id{display:flex;margin-bottom:5px;min-height:18px;font-size:9px}.desk-id b{font-size:16px}.desk-id b>span:not(.sr-only){font-size:10px}
 .desk-id #distance{font-size:16px}.precision-caption{min-width:124px;max-width:150px}.precision-caption b{font-size:12px;line-height:1.7}
}
@media(max-width:900px) and (max-height:500px) and (orientation:landscape){
 .desk-id{position:absolute;top:-23px;right:10px;min-height:20px;margin:0;padding:2px 7px;background:var(--ink);border:1px solid #fff3d555;border-radius:2px}
 .desk-id>span{display:none}.desk-id b,.desk-id #distance{font-size:13px}.precision-caption{min-width:90px;max-width:110px}.precision-caption b{font-size:10px}
}
@media(max-width:360px){.precision-caption{min-width:118px;max-width:126px}.precision-caption b{font-size:11px}}
/* Contact-only artwork occupies the existing brand strip, never the ball lane.
   Literal local url is intentional: startup manifest discovers and preloads it. */
#secret-cue{position:absolute;z-index:2;left:0;top:0;width:min(360px,calc(100% - 190px));height:100%;max-height:88px;pointer-events:none;user-select:none;background:var(--indigo) url('./assets/hud/elevator-manga-cut-in.webp') left center/contain no-repeat;contain:paint;isolation:isolate}
#secret-cue[hidden]{display:none}
#game[data-secret-cue="active"] .match-brand{visibility:hidden}
@media(max-width:900px){#secret-cue{left:12px;width:calc(100% - 175px);max-height:64px}}
@media(max-width:360px){#secret-cue{left:8px;width:calc(100% - 145px)}}
@media(prefers-reduced-motion:reduce){#secret-cue{transform:none!important}}
/* At contact give the illustration, score and settings separate columns.
   A negative or over-wide absolute overlay must never cover either control.
   The original (hidden) brand still determines the row's natural height. */
#game[data-secret-cue="active"] .match-header{display:grid;grid-template-columns:minmax(0,1fr) auto auto;grid-template-rows:auto}
#game[data-secret-cue="active"] .match-brand{grid-area:1/1;min-width:0}
#game[data-secret-cue="active"] #secret-cue{position:relative;inset:auto;grid-area:1/1;width:100%;max-width:340px;height:100%;max-height:88px;background-color:transparent}
#game[data-secret-cue="active"] .score{grid-area:1/2}
#game[data-secret-cue="active"] .tools{grid-area:1/3;margin-left:0}
/* Opportunity uses the existing instruction line, not the football hit area. */
#special-chance{display:inline-block;padding:0 5px;border-radius:3px;background:#ffd05e20;color:#ffe29a;font-weight:800;white-space:nowrap;pointer-events:none}
#special-chance[hidden],#strike-help[hidden]{display:none}
#special-chance.chance-entry{animation:chance-glow .65s ease-in-out 2}
@keyframes chance-glow{0%,100%{background-color:#ffd05e20;color:#ffe29a}50%{background-color:#ffd05e48;color:#fff3ce}}
@media(prefers-reduced-motion:reduce){#special-chance.chance-entry{animation:none}}
