* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Loading (index.html): over everything but the scanlines until the title art's ready, then it fades */
#loading {
    z-index: 2;
    background: #000;
    gap: 2vmin;
    font-size: 3vmin;
    transition: opacity 0.6s, visibility 0s 0.6s;
}

#loading.done {
    opacity: 0;
    visibility: hidden;
}

#loading .load-title {
    font-size: 9vmin;
    letter-spacing: 1vmin;
}

.load-bar {
    width: 40vmin;
    height: 2.4vmin;
    padding: 0.4vmin;
    border: 1px solid #0f0;
    box-shadow: 0 0 6px #0f0;
}

#load-fill {
    width: 0;
    height: 100%;
    background: #0f0;
    box-shadow: 0 0 8px #0f0;
    transition: width 0.3s;
}

/* CRT knobs, set live from the tuning panel (settings.js) */
:root {
    --scanlines: 0.35;
    --vignette: 0.9;
    --curve: 4vmin;
    --roll: 0.04;
    --roll-speed: 7s;
    --flicker: 1;
    --fringe: 1px;
}

body {
    background-color: #000;
    color: #0f0;
    /* Retro green phosphor */
    font-family: 'VT323', monospace;
    height: 100vh;
    overflow: hidden;
    text-transform: uppercase;
}

canvas {
    position: fixed;
    inset: 0;
    display: block;
    width: 100vw;
    height: 100vh;
    animation: crt-on 1s ease-out;
}

/* Tube warming up: a bright line that opens into the picture */
@keyframes crt-on {
    0%,
    35% {
        transform: scale(1, 0.004);
        filter: brightness(6);
    }

    70% {
        transform: scale(1, 1);
        filter: brightness(2);
    }

    100% {
        transform: none;
        filter: none;
    }
}

/* Powered down (rescue.js; game.js toggles .on): the cabin lights go out and the view darkens as the panel winds
   down; powered back up, they come on quicker */
#dark {
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.35) 30%, rgba(0, 0, 0, 0.75) 100%);
    transition: opacity 0.8s;
}

#dark.on {
    opacity: 1;
    transition: opacity 3s ease-in;
}

/* Red edges that pulse with the heartbeat; opacity is driven from game.js */
#danger {
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    background: radial-gradient(ellipse at center, rgba(255, 0, 0, 0) 45%, rgba(255, 0, 0, 0.5) 100%);
}

/* A distress call going out (rescue.js distressSiren): the screen pulses red with each wail of the siren, swelling as
   it rises and cut off as it stops (--wail: one wail's length) */
#siren {
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    background: radial-gradient(ellipse at center, rgba(255, 0, 0, 0.15) 25%, rgba(255, 0, 0, 0.65) 100%);
}

#siren.on {
    animation: siren-wail var(--wail, 1.2s) linear 4;
}

@keyframes siren-wail {
    0% { opacity: 0; }
    45% { opacity: 0.75; }
    72% { opacity: 1; }
    76% { opacity: 0; }
    100% { opacity: 0; }
}

/* Hypoxia: the view closes in from the edges as the air runs out (game.js sets --h 0..1 and the opacity) */
#tunnel {
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) calc(80% - var(--h, 0) * 62%), rgba(0, 0, 0, 0.97) calc(110% - var(--h, 0) * 62%));
}

.overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    /* Chromatic fringing on all phosphor text */
    text-shadow: calc(-1 * var(--fringe)) 0 rgba(255, 0, 60, 0.6), var(--fringe) 0 rgba(0, 160, 255, 0.6), 0 0 6px #0f0;
}

/* Scanlines, RGB phosphor mask and the tube's dark edges */
#crt {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 3;
    background:
        radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, calc(var(--vignette) * 0.55)) 88%, rgba(0, 0, 0, var(--vignette)) 100%),
        linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, var(--scanlines)) 50%),
        linear-gradient(90deg, rgba(255, 0, 0, 0.07), rgba(0, 255, 0, 0.025), rgba(0, 0, 255, 0.07));
    background-size: 100% 100%, 100% 3px, 3px 100%;
}

/* Slow rolling hum bar */
#crt::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: -25vh;
    height: 25vh;
    background: linear-gradient(rgba(0, 255, 0, 0), rgba(0, 255, 0, var(--roll)), rgba(0, 255, 0, 0));
    animation: roll var(--roll-speed) linear infinite;
}

@keyframes roll {
    to {
        transform: translateY(150vh);
    }
}

/* Curved glass: blacked-out rounded corners and an inner shadow */
#crt::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--curve);
    box-shadow: 0 0 0 10vmin #000, inset 0 0 10vmin rgba(0, 0, 0, calc(var(--vignette) * 0.75));
}

h1#title {
    position: absolute;
    top: 6vh;
    font-size: 9vmin;
    letter-spacing: 1vmin;
}

#intro-screen,
#game-over-screen {
    position: relative;
    background-color: rgba(0, 0, 0, 0.82);
    padding: 3vmin 5vmin;
    border: 1px solid #0f0;
    box-shadow: 0 0 5px #0f0;
    font-size: 3vmin;
}

/* The briefing fits any screen: text sized by height too, the controls in two columns, and on a short screen the
   how-to-play text scrolls while the launch and lobby lines stay in view */
#intro-screen {
    margin-top: 14vh; /* below the LONG DRIFT heading (h1#title) */
    max-height: 84vh;
    display: flex;
    flex-direction: column;
    font-size: min(3vmin, 2.3vh);
}

#briefing-text {
    flex: 0 1 auto;
    min-height: 0;
    overflow-y: auto;
    pointer-events: auto;
    scrollbar-width: thin;
    scrollbar-color: #0a0 #000;
}

.controls {
    columns: 2;
    column-gap: 4vmin;
    text-align: left;
}

.controls p {
    margin: 5px 0;
    break-inside: avoid;
}

.o2 {
    color: #0ff;
}

.fuel {
    color: #fa0;
}

.mixed {
    color: #fff;
}

.colony {
    color: #f5f;
}

.ore {
    color: #fd3;
}

/* Solo / co-op choice over the title art (coop.js), above the art's bottom strip */
#mode-menu {
    position: absolute;
    bottom: 20vh;
    padding: 2vmin 5vmin;
    background: rgba(0, 0, 0, 0.75);
    border: 1px solid #0f0;
    box-shadow: 0 0 8px #0f0;
    font-size: 4.5vmin;
}

#mode-menu .option {
    padding: 0 2vmin;
    cursor: pointer;
    pointer-events: auto;
}

#mode-menu .option.on {
    color: #000;
    background: #0f0;
}

#mode-menu .hint {
    margin-top: 1vmin;
    font-size: 2.4vmin;
    opacity: 0.8;
}

