/* MDT SPACE EXPLORER - the MDT look (near-black glass, gold for the main
   actions) in deep-space blue, with a cyan accent and Orbitron for the big type */
:root {
  --ink: #eef4ff; --mute: #9fb0c8; --faint: #5d6c82; --bg: #05070c; --glass: rgba(8, 12, 20, 0.88); --glass2: rgba(16, 22, 34, 0.8);
  --line: rgba(190, 220, 255, 0.1); --line2: rgba(190, 220, 255, 0.2);
  --gold: #f0c868; --gold2: #ffd98a; --goldInk: #2a1c04; --acc: #5fd4ff; --cyan: #5fd4ff; --good: #46e39a; --bad: #ff6a6a; --pink: #ff6ad0;
  --font: Inter, -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif; --display: Orbitron, Inter, system-ui, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px); --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--font); }
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input { -webkit-user-select: text; user-select: text; }
#game { position: fixed; inset: 0; }
#game canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: 0.5; }
svg { flex: none; }
#buildTag { position: fixed; right: 6px; bottom: calc(4px + var(--safe-b)); font: 10px system-ui, sans-serif; color: rgba(255, 255, 255, 0.35); z-index: 95; pointer-events: none; }
.muted { color: var(--mute); }
.small { font-size: 13px; }
.kick { display: block; font-size: 11.5px; font-weight: 800; letter-spacing: 1.6px; text-transform: uppercase; color: var(--acc); }
h2 { font: 800 23px/1.15 var(--font); margin: 4px 0 6px; letter-spacing: -0.2px; }
h3 { font: 800 13px/1.2 var(--display); letter-spacing: 1.2px; margin: 18px 0 4px; color: var(--cyan); text-transform: uppercase; }
p { margin: 6px 0; }

