/* Lone Orbit: dark holographic bridge. Own visual language, glass panels, cyan data, amber command, red alert. */
:root {
  --bg: #04070b; --glass: rgba(12, 22, 31, .72); --glass-2: rgba(18, 32, 44, .8);
  --line: rgba(110, 210, 255, .16); --line-2: rgba(110, 210, 255, .32);
  --ink: #d5e5ee; --muted: #6d8796; --cyan: #5fe0ff; --amber: #ffb347; --red: #ff4d5e; --green: #5effa8;
  --head: "Chakra Petch", "Segoe UI", sans-serif; --body: "Chakra Petch", "Segoe UI", sans-serif; --mono: "Chakra Petch", ui-monospace, monospace;
  --r: 10px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 15px/1.55 var(--body); overflow-x: hidden; }

/* drifting starfield + nebula */
.stars { position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(1px 1px at 12% 22%, #fff8, transparent), radial-gradient(1px 1px at 72% 12%, #fff9, transparent),
    radial-gradient(1.5px 1.5px at 38% 78%, #cfefff, transparent), radial-gradient(1px 1px at 88% 64%, #fff7, transparent),
    radial-gradient(1px 1px at 55% 40%, #fff6, transparent), radial-gradient(1px 1px at 22% 58%, #fff5, transparent),
    radial-gradient(1.5px 1.5px at 92% 30%, #ffe6c4, transparent), radial-gradient(1px 1px at 5% 85%, #fff6, transparent),
    radial-gradient(ellipse at 80% 10%, rgba(64, 120, 200, .16), transparent 55%),
    radial-gradient(ellipse at 10% 95%, rgba(150, 60, 140, .12), transparent 55%);
  background-size: 600px 600px, 700px 700px, 800px 800px, 500px 500px, 900px 900px, 650px 650px, 750px 750px, 550px 550px, 100% 100%, 100% 100%;
  animation: drift 240s linear infinite; }
@keyframes drift { to { background-position: 600px 300px, -700px 350px, 800px -400px, -500px 250px, 900px 450px, -650px -320px, 750px 380px, 550px -270px, 0 0, 0 0; } }

.screen { position: relative; z-index: 1; }
.center { min-height: 100vh; display: grid; place-items: center; padding: 30px; }
.glass { background: var(--glass); border: 1px solid var(--line); border-radius: var(--r); backdrop-filter: blur(10px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 20px 60px rgba(0,0,0,.45); }
h2, h3 { font-family: var(--head); margin: 0; }
h2 { font-size: 24px; letter-spacing: .04em; color: #eaf6fb; }
h3 { font-size: 11px; letter-spacing: .26em; text-transform: uppercase; color: var(--cyan); opacity: .8; margin: 18px 0 8px; font-weight: 600; }
.muted { color: var(--muted); } .small { font-size: 13px; }

.brand { font-family: var(--head); font-weight: 700; letter-spacing: .32em; font-size: 20px; color: #eaf6fb; }
.brand span { color: var(--cyan); }
.brand.big { font-size: 44px; text-align: center; text-shadow: 0 0 30px rgba(95, 224, 255, .35); }
.brand.small { font-size: 14px; }

input { width: 100%; background: rgba(4, 10, 15, .7); color: var(--ink); border: 1px solid var(--line); border-radius: 7px; padding: 11px 13px; font: inherit; }
input:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(95,224,255,.12); }
label { display: flex; flex-direction: column; gap: 6px; font-family: var(--head); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }

button { font: inherit; color: var(--ink); cursor: pointer; }
.cmd { background: rgba(10, 20, 28, .8); border: 1px solid var(--line); border-radius: 7px; padding: 11px 14px; text-align: left;
  font-family: var(--head); letter-spacing: .04em; transition: border-color .2s, background .2s, box-shadow .2s, transform .1s; }
.cmd:hover:not(:disabled) { border-color: var(--cyan); background: rgba(95, 224, 255, .08); box-shadow: 0 0 18px rgba(95,224,255,.12); }
.cmd:active:not(:disabled) { transform: translateY(1px); }
.cmd:disabled { opacity: .4; cursor: default; }
.cmd.primary { background: linear-gradient(180deg, rgba(255,179,71,.22), rgba(255,179,71,.08)); border-color: rgba(255,179,71,.6); color: #ffe2b8;
  text-align: center; text-transform: uppercase; letter-spacing: .2em; font-weight: 600; }
.cmd.primary:hover:not(:disabled) { border-color: var(--amber); box-shadow: 0 0 22px rgba(255,179,71,.25); background: rgba(255,179,71,.2); }
.link { background: none; border: 0; color: var(--muted); padding: 6px 0; text-decoration: underline; text-underline-offset: 3px; font-size: 13px; }

/* intro + menu */
.intro { width: min(460px, 100%); padding: 36px; display: flex; flex-direction: column; gap: 14px; text-align: center; }
.menu { width: min(860px, 100%); padding: 28px 32px 32px; display: flex; flex-direction: column; gap: 8px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.saves { display: grid; gap: 8px; }
.save { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; }
.save small { color: var(--muted); font-family: var(--body); letter-spacing: 0; }
.save .st { grid-row: 1 / 3; grid-column: 2; align-self: center; font-size: 12px; color: var(--cyan); }
.save .st.lost { color: var(--red); } .save .st.won { color: var(--green); }
.bgs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 14px 0; }
.bg { display: flex; flex-direction: column; gap: 8px; padding: 14px; }
.bg.sel { border-color: var(--amber); background: rgba(255,179,71,.08); box-shadow: 0 0 20px rgba(255,179,71,.12) inset; }
.bg b { font-size: 15px; }
.mini-skills { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; font-family: var(--body); font-size: 12px; color: var(--muted); letter-spacing: 0; }
.mini-skills i { font-style: normal; font-family: var(--mono); color: var(--cyan); }

/* bridge layout */
.bridge { display: grid; grid-template-columns: 250px minmax(0, 1fr) 300px; grid-template-rows: auto 1fr; gap: 14px; padding: 14px; min-height: 100vh; }
.hud { grid-column: 1 / -1; display: flex; align-items: center; gap: 22px; padding: 10px 18px; }
.hud-title { display: flex; flex-direction: column; min-width: 160px; font-family: var(--head); font-size: 17px; color: #eaf6fb; }
.hud-title small { font-size: 11px; color: var(--muted); letter-spacing: .14em; text-transform: uppercase; }
.gauges { display: flex; gap: 18px; flex: 1; align-items: center; flex-wrap: wrap; }
.gauge, .stat { display: flex; flex-direction: column; gap: 3px; }
.gauge span, .stat span { font-family: var(--head); font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.gauge { width: 150px; }
.gauge .bar { height: 6px; background: rgba(255,255,255,.06); border-radius: 3px; overflow: hidden; }
.gauge .bar i { display: block; height: 100%; background: linear-gradient(90deg, #ff9a3c, #ffd27a); transition: width .6s; box-shadow: 0 0 10px rgba(255,180,80,.6); }
.gauge.shield .bar i { background: linear-gradient(90deg, #2bb8ff, #8ff0ff); box-shadow: 0 0 10px rgba(95,224,255,.6); }
.gauge.low .bar i { background: linear-gradient(90deg, #c01b2c, #ff4d5e); }
.gauge b, .stat b { font-family: var(--mono); font-size: 13px; color: #eaf6fb; font-weight: 500; }
.stat.warn b { color: var(--red); }
.alert { font-family: var(--head); font-size: 12px; letter-spacing: .24em; padding: 7px 12px; border: 1px solid var(--line); border-radius: 6px; color: var(--green); }
.alert.yellow { color: var(--amber); border-color: rgba(255,179,71,.6); }
.alert.red { color: #fff; background: rgba(255,77,94,.25); border-color: var(--red); animation: pulseRed 1.2s ease-in-out infinite; }
@keyframes pulseRed { 50% { box-shadow: 0 0 22px rgba(255,77,94,.6); } }
body.red-alert .bridge .glass { border-color: rgba(255,77,94,.35); }
body.red-alert .stars { background-color: #0d0306; }

.side { padding: 6px 16px 16px; align-self: start; position: sticky; top: 14px; }
.pos b { display: block; font-family: var(--head); font-size: 18px; color: #eaf6fb; }
.pos .chip { display: inline-block; margin-top: 6px; font-family: var(--head); font-size: 11px; letter-spacing: .18em; padding: 3px 8px; border: 1px solid var(--line-2); border-radius: 4px; color: var(--cyan); }
.pos .meta { font-size: 13px; color: var(--muted); margin-top: 6px; }
.consoles { display: grid; gap: 8px; }
.consoles .cmd { display: flex; flex-direction: column; }
.consoles small { color: var(--muted); font-family: var(--body); letter-spacing: 0; font-size: 12px; }
.styles { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 12px; }
.styles button { padding: 7px; font-size: 12px; text-align: center; }
.styles button.sel { border-color: var(--cyan); color: var(--cyan); background: rgba(95,224,255,.08); }

.main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.viewscreen { position: relative; aspect-ratio: 16 / 8; border-radius: var(--r); overflow: hidden; border: 1px solid var(--line-2);
  background: radial-gradient(ellipse at 50% 60%, #0b1c2a, #02050a); box-shadow: 0 0 60px rgba(40, 140, 200, .12); }
.vs-img { position: absolute; inset: 0; background-size: cover; background-position: center; transition: opacity .8s; }
.vs-img::after { content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.12) 0 1px, transparent 1px 3px), linear-gradient(180deg, transparent 60%, rgba(4,7,11,.65)); }
.vs-hud { position: absolute; inset: 14px; pointer-events: none; }
.corner { position: absolute; width: 26px; height: 26px; border: 2px solid rgba(95,224,255,.6); }
.corner.tl { top: 0; left: 0; border-right: 0; border-bottom: 0; } .corner.tr { top: 0; right: 0; border-left: 0; border-bottom: 0; }
.corner.bl { bottom: 0; left: 0; border-right: 0; border-top: 0; } .corner.br { bottom: 0; right: 0; border-left: 0; border-top: 0; }
.vs-label { position: absolute; top: 8px; left: 38px; font-family: var(--head); letter-spacing: .2em; font-size: 12px; color: var(--cyan); text-shadow: 0 0 8px #000; }
.vs-zone { position: absolute; bottom: 8px; right: 38px; font-family: var(--mono); font-size: 12px; color: #9fdcee; text-shadow: 0 0 8px #000; }
body.red-alert .corner { border-color: rgba(255,77,94,.8); } body.red-alert .vs-label { color: #ff8a95; }
.vs-busy { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(2,6,10,.55); font-family: var(--head); letter-spacing: .3em; text-transform: uppercase; color: var(--cyan); font-size: 13px; }
.vs-busy .scan { position: absolute; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--cyan), transparent); box-shadow: 0 0 16px var(--cyan); animation: scan 2s ease-in-out infinite; }
@keyframes scan { 0% { top: 8%; } 50% { top: 92%; } 100% { top: 8%; } }

.story { padding: 20px 24px 22px; }
.narration { margin: 0 0 14px; font-size: 18px; line-height: 1.65; color: #e3eef4; }
.narration.speaking { color: #fff; text-shadow: 0 0 14px rgba(95,224,255,.15); }
.voice { display: grid; grid-template-columns: 110px 1fr; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.voice label { padding-top: 3px; color: var(--cyan); font-size: 11px; }
.voice p { margin: 0; }
.voice.computer p { font-family: var(--mono); font-size: 14px; color: #a9e9f7; }
.voice.comms label { color: var(--amber); }
.voice.comms p { font-style: italic; color: #ffe2b8; }
.voice.speaking label::after { content: " ◉"; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.applied { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 4px; }
.fx { font-family: var(--mono); font-size: 12px; padding: 3px 8px; border-radius: 4px; border: 1px solid var(--line); }
.fx.bad { color: #ff9aa4; border-color: rgba(255,77,94,.4); } .fx.good { color: #9dffcf; border-color: rgba(94,255,168,.35); }
.options { display: grid; gap: 8px; margin-top: 12px; }
.opt { display: flex; align-items: center; gap: 12px; padding: 13px 16px; font-family: var(--body); font-size: 16px; letter-spacing: 0; }
.opt .n { font-family: var(--mono); color: var(--amber); }
.opt .lbl { flex: 1; }
.opt .chip { font-family: var(--head); font-size: 11px; letter-spacing: .12em; padding: 3px 8px; border-radius: 4px; border: 1px solid var(--line-2); color: var(--cyan); white-space: nowrap; }
.opt .chip.jump { border-color: rgba(255,179,71,.5); color: var(--amber); }
.own { display: flex; gap: 8px; margin-top: 8px; }
.own[hidden] { display: none; }
.own input { flex: 1; min-width: 0; padding: 12px 14px; font: 15px var(--body); color: inherit; background: rgba(4, 12, 18, .55); border: 1px dashed var(--line-2); border-radius: 6px; }
.own input:focus { outline: none; border-style: solid; border-color: var(--amber); }
.own button { padding: 0 16px; white-space: nowrap; }

.tabs { display: flex; gap: 6px; margin: 12px 0 10px; }
.tabs button { flex: 1; background: none; border: 1px solid var(--line); border-radius: 6px; padding: 6px; font-family: var(--head); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.tabs button.sel { color: var(--cyan); border-color: var(--line-2); background: rgba(95,224,255,.06); }
.feed { max-height: calc(100vh - 170px); overflow: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 4px; }
.entry { font-size: 14px; border-left: 2px solid var(--line-2); padding-left: 10px; }
.entry .sd { font-family: var(--mono); font-size: 11px; color: var(--cyan); display: block; }
.tele { font-family: var(--mono); font-size: 12px; color: #a5bfcc; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.tele .ok { color: var(--green); } .tele .bad { color: var(--red); } .tele b { color: #fff; }

/* overlays */
.overlay { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 24px; background: rgba(1, 4, 8, .72); backdrop-filter: blur(4px); }
.sheet { position: relative; width: min(980px, 100%); max-height: calc(100vh - 48px); overflow: auto; padding: 24px 28px 28px; background: var(--glass-2); }
.sheet.wide { width: min(1280px, 100%); } .sheet.narrow { width: min(640px, 100%); }
.x { position: absolute; top: 10px; right: 14px; background: none; border: 0; font-size: 26px; color: var(--muted); }
.x:hover { color: var(--cyan); }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; padding: 0 36px 14px 0; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.legend { font-size: 13px; max-width: 360px; text-align: right; }
.sh-stats { display: flex; gap: 10px; flex-wrap: wrap; }
.sh-stats .s { border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; min-width: 76px; text-align: center; }
.sh-stats .s span { display: block; font-family: var(--head); font-size: 10px; letter-spacing: .18em; color: var(--muted); text-transform: uppercase; }
.sh-stats .s b { font-family: var(--mono); font-size: 16px; font-weight: 500; }

.ship-body { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.modules { display: grid; gap: 8px; }
.module { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; }
.module .slot { font-family: var(--head); font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); grid-column: 1 / -1; }
.module b { font-size: 15px; } .module.empty b { color: var(--muted); font-weight: 400; font-style: italic; }
.module small { color: var(--muted); font-family: var(--body); letter-spacing: 0; font-size: 12px; grid-column: 1; }
.cargo { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.crate { position: relative; display: flex; flex-direction: column; gap: 4px; min-height: 74px; padding: 10px; font-size: 13px; }
.crate .q { position: absolute; top: 6px; right: 8px; font-family: var(--mono); color: var(--amber); font-size: 12px; }
.crate .t { font-family: var(--head); font-size: 9px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.crate.t-module { border-color: rgba(95,224,255,.35); } .crate.t-quest { border-color: rgba(255,179,71,.45); }
.crate.sel, .module.sel { border-color: var(--amber); box-shadow: 0 0 14px rgba(255,179,71,.18) inset; }
.detail { margin-top: 14px; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; min-height: 80px; }
.detail .acts-row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

.skills { display: grid; gap: 8px; }
.skill { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; }
.skill span { font-family: var(--head); letter-spacing: .08em; }
.skill .bar { width: 180px; height: 6px; background: rgba(255,255,255,.06); border-radius: 3px; overflow: hidden; }
.skill .bar i { display: block; height: 100%; background: linear-gradient(90deg, #2bb8ff, #8ff0ff); }
.skill b { font-family: var(--mono); font-weight: 500; min-width: 64px; text-align: right; }
.skill b em { font-style: normal; color: var(--green); font-size: 12px; }

.premise { font-size: 17px; line-height: 1.6; color: #e3eef4; }
.acts { display: grid; gap: 8px; }
.act { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.act .n { font-family: var(--head); font-size: 11px; letter-spacing: .2em; color: var(--muted); }
.act b { display: block; font-family: var(--head); font-size: 16px; }
.act.cur { border-color: var(--amber); background: rgba(255,179,71,.06); } .act.cur .n { color: var(--amber); }
.act.done { opacity: .6; } .act.done .n::after { content: " · ukończony"; color: var(--green); }
.act.locked b { color: var(--muted); }

/* star chart */
.map-wrap { position: relative; }
#map { width: 100%; height: auto; display: block; border-radius: 8px; border: 1px solid var(--line); background: #02050a; }
.lane { stroke: rgba(110, 210, 255, .18); stroke-width: 1.5; fill: none; }
.lane.live { stroke: var(--amber); stroke-width: 2; stroke-dasharray: 6 6; animation: dash 1.5s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -24; } }
.lane-days { fill: var(--amber); font: 12px var(--mono); text-anchor: middle; }
.sys { cursor: pointer; }
.sys .glow { opacity: .35; }
.sys .core { stroke: rgba(255,255,255,.6); stroke-width: .5; }
.sys text { fill: #cfe3ec; font: 600 12px var(--head); letter-spacing: .06em; text-anchor: middle; paint-order: stroke; stroke: #02050a; stroke-width: 4px; }
.sys .type { fill: var(--muted); font: 10px var(--body); letter-spacing: 0; }
.sys.unvisited text { opacity: .55; }
.sys.exit .ring { stroke: var(--amber); stroke-width: 1.5; fill: none; }
.sys.here .ring { stroke: var(--cyan); stroke-width: 2; fill: rgba(95,224,255,.08); animation: hereRing 2.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes hereRing { 50% { transform: scale(1.3); opacity: .5; } }
.sys .act-mark { fill: none; stroke: #ffd27a; stroke-width: 1.5; stroke-dasharray: 3 3; }
.sys .faction { fill: none; stroke-width: 1; opacity: .5; }
.tip { position: absolute; transform: translate(-50%, calc(-100% - 26px)); min-width: 230px; padding: 12px 14px; text-align: left; z-index: 3; }
.tip.below { transform: translate(-50%, 30px); }
.tip b { font-family: var(--head); font-size: 15px; display: block; }
.tip .cmd { margin-top: 10px; width: 100%; }

.end { text-align: center; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.end h2 { font-size: 30px; }
#toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 40; max-width: 640px; padding: 12px 16px; border-radius: 8px;
  background: rgba(40, 8, 14, .92); border: 1px solid var(--red); color: #ffc2c8; cursor: pointer; }


/* codex */
.codex { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.entry-card { border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; background: rgba(4, 10, 15, .5); }
.entry-card .kind { font-family: var(--head); font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--amber); }
.entry-card b { display: block; font-family: var(--head); font-size: 17px; margin: 2px 0 6px; color: #eaf6fb; }
.entry-card p { margin: 0 0 8px; font-size: 14px; color: #c3d6e0; }
.entry-card small { color: var(--muted); font-size: 12px; }
.codex-tabs { width: 260px; margin: 0; }
.tip .lore { margin: 8px 0 0; font-size: 13px; line-height: 1.45; color: #c3d6e0; max-width: 300px; }
.mobnav, .mob-close { display: none; }


/* ================= FULLSCREEN SCENE =================
   The picture is the whole screen; the UI floats on it in small see-through panels. */
:root { --float: rgba(4, 9, 14, .44); --float-2: rgba(4, 9, 14, .62); }
.bridge { display: block; padding: 0; min-height: 100vh; }
.viewscreen { position: fixed; inset: 0; aspect-ratio: auto; border: 0; border-radius: 0; z-index: 0; box-shadow: none; }
.vs-img::after { background:
    linear-gradient(180deg, rgba(2,5,9,.55) 0, transparent 14%, transparent 52%, rgba(2,5,9,.78) 100%),
    repeating-linear-gradient(0deg, rgba(0,0,0,.06) 0 1px, transparent 1px 3px); }
.vs-hud { inset: 64px 14px 14px 206px; }
.vs-label { top: 6px; left: 34px; font-size: 11px; }
.vs-zone { bottom: auto; top: 6px; right: 34px; font-size: 11px; }
.vs-busy { background: rgba(2,6,10,.35); }

.bridge .glass { background: var(--float); border-color: rgba(110, 210, 255, .14); backdrop-filter: blur(7px); box-shadow: 0 10px 40px rgba(0,0,0,.35); }
.hud { position: fixed; top: 10px; left: 10px; right: 10px; z-index: 6; gap: 16px; padding: 6px 12px; }
.hud .brand.small { font-size: 12px; }
.hud-title { min-width: 0; font-size: 14px; } .hud-title small { font-size: 10px; }
.gauges { gap: 14px; } .gauge { width: 110px; }
.gauge span, .stat span { font-size: 9px; } .gauge b, .stat b { font-size: 12px; }
.alert { font-size: 10px; padding: 5px 9px; }
.hud-btns { display: flex; gap: 6px; }
.cmd.tiny { padding: 5px 10px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; text-align: center; }
body.show-right .hud-btns [data-mob="right"] { border-color: var(--cyan); color: var(--cyan); }

.side.left { position: fixed; top: 70px; left: 10px; width: 186px; z-index: 5; padding: 2px 12px 12px; max-height: calc(100vh - 90px); overflow: auto; }
.side.left h3 { margin: 12px 0 6px; font-size: 9px; }
.pos b { font-size: 15px; } .pos .meta { font-size: 11px; line-height: 1.4; } .pos .chip { font-size: 9px; padding: 2px 6px; }
.consoles { gap: 5px; } .consoles .cmd { padding: 7px 10px; font-size: 13px; } .consoles small { display: none; }
.styles { gap: 4px; } .styles button { padding: 5px 4px; font-size: 11px; }
.side.left .link { font-size: 11px; }

.side.right { display: none; position: fixed; top: 70px; right: 10px; width: 290px; z-index: 5; max-height: calc(100vh - 90px); overflow: auto; padding-top: 4px; }
body.show-right .side.right { display: block; }
.side.right .mob-close { display: block; top: 6px; right: 8px; font-size: 22px; }
.side.right .tabs { margin-right: 30px; }
.feed { max-height: none; }
.entry { font-size: 13px; }

.story { position: fixed; z-index: 5; bottom: 12px; left: 208px; right: 12px; max-width: 920px; margin: 0 auto;
  max-height: 48vh; overflow: auto; padding: 12px 18px 14px; background: var(--float-2) !important; }
body.show-right .story { right: 312px; }
.narration { font-size: 16px; line-height: 1.6; margin: 0 22px 8px 0; text-shadow: 0 1px 8px rgba(0,0,0,.6); }
.voice { grid-template-columns: 92px 1fr; padding: 6px 0; gap: 10px; font-size: 14px; }
.voice label { font-size: 10px; }
.voice.computer p { font-size: 13px; }
.applied { margin: 4px 0 2px; } .fx { font-size: 11px; padding: 2px 7px; }
.options { grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.opt { padding: 9px 12px; font-size: 14px; gap: 10px; background: rgba(4, 12, 18, .55); }
.opt .chip { font-size: 10px; padding: 2px 6px; }
.fold { position: absolute; top: 8px; right: 10px; background: none; border: 0; color: var(--muted); font-size: 16px; padding: 2px 6px; }
.fold:hover { color: var(--cyan); }
body.story-folded .story .narration, body.story-folded .story .voice, body.story-folded .story .applied { display: none; }

/* hide everything, keep the picture */
.show-ui { display: none; position: fixed; top: 12px; right: 12px; z-index: 7; background: var(--float); backdrop-filter: blur(6px); }
body.ui-hidden .bridge > *:not(.viewscreen):not(.show-ui) { display: none !important; }
body.ui-hidden .show-ui { display: block; }
body.ui-hidden .vs-hud { display: none; }
body.ui-hidden .vs-img::after { background: none; }

/* tablets */
/* recorded campaigns and film export */
.rec-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; margin: 4px 0 14px; }
.rec-toggle { flex-direction: row; align-items: center; gap: 12px; cursor: pointer; text-transform: none; letter-spacing: 0; }
.rec-toggle input { width: 20px; height: 20px; accent-color: var(--cyan); flex: none; }
.rec-toggle span { display: flex; flex-direction: column; gap: 2px; }
.rec-toggle b { font-family: var(--head); font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink); }
.rec-toggle small { font-size: 13px; color: var(--muted); }
.rec-sizes { display: flex; align-items: center; gap: 6px; font-family: var(--head); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.rec-sizes[hidden] { display: none; }
.rec-sizes span { margin-right: 6px; }
.rec-sizes .cmd { padding: 6px 12px; min-width: 0; }
.export-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }

/* explorer career: new game wizard */
.wizard { width: min(1080px, 100%); }
.steps { display: flex; gap: 6px; }
.steps span { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; font-family: var(--head); font-size: 12px; color: var(--muted); }
.steps span.on { border-color: var(--amber); color: var(--amber); box-shadow: 0 0 12px rgba(255,179,71,.25); }
.step { display: flex; flex-direction: column; gap: 12px; }
.pick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.pick-grid.ships { grid-template-columns: repeat(4, 1fr); }
.pick { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.pick-img { aspect-ratio: 16 / 9; background: radial-gradient(ellipse at 30% 30%, rgba(95,224,255,.18), transparent 60%), radial-gradient(ellipse at 80% 90%, rgba(255,179,71,.14), transparent 60%), #071019;
  background-size: cover; background-position: center; border-bottom: 1px solid var(--line); position: relative; }
.pick-img:not(.has)::after { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(95,224,255,.08) 50%, transparent 70%); background-size: 200% 100%; animation: shimmer 2.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.pick-body { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px 14px; }
.pick-body b { font-size: 16px; color: #eaf6fb; }
.pick-body small { font-family: var(--body); letter-spacing: 0; color: #b9ccd6; font-size: 13px; }
.pick-body small.cls { color: var(--muted); font-size: 12px; }
.pick-body .chip { align-self: flex-start; font-size: 11px; letter-spacing: .12em; padding: 3px 8px; border: 1px solid var(--line-2); border-radius: 4px; color: var(--cyan); }
.pick.sel { border-color: var(--amber); box-shadow: 0 0 0 1px var(--amber), 0 0 26px rgba(255,179,71,.18); }
.wizard-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; }
.wizard-nav .primary { min-width: 220px; }

/* career on the bridge */
body:not(.is-career) .career-only { display: none !important; }
.side-missions h3 { margin-top: 14px; }
.sm { padding: 8px 10px; border-left: 2px solid var(--cyan); background: rgba(95,224,255,.05); border-radius: 0 6px 6px 0; margin-bottom: 6px; }
.sm b { display: block; font-family: var(--head); font-size: 13px; font-weight: 500; }
.sm span { font-size: 11px; color: var(--muted); }
.sm.done { border-left-color: var(--green); } .sm.done span { color: var(--green); }
.away-note { padding: 10px 14px; border: 1px solid rgba(255,179,71,.4); border-radius: 8px; background: rgba(255,179,71,.07); color: #ffe2b8; font-size: 14px; margin-bottom: 14px; }
.base-tabs { width: 380px; margin: 0; }
.jobs { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.job, .upg { border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; background: rgba(4, 10, 15, .5); display: flex; flex-direction: column; gap: 4px; }
.job .kind, .upg .kind { font-family: var(--head); font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--amber); }
.job b, .upg b { font-family: var(--head); font-size: 16px; color: #eaf6fb; }
.job p, .upg p { margin: 0; font-size: 14px; color: #c3d6e0; flex: 1; }
.job.active { border-color: var(--line-2); } .job.done { border-color: rgba(94,255,168,.45); }
.job-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; }
.reward { font-family: var(--head); font-size: 13px; color: var(--green); }
.chip.ok { font-family: var(--head); font-size: 11px; letter-spacing: .1em; padding: 3px 8px; border: 1px solid rgba(94,255,168,.5); border-radius: 4px; color: var(--green); }
.store-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.slist { display: grid; gap: 6px; }
.srow { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: rgba(4,10,15,.45); font-size: 14px; }
.srow i { font-style: normal; color: var(--amber); font-family: var(--mono); }
.srow .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.srow.t-module { border-color: rgba(95,224,255,.35); } .srow.t-quest { border-color: rgba(255,179,71,.45); }
.services { display: grid; grid-template-columns: repeat(2, minmax(0, 260px)); gap: 10px; }
.services .cmd { display: flex; flex-direction: column; gap: 2px; } .services small { color: var(--muted); font-family: var(--body); letter-spacing: 0; }
.upgrades { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.upg .cmd { margin-top: 8px; align-self: flex-start; }
.shop { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.shop .crate small { font-size: 12px; letter-spacing: 0; font-family: var(--body); }

/* star chart: home and contract targets */
.home-mark { fill: none; stroke: var(--green); stroke-width: 1.5; stroke-dasharray: 3 4; }
.mark-label { font: 700 10px var(--head) !important; letter-spacing: .24em !important; }
.mark-label.home { fill: var(--green) !important; }
.target-mark { fill: var(--amber); stroke: #02050a; stroke-width: 1.5; }

/* pictures from the art studio: black backgrounds disappear on the dark UI */
.ico { display: block; width: 100%; height: 64px; background: center / contain no-repeat; mix-blend-mode: screen; margin-bottom: 4px; pointer-events: none; }
.module { position: relative; }
.ico.side { position: absolute; top: 10px; right: 12px; width: 54px; height: 54px; margin: 0; }
.ico.mini { display: inline-block; width: 30px; height: 30px; vertical-align: middle; margin: 0 8px 0 0; }
.tip-pic { display: block; height: 120px; margin: -4px -4px 8px; background: center / contain no-repeat; mix-blend-mode: screen; }
.pick-img.has { background-size: contain; background-repeat: no-repeat; background-color: #000; }

@media (max-width: 1180px) {
  .side.left { width: 160px; }
  .story { left: 182px; }
  .vs-hud { left: 178px; }
  .options { grid-template-columns: 1fr; }
  .gauge { width: 90px; } .gauges { gap: 10px; }
  .hud .brand.small { display: none; }
  .bgs { grid-template-columns: 1fr 1fr; } .ship-body { grid-template-columns: 1fr; }
}


/* ---------- viewscreen picture: layered, with inertia ---------- */
.vs-img { overflow: hidden; background: radial-gradient(ellipse at 50% 60%, #0b1c2a, #02050a); }
.vs-img::after { z-index: 2; }
.vs-layer { position: absolute; inset: 0; opacity: 0; transform: scale(1.08); filter: blur(6px) brightness(.8);
  transition: opacity 2.8s ease, transform 6s cubic-bezier(.2, .7, .2, 1), filter 3.2s ease; will-change: opacity, transform, filter; }
.vs-layer.in { opacity: 1; transform: scale(1); filter: none; }
.vs-layer.leaving { transform: scale(1.18); filter: blur(4px) brightness(.42) saturate(.65);
  transition: transform 9s cubic-bezier(.35, 0, .2, 1), filter 4.5s ease, opacity 2.8s ease; }
.vs-layer.out { opacity: 0; transition: opacity 2.6s ease, transform 3s ease, filter 2.6s ease; }
.vs-pic { position: absolute; inset: -3%; background-size: cover; background-position: center; animation: drift-pic 48s ease-in-out infinite alternate; }
@keyframes drift-pic { from { transform: scale(1) translate(0, 0); } to { transform: scale(1.07) translate(-1.6%, -1.1%); } }
/* while the computer thinks: a soft light sweep over the dimmed picture */
.vs-busy { background: radial-gradient(ellipse at 50% 55%, rgba(95,224,255,.07), rgba(2,6,10,.25) 60%); animation: busyIn 1.2s ease both; }
.vs-busy::before { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(160,235,255,.08) 50%, transparent 70%);
  background-size: 250% 100%; animation: sweep 3.2s ease-in-out infinite; }
@keyframes busyIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes sweep { from { background-position: 120% 0; } to { background-position: -120% 0; } }
@media (prefers-reduced-motion: reduce) { .vs-pic { animation: none; } .vs-layer, .vs-layer.leaving { transition-duration: .6s; } }

/* ---------- language buttons ---------- */
.langs { display: flex; gap: 4px; justify-content: center; }
.side .langs { justify-content: flex-start; margin-bottom: 8px; }
.lang { background: none; border: 1px solid var(--line); border-radius: 5px; padding: 3px 9px; font-family: var(--head); font-size: 11px; letter-spacing: .14em; color: var(--muted); }
.lang:hover { color: var(--cyan); border-color: var(--line-2); }
.lang.sel { color: var(--cyan); border-color: var(--cyan); background: rgba(95,224,255,.08); }
.menu-top { display: flex; justify-content: space-between; align-items: center; }
.narration { font-weight: 400; letter-spacing: .01em; }
.voice.comms p { font-style: italic; }

/* ---------- desktop-only / phone-only bits ---------- */
.mob-menu, .mob-only, .side-stats { display: none; }

/* ================= PHONE: the picture first =================
   Portrait picture on the whole screen, a thin bar on top, a small narrator and the choices at the bottom.
   Everything else lives under the menu button. */
@media (max-width: 760px) {
  body { font-size: 14px; }
  .bridge { display: block; padding: 0; }
  .mobnav { display: none !important; }

  /* top: ship name, two thin bars, menu */
  .hud { position: fixed; top: max(6px, env(safe-area-inset-top)); left: 8px; right: 8px; flex-wrap: nowrap; gap: 10px; padding: 6px 8px 6px 12px;
    background: rgba(2, 6, 10, .38) !important; border-color: rgba(110,210,255,.1) !important; }
  .hud .brand, .hud-btns, .hud .stat, .gauge span, .gauge b { display: none !important; }
  .hud-title { flex: 0 1 auto; min-width: 0; font-size: 13px; }
  .hud-title span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .hud-title small { display: none; }
  .gauges { display: flex; flex: 1; gap: 6px; flex-direction: column; justify-content: center; order: 0; }
  .gauge { width: 100%; display: block; }
  .gauge .bar { height: 3px; }
  .alert { font-size: 0; width: 9px; height: 9px; padding: 0; border-radius: 50%; border: 0; background: var(--green); box-shadow: 0 0 8px var(--green); flex: none; }
  .alert.yellow { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
  .alert.red { background: var(--red); box-shadow: 0 0 10px var(--red); }
  .mob-menu { display: block; flex: none; background: none; border: 0; color: #eaf6fb; font-size: 22px; line-height: 1; padding: 2px 4px; }

  /* the picture: no frame, no labels */
  .vs-hud { display: none; }
  .vs-img::after { background: linear-gradient(180deg, rgba(2,5,9,.35) 0, transparent 12%, transparent 45%, rgba(2,5,9,.92) 100%); }

  /* bottom: small narrator, then the choices */
  .story { left: 0 !important; right: 0 !important; bottom: 0; max-width: none; max-height: 70vh; border-radius: 0; border: 0 !important;
    padding: 28px 14px max(14px, env(safe-area-inset-bottom)) !important; background: linear-gradient(180deg, transparent, rgba(2,5,9,.78) 22%) !important;
    backdrop-filter: none !important; box-shadow: none !important; }
  .fold { display: none; }
  .narration { font-size: 14px; line-height: 1.5; margin: 0 0 4px; color: #dfeaf0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
  .narration::after { content: ""; }
  .story .voice, .story .applied { display: none; }
  body.story-open .narration { -webkit-line-clamp: unset; display: block; }
  body.story-open .story .voice:not([hidden]) { display: block; }
  body.story-open .story .applied { display: flex; }
  .story::before { content: "▴"; position: absolute; top: 8px; left: 50%; transform: translateX(-50%); color: var(--muted); font-size: 11px; }
  body.story-open .story::before { content: "▾"; }
  .voice { padding: 6px 0; border-top: 1px solid rgba(110,210,255,.12); }
  .voice label { display: block; font-size: 9px; margin-bottom: 2px; }
  .voice p, .voice.computer p { font-size: 13px; }
  .options { grid-template-columns: 1fr; gap: 6px; margin-top: 8px; }
  .opt { padding: 10px 12px; font-size: 14px; gap: 8px; flex-wrap: nowrap; background: rgba(6, 14, 20, .62); backdrop-filter: blur(6px); }
  .opt .lbl { flex: 1; }
  .opt .chip { margin: 0; font-size: 9px; padding: 2px 5px; letter-spacing: .06em; }

  /* menu: one sheet with everything else */
  .side, .side.left, .side.right { display: none; position: fixed !important; inset: auto 0 0 0 !important; width: auto !important; max-height: 82vh; overflow: auto; z-index: 15;
    border-radius: 16px 16px 0 0; padding: 16px 16px max(18px, env(safe-area-inset-bottom)); background: rgba(5, 10, 15, .9) !important; backdrop-filter: blur(14px) !important; }
  body.show-left .side.left, body.show-right .side.right { display: block; }
  .mob-close { display: block; } .mob-only { display: flex; }
  .side .tabs, .side h3:first-of-type { margin-right: 34px; }
  .side-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 10px 0 4px; }
  .side-stats div { border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; }
  .side-stats span { display: block; font-size: 9px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
  .side-stats b { font-size: 13px; }
  .consoles { grid-template-columns: 1fr 1fr; }
  .consoles .cmd { padding: 10px; } .consoles small { display: block; font-size: 11px; }
  .feed { max-height: none; }
  .show-ui { top: auto; bottom: 12px; right: 12px; }

  /* overlays fill the phone */
  .overlay { padding: 0; place-items: stretch; }
  .sheet, .sheet.wide, .sheet.narrow { width: 100%; max-height: 100vh; height: 100%; border-radius: 0; padding: 18px 14px 24px; }
  .sheet-head { flex-direction: column; align-items: flex-start; padding-right: 30px; }
  .legend { text-align: left; }
  #map { height: 62vh; }
  .tip { position: fixed; left: 8px !important; right: 8px; top: auto !important; bottom: 12px; transform: none !important; min-width: 0; }
  .cargo { grid-template-columns: repeat(2, 1fr); }
  .skill { grid-template-columns: 1fr auto; } .skill .bar { display: none; }
  .row2, .bgs { grid-template-columns: 1fr; }
  .menu, .intro { padding: 22px 16px; }
  .brand.big { font-size: 32px; }
  .codex-tabs { width: 100%; }
  .ship-body { grid-template-columns: 1fr; }
}

/* explorer career on phones */
@media (max-width: 760px) {
  .pick-grid, .pick-grid.ships, .upgrades, .store-cols, .services { grid-template-columns: 1fr; }
  .base-tabs { width: 100%; }
  .wizard-nav .primary { min-width: 0; flex: 1; }
  .mobnav { grid-template-columns: repeat(6, 1fr) !important; }
}
@media (min-width: 761px) and (max-width: 1180px) { .pick-grid, .pick-grid.ships { grid-template-columns: repeat(2, 1fr); } .upgrades { grid-template-columns: 1fr 1fr; } }