/* Which version this is, so both players can check they match (in the menu box: the title art fills the corners) */
#mode-menu .version {
    margin-top: 1.5vmin;
    font-size: 2.6vmin;
    opacity: 0.85;
}

#sound-status {
    margin-top: 1vmin;
    color: #fa0;
    font-size: 2.4vmin;
}

#mode-menu .version small {
    font-size: 0.7em;
    opacity: 0.6;
}

/* Campaign slots (campaign.js): three saves and Free Drift, between the mode and the pilot. Dim: not playable from
   this mode (finished, or the other mode's). The flight controls screen (coop.js), after the pilot, and SETTINGS, off
   the title, look the same. */
:is(#slot-menu, #style-menu, #settings-menu) {
    position: relative;
    max-width: 92vw;
    padding: 2vmin 4vmin;
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid #0f0;
    box-shadow: 0 0 8px #0f0;
}

:is(#style-menu, #settings-menu) {
    max-width: min(92vw, 110vmin);
}

:is(#slot-menu, #style-menu, #settings-menu) h2 {
    font-size: 5vmin;
    margin-bottom: 1.5vmin;
}

:is(#slot-menu, #style-menu, #settings-menu) .option {
    padding: 0.6vmin 2vmin;
    font-size: 3.6vmin;
    text-align: left;
    cursor: pointer;
    pointer-events: auto;
}

:is(#slot-menu, #style-menu, #settings-menu) .option small {
    display: block;
    font-size: 0.6em;
    opacity: 0.8;
}

:is(#slot-menu, #style-menu, #settings-menu) .option.on {
    color: #000;
    background: #0f0;
}

#slot-menu .option.off {
    opacity: 0.45;
}

:is(#slot-menu, #style-menu, #settings-menu) .hint {
    margin-top: 1vmin;
    font-size: 2.4vmin;
    opacity: 0.8;
}

#campaign-line {
    color: #fbf;
}

/* The universe map (worlds.js): Free Drift's worlds drawn on the canvas behind; the heading over it, the highlighted
   world's name and what it is under it */
#world-menu {
    position: fixed;
    inset: 4vmin 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
}

#world-menu h2 {
    font-size: 5vmin;
}

#world-menu > div {
    max-width: min(92vw, 110vmin);
    padding: 1.5vmin 4vmin;
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid #0f0;
    box-shadow: 0 0 8px #0f0;
}

#world-name {
    font-size: 3.6vmin;
}

#world-name small {
    display: block;
    font-size: 0.6em;
    opacity: 0.8;
}

#world-menu .hint {
    margin-top: 1vmin;
    font-size: 2.4vmin;
    opacity: 0.8;
}

/* Choosing a pilot (coop.js): the nine portraits, the highlighted one lit up and named */
#crew-select {
    position: relative;
    padding: 2vmin 4vmin;
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid #0f0;
    box-shadow: 0 0 8px #0f0;
}

#crew-select h2 {
    font-size: 5vmin;
    margin-bottom: 1.5vmin;
}

#crew-grid {
    display: grid;
    grid-template-columns: repeat(3, 19vmin);
    gap: 1.2vmin;
    justify-content: center;
}

.crew-cell {
    width: 19vmin;
    height: 19vmin;
    border: 2px solid #050;
    filter: brightness(0.65) saturate(0.7);
    cursor: pointer;
    pointer-events: auto;
}

.crew-cell.on {
    border-color: #fff;
    filter: none;
    box-shadow: 0 0 12px #0f0;
}

/* Lost in a campaign: their death face, greyed (it can still be highlighted, not picked) */
.crew-cell.lost {
    filter: grayscale(1) brightness(0.45);
}

.crew-cell.lost.on {
    border-color: #f33;
    filter: grayscale(1) brightness(0.7);
    box-shadow: 0 0 12px #f33;
}

#crew-name {
    margin-top: 1vmin;
    font-size: 5vmin;
    color: #fff;
    letter-spacing: 0.3em;
}

#crew-select .hint {
    font-size: 2.4vmin;
    opacity: 0.8;
}

/* The crew in the HUD's corner (coop.js): talking lights a portrait, radio shadow turns the far end's to static,
   a lost ship greys the pilot's out */
#crew-cards {
    position: absolute;
    top: 9vh;
    right: 5vw;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: flex-start;
    max-width: 31vmin; /* the two crew side by side, passengers in rows of three under them */
    gap: 1.5vmin;
}

.card {
    margin: 0;
    text-align: center;
    font-size: 2vmin;
}

.card img {
    display: block;
    width: 14vmin;
    height: 14vmin;
    border: 1px solid #0f0;
    filter: brightness(1.35) contrast(1.1); /* the art is dark; the scanlines and vignette darken a corner further */
}

.card figcaption {
    margin-top: 0.4vmin;
    line-height: 1.1;
}

.card small {
    display: block;
    font-size: 0.75em;
    opacity: 0.7;
}

/* Passengers (jobs.js): smaller, on their own rows under the crew, three as wide as the two crew cards */
.pax-row {
    display: flex;
    flex-wrap: wrap;
    flex-basis: 100%;
    justify-content: inherit;
    gap: inherit;
}

.card.pax {
    width: 8.8vmin;
    font-size: 1.5vmin;
}

.card.pax img {
    width: 8.8vmin;
    height: 8.8vmin;
    border-color: #7cf;
}

.card.talking img {
    border-color: #fff;
    box-shadow: 0 0 10px #fff;
}

.card.lost img {
    filter: grayscale(1) contrast(1.8) brightness(0.5);
    animation: card-static 0.2s steps(2) infinite;
}

.card.lost figcaption::after {
    content: 'NO SIGNAL';
    display: block;
    color: #f33;
}

/* (the pilot's card shows their death portrait by then: coop.js pilotFace) */
.card.down img {
    border-color: #f33;
    box-shadow: 0 0 8px #f33;
}

.card.down figcaption {
    color: #f33;
}

/* Mission control's, sentenced by HQ (coop.js showHq): no death portrait, so the face itself goes red */
.card.down[data-job="mc"] img {
    filter: grayscale(1) sepia(1) saturate(6) hue-rotate(-45deg) brightness(0.8) contrast(1.2);
}

/* Mission control's biomonitor under the pilot's portrait (coop.js drawEcg): the heart's trace */
.card .ecg {
    position: static; /* (not the full-screen canvas rule's) */
    animation: none;
    display: block;
    width: 14vmin;
    height: 4.5vmin;
    margin-top: 0.6vmin;
    border: 1px solid #0f0;
    background: rgba(0, 20, 0, 0.85);
}

.card.down .ecg {
    border-color: #f33;
}

