:root {
  --amber: #f2a65a;
  --amber-hi: #ffd29a;
  --amber-dim: #8a5a2b;
  --red: #ff3b2f;
  --term: #8dff8a;
  --term-dim: #3f8a3d;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: #000;
  color: var(--amber); font-family: 'VT323', 'Share Tech Mono', monospace;
  user-select: none; -webkit-user-select: none;
}
canvas#view { position: fixed; inset: 0; width: 100vw; height: 100vh; height: var(--app-h, 100vh); display: block; image-rendering: pixelated; cursor: none; }
.hidden { display: none !important; }

/* ---------------- HUD ---------------- */
#hud { position: fixed; inset: 0; pointer-events: none; font-size: 22px; text-shadow: 0 0 6px rgba(242,166,90,.55); }
#visor {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at center, transparent 62%, rgba(0,0,0,.35) 85%, rgba(0,0,0,.75) 100%);
}
/* stamina: a thin line above the inventory that only shows while it matters */
#stamina { position: absolute; left: 50%; bottom: 114px; width: 200px; height: 3px; margin-left: -100px; background: rgba(242,166,90,.12); opacity: 0; transition: opacity .7s; }
#stamina.show { opacity: .95; transition: opacity .15s; }
#stamina > div { height: 100%; width: 100%; margin: 0 auto; background: var(--amber); box-shadow: 0 0 6px var(--amber); transition: width .1s linear; }
#stamina.exhausted > div { background: #c8452f; box-shadow: 0 0 6px #c8452f; animation: pulse .4s infinite alternate; }
#weight { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); font-size: 16px; letter-spacing: 2px; opacity: .5; }
@keyframes pulse { from { opacity: 1; } to { opacity: .35; } }

#clock { position: absolute; top: 22px; left: 50%; transform: translateX(-50%); text-align: center; }
#clocktime { font-size: 40px; letter-spacing: 3px; line-height: 1; }
#clocksub { font-size: 18px; opacity: .7; letter-spacing: 2px; }
#clock.warn #clocktime { color: var(--red); text-shadow: 0 0 10px var(--red); animation: pulse .8s infinite alternate; }

#lobbycode { position: absolute; top: 22px; right: 30px; font-size: 20px; opacity: .8; text-align: right; }

#hold { position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%; opacity: 0; pointer-events: none; --p: 0; background: conic-gradient(var(--amber) calc(var(--p) * 1turn), rgba(242,166,90,.14) 0); -webkit-mask: radial-gradient(circle, transparent 11px, #000 12px); mask: radial-gradient(circle, transparent 11px, #000 12px); }
#hold.on { opacity: .75; }
#crosshair { position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px 0 0 -2px; background: var(--amber); opacity: .6; border-radius: 50%; box-shadow: 0 0 4px var(--amber); }
#prompt { position: absolute; left: 50%; top: calc(50% + 34px); transform: translateX(-50%); font-size: 26px; white-space: nowrap; text-align: center; }
#prompt .key { display: inline-block; border: 1px solid var(--amber); padding: 0 6px; margin-right: 6px; line-height: 22px; }
#prompt .val { color: var(--amber-hi); }
#prompt .warn { color: var(--red); }