/* --- loading */
#loading { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: radial-gradient(circle at 50% 42%, #10223a, var(--bg) 68%); transition: opacity 0.5s; }
#loading.gone { opacity: 0; pointer-events: none; }
.ld { text-align: center; width: 290px; }
.ld b { display: block; font: 900 24px var(--display); letter-spacing: 4px; background: linear-gradient(180deg, #ffffff, #9fe8ff 55%, #5f9cff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ld .bar { height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.1); margin: 16px 0 10px; overflow: hidden; }
.ld .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #5fd4ff, var(--gold)); transition: width 0.3s; }
.ld span { color: var(--mute); font-size: 13.5px; }

/* --- buttons and form bits */
.btn { flex: 1; min-height: 46px; padding: 0 18px; border-radius: 14px; border: 1px solid var(--line2); background: rgba(255, 255, 255, 0.07); font-weight: 650; display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap; transition: transform 0.12s, background 0.2s; }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn.gold { background: linear-gradient(180deg, var(--gold2), var(--gold) 60%, #d9a640); border-color: rgba(255, 230, 160, 0.7); color: var(--goldInk); box-shadow: 0 6px 20px rgba(240, 200, 104, 0.2); }
.btn.big { min-height: 54px; font-size: 17px; }
.btn.sm { flex: none; min-height: 34px; padding: 0 13px; font-size: 13.5px; border-radius: 11px; }
.btn.ghost { background: transparent; }
.btn.danger { background: rgba(255, 106, 106, 0.16); border-color: rgba(255, 106, 106, 0.5); color: #ffb8b8; }
.btns { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.link { background: none; border: 0; color: var(--gold); padding: 10px 0; font-weight: 600; }
.err { color: var(--bad); min-height: 18px; font-size: 13px; margin: 4px 0; }
.card input:not([type=range]) { width: 100%; height: 48px; border-radius: 13px; border: 1px solid var(--line2); background: rgba(0, 0, 0, 0.35); color: var(--ink); padding: 0 14px; font: inherit; margin-bottom: 8px; }
form { margin: 0; }

/* --- the title card */
#title { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: flex-start; padding: calc(var(--mdts-h, 52px) + 20px) 6vw calc(24px + var(--safe-b)); background: linear-gradient(90deg, rgba(3, 6, 12, 0.92), rgba(3, 6, 12, 0.55) 46%, rgba(3, 6, 12, 0) 72%); }
.tCard { max-width: 500px; }
.tKick { font-size: 12px; font-weight: 800; letter-spacing: 2.4px; text-transform: uppercase; color: var(--cyan); }
.tLogo { margin: 6px 0 10px; font: 900 clamp(34px, 7.4vw, 62px)/0.98 var(--display); letter-spacing: 2px; background: linear-gradient(180deg, #ffffff, #bfe9ff 45%, #5f9cff); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 4px 22px rgba(95, 180, 255, 0.35)); }
.tLogo small { display: block; font-size: 0.42em; letter-spacing: 8px; background: linear-gradient(180deg, #fff6d8, #f0c868 55%, #b8862e); -webkit-background-clip: text; background-clip: text; }
.tTag { font-size: 16px; color: #d8e4f4; margin: 0 0 16px; }
/* your runs: one card each (where the ship is, how far it's got, who's in it), newest first */
.tRuns { display: flex; flex-direction: column; gap: 8px; max-height: min(44vh, 380px); overflow-y: auto; margin: 0 -4px 4px; padding: 0 4px; overscroll-behavior: contain; }
.tRunsHead { font-size: 11.5px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; color: var(--mute); margin-bottom: -2px; }
.tEmpty { color: #cfdcef; font-size: 14.5px; margin: 0 0 4px; }
.runCard { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 14px; background: rgba(10, 16, 28, 0.78); border: 1px solid var(--line); }
.runCard.cur { border-color: rgba(240, 200, 104, 0.55); box-shadow: 0 0 0 1px rgba(240, 200, 104, 0.12) inset; }
.rcMain { flex: 1; min-width: 0; }
.rcMain b { display: block; font-size: 15.5px; }
.rcMain span { display: block; font-size: 13px; color: #d8e4f4; line-height: 1.35; }
.rcMain .rcSub { color: var(--mute); font-size: 12.5px; }
.rcMain .rcWhere::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--acc); box-shadow: 0 0 8px var(--acc); margin-right: 7px; vertical-align: 1px; }
.rcBar { display: block; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.1); margin: 6px 0 4px; max-width: 260px; overflow: hidden; }
.rcBar i { display: block; height: 100%; border-radius: 2px; background: linear-gradient(90deg, #5fd4ff, #f0c868); }
.rcMain .rcCrew { color: var(--cyan); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rcBtns { flex: none; display: flex; gap: 6px; align-items: center; }
.rcOff { color: var(--mute); font-size: 12px; }
.runCard .live { font-style: normal; font-size: 10px; font-weight: 800; letter-spacing: 0.6px; text-transform: uppercase; color: #04210f; background: var(--good); border-radius: 99px; padding: 2px 7px; margin-left: 6px; vertical-align: middle; }
.pRow.pick { cursor: pointer; }
.pRow.pick input { flex: none; width: 20px; height: 20px; margin: 0 2px; accent-color: var(--gold); }
.link.inline { display: inline; padding: 0; font: inherit; font-weight: 700; }
#title .btns { max-width: 420px; }
/* a long list never pushes the title off the top: the card scrolls instead */
#title { overflow-y: auto; align-items: safe center; }
@media (max-height: 820px) and (min-width: 641px) {
  .tLogo { font-size: clamp(34px, 5.4vw, 50px); margin: 4px 0 8px; }
  .tTag { font-size: 14.5px; margin-bottom: 12px; }
  .tRuns { max-height: min(34vh, 300px); }
}
@media (max-width: 640px) {
  #title { align-items: flex-end; background: linear-gradient(0deg, rgba(3, 6, 12, 0.96), rgba(3, 6, 12, 0.6) 58%, rgba(3, 6, 12, 0)); }
  .tTag { font-size: 14px; margin-bottom: 12px; }
  .tRuns { max-height: 40vh; }
}

/* --- the HUD */
#hud { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
#hud > * { pointer-events: auto; }
#locPill { position: fixed; top: calc(12px + var(--safe-t)); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 99px; background: var(--glass); border: 1px solid var(--line2); font-weight: 700; font-size: 13.5px; white-space: nowrap; pointer-events: none; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); overflow: hidden; max-width: calc(100vw - 230px); }
#locPill > i { width: 8px; height: 8px; border-radius: 50%; background: var(--acc); box-shadow: 0 0 10px var(--acc); flex: none; }
#locPill span { overflow: hidden; text-overflow: ellipsis; }
#locPill em { font-style: normal; font-size: 11.5px; color: #05070c; background: var(--cyan); border-radius: 99px; padding: 2px 8px; flex: none; }
#tripBar { display: none; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: rgba(255, 255, 255, 0.08); }
#tripBar u { display: block; height: 100%; width: calc(var(--k, 0) * 100%); background: linear-gradient(90deg, var(--cyan), var(--acc)); }
#locPill.trip #tripBar { display: block; }
#tracker { position: fixed; left: calc(12px + var(--safe-l)); top: calc(60px + var(--safe-t)); max-width: min(330px, calc(100vw - 24px)); text-align: left; padding: 9px 13px; border-radius: 14px; background: var(--glass); border: 1px solid var(--line2); border-left: 3px solid var(--acc); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); display: flex; flex-direction: column; gap: 1px; }
#tracker b { font-size: 14.5px; }
#tracker > span:last-child { font-size: 12.5px; color: #cfdcef; line-height: 1.3; }
.hRight { position: fixed; top: calc(10px + var(--safe-t)); right: calc(10px + var(--safe-r)); display: flex; gap: 6px; }
.hb { position: relative; width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(95, 212, 255, 0.4); background: rgba(5, 8, 14, 0.78); display: grid; place-items: center; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4); }
.hb svg { width: 21px; height: 21px; fill: #cdeeff; }
.hb b { position: absolute; right: -4px; bottom: -4px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: var(--gold); color: var(--goldInk); font-size: 11px; display: grid; place-items: center; }
.hb.sm { width: 48px; height: 48px; }
.hb.off { background: rgba(255, 106, 208, 0.25); border-color: var(--pink); }
.hb.off svg { fill: #ffd0f0; }
.hSide { position: fixed; right: calc(12px + var(--safe-r)); bottom: calc(18px + var(--safe-b)); display: flex; flex-direction: column; gap: 10px; }
body.touch .hSide { bottom: calc(176px + var(--safe-b)); }
/* the label pinned to whatever's in reach (tickUse puts it there each frame): tap it, or the thing, to use it */
#useBtn { position: fixed; left: 0; top: 0; translate: -50% calc(-100% - 10px); display: flex; align-items: center; gap: 7px; max-width: min(260px, calc(100vw - 40px)); padding: 0 13px 0 10px; height: 38px; border-radius: 99px; border: 1.5px solid rgba(255, 216, 74, 0.85); background: rgba(10, 12, 18, 0.82); color: #ffe39a; font-weight: 750; font-size: 13.5px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45), 0 0 18px rgba(255, 216, 74, 0.25); overflow: visible; touch-action: none; z-index: 22; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
#useBtn::after { content: ''; position: absolute; left: 50%; bottom: -8px; margin-left: -7px; border-top: 8px solid rgba(255, 216, 74, 0.85); border-left: 7px solid transparent; border-right: 7px solid transparent; }
#useBtn.free { translate: -50% -100%; }
#useBtn.free::after { display: none; }
#useBtn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; position: relative; }
#useBtn svg { width: 17px; height: 17px; fill: currentColor; position: relative; }
#useBtn kbd { font: 700 11px var(--font); border: 1px solid rgba(255, 216, 74, 0.5); border-radius: 5px; padding: 1px 5px; position: relative; }
#useRing { position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--p, 0) * 100%); border-radius: 99px; background: rgba(70, 227, 154, 0.55); }
#useBtn.hold { border-color: #ff7a5a; color: #ffd0c4; }
#useBtn.hold::after { border-top-color: #ff7a5a; }
body.touch #useBtn kbd { display: none; }
@keyframes pop { from { transform: translateX(-50%) scale(0.85); opacity: 0; } }
body[data-ui=card] #useBtn { display: none; }
#bigCount { position: fixed; left: 50%; top: 34%; transform: translate(-50%, -50%); font: 900 clamp(70px, 18vw, 150px) var(--display); color: #fff; text-shadow: 0 0 40px rgba(95, 212, 255, 0.8); pointer-events: none !important; animation: beat 1s infinite; }
@keyframes beat { from { transform: translate(-50%, -50%) scale(1.25); opacity: 0.4; } 30% { opacity: 1; } to { transform: translate(-50%, -50%) scale(1); } }
#skipBtn { position: fixed; right: calc(12px + var(--safe-r)); top: calc(62px + var(--safe-t)); flex: none; }
#o2 { position: fixed; left: 50%; top: calc(54px + var(--safe-t)); transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 99px; background: var(--glass); border: 1px solid var(--line2); font: 800 11px var(--display); letter-spacing: 1px; pointer-events: none !important; }
#o2 b { width: 120px; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
#o2 i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #46e39a, var(--cyan)); transition: width 0.3s; }
#o2 em { font-style: normal; color: var(--mute); }
#o2.low i { background: var(--bad); } #o2.low { border-color: var(--bad); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.55; } }
#evaHint { position: fixed; left: 50%; bottom: calc(90px + var(--safe-b)); transform: translateX(-50%); padding: 6px 12px; border-radius: 99px; background: var(--glass); border: 1px solid rgba(255, 216, 74, 0.5); color: #ffe9a6; font-size: 13px; font-weight: 650; white-space: nowrap; pointer-events: none !important; }
/* low oxygen: a red banner over the airlock hint, the screen's edges pulse red, faster at the end */
#o2Warn { position: fixed; left: 50%; bottom: calc(132px + var(--safe-b)); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 18px; border-radius: 14px; background: rgba(60, 6, 6, 0.82); border: 1.5px solid var(--bad); color: #fff; text-align: center; pointer-events: none !important; animation: blink 1.2s infinite; max-width: calc(100vw - 32px); }
#o2Warn b { font: 900 15px var(--display); letter-spacing: 2px; color: #ff8a80; }
#o2Warn span { font-size: 13.5px; font-weight: 650; }
#o2Warn.crit { animation-duration: 0.5s; }
#o2Warn.crit b { font-size: 20px; color: #fff; }
#o2Vig { position: fixed; inset: 0; z-index: 4; pointer-events: none !important; opacity: 0; background: radial-gradient(ellipse at center, transparent 55%, rgba(255, 40, 30, 0.55)); }
#o2Vig.on { animation: vig 1.6s ease-in-out infinite; }
#o2Vig.crit { animation-duration: 0.6s; }
@keyframes vig { 50% { opacity: 1; } }
#fade { position: fixed; inset: 0; z-index: 35; background: #000; opacity: 0; pointer-events: none; transition: opacity 0.15s; }

@media (max-width: 560px) {
  #locPill { top: calc(62px + var(--safe-t)); font-size: 12.5px; padding: 6px 12px; max-width: calc(100vw - 24px); }
  #tracker { top: calc(102px + var(--safe-t)); }
  #o2 { top: calc(100px + var(--safe-t)); }
  body[data-mode=eva] #tracker { top: calc(140px + var(--safe-t)); }
  .hb { width: 40px; height: 40px; }
  .hRight { gap: 5px; }
  #skipBtn { top: calc(104px + var(--safe-t)); }
}

/* --- touch: up and down (the stick is the shared MDT stick, apps/_shared/mdt-stick.js) */
#controls { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
body:not(.touch) #upBtn, body:not(.touch) #downBtn { display: none; }
#upBtn, #downBtn { position: fixed; right: calc(80px + var(--safe-r)); width: 62px; height: 62px; border-radius: 50%; border: 1px solid var(--line2); background: rgba(5, 8, 14, 0.6); pointer-events: auto; display: grid; place-items: center; touch-action: none; }
#upBtn { bottom: calc(100px + var(--safe-b)); }
#downBtn { bottom: calc(28px + var(--safe-b)); }
body[data-mode=walk] #upBtn { bottom: calc(30px + var(--safe-b)); }
#upBtn svg, #downBtn svg { width: 26px; height: 26px; fill: #fff; }
#upBtn.float, #downBtn { border-color: rgba(255, 106, 208, 0.6); }

/* --- the telescope and the mining laser */
#scopeUI, #turretUI { position: fixed; inset: 0; z-index: 25; pointer-events: none; }
#scopeUI > *, #turretUI > * { pointer-events: auto; }
.vignette { position: absolute; inset: 0; pointer-events: none !important; background: radial-gradient(circle at 50% 50%, transparent 0, transparent min(42vw, 42vh), rgba(0, 0, 0, 0.92) min(48vw, 48vh)); }
.reticle { position: absolute; left: 50%; top: 50%; width: calc(min(100vw, 100vh) * 0.18); height: calc(min(100vw, 100vh) * 0.18); transform: translate(-50%, -50%); border-radius: 50%; border: 2px solid rgba(95, 212, 255, 0.75); pointer-events: none !important; box-shadow: 0 0 20px rgba(95, 212, 255, 0.3); }
.reticle::before, .reticle::after { content: ''; position: absolute; background: rgba(95, 212, 255, 0.7); }
.reticle::before { left: 50%; top: -14px; bottom: -14px; width: 1px; }
.reticle::after { top: 50%; left: -14px; right: -14px; height: 1px; }
#scanRing { position: absolute; inset: -6px; border-radius: 50%; background: conic-gradient(var(--good) calc(var(--p, 0) * 360deg), transparent 0); -webkit-mask: radial-gradient(circle, transparent 66%, #000 68%); mask: radial-gradient(circle, transparent 66%, #000 68%); }
.reticle.sq { border-radius: 8px; width: 46px; height: 46px; border-color: rgba(255, 176, 74, 0.85); box-shadow: 0 0 16px rgba(255, 176, 74, 0.4); }
.reticle.sq::before, .reticle.sq::after { background: rgba(255, 176, 74, 0.8); }
#pois { position: absolute; inset: 0; pointer-events: none !important; }
.poi { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; margin: -9px 0 0 -9px; transition: opacity 0.2s; }
.poi i { width: 18px; height: 18px; border: 2px solid #ffd84a; border-radius: 4px; transform: rotate(45deg); box-shadow: 0 0 10px rgba(255, 216, 74, 0.6); }
.poi span { font-size: 12px; font-weight: 700; color: #ffe9a6; white-space: nowrap; text-shadow: 0 1px 4px #000; }
.poi.done i { border-color: var(--good); background: rgba(70, 227, 154, 0.35); box-shadow: 0 0 10px rgba(70, 227, 154, 0.6); }
.poi.done span { color: #b8ffd8; }
.poi.off i { border-radius: 0; border: 0; width: 0; height: 0; border-left: 10px solid transparent; border-right: 10px solid transparent; border-bottom: 16px solid #ffd84a; transform-origin: 50% 60%; box-shadow: none; }
.poi.off.done i { border-bottom-color: var(--good); background: none; }
.scTop { position: absolute; left: 50%; top: calc(14px + var(--safe-t)); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; padding: 8px 16px; border-radius: 16px; background: var(--glass); border: 1px solid var(--line2); white-space: nowrap; }
.scTop span:last-child { color: var(--mute); font-size: 12.5px; }
.scBot { position: absolute; left: 50%; bottom: calc(18px + var(--safe-b)); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; width: min(420px, calc(100vw - 24px)); text-align: center; font-size: 13px; }
.scBot .btn { width: 100%; }
#scInfo { position: absolute; left: 50%; bottom: calc(118px + var(--safe-b)); transform: translateX(-50%); width: min(440px, calc(100vw - 24px)); padding: 12px 14px; border-radius: 16px; background: var(--glass); border: 1px solid rgba(70, 227, 154, 0.6); animation: up 0.25s ease-out; }
#scInfo b { color: #b8ffd8; }
#scInfo p { margin: 4px 0 0; font-size: 14px; }
#fireBtn { position: absolute; right: calc(22px + var(--safe-r)); bottom: calc(120px + var(--safe-b)); width: 92px; height: 92px; border-radius: 50%; border: 2px solid rgba(255, 176, 74, 0.9); background: radial-gradient(circle, rgba(255, 140, 40, 0.55), rgba(120, 40, 0, 0.6)); color: #fff; font: 900 15px var(--display); letter-spacing: 1px; touch-action: none; box-shadow: 0 0 30px rgba(255, 140, 40, 0.35); }
body:not(.touch) #fireBtn { display: none; }
#turretUI .scBot { bottom: calc(18px + var(--safe-b)); }

/* --- a card (the Lab, a mission result): a bottom sheet on a phone, a side panel on a wide screen */
.panel { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; max-height: 66vh; overflow: auto; padding: 8px 18px calc(18px + var(--safe-b)); background: var(--glass); border-top: 1px solid var(--line2); border-radius: 22px 22px 0 0; -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5); animation: up 0.28s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.panel .grab { width: 40px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.25); margin: 0 auto 10px; }
@media (min-width: 820px) and (min-aspect-ratio: 1/1) {
  .panel { left: auto; top: 76px; bottom: 16px; right: 16px; width: 420px; max-height: none; border-radius: 22px; border: 1px solid var(--line2); animation: side 0.28s ease-out; }
  .panel .grab { display: none; }
  @keyframes side { from { transform: translateX(40px); opacity: 0; } }
}
.cHead { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; border-bottom: 2px solid var(--acc); padding-bottom: 10px; margin-bottom: 8px; }
.cBody p { color: #dfe8f6; }
.badge { flex: none; width: 58px; height: 58px; border-radius: 50%; border: 3px double var(--acc); display: grid; place-items: center; color: var(--acc); font: 900 26px var(--display); animation: stamp 0.45s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes stamp { from { transform: rotate(-30deg) scale(2.2); opacity: 0; } }
.rewards { display: flex; gap: 10px; margin: 10px 0; }
.rewards div { flex: 1; padding: 12px; border-radius: 14px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); text-align: center; }
.rewards b { display: block; font: 900 30px var(--display); color: var(--gold); }
.rewards div + div b { color: var(--cyan); }
.rewards span { color: var(--mute); font-size: 12.5px; }
.qMsg { min-height: 22px; margin-top: 10px; font-weight: 600; }
.qMsg.good { color: #b8ffd8; } .qMsg.bad { color: #ffb0a0; }
.mxcBox { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-top: 10px; border-radius: 14px; background: rgba(240, 200, 104, 0.1); border: 1px solid rgba(240, 200, 104, 0.35); }
.mxcBox span { flex: 1; } .mxcBox.paid { border-color: var(--good); }
.mxc-coin { width: 20px; height: 20px; }
/* the spectrometer */
.specLbl { margin: 12px 0 6px; font-size: 11.5px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; color: var(--mute); }
.spec { position: relative; display: block; width: 100%; border: 1px solid var(--line2); border-radius: 12px; padding: 6px; background: rgba(0, 0, 0, 0.3); text-align: left; }
.spec .bars { position: relative; height: 30px; border-radius: 6px; background: linear-gradient(90deg, rgba(120, 0, 255, 0.12), rgba(0, 80, 255, 0.12), rgba(0, 200, 255, 0.12), rgba(0, 255, 120, 0.12), rgba(255, 255, 0, 0.12), rgba(255, 120, 0, 0.12), rgba(255, 0, 0, 0.12)); }
.spec .bars i { position: absolute; top: 0; bottom: 0; width: 3px; margin-left: -1.5px; background: var(--c); box-shadow: 0 0 8px var(--c); }
.spec span { display: block; margin-top: 5px; font-weight: 650; font-size: 13.5px; }
.specOpts { display: flex; flex-direction: column; gap: 8px; }
.spec.opt { cursor: pointer; }
.spec.opt.right { border-color: var(--good); background: rgba(70, 227, 154, 0.12); }
.spec.opt.wrong { border-color: var(--bad); background: rgba(255, 106, 106, 0.1); }

/* --- sheets */
body[data-phase=play] .screen { padding-top: calc(62px + var(--safe-t)); }
.screen { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: calc(16px + var(--safe-t)) 14px calc(16px + var(--safe-b)); background: rgba(0, 0, 0, 0.55); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.screen .card { width: 100%; max-width: 440px; max-height: 100%; overflow: auto; padding: 18px 20px 20px; border-radius: 22px; background: var(--glass); border: 1px solid var(--line2); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); animation: up 0.25s ease-out; }
.screen .card.wide { max-width: 580px; }
.shHead { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.x { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line2); background: rgba(255, 255, 255, 0.06); }
.navNow { margin-top: 10px; padding: 14px; border-radius: 16px; background: rgba(95, 212, 255, 0.08); border: 1px solid rgba(95, 212, 255, 0.35); }
.navNow b { display: block; font-size: 16px; } .navNow span { color: var(--mute); font-size: 13.5px; }
.navList { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.navRow { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04); }
.navRow > i { width: 12px; height: 12px; border-radius: 50%; background: var(--acc); box-shadow: 0 0 10px var(--acc); flex: none; }
.navRow > div { flex: 1; min-width: 0; } .navRow b { display: block; } .navRow span { color: var(--mute); font-size: 12.5px; }
.navRow.cur { border-color: var(--acc); background: color-mix(in srgb, var(--acc) 12%, transparent); }
.navRow.lock { opacity: 0.5; }
.sciBox { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 10px 14px; border-radius: 14px; background: rgba(95, 212, 255, 0.08); border: 1px solid rgba(95, 212, 255, 0.3); }
.sciBox b { font: 900 24px var(--display); color: var(--cyan); } .sciBox span { flex: 1; color: var(--mute); font-size: 13px; }
.mRow2 { margin-top: 10px; padding: 12px; border-radius: 16px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); border-left: 3px solid var(--acc); }
.mRow2.on { background: color-mix(in srgb, var(--acc) 10%, transparent); border-color: var(--acc); }
.mRow2.lock { opacity: 0.55; }
.mTop { display: flex; align-items: center; gap: 10px; }
.mTop > i { width: 10px; height: 10px; border-radius: 50%; background: var(--acc); flex: none; }
.mTop > div { flex: 1; min-width: 0; } .mTop b { display: block; font-size: 15.5px; } .mTop span { color: var(--mute); font-size: 12.5px; }
.mRow2 p { font-size: 13.5px; color: #cfdcef; margin: 8px 0 0; }
.tag { font-style: normal; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 99px; border: 1px solid var(--line2); color: var(--mute); white-space: nowrap; }
.tag.on { background: var(--acc); color: #05070c; border-color: var(--acc); }
.steps { margin: 10px 0 0; padding: 0 0 0 4px; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.steps li { position: relative; padding-left: 24px; font-size: 13.5px; color: var(--faint); }
.steps li::before { content: ''; position: absolute; left: 2px; top: 4px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--faint); }
.steps li.done { color: var(--mute); text-decoration: line-through; } .steps li.done::before { background: var(--good); border-color: var(--good); }
.steps li.cur { color: #fff; font-weight: 650; } .steps li.cur::before { border-color: #ffd84a; box-shadow: 0 0 8px #ffd84a; }
.upRow { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.upRow > div:first-child { flex: 1; min-width: 0; } .upRow b { display: block; } .upRow span { display: block; color: var(--mute); font-size: 12.5px; }
.upRow .nx { color: #cfdcef; margin-top: 2px; } .upRow .nx b { display: inline; }
.pips { display: flex; gap: 3px; } .pips i { width: 8px; height: 8px; border-radius: 2px; background: rgba(255, 255, 255, 0.15); } .pips i.on { background: var(--cyan); }
#mapCv { width: 100%; height: auto; aspect-ratio: 640 / 560; border-radius: 16px; margin-top: 10px; background: #05070c; }
.mapList { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; }
.mRow { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04); text-align: left; }
.mRow i { width: 10px; height: 10px; border-radius: 50%; background: var(--acc); flex: none; }
.mRow b { flex: 1; font-size: 13.5px; }
.mRow span { color: var(--gold); font-weight: 700; font-size: 13px; }
.tourBox { margin-top: 10px; padding: 12px 14px; border-radius: 16px; background: rgba(95, 212, 255, 0.08); border: 1px solid rgba(95, 212, 255, 0.35); }
.tourBox b { display: block; } .tourBox span { color: var(--mute); font-size: 13.5px; }
.tourBox .btns { margin-top: 10px; }
.pSec { margin: 16px 0 6px; font-size: 11.5px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; color: var(--mute); }
.pRow { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.pRow > i { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--faint); }
.pRow > i.on { background: var(--good); box-shadow: 0 0 8px var(--good); }
.pRow > div { flex: 1; min-width: 0; }
.pRow b { display: block; overflow: hidden; text-overflow: ellipsis; }
.pRow span { display: block; color: var(--mute); font-size: 12.5px; }

/* --- toasts and notes */
#toast { position: fixed; left: 50%; top: calc(104px + var(--safe-t)); transform: translate(-50%, -12px); z-index: 70; max-width: min(520px, calc(100vw - 32px)); padding: 10px 16px; border-radius: 14px; background: var(--glass); border: 1px solid rgba(95, 212, 255, 0.45); font-weight: 600; font-size: 14px; text-align: center; opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
#note { position: fixed; left: 50%; top: calc(150px + var(--safe-t)); transform: translateX(-50%); z-index: 71; width: min(440px, calc(100vw - 24px)); padding: 12px 14px; border-radius: 16px; background: var(--glass); border: 1px solid rgba(95, 212, 255, 0.6); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5); animation: up 0.25s ease-out; }
.nTxt span { color: var(--mute); font-size: 13.5px; }
.nBtns { display: flex; gap: 8px; margin-top: 10px; }
@media (max-width: 560px) { #toast { top: auto; bottom: calc(150px + var(--safe-b)); } #note { top: calc(178px + var(--safe-t)); } }

/* --- random events: the banner, the alarm, the flare, the guide arrow */
#evBanner { position: fixed; left: 50%; top: calc(56px + var(--safe-t)); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; padding: 7px 16px; border-radius: 14px; background: rgba(40, 6, 8, 0.88); border: 1px solid #ff5a4a; box-shadow: 0 0 24px rgba(255, 70, 50, 0.35); white-space: nowrap; pointer-events: none !important; animation: pop2 0.3s; }
#evBanner b { font: 900 13px var(--display); letter-spacing: 1.4px; color: #ff9a8a; text-transform: uppercase; }
#evBanner span { font-size: 13px; font-weight: 650; }
#evBanner.ev-comet, #evBanner.ev-fault { background: rgba(6, 18, 34, 0.9); border-color: var(--cyan); box-shadow: 0 0 24px rgba(95, 212, 255, 0.3); }
#evBanner.ev-comet b, #evBanner.ev-fault b { color: #9fe8ff; }
#evBanner.done { background: rgba(6, 30, 18, 0.9); border-color: var(--good); box-shadow: none; }
#evBanner.done b { color: #b8ffd8; }
@keyframes pop2 { from { transform: translateX(-50%) scale(0.85); opacity: 0; } }
body[data-mode=eva] #evBanner { top: calc(96px + var(--safe-t)); }
#alarm { position: fixed; inset: 0; z-index: 12; pointer-events: none; opacity: 0; background: radial-gradient(ellipse at center, transparent 45%, rgba(255, 20, 10, 0.55) 100%); }
#flare { position: fixed; inset: 0; z-index: 12; pointer-events: none; opacity: 0; background: radial-gradient(circle at 75% 20%, #fff6e0, rgba(255, 170, 80, 0.6) 40%, rgba(255, 120, 40, 0.25)); mix-blend-mode: screen; }
#flash { position: fixed; inset: 0; z-index: 36; pointer-events: none; opacity: 0; background: #fff; }
#flash.on { animation: flash 1.2s ease-out; }
@keyframes flash { 0% { opacity: 0.9; } 100% { opacity: 0; } }
body[data-ui=ext] #useBtn, body[data-ui=ext] #tracker { display: none !important; }
body[data-ui=ext] #viewBtn { background: var(--cyan); }
body[data-ui=ext] #viewBtn svg { fill: #05070c; }
.poi.comet i { border-color: #9fe8ff; box-shadow: 0 0 12px rgba(159, 232, 255, 0.8); }
.poi.comet span { color: #cdf4ff; }
@media (max-width: 560px) {
  #evBanner { top: calc(104px + var(--safe-t)); }
  body.evlive #tracker { display: none; }
  body[data-mode=eva] #evBanner { top: calc(140px + var(--safe-t)); }
}

/* the logbook */
.lgSum { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 4px 0 10px; }
.lgSum > div { padding: 10px 6px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); text-align: center; }
.lgSum b { display: block; font-size: 20px; color: var(--gold); }
.lgSum span { font-size: 11.5px; color: #9fb0c8; }
.lgHead { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 4px; }
.lgHead span { font-size: 12.5px; color: #9fb0c8; font-weight: 700; }
.lgItem { font-size: 13.5px; padding: 6px 0; border-top: 1px solid var(--line); }
.lgItem summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; font-weight: 600; }
.lgItem summary::-webkit-details-marker { display: none; }
.lgItem i { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--acc); }
.lgItem.off { color: #7f8ea6; display: flex; align-items: center; gap: 8px; }
.lgItem.off i { background: transparent; border: 1px solid #56627a; }
.lgItem p { margin: 6px 0 2px 16px; color: #cfdcef; font-size: 13px; }
@media (max-width: 520px) { .lgSum { grid-template-columns: repeat(2, 1fr); } }
body.sheeton #note { display: none; }
/* on a phone the toast sits low, over a sheet's or a card's buttons: lift it to the top while one is open */
@media (max-width: 560px) { body.sheeton #toast, body[data-ui="card"] #toast { top: calc(14px + var(--safe-t)); bottom: auto; } }
/* a phone on its side (short and wide): fit the title card, keep the event banner clear of the mission tracker */
@media (max-height: 520px) {
  #title { align-items: flex-start; overflow-y: auto; padding-top: calc(var(--mdts-h, 52px) + 10px); padding-bottom: calc(12px + var(--safe-b)); }
  .tLogo { font-size: 34px; margin: 2px 0 6px; }
  .tTag { font-size: 13.5px; margin-bottom: 10px; }
  .tKick, .tTag { display: none; }
  .tRuns { max-height: none; overflow: visible; }
  .tCard { max-width: 560px; display: flex; flex-direction: column; }
  .tLogo { order: -2; }
  #title .btns { order: -1; margin: 0 0 10px; }
  #title .btn.big { min-height: 44px; }
  body.sheeton #toast, body[data-ui="card"] #toast { top: calc(10px + var(--safe-t)); bottom: auto; }
  .scBot .muted { text-shadow: 0 1px 6px #000, 0 0 2px #000; color: #dfe8f5; }
}
@media (max-height: 520px) and (min-width: 561px) {
  #evBanner, body[data-mode=eva] #evBanner { left: auto; right: calc(76px + var(--safe-r)); transform: none; top: calc(60px + var(--safe-t)); }
}
@media (max-height: 520px) { #toast { top: auto; bottom: calc(16px + var(--safe-b)); } }

/* phones: the page never zooms or bounces; the right of the screen is kept free for looking round. The small
   buttons sit in the top-right corner under the menu, jump right down in the bottom corner, the laser's FIRE on
   the left (the right thumb aims), and waving is in the Crew sheet */
html, body { overscroll-behavior: none; touch-action: manipulation; }
button { touch-action: manipulation; }
#controls, #controls button, #hud .hb, #useBtn, #fireBtn { touch-action: none; }
body.touch .hSide { top: calc(64px + var(--safe-t)); bottom: auto; right: calc(10px + var(--safe-r)); gap: 8px; }
body.touch .hSide .hb.sm { width: 42px; height: 42px; }
body.touch #waveBtn { display: none; }
body.touch #tracker { max-width: calc(100vw - 96px - var(--safe-l) - var(--safe-r)); }
body.touch #skipBtn { top: calc(166px + var(--safe-t)); right: calc(10px + var(--safe-r)); }
body.touch #upBtn, body.touch #downBtn { right: calc(16px + var(--safe-r)); width: 64px; height: 64px; }
body.touch #upBtn { bottom: calc(92px + var(--safe-b)); }
body.touch #downBtn { bottom: calc(18px + var(--safe-b)); }
body.touch[data-mode=walk] #upBtn { bottom: calc(18px + var(--safe-b)); }
body.touch #fireBtn { right: auto; left: calc(22px + var(--safe-l)); }

/* =====================================================================
   3.0: the ship's chips, goals, flying a landing, the star map, the new sheets
   ===================================================================== */
/* fuel, hull and the hold, under the shell's buttons (tap for the refinery or the hold) */
#chips { position: fixed; left: calc(12px + var(--safe-l)); top: calc(62px + var(--safe-t)); display: flex; gap: 6px; }
.chip { position: relative; display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 11px 0 9px; border-radius: 99px; border: 1px solid var(--line2); background: var(--glass); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); overflow: hidden; font-size: 12.5px; }
.chip svg { width: 15px; height: 15px; fill: var(--cyan); }
.chip b { font-weight: 750; min-width: 20px; text-align: left; }
.chip u { position: absolute; left: 9px; right: 9px; bottom: 3px; height: 2px; border-radius: 1px; background: rgba(255, 255, 255, 0.1); }
.chip u i { display: block; height: 100%; width: 0; background: var(--cyan); }
#chFuel svg { fill: var(--gold); } #chFuel u i { background: var(--gold); }
#chHull svg { fill: var(--good); } #chHull u i { background: var(--good); }
.chip.low { border-color: var(--bad); } .chip.low svg { fill: var(--bad); } .chip.low u i { background: var(--bad); }
/* the goals on screen */
#tracker { top: calc(102px + var(--safe-t)); display: flex; flex-direction: column; gap: 9px; color: inherit; }
#tracker:empty { display: none; }
.tg { display: block; }
.tg .kick { color: #ffd84a; font-size: 10.5px; letter-spacing: 1.2px; }
.tg b { display: block; font-size: 13.5px; font-weight: 650; line-height: 1.3; }
.tg u { display: block; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.12); margin-top: 5px; }
.tg u i { display: block; height: 100%; border-radius: 2px; background: var(--good); }
#toast.good { border-color: rgba(240, 200, 104, 0.7); color: #ffe9a6; }
.mst { font-style: normal; font-size: 10.5px; font-weight: 800; color: var(--goldInk); background: var(--gold); border-radius: 99px; padding: 2px 8px; margin-left: 6px; vertical-align: middle; letter-spacing: 0.4px; }
@media (max-width: 560px) {
  #chips { top: calc(100px + var(--safe-t)); left: 50%; transform: translateX(-50%); }
  #tracker { top: calc(140px + var(--safe-t)); }
  #tracker .tg + .tg { display: none; }
  #o2 { top: calc(140px + var(--safe-t)); }
  body.out #tracker { top: calc(180px + var(--safe-t)); }
}

/* flying a landing: readouts along the top, the radar, AUTOPILOT and a big THRUST button (the stick steers) */
#flyUI { position: fixed; inset: 0; z-index: 22; pointer-events: none; }
#flyUI > * { pointer-events: auto; }
.flyTop { position: fixed; left: 50%; top: calc(58px + var(--safe-t)); transform: translateX(-50%); display: flex; gap: 4px; padding: 6px; border-radius: 16px; background: var(--glass); border: 1px solid var(--line2); }
.fr { min-width: 80px; padding: 3px 10px; text-align: center; }
.fr span { display: block; font-size: 10px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--mute); white-space: nowrap; }
.fr b { font: 800 17px var(--display); white-space: nowrap; }
#flyVsBox.ok b { color: var(--good); } #flyVsBox.warn b { color: #ffd84a; } #flyVsBox.bad b { color: var(--bad); }
.fr.fuel b { display: block; width: 70px; height: 8px; margin: 8px auto 0; border-radius: 4px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.fr.fuel i { display: block; height: 100%; background: var(--gold); }
#flyAdv { position: fixed; left: 50%; top: calc(126px + var(--safe-t)); transform: translateX(-50%); padding: 6px 14px; border-radius: 99px; background: rgba(5, 8, 14, 0.78); font-weight: 700; font-size: 14px; white-space: nowrap; }
#flyRadar { position: fixed; right: calc(20px + var(--safe-r)); top: calc(66px + var(--safe-t)); width: 112px; height: 112px; border-radius: 50%; border: 1px solid rgba(95, 212, 255, 0.5); background: radial-gradient(circle, rgba(95, 212, 255, 0.14), rgba(5, 8, 14, 0.75) 70%); pointer-events: none !important; }
#flyRadar::before { content: ''; position: absolute; inset: 30%; border-radius: 50%; border: 1px dashed rgba(95, 212, 255, 0.35); }
#flyRadar u { position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px; border-radius: 50%; background: #fff; box-shadow: 0 0 8px #fff; }
#flyPad { position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px; border-radius: 50%; border: 2px solid var(--good); box-shadow: 0 0 10px var(--good); }
#flyThrust { position: fixed; right: calc(24px + var(--safe-r)); bottom: calc(28px + var(--safe-b)); width: 124px; height: 124px; border-radius: 50%; border: 2px solid rgba(255, 176, 74, 0.9); background: radial-gradient(circle, rgba(255, 140, 40, 0.3), rgba(5, 8, 14, 0.78)); font: 900 15px var(--display); letter-spacing: 1px; color: #ffd9a0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; touch-action: none; }
#flyThrust.on { background: radial-gradient(circle, rgba(255, 180, 70, 0.9), rgba(255, 100, 20, 0.45)); color: #fff; box-shadow: 0 0 34px rgba(255, 140, 40, 0.6); }
#flyAuto { position: fixed; right: calc(162px + var(--safe-r)); bottom: calc(66px + var(--safe-b)); height: 46px; padding: 0 16px; border-radius: 99px; border: 1px solid rgba(95, 212, 255, 0.6); background: rgba(5, 8, 14, 0.8); font: 800 13px var(--display); letter-spacing: 1px; color: #cdeeff; display: flex; align-items: center; gap: 8px; }
#flyAuto.on { background: var(--cyan); color: #05070c; }
#flyUI kbd { font: 700 10px var(--font); border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; opacity: 0.7; letter-spacing: 0; }
body.touch #flyUI kbd { display: none; }
body[data-ui=fly] #tracker, body[data-ui=fly] .hSide, body[data-ui=fly] #useBtn, body[data-ui=fly] #chips, body[data-ui=fly] #evBanner { display: none !important; }
@media (max-width: 560px) {
  .flyTop { top: calc(100px + var(--safe-t)); width: calc(100vw - 20px); justify-content: space-between; }
  .fr { min-width: 0; padding: 3px 3px; } .fr b { font-size: 13.5px; } .fr span { font-size: 9px; } .fr.fuel b { width: 44px; }
  #flyAdv { top: calc(166px + var(--safe-t)); font-size: 12.5px; max-width: calc(100vw - 24px); overflow: hidden; text-overflow: ellipsis; }
  #flyRadar { top: auto; bottom: calc(168px + var(--safe-b)); width: 92px; height: 92px; }
  #flyThrust { width: 112px; height: 112px; right: calc(16px + var(--safe-r)); bottom: calc(22px + var(--safe-b)); }
  #flyAuto { right: auto; left: 50%; transform: translateX(-50%); bottom: calc(160px + var(--safe-b)); }
}

/* the star map's panel: views along the top, the picked world's card */
#holoUI { position: fixed; left: 50%; bottom: calc(14px + var(--safe-b)); transform: translateX(-50%); z-index: 26; width: min(520px, calc(100vw - 20px)); }
.hoTabs { display: flex; gap: 6px; margin-bottom: 8px; }
.hoTabs button { flex: none; height: 36px; padding: 0 14px; border-radius: 99px; border: 1px solid rgba(95, 212, 255, 0.45); background: rgba(5, 8, 14, 0.82); font-weight: 700; font-size: 13px; color: #cdeeff; }
.hoTabs button.on { background: var(--cyan); color: #05070c; }
.hoTabs .x { margin-left: auto; width: 36px; padding: 0; }
.hoCard { padding: 12px 14px; border-radius: 18px; background: var(--glass); border: 1px solid rgba(95, 212, 255, 0.35); box-shadow: 0 0 30px rgba(95, 212, 255, 0.12); max-height: 42vh; overflow: auto; }
.hoCard > b { display: block; font-size: 17px; }
.hoCard .sub { display: block; color: var(--mute); font-size: 13px; }
.hoCard p { font-size: 13.5px; color: #dfe8f6; }
.hoCard .btns { margin-top: 10px; align-items: center; }
.hoBar { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.1); overflow: hidden; margin: 8px 0 4px; }
.hoBar i { display: block; height: 100%; background: linear-gradient(90deg, var(--cyan), var(--good)); }
.hoBar.big { height: 10px; border-radius: 5px; margin: 10px 0; }
.hoRes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.hoRes span { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); font-size: 12px; font-weight: 650; }
.hoRes i { width: 8px; height: 8px; border-radius: 50%; background: var(--rc, #9fb0c8); }

/* sheets: goals, cargo, the refinery, the fabricator's costs, the logbook's sites */
.gRow { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.gRow > div { flex: 1; min-width: 0; }
.gRow b { display: block; font-size: 14px; font-weight: 650; }
.gRow u { display: block; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.1); margin: 6px 0 2px; }
.gRow u i { display: block; height: 100%; border-radius: 2px; background: var(--good); }
.gRow span { font-size: 12px; color: var(--mute); }
.gRow.on b { color: #ffe9a6; }
.pin { flex: none; height: 32px; padding: 0 13px; border-radius: 99px; border: 1px solid var(--line2); background: rgba(255, 255, 255, 0.05); font-size: 12.5px; font-weight: 700; color: var(--mute); }
.pin.on { background: var(--gold); border-color: var(--gold); color: var(--goldInk); }
.resRow { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.resRow > i { flex: none; width: 11px; height: 11px; border-radius: 2px; background: var(--rc); box-shadow: 0 0 8px var(--rc); transform: rotate(45deg); margin: 0 3px; }
.resRow > div { flex: 1; min-width: 150px; }
.resRow b { display: block; } .resRow b em { font-style: normal; color: var(--gold); margin-left: 4px; }
.resRow span { display: block; color: var(--mute); font-size: 12.5px; }
.shipBars { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 4px; }
.shipBars > div { display: flex; align-items: center; gap: 10px; }
.shipBars span { width: 42px; font-size: 11.5px; font-weight: 800; color: var(--mute); text-transform: uppercase; letter-spacing: 1px; }
.shipBars b { flex: 1; height: 10px; border-radius: 5px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.shipBars b i { display: block; height: 100%; background: var(--gold); } .shipBars b.hull i { background: var(--good); }
.shipBars em { font-style: normal; width: 74px; text-align: right; font-weight: 700; font-size: 13px; }
.costs { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.cost { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 99px; border: 1px solid rgba(255, 106, 106, 0.45); font-size: 12px; font-weight: 650; color: #ffc4c4; }
.cost i { width: 7px; height: 7px; border-radius: 50%; background: var(--rc, var(--cyan)); }
.cost small { color: var(--mute); font-weight: 600; margin-left: 3px; } .cost small::before { content: '· have '; }
.cost.ok { border-color: rgba(70, 227, 154, 0.5); color: #c8ffe2; }
.lgSite { display: flex; justify-content: space-between; align-items: baseline; margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line2); font-size: 13.5px; }
.lgSite span { color: var(--mute); font-size: 12px; } .lgSite.off { opacity: 0.55; }
.lgRes { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0 2px; }
.lgRes span { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line); font-size: 12px; color: #7f8ea6; }
.lgRes span.on { color: #fff; border-color: var(--rc); }
.lgRes i { width: 7px; height: 7px; border-radius: 50%; background: var(--rc); opacity: 0.4; } .lgRes span.on i { opacity: 1; }
/* phones: keep the messages and the outside hints clear of the stick and the landing buttons */
@media (max-width: 560px) {
  body.touch:not(.sheeton):not([data-ui=card]):not([data-ui=fly]) #toast { bottom: calc(262px + var(--safe-b)); }
  body.touch #evaHint { bottom: calc(184px + var(--safe-b)); }
  body.touch #o2Warn { bottom: calc(222px + var(--safe-b)); }
  body[data-ui=fly] #toast { top: calc(204px + var(--safe-t)); bottom: auto; }
}

/* --- MD-2, the ship's droid: its speech bubble and the talk panel (droid.js) */
#droidSay { position: fixed; left: 0; top: 0; z-index: 19; max-width: min(260px, 70vw); padding: 7px 11px; border-radius: 14px 14px 14px 4px; background: rgba(8, 14, 26, 0.9); border: 1px solid rgba(95, 212, 255, 0.55); color: #e6f6ff; font-size: 13px; font-weight: 600; line-height: 1.3; pointer-events: none; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4); margin-top: -8px; }
#droidSay.zzz { background: none; border: 0; box-shadow: none; color: #9fd8ff; font: 800 15px var(--display); letter-spacing: 3px; animation: dZzz 2.4s ease-in-out infinite; }
@keyframes dZzz { 0%, 100% { opacity: 0.35; margin-top: -4px; } 50% { opacity: 1; margin-top: -14px; } }
#droidUI { position: fixed; z-index: 30; left: calc(14px + var(--safe-l)); bottom: calc(14px + var(--safe-b)); width: min(380px, calc(100vw - 28px)); max-height: min(520px, 62vh); display: flex; flex-direction: column; border-radius: 18px; background: var(--glass); border: 1px solid rgba(95, 212, 255, 0.4); box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); overflow: hidden; }
#droidUI header { display: flex; align-items: center; gap: 10px; padding: 10px 10px 8px 12px; border-bottom: 1px solid var(--line); }
#droidUI header > div { flex: 1; min-width: 0; }
#droidUI header b { display: block; font: 800 15px var(--display); letter-spacing: 1.5px; color: var(--cyan); }
#dStatus { display: block; font-size: 12px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dFace { flex: none; width: 34px; height: 34px; border-radius: 50%; background: radial-gradient(circle at 50% 38%, #5fd4ff 0 4px, #2a2f38 5px 8px, transparent 9px), linear-gradient(180deg, #d6dce5 0 52%, #1f5fd6 52% 60%, #f2f4f8 60%); border: 1px solid rgba(255, 255, 255, 0.4); }
#dBat { display: flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; color: var(--mute); }
#dBat u { position: relative; width: 30px; height: 13px; border: 1.5px solid #9fd8ff; border-radius: 3px; text-decoration: none; }
#dBat u::after { content: ''; position: absolute; right: -4px; top: 3px; width: 2px; height: 5px; background: #9fd8ff; border-radius: 0 1px 1px 0; }
#dBat i { position: absolute; left: 1px; top: 1px; bottom: 1px; width: 100%; max-width: calc(100% - 2px); background: var(--good); border-radius: 1px; }
#dBat.low i { background: var(--bad); } #dBat.low u { border-color: var(--bad); }
.dX { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line2); background: rgba(255, 255, 255, 0.04); font-size: 20px; line-height: 1; }
#dLog { flex: 1; min-height: 90px; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; -webkit-user-select: text; user-select: text; overscroll-behavior: contain; }
#dLog p { margin: 0; max-width: 85%; padding: 7px 11px; border-radius: 14px; font-size: 14px; line-height: 1.35; word-wrap: break-word; }
#dLog .droid { align-self: flex-start; background: rgba(95, 212, 255, 0.12); border: 1px solid rgba(95, 212, 255, 0.25); border-bottom-left-radius: 4px; }
#dLog .me { align-self: flex-end; background: rgba(240, 200, 104, 0.16); border: 1px solid rgba(240, 200, 104, 0.3); border-bottom-right-radius: 4px; }
#dLog .sys { align-self: center; max-width: 100%; font-size: 12px; color: var(--mute); text-align: center; padding: 2px 6px; }
#dLog .typing { display: flex; gap: 4px; padding: 10px 12px; }
#dLog .typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); animation: dDot 1s infinite; }
#dLog .typing i:nth-child(2) { animation-delay: 0.15s; } #dLog .typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes dDot { 0%, 100% { opacity: 0.25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }
#dChips { display: flex; gap: 6px; padding: 0 10px 8px; overflow-x: auto; scrollbar-width: none; }
#dChips::-webkit-scrollbar { display: none; }
#dChips button { flex: none; padding: 6px 11px; border-radius: 14px; border: 1px solid rgba(95, 212, 255, 0.35); background: rgba(95, 212, 255, 0.08); color: #cdeeff; font-size: 12.5px; font-weight: 600; }
#dForm { display: flex; gap: 6px; padding: 8px 10px 10px; border-top: 1px solid var(--line); }
#dIn { flex: 1; min-width: 0; height: 42px; padding: 0 13px; border-radius: 21px; border: 1px solid var(--line2); background: rgba(255, 255, 255, 0.06); color: var(--ink); font: 16px var(--font); outline: none; }
#dIn:focus { border-color: rgba(95, 212, 255, 0.6); }
#dForm button { flex: none; width: 42px; height: 42px; border-radius: 50%; border: 1px solid rgba(95, 212, 255, 0.45); background: rgba(95, 212, 255, 0.14); display: grid; place-items: center; }
#dForm button svg { width: 20px; height: 20px; fill: #cdeeff; }
#dSend { background: linear-gradient(180deg, var(--gold2), var(--gold)) !important; border-color: rgba(255, 230, 160, 0.7) !important; }
#dSend svg { fill: var(--goldInk) !important; }
#dMic.on { background: rgba(255, 90, 74, 0.35); border-color: var(--bad); animation: dDot 1s infinite; }
#dNote { margin: 0; padding: 0 12px 10px; font-size: 12px; color: var(--mute); }
#dNote:empty { display: none; }
#dNote .link { padding: 0; font-size: 12px; }
body[data-ui=talk] #useBtn, body[data-ui=talk] #tracker { display: none !important; }
body.touch #droidUI { left: calc(8px + var(--safe-l)); right: calc(8px + var(--safe-r)); width: auto; bottom: calc(8px + var(--safe-b)); max-height: 56vh; }
@media (max-height: 520px) { #droidUI { max-height: calc(100vh - 70px); } }

/* the status card (v3.15): oxygen, the city's bots and your suit's power as rows of one small card, not a stack of
   pills. Each row: a label, a bar, a value */
#statPanel { position: fixed; left: calc(12px + var(--safe-l)); top: calc(102px + var(--safe-t)); width: min(300px, calc(100vw - 108px - var(--safe-l) - var(--safe-r))); display: flex; flex-direction: column; gap: 4px; padding: 7px 12px; border-radius: 14px; background: var(--glass); border: 1px solid var(--line2); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); pointer-events: none !important; }
#statPanel:has(#o2.low), #statPanel:has(#hp.low) { border-color: var(--bad); }
#statPanel #o2, #hp, #cityHud { position: static; transform: none; display: grid; grid-template-columns: 62px 1fr 56px; align-items: center; gap: 8px; padding: 0; margin: 0; background: none; border: none; border-radius: 0; font: 800 10px var(--display); letter-spacing: 0.8px; white-space: nowrap; animation: none; box-shadow: none; }
#statPanel #o2 b, #hp b, #cityHud u { display: block; width: auto; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
#statPanel #o2 em, #hp em, #cityKills { font-style: normal; color: var(--mute); text-align: right; }
#statPanel #o2.low #o2Lbl, #statPanel #o2.low em, #hp.low span, #hp.low em { color: var(--bad); animation: blink 0.9s infinite; }
#hp i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #ffb04a, #9fe8ff); transition: width 0.15s; }
#hp.low i { background: var(--bad); }
#cityBox { display: contents; }
#cityHud b { color: #ff8a7a; }
#cityHud u i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #ff5a4a, #ffb04a); transition: width 0.25s; }
#cityBox.open #cityHud b, #cityBox.open #cityKills { color: #ffd84a; animation: blink 1.4s infinite; }
#cityBox.won #cityHud b, #cityBox.won #cityKills { color: var(--good); }
#cityBox.open #cityHud u i, #cityBox.won #cityHud u i { background: linear-gradient(90deg, #ffd84a, #9fe8ff); }
/* the goal card shrinks to one line a few seconds after it changes (tap it for the goals board) */
#tracker.mini { padding: 6px 11px; gap: 0; }
#tracker.mini .kick, #tracker.mini .tg + .tg { display: none; }
#tracker.mini .tg b { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: min(250px, calc(100vw - 150px)); }
#tracker.mini .tg u { margin-top: 3px; }
#hurtVig { position: fixed; inset: 0; z-index: 4; pointer-events: none !important; opacity: 0; background: radial-gradient(ellipse at center, transparent 45%, rgba(255, 20, 10, 0.7)); }
#hurtVig.on { animation: hurt 0.55s ease-out; }
@keyframes hurt { 0% { opacity: 1; } 100% { opacity: 0; } }
#blastBtn { position: fixed; display: none; right: calc(16px + var(--safe-r)); bottom: calc(96px + var(--safe-b)); width: 86px; height: 86px; border-radius: 50%; border: 2px solid rgba(159, 232, 255, 0.9); background: radial-gradient(circle, rgba(95, 212, 255, 0.45), rgba(10, 40, 70, 0.7)); color: #fff; font: 900 13px var(--display); letter-spacing: 1px; pointer-events: auto; touch-action: none; box-shadow: 0 0 26px rgba(95, 212, 255, 0.35); flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
#blastBtn svg { width: 26px; height: 26px; fill: #fff; }
#blastBtn:active { transform: scale(0.94); background: radial-gradient(circle, rgba(159, 232, 255, 0.8), rgba(10, 60, 100, 0.8)); }
body.touch.city #blastBtn { display: flex; }
.navRow.city b::after { content: 'BATTLE'; margin-left: 8px; font: 800 9.5px var(--display); letter-spacing: 1px; color: #ff8a7a; border: 1px solid rgba(255, 90, 74, 0.6); border-radius: 99px; padding: 1px 7px; vertical-align: middle; }
/* (v3.16) the chips, status card and goal card are one column down the left (app.js layoutHud stacks them); on a
   phone it starts under the place's name, clear of the buttons down the right */
@media (max-width: 560px) {
  #chips { left: calc(12px + var(--safe-l)); transform: none; }
  #locPill { max-width: calc(100vw - 140px); }
  #tracker { max-width: calc(100vw - 108px - var(--safe-l) - var(--safe-r)); }
  #tracker b, .tg b { font-size: 13px; }
}

/* the cargo hold (v3.19): each resource with a keep / spare bar and buttons for 1, 10, the spare or all */
.cgKey { display: flex; align-items: center; gap: 6px 16px; flex-wrap: wrap; margin: 10px 0 4px; color: var(--mute); font-size: 12.5px; }
.cgKey span { display: inline-flex; align-items: center; gap: 6px; }
.cgKey i { width: 14px; height: 6px; border-radius: 3px; display: inline-block; } .cgKey i.k { background: #5fd4ff; } .cgKey i.s { background: #ffd84a; }
.cgRow { padding: 12px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.cgTop { display: flex; align-items: baseline; gap: 8px; }
.cgTop > i { flex: none; width: 11px; height: 11px; border-radius: 2px; background: var(--rc); box-shadow: 0 0 8px var(--rc); transform: rotate(45deg) translateY(-1px); margin: 0 3px; }
.cgTop b { font-size: 15px; } .cgTop em { font-style: normal; font: 800 16px var(--display); color: var(--gold); margin-left: auto; } .cgTop small { color: var(--mute); font-size: 11.5px; }
.cgBar { position: relative; display: flex; height: 7px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); overflow: visible; }
.cgBar u { display: block; height: 100%; background: #5fd4ff; border-radius: 4px 0 0 4px; } .cgBar s { display: block; height: 100%; background: #ffd84a; }
.cgBar u:only-child, .cgBar s:last-child { border-radius: 0 4px 4px 0; }
.cgBar b { position: absolute; top: -3px; width: 2px; height: 13px; background: #fff; border-radius: 1px; transform: translateX(-1px); }
.cgWhy { color: var(--mute); font-size: 12.5px; } .cgWhy.short { color: #ffcf8a; }
.cgBtns { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cgBtns > span { color: var(--mute); font-size: 12px; font-weight: 700; margin-right: 2px; }
.cgBtns .btn { min-width: 44px; }

/* the fabricator (v3.19): a card per upgrade, you have > next, costs as have / need bars */
.upGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 10px; margin-top: 8px; }
.upCard { display: flex; flex-direction: column; gap: 10px; padding: 13px 14px; border-radius: 16px; background: rgba(255, 255, 255, 0.035); border: 1px solid var(--line); }
.upCard.ready { border-color: rgba(240, 200, 104, 0.65); background: linear-gradient(180deg, rgba(240, 200, 104, 0.09), rgba(255, 255, 255, 0.03)); box-shadow: 0 0 22px rgba(240, 200, 104, 0.08); }
.upCard.max { opacity: 0.8; }
.ucHead { display: flex; align-items: center; gap: 8px; } .ucHead b { font-size: 15.5px; }
.ucLv { margin-left: auto; color: var(--mute); font-size: 11.5px; font-weight: 700; letter-spacing: 0.3px; }
.upCard.ready .ucLv { color: var(--gold); }
.ucPair { display: flex; align-items: stretch; gap: 8px; }
.ucNow, .ucNext { flex: 1; min-width: 0; padding: 8px 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); display: flex; flex-direction: column; gap: 2px; }
.ucNext { background: rgba(95, 212, 255, 0.08); border: 1px solid rgba(95, 212, 255, 0.28); }
.upCard.ready .ucNext { background: rgba(240, 200, 104, 0.1); border-color: rgba(240, 200, 104, 0.45); }
.ucPair .lbl { font: 800 9.5px var(--display); letter-spacing: 1.1px; text-transform: uppercase; color: var(--mute); }
.ucNext .lbl { color: var(--cyan); } .upCard.ready .ucNext .lbl { color: var(--gold); }
.ucPair b { font-size: 13.5px; } .ucPair span:not(.lbl) { color: #cfdcef; font-size: 12px; line-height: 1.35; }
.ucArrow { align-self: center; color: var(--mute); font-size: 20px; font-weight: 300; }
.ucCosts { display: flex; flex-direction: column; gap: 5px; }
.ucCost { display: grid; grid-template-columns: 10px 84px 1fr 64px; align-items: center; gap: 8px; font-size: 12.5px; }
.ucCost i { width: 8px; height: 8px; border-radius: 2px; background: var(--rc); transform: rotate(45deg); }
.ucCost span { color: #cfdcef; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ucCost u { display: block; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.09); overflow: hidden; } .ucCost u b { display: block; height: 100%; background: #ff8a6a; border-radius: 3px; }
.ucCost.ok u b { background: var(--good); }
.ucCost em { font-style: normal; text-align: right; color: #ffc4c4; font-weight: 700; } .ucCost.ok em { color: #c8ffe2; }
.ucBuild { width: 100%; } .ucBuild:disabled { opacity: 1; color: var(--mute); }
.ucDone { color: var(--good); font-size: 12.5px; margin: 0; }
@media (max-width: 420px) { .ucPair { flex-direction: column; } .ucArrow { display: none; } }
@media (max-width: 420px) { .cgBtns > span { width: 100%; } .cgBtns .btn { flex: 1; min-width: 0; padding-left: 6px; padding-right: 6px; } }