@keyframes card-static {
    50% {
        transform: translateX(2px);
        opacity: 0.6;
    }
}

/* Mission control: in the console column, between its panel and the emergency box */
body.role-mc #crew-cards {
    top: 48vh;
    right: auto;
    left: 70vw;
    justify-content: flex-start;
}

#mode-menu.asleep .option,
#mode-menu.asleep .hint,
#mode-menu:not(.asleep) .wake {
    display: none;
}

/* Escape mid-run: abandon it for the main menu? (coop.js) */
:is(#quit-ask, #paused) {
    position: absolute;
    top: 40vh;
    padding: 2vmin 4vmin;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid #0f0;
    box-shadow: 0 0 8px #0f0;
    font-size: 3.5vmin;
    z-index: 1;
}

:is(#quit-ask, #paused) small {
    font-size: 0.7em;
    opacity: 0.8;
}

/* Co-op role swap offer on the home pad (coop.js), above the bottom readouts */
#swap {
    position: absolute;
    bottom: 12vh;
    padding: 1vmin 3vmin;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid #fff;
    color: #fff;
    font-size: 3vmin;
}

/* Radio shadow (coop.js): the link to home is blocked by a rock */
#signal {
    position: absolute;
    top: 4vh;
    padding: 0.5vmin 2vmin;
    border: 1px solid #f33;
    color: #f33;
    background: rgba(0, 0, 0, 0.8);
    font-size: 3vmin;
    animation: blinker 1s steps(1) infinite;
}

/* Mission control: in the console column under its panel, clear of the radar */
body.role-mc #swap {
    bottom: auto;
    top: 42vh;
    left: 70vw;
    width: 27vw;
    font-size: 2.6vmin;
}

/* --- Co-op (coop.js) --- */
#room-code {
    width: 26vmin;
    margin: 1vmin 0;
    padding-left: 0.4em; /* balances the letter spacing after the last letter */
    font: inherit;
    font-size: 7vmin;
    letter-spacing: 0.4em;
    text-align: center;
    text-transform: uppercase;
    color: #0f0;
    background: #000;
    border: 1px solid #0f0;
    outline: none;
    pointer-events: auto;
}

/* Callsign box on the briefing (coop.js) */
#callsign {
    width: 16vmin;
    font: inherit;
    text-align: center;
    text-transform: uppercase;
    color: #fff;
    background: #000;
    border: 1px solid #0f0;
    outline: none;
    pointer-events: auto;
}

#callsign:focus {
    border-color: #fff;
    box-shadow: 0 0 6px #0f0;
}

/* The mission report, typed out on the fail screen (game.js): laid out in full from the start, the untyped part
   invisible, so the box doesn't grow as it types */
#end-message {
    white-space: pre;
    text-align: left;
    font-size: 3vmin;
    font-weight: normal;
    line-height: 1.35;
}

#end-message::first-line {
    font-size: 1.5em;
    color: #f33;
}

#end-message .untyped {
    visibility: hidden;
}

#retry-keys {
    margin-top: 2vmin;
}

/* Co-op lobby (coop.js): the how-to-play text folds away ([I] brings it back) */
#intro-screen.coop:not(.help) #briefing-text {
    display: none;
}

#coop-lobby h2 {
    color: #fff;
    font-size: 1.6em;
    margin-bottom: 0.5vmin;
}

.seats {
    display: flex;
    gap: 4vmin;
    justify-content: center;
    margin: 2vmin 0 1vmin;
}

.seat {
    flex: 1;
    max-width: 42vmin;
    padding: 2vmin;
    border: 1px solid #0f0;
    box-shadow: 0 0 6px #0f0;
    cursor: pointer;
    pointer-events: auto;
}

.seat:hover {
    background: rgba(0, 255, 0, 0.12);
}

.seat h3 {
    color: #fff;
    font-size: 1.3em;
    margin-bottom: 1vmin;
}

.seat .key {
    color: #fff;
    font-size: 1.5em;
    margin-top: 1vmin;
}

.room-big {
    color: #fff;
    font-size: 3.4em;
    letter-spacing: 0.5em;
    padding-left: 0.5em;
    text-shadow: 0 0 10px #0f0;
}

/* The checklist: left-aligned lines in a centred block */
.steps {
    display: inline-block;
    text-align: left;
    margin: 1.5vmin 0 0.5vmin;
}

.step {
    margin: 0.5vmin 0;
}

.step.done {
    color: #0f0;
}

.step.wait {
    color: #fa0;
}

.step.bad {
    color: #f33;
}

.go {
    color: #fff;
    font-size: 1.8em;
    margin-top: 1vmin;
}

.next {
    color: #8a8;
    margin-top: 1vmin;
}

.yours {
    color: #9c9;
    font-size: 0.85em;
    margin-top: 1.5vmin;
}

#link-lost {
    position: absolute;
    top: 40vh;
    padding: 2vmin 4vmin;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid #f33;
    color: #f33;
    font-size: 3.5vmin;
    white-space: pre-line;
    animation: blinker 1.2s steps(1) infinite;
}

/* Radio: who's talking (coop.js) */
#voice {
    position: absolute;
    top: 4vh;
    padding: 0.5vmin 2vmin;
    border: 1px solid #f33;
    color: #f33;
    font-size: 3vmin;
    background: rgba(0, 0, 0, 0.7);
}

#voice.incoming {
    border-color: #fff;
    color: #fff;
    animation: blinker 0.8s steps(1) infinite;
}

/* Emergencies (faults.js): centred under the radio light for the pilot, under the panel for mission control */
#fault {
    position: absolute;
    z-index: 1; /* over mission control's portraits when passengers fill their column */
    top: 12vh;
    padding: 1.5vmin 3vmin;
    background: #140000;
    border: 2px solid #f33;
    box-shadow: 0 0 10px #f33;
    font-size: 3.2vmin;
    line-height: 1.4;
    /* centred, so as wide as it can be while staying clear of the crew portraits down the right (#crew-cards) */
    max-width: max(36vw, 90vw - 70vmin);
}

#fault small {
    font-size: 0.75em;
    color: #f88;
}

#fault b {
    color: #fff;
    font-size: 1.4em;
    letter-spacing: 0.3em;
}

body.role-mc #fault {
    top: auto;
    bottom: 14vh;
    left: 70vw;
    width: 27vw;
    font-size: 2.6vmin;
}

/* Mission control's contact warning (ships.js contactAlert): over the top of the radar, flashing */
#contact {
    position: absolute;
    top: 30vh;
    padding: 1vmin 3vmin;
    border: 2px solid #f33;
    background: rgba(20, 0, 0, 0.9);
    color: #f33;
    font-size: 3.2vmin;
    line-height: 1.3;
    animation: alert-flash 0.5s steps(1) infinite;
}