#slots { position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; }
.slot { width: 74px; height: 74px; border: 2px solid var(--amber-dim); background: rgba(10,6,2,.35); position: relative; display: flex; align-items: center; justify-content: center; text-align: center; font-size: 16px; line-height: 15px; padding: 4px; color: var(--amber); }
.slot.sel { border-color: var(--amber); box-shadow: 0 0 12px rgba(242,166,90,.6), inset 0 0 12px rgba(242,166,90,.25); }
.slot .num { position: absolute; top: 1px; left: 4px; font-size: 14px; opacity: .6; }
.slot .bat { position: absolute; bottom: 3px; left: 6px; right: 6px; height: 3px; background: rgba(242,166,90,.2); }
.slot .bat > div { height: 100%; background: var(--amber); }
.slot .on { position: absolute; top: 3px; right: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--amber-hi); box-shadow: 0 0 6px var(--amber-hi); }
.slot svg { width: 40px; height: 40px; opacity: .9; }
.slot .nm { position: absolute; bottom: 7px; left: 2px; right: 2px; font-size: 13px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#iteminfo { position: absolute; bottom: 122px; left: 50%; transform: translateX(-50%); font-size: 22px; text-align: center; white-space: nowrap; }
/* a creature found by the scanner */
.slabel.mon { color: #ff4232; }
.slabel.mon .mk { border-width: 2px; box-shadow: 0 0 16px currentColor, inset 0 0 8px currentColor; }
.slabel.mon .tag b { letter-spacing: 3px; }

#notice { position: absolute; top: 26%; left: 0; right: 0; text-align: center; opacity: 0; transition: opacity .6s; }
#notice.show { opacity: 1; }
#noticetitle { font-size: 54px; letter-spacing: 6px; }
#noticesub { font-size: 26px; opacity: .85; letter-spacing: 2px; }
#notice.danger #noticetitle { color: var(--red); text-shadow: 0 0 14px var(--red); }

#toast { position: absolute; top: 70px; left: 50%; transform: translateX(-50%); font-size: 24px; opacity: 0; transition: opacity .3s; white-space: nowrap; }
#toast.show { opacity: 1; }

#scanring { position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; border: 2px solid rgba(242,166,90,.0); }
#scanring.go { animation: scan 0.9s ease-out; }
@keyframes scan { 0% { transform: scale(1); border-color: rgba(242,166,90,.9); } 100% { transform: scale(220); border-color: rgba(242,166,90,0); border-width: .1px; } }
#scanlabels { position: absolute; inset: 0; }
/* words in the air: speech over a head, radio calls over walkie-talkies; every letter bobs in turn */
#bubbles { position: absolute; inset: 0; pointer-events: none; }
.bubble { position: absolute; transform: translate(-50%, -100%); white-space: nowrap; transform-origin: 50% 100%; font: 24px "VT323", monospace; color: #f1e9d6; text-shadow: 0 0 6px rgba(0,0,0,.95), 0 0 2px #000; }
.bubble b { display: inline-block; font-weight: normal; padding: 2px 10px 4px; background: rgba(8,8,6,.5); border-radius: 9px; animation: bubblepop .45s cubic-bezier(.2,1.8,.4,1) both; }
.bubble b span { display: inline-block; animation: bubblebob 1s ease-in-out infinite; }
.bubble b i { font-style: normal; opacity: .75; }
.bubble.say b::after { content: ''; position: absolute; left: 50%; bottom: -7px; margin-left: -6px; border: 6px solid transparent; border-top-color: rgba(8,8,6,.5); border-bottom: 0; }
.bubble.say b { position: relative; }
.bubble.radio { color: #a8ff9c; text-shadow: 0 0 8px rgba(90,255,120,.65), 0 0 2px #000; }
.bubble.radio b { background: rgba(4,18,6,.6); border: 1px solid rgba(120,255,140,.35); animation: bubblepop .45s cubic-bezier(.2,1.8,.4,1) both, radiohiss .18s steps(2) infinite .45s; }
/* out of the walkie-talkie in your hand: a tail down to its speaker */
.bubble.hand b { position: relative; }
.bubble.hand b::after { content: ''; position: absolute; left: calc(50% + var(--tail, 0px)); bottom: -8px; margin-left: -6px; border: 6px solid transparent; border-top-color: rgba(120,255,140,.45); border-bottom: 0; }
.bubble.hand.stacked b::after { display: none; }
@keyframes bubblebob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes bubblepop { from { transform: scale(.2) translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes radiohiss { 50% { filter: brightness(1.25) blur(.3px); } }
/* scan markers: a diamond on the find, a thin stem rising from it, and a tag; anchored at the find itself */
.slabel { position: absolute; width: 0; height: 0; color: #ffb45e; transition: opacity .4s; }
.slabel .mk { position: absolute; left: -8px; top: -8px; width: 16px; height: 16px; border: 1.5px solid currentColor; transform: rotate(45deg); box-shadow: 0 0 10px currentColor, inset 0 0 6px currentColor; }
.slabel .mk::after { content: ''; position: absolute; left: 5px; top: 5px; width: 3px; height: 3px; background: currentColor; }
.slabel .stem { position: absolute; left: 0; bottom: 10px; width: 1px; height: 44px; background: linear-gradient(to top, currentColor, rgba(0,0,0,0)); opacity: .85; }
.slabel .tag { position: absolute; left: 7px; bottom: 46px; padding: 1px 0 1px 7px; border-left: 1px solid currentColor; white-space: nowrap; font-size: 17px; line-height: 16px; text-shadow: 0 0 6px rgba(0,0,0,.9), 0 0 10px currentColor; }
.slabel .tag b { display: block; font-weight: normal; letter-spacing: 2px; }
.slabel .tag .v { color: #ffe3a0; margin-right: 8px; }
.slabel .tag .s { opacity: .65; font-size: 15px; }
.slabel.rich { color: #ffe08a; }
.slabel.rich .mk { width: 20px; height: 20px; left: -10px; top: -10px; outline: 1px solid currentColor; outline-offset: 3px; }
.slabel.big { color: #d8f4ff; }
.slabel.big .mk { transform: none; border-radius: 0; }
.slabel.dead { color: rgba(170, 160, 150, .75); }
.slabel.dead .mk { border-style: dotted; transform: none; }
.slabel.dead .tag b { text-decoration: line-through; text-decoration-thickness: 2px; }
.slabel.player { color: #9be8ff; }
.slabel.player .mk { border-radius: 50%; transform: none; }
.slabel.sig { color: rgba(150, 215, 255, .8); }
.slabel.sig .mk { border-style: dashed; border-radius: 50%; transform: none; animation: sigpulse 1.1s ease-in-out infinite; }
.slabel.sig .stem { height: 22px; }
.slabel.sig .tag { bottom: 24px; }
.slabel.pop .mk, .slabel.pop .stem, .slabel.pop .tag { animation: spop .5s steps(7) both; }
.slabel.pop.sig .mk { animation: spop .5s steps(7) both, sigpulse 1.1s ease-in-out .5s infinite; }
@keyframes spop { 0% { opacity: 0; transform: scale(2.4) rotate(45deg); } 25% { opacity: 1; } 45% { opacity: .25; } 70% { opacity: 1; } 100% { opacity: 1; } }
.slabel.pop .stem, .slabel.pop .tag { animation-name: spop2; }
@keyframes spop2 { 0% { opacity: 0; clip-path: inset(100% 0 0 0); } 40% { opacity: 1; } 60% { opacity: .3; } 100% { opacity: 1; clip-path: inset(0 0 0 0); } }
@keyframes sigpulse { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }

#chat { position: absolute; left: 30px; bottom: 140px; width: 420px; font-size: 20px; }
#chatlog { display: flex; flex-direction: column; gap: 2px; }
#chatlog .msg { background: rgba(0,0,0,.35); padding: 1px 6px; transition: opacity 1s; }
#chatlog .msg.radio { color: #b6ffb0; text-shadow: 0 0 6px rgba(140,255,140,.5); }
#chatlog .msg.sys { color: var(--amber-hi); opacity: .9; }
#chatlog .msg.fade { opacity: 0; }
#chatinput { display: none; width: 100%; margin-top: 4px; background: rgba(0,0,0,.6); border: 1px solid var(--amber); color: var(--amber-hi); font-family: inherit; font-size: 20px; padding: 3px 6px; outline: none; pointer-events: auto; }
#chat.open #chatinput { display: block; }
#chat.open #chatlog .msg { opacity: 1 !important; }

#tracker { position: absolute; right: 34px; bottom: 34px; width: 180px; height: 180px; display: none; }
#tracker.on { display: block; }

#struggle { position: absolute; left: 50%; top: 62%; transform: translateX(-50%); font-size: 30px; color: var(--red); text-shadow: 0 0 10px var(--red); display: none; text-align: center; }
#struggle.on { display: block; animation: pulse .35s infinite alternate; }
#spectate { position: absolute; bottom: 40px; left: 0; right: 0; text-align: center; font-size: 26px; display: none; }
#spectate.on { display: block; }
/* letterbox for the send-off (the view flies out to watch the ship leave): the play HUD steps aside */
#bars i { position: fixed; left: 0; right: 0; height: 0; background: #000; transition: height .9s ease; z-index: 5; }
#bars i:first-child { top: 0; } #bars i:last-child { bottom: calc(100% - var(--app-h, 100%)); }
#bars.on i { height: 11vh; }
#hud.cine #crosshair, #hud.cine #hold, #hud.cine #slots, #hud.cine #stamina, #hud.cine #weight, #hud.cine #prompt, #hud.cine #iteminfo, #hud.cine #visor, #hud.cine #tracker { opacity: 0; transition: opacity .4s; }
#voiceind { position: absolute; left: 30px; bottom: 110px; font-size: 18px; color: #b6ffb0; }
/* driving the rover: you're looking down its camera (scanlines, the corners of the frame, its readout) */
#rovercam { position: fixed; inset: 0; pointer-events: none; z-index: 4; color: #b8ffc4; text-shadow: 0 0 6px rgba(120,255,150,.55); font-size: 22px; letter-spacing: 1px;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.16) 0 1px, transparent 1px 3px), radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.55) 100%); }
#rovercam::before, #rovercam::after { content: ''; position: absolute; left: 4vw; right: 4vw; top: 5vh; bottom: 5vh; border: 2px solid rgba(184,255,196,.5); }
#rovercam::after { left: 50%; top: 50%; right: auto; bottom: auto; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-width: 1px; border-color: rgba(184,255,196,.35); }
#rovercam::before { -webkit-mask: linear-gradient(#000 0 0) top left / 40px 40px no-repeat, linear-gradient(#000 0 0) top right / 40px 40px no-repeat, linear-gradient(#000 0 0) bottom left / 40px 40px no-repeat, linear-gradient(#000 0 0) bottom right / 40px 40px no-repeat;
  mask: linear-gradient(#000 0 0) top left / 40px 40px no-repeat, linear-gradient(#000 0 0) top right / 40px 40px no-repeat, linear-gradient(#000 0 0) bottom left / 40px 40px no-repeat, linear-gradient(#000 0 0) bottom right / 40px 40px no-repeat; }
#rovercam .rc-tag { position: absolute; left: calc(4vw + 16px); top: calc(5vh + 10px); }
#rovercam .rc-rec { position: absolute; right: calc(4vw + 16px); top: calc(5vh + 10px); color: #ff7060; text-shadow: 0 0 6px rgba(255,80,60,.6); animation: rcblink 1s steps(1) infinite; }
#rovercam .rc-hint { position: absolute; left: 0; right: 0; bottom: calc(5vh + 10px); text-align: center; font-size: 18px; opacity: .6; }
body.touch #rovercam .rc-hint { display: none; }
#hud.rc #clock { opacity: 0; }
@keyframes rcblink { 50% { opacity: 0; } }

/* --------------- TERMINAL ---------------- */
#terminal { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(0,0,0,.55); z-index: 20; }
#term-bezel { width: min(880px, 94vw); height: min(620px, 82vh); padding: 26px; background: linear-gradient(#1b1d1a, #0d0e0c); border-radius: 18px; box-shadow: 0 0 0 2px #2a2c27, 0 30px 80px #000, inset 0 0 30px #000; }
#term-screen { position: relative; width: 100%; height: 100%; border-radius: 12px; background: radial-gradient(ellipse at center, #071a08 0%, #020802 90%); color: var(--term); text-shadow: 0 0 6px rgba(120,255,120,.6); font-size: 23px; padding: 18px 22px; display: flex; flex-direction: column; overflow: hidden; }
#term-screen::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(0,0,0,.22) 0 2px, transparent 2px 4px); border-radius: 12px; box-shadow: inset 0 0 60px rgba(0,0,0,.9); }
#term-head { display: flex; align-items: center; gap: 16px; padding-bottom: 6px; border-bottom: 1px solid rgba(120,255,120,.25); font-size: 20px; }
#term-title { color: #e2ffdf; letter-spacing: 2px; }
#term-stats { flex: 1; text-align: right; color: var(--term-dim); text-shadow: none; letter-spacing: 1px; }
#term-exit { font-family: inherit; font-size: 20px; background: transparent; color: #ff8a7a; border: 1px solid rgba(255,120,100,.5); padding: 0 8px; cursor: pointer; text-shadow: 0 0 6px rgba(255,90,70,.5); }
#term-exit:hover { background: rgba(255,120,100,.15); }
#term-bar { display: flex; flex-wrap: wrap; gap: 6px 10px; padding: 8px 0; border-bottom: 1px solid rgba(120,255,120,.15); margin-bottom: 8px; }
#term-bar button { font-family: inherit; font-size: 20px; background: rgba(120,255,120,.06); color: var(--term); border: 1px solid rgba(120,255,120,.35); padding: 0 10px; cursor: pointer; text-shadow: inherit; }
#term-bar button:hover, #term-bar button.on { background: rgba(120,255,120,.2); color: #e2ffdf; }
#term-out { flex: 1; overflow-y: auto; white-space: pre-wrap; scrollbar-width: thin; scrollbar-color: rgba(120,255,120,.5) transparent; animation: flick 4s infinite; }
#term-out::-webkit-scrollbar { width: 6px; }
#term-out::-webkit-scrollbar-thumb { background: rgba(120,255,120,.45); }
#term-out > div.rv { opacity: 0; animation: lineIn .12s forwards; }
#term-out .echo { color: var(--term-dim); text-shadow: none; margin-bottom: 4px; }
#term-out .cmd { cursor: pointer; }
#term-out .cmd.btn { border: 1px solid rgba(120,255,120,.4); padding: 0 4px; }
#term-out .cmd:not(.btn) { text-decoration: underline dotted; text-underline-offset: 4px; }
#term-out .cmd:hover { color: #d9ffd6; background: rgba(120,255,120,.18); }
#term-out .dim { color: var(--term-dim); text-shadow: none; }
#term-out .bad { color: #ff7b6b; text-shadow: 0 0 6px rgba(255,90,70,.6); }
#term-out .hi { color: #e2ffdf; }
#term-more { position: absolute; right: 28px; bottom: 52px; font-size: 17px; color: var(--term-dim); opacity: 0; transition: opacity .3s; pointer-events: none; animation: pulse .8s infinite alternate; }
#term-more.on { opacity: 1; }
#term-line { display: flex; gap: 8px; align-items: center; border-top: 1px solid rgba(120,255,120,.15); padding-top: 6px; }
#term-input { flex: 1; background: transparent; border: none; outline: none; color: var(--term); font-family: inherit; font-size: 23px; text-shadow: inherit; caret-color: var(--term); text-transform: uppercase; }
#term-input::placeholder { color: var(--term-dim); text-transform: none; opacity: .6; }
#term-hint { margin-top: 12px; color: #6f6f6f; font-size: 18px; letter-spacing: 2px; }
#term-screen.boot { animation: crtOn .5s ease-out; }
#term-screen.tear #term-out { transform: translateX(7px) skewX(-4deg); filter: brightness(1.5) blur(.4px); }
#term-screen.tear::before { content: ''; position: absolute; left: 0; right: 0; top: var(--tear, 40%); height: 9px; background: rgba(170,255,170,.16); z-index: 2; }
@keyframes crtOn { 0% { transform: scale(1, .006); filter: brightness(4); } 45% { transform: scale(1, .006); filter: brightness(3); } 70% { transform: scale(1, 1.02); filter: brightness(1.6); } 100% { transform: none; filter: none; } }
@keyframes lineIn { from { opacity: 0; transform: translateX(-4px); } to { opacity: 1; transform: none; } }
@keyframes flick { 0%, 100% { opacity: 1; } 46% { opacity: 1; } 47% { opacity: .82; } 48% { opacity: 1; } 71% { opacity: .93; } 72% { opacity: 1; } }

/* --------------- SUMMARY ---------------- */
#summary { position: fixed; inset: 0; z-index: 15; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.72); pointer-events: auto; }
#summary .panel { width: min(640px, 92vw); border: 2px solid var(--amber); padding: 26px 34px; background: rgba(12,7,2,.92); box-shadow: 0 0 40px rgba(242,166,90,.25); font-size: 24px; }
#summary h2 { margin: 0 0 4px; font-weight: normal; font-size: 40px; letter-spacing: 4px; }
#summary .sub { opacity: .7; margin-bottom: 16px; }
#summary .row { display: flex; justify-content: space-between; border-bottom: 1px dashed rgba(242,166,90,.25); padding: 3px 0; }
#summary .grade { font-size: 96px; text-align: center; line-height: 1; margin: 10px 0 0; text-shadow: 0 0 20px var(--amber); }
#summary .dead { color: var(--red); }
#summary .btn { margin-top: 18px; }

/* --------------- MENUS ---------------- */
#menu { position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; padding-left: 9vw; background: linear-gradient(90deg, rgba(0,0,0,.82) 0%, rgba(0,0,0,.45) 45%, rgba(0,0,0,0) 75%); }
#title h1 { margin: 0; font-weight: normal; font-size: clamp(54px, 8vw, 112px); letter-spacing: 8px; color: #e8dccb; text-shadow: 0 0 18px rgba(255,80,40,.35); position: relative; line-height: .9; }
#tagline { font-size: 22px; letter-spacing: 5px; color: var(--amber-dim); margin: 10px 0 34px 4px; }
.glitch::before, .glitch::after { content: attr(data-text); position: absolute; left: 0; top: 0; width: 100%; overflow: hidden; }
.glitch::before { color: #ff2a2a; opacity: .6; animation: glitchA 5s infinite steps(1); }
.glitch::after { color: #2affd5; opacity: .35; animation: glitchB 7s infinite steps(1); }
@keyframes glitchA { 0%, 93%, 100% { transform: none; clip-path: inset(100% 0 0 0); } 94% { transform: translate(-4px, 1px); clip-path: inset(10% 0 60% 0); } 96% { transform: translate(5px, -2px); clip-path: inset(55% 0 20% 0); } 98% { transform: translate(-2px, 0); clip-path: inset(30% 0 45% 0); } }
@keyframes glitchB { 0%, 88%, 100% { transform: none; clip-path: inset(100% 0 0 0); } 89% { transform: translate(4px, 0); clip-path: inset(70% 0 5% 0); } 91% { transform: translate(-6px, 2px); clip-path: inset(5% 0 75% 0); } }
#menupanel { display: flex; flex-direction: column; gap: 6px; min-width: 360px; max-width: 520px; }
/* a screen too tall for the window splits into two columns side by side (and shrinks if it must: fitToScreen) */
#menupanel.cols, #pause .inner.cols, #summary .panel.cols { display: block; columns: 2; column-gap: 36px; max-width: none; width: min(88vw, 900px); }
#menupanel.cols > *, #pause .inner.cols > *, #summary .panel.cols > * { break-inside: avoid; }
#menupanel.cols > *, #pause .inner.cols > * { margin-bottom: 6px; }
#menupanel.cols .btn, #pause .inner.cols .btn { display: block; }
/* (settings rows, two to a screen, keep to their own column) */
.cols .setrow { gap: 8px; } .cols .setrow > span:first-child { flex: 1; min-width: 0; }
.cols .setrow input[type=range] { width: 84px; flex: none; } .cols .setrow .sv { width: 46px; flex: none; } .cols .setrow button { min-width: 0; width: 104px; flex: none; }
#menufoot { position: absolute; bottom: 22px; left: 9vw; font-size: 18px; letter-spacing: 3px; color: #5a4a3a; }
.btn { pointer-events: auto; background: transparent; border: none; color: #cdbfae; font-family: 'VT323', monospace; font-size: 32px; letter-spacing: 3px; text-align: left; padding: 4px 10px; cursor: pointer; position: relative; transition: color .15s, padding .15s; }
.btn:hover, .btn:focus-visible { color: var(--amber-hi); padding-left: 26px; outline: none; text-shadow: 0 0 10px rgba(242,166,90,.6); }
.btn:hover::before, .btn:focus-visible::before { content: '>'; position: absolute; left: 4px; }
.btn.small { font-size: 24px; }
.btnrow { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: -4px 0 2px -10px; }
.btnrow .btn { color: var(--amber-hi); }
.btn[disabled] { opacity: .35; cursor: default; }
.btn[disabled]:hover { padding-left: 10px; color: #cdbfae; }
.btn[disabled]:hover::before { content: none; }
.mtitle { font-size: 30px; letter-spacing: 4px; color: var(--amber); margin-bottom: 8px; }
.mtext { font-size: 22px; color: #b9ab99; line-height: 1.15; margin-bottom: 8px; max-width: 560px; }
.mtext b { color: var(--amber-hi); font-weight: normal; }
.field { display: flex; flex-direction: column; gap: 4px; margin: 6px 0 10px; }
.field label { font-size: 20px; color: var(--amber-dim); letter-spacing: 2px; }
.field input[type=text] { pointer-events: auto; background: rgba(0,0,0,.6); border: 1px solid var(--amber-dim); color: var(--amber-hi); font-family: 'VT323', monospace; font-size: 30px; padding: 4px 10px; outline: none; letter-spacing: 3px; width: 100%; user-select: text; -webkit-user-select: text; }
.field input[type=text]:focus { border-color: var(--amber); box-shadow: 0 0 10px rgba(242,166,90,.3); }
.field input[type=range] { pointer-events: auto; width: 100%; accent-color: var(--amber); }
.setrow { display: flex; justify-content: space-between; align-items: center; gap: 18px; font-size: 22px; color: #cdbfae; margin: 2px 0; }
.setrow input[type=range] { width: 200px; accent-color: var(--amber); pointer-events: auto; }
.setrow .sv { width: 120px; text-align: right; color: var(--amber-hi); }
.setrow button { pointer-events: auto; font-family: 'VT323', monospace; font-size: 22px; background: transparent; color: var(--amber-hi); border: 1px solid var(--amber-dim); padding: 0 10px; cursor: pointer; min-width: 150px; }
.err { color: var(--red); font-size: 22px; min-height: 24px; }
.code { font-size: 64px; letter-spacing: 12px; color: var(--amber-hi); text-shadow: 0 0 16px rgba(242,166,90,.6); }
.keys { display: grid; grid-template-columns: 150px 1fr; gap: 1px 14px; font-size: 21px; color: #b9ab99; margin-bottom: 12px; }
.keys span:nth-child(odd) { color: var(--amber-hi); }

#pause { position: fixed; inset: 0; z-index: 12; background: rgba(0,0,0,.72); display: flex; align-items: center; padding-left: 9vw; }
#pause .inner { display: flex; flex-direction: column; gap: 6px; min-width: 380px; max-width: 560px; }

#fade { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; z-index: 30; transition: opacity .35s; }
#clicktoplay { position: fixed; inset: 0; z-index: 11; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 26vh; font-size: 24px; letter-spacing: 6px; color: var(--amber); text-shadow: 0 0 10px rgba(242,166,90,.6); cursor: pointer; background: transparent; }
/* suit colour: a hue/saturation wheel, a brightness slider and the robot painted in it */
.suitpick { display: flex; gap: 18px; align-items: center; margin: 4px 0 6px; pointer-events: auto; }
.suitpick canvas { width: 168px; height: 168px; cursor: crosshair; touch-action: none; border-radius: 50%; box-shadow: 0 0 0 2px rgba(242,166,90,.25), 0 0 18px rgba(0,0,0,.6); }
.suitside { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.suitprev { width: 96px; height: 96px; image-rendering: pixelated; border: 2px solid rgba(242,166,90,.25); background: rgba(0,0,0,.45); }
.suitval { width: 120px; accent-color: var(--amber); cursor: pointer; }
.suithex { font-size: 16px; letter-spacing: 2px; color: #b9ab99; display: flex; align-items: center; gap: 6px; }
.suithex i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; }
#clicktoplay div { animation: pulse 1s infinite alternate; }
#loading { position: fixed; inset: 0; z-index: 40; background: #000; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 30px; letter-spacing: 6px; color: var(--amber); }
#loaderr { color: var(--red); font-size: 22px; margin-top: 16px; letter-spacing: 1px; max-width: 80vw; text-align: center; }
.blink { animation: blink 1s infinite steps(1); }
@keyframes blink { 50% { opacity: 0; } }

/* --------------- TOUCH ---------------- */
/* a thumbstick that appears under the left thumb, buttons under the right; the hotbar takes taps */
body.touch canvas#view { cursor: default; touch-action: none; }
body.touch { -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
#touch { position: fixed; inset: 0; z-index: 8; display: none; touch-action: none; }
#touch.on { display: block; }
#touch .tpad { position: absolute; inset: 0; touch-action: none; }
.tstick { position: absolute; left: calc(92px + env(safe-area-inset-left)); top: calc(100% - 92px); width: 92px; height: 92px; margin: -46px 0 0 -46px; border-radius: 50%; border: 2px solid rgba(242,166,90,.35); background: rgba(10,6,2,.18); pointer-events: none; opacity: .5; transition: opacity .2s; }
.tstick.live { opacity: 1; }
.tstick.sprint { border-color: var(--amber-hi); box-shadow: 0 0 16px rgba(242,166,90,.5); }
.tknob { position: absolute; left: 50%; top: 50%; width: 42px; height: 42px; margin: -21px 0 0 -21px; border-radius: 50%; background: rgba(242,166,90,.3); border: 2px solid rgba(242,166,90,.7); box-shadow: 0 0 10px rgba(242,166,90,.35); }
.tbtn { position: absolute; display: flex; align-items: center; justify-content: center; border-radius: 50%; border: 2px solid rgba(242,166,90,.55); background: rgba(10,6,2,.28); color: var(--amber); font-family: 'VT323', monospace; letter-spacing: 1px; text-shadow: 0 0 6px rgba(242,166,90,.55); touch-action: none; user-select: none; -webkit-user-select: none; }
.tbtn.box { border-radius: 12px; }
.tbtn.down { background: rgba(242,166,90,.35); color: #fff3e0; border-color: var(--amber-hi); }
.tbtn.on { background: rgba(242,166,90,.22); border-color: var(--amber-hi); }
.tbtn.ready { border-color: var(--amber-hi); color: var(--amber-hi); box-shadow: 0 0 14px rgba(242,166,90,.6), inset 0 0 10px rgba(242,166,90,.3); }
.ttop { position: absolute; top: calc(8px + env(safe-area-inset-top)); left: calc(10px + env(safe-area-inset-left)); display: flex; gap: 8px; }
.tbtn.small { position: relative; width: 46px; height: 34px; border-radius: 7px; font-size: 17px; }
.tbtn.talk { left: calc(22px + env(safe-area-inset-left)); bottom: 178px; width: 50px; height: 50px; font-size: 14px; color: #b6ffb0; border-color: rgba(140,255,140,.5); }
#touch.dead .tstick, #touch.dead .act:not([data-k=use]) { display: none; }
body.touch #chat { top: calc(60px + env(safe-area-inset-top)); bottom: auto; left: calc(12px + env(safe-area-inset-left)); }
body.touch #voiceind { bottom: auto; top: calc(60px + env(safe-area-inset-top)); left: auto; right: 20px; }
/* hold your phone sideways */
#rotate { position: fixed; inset: 0; z-index: 60; background: #000; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 22px; font-size: 24px; letter-spacing: 4px; color: var(--amber); text-align: center; padding: 20px; }
#rotate .ph { width: 46px; height: 80px; border: 3px solid var(--amber); border-radius: 8px; animation: turn 1.8s ease-in-out infinite; }
@keyframes turn { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
@media (orientation: portrait) and (max-width: 600px) { body.touch #rotate { display: flex; } }

/* --------------- SMALL SCREENS (a phone on its side) ---------------- */
@media (max-height: 520px) {
  #hud { font-size: 17px; }
  #clock { top: 8px; } #clocktime { font-size: 28px; } #clocksub { font-size: 14px; }
  #lobbycode { top: 8px; right: 14px; font-size: 15px; }
  .slot { width: 52px; height: 52px; font-size: 12px; line-height: 11px; }
  .slot svg { width: 28px; height: 28px; } .slot .nm { font-size: 10px; bottom: 5px; } .slot .num { font-size: 11px; }
  #slots { bottom: 10px; gap: 6px; }
  #stamina { bottom: 70px; } #iteminfo { bottom: 68px; font-size: 17px; } #weight { bottom: 0; font-size: 12px; }
  #prompt { font-size: 19px; top: calc(50% + 24px); } #prompt .key { line-height: 16px; }
  #noticetitle { font-size: 34px; letter-spacing: 4px; } #noticesub { font-size: 17px; }
  #toast { top: 46px; font-size: 18px; }
  #chat { width: 300px; font-size: 16px; } #chatinput { font-size: 18px; }
  #tracker { width: 120px; height: 120px; right: 16px; bottom: 16px; }
  #spectate { font-size: 19px; bottom: 76px; } #struggle { font-size: 22px; }
  .slabel .tag { font-size: 14px; } .bubble { font-size: 18px; }
  #menu { padding: 8px 0 8px 5vw; }
  #menu.sub #title { display: none; }
  #title h1 { font-size: 42px; letter-spacing: 5px; } #tagline { font-size: 13px; letter-spacing: 3px; margin: 4px 0 8px 2px; }
  #menupanel { min-width: 300px; padding-right: 8px; touch-action: pan-y; }
  #menufoot { display: none; }
  .btn { font-size: 24px; padding: 2px 10px; } .btn.small { font-size: 19px; }
  .mtitle { font-size: 22px; margin-bottom: 4px; } .mtext { font-size: 17px; }
  .field { margin: 2px 0 6px; } .field label { font-size: 15px; } .field input[type=text] { font-size: 22px; padding: 2px 8px; }
  .setrow { font-size: 17px; } .setrow input[type=range] { width: 140px; } .setrow .sv { width: 70px; } .setrow button { font-size: 17px; min-width: 110px; }
  .code { font-size: 40px; } .keys { grid-template-columns: 130px 1fr; font-size: 16px; }
  .suitpick canvas { width: 110px; height: 110px; } .suitprev { width: 64px; height: 64px; }
  #pause { padding-left: 5vw; } #pause .inner { min-width: 300px; touch-action: pan-y; padding: 8px 8px 8px 0; }
  #summary .panel { padding: 12px 20px; font-size: 17px; touch-action: pan-y; } #summary h2 { font-size: 27px; } #summary .grade { font-size: 56px; } #summary .sub { margin-bottom: 8px; }
  #term-bezel { width: 98vw; height: 96vh; padding: 8px; border-radius: 10px; }
  #term-screen { font-size: 17px; padding: 8px 10px; } #term-head { font-size: 15px; gap: 8px; } #term-exit { font-size: 17px; }
  #term-bar { gap: 4px 6px; padding: 4px 0; } #term-bar button { font-size: 16px; padding: 2px 8px; }
  #term-input { font-size: 17px; } #term-hint { display: none; } #term-more { bottom: 38px; font-size: 14px; }
}
/* every full-screen layer reaches the screen's true bottom edge, even where an iPhone home-screen app is told its window
   is shorter than it is (--app-h: see appSize in js/util.js) */
#hud, #rovercam, #terminal, #summary, #menu, #pause, #fade, #clicktoplay, #loading, #touch, #rotate { bottom: auto; height: var(--app-h, 100%); }
