:root {
  --bg: #0d1012; --panel: #161b1e; --panel2: #1f272b; --line: #34424a;
  --text: #f1f6f4; --muted: #93a59e; --accent: #ffd23f; --accent2: #3ee08f; --danger: #ff5a5f; --blue: #58a6ff;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; background: var(--bg); color: var(--text); overflow: hidden;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-user-select: none; user-select: none; touch-action: none; overscroll-behavior: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
input { font: inherit; color: inherit; }
canvas#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
.h { font-weight: 900; font-style: italic; text-transform: uppercase; letter-spacing: .02em; }

/* ------------------------------------------------------------ screens */
.screen { position: fixed; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y;
  background: linear-gradient(180deg, rgba(13, 16, 18, .45), rgba(13, 16, 18, .8) 45%, rgba(13, 16, 18, .94)); }
#help, #camp, #mp { background: rgba(13, 16, 18, .9); }
.screen.overlay { background: rgba(8, 10, 12, .86); backdrop-filter: blur(3px); }
.wrap { max-width: 540px; margin: 0 auto; padding: calc(18px + var(--sat)) calc(14px + var(--sar)) calc(28px + var(--sab)) calc(14px + var(--sal)); display: flex; flex-direction: column; gap: 10px; }
.wrap.narrow { max-width: 380px; padding-top: 20vh; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 2px; }
.head .t { font-size: 26px; }
.card { background: rgba(22, 27, 30, .92); border: 1px solid #ffffff1c; border-radius: 14px; padding: 12px; box-shadow: 0 6px 20px #0006; text-align: left; }
.card p { font-size: 13px; line-height: 1.45; color: #d2ddd8; }
.card ul { padding-left: 18px; font-size: 13px; line-height: 1.5; color: #d2ddd8; display: flex; flex-direction: column; gap: 4px; }
.card b { color: #fff; }
.lbl { font-size: 10px; font-weight: 900; letter-spacing: .14em; color: var(--muted); text-transform: uppercase; margin-bottom: 8px; display: flex; justify-content: space-between; gap: 8px; }
.lbl .r { color: var(--accent); }
.mt { margin-top: 10px; }
.note { font-size: 12px; color: var(--muted); line-height: 1.4; }
.center { text-align: center; }
.row { display: flex; gap: 8px; align-items: center; }
.btn { padding: 9px 14px; border-radius: 11px; background: var(--panel2); border: 1px solid #ffffff22; font-weight: 800; font-size: 14px; }
.btn.ghost { background: transparent; }
.btn.strike { background: var(--accent); color: #2a1d00; border: 0; }
.go { min-height: 58px; border-radius: 16px; font-size: 24px; color: #2a1d00; background: linear-gradient(180deg, #ffe476, #ffd23f 55%, #e8b300); box-shadow: 0 5px 0 #8a6700, 0 10px 26px #ffd23f40; flex: 1; }
.go small { display: block; font: 900 9px/1.2 system-ui; letter-spacing: .12em; margin-top: 3px; color: #5a4200; font-style: normal; }
.go:active { transform: translateY(3px); box-shadow: 0 2px 0 #8a6700; }
.go:disabled { filter: grayscale(.8); }
.go2 { height: 50px; border-radius: 14px; font-size: 17px; background: var(--panel2); border: 1px solid #ffffff22; flex: 1; }
.btnrow { display: flex; gap: 8px; }
.foot { display: flex; justify-content: center; gap: 18px; margin-top: 4px; }
.link { color: var(--muted); font-size: 13px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.ggs-foot { text-align: center; font-size: 11px; } .ggs-foot a { color: #ffffff55; }
.waiting { text-align: center; font-size: 13px; color: var(--muted); font-weight: 700; padding: 8px; }
.mperr { background: #3a1418; border: 1px solid var(--danger); color: #ffd0d2; border-radius: 12px; padding: 10px 12px; font-size: 13px; font-weight: 700; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { flex: 1 1 auto; padding: 8px 10px; border-radius: 10px; background: var(--panel2); border: 1px solid #ffffff1a; font-size: 12px; font-weight: 800; }
.seg button.sel { background: var(--accent); color: #2a1d00; border-color: var(--accent); }
.seg button:disabled { opacity: .35; }

/* logo */
.logo { text-align: center; line-height: .86; margin: 14px 0 4px; }
.logo span { display: block; font-weight: 900; font-style: italic; letter-spacing: .04em; -webkit-text-stroke: 3px #070a0b; paint-order: stroke fill; }
.logo .l1 { font-size: 70px; color: var(--accent); text-shadow: 0 7px 0 #070a0b, 0 0 30px #ffd23f55; transform: rotate(-3deg); }
.logo .l2 { font-size: 44px; color: #fff; text-shadow: 0 6px 0 #070a0b; margin-top: 4px; }
.logo .l3 { margin-top: 12px; font-size: 11px; letter-spacing: .42em; color: #dfe9e4; -webkit-text-stroke: 0; text-shadow: 0 2px 0 #000; }
.tagline { text-align: center; font-size: 13px; font-weight: 800; color: #d9e6e0; text-shadow: 0 2px 6px #000; margin: 4px 0 6px; }
.tagline b { color: var(--accent); font-style: italic; }

/* menu */
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mode { position: relative; text-align: left; background: rgba(31, 39, 43, .94); border: 1px solid #ffffff14; border-radius: 12px; padding: 10px 11px 11px; }
.mode b { display: block; font-size: 17px; line-height: 1; }
.mode p { font-size: 11px; line-height: 1.3; font-weight: 700; color: #c3d0ca; margin-top: 4px; }
.mode.sel { border: 2px solid var(--accent); background: linear-gradient(160deg, #3a3315, #1f272b 70%); }
.settings { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.set { padding: 7px 10px; border-radius: 10px; background: rgba(31, 39, 43, .9); border: 1px solid #ffffff18; font-size: 12px; font-weight: 700; color: var(--muted); }
.set b { color: #fff; margin-left: 3px; }
.cloudline { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--muted); }
.cloudline b { color: #fff; }

/* campaign */
.theatres { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.th { padding: 8px 6px; border-radius: 11px; background: var(--panel2); border: 2px solid #050708; text-align: center; }
.th b { display: block; font: italic 900 12px/1.1 system-ui; text-transform: uppercase; }
.th small { display: block; font-size: 10px; font-weight: 800; color: var(--accent); margin-top: 3px; }
.th.sel { border-color: var(--accent); box-shadow: 0 0 0 2px #ffd23f44; }
.th.lock { opacity: .4; }
.sorties { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.so { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 11px; background: #0f1416; border: 1px solid #ffffff14; text-align: left; }
.so .n { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font: italic 900 12px/1 system-ui; background: #283236; }
.so b { display: block; font: italic 900 14px/1.1 system-ui; text-transform: uppercase; }
.so small { display: block; font-size: 10px; font-weight: 800; letter-spacing: .1em; color: var(--muted); margin-top: 2px; }
.so .st { color: var(--accent); font-size: 15px; letter-spacing: 2px; }
.so .st i { font-style: normal; color: #ffffff22; }
.so.sel { border: 2px solid var(--accent); background: #262511; }
.so.sel .n { background: var(--accent); color: #2a1d00; }
.so.lock { opacity: .4; }
.brn { display: block; font-size: 22px; margin-bottom: 4px; }

/* crew room */
.inp { flex: 1; padding: 10px 12px; border-radius: 11px; background: #0b0f10; border: 1px solid #ffffff2a; font-size: 18px; font-weight: 900; letter-spacing: .3em; text-transform: uppercase; }
.roomcode { font-size: 46px; letter-spacing: .14em; color: var(--accent); text-shadow: 0 3px 0 #000; }
.stations { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.sta { position: relative; min-height: 66px; border-radius: 12px; background: linear-gradient(180deg, #222c30, #151b1e); border: 2px solid #050708; padding: 8px 9px 8px 54px; text-align: left; box-shadow: inset 0 1px 0 #ffffff14; }
.sta canvas { position: absolute; left: 4px; top: 50%; transform: translateY(-50%); width: 46px; height: 54px; }
.sta .rn { display: block; font: italic 900 13px/1 system-ui; text-transform: uppercase; }
.sta .rd { display: block; font-size: 10px; font-weight: 700; color: #aebdb7; margin-top: 3px; line-height: 1.25; }
.sta .who { position: absolute; right: 6px; top: -8px; font: italic 900 9.5px/1 system-ui; padding: 2px 5px; border-radius: 4px; border: 1.5px solid #050708; background: var(--pc); color: #070a0b; max-width: 70%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sta .who.bot { background: #050708; color: #cfdcd6; }
.sta.me { border-color: #fff; box-shadow: 0 0 0 2px #fff, 0 0 18px #ffd23f55; }
.sta.off { opacity: .35; }
.sta.wide { grid-column: span 2; }
.mpsortie { flex: 1; text-align: center; }
.mpsortie b { display: block; font-size: 18px; }
.mpsortie small { display: block; font-size: 10px; font-weight: 900; letter-spacing: .12em; color: var(--muted); margin-top: 2px; }

/* ------------------------------------------------------------ HUD */
#hud { position: fixed; inset: 0; pointer-events: none; }
#hud button, #hud .chips { pointer-events: auto; }
.pause { position: absolute; left: calc(10px + var(--sal)); top: calc(10px + var(--sat)); width: 38px; height: 38px; border-radius: 11px; border: 1px solid #ffffff2a; background: rgba(12, 16, 18, .82); display: grid; place-items: center; font-weight: 900; font-size: 12px; letter-spacing: -.1em; }
.seatbtn { position: absolute; left: calc(10px + var(--sal)); top: calc(54px + var(--sat)); padding: 5px 9px; border-radius: 10px; border: 1px solid #ffd23f66; background: rgba(12, 16, 18, .86); text-align: left; }
.seatbtn small { display: block; font: 900 8px/1 system-ui; letter-spacing: .14em; color: var(--muted); }
.seatbtn b { display: block; font: italic 900 12px/1.1 system-ui; text-transform: uppercase; color: var(--accent); margin-top: 2px; }
.chips { position: absolute; left: calc(56px + var(--sal)); top: calc(12px + var(--sat)); display: flex; gap: 6px; pointer-events: none !important; }
.chip { position: relative; width: var(--cw, 118px); height: var(--ch, 38px); border-radius: 10px; border: 2px solid #050708;
  background: linear-gradient(180deg, color-mix(in srgb, var(--pc) 50%, #0f1416), color-mix(in srgb, var(--pc) 20%, #0a0d0e)); box-shadow: 0 3px 0 #0009, inset 0 1px 0 #ffffff40; }
.chip canvas { position: absolute; left: 0; bottom: 0; width: calc(var(--ch, 38px) * .95); height: calc(var(--ch, 38px) + 6px); }
.chip .pn { position: absolute; left: 4px; top: -8px; font: italic 900 9.5px/1 system-ui; background: var(--pc); color: #070a0b; padding: 2px 4px; border-radius: 4px; border: 1.5px solid #050708; z-index: 2; white-space: nowrap; }
.chip .st { position: absolute; right: 6px; top: 4px; font: italic 900 calc(var(--ch, 38px) * .32)/1 system-ui; color: #fff; -webkit-text-stroke: 1.2px #050708; paint-order: stroke fill; text-shadow: 0 2px 0 #050708; }
.chip .hp { position: absolute; left: calc(var(--ch, 38px) * .95 + 3px); right: 6px; bottom: 6px; height: calc(var(--ch, 38px) * .2); border-radius: 4px; background: #050708cc; border: 1.5px solid #050708; overflow: hidden; }
.chip .hp i { position: absolute; left: 0; top: 0; bottom: 0; width: var(--hp); background: linear-gradient(180deg, var(--hc, #7cf2a9), color-mix(in srgb, var(--hc, #3ee08f) 70%, #000)); transition: width .25s; }
.chip .hp::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), #050708 0 10%); }
.chip.low .hp i { --hc: #ff5a5f; }
.chip.down { filter: grayscale(.7) brightness(.8); }
.chip .bub { position: absolute; right: -6px; top: -14px; font: italic 900 10px/1 system-ui; padding: 3px 6px; border-radius: 7px; border: 1.5px solid #050708; transform: rotate(5deg); white-space: nowrap; background: var(--accent); color: #1a1400; z-index: 3; }
.chip .bub.bad { background: #fff; color: #c22a30; }
.obj { position: absolute; right: calc(12px + var(--sar)); top: calc(8px + var(--sat)); width: 168px; padding: 6px 10px 7px; border-radius: 10px; background: rgba(12, 16, 18, .9); border: 1px solid #ffffff26; }
.obj small { display: block; font: 900 8.5px/1.2 system-ui; letter-spacing: .12em; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.obj b { display: block; font: italic 900 14px/1.1 system-ui; text-transform: uppercase; margin-top: 3px; }
.obj .bar { height: 6px; border-radius: 3px; background: #ffffff1c; margin-top: 5px; overflow: hidden; }
.obj .bar i { display: block; height: 100%; width: 0; background: var(--accent2); transition: width .3s; }
.cmdbtn { position: absolute; right: calc(12px + var(--sar)); top: calc(106px + var(--sat)); padding: 6px 12px; border-radius: 11px; background: linear-gradient(180deg, #ffe476, #ffd23f 55%, #e8b300); box-shadow: 0 4px 0 #8a6700; text-align: right; color: #2a1d00; }
.cmdbtn b { display: block; font: italic 900 13px/1 system-ui; }
.cmdbtn small { display: block; font: 900 9px/1.2 system-ui; letter-spacing: .06em; margin-top: 2px; color: #5a4200; }
.cmdbtn.alarm { background: linear-gradient(180deg, #ff8f92, #ff5a5f 55%, #c22a30); box-shadow: 0 4px 0 #6a1418; animation: blink .6s steps(2) infinite; }
.cmdbtn.alarm, .cmdbtn.alarm small { color: #fff; }
.cmdbtn.sel { background: #1f272b; color: #fff; box-shadow: 0 0 0 2px #ffd23f; animation: none; } .cmdbtn.sel small { color: var(--muted); }
#hud.cmd #ctl > *:not(#hint) { display: none !important; }
#hud.port .cmdbtn { right: 8px; top: calc(106px + var(--sat)); }
.shipst { position: absolute; right: calc(12px + var(--sar)); top: calc(72px + var(--sat)); display: flex; gap: 8px; font: 900 9px/1 system-ui; letter-spacing: .1em; color: var(--muted); background: rgba(12, 16, 18, .8); padding: 5px 8px; border-radius: 8px; border: 1px solid #ffffff1a; }
.shipst b { color: #fff; }
.shipst .lk { color: var(--danger); }
.shipst.hit { border-color: var(--danger); }
.comms { position: absolute; left: calc(12px + var(--sal)); bottom: calc(14px + var(--sab)); width: min(320px, 40vw); display: flex; flex-direction: column; gap: 4px; }
.msg { display: flex; gap: 7px; align-items: flex-start; background: rgba(12, 16, 18, .88); border: 1px solid #ffffff22; border-left: 3px solid var(--pc, #3ee08f); border-radius: 9px; padding: 5px 9px; font-size: 11.5px; font-weight: 700; line-height: 1.3; color: #e6eeea; transition: opacity .6s; }
.msg b { font-style: italic; font-weight: 900; color: var(--pc, #3ee08f); white-space: nowrap; text-transform: uppercase; }
.msg.warn { border-left-color: var(--danger); background: rgba(60, 12, 14, .9); }
.msg.old { opacity: .45; }
.call { position: absolute; left: 50%; top: 26%; transform: translateX(-50%) rotate(-4deg); font: italic 900 38px/1 system-ui; color: var(--accent); -webkit-text-stroke: 3px #070a0b; paint-order: stroke fill; text-shadow: 0 5px 0 #070a0b, 0 0 30px #ffd23f88; white-space: nowrap; text-align: center; text-transform: uppercase; }
.call small { display: block; font-size: .36em; color: #fff; -webkit-text-stroke: 2px #070a0b; margin-top: 4px; letter-spacing: .06em; }
.call.bad { color: var(--danger); text-shadow: 0 5px 0 #070a0b, 0 0 30px #ff5a5f88; }
#warn { position: absolute; left: 50%; top: 18%; transform: translateX(-50%); padding: 8px 16px; border-radius: 12px; background: #5a0d10e0; border: 2px solid var(--danger); font: italic 900 18px/1 system-ui; letter-spacing: .04em; color: #fff; animation: blink .4s steps(2) infinite; white-space: nowrap; }
@keyframes blink { 50% { opacity: .35; } }
.keys { position: absolute; left: 50%; bottom: calc(10px + var(--sab)); transform: translateX(-50%); display: flex; gap: 12px; align-items: center; padding: 6px 12px; border-radius: 12px; background: rgba(12, 16, 18, .85); border: 1px solid #ffffff22; font-size: 11px; font-weight: 800; color: #d4e0db; white-space: nowrap; }
.keys kbd { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; margin-right: 4px; border-radius: 5px; background: #283236; border: 1px solid #ffffff30; box-shadow: 0 2px 0 #000; font: 900 10px/1 system-ui; color: #fff; }

/* the round buttons */
#ctl > * { position: absolute; display: none; }
.rb { width: var(--d, 60px); height: var(--d, 60px); border-radius: 50%; display: grid; place-items: center; text-align: center;
  background: radial-gradient(circle at 36% 30%, color-mix(in srgb, var(--c) 45%, #fff), var(--c) 46%, color-mix(in srgb, var(--c) 60%, #000));
  border: 3px solid #050708; box-shadow: 0 5px 0 #050708, 0 8px 16px #000a, inset 0 2px 0 #ffffff70; opacity: .95; touch-action: none; }
.rb span { font: italic 900 calc(var(--d, 60px) * .21)/1 system-ui; color: #fff; -webkit-text-stroke: 1.5px #050708; paint-order: stroke fill; text-shadow: 0 2px 0 #050708; }
.rb span.sm { font-size: calc(var(--d, 60px) * .17); }
.rb small { display: block; font: 900 calc(var(--d, 60px) * .13)/1 system-ui; letter-spacing: .06em; color: #ffffffdd; -webkit-text-stroke: 0; margin-top: 2px; text-shadow: 0 1px 0 #0008; }
.rb.press, .rb:active { transform: translateY(3px); box-shadow: 0 2px 0 #050708, 0 0 0 4px #ffffff55, 0 0 24px var(--c); }
.rb.meter::before { content: ""; position: absolute; inset: -7px; border-radius: 50%; background: conic-gradient(var(--mc, var(--accent)) var(--m, 100%), #ffffff22 0);
  -webkit-mask: radial-gradient(circle, transparent calc(50% - 4px), #000 calc(50% - 3px)); mask: radial-gradient(circle, transparent calc(50% - 4px), #000 calc(50% - 3px)); }
.rb.dim { filter: saturate(.35) brightness(.7); }
.rb.sel { box-shadow: 0 5px 0 #050708, 0 0 0 3px #fff, 0 0 20px var(--c), inset 0 2px 0 #ffffff70; }
.rb.ready { animation: pulse .5s ease-in-out infinite alternate; }
@keyframes pulse { to { box-shadow: 0 5px 0 #050708, 0 0 0 5px #fff, 0 0 30px var(--c); } }
.rb.big { --d: 92px; }
.guns { display: flex; gap: 12px; }
.guns .rb { position: relative; --d: 56px; }
.zoom { flex-direction: column; border-radius: 12px; overflow: hidden; border: 2px solid #050708; box-shadow: 0 4px 0 #050708; }
.zoom button { width: 48px; height: 38px; display: grid; place-items: center; font: italic 900 12px/1 system-ui; background: #1f272b; color: #cfe; border-bottom: 1px solid #050708; }
.zoom button.sel { background: var(--accent); color: #1a1400; }
.hint { padding: 5px 12px; border-radius: 999px; background: rgba(12, 16, 18, .85); border: 1px solid #ffffff22; font-size: 11px; font-weight: 800; color: #d4e0db; white-space: nowrap; }
.hint b { color: var(--accent); }
.heat { width: 160px; padding: 6px 9px; border-radius: 10px; background: rgba(12, 16, 18, .9); border: 1px solid #ffffff26; }
.heat small { display: flex; justify-content: space-between; font: 900 8.5px/1 system-ui; letter-spacing: .12em; color: var(--muted); }
.heat small b { color: var(--danger); }
.heat .bar { height: 9px; border-radius: 4px; margin-top: 5px; background: #ffffff18; overflow: hidden; }
.heat .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #ffd23f, #ff7a1a 60%, #ff3a3f); }
.heat.over .bar i { animation: blink .3s steps(2) infinite; }
.loadbars { display: flex; flex-direction: column; gap: 6px; width: min(300px, 40vw); }
.lb { position: relative; display: grid; grid-template-columns: 56px 1fr; gap: 8px; align-items: center; padding: 5px 8px; border-radius: 12px; background: rgba(12, 16, 18, .92); border: 2px solid #050708; pointer-events: auto; text-align: left; }
.lb b { font: italic 900 16px/1 system-ui; color: var(--c); }
.lb b small { display: block; font: 900 8.5px/1 system-ui; letter-spacing: .1em; color: var(--muted); font-style: normal; margin-top: 3px; }
.lb .tr { position: relative; height: 18px; border-radius: 7px; background: #ffffff12; overflow: hidden; }
.lb .tr .w { position: absolute; top: 0; bottom: 0; background: #3ee08f66; border-left: 2px solid #3ee08f; border-right: 2px solid #3ee08f; }
.lb .tr .m { position: absolute; top: -2px; bottom: -2px; width: 4px; margin-left: -2px; background: #fff; box-shadow: 0 0 8px #fff; }
.lb .tr .f { position: absolute; left: 0; top: 0; bottom: 0; background: #ffffff18; }
.lb.ready .tr { background: #3ee08f33; }
.lb.ready .tr::after { content: "READY"; position: absolute; inset: 0; display: grid; place-items: center; font: 900 10px/1 system-ui; letter-spacing: .2em; color: #7cf2a9; }
.lb.miss .tr { background: #ff5a5f33; }

/* which controls each seat shows (#hud[data-view]) — landscape positions */
#hud[data-view="gun"] #zoom, #hud[data-view="sensor"] #zoom { display: flex; left: calc(12px + var(--sal)); top: calc(50% - 60px); }
#hud[data-view="gun"] #guns { display: flex; right: calc(130px + var(--sar)); bottom: calc(18px + var(--sab)); }
#hud[data-view="gun"] #b-fire, #hud[data-view="door"] #b-fire { display: grid; right: calc(22px + var(--sar)); bottom: calc(22px + var(--sab)); }
#hud[data-view="sensor"] #b-mark { display: grid; right: calc(130px + var(--sar)); bottom: calc(24px + var(--sab)); }
#hud[data-view="sensor"] #b-lase { display: grid; right: calc(22px + var(--sar)); bottom: calc(22px + var(--sab)); }
#hud[data-view="sensor"] #b-track { display: grid; right: calc(36px + var(--sar)); bottom: calc(128px + var(--sab)); --d: 54px; }
#hud[data-view="sensor"] #b-hot { display: grid; right: calc(130px + var(--sar)); bottom: calc(102px + var(--sab)); --d: 48px; }
#hud[data-view="pilot"] #b-flare { display: grid; right: calc(22px + var(--sar)); bottom: calc(22px + var(--sab)); }
#hud[data-view="pilot"] #b-up { display: grid; right: calc(36px + var(--sar)); bottom: calc(134px + var(--sab)); --d: 56px; }
#hud[data-view="pilot"] #b-down { display: grid; right: calc(124px + var(--sar)); bottom: calc(110px + var(--sab)); --d: 52px; }
#hud[data-view="load"] #b-drop { display: grid; right: calc(22px + var(--sar)); bottom: calc(22px + var(--sab)); }
#hud[data-view="load"] #loadbars { display: flex; right: calc(130px + var(--sar)); bottom: calc(18px + var(--sab)); }
#hud[data-view="door"] #heat { display: block; right: calc(130px + var(--sar)); bottom: calc(22px + var(--sab)); }
#hud[data-view="pilot"] #hint, #hud[data-view="load"] #hint, #hud[data-view="wpilot"] #hint, #hud[data-view="gun"] #hint, #hud[data-view="sensor"] #hint, #hud[data-view="door"] #hint { display: block; left: 50%; transform: translateX(-50%); top: calc(104px + var(--sat)); }
#hud.desk #hint { display: none !important; }
#hud.desk.cmd #hint { display: block !important; }
#hud.desk[data-view="pilot"] #hint, #hud.desk[data-view="load"] #hint, #hud.desk[data-view="wpilot"] #hint { display: block !important; }
#hud[data-view="load"] .comms { bottom: calc(14px + var(--sab)); }

/* portrait phones: the camera on top, a control deck below */
#hud.port::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 37%; background: linear-gradient(180deg, #1d2528, #141a1c 30%, #0d1112); border-top: 3px solid #000; box-shadow: inset 0 2px 0 #ffffff14; }
#hud.port::after { content: ""; position: absolute; left: 0; right: 0; bottom: calc(37% - 6px); height: 6px; background: repeating-linear-gradient(90deg, var(--accent) 0 14px, #141a1c 14px 28px); opacity: .85; }
#hud.port .chips { left: 8px; right: 8px; gap: 5px; top: calc(14px + var(--sat)); }
#hud.port .chip { --cw: calc((100vw - 31px) / 4); --ch: 36px; }
#hud.port .pause { left: auto; right: 8px; top: calc(62px + var(--sat)); }
#hud.port .seatbtn { left: auto; right: 52px; top: calc(62px + var(--sat)); }
#hud.port .obj { left: 8px; right: auto; top: calc(62px + var(--sat)); width: calc(100vw - 170px); max-width: 220px; }
#hud.port .shipst { left: 8px; right: auto; top: calc(124px + var(--sat)); }
#hud.port .comms { left: 12px; right: 12px; width: auto; bottom: auto; top: calc(63% + 14px); z-index: 1; }
#hud.port .msg.old { display: none; }
#hud.port #zoom { flex-direction: row; left: 14px; top: auto; bottom: calc(18px + var(--sab)); z-index: 1; }
#hud.port #zoom button { width: 52px; height: 40px; border-bottom: 0; border-right: 1px solid #050708; }
#hud.port[data-view="gun"] #guns { right: auto; left: 16px; bottom: calc(76px + var(--sab)); z-index: 1; }
#hud.port .rb.big { --d: 104px; z-index: 1; }
#hud.port .rb { z-index: 1; }
#hud.port[data-view="gun"] #b-fire, #hud.port[data-view="door"] #b-fire { right: 20px; bottom: calc(26px + var(--sab)); }
#hud.port[data-view="sensor"] #b-mark { right: 140px; bottom: calc(26px + var(--sab)); }
#hud.port[data-view="sensor"] #b-track { right: 150px; bottom: calc(108px + var(--sab)); --d: 52px; }
#hud.port[data-view="sensor"] #b-hot { right: auto; left: 190px; bottom: calc(80px + var(--sab)); --d: 48px; }
#hud.port[data-view="sensor"] #zoom { bottom: calc(18px + var(--sab)); }
#hud.port[data-view="load"] #loadbars { right: auto; left: 12px; width: calc(100vw - 150px); bottom: calc(20px + var(--sab)); z-index: 1; }
#hud.port[data-view="load"] .comms { display: none; }
#hud.port[data-view="door"] #heat { right: auto; left: 16px; bottom: calc(30px + var(--sab)); z-index: 1; }
#hud.port #hint { top: calc(63% - 34px); z-index: 1; white-space: normal; text-align: center; width: max-content; max-width: 92vw; }
#hud.port .call { top: 30%; font-size: 30px; }
#hud.port .keys { display: none; }

/* results */
.banner2 { text-align: center; margin-top: 10px; }
.banner2 .h { display: block; font-size: 40px; color: var(--accent); -webkit-text-stroke: 2.5px #070a0b; paint-order: stroke fill; text-shadow: 0 5px 0 #070a0b; transform: rotate(-3deg); }
.banner2.bad .h { color: var(--danger); }
.banner2 small { display: block; margin-top: 10px; font-size: 11px; font-weight: 900; letter-spacing: .14em; color: #cfe; }
.stars { text-align: center; font-size: 40px; letter-spacing: 6px; color: var(--accent); text-shadow: 0 3px 0 #000, 0 0 18px #ffd23f88; }
.stars i { font-style: normal; color: #ffffff28; text-shadow: none; }
.stars small { display: block; font-size: 11px; letter-spacing: .1em; color: var(--muted); text-shadow: none; font-weight: 800; }
.tally .rw { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; font-weight: 800; padding: 5px 0; border-bottom: 1px solid #ffffff10; }
.tally .rw:last-child { border: 0; }
.tally .rw b { font-style: italic; text-align: right; }
.tally .rw b.g { color: var(--accent2); } .tally .rw b.r { color: var(--danger); } .tally .rw b.y { color: var(--accent); }
.awards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.aw { padding: 8px; border-radius: 12px; background: var(--panel2); border: 1px solid #ffffff1a; text-align: center; }
.aw .ic { font-size: 22px; }
.aw b { display: block; font: italic 900 11.5px/1.1 system-ui; text-transform: uppercase; margin-top: 3px; }
.aw small { display: block; font-size: 10px; font-weight: 700; color: #aebdb7; margin-top: 2px; }

/* ------------------------------------------------------------ Versus */
.mode.vsmode { grid-column: span 2; border-color: #ff7a1a66; background: linear-gradient(160deg, #3a2414, #1f272b 70%); }
.mode.vsmode em { font-style: italic; color: #ff9a3c; font-size: 13px; }
.vkits { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.vkits button { padding: 8px 4px; border-radius: 10px; background: var(--panel2); border: 1px solid #ffffff14; text-align: center; }
.vkits b { display: block; font: italic 900 11px/1 system-ui; text-transform: uppercase; }
.vkits small { display: block; font-size: 9.5px; font-weight: 700; color: #aebdb7; margin-top: 3px; line-height: 1.2; }
.vkits .ic { font-size: 19px; line-height: 1.2; }
.vkits button.sel { border: 2px solid var(--accent); background: #2a2814; }
.vsides { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.vside { border-radius: 14px; padding: 10px; border: 2px solid #050708; text-align: left; }
.vside.g { background: linear-gradient(170deg, #1f3a2e, #0c1013 80%); } .vside.s { background: linear-gradient(170deg, #3a2614, #0c1013 80%); }
.vside.sel { border-color: var(--accent); }
.vside b.t { display: block; font: italic 900 17px/1 system-ui; text-transform: uppercase; }
.vside small.k { display: block; font: 900 9px/1.3 system-ui; letter-spacing: .1em; margin: 3px 0 8px; color: var(--muted); }
.vrow { display: flex; justify-content: space-between; gap: 6px; padding: 5px 7px; border-radius: 7px; background: rgba(5, 7, 8, .7); font-size: 11px; font-weight: 800; margin-top: 4px; }
.vrow em { font-style: normal; font-size: 9px; font-weight: 900; letter-spacing: .06em; color: var(--muted); }
.vrow.me { outline: 2px solid #fff; }
.vrow.bot { opacity: .6; }
.vscv { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#vs2d { pointer-events: none; }
#vshud { position: fixed; inset: 0; pointer-events: none; }
#vshud button { pointer-events: auto; }
#vshud .pause { left: calc(10px + var(--sal)); top: calc(118px + var(--sat)); width: 34px; height: 34px; }
#vshud[data-side="s"] .pause { top: calc(48px + var(--sat)); }
.vteam { position: absolute; left: calc(10px + var(--sal)); top: calc(10px + var(--sat)); display: flex; gap: 5px; flex-wrap: wrap; max-width: 46vw; }
.tchip { position: relative; height: 28px; min-width: 64px; padding: 0 8px 0 8px; border-radius: 9px; border: 2px solid #050708; display: flex; align-items: center; font: italic 900 10.5px/1 system-ui; text-transform: uppercase; white-space: nowrap;
  background: linear-gradient(180deg, color-mix(in srgb, var(--pc) 50%, #0f1416), color-mix(in srgb, var(--pc) 20%, #0a0d0e)); box-shadow: 0 3px 0 #0009; }
.tchip i { position: absolute; left: 6px; right: 6px; bottom: 3px; height: 3px; border-radius: 2px; background: #050708; }
.tchip i::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: var(--hp); background: var(--pc); border-radius: 2px; }
.tchip.me { box-shadow: 0 0 0 2px #fff, 0 3px 0 #0009; } .tchip.dead { filter: grayscale(1) brightness(.6); } .tchip.bot { opacity: .85; }
.vscore { position: absolute; left: 50%; top: calc(8px + var(--sat)); transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 12px; background: rgba(12, 16, 18, .9); border: 1px solid #ffffff26; }
.vscore b { font: italic 900 20px/1 system-ui; } .vscore .g { color: var(--accent2); } .vscore .s { color: #ff7a1a; }
.vscore small { display: flex; flex-direction: column; align-items: center; font: 900 8.5px/1.25 system-ui; letter-spacing: .12em; color: var(--muted); }
.vscore small span:last-child { color: #fff; font-size: 11px; letter-spacing: .04em; }
.vobj { right: calc(12px + var(--sar)); top: calc(8px + var(--sat)); }
.vkite { position: absolute; right: calc(12px + var(--sar)); top: calc(72px + var(--sat)); font: 900 9px/1 system-ui; letter-spacing: .1em; color: var(--muted); background: rgba(12, 16, 18, .8); padding: 5px 8px; border-radius: 8px; border: 1px solid #ffffff1a; white-space: nowrap; }
.vkite b { color: #ff9a3c; } .vkite.away b { color: var(--accent2); } .vkite.hit { border-color: var(--danger); }
.vheat { position: absolute; left: calc(10px + var(--sal)); top: calc(48px + var(--sat)); width: 150px; padding: 6px 9px 7px; border-radius: 10px; background: rgba(12, 16, 18, .9); border: 1px solid #ffffff26; }
.vheat small { display: flex; justify-content: space-between; font: 900 8.5px/1 system-ui; letter-spacing: .12em; color: var(--muted); }
.vheat small b { color: var(--hc, #3ee08f); }
.vheat .bar { position: relative; height: 8px; border-radius: 4px; margin-top: 5px; background: linear-gradient(90deg, #3a6fd8, #3ee08f 35%, #ffd23f 65%, #ff5a5f); overflow: hidden; }
.vheat .bar i { position: absolute; top: 0; bottom: 0; right: 0; left: var(--v, 30%); background: #0a0d0edd; transition: left .2s; }
.vheat em { display: block; font-style: normal; font-size: 10px; font-weight: 700; color: #c3d0ca; margin-top: 4px; }
.vwarn { position: absolute; left: 50%; top: calc(96px + var(--sat)); transform: translateX(-50%); padding: 7px 16px; border-radius: 12px; background: #5a0d10e6; border: 2px solid var(--danger); text-align: center; animation: blink .35s steps(2) infinite; }
.vwarn b { display: block; font: italic 900 20px/1 system-ui; color: #fff; white-space: nowrap; }
.vwarn small { display: block; font: 900 10px/1.2 system-ui; letter-spacing: .1em; color: #ffc2c4; margin-top: 3px; white-space: nowrap; }
.vcomms { left: calc(12px + var(--sal)); bottom: calc(140px + var(--sab)); width: min(300px, 40vw); }
.vdown { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); text-align: center; padding: 14px 24px; border-radius: 16px; background: rgba(40, 8, 10, .85); border: 2px solid var(--danger); }
.vdown b { display: block; font: italic 900 30px/1 system-ui; color: var(--danger); text-transform: uppercase; }
.vdown small { display: block; font-size: 12px; font-weight: 800; color: #ffd0d2; margin-top: 6px; }
.vstick { position: absolute; left: calc(26px + var(--sal)); bottom: calc(26px + var(--sab)); width: 108px; height: 108px; border-radius: 50%; background: radial-gradient(circle, #ffffff10 0 58%, #ffffff1c 59% 100%); border: 2px solid #ffffff40; }
.vstick i { position: absolute; width: 44%; height: 44%; left: 28%; top: 28%; border-radius: 50%; background: radial-gradient(circle at 38% 32%, #ffffffcc, #c7c3e0 40%, #77739a); border: 2px solid #050708; }
.vstick span { position: absolute; left: 50%; bottom: -16px; transform: translateX(-50%); font-size: 8.5px; font-weight: 900; letter-spacing: .12em; color: #ffffffaa; white-space: nowrap; text-shadow: 0 1px 0 #000; }
.vammo { position: absolute; right: calc(150px + var(--sar)); bottom: calc(150px + var(--sab)); text-align: right; font: italic 900 26px/1 system-ui; -webkit-text-stroke: 2px #050708; paint-order: stroke fill; text-shadow: 0 3px 0 #050708; }
.vammo small { font-size: 13px; color: #cfdcd6; }
.vammo em { display: block; font: 900 9px/1.2 system-ui; letter-spacing: .12em; color: var(--muted); -webkit-text-stroke: 0; font-style: normal; text-shadow: 0 1px 0 #000; }
#vshud .rb { position: absolute; }
#vshud .guns .rb { position: relative; --d: 56px; }
#v-fire { right: calc(24px + var(--sar)); bottom: calc(28px + var(--sab)); --d: 86px; }
#v-jump { right: calc(122px + var(--sar)); bottom: calc(16px + var(--sab)); }
#v-prone { right: calc(118px + var(--sar)); bottom: calc(92px + var(--sab)); }
#v-kit { right: calc(28px + var(--sar)); bottom: calc(134px + var(--sab)); }
#v-prone.sel, #v-kit.sel { box-shadow: 0 5px 0 #050708, 0 0 0 3px #fff, 0 0 20px var(--c); }
#vshud[data-side="s"] .vg, #vshud[data-side="s"] .vstick, #vshud[data-side="s"] .vammo, #vshud[data-side="s"] .vheat { display: none; }
#vshud[data-side="g"] .vsk { display: none !important; }
#vshud .zoom { position: absolute; left: calc(12px + var(--sal)); top: calc(50% - 50px); display: flex; }
#vshud .guns { position: absolute; right: calc(130px + var(--sar)); bottom: calc(18px + var(--sab)); display: flex; }
#v-sfire { right: calc(22px + var(--sar)); bottom: calc(22px + var(--sab)); }
#v-flare { right: calc(34px + var(--sar)); bottom: calc(130px + var(--sab)); }
#v-mark { right: calc(118px + var(--sar)); bottom: calc(100px + var(--sab)); }
#v-map { right: calc(12px + var(--sar)); top: calc(100px + var(--sat)); }
#vshud.mapmode .guns, #vshud.mapmode #v-sfire, #vshud.mapmode .zoom, #vshud.mapmode #v-mark { display: none; }
#vshud.desk .vstick, #vshud.desk .vg, #vshud.desk .vsk:not(#v-map) { display: none !important; }
#vshud.desk .vammo { right: calc(24px + var(--sar)); bottom: calc(56px + var(--sab)); display: block !important; }
#vshud.desk .vcomms { bottom: calc(56px + var(--sab)); }
#vshud.port .vteam { max-width: calc(100vw - 20px); }
#vshud.port .vobj { top: calc(92px + var(--sat)); width: calc(100vw - 172px); }
#vshud.port .vkite { top: calc(158px + var(--sat)); }
#vshud.port .vheat { top: calc(92px + var(--sat)); width: 140px; }
#vshud.port .vwarn { top: calc(250px + var(--sat)); }
#vshud.port .vwarn b { font-size: 16px; } #vshud.port .vwarn small { white-space: normal; }
#vshud.port .vcomms { width: auto; right: 12px; bottom: calc(200px + var(--sab)); }
#vshud[data-side="s"] .vcomms { left: calc(74px + var(--sal)); bottom: calc(14px + var(--sab)); }
#vshud.port .pause { top: calc(162px + var(--sat)); }
#vshud.port .vscore { top: calc(44px + var(--sat)); }
.vvs { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; text-align: center; margin: 4px 0; }
.vvs b { display: block; font: italic 900 46px/1 system-ui; -webkit-text-stroke: 2px #070a0b; paint-order: stroke fill; }
.vvs small { display: block; font: 900 10px/1.2 system-ui; letter-spacing: .12em; color: var(--muted); }
.vvs .x { font: italic 900 18px system-ui; color: var(--muted); }
.tally .ph { display: flex; justify-content: space-between; font-size: 10px; font-weight: 900; letter-spacing: .12em; color: var(--muted); margin: 8px 0 2px; }

#vshud.coop .vheat { display: none; }