#contact small {
    font-size: 0.7em;
}

/* The prompts (index.html #toasts): one stack low in the middle, each box flashing a few times then steady, and only
   the boxes that are up take a place, so they never leave gaps. From the bottom: the pumps reminder on touchdown
   (coop.js pumpToast); the distress prompts (rescue.js distressToast), red when it's life or death; the pirates'
   warning (ships.js pirateToast), always red; a skipper's words (ships.js skipperRadio), amber; a solar storm's
   warning (storm.js stormToast), red; the hold's weight (coop.js weightToast), amber */
#toasts {
    position: absolute;
    left: 50%;
    bottom: 17vh;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    gap: 1vmin;
    max-width: 80vw;
}

/* :where: no more weight than an id, so each box's own colours below (#pirate-toast red, #skipper-toast amber...) win */
#toasts > :where(div) {
    padding: 0.6vmin 2vmin;
    border: 1px solid #0f0;
    background: rgba(0, 20, 0, 0.85);
    color: #0f0;
    font-size: 2.4vmin;
    text-align: center;
    animation: toast-flash 0.4s steps(1) 3;
}

#pump-toast {
    white-space: nowrap;
}

/* Solo, sat on a pad with fuel or O2 to fill (coop.js tankToast): a button for each just under the ship, pressed or
   clicked, in the pad colours; a pump on pulses till its tank is full */
#tank-toast {
    position: absolute;
    transform: translateX(-50%);
    display: flex;
    gap: 1.5vmin;
    padding: 0.8vmin;
    border: 1px solid #0f0;
    background: rgba(0, 20, 0, 0.9);
    font-size: 2.8vmin;
    white-space: nowrap;
    animation: toast-flash 0.4s steps(1) 3;
}

#tank-toast span {
    padding: 0.6vmin 1.8vmin;
    border: 1px solid;
}

#tank-toast .fuel {
    color: #fa0;
}

#tank-toast .o2 {
    color: #0ff;
}

#tank-toast .on {
    border-style: dashed;
    animation: power-pulse 1s ease-in-out infinite;
}

/* The world's shopkeeper at a run's start and at each port (trade.js shopToast): their face, a line and the keys, in the
   prompts' box, just under the ship wherever it sits (mission control's: just over it on the radar) */
#shop-toast {
    position: absolute;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 1.5vmin;
    width: 66vmin;
    padding: 0.8vmin;
    border: 1px solid #0f0;
    background: rgba(0, 20, 0, 0.9);
    color: #0f0;
    font-size: 2.3vmin;
    text-align: left;
    animation: toast-flash 0.4s steps(1) 3;
}

body.role-mc #shop-toast {
    transform: translate(-50%, -100%);
}

#shop-toast img {
    flex: none;
    width: 17vmin;
    height: 17vmin;
    border: 1px solid #0a0;
}

#shop-toast p {
    margin: 0.4vmin 0;
}

#shop-toast .who {
    color: #fff;
}

#shop-toast .key {
    font-size: 2.4vmin;
}

/* A collectible or a bobblehead in today (trade.js shopToast): gold, like its celebration */
#shop-toast .curio {
    color: #fd4;
    text-shadow: 0 0 6px #fa0;
}

/* Mission control's leak prompt (arm.js armToast): bigger and red, in the middle of the radar, flashing till the arm's out */
#arm-toast {
    position: absolute;
    transform: translateX(-50%);
    padding: 1vmin 2.5vmin;
    border: 2px solid #f33;
    background: rgba(40, 0, 0, 0.9);
    color: #f44;
    font-size: 3.2vmin;
    white-space: nowrap;
    text-shadow: 0 0 6px #f00;
    animation: arm-flash 0.6s steps(1) infinite;
}

@keyframes arm-flash {
    50% {
        background: #f33;
        color: #000;
        text-shadow: none;
    }
}

/* A collectible bought (trade.js collect): gold, in the middle of the screen over the shop, bouncing in with sparkles,
   its name in jumping letters (a card has it on its picture), gone after 5 s or at a click (a card has an OK on it) */
#collect-pop {
    position: fixed;
    pointer-events: auto;
    cursor: pointer;
    left: 50%;
    top: 45%;
    min-width: 44vmin;
    padding: 2vmin 4vmin;
    border: 4px double #fd4;
    background: rgba(25, 18, 0, 0.94);
    color: #fd4;
    text-align: center;
    text-shadow: 0 0 8px #fa0;
    box-shadow: 0 0 30px rgba(255, 200, 0, 0.5);
    transform: translate(-50%, -50%);
}

#collect-pop.show {
    animation: collect-in 0.6s cubic-bezier(0.2, 1.6, 0.4, 1) both, collect-glow 0.8s ease-in-out 0.6s infinite alternate;
}

#collect-pop.out {
    animation: collect-out 0.4s ease-in forwards;
}

#collect-pop small {
    display: block;
    font-size: 2.8vmin;
    letter-spacing: 0.25em;
    animation: collect-blink 0.4s steps(1) infinite;
}

#collect-pop img {
    display: block;
    width: 26vmin;
    height: 26vmin;
    margin: 1.5vmin auto 0;
    object-fit: contain;
    animation: collect-wobble 1.6s ease-in-out infinite;
}

/* A card: the pop-up the user drew, big and still (its name's on it) */
#collect-pop img.card {
    width: 46vmin;
    height: 46vmin;
    animation: none;
}

#collect-pop .wave {
    display: block;
    margin: 1.5vmin 0 1vmin;
    font-size: 5.5vmin;
    white-space: nowrap;
}

#collect-pop .wave span {
    display: inline-block;
    animation: collect-wave 1s ease-in-out infinite;
}

#collect-pop p {
    margin: 0;
    font-size: 2.6vmin;
    color: #fff;
}

/* the sparkles, twinkling at its corners */
#collect-pop::before,
#collect-pop::after {
    content: '\2726   \2727   \2726';
    position: absolute;
    left: 0;
    right: 0;
    font-size: 4vmin;
    white-space: pre;
    animation: collect-twinkle 0.7s steps(2) infinite;
}

#collect-pop::before {
    top: -5vmin;
}

#collect-pop::after {
    bottom: -5vmin;
    animation-delay: 0.35s;
}

