:root {
  --bg: #04060b;
  --panel: #0a0f1a;
  --line: #1b2740;
  --text: #c9d6e8;
  --dim: #5d6f8c;
  --amber: #ffb400;
  --cyan: #5fd7ff;
  --red: #ff3b30;
  --green: #39d98a;
  --accent: var(--green);
  --mono: "Cascadia Mono", "Cascadia Code", Consolas, "DejaVu Sans Mono", Menlo, monospace;
  --sans: "Segoe UI", system-ui, -apple-system, Helvetica, Arial, sans-serif;
}
body[data-condition="RED"] { --accent: var(--red); }
body[data-condition="YELLOW"] { --accent: var(--amber); }
body[data-condition="DOCKED"] { --accent: var(--cyan); }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--sans); overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }

/* ---------- Title ---------- */
#title { position: fixed; inset: 0; display: grid; place-items: center; text-align: center; z-index: 10; }
#title canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#title .inner { position: relative; padding: 16px; }
.kicker { font-family: var(--mono); letter-spacing: .5em; font-size: 12px; color: var(--cyan); text-transform: uppercase; margin-bottom: 18px; opacity: .85; }
h1 { margin: 0; font-size: clamp(40px, 9vw, 116px); line-height: .92; font-style: italic; font-weight: 800; letter-spacing: .02em;
     color: var(--amber); text-shadow: 0 0 28px rgba(255,180,0,.45), 0 2px 0 #7a4c00; text-transform: uppercase; }
/* the logo (logo.svg) is SUPER over STAR TREK in the lettering of the original series */
h1 .logo { display: block; margin: 0 auto; width: min(84vw, 560px, 68vh); height: auto; filter: drop-shadow(0 0 22px rgba(251,215,39,.35)); }
.tagline { margin: 22px auto 26px; max-width: 34em; font-size: clamp(14px, 1.6vw, 19px); color: #9fb2cc; line-height: 1.5; }
.difficulty { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; margin-bottom: 26px; background: rgba(4,6,11,.7); }
.difficulty button { background: none; border: 0; padding: 8px 16px; font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.difficulty button:hover { color: var(--text); }
.difficulty button[aria-checked="true"] { background: var(--cyan); color: #04121a; }
#play { display: block; margin: 0 auto; border: 2px solid var(--amber); background: rgba(255,180,0,.08); color: var(--amber); padding: 14px 56px; border-radius: 999px;
        font-family: var(--mono); font-size: 18px; letter-spacing: .35em; text-indent: .35em; text-transform: uppercase; transition: all .2s;
        animation: pulse 2.2s ease-in-out infinite; }
#play:hover, #play:focus-visible { background: var(--amber); color: #120c00; box-shadow: 0 0 40px rgba(255,180,0,.6); outline: none; }
@keyframes pulse { 50% { box-shadow: 0 0 26px rgba(255,180,0,.45); } }
.version { margin-top: 18px; font-family: var(--mono); font-size: 12px; letter-spacing: .15em; color: var(--dim); }
/* "play the tutorial": small and grey, under the version */
.textlink { display: block; margin: 8px auto 0; background: none; border: 0; padding: 4px 8px; font-family: var(--mono); font-size: 12px; letter-spacing: .1em; color: var(--dim); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.textlink:hover, .textlink:focus-visible { color: var(--text); outline: none; }
.credits { position: absolute; left: 0; right: 0; bottom: 16px; font-size: 12px; color: var(--dim); padding: 0 16px; }
#flash { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 20; transition: opacity .35s; }

/* ---------- Bridge ---------- */
#bridge { position: fixed; inset: 0; display: none; grid-template-rows: auto 1fr auto; }
#bridge.on { display: grid; }
header { display: flex; align-items: center; gap: 12px; padding: 8px 14px; border-bottom: 1px solid var(--line); background: #070b13; }
header .brand { font-style: italic; font-weight: 800; color: var(--amber); letter-spacing: .06em; text-transform: uppercase; font-size: 15px; white-space: nowrap; }
header .pack { font-family: var(--mono); font-size: 11px; color: var(--dim); border: 1px solid var(--line); border-radius: 4px; padding: 3px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
header .spacer { flex: 1; }
header .brand { display: flex; }
/* the name is logo-line.svg, in the lettering of the original series */
header .brand img { display: block; height: 16px; width: auto; transition: filter .2s; }
header a.brand { text-decoration: none; }
header a.brand:hover img, header a.brand:focus-visible img { filter: brightness(1.2) drop-shadow(0 0 7px rgba(251,215,39,.7)); }
/* warning before the home link leaves the game */
#leavedialog, #tutorialdialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-top: 2px solid var(--amber); border-radius: 10px;
               padding: 20px 24px; max-width: min(420px, calc(100vw - 32px)); box-shadow: 0 0 40px rgba(0,0,0,.7); }
#leavedialog::backdrop, #tutorialdialog::backdrop { background: rgba(2,4,9,.72); }
#leavedialog h3, #tutorialdialog h3 { margin: 0 0 10px; font-family: var(--mono); font-size: 14px; letter-spacing: .15em; text-transform: uppercase; color: var(--amber); }
#leavedialog p, #tutorialdialog p { margin: 0 0 18px; font-size: 14px; line-height: 1.5; color: #9fb2cc; }
.dialogbtns { display: flex; justify-content: flex-end; gap: 10px; }
.dialogbtns button { background: none; border: 1px solid var(--line); border-radius: 4px; padding: 7px 18px; font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.dialogbtns button:hover, .dialogbtns button:focus-visible { border-color: var(--cyan); color: var(--cyan); outline: none; }
#leaveok:hover, #leaveok:focus-visible { border-color: var(--red); color: var(--red); }
.byline { text-align: center; padding: 0 14px 6px; font-family: var(--mono); font-size: 11px; letter-spacing: .08em; color: #2f3b52; }
header button { background: none; border: 1px solid var(--line); border-radius: 4px; padding: 4px 10px; font-family: var(--mono); font-size: 12px; color: var(--text); white-space: nowrap; }
header button:hover { border-color: var(--cyan); color: var(--cyan); }

main { display: grid; grid-template-columns: 290px minmax(0, 1fr) 290px; gap: 12px; padding: 12px; min-height: 0; }
.col { display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow-y: auto; scrollbar-width: none; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; flex: none; transition: border-color .3s, box-shadow .3s; }
.panel h2 { margin: 0; padding: 7px 10px; font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: var(--dim);
            border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 8px; }
.panel h2 { white-space: nowrap; }
.panel h2 em { font-style: normal; color: #3f5070; letter-spacing: .05em; text-transform: none; }
.panel .body { padding: 10px; }

body[data-condition="RED"] .panel { border-color: rgba(255,59,48,.55); animation: redglow 1s ease-in-out infinite; }
@keyframes redglow { 50% { box-shadow: 0 0 22px rgba(255,59,48,.35), inset 0 0 22px rgba(255,59,48,.08); } }

#view { display: block; width: 100%; aspect-ratio: 4 / 3; background: #000; }
.viewcap { font-family: var(--mono); font-size: 11px; color: var(--dim); padding: 6px 10px; border-top: 1px solid var(--line); min-height: 28px; }

/* the panel is there only while somebody speaks, or waits for an answer */
#bridgepanel { transition: opacity .35s; }
#bridgepanel.idle { opacity: 0; pointer-events: none; }
/* one card for each person who is speaking, or has just spoken: a card folds away when its time is up */
.speaker { display: flex; gap: 12px; align-items: center; max-height: 110px; margin-bottom: 8px; overflow: hidden;
           transition: max-height .35s ease, margin .35s ease, opacity .3s; }
.speaker:last-child { margin-bottom: 0; }
.speaker.gone { max-height: 0; margin-bottom: 0; opacity: 0; }
.speaker:not(.talking) .portrait { filter: brightness(.82); }
.portrait { width: 64px; height: 64px; border-radius: 8px; flex: none; display: grid; place-items: center; font-size: 34px; font-weight: 800; font-style: italic;
            color: #0a0f1a; background: var(--dim); position: relative; overflow: hidden; transition: background .2s; }
.portrait img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* a picture of the pack instead of the initial: a larger frame, black behind pixel art */
.portrait.photo { width: 76px; height: 76px; background: #000; }
.portrait .strip { image-rendering: pixelated; background-repeat: no-repeat; }
.portrait::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, rgba(0,0,0,.18) 0 2px, transparent 2px 4px); }
.speaker .who { font-weight: 700; font-size: 15px; }
.speaker .role { font-size: 12px; color: var(--dim); margin-top: 2px; }
.speaker .wave { display: flex; gap: 3px; align-items: flex-end; height: 16px; margin-top: 8px; }
.speaker .wave i { width: 3px; height: 3px; background: var(--dim); border-radius: 1px; }
.speaker.talking .wave i { background: var(--cyan); animation: wave .5s ease-in-out infinite; }
.speaker.talking .wave i:nth-child(2n) { animation-delay: .12s; }
.speaker.talking .wave i:nth-child(3n) { animation-delay: .25s; }
@keyframes wave { 50% { height: 16px; } }

/* On the bridge: six faces, two on each row, always there. Nothing appears or moves in a
   fight: the face of who speaks lights up, with the bars dancing over it. */
#bridgepanel .body { position: relative; }
/* the Terminal pack is the plain game: no faces at all, who speaks is read in the terminal */
body[data-pack="terminal"] #bridgepanel { display: none; }
/* as large as the height of the window allows, so that the three rows fit under the viewer */
#speakers { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; --face: clamp(54px, calc((100vh - 590px) / 3), 118px); }
.crew { min-width: 0; text-align: center; }
.crew .who { font-family: var(--mono); font-size: 10px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--dim);
             margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color .2s; }
.crew .portrait, .crew .portrait.photo { width: var(--face); height: var(--face); margin: 0 auto; font-size: calc(var(--face) * .45);
             filter: brightness(.55) saturate(.6); transition: filter .25s, box-shadow .25s; }
/* lit: has just spoken (the light stays on for a while). talking: is speaking now, with the bars and a glow */
.crew.lit .portrait { filter: none; box-shadow: 0 0 0 2px rgba(95,215,255,.55); }
.crew.talking .portrait { box-shadow: 0 0 0 2px var(--cyan), 0 0 14px rgba(95,215,255,.45); }
.crew.lit .who { color: var(--division, #fff); }
/* waiting for the player's answer */
.crew.asking .portrait { filter: brightness(.95); box-shadow: 0 0 0 2px var(--amber); }
.crew.asking .who { color: var(--amber); }
.crew .wave { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; display: flex; gap: 3px; justify-content: center; align-items: flex-end;
              height: 20px; padding-bottom: 4px; background: linear-gradient(transparent, rgba(0,0,0,.7)); opacity: 0; transition: opacity .2s; }
.crew .wave i { width: 3px; height: 3px; background: var(--cyan); border-radius: 1px; }
.crew.talking .wave { opacity: 1; }
.crew.talking .wave i { animation: crewwave .5s ease-in-out infinite; }
.crew.talking .wave i:nth-child(2n) { animation-delay: .12s; }
.crew.talking .wave i:nth-child(3n) { animation-delay: .25s; }
@keyframes crewwave { 50% { height: 13px; } }
/* whoever is not one of the six (the captain reading the log, Starfleet) covers them for a moment */
#solo { position: absolute; inset: 0; z-index: 3; background: var(--panel); padding: 10px; margin: 0; max-height: none; justify-content: center; transition: opacity .3s; }
#solo.gone { opacity: 0; pointer-events: none; max-height: none; }
#solo .portrait.photo { width: 96px; height: 96px; }

.cond { display: flex; align-items: center; gap: 12px; }
.lamp { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 18px var(--accent); flex: none; transition: background .3s; }
body[data-condition="RED"] .lamp { animation: blink .5s steps(2) infinite; }
.cond b { font-family: var(--mono); font-size: 20px; letter-spacing: .2em; color: var(--accent); }
.cond small { display: block; color: var(--dim); font-size: 11px; margin-top: 2px; }

/* power bar: shields first, then the free energy, on the scale of a full tank */
.power { font-family: var(--mono); }
.powertrack { display: flex; height: 10px; background: #121a2b; border-radius: 3px; overflow: hidden; }
.powertrack i { display: block; height: 100%; transition: width .5s; }
#shieldbar { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
#energybar { background: #2f7d5b; }
.powerlegend { display: flex; justify-content: space-between; margin-bottom: 5px; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
/* days left and enemies left, under the bar */
.powerlegend.missionlegend { margin: 9px 0 0; }
.pl-foes b { color: var(--red); }
.missionlegend[data-time="low"] #daysleft { color: var(--amber); }
.missionlegend[data-time="critical"] #daysleft { color: var(--red); animation: blink 1s steps(2) infinite; }
.powerlegend b { color: #fff; font-size: 12px; }
.pl-shields::before, .pl-energy::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }
.pl-shields::before { background: var(--cyan); }
.pl-energy::before { background: #2f7d5b; }
.power[data-shields="down"] .pl-shields b { color: var(--red); }
.powerlegend.weaponlegend { margin: 9px 0 0; flex-wrap: wrap; gap: 3px 10px; }
.weaponlegend span { white-space: nowrap; }
#shieldlock { font-style: normal; color: var(--red); margin-left: 4px; }
#shieldlock::before { content: "⚠ "; }
.weaponlegend[data-torpedoes="low"] #torpval { color: var(--amber); }
.weaponlegend[data-torpedoes="down"] #torpval { color: var(--red); }
.weaponlegend[data-phasers="down"] #phaserval { color: var(--red); }
.power[data-shields="low"] .pl-shields b { color: var(--amber); }
body[data-condition="RED"] .power[data-shields="down"] .pl-shields { animation: blink 1s steps(2) infinite; color: var(--red); }

.tac-ship { fill: var(--cyan); stroke: #fff; stroke-width: .8; filter: drop-shadow(0 0 2px var(--cyan)); transition: transform ease-in-out; }
.grid8 .blocked { outline: 2px solid var(--red); background: rgba(255,59,48,.45) !important; animation: blink .5s steps(2) 3; }

.grid8 { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 2px; }
.grid8 div { aspect-ratio: 1; background: #070b13; border-radius: 2px; display: grid; place-items: center; font-family: var(--mono); font-size: 13px; }
.grid8 .E { color: var(--cyan); background: rgba(95,215,255,.14); font-weight: 700; }
.grid8 .K { color: var(--red); background: rgba(255,59,48,.16); font-weight: 700; }
.grid8 .S { color: var(--amber); }
.grid8 .B { color: var(--green); background: rgba(57,217,138,.14); }
.viewwrap { position: relative; }
/* a short film of the pack, frame by frame, over the whole viewer */
#viewclip { position: absolute; inset: 0; background: #000 no-repeat; display: none; pointer-events: none; }
#viewclip.on { display: block; }
/* the animations of the scan made of characters (packs without images): torpedo, beams, blasts, warp */
/* yellow torpedo, light blue for the phasers of the Enterprise, green for the fire of the enemy */
.grid8 .g-torp { color: #ffe93b; font-weight: 700; }
.grid8 .g-phaser, .grid8 .g-weak { color: var(--cyan); font-weight: 700; }
.grid8 .g-enemy { color: #4dff5a; font-weight: 700; }
.grid8 .wake { opacity: .55; }
.grid8 .g-boom { color: var(--amber); font-weight: 700; }
.grid8 .g-boom.hot { color: #fff; }
.grid8 .warpcell { background: rgba(95,215,255,.55) !important; }
/* the streak of light the Enterprise leaves when it goes to warp */
.tac-warp { stroke: #cfeaff; stroke-width: 1.5; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1;
            filter: drop-shadow(0 0 2px var(--cyan)); animation: warptrail cubic-bezier(.75, 0, 1, .6) forwards; }
@keyframes warptrail { 0% { stroke-dashoffset: 1; opacity: 1; } 75% { stroke-dashoffset: 0; opacity: 1; } 100% { stroke-dashoffset: 0; opacity: 0; } }
/* a pack may draw the objects of the scan with images instead of letters */
/* a little wider than the cell: the ships are long and thin, and cells are small */
/* The image is laid over its cell and never takes part in the layout: a big picture must
   not stretch the row or the column it is in (it pushed the last row out of the panel). */
.grid8 img.sprite { position: absolute; left: -12.5%; top: 0; width: 125%; height: 100%; max-width: none; object-fit: contain; display: block; z-index: 1; }
.grid8 .S img.sprite { left: 19%; top: 19%; width: 62%; height: 62%; image-rendering: pixelated; }
/* with images the cells stay dark: no coloured square behind a ship */
.grid8.sprites .E, .grid8.sprites .K, .grid8.sprites .B { background: #070b13; }
.grid8.sprites .struck { background: #070b13 !important; }
.grid8.sprites .firing { outline: none; }
.grid8 div { position: relative; }
/* the Enterprise is hit: its shields light up around it */
.grid8 .shielded::after { content: ""; position: absolute; inset: -4px; border: 2px solid #7fd4ff; border-radius: 50%; z-index: 2;
                          box-shadow: 0 0 7px #5fd7ff, inset 0 0 6px #5fd7ff; }
.grid8 .struck img.sprite { filter: brightness(0) invert(1); }
.tac-ship.sprite { filter: none; stroke: none; }
#packs { margin-bottom: 12px; }
/* tactical view: numbered rows and columns around the scan, effects drawn on top */
.tac { display: grid; grid-template-columns: 13px 1fr; grid-template-rows: 13px auto; gap: 2px; }
.tac-cols, .tac-rows { display: grid; font-family: var(--mono); font-size: 9.5px; color: var(--dim); text-align: center; }
.tac-cols { grid-template-columns: repeat(8, 1fr); gap: 2px; }
.tac-rows { grid-template-rows: repeat(8, 1fr); gap: 2px; align-items: center; }
.tac-field { position: relative; }
.tac-fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.tac-torpedo { fill: #fff; stroke: #ff7a3a; stroke-width: 1.2; filter: drop-shadow(0 0 2px #ff7a3a); transition: transform linear; }
.tac-beam { stroke-width: 1.3; stroke-linecap: round; stroke-dasharray: 1; animation: beam linear both; }
.tac-beam.phaser { stroke: var(--cyan); filter: drop-shadow(0 0 1.5px var(--cyan)); }
.tac-beam.weak { stroke: #7fa9c4; stroke-width: .8; opacity: .7; }
.tac-beam.enemy { stroke: #7dff7d; filter: drop-shadow(0 0 1.5px #7dff7d); }
@keyframes beam { 0% { stroke-dashoffset: 1; } 35% { stroke-dashoffset: 0; opacity: 1; } 85% { stroke-dashoffset: 0; opacity: 1; } 100% { stroke-dashoffset: 0; opacity: 0; } }
.tac-boom { fill: rgba(255,170,40,.85); stroke: #fff; stroke-width: .8; transform-box: fill-box; transform-origin: center; animation: boom ease-out both; }
@keyframes boom { 0% { transform: scale(.1); opacity: 1; } 60% { opacity: .9; } 100% { transform: scale(1); opacity: 0; } }
.grid8 .trail { background: rgba(255,122,58,.3); }
.grid8 .firing { outline: 1px solid #fff; }
.grid8 .struck { background: #fff !important; color: #000 !important; }
.grid8 .deflect { outline: 2px solid var(--cyan); background: rgba(95,215,255,.25) !important; }
.grid8 div { transition: background .25s; }

.galaxy div { font-size: 9.5px; color: #2c3a55; aspect-ratio: 1.4; }
.galaxy .known { color: #8fa3c2; }
.galaxy .danger { color: var(--red); background: rgba(255,59,48,.12); }
.galaxy .base { color: var(--green); }
.galaxy .here { outline: 1px solid var(--cyan); }
.offline { font-family: var(--mono); font-size: 11px; color: var(--dim); text-align: center; padding: 26px 0; }
.offline.bad { color: var(--red); animation: blink 1.4s steps(2) infinite; }

/* ---------- Terminal ---------- */
#termwrap { position: relative; display: flex; flex-direction: column; min-height: 0; background: #020409; border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
            box-shadow: inset 0 0 80px rgba(40,90,160,.12); transition: border-color .3s, box-shadow .3s; }
body[data-condition="RED"] #termwrap { border-color: rgba(255,59,48,.6); box-shadow: inset 0 0 90px rgba(255,59,48,.14), 0 0 30px rgba(255,59,48,.2); }
#termwrap::after { content: ""; position: absolute; inset: 0; pointer-events: none;
                   background: repeating-linear-gradient(0deg, rgba(0,0,0,.22) 0 1px, transparent 1px 3px); }
#termwrap.shake { animation: shake .35s linear; }
@keyframes shake { 20% { transform: translate(-5px, 3px); } 40% { transform: translate(5px, -3px); } 60% { transform: translate(-3px, -2px); } 80% { transform: translate(3px, 2px); } }
#term { flex: 1; overflow-y: auto; padding: 16px 18px 18px; font-family: var(--mono); font-size: 14.5px; line-height: 1.5; white-space: pre-wrap; word-break: break-word;
        text-shadow: 0 0 6px rgba(160,200,255,.28); scrollbar-width: thin; scrollbar-color: var(--line) transparent; cursor: text; }
#term .ln { min-height: 1.5em; }
.art, .pre { color: #6f86ab; white-space: pre; overflow-x: auto; scrollbar-width: none; }
.compass { color: #8fa3c2; }
.t-log { color: var(--amber); font-style: italic; }
.t-system, .sys { color: var(--dim); }
.t-disaster .body, .em-disaster .body { background: var(--red); color: #000; font-weight: 700; padding: 1px 6px; text-shadow: none; }
.em-warning .body { color: var(--red); font-weight: 700; }
.em-warning .body::before { content: "\26A0  "; }
.em-kill .body { background: var(--amber); color: #120c00; font-weight: 700; padding: 1px 6px; text-shadow: none; }
.notice .body { font-weight: 700; padding: 1px 6px; text-shadow: none; }
.notice-repair .body { background: rgba(57,217,138,.16); color: var(--green); box-shadow: inset 3px 0 0 var(--green); }
.notice-damage .body { background: rgba(255,59,48,.16); color: #ff8078; box-shadow: inset 3px 0 0 var(--red); }
.who { font-weight: 700; }
/* Mr Spock's lines in the tutorial: the colour of the text is set by the game (his crew colour) */
.lesson .body { font-weight: 500; }
.typed { color: #fff; font-weight: 700; }
.c-ent { color: var(--cyan); font-weight: 700; }
.c-kli { color: var(--red); font-weight: 700; }
.c-warn { color: var(--amber); font-weight: 700; }
.c-star { color: var(--amber); }
.c-base { color: var(--green); font-weight: 700; }
.unknown { color: #35486b; }
.frame { color: #35486b; }
.lbl { color: #8fa3c2; }
.val { color: #fff; font-weight: 700; }
.here { outline: 1px solid var(--cyan); outline-offset: 2px; }
.track { color: #ff7a3a; }
.inv-red { background: var(--red); color: #000; font-weight: 700; padding: 0 4px; text-shadow: none; }
.inv-green { background: var(--green); color: #000; font-weight: 700; padding: 0 4px; text-shadow: none; }
.inv-yellow { background: var(--amber); color: #000; font-weight: 700; padding: 0 4px; text-shadow: none; }
.inv-cyan { background: var(--cyan); color: #000; font-weight: 700; padding: 0 4px; text-shadow: none; }
.blink { animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .15; } }

/* the line where the player types */
.ln.prompt { display: flex; }
.ln.prompt .ptext, .ln.prompt .who { flex: none; white-space: pre; }
.tin { flex: 1; min-width: 4ch; background: none; border: 0; outline: 0; padding: 0; margin: 0; font: inherit; color: #fff; font-weight: 700; caret-color: var(--cyan);
       text-shadow: inherit; text-transform: none; }
.ln.continue { color: var(--dim); cursor: pointer; }
.ln.continue .tin { width: 1ch; flex: none; }
.newmission { margin-top: 10px; border: 1px solid var(--amber); background: rgba(255,180,0,.08); color: var(--amber); border-radius: 999px; padding: 8px 22px;
              font-family: var(--mono); font-size: 13px; letter-spacing: .2em; text-transform: uppercase; }
.newmission:hover, .newmission:focus-visible { background: var(--amber); color: #120c00; outline: none; }
/* second button next to NEW MISSION: a link that looks like it, in cyan */
.endbuttons { display: flex; flex-wrap: wrap; gap: 10px 14px; }
.newmission.leaderboardbtn { display: inline-block; text-decoration: none; border-color: var(--cyan); background: rgba(95,215,255,.08); color: var(--cyan); }
.newmission.leaderboardbtn:hover, .newmission.leaderboardbtn:focus-visible { background: var(--cyan); color: #04121a; }

/* command buttons under the terminal */
#chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px; border-top: 1px solid var(--line); background: #060a12; position: relative; z-index: 1; }
#chips button { background: none; border: 1px solid var(--line); border-radius: 4px; padding: 3px 9px; font-family: var(--mono); font-size: 12px; letter-spacing: .08em; color: var(--dim);
                opacity: .45; transition: opacity .2s, color .2s, border-color .2s; }
body.at-command #chips button { opacity: 1; color: var(--text); }
body.at-command #chips button:hover { border-color: var(--cyan); color: var(--cyan); }

/* short windows: shrink the panels so that everything stays on screen */
@media (max-height: 800px) and (min-width: 1051px) {
  #view { aspect-ratio: 16 / 9; }
  .portrait { width: 54px; height: 54px; font-size: 26px; }
  .panel .body { padding: 8px; }
  .tac { max-width: 236px; margin: 0 auto; }
  .galaxy div { aspect-ratio: 1.7; }
  main { gap: 8px; padding: 8px; }
  .col { gap: 8px; }
}

@media (max-width: 1050px) {
  body { overflow: auto; }
  #bridge { position: static; min-height: 100%; }
  main { grid-template-columns: 1fr; }
  #termwrap { height: 72vh; order: -1; }
  .col { flex-direction: row; flex-wrap: wrap; overflow: visible; }
  .col .panel { flex: 1 1 250px; }
  header .pack { display: none; }
}
@media (max-width: 560px) {
  #term { font-size: 11.5px; padding: 10px; }
  header { gap: 6px; padding: 6px 8px; }
  header .brand img { height: 13px; }
  header button { padding: 4px 7px; font-size: 11px; }
  main { padding: 8px; gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .blink, .lamp, #play, .panel, #termwrap.shake, .offline.bad { animation: none !important; }
}



