/* Instrument layout: clear arena center, phase above, player telemetry below.
   Scene 0; match instruments 2; event feedback 3; menu panels 4. */
:root{--surface:#0c1520;--subtle:#7f919f;--gold:#e5c58a;--ease:cubic-bezier(.2,.8,.2,1)}
body{min-height:100dvh}
button{transition:background .18s,color .18s,border-color .18s,transform .18s}
button:active:enabled{transform:translateY(1px)!important}
button:disabled{opacity:.55}
input[aria-invalid=true]{border-color:var(--pink)}
header{pointer-events:none}header a{pointer-events:auto}
.brand-mark{opacity:.85}.edition{letter-spacing:1.5px}
.session{padding:9px 12px;border:1px solid var(--line);background:#080d1580}
#settings{gap:20px}#settings button{min-height:36px}
#settings select{min-height:36px;cursor:pointer}
#connection{letter-spacing:.06em}
.landing{overflow-y:auto;scrollbar-width:thin;scrollbar-color:var(--line) transparent}
.landing .text-button{align-self:flex-start;border:0;color:var(--ink);padding:8px 0}
.landing .text-button span{color:var(--mint)}
.entry-controls .actions{gap:16px}
.panel.modal{border:1px solid #42535f;border-top:2px solid var(--mint);padding:36px;width:470px;background:linear-gradient(135deg,#14212df5,#0a121dfc 65%);box-shadow:0 32px 100px #020712a6}
.panel.modal::before{content:'';position:absolute;top:10px;right:10px;width:6px;height:6px;border-top:1px solid var(--mint);border-right:1px solid var(--mint);pointer-events:none}
.modal .eyebrow{font-size:10px;letter-spacing:.18em}
.modal h2{font-size:58px;letter-spacing:-.8px;margin:20px 0 12px;line-height:.97}
.modal .muted{margin:0;color:#b2bfca}
.room-code-block{display:flex;align-items:center;justify-content:space-between;border-block:1px solid var(--line);margin:24px 0 8px;padding:12px 0}
.room-code-block small{font-size:10px;color:var(--muted);letter-spacing:.14em}
.room-code{padding:0;margin:0;border:0;font-size:44px;letter-spacing:.2em;line-height:1}
#players{margin:0 0 24px}#players li{font-size:14px;min-height:52px}
#players li>span:last-child{font-family:inherit;font-size:10px;letter-spacing:.08em;color:var(--muted)}
#players li[data-ready=true]>span:last-child{color:var(--mint)}
.bot-settings{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px 12px;align-items:end;border-block:1px solid var(--line);padding:16px 0;margin:16px 0}
.bot-settings .field{margin:0}.bot-settings input{min-width:0}.bot-settings button{min-height:42px}
.bot-settings p{grid-column:1/-1;margin:0;font-size:10px}
#bot-summary{margin:12px 0;font-size:11px}
#players li[data-ready=true]>span:last-child::before{content:'';display:inline-block;width:5px;height:5px;margin-right:7px;background:var(--mint)}
.roster-name{min-width:0;overflow-wrap:anywhere}.seat-number{font-family:inherit}
.modal .actions{grid-template-columns:1fr 1.2fr}.modal .actions .secondary{border:1px solid var(--line);padding:10px 14px}
.watch-details{border-bottom:1px solid var(--line);padding:0 0 16px;margin-top:22px}.watch-details summary{padding:4px 0;color:var(--muted)}
.modal .control-hint{margin-top:20px;color:var(--muted)}
#results h2{font-size:58px}#reason{color:#b2bfca}
.result-summary{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));border-block:1px solid var(--line);margin:24px 0 12px;padding:18px 0}
.result-summary>div{display:flex;flex-direction:column;gap:7px;padding-left:20px;border-left:1px solid var(--line)}
.result-summary>div:first-child{border:0;padding:0}
.result-summary small{font-size:9px;letter-spacing:.1em;color:var(--muted)}
.result-summary strong{font-size:30px;font-weight:500;font-variant-numeric:tabular-nums;letter-spacing:-1px}
.standing{grid-template-columns:24px minmax(0,1fr) auto}.standing>span:nth-child(2){overflow-wrap:anywhere}
.standing.is-winner{background:#b7e9d708}.standing-score{font-size:11px!important;white-space:nowrap}
#match-hud{position:fixed;inset:0;transform:none;width:auto;padding:0;border:0;background:none;z-index:2;pointer-events:none;font-variant-numeric:tabular-nums}
body[data-screen=playing] header{height:68px;padding:0 28px;background:linear-gradient(#080d15bb,transparent)}
body[data-screen=playing] .brand{font-size:11px;letter-spacing:2px}
body[data-screen=playing] .edition,body[data-screen=playing] .session{display:none}
body[data-screen=playing] #settings{right:28px;bottom:18px;font-size:10px;gap:16px}
body[data-screen=playing] #settings button,body[data-screen=playing] #settings select{font-size:10px}
body[data-screen=playing] #status{top:auto;bottom:181px;left:50%;transform:translateX(-50%);max-width:600px;width:max-content;text-align:center;padding:6px 12px;background:#080d15e8;border:1px solid var(--line);font-size:11px}
body[data-screen=playing] #status[data-context=phase]{display:none}
body[data-screen=playing] #leave{top:22px;right:28px;padding:9px 14px;min-height:36px;background:#080d1580;font-size:11px}
body[data-screen=playing] #help{left:28px;bottom:28px;font-size:9px;letter-spacing:.06em}
body[data-screen=playing][data-watching=true] #help{display:none}
body[data-screen=playing] .vignette{background:linear-gradient(0deg,#080d15db,transparent 25%,transparent 75%,#080d1577),radial-gradient(ellipse at center,transparent 55%,#050a1466)}
.phase-module{position:absolute;top:24px;left:50%;transform:translateX(-50%);width:360px}
.phase-meta{display:flex;justify-content:space-between;align-items:center;font-size:10px;letter-spacing:.15em;color:var(--muted)}
#recording-state{font-size:9px;color:var(--phase);display:flex;align-items:center;gap:7px}
#recording-state::before{content:'';width:5px;height:5px;background:currentColor;border-radius:50%}
.phase-display{display:flex;align-items:baseline;justify-content:space-between;margin:6px 0 9px;color:var(--phase)}
#phase-name{font-family:'Barlow Condensed',Impact,sans-serif;font-size:44px;font-weight:700;letter-spacing:.025em;line-height:1}
#phase-timer{font-size:32px;letter-spacing:-1.3px;line-height:1}
#phase-timer small{font-size:9px;letter-spacing:.08em;margin-left:7px;color:var(--muted)}
#phase-progress{height:2px;margin:0;border-radius:0;background:#b7c7d324}
progress::-webkit-progress-bar{background:#b7c7d324}
progress::-webkit-progress-value{transition:none}
#phase-objective{font-size:11px;line-height:1.5;text-align:center;margin:10px -20px 0;color:#b6c3ce;text-shadow:0 1px 6px #080d15}
.field-intel{position:absolute;right:28px;top:104px;width:218px;padding:0 0 12px;background:linear-gradient(90deg,transparent,#080d15a6)}
.intel-heading{display:flex;justify-content:space-between;align-items:center;border-bottom:1px solid var(--line);padding-bottom:12px;font-size:10px;letter-spacing:.1em;color:var(--muted)}
.intel-heading strong{font-size:9px;font-weight:500;color:var(--ink);letter-spacing:.02em}
#live-roster{margin:5px 0 0}
#live-roster li{display:grid;grid-template-columns:5px minmax(0,1fr) 24px 28px 24px;gap:8px;align-items:center;border:0;padding:9px 0;font-size:12px;min-height:35px}
.player-marker{height:12px;width:3px;background:var(--player-color,var(--mint))}
[data-pad="0"]{--player-color:#75ffe0}[data-pad="1"]{--player-color:#ffb86b}[data-pad="2"]{--player-color:#91a8ff}[data-pad="3"]{--player-color:#ff7fba}[data-pad="4"]{--player-color:#ffee9c}[data-pad="5"]{--player-color:#a3ff85}
.live-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#c5cfd6}
#live-roster li.is-you .live-name{color:var(--mint);font-weight:600}
#live-roster small{font-size:8px;color:var(--muted);letter-spacing:.06em}
#live-roster .roster-health{color:var(--player-color);font-size:12px;letter-spacing:-1px}
#live-roster b{font-size:12px;font-weight:500;text-align:right;color:var(--ink)}
#live-roster .is-out{opacity:.5}.is-out .player-marker{background:var(--muted)}
.echo-intel{display:flex;justify-content:space-between;border-top:1px solid var(--line);padding-top:12px;margin-top:4px;font-size:9px;letter-spacing:.08em}
#ghost-count{color:var(--muted)}#core-bonus{color:var(--gold)}
.pilot-console{position:absolute;bottom:65px;left:50%;transform:translateX(-50%);width:min(740px,calc(100vw - 64px));display:grid;grid-template-columns:1fr 1.25fr 1fr;background:linear-gradient(120deg,#101e29f5,#0b1421f0);border:1px solid #667c8a55;border-top-color:#859eab77;box-shadow:0 16px 40px #02081255}
.pilot-console::before,.pilot-console::after{content:'';position:absolute;top:-1px;width:20px;height:1px;background:var(--mint)}
.pilot-console::before{left:-1px}.pilot-console::after{right:-1px}
.pilot-console>section{min-width:0;padding:18px 22px;position:relative}
.pilot-console>section+section::before{content:'';position:absolute;left:0;top:18px;bottom:18px;width:1px;background:var(--line)}
.instrument-label,.pace-heading{display:flex;justify-content:space-between;gap:8px;font-family:inherit;font-size:10px;letter-spacing:.05em;color:var(--muted)}
#pilot-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}#health-count{white-space:nowrap;color:#c3d1d9;letter-spacing:0}
#hearts{display:flex;gap:5px;margin:15px 0 10px;height:12px;letter-spacing:0}
#hearts i{flex:1;background:var(--mint);transform:skewX(-16deg);border:1px solid var(--mint);transition:background .18s}
#hearts i.lost{background:#b7e9d70a;border-color:#b7c7d32e}
#integrity-state{display:block;font-size:10px;color:var(--muted);white-space:nowrap}
#match-hud[data-health="1"] #hearts i:not(.lost){background:var(--pink);border-color:var(--pink)}
#match-hud[data-health="1"] #integrity-state{color:var(--pink)}
.pace-heading{letter-spacing:.05em;font-size:10px}#pace-state{color:var(--muted);white-space:nowrap;font-size:9px;letter-spacing:.04em}
.pace-reading{display:flex;align-items:baseline;gap:6px;margin:5px 0 9px}
#pace-value{font-size:33px;font-weight:500;letter-spacing:-1.5px;line-height:1}
.pace-reading>span{font-size:11px;color:var(--muted)}
.pace-reading .pace-target{margin-left:auto;font-size:8px;letter-spacing:.05em;display:block}.pace-target b{font-size:11px;font-weight:500;color:var(--ink);margin-left:3px}
.pace-track{margin-top:0}#pace{height:4px;border-radius:0;background:#b7c7d324}
#pace::-webkit-progress-value{background:var(--mint)}#pace::-moz-progress-bar{background:var(--mint)}
#pace.low::-webkit-progress-value{background:var(--pink)}#pace.low::-moz-progress-bar{background:var(--pink)}
.target-tick{height:10px;top:-3px;background:var(--ink)}
#match-hud[data-pace=low] #pace-state{color:var(--pink)}
#match-hud[data-pace=safe] #pace-state{color:var(--mint)}
#match-hud[data-pace=idle] #pace-value{color:var(--muted)}
.score-module{display:flex;justify-content:space-between;gap:12px}
.score-module>div{display:flex;flex-direction:column;gap:9px}.score-module small{font-size:9px;letter-spacing:.03em;color:var(--muted);white-space:nowrap}
#score{font-size:30px;padding:0;line-height:1;font-weight:500;letter-spacing:-1px;color:var(--gold)}
#clock{font-size:24px;line-height:1.25;font-weight:500;letter-spacing:-1px}
#spectator{position:absolute;bottom:190px;left:50%;transform:translateX(-50%);margin:0;padding:9px 18px;background:#0c1520ed;border:1px solid var(--line);font:11px 'Space Grotesk',sans-serif;letter-spacing:.04em;white-space:nowrap;color:var(--ink)}
#notice{top:auto;bottom:198px;left:50%;transform:translateX(-50%);width:max-content;max-width:calc(100vw - 32px);margin:0;padding:10px 16px;background:#0b1521f2;border-left:2px solid var(--mint);font:12px 'Space Grotesk',sans-serif;letter-spacing:.07em;text-shadow:none}
#notice:empty{display:none}#notice[data-kind=orb]{color:var(--gold);border-color:var(--gold)}
body:not([data-screen=playing]) #notice{display:none}
#notice[data-kind=hit],#notice[data-kind=pace-hit],#notice[data-kind=death]{color:var(--pink);border-color:var(--pink)}
body[data-watching=true] #notice{bottom:235px}
#phase-announcement{top:28%;font-size:clamp(42px,6vw,78px);letter-spacing:.08em;text-shadow:0 4px 24px #080d15}
@keyframes announce{0%{opacity:0;transform:translateY(8px)}18%,55%{opacity:.95}100%{opacity:0;transform:translateY(-6px)}}
#jump{right:32px;bottom:83px;width:64px;height:64px;font-size:20px;background:#0e201fe6;border-color:#b7e9d777;z-index:3}
#jump span{font:9px 'Space Grotesk',sans-serif;letter-spacing:.1em}
#jump{display:none}
@media(any-pointer:coarse){#jump{display:block}}
#joystick{z-index:3;background:#0b1924a6;border-color:#b7e9d755}
#stick{background:#b7e9d733;border-color:#b7e9d799}
@media(min-width:1050px){body[data-screen=lobby] .modal,body[data-screen=results] .modal{left:7vw;transform:translateY(-50%);top:51%}}
@media(min-width:1600px){.phase-module{top:32px;width:400px}.pilot-console{bottom:72px;width:740px}.pilot-console>section{padding:23px 26px}.field-intel{right:40px;width:240px}}
@media(max-width:1050px) and (min-width:768px){.field-intel{width:170px;right:22px;top:100px}.phase-module{width:300px}.pilot-console{width:600px}.pilot-console>section{padding:16px}.score-module{gap:10px}#jump{right:20px;bottom:200px}.brand .edition{display:none}body[data-screen=playing] #help{font-size:8px}}
@media(max-width:767px){
  header{padding-inline:20px}.session{padding:6px 8px}.session #hud-room{font-size:9px}
  .panel.modal{width:min(440px,calc(100vw - 32px));padding:26px;max-height:calc(100dvh - 166px)}
  .modal h2,#results h2{font-size:48px}.result-summary{margin:20px 0 8px;padding:15px 0}.result-summary>div{padding-left:12px}.result-summary strong{font-size:27px}
  body[data-screen=playing] header{height:54px;padding:0 16px}.brand-mark{width:24px;height:24px}
  body[data-screen=playing] .brand{font-size:9px;letter-spacing:1.4px}
  body[data-screen=playing] #leave{top:12px;right:16px;padding:7px 10px;min-height:32px;font-size:10px}
  body[data-screen=playing] #settings{top:auto;bottom:max(8px,env(safe-area-inset-bottom));left:16px;right:16px;justify-content:flex-end;gap:14px}
  body[data-screen=playing] #settings #connection{margin-right:auto;font-size:9px}
  .phase-module{top:66px;width:calc(100% - 40px);max-width:420px}
  .phase-meta{font-size:9px}.phase-display{margin:7px 0 9px}#phase-name{font-size:38px}#phase-timer{font-size:29px}
  #phase-objective{font-size:10px;margin:8px 0 0}
  .field-intel{top:174px;right:20px;left:20px;width:auto;background:none;padding:0;display:flex;justify-content:space-between;gap:16px}
  .intel-heading{border:0;padding:0;font-size:8px;gap:10px}.intel-heading>span{display:none}.intel-heading strong{font-size:9px}
  #live-roster{display:none}.echo-intel{border:0;padding:0;margin:0;gap:15px;font-size:9px}
  .pilot-console{bottom:calc(158px + env(safe-area-inset-bottom));width:calc(100% - 32px);grid-template-columns:.95fr 1.2fr .8fr}
  .pilot-console>section{padding:13px 12px}.pilot-console>section+section::before{top:13px;bottom:13px}
  .instrument-label{font-size:9px;letter-spacing:0}#health-count{display:none}#hearts{margin:14px 0 10px;height:10px;gap:4px}
  #integrity-state{font-size:9px;white-space:normal;line-height:1.35}.pace-heading{font-size:9px;letter-spacing:0;flex-direction:column;align-items:flex-start;gap:4px}
  #pace-state{font-size:9px}#pace-value{font-size:29px}.pace-reading{margin:6px 0 9px;gap:4px}.pace-reading>span{font-size:10px}
  .pace-reading .pace-target{font-size:0}.pace-target b{font-size:9px;margin:0}
  .score-module{flex-direction:column;gap:9px}.score-module>div{flex-direction:column;align-items:flex-start;gap:3px}
  .score-module small{font-size:9px;letter-spacing:0;white-space:nowrap;line-height:1.3}#score{font-size:24px}#clock{font-size:18px;white-space:nowrap}
  #spectator{bottom:calc(270px + env(safe-area-inset-bottom));font-size:10px;padding:8px 12px;max-width:calc(100% - 32px);white-space:normal;width:max-content}
  #notice{bottom:calc(285px + env(safe-area-inset-bottom));font-size:10px;letter-spacing:.03em;padding:9px 12px}
  body[data-watching=true] #notice{bottom:calc(310px + env(safe-area-inset-bottom))}
  body[data-screen=playing] #status{bottom:calc(282px + env(safe-area-inset-bottom));max-width:calc(100% - 32px);font-size:10px}
  #phase-announcement{top:35%;font-size:46px}
  #joystick{width:100px;height:100px;left:24px;bottom:calc(43px + env(safe-area-inset-bottom))}
  #stick{left:30px;top:30px}#jump{width:70px;height:70px;right:26px;bottom:calc(58px + env(safe-area-inset-bottom))}
}
@media(max-width:380px){.pilot-console>section{padding:12px 9px}.pilot-console{grid-template-columns:.9fr 1.15fr .9fr}.phase-module{top:62px}.field-intel{top:165px}.landing{padding-right:12px}.actions{gap:8px}.primary,.secondary{font-size:12px}.modal h2,#results h2{font-size:42px}}
@media(max-height:540px) and (min-width:640px){
  body[data-screen=playing] header{height:48px}body[data-screen=playing] #leave{top:10px}
  .phase-module{top:14px;width:260px}#phase-name{font-size:30px}#phase-timer{font-size:24px}#phase-objective{font-size:9px;margin-top:6px}
  .field-intel{top:85px;right:20px;left:auto;width:150px;display:block}.intel-heading{padding-bottom:8px}.echo-intel{margin-top:8px}#live-roster{display:none}
  .pilot-console{bottom:42px;width:470px;grid-template-columns:1fr 1.2fr 1fr}.pilot-console>section{padding:10px 14px}#integrity-state{display:none}#hearts{margin-bottom:4px}.instrument-label,.pace-heading{font-size:8px}#pace-value{font-size:25px}.score-module small{font-size:7px}.score-module{flex-direction:row}#clock{font-size:20px}#score{font-size:25px}
  #joystick{width:86px;height:86px;left:20px;bottom:40px}#stick{left:23px;top:23px}#jump{right:20px;bottom:50px;width:60px;height:60px}
  #notice,body[data-watching=true] #notice{bottom:150px}#spectator{bottom:135px}body[data-screen=playing] #help{display:none}body[data-screen=playing] #settings{bottom:5px;top:auto;left:auto;right:20px}#phase-announcement{top:30%;font-size:42px}
  .panel.modal{max-height:calc(100dvh - 100px);padding:22px}.modal h2,#results h2{font-size:40px}
}
@media(prefers-reduced-motion:no-preference){
  body[data-phase=run] #recording-state::before{animation:recording 1.5s ease-in-out infinite}
  .damage-feedback::before{content:'';position:fixed;inset:0;pointer-events:none;z-index:3;box-shadow:inset 0 0 100px #ef86b755;animation:damage .55s ease-out both}
  .panel.modal:not([hidden]){animation:panel-enter .3s var(--ease) both}
  @keyframes recording{50%{opacity:.35}}
  @keyframes damage{from{opacity:1}to{opacity:0}}
  @keyframes panel-enter{from{opacity:0}to{opacity:1}}
}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important}}
@media(prefers-reduced-transparency:reduce){.pilot-console,.field-intel,.panel.modal,#notice,#spectator{background:var(--surface);backdrop-filter:none}}