@keyframes collect-in {
    from {
        transform: translate(-50%, -50%) scale(0) rotate(-10deg);
        opacity: 0;
    }
    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

@keyframes collect-out {
    to {
        transform: translate(-50%, -50%) scale(0.6);
        opacity: 0;
    }
}

@keyframes collect-glow {
    to {
        box-shadow: 0 0 70px rgba(255, 220, 0, 0.95);
    }
}

@keyframes collect-blink {
    50% {
        color: #fff;
    }
}

@keyframes collect-wave {
    0%, 60%, 100% {
        transform: translateY(0);
        color: #fd4;
    }
    25% {
        transform: translateY(-1.4vmin);
        color: #fff;
    }
}

@keyframes collect-wobble {
    0%, 100% {
        transform: rotate(-6deg) scale(1);
    }
    50% {
        transform: rotate(6deg) scale(1.07);
    }
}

@keyframes collect-twinkle {
    50% {
        opacity: 0.2;
    }
}

@keyframes toast-flash {
    50% {
        background: #0f0;
        color: #000;
    }
}

#weight-toast {
    border-color: #fa0;
    background: rgba(30, 20, 0, 0.85);
    color: #fa0;
    animation-name: toast-flash-weight;
}

@keyframes toast-flash-weight {
    50% {
        background: #fa0;
        color: #000;
    }
}

#weight-toast.bad {
    border-color: #f44;
    background: rgba(30, 0, 0, 0.85);
    color: #f44;
    animation-name: toast-flash-bad;
}

/* A clean touchdown's grade (game.js gradeLanding): over the ship, popping in, then fading. Greased: gold */
#landing-toast {
    position: absolute;
    left: 50%;
    top: 28vh;
    transform: translateX(-50%);
    padding: 0.6vmin 2vmin;
    color: #0f0;
    font-size: 3.4vmin;
    text-align: center;
    animation: landing-pop 2.6s ease-out forwards;
}

#landing-toast small {
    display: block;
    font-size: 0.6em;
    opacity: 0.8;
}

#landing-toast.greased {
    color: #ff8;
}

@keyframes landing-pop {
    0% { opacity: 0; transform: translateX(-50%) scale(1.4); }
    8% { opacity: 1; transform: translateX(-50%) scale(1); }
    70% { opacity: 1; }
    100% { opacity: 0; }
}

/* Sound off (audio.js toggleMute): on every screen, top right */
#muted {
    position: fixed;
    top: 1.2vmin;
    right: 1.5vmin;
    z-index: 20;
    color: #f44;
    font-size: 2.2vmin;
    pointer-events: none;
}

/* The opening menus' mute button, bottom right (audio.js): waves while the sound's on, a red cross while it's off. A
   small phosphor box like the menus', under the tube's scanlines and glass (#crt) */
#speaker {
    position: fixed;
    right: 1.6vmin;
    bottom: 1.6vmin;
    z-index: 2;
    width: 3vmin;
    height: 3vmin;
    padding: 0.4vmin;
    color: #0f0;
    background: rgba(0, 0, 0, 0.75);
    border: 1px solid currentColor;
    box-shadow: 0 0 5px currentColor;
    cursor: pointer;
    pointer-events: auto;
}

#speaker:hover {
    color: #bfb;
}

#speaker svg {
    display: block;
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: square;
    shape-rendering: crispEdges; /* (blocky, like the VT323 type) */
    /* the phosphor the menus' text has (.overlay): red and blue fringes and a glow */
    filter: drop-shadow(calc(-1 * var(--fringe)) 0 rgba(255, 0, 60, 0.6)) drop-shadow(var(--fringe) 0 rgba(0, 160, 255, 0.6)) drop-shadow(0 0 2px currentColor);
}

#speaker .box {
    fill: currentColor;
}

#speaker.off {
    color: #f44;
}

#speaker .cross,
#speaker.off .waves {
    display: none;
}

#speaker.off .cross {
    display: inline;
}

/* A feed line about a place (a contact): click it for a waypoint there (coop.js) */
#feed p.way {
    pointer-events: auto;
    cursor: pointer;
    text-decoration: underline dotted;
}

#feed p.way:hover {
    color: #fff;
}

/* The drill's code on mission control's panel: the digits keyed so far */
#mc-panel .typed {
    color: #fff;
    text-decoration: underline;
}

/* Powering back up (rescue.js powerUpCountdown): the count, big in the middle of both screens, over the dark */
#power-up {
    position: absolute;
    left: 50%;
    top: 42%;
    transform: translate(-50%, -50%);
    font-size: 8vmin;
    color: #fc8;
    text-shadow: 0 0 2vmin #fc8;
    white-space: nowrap;
    animation: power-pulse 1s ease-in-out infinite;
}

@keyframes power-pulse {
    50% {
        opacity: 0.55;
    }
}

#skipper-toast {
    border-color: #fc8;
    background: rgba(30, 20, 0, 0.85);
    color: #fc8;
    animation-name: toast-flash-skipper;
}

@keyframes toast-flash-skipper {
    50% {
        background: #fc8;
        color: #000;
    }
}

#distress-toast.bad,
#pirate-toast,
#storm-toast,
#seal-toast {
    border-color: #f44;
    background: rgba(30, 0, 0, 0.85);
    color: #f44;
    animation-name: toast-flash-bad;
}

/* The robot arm's news (arm.js armSay: NO LEAKS FOUND): amber, not the red of its trouble */
#seal-toast.news {
    border-color: #fa0;
    background: rgba(30, 20, 0, 0.85);
    color: #fa0;
    animation-name: toast-flash-weight;
}

@keyframes toast-flash-bad {
    50% {
        background: #f44;
        color: #000;
    }
}

/* A live emergency flashes on mission control's console so it isn't missed while they watch the radar
   (faults.js sets .alert; the screen edges flash too: updateDanger in game.js) */
body.role-mc #fault.alert {
    animation: alert-flash 0.5s steps(1) infinite;
}

body.role-mc #fault.alert small {
    color: inherit;
}

@keyframes alert-flash {
    50% {
        background: #b00;
        border-color: #fff;
        color: #fff;
        box-shadow: 0 0 30px #f33;
    }
}

/* The pilot flies half-blind: only raw SPEED / ALT / ATT and the fuel gauge (watching it drain is their worry); no
   other gauges, credits, status, warning colours or CAPCOM text (mission control has all that) */
body.role-pilot .gauge:not(.fuel-gauge),
body.role-pilot #status,
body.role-pilot .hud-top > span:first-child,
body.role-pilot #comms {
    display: none !important;
}

body.role-pilot #hud .warn,
body.role-pilot #hud .bad {
    color: #0f0;
    text-shadow: none;
}

/* Mission control's panel, right of the radar */
#mc-panel {
    display: none;
    position: absolute;
    left: 70vw;
    top: 25vh;
    width: 27vw;
    padding: 1.5vmin 2vmin;
    background: rgba(0, 12, 0, 0.85);
    border: 1px solid #0f0;
    font-size: 2.6vmin;
    text-align: left;
}

#mc-panel p {
    margin: 0.6vmin 0;
}

