:root{color-scheme:dark;font-family:system-ui,sans-serif;background:#101b23;color:#f5f1dc}*{box-sizing:border-box}main{max-width:1220px;margin:3vh auto;padding:20px}h1{font-size:3rem;margin-bottom:0}small{font-size:1rem;color:#b9c6cd}button,input{font:inherit;padding:10px;margin:5px;border-radius:6px;border:1px solid #83969e}input{width:9em}button{background:#e8b559;color:#13222d;cursor:pointer}button:disabled{opacity:.5;cursor:default}.accent{outline:3px solid #e8b559;background:#ffe0a0}a{color:#e8b559}.panel{padding:16px;background:#192a35;border:1px solid #3a5261;border-radius:10px;margin:12px 0}.lobby,.controls,form{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.layout{display:grid;grid-template-columns:minmax(0,2fr) minmax(0,1fr);gap:16px}canvas,video{width:100%;max-width:640px;aspect-ratio:4/3;background:#03070b;display:block}video{object-fit:contain}#status{padding:12px;background:#213b49}dl{display:flex;gap:20px;flex-wrap:wrap}dt{font-size:.8rem;color:#aec5d3}dd{margin:4px 0}pre{white-space:pre-wrap;font-size:.8rem}footer{padding:20px 0}[hidden]{display:none!important}@media(max-width:850px){.layout{grid-template-columns:1fr}main{padding:10px}}

.touch-pad{display:flex;gap:8px;margin:12px 0}.touch-pad button{touch-action:none;min-width:56px;min-height:50px;user-select:none}summary{cursor:pointer;padding:12px 0}video{touch-action:manipulation}

#healthHud{display:flex;gap:18px;flex-wrap:wrap;padding:12px 0}progress{accent-color:#6fc478;width:110px}.low progress{accent-color:#ef5555}.hurt{background:#7f3333}#matchEnd{padding:16px;background:#294453;border:2px solid #e8b559}
#mobileControls{display:flex;gap:16px;flex-wrap:wrap;margin:12px 0}#joystick,#lookPad{touch-action:none;user-select:none;border:2px solid #83969e;background:#213b49;position:relative}#joystick{width:120px;height:120px;border-radius:50%}#joystickKnob{width:38px;height:38px;background:#e8b559;border-radius:50%;position:absolute;left:39px;top:39px;pointer-events:none}#lookPad{width:180px;height:120px;padding:16px}#talkBtn{touch-action:none}#sensitivity{width:160px}#gameAudio,#voiceAudio{display:none}

button{touch-action:manipulation}

#viewport{position:relative;max-width:640px}#reticle{position:absolute;top:calc((100% - 144px)/2);left:50%;color:#fff;text-shadow:0 1px 2px #000;pointer-events:none;font-size:22px}#mobileTalkBtn{display:none}
@media(pointer:coarse){#mobileControls{position:absolute;bottom:8px;left:8px;right:8px;justify-content:space-between;margin:0;pointer-events:none}#mobileControls>*{pointer-events:auto;opacity:.8}#joystick{width:90px;height:90px}#joystickKnob{width:32px;height:32px;left:27px;top:27px}#lookPad{width:110px;height:90px;padding:8px;font-size:12px}#reticle{top:50%}#mobileTalkBtn{display:block;position:absolute;top:5px;right:5px;touch-action:none;opacity:.8}}

canvas,video{height:auto}

#rtcHistory{max-height:220px;overflow:auto}

/* The guest camera still renders for streaming, but the playing view gets the space. */
main{max-width:1500px}.layout{display:block}#viewport{max-width:1200px}#viewport canvas,#viewport video{max-width:none}#reticle{top:0;margin-top:37.5%;transform:translate(-50%,-50%)}

#viewport.binoculars::after{content:"";position:absolute;inset:0 0 auto;aspect-ratio:4/3;border:clamp(14px,5vw,65px) solid rgba(0,0,0,.85);border-radius:35%;pointer-events:none;box-shadow:inset 0 0 28px #000}

#connectionDetails{white-space:pre-line}
/* Keep engineering information available with ?dev=1, outside the game flow. */
html:not(.dev-mode) .dev-only{display:none!important}
#mobileControls,.touch-pad{display:none}
@media(pointer:coarse){#mobileControls{display:flex}.touch-pad{display:flex}}
#combatHud{position:absolute;top:10px;left:10px;right:10px;display:flex;justify-content:space-between;align-items:flex-start;gap:8px;pointer-events:none;color:#fff;font-size:14px;text-shadow:0 1px 3px #000}
#hudCannons,#hudAmmo{background:rgba(11,19,24,.82);border:1px solid rgba(233,221,187,.32);border-radius:6px;padding:6px 9px}
#hudCannons{display:flex;flex-direction:column;gap:3px}.hud-cannon{display:flex;align-items:center;gap:5px}.hud-cannon img{width:24px;height:18px}.hud-cannon progress{width:76px;height:8px}.hud-cannon.destroyed{opacity:.48}.hud-cannon.destroyed progress{accent-color:#db5953}
#hudAmmo{font-size:11px;letter-spacing:.08em}#hudAmmo strong{display:block;color:#f3c573;font-size:16px;letter-spacing:0}
#replayLabel{position:absolute;top:12%;left:50%;transform:translateX(-50%);padding:7px 12px;background:rgba(10,15,20,.82);color:#fff;font-weight:700;letter-spacing:.12em;pointer-events:none}
.help{margin:8px 0}.help p{max-width:80ch}@media(pointer:coarse){#combatHud{font-size:11px;top:5px;left:5px;right:5px}.hud-cannon img{width:19px;height:14px}.hud-cannon progress{width:48px}#hudAmmo strong{font-size:13px}}

#viewport.replaying #combatHud,#viewport.replaying #reticle,#viewport.replaying #mobileControls{visibility:hidden}

#viewport.outside-view #reticle{visibility:hidden}

#waitingGames{margin-top:18px}#waitingGames h2{font-size:1.1rem;margin:0 0 6px}#waitingGames .room-note{color:#c2d1d1;margin:6px 0;font-size:.9rem}#roomListStatus{color:#c2d1d1;margin:6px 0}#roomList{list-style:none;margin:0;padding:0;display:grid;gap:6px;max-width:620px}#roomList li{display:flex;align-items:center;justify-content:space-between;gap:12px;background:#213b49;border:1px solid #3a5261;border-radius:7px;padding:4px 8px 4px 12px}#roomList li span{overflow-wrap:anywhere}#roomList button{flex:none}

@font-face{font-family:'Kanon Display';src:url('/assets/fonts/HennyPenny-Regular.ttf') format('truetype');font-display:swap}
h1,h2{font-family:'Kanon Display',serif;font-weight:normal}

#hudStamina{font-size:11px}#sprintMeter{width:70px;height:8px}#jumpBtn,#sprintBtn{touch-action:none;align-self:flex-end;padding:8px}

#language{font:inherit;color:inherit;background:#293e4c;border:1px solid #83969e;border-radius:6px;padding:10px;margin:5px}


/* During a match, use the extra horizontal space on desktop for the lobby. */
@media (min-width:1100px) and (min-height:650px) and (pointer:fine){
  body.playing main{max-width:1650px;min-height:100vh;margin:0 auto;padding:12px 20px;display:grid;grid-template-columns:230px minmax(0,1fr);grid-template-rows:auto 1fr;column-gap:16px;align-items:start}
  body.playing main>header{grid-column:1;grid-row:1}
  body.playing main>header h1{font-size:2.25rem;margin:0}
  body.playing #lobbyPanel{grid-column:1;grid-row:2;margin:0;position:sticky;top:12px}
  body.playing #lobbyPanel .lobby{flex-direction:column;align-items:stretch;gap:4px}
  body.playing #lobbyPanel .lobby label{margin-top:5px}
  body.playing #lobbyPanel .lobby input,body.playing #lobbyPanel .lobby select,body.playing #lobbyPanel .lobby button{width:100%;margin:0}
  body.playing #lobbyPanel #create{display:none}
  body.playing #lobbyPanel #status{font-size:.9rem;line-height:1.4;overflow-wrap:anywhere}
  body.playing #gameLayout{grid-column:2;grid-row:1 / span 2;min-width:0}
  body.playing #gameLayout>.panel{margin:0;padding:12px}
  body.playing #screenTitle{margin:0 0 6px;font-size:1.35rem}
  body.playing #healthHud{padding:5px 0}
  body.playing #viewport{width:min(100%, 1200px, calc(133.333vh - 333px));max-width:100%}
  body.playing footer{grid-column:1 / -1}
}

#lobbyPresentation{max-width:900px;padding:10px;background:#192a35}
#lobbyCanvas{display:block;width:100%;max-width:none;height:auto;aspect-ratio:5/2;border-radius:6px;background:#91b1bf}
#lobbyMusic{margin:8px 0 0}
body.playing #lobbyPresentation{display:none}

.app-version{position:absolute;top:10px;right:16px;font:0.75rem system-ui,sans-serif;color:#9aabb2;letter-spacing:.02em}

/* Show the supplied artwork in the lobby while retaining a compact in-game title. */
#lobbyBanner{display:block;width:auto;height:auto;max-width:100%;max-height:min(32vh,320px);border-radius:8px}
body:not(.playing) header h1{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
body.playing #lobbyBanner{display:none}

@media (min-width:1100px) and (min-height:650px) and (pointer:fine){
  body.playing #lobbyPanel{max-height:calc(100vh - 24px);overflow-y:auto}
  body.playing #lobbyPanel #gameControls{margin-top:14px;padding-top:12px;border-top:1px solid #3a5261}
  body.playing #lobbyPanel #gameControls .controls{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:5px}
  body.playing #lobbyPanel #gameControls .controls button{min-width:0;width:100%;margin:0;padding:8px 4px;font-size:.82rem;line-height:1.2;overflow-wrap:anywhere}
  body.playing #lobbyPanel #interactBtn,body.playing #lobbyPanel #invertCannonBtn,body.playing #lobbyPanel #talkBtn{grid-column:1 / -1}
  body.playing #lobbyPanel #specialAmmoState,body.playing #lobbyPanel #voiceState{font-size:.8rem;line-height:1.35}
  body.playing #lobbyPanel .help summary{padding:6px 0}
}

/* Keep the lobby artwork and panels aligned at every viewport width. */
body:not(.playing) main{max-width:1000px}
body:not(.playing) #lobbyBanner{width:100%;max-width:100%;max-height:none}
body:not(.playing) #lobbyPresentation{max-width:none}

#matchHistory{min-width:0;margin-top:16px}
#matchHistory h2{font-size:1.1rem;margin:0 0 8px}
#historyStatus{color:#c2d1d1;font-size:.9rem;margin:6px 0}
#historyList{list-style:none;margin:0;padding:0;max-height:320px;overflow-y:auto}
#historyList li{display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);gap:8px;padding:5px 2px;border-bottom:1px solid #3a5261;font-size:.88rem}
.history-name{display:grid;grid-template-columns:1.4em minmax(0,1fr);overflow-wrap:anywhere}.history-trophy{white-space:nowrap}.history-vs{color:#aabdc5}
body.playing #matchHistory{display:none}
@media (min-width:700px){
  body:not(.playing) #lobbyPanel{display:grid;grid-template-columns:minmax(0,1fr) minmax(300px,380px);column-gap:20px;align-items:start}
  body:not(.playing) #lobbyPanel>.lobby{grid-column:1;grid-row:1}
  body:not(.playing) #waitingGames{grid-column:1;grid-row:2}
  body:not(.playing) #status{grid-column:1;grid-row:3}
  body:not(.playing) #matchHistory{grid-column:2;grid-row:1 / span 3;margin-top:0}
  body:not(.playing) #connectionStatus,body:not(.playing) #connectionHelp{grid-column:1 / -1}
}

.game-heading{display:flex;align-items:center;justify-content:space-between;gap:8px}
#fullscreenBtn{flex:none}
@media (pointer:coarse){
  body.playing main{margin:0 auto;padding:4px max(4px,env(safe-area-inset-right)) 8px max(4px,env(safe-area-inset-left))}
  body.playing main>header,body.playing .app-version{display:none}
  body.playing #lobbyPanel{margin:0 0 4px;padding:4px 8px}
  body.playing #lobbyPanel .lobby>label,body.playing #lobbyPanel #language,body.playing #lobbyPanel #playerName,body.playing #lobbyPanel #create,body.playing #lobbyPanel #status{display:none}
  body.playing #leave{margin:0;padding:6px 10px;font-size:.85rem}
  body.playing #gameLayout>.panel{margin:0;padding:6px}
  body.playing #screenTitle{font-size:1.05rem;margin:0}
  body.playing #fullscreenBtn{margin:0;padding:6px 10px;font-size:.85rem}
  body.playing #healthHud{padding:5px 0;gap:4px 12px;font-size:.8rem}
  body.playing #healthHud progress{width:65px}
  body.playing #viewport{width:min(100%,calc((100dvh - 210px) * 4 / 3));margin:0 auto}
  body.playing #gameControls>.controls:first-child{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:4px;margin-top:6px}
  body.playing #gameControls>.controls:first-child button{min-width:0;margin:0;padding:7px 3px;font-size:.72rem;line-height:1.15;overflow-wrap:anywhere}
  body.playing #interactBtn{grid-column:span 2}
  body.playing #invertCannonBtn{grid-column:span 2}
  body.playing #specialAmmoState{font-size:.75rem;margin:6px 0}
  body.playing #gameControls>.controls:last-child{gap:3px}
  body.playing #gameControls>.controls:last-child button{font-size:.75rem;padding:6px;margin:2px}
  body.playing #voiceState{font-size:.75rem}
  body.playing #mobileControls{gap:3px;bottom:4px;left:4px;right:4px;align-items:flex-end;flex-wrap:nowrap}
  body.playing #joystick{flex:none;width:clamp(58px,19vw,90px);height:clamp(58px,19vw,90px)}
  body.playing #joystickKnob{left:50%;top:50%;margin:-16px 0 0 -16px}
  body.playing #lookPad{flex:none;width:clamp(60px,21vw,110px);height:clamp(58px,19vw,90px);font-size:.65rem;padding:5px}
  body.playing #jumpBtn,body.playing #sprintBtn{padding:6px 4px;margin:0;font-size:.7rem}
}
@media (pointer:fine){#fullscreenBtn{display:none}}
@media (pointer:coarse) and (orientation:landscape){
  body.playing #viewport{width:min(100%,calc((100dvh - 245px) * 4 / 3))}
}

#dynamiteWarning{position:absolute;top:19%;left:50%;transform:translateX(-50%);padding:8px 14px;background:rgba(125,25,16,.93);color:#fff5df;font-weight:700;border:1px solid #ffba60;border-radius:5px;pointer-events:none;white-space:nowrap}

/* Make games waiting for an opponent easy to spot. */
#roomList li{border-color:#75c989;animation:waiting-glow 2s ease-in-out infinite alternate}
@keyframes waiting-glow{0%{box-shadow:0 0 5px rgba(91,220,120,.5);border-color:#75c989}50%{box-shadow:0 0 15px rgba(82,190,245,.8);border-color:#70c9ef}100%{box-shadow:0 0 12px rgba(201,135,245,.8);border-color:#c987f5}}
@media (prefers-reduced-motion:reduce){#roomList li{animation:none;box-shadow:0 0 8px rgba(91,220,120,.5)}}
.presentation-footer{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}.site-credit{margin-left:auto;text-align:right;color:#c2d1d1}.site-credit a{font-weight:700}#status:empty,#roomListStatus:empty{display:none}

.presentation-scene{position:relative}
.lobby-chat{position:absolute;right:12px;top:12px;bottom:12px;width:min(45%,420px);display:flex;flex-direction:column;gap:6px;padding:10px;border:1px solid rgba(214,231,232,.5);border-radius:8px;background:rgba(16,27,35,.74);color:#fff}
.lobby-chat h2{font-size:1rem;margin:0}
#chatMessages{flex:1;min-height:0;overflow-y:auto;overflow-wrap:anywhere;font-size:.9rem}
#chatMessages div{padding:3px 0}
#chatForm{display:flex;flex-wrap:nowrap;gap:4px}
#chatInput{width:100%;min-width:0;margin:0;padding:7px}
#chatForm button{margin:0;padding:7px}
.chat-label{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
@media(max-width:600px){.lobby-chat{right:5px;top:5px;bottom:5px;width:54%;padding:6px}.lobby-chat h2{font-size:.85rem}#chatMessages{font-size:.8rem}#chatInput,#chatForm button{font-size:.8rem;padding:5px}}

#lobbyPlayers{margin:0;color:#d7e8df;font-size:.78rem;max-height:3em;overflow-y:auto;overflow-wrap:anywhere}

#chatMessages time{margin-right:.4em;color:#c2d1d1;font-variant-numeric:tabular-nums}

/* Match chat stays available over either camera, including on touch screens. */
#quickChatOverlay{position:absolute;z-index:8;top:8px;right:8px;width:min(300px,calc(100% - 16px));font-size:.85rem}
#quickChatLog{max-height:7.5em;overflow:auto;pointer-events:none}
#quickChatLog p{margin:3px 0;padding:4px 7px;border-radius:5px;background:rgba(10,22,30,.86);overflow-wrap:anywhere}
#quickChat{margin-left:auto;width:max-content;max-width:100%;background:rgba(20,38,48,.94);border-radius:6px}
#quickChat summary{padding:7px 10px;list-style:none;cursor:pointer;color:#f8d68d;font-weight:700}
#quickChat summary::-webkit-details-marker{display:none}
#quickChat[open]{width:100%;border:1px solid #83969e}
.quick-chat-panel{padding:0 7px 7px}
#quickChatStatus{margin:2px 4px 5px;font-size:.8rem}
#quickChatPresets{display:flex;flex-wrap:wrap;gap:3px}
#quickChatPresets button,#quickChatForm button{padding:6px;margin:2px;font-size:.8rem}
#quickChatForm{display:flex;flex-wrap:nowrap;gap:3px}
#quickChatInput{min-width:0;width:100%;padding:6px;margin:2px}