/* The pumps line's flash, on alternate half-seconds (coop.js updateMcPanel) */
#mc-panel .pump-flash {
    background: #b00;
    color: #fff;
    box-shadow: 0 0 20px #f33;
}

#mc-panel .pump-flash .warn {
    color: #fff;
}

body.role-mc #mc-panel {
    display: block;
}

/* Mission control's feed (coop.js updateFeed): a terminal under the crew cards, down to the radar's bottom edge, the
   newest line at the bottom and the oldest fading off the top */
#feed {
    display: none;
    position: absolute;
    left: 70vw;
    top: 67vh;
    bottom: 12vh;
    width: 27vw;
    padding: 0.8vmin 1.5vmin;
    box-sizing: border-box;
    flex-direction: column;
    justify-content: flex-end;
    overflow: hidden;
    background: rgba(0, 12, 0, 0.85);
    border: 1px solid #0a0;
    font-size: 1.9vmin;
    line-height: 1.15;
    text-align: left;
    color: #6f6;
    -webkit-mask-image: linear-gradient(transparent, #000 35%);
    mask-image: linear-gradient(transparent, #000 35%);
}

body.role-mc #feed {
    display: flex;
}

/* The spam over mission control's radar (coop.js openAd): each advert a canvas placed in screen pixels */
#ads {
    display: none;
    position: absolute;
    left: 0;
    top: 0;
}

body.role-mc #ads {
    display: block;
}

#ads .ad {
    position: absolute;
    inset: auto; /* (not the game canvas's full screen) */
    height: auto;
    animation: none;
    pointer-events: auto;
    filter: drop-shadow(0 0 1.2vmin #000);
}

#ads .shake {
    animation: ad-shake 0.4s;
}

@keyframes ad-shake {
    0%,
    100% {
        transform: none;
    }

    15% {
        transform: translate(-9px, 2px) rotate(-1deg);
    }

    30% {
        transform: translate(8px, -2px) rotate(1deg);
    }

    45% {
        transform: translate(-7px, 1px);
    }

    60% {
        transform: translate(6px, -1px) rotate(0.5deg);
    }

    80% {
        transform: translate(-3px, 0);
    }
}

#feed p {
    margin: 0;
    overflow-wrap: anywhere;
}

#feed .dim {
    color: #3a3;
}

#feed .chat {
    color: #fc8;
}

#feed .warn {
    color: #fa0;
}

#feed .bad {
    color: #f55;
}

/* Mission control reads the landing verdict in its panel: the readouts stay put in the bottom bar */
body.role-mc #approach {
    display: none;
}

body.role-mc .hud-stats .flight {
    opacity: 1;
}

/* Upgrade shop (trade.js): opened with U while landed at home or a colony */
#shop {
    position: relative;
    min-width: 60vmin;
    padding: 2.5vmin 4vmin;
    background-color: rgba(0, 0, 0, 0.88);
    border: 1px solid #f5f;
    box-shadow: 0 0 6px #f5f;
    font-size: 2.8vmin;
    text-align: left;
}

#shop h2 {
    color: #f5f;
    margin-bottom: 0.5vmin;
}

#shop > p {
    color: #fd3;
    margin-bottom: 1.5vmin;
}

.shop-row {
    display: grid;
    grid-template-columns: 1fr 7vmin 18vmin 11vmin;
    gap: 2vmin;
    padding: 0.4vmin 0;
}

.shop-row span:last-child {
    text-align: right;
    color: #fd3;
    white-space: nowrap; /* (a price and its dearer / cheaper mark on one line) */
}

.shop-row.poor {
    opacity: 0.45;
}

.shop-row.maxed {
    opacity: 0.6;
}

.shop-row.maxed span:last-child {
    color: #0f0;
}

/* Jobs board rows (jobs.js): what, where to, what it pays */
.shop-row.job {
    grid-template-columns: 1fr auto 11vmin;
}

/* Distress call rows (rescue.js): who, too slow?, how soon, what it costs; then the small print */
.shop-row.call {
    grid-template-columns: 1fr auto 11vmin 17vmin;
}

.shop-row.call span {
    white-space: nowrap;
}

.shop-row.slow {
    opacity: 0.55;
}

.shop-row.slow span:nth-child(2) {
    color: #f44;
}

.call-note {
    font-size: 0.85em;
    opacity: 0.75;
    margin: 0.6vmin 0 0;
}

#shop h3 {
    color: #7cf;
    margin-top: 1.5vmin;
}

#shop > p.shop-hint {
    color: #0f0;
    margin: 1.5vmin 0 0;
    text-align: center;
}

.blink {
    animation: blinker 1s linear infinite;
}

/* Main-menu tuning slots (settings.js) */
.slot {
    padding: 0 0.5vmin;
}

.slot.on {
    color: #000;
    background: #0f0;
}

.slot.empty {
    opacity: 0.4;
}

@keyframes blinker {
    50% {
        opacity: 0;
    }
}

.hidden {
    display: none !important;
}

#hud {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 4vh 5vw;
    font-size: min(3vmin, 1.7vw); /* (by width too: on a squarer screen the bottom bar's readouts ran together) */
    /* The overlay's fringe and glow, over a dark halo: thin green text on a bright rock otherwise washes out */
    text-shadow: calc(-1 * var(--fringe)) 0 rgba(255, 0, 60, 0.6), var(--fringe) 0 rgba(0, 160, 255, 0.6), 0 0 6px #0f0,
        0 0 2px #000, 0 0 4px #000, 0 0 8px #000;
}

.hud-top,
.hud-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2vmin;
    width: 100%;
}

.gauge {
    display: flex;
    align-items: center;
    gap: 1vmin;
}

.bar {
    width: min(12vmin, 6.8vw);
    height: 1.6vmin;
    border: 1px solid #0f0;
}

.bar div {
    height: 100%;
}

#fuel-bar {
    background-color: #fa0;
}

#o2-bar {
    background-color: #0ff;
}

#hull-bar {
    background-color: #0f0;
}

#cargo-bar {
    background-color: #0f0;
}

/* Half full: amber. Nearly full: red, flashing (game.js updateHud) */
#cargo-bar.mid {
    background-color: #fa0;
}

#cargo-bar.full {
    background-color: #f33;
    animation: blinker 0.6s steps(1) infinite;
}

/* Low (under LOW_FUEL, LOW_O2): flashing (game.js updateHud) */
:is(#fuel-bar, #o2-bar).low {
    animation: blinker 0.5s steps(1) infinite;
}

#hull-bar.bad {
    background-color: #f33;
}

/* Mission control's hold line (demo.js holdLine): each ore a button that vents it */
#mc-panel .vent {
    pointer-events: auto;
    cursor: pointer;
    padding: 0 0.5vmin;
    border: 1px solid currentColor;
    color: #fd3;
}

#mc-panel .vent:hover {
    background: #fd3;
    color: #000;
}

/* What's in the hold (game.js updateHud): small over the cargo gauge */
.gauge:has(> #cargo-what) {
    position: relative;
}

#cargo-what {
    position: absolute;
    left: 0;
    bottom: 115%;
    font-size: 0.85em;
    white-space: nowrap;
}

/* A leak just stopped (seal.js sealedFlash): SEALED flashing over the gauge, the bar lit up; a fuel line's in orange */
.gauge.sealed {
    position: relative;
}

.gauge.sealed::after {
    content: 'SEALED';
    position: absolute;
    left: 50%;
    bottom: 130%;
    transform: translateX(-50%);
    color: #0f0;
    animation: blinker 0.3s steps(1) infinite;
}

.gauge.sealed .bar {
    box-shadow: 0 0 1vmin #0f0;
}

.fuel-gauge.sealed::after {
    color: #fa0;
    text-shadow: 0 0 5px #fa0;
}

.fuel-gauge.sealed .bar {
    box-shadow: 0 0 1vmin #fa0;
}

/* A sun system's hull heat (sun.js): orange, amber past 75, red and flashing past 95; only by a sun */
#heat-bar {
    background-color: #f80;
}

#heat-bar.warm {
    background-color: #fc0;
}

#heat-bar.bad {
    background-color: #f33;
    animation: blinker 0.4s steps(1) infinite;
}

body:not(.sun-world) .heat-gauge,
body.maw-world .heat-gauge { /* (the Maw is a sun world without the heat: maw.js) */
    display: none;
}

/* With the heat gauge too, the bars shrink so the row still fits */
body.sun-world:not(.maw-world) .bar {
    width: min(9vmin, 5vw);
}

/* A reading in the hard-landing zone: survivable, but it will cost hull */
.warn {
    color: #f80;
    text-shadow: 0 0 5px #f80;
}

.bad {
    color: #f33;
    text-shadow: 0 0 5px #f33;
}

#status.bad {
    animation: blinker 1s linear infinite;
}

/* Landing readout: a big SPEED / ALT / ATT that grows up out of the bottom bar's right end on approach,
   while the bar's own copies fade. game.js sets --approach (0..1) and --approach-scale. */
#approach {
    position: absolute;
    right: 5vw;
    bottom: calc(4vh + 4.5vmin);
    display: flex;
    gap: 3vmin;
    transform-origin: bottom right;
    transform: scale(var(--approach-scale, 1));
    opacity: var(--approach, 0);
}

.hud-stats .flight {
    opacity: calc(1 - var(--approach, 0));
}

/* A wild pad's reserves (game.js padInfo): in the landing readout's corner, which is empty once down */
#pad-info {
    position: absolute;
    right: 5vw;
    bottom: calc(4vh + 4.5vmin);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.8vmin;
}

#pad-info p {
    margin: 0;
}

body.role-pilot #pad-info,
body.role-mc #pad-info,
#hud.chart #pad-info {
    display: none;
}

/* Radio transmissions */
#comms {
    position: absolute;
    top: 11vh;
    left: 50%;
    transform: translateX(-50%);
    max-width: 70vw;
    padding: 1vmin 2vmin;
    border: 1px solid #0f0;
    background: rgba(0, 20, 0, 0.6);
    text-align: left;
    font-size: 3.2vmin;
}

#comms .from {
    color: #fff;
    animation: blinker 0.5s steps(1) infinite;
}

/* Pirates on the channel (ships.js gangSpeaking): their gang's name for CAPCOM's, in red */
#comms.pirate {
    border-color: #f44;
    background: rgba(30, 0, 0, 0.6);
    color: #f44;
}

#comms.pirate .from {
    color: #f88;
}

/* Someone on the radio with a face (ships.js showCall): their portrait coming up through static, left of the view;
   red for a pirate, amber for a traveller's skipper, green for a mining colony's boss (trade.js shopToast) */
#radio-call {
    position: absolute;
    left: 3vw;
    top: 30vh;
    width: 24vmin;
    padding: 0.8vmin;
    border: 1px solid #f44;
    background: rgba(0, 0, 0, 0.85);
    color: #f44;
    font-size: 2vmin;
}

/* Mission control: smaller, low on the radar's left, under the pilot's landing numbers (instruments.js mcReadout) */
body.role-mc #radio-call {
    top: 64vh;
    width: 18vmin;
}

#radio-call.skipper {
    border-color: #fc8;
    color: #fc8;
}

#radio-call.boss {
    border-color: #0f0;
    color: #0f0;
}

/* Someone stranded calling a mayday (jobs.js strandedRadio): a pale cold blue, not a trader's amber or a pirate's red */
#radio-call.sos {
    border-color: #9cf;
    color: #9cf;
}

#radio-call .who {
    margin-bottom: 0.6vmin;
    white-space: nowrap;
    overflow: hidden;
    animation: blinker 0.5s steps(1) infinite;
}

#radio-call .face {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    background: #000;
}

#radio-call img,
#radio-call canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

#radio-call canvas {
    image-rendering: pixelated;
    mix-blend-mode: screen;
}

#comms-text::after {
    content: '_';
    animation: blinker 0.6s steps(1) infinite;
}

/* CRT flicker effect */
body::after {
    content: " ";
    display: block;
    position: absolute;
    inset: 0;
    background: rgba(18, 16, 16, 0.1);
    opacity: 0;
    z-index: 4;
    pointer-events: none;
    animation: flicker 0.15s infinite;
}

@keyframes flicker {
    0% {
        opacity: calc(0.06 * var(--flicker));
    }

    50% {
        opacity: calc(0.02 * var(--flicker));
    }

    100% {
        opacity: calc(0.09 * var(--flicker));
    }
}

/* The flier's keys, top left, small: a column of keys and one of what they do, two pairs a row. Solo's under the belt
   line and clear of the CAPCOM box; the co-op pilot has the corner to themselves. Mission control's are on its panel. */
#keys-help {
    position: absolute;
    top: 9vh;
    left: 5vw;
    font-size: 1.7vmin;
    opacity: 0.7;
    text-align: left; /* (the HUD centres its text: here it would scatter the columns) */
}

#keys-help > div {
    display: grid;
    grid-template-columns: repeat(4, auto);
    justify-content: start;
    gap: 0.1vmin 1.4vmin;
    white-space: nowrap;
}

#keys-help kbd {
    font: inherit;
}

/* [N] DROP CHARGE: only in a sun system (demo.js) */
body:not(.sun-world) #keys-help .sun-key {
    display: none;
}

body.role-pilot #keys-help {
    top: 4vh;
}

body.role-mc #keys-help,
body.role-pilot #keys-help .solo,
body:not(.role-pilot) #keys-help .pilot {
    display: none;
}

/* The full map's up (game.js draw): its title and top corners would sit on the keys and the crew cards */
#hud.chart #keys-help,
#hud.chart #crew-cards {
    visibility: hidden;
}

/* Powered down (rescue.js): the readouts go dark but the air, and the status line with the tender's time */
#hud.powered-down .hud-stats > :not(.o2-gauge),
#hud.powered-down #keys-help,
#hud.powered-down #credits,
#hud.powered-down #ammo {
    opacity: 0.15;
    transition: opacity 1.5s;
}

/* Co-op: the pilot's warning signs (instruments.js), down the left: cryptic, each flashing at its own rate */
#warnings {
    position: absolute;
    left: 5vw;
    top: 22vh;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5vmin;
}

.warn-sign {
    --lamp: #fa0;
    padding: 0.6vmin 1.5vmin;
    border: 2px solid var(--lamp);
    background: rgba(30, 15, 0, 0.85);
    color: var(--lamp);
    font-size: 2.6vmin;
    letter-spacing: 0.15em;
    animation: warn-flash 0.5s steps(1) infinite;
}

.warn-sign.master {
    --lamp: #f33;
    font-size: 3.2vmin;
}

@keyframes warn-flash {
    50% {
        background: var(--lamp);
        color: #000;
    }
}

/* The monitor's glass, cracked by knocks and smashed when the ship blows up (game.js): over the picture and the HUD,
   under the scanlines. Its pixel art is drawn coarse and blown up unsmoothed. The sealant's pane (seal.js) the same. */
#cracks,
#seal {
    z-index: 2;
    pointer-events: none;
    image-rendering: pixelated;
}

/* The ship going up (game.js crackScreen): the cracks race out behind a white flash */
#cracks.smash {
    animation: crack-spread 0.35s ease-out, crack-flash 1.2s ease-out;
}

@keyframes crack-spread {
    from {
        clip-path: circle(0 at var(--x) var(--y));
    }

    to {
        clip-path: circle(150vmax at var(--x) var(--y));
    }
}

@keyframes crack-flash {
    from {
        background: rgba(255, 255, 255, 0.85);
    }

    to {
        background: transparent;
    }
}

/* The mission report comes up over the cracked glass (still under the scanlines), fading in as it rises; the glass
   shows faintly through it */
#report-layer {
    z-index: 2;
}

#game-over-screen {
    animation: report-up 1.2s ease-out;
}

@keyframes report-up {
    from {
        opacity: 0;
        transform: translateY(3vh);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* Tuning panel (settings.js), above the CRT layers so it stays readable */
#tune-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 360px;
    max-width: 90vw;
    z-index: 5;
    overflow-y: auto;
    padding: 12px;
    background: rgba(0, 10, 0, 0.94);
    border-left: 1px solid #0f0;
    font-size: 18px;
    text-shadow: 0 0 4px #0f0;
}

.tune-head {
    display: flex;
    justify-content: space-between;
    font-size: 24px;
    margin-bottom: 8px;
}

.tune-buttons {
    display: flex;
    gap: 8px;
}

#tune-panel button {
    flex: 1;
    padding: 4px;
    font: inherit;
    color: #000;
    background: #0f0;
    border: none;
    cursor: pointer;
}

.tune-note {
    margin: 8px 0;
    font-size: 15px;
    opacity: 0.7;
    text-transform: none;
}

/* Cheats (cheats.js): switches, then buttons two to a row */
.cheat-toggle {
    display: block;
    padding: 3px 0;
    cursor: pointer;
}

.cheat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-top: 6px;
}

#cheat-status {
    color: #f5f;
    opacity: 1;
}

/* The HUD's reminder that cheats are on */
#cheat-tag {
    position: absolute;
    top: 6vh;
    left: 50%;
    transform: translateX(-50%);
    color: #f5f;
    font-size: 18px;
    text-shadow: 0 0 4px #f5f;
    pointer-events: none;
}

#tune-panel summary {
    cursor: pointer;
    padding: 6px 0;
    border-bottom: 1px solid #060;
}

.tune-row {
    display: grid;
    grid-template-columns: 1fr 110px 64px;
    gap: 6px;
    align-items: center;
    padding: 2px 0;
}

.tune-name {
    cursor: default;
    user-select: none;
}

.tune-name.changed {
    color: #fff;
}

.tune-row input[type="range"] {
    width: 100%;
    accent-color: #0f0;
}

.tune-row input[type="number"] {
    width: 100%;
    font: inherit;
    color: #0f0;
    background: #000;
    border: 1px solid #0f0;
}

/* Key prompts and panel rows the mouse can click too (coop.js clickKey) */
[data-press], #shop .shop-row {
    pointer-events: auto;
    cursor: pointer;
}

[data-press]:hover, #shop .shop-row:hover {
    background: rgba(0, 255, 0, 0.25);
}

/* Mission control's jail (coop.js drawJail): the gates and the black behind them, over the whole console; under HQ's
   verdict and the report (the next layer), and the tube's scanlines */
#jail {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    animation: none; /* (not the canvas rule's switch-on: that squashed it to a line in the middle, opening out, over the drop) */
}

/* The dead pilot drifting past in pieces (dead.js): over the report (the layer before it), under the tube's scanlines */
#dead {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    animation: none; /* (not the canvas rule's switch-on) */
}

/* HQ's verdict on mission control, the ship lost (coop.js showHq): flashing red across the top, over the report */
#hq {
    position: fixed;
    top: 4vh;
    left: 50%;
    transform: translateX(-50%);
    width: min(92vw, 120vmin);
    padding: 1.5vmin 3vmin;
    border: 3px solid #f33;
    background: rgba(40, 0, 0, 0.92);
    color: #f44;
    font-size: 3.4vmin;
    line-height: 1.25;
    text-align: center;
    text-shadow: 0 0 8px #f00;
    animation: hq-flash 0.5s steps(1) infinite;
}

#hq small {
    display: block;
    font-size: 0.7em;
    letter-spacing: 0.4em;
    margin-bottom: 0.5vmin;
}

/* [SPACE] CONTINUE: the report waits behind the verdict till it's read (coop.js hqContinue) */
#hq .hq-go {
    margin: 1.5vmin 0 0;
    font-size: 0.7em;
}

#hq [data-press]:hover {
    background: rgba(255, 60, 60, 0.3);
}

@keyframes hq-flash {
    50% {
        color: #fff;
        border-color: #fff;
        background: rgba(110, 0, 0, 0.92);
    }
}
