/* TubeGrub Cyberpunk System Terminal CSS */

/* ------------------------------------------------------------------ *
 * The palette
 *
 * The terminal's colours, as tokens: saturated cyan and pink, everything lit
 * from within. Rules read these rather than naming a colour, so the look can
 * be retuned in one place. The old names are kept as aliases because two
 * hundred rules use them.
 *
 * --neon-accent is the exception: it is the operator's own tint, written
 * straight onto the root element at sign-in.
 * ------------------------------------------------------------------ */
:root {
    /* Ground and planes */
    --ground: #0a0e1a;
    --plane: rgba(18, 24, 37, 0.45);
    --plane-solid: #121825;

    /* Ink */
    --ink: #e8eaef;
    --ink-dim: #9ca3b4;
    --ink-faint: rgba(232, 234, 239, 0.45);

    /* Chrome: the colour the terminal's own furniture is drawn in — rules,
       labels, frames. */
    --chrome: #00d4ff;
    --hot: #ff3366;      /* the signature: glitch text, the NEW rule, the deck */
    --amber: #ffaa00;    /* the black pages, and anything filed rather than live */
    --ok: #00ff88;
    --warn: #ff9933;
    --neon-purple: #bc13fe;
    --neon-blue: #4d8dff;

    /* How hard things glow, and how much dirt sits over them. Dialled by the
       skin; every shadow and texture below is written in terms of these. */
    --glow: 1;
    --haze: 0;
    --burn: 0;

    --neon-accent: var(--chrome); /* User-controllable highlight */

    --font-mono: 'JetBrains Mono', monospace;
    --font-sans: 'Inter', sans-serif;

    /* Aliases, kept so existing rules go on working. */
    --bg-main: var(--ground);
    --bg-surface: var(--plane);
    --neon-cyan: var(--chrome);
    --neon-pink: var(--hot);
    --neon-green: var(--ok);
    --neon-orange: var(--warn);
    --text-primary: var(--ink);
    --text-secondary: var(--ink-dim);
    --border-glow: color-mix(in srgb, var(--chrome) 30%, transparent);
    --bg-glow-main: color-mix(in srgb, var(--chrome) 8%, transparent);
    --grid-color: color-mix(in srgb, var(--chrome) 5%, transparent);
}

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

body {
    background-color: var(--bg-main);
    background-image:
        radial-gradient(circle at 10% 20%, var(--bg-glow-main) 0%, transparent 40%),
        radial-gradient(circle at 5% 80%, color-mix(in srgb, var(--hot) 8%, transparent) 0%, transparent 40%);
    color: var(--text-primary);
    font-family: var(--font-sans);
    /* 100vh is the *layout* viewport, which iOS leaves at full height when the
       keyboard opens — so the page stayed taller than the visible area and the
       header scrolled away above it. dvh tracks the visible area instead. The
       vh line stays as the fallback for anything without dvh. */
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Fixed Grid Overlay */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(var(--grid-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: 9000;
}

/* Everything above the scanline layer.
 *
 * body::after paints the CRT scanlines across the whole viewport at 10000, so
 * anything that must not be scanlined has to sit above it. Message media does;
 * the chrome that overlays message media therefore has to clear the media in
 * turn, and carries its own scanline so the texture does not vanish from it.
 *
 *    9000  the page's grid (body::before)
 *   10000  scanlines
 *   10001  message media, and the deck's corner panel; the login board's
 *          monitor (js/bbslogin.js), which is plastic, its glass drawing
 *          its own scanlines
 *   10003  the EJECT key in an embed's corner, over the media it ejects
 *   10002  the tape deck's player — above the panel that frames it, or the
 *          panel's own background paints over the video
 *   10040  the ▼ NEW key at the foot of the message list
 *   10050  reaction picker         \
 *   10060  mention autocomplete     > float over the message pane, so over media
 *   10065  LINK TRIMMED notice      |
 *   10070  formatting toolbar      /
 *   10090  hover dossier
 *   10100  mobile drawer scrim
 *   10150  mobile drawer
 *   10200  mobile header
 *   10210  ON AIR popover — opens from either header, so above both
 *   99999  modals
 *  100001  dialogs, boot overlay
 *  100002  image viewer
 *
 * Anything new that floats above the message list belongs in the 100xx range.
 * Below 10001 it will be covered by any image in the conversation — which is
 * how the formatting toolbar and the mention list ended up behind a photograph
 * when media was first lifted clear of the scanlines.
 */

/* Scanline Effect */
body::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%,
            rgba(0, 0, 0, 0.1) 50%);
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 10000;
    opacity: 0.3;
}

/* Layout */
#app {
    display: flex;
    flex-direction: column;
    flex: 1;
    height: 100%;
}

#layout-wrapper {
    display: flex;
    flex: 1;
    overflow: hidden;
    height: 100%;
}

/* The three pane headers — server, channel, members.
   They all drew the same border-bottom: 1px solid var(--border-glow), but that
   colour is translucent (and re-derived at 0x44 alpha whenever the operator
   retints the HUD), so it composited differently over each pane's background:
   the channel header sits on a cyan-tinted radial gradient, the sidebars on
   their own translucent fills. Same declared colour, three apparent colours.
   Giving the strips one shared backdrop makes the rule read identically across
   all three while keeping the tint live. */
.hud-header {
    /* Fixed height, not padding-derived: these three strips sat at 52px, 58px
       and 52px, because the channel header carries a settings button and the
       others only carry a label. That put its rule 6px below the ones on
       either side — three pane headers, one of them out of line. Pinning the
       height keeps all three rules on a single row whatever they contain. */
    height: 56px;
    padding: 0 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    background: rgba(6, 10, 18, 0.55);
    border-bottom: 1px solid var(--border-glow);
}

/* The label's default bottom margin would push it off centre in a fixed-height
   strip. */
.hud-header .terminal-label {
    margin-bottom: 0;
}

.sidebar {
    width: 260px;
    flex-shrink: 0;
    background-color: var(--bg-surface);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

#server-sidebar {
    background-color: rgba(6, 10, 18, 0.7);
    /* Darker, more foundational */
    border-right: 1px solid color-mix(in srgb, var(--chrome) 10%, transparent);
    /* Subtle cyan edge */
    backdrop-filter: blur(8px) saturate(100%);
    /* Less "active" blur than channels */
    -webkit-backdrop-filter: blur(8px) saturate(100%);
    box-shadow: inset -5px 0 10px rgba(0, 0, 0, 0.2);
    width: 70px !important;
    align-items: center;
    padding-top: 20px;
    gap: 10px;
}

#member-sidebar {
    /* 200px left roughly 140px for text once the avatar and padding were taken
       out, which is not enough for an ordinary display name — "Juniper Monkeys"
       did not fit. 240px clears the common cases; anything longer now ellipses
       rather than running under the window edge. */
    width: 240px !important;
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    border-right: none;
    background-color: rgba(6, 10, 18, 0.7);
}

/* A narrow desk: a window wider than a phone but under 1024px. The two left
   panes and the roster took 570px of it, which at 860 wide left the
   conversation 240px and the message box 11px. Here the right rail leaves the
   row for the drawer a phone has, from the right, over a shade, opened by the
   key in the room's header (paintHandKeys says which rooms have one): USERS
   for the roster, TALK for a deck's or an arcade's talk, which would
   otherwise leave the deck itself a few hundred pixels or none. */
.roster-key { display: none; }

@media (min-width: 769px) and (max-width: 1023px) {
    #layout-wrapper { position: relative; }

    #member-sidebar {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        z-index: 10150;
        transform: translateX(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        background: var(--bg-main) !important;
        border-left: 1px solid var(--neon-cyan);
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
    }

    #layout-wrapper.members-open #member-sidebar {
        transform: translateX(0);
    }

    .roster-key:not([hidden]) {
        display: inline-flex;
        align-items: center;
        flex-shrink: 0;
        margin-left: auto;
    }
}

.main-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: radial-gradient(circle at center, color-mix(in srgb, var(--chrome) 5%, transparent) 0%, transparent 70%);
}

/* Components */

/* A key that fills or lights on hover keeps that rule inside
   @media (hover: hover), gated on a device that actually has a pointer.
   iOS applies :hover on tap and leaves it applied until you tap something
   else, so a tapped SEND button stayed lit up as though the cursor were still
   on it — and blur() does not clear it, because it is hover and not focus. */

.input-field,
.neon-input,
.auth-card input[type="text"].neon-input {
    background: rgba(0, 0, 0, 0.4) !important;
    border: 1px solid var(--border-glow) !important;
    color: var(--text-primary) !important;
    padding: 10px;
    margin-bottom: 10px;
    width: 100%;
    font-family: var(--font-mono);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    border-radius: 2px;
}

.input-field:focus,
.neon-input:focus,
.auth-card input[type="text"].neon-input:focus {
    border-color: var(--neon-accent) !important;
    box-shadow: 0 0 10px var(--neon-accent);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
    background: var(--neon-cyan);
    box-shadow: 0 0 5px var(--neon-cyan);
}

/* Terminal Labels */
.terminal-label {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--neon-accent);
    margin-bottom: 4px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
}

.terminal-link {
    color: var(--neon-accent);
    text-transform: uppercase;
    font-family: var(--font-mono);
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.2s, text-shadow 0.2s;
    background: none;
    border: none;
    font-size: 0.65rem;
    opacity: 0.6;
}

@media (hover: hover) {
    .terminal-link:hover {
        opacity: 1;
        text-shadow: 0 0 8px var(--neon-accent);
    }
}

.message-link,
.message-link:visited {
    color: var(--neon-accent);
    text-decoration: none;
    border-bottom: 1px solid var(--border-glow);
    transition: color 0.2s, border-bottom-color 0.2s, opacity 0.2s, text-shadow 0.2s;
    cursor: pointer;
    font-size: inherit;
    font-family: inherit;
}

@media (hover: hover) {
    .message-link:hover {
        text-shadow: 0 0 5px var(--neon-accent), 0 0 10px var(--neon-accent);
        border-bottom-color: var(--neon-accent);
        opacity: 1;
    }
}

/* The viewer's image: shown whole, never upscaled past its own size. */
.image-viewer-frame {
    max-width: 95vw;
    max-height: 88vh;
    object-fit: contain;
    border: 1px solid var(--border-glow);
    border-radius: 4px;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
}

/* Stepping through a gallery in the viewer. */
#image-viewer .viewer-step {
    position: absolute;
    top: 50%;
    width: 44px;
    height: 64px;
    margin-top: -32px;
    border: 1px solid var(--border-glow);
    border-radius: 3px;
    background: rgba(4, 7, 12, 0.7);
    color: var(--neon-cyan);
    font: 1.8rem/1 var(--font-mono);
    cursor: pointer;
}
#image-viewer .viewer-step.is-prev { left: 16px; }
#image-viewer .viewer-step.is-next { right: 16px; }
#image-viewer .viewer-step:hover { background: color-mix(in srgb, var(--neon-cyan) 15%, rgba(4, 7, 12, 0.8)); }
#image-viewer .viewer-count {
    position: absolute;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--text-secondary);
    font: 0.7rem var(--font-mono);
    letter-spacing: 3px;
}

#image-viewer #image-viewer-close {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    height: 32px;
    padding: 0 18px;
    font-size: 0.7rem;
    letter-spacing: 2px;
}

#image-viewer #image-viewer-close:active { height: 30px; }

/* Media is lifted clear of the scanline overlay: a photograph looked like it
   had been filmed off a monitor, which is a good look for the chrome and a bad
   one for someone's holiday snap. */
.msg-media {
    position: relative;
    z-index: 10001;
    cursor: zoom-in;
}

.msg-content-text {
    overflow-wrap: anywhere;
    word-break: break-word;
    max-width: 100%;
}

.terminal-label::before {
    content: "> ";
    margin-right: 4px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: var(--neon-green);
    border-radius: 50%;
    margin-right: 8px;
    box-shadow: 0 0 10px var(--neon-green);
}

.status-dot.online {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.5;
    }
}

/* Auth Screen Overlay (Login only) */
#auth-screen {
    display: flex;
    align-items: center;
    height: 100vh;
    height: 100dvh;
    width: 100%;
    position: relative;
    overflow: hidden;
}

/* Background animated grid - Login screen only */
#auth-screen::before {
    content: "";
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background-image:
        linear-gradient(var(--grid-color) 2px, transparent 2px),
        linear-gradient(90deg, var(--grid-color) 2px, transparent 2px);
    background-size: 80px 80px;
    transform: perspective(500px) rotateX(60deg);
    animation: grid-move 20s linear infinite;
    opacity: 0.5;
    z-index: 1;
}

@keyframes grid-move {
    0% {
        transform: perspective(500px) rotateX(60deg) translateY(0);
    }

    100% {
        transform: perspective(500px) rotateX(60deg) translateY(80px);
    }
}

/* Base Modal/Card Style - Global */
.auth-card {
    background: var(--bg-surface);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border-glow);
    padding: 30px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    position: relative;
    z-index: 1001;
}

/* Layout lives here rather than inline on the element. It was inline, which
   meant the mobile rule that hides these could not win without !important —
   an inline declaration beats any selector. */
.message-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.2s;
}

.message-block:hover .message-actions {
    opacity: 1 !important;
}

/* Consecutive messages from one person collapse: no repeated avatar or name,
   just a hover-revealed clock where the avatar would have been. */
.msg-gutter {
    width: 40px;
    flex-shrink: 0;
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
    padding-top: 2px;
}

.msg-grouped-time {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--text-secondary);
    opacity: 0;
    transition: opacity 0.15s;
    user-select: none;
}

.message-block:hover .msg-grouped-time {
    opacity: 0.6;
}

/* Grouped messages have no header row to sit in, so the actions overlay the
   block's top-right. The backdrop keeps them legible over message text, which
   matters on mobile where they are always visible. */
.message-actions-float {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 2;
    background: var(--bg-main);
    padding: 1px 6px;
    border-radius: 3px;
}

/* Where you left off. Sits above the first message that arrived since the
   channel was last open. */
.unread-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 18px 0 4px;
    pointer-events: none;
}

.unread-divider::before,
.unread-divider::after {
    content: "";
    height: 1px;
    background: var(--neon-pink);
    opacity: 0.45;
    flex: 1;
}

.unread-divider span {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    letter-spacing: 2px;
    color: var(--neon-pink);
    text-shadow: 0 0 6px var(--neon-pink);
    flex-shrink: 0;
}

/* ------------------------------------------------------------------ *
 * Tape deck
 *
 * A playlist channel puts the deck in the main pane and moves the talk into
 * the right rail. The rail is wider than the roster it replaces — chat at
 * 240px is three words a line — and the message list, reply preview and
 * composer are the app's real ones, relocated rather than rebuilt.
 * ------------------------------------------------------------------ */

.channel-item.is-deck > span:first-child::before {
    content: "♪ ";
    color: var(--neon-pink);
}

/* The arcade: a joystick seen from above, in the one blue nothing else uses. */
.channel-item.is-arcade > span:first-child::before {
    content: "◈ ";
    color: var(--neon-blue);
}

/* The wall keeps the green blocks the arcade used to wear — two cells of the
   drawing itself. */
.channel-item.is-wall > span:first-child::before {
    content: "▚ ";
    color: var(--neon-green);
}

/* The back room: a half-lit bulb, in the purple no other room wears. */
.channel-item.is-backroom > span:first-child::before {
    content: "◐ ";
    color: var(--neon-purple);
}

/* Any room that takes the main pane. The arcade draws a canvas into it and the
   deck lays out a list, so this only has to be a box that fills the space and
   does not scroll the page. */
.rail-pane {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* The games centre themselves inside their own container, which is at least
   the height of the room and grows past it if it has to. So the room only has
   to be a scrollable column — adding a second centring here fought the first
   and left the cabinets sitting high with dead space beneath them. */
#arcade-room {
    align-items: stretch;
    overflow-y: auto;
}

#member-sidebar.deck-rail {
    width: 310px !important;
}

#member-sidebar.deck-rail #message-list {
    flex: 1;
    padding: 12px;
    font-size: 0.9rem;
}

#member-sidebar.deck-rail #message-input-area {
    padding: 12px;
}

/* The talk beside a deck is for talking: no picture key, and a narrower SEND,
   so the screen gets the width. */
#member-sidebar.deck-rail .composer-attach { display: none; }

#member-sidebar.deck-rail .composer-send {
    width: 66px;
    gap: 6px;
    letter-spacing: 1px;
}

/* The talk in a 310px rail. The header is one line whatever the name: the
   name gives way (…) and the stamp keeps its place, rather than both wrapping
   into a stack of fragments. Avatars come down to fit the column. */
#member-sidebar.deck-rail .message-header > div:first-child {
    flex: 1;
    min-width: 0;
    flex-wrap: nowrap;
    gap: 8px !important;
    margin-right: 0 !important;
}

/* The hover actions float over the corner, as they do on a grouped message:
   in the header they held their width while invisible and squeezed the name
   down to nothing. */
#member-sidebar.deck-rail .message-header .message-actions {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 2;
    padding: 1px 6px;
    border-radius: 3px;
    background: var(--bg-main);
}

#member-sidebar.deck-rail .msg-username {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.85rem;
}

#member-sidebar.deck-rail .msg-meta {
    flex-shrink: 0;
    white-space: nowrap;
    font-size: 0.58rem !important;
}

#member-sidebar.deck-rail .message-block {
    gap: 10px !important;
}

#member-sidebar.deck-rail .message-block > img.user-profile-trigger {
    width: 30px !important;
    height: 30px !important;
}

#member-sidebar.deck-rail .msg-gutter {
    width: 30px;
    flex-shrink: 0;
}

/* A queue announcement, compacted.
 *
 * It is an ordinary transmission — that is what makes it work on a phone —
 * but beside a deck that already lists every track, a full avatar and header
 * per queue is a lot of furniture for a line nobody reads twice. The gutter
 * collapses, the header goes, and a ♪ marks it as machine-written. It stays a
 * real message underneath: still reportable, still repliable, still there. */
#member-sidebar.deck-rail .message-block.deck-announcement {
    margin-top: 4px !important;
    gap: 6px !important;
    align-items: baseline;
}

/* The avatar goes — the deck lists every track with its owner already — but
   the name stays. Who put a thing on is most of what the line is for. */
#member-sidebar.deck-rail .deck-announcement > img:first-child,
#member-sidebar.deck-rail .deck-announcement .msg-gutter {
    display: none;
}

/* Belt and braces on the player. suppress_embeds is set when the announcement
   is written, so it does nothing for tracks queued before that existed — and
   the rail should not depend on the age of a row. */
#member-sidebar.deck-rail .deck-announcement .embed-container,
#member-sidebar.deck-rail .deck-announcement .msg-media {
    display: none !important;
}

#member-sidebar.deck-rail .deck-announcement .message-header {
    font-size: 0.6rem;
    margin-bottom: 1px;
}

#member-sidebar.deck-rail .deck-announcement .msg-username {
    font-size: 0.62rem;
}

#member-sidebar.deck-rail .deck-announcement .msg-content-text {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    line-height: 1.5;
    color: var(--text-secondary);
    border-left: 2px solid rgba(0, 255, 136, 0.35);
    padding-left: 8px;
    margin-top: 0 !important;
}

#member-sidebar.deck-rail .deck-announcement .msg-content-text::before {
    content: "♪ ";
    color: var(--neon-green);
}

/* A raw YouTube URL is around forty characters and wraps to three lines in a
   310px column, which is most of what a queue announcement looks like. The
   href is untouched — only how much of it is drawn. */
#member-sidebar.deck-rail .message-link {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}

#tape-deck {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.deck-loading {
    padding: 30px;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-secondary);
    opacity: 0.6;
}

.deck-now {
    display: flex;
    gap: 20px;
    padding: 18px;
    border-bottom: 1px solid var(--border-glow);
    background: linear-gradient(180deg, color-mix(in srgb, var(--chrome) 6%, transparent), transparent);
    flex-shrink: 0;
}

/* The video's screen, set into a hatched bezel like the arcade's machines. */
.deck-bezel {
    position: relative;
    flex-shrink: 0;
    padding: 18px 10px 10px;
    border: 1px solid color-mix(in srgb, var(--chrome) 32%, transparent);
    border-radius: 4px;
    background:
        repeating-linear-gradient(135deg, transparent 0 3px, color-mix(in srgb, var(--chrome) 5%, transparent) 3px 4px),
        rgba(4, 7, 13, 0.9);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 2px 10px rgba(0, 0, 0, 0.5);
}

.deck-bezel-tag {
    position: absolute;
    top: 5px;
    left: 10px;
    font-family: var(--font-mono);
    font-size: 7px;
    letter-spacing: 2px;
    color: color-mix(in srgb, var(--chrome) 55%, transparent);
}

/* The YouTube iframe replaces this element wholesale, so the box has to hold
   its own shape rather than relying on what is inside it. */
.deck-screen,
#deck-screen {
    width: 280px;
    height: 158px;
    flex-shrink: 0;
    border-radius: 2px;
    background: linear-gradient(150deg, #12202b, #060a12);
    box-shadow: 0 0 0 1px #05070c, inset 0 2px 8px rgba(0, 0, 0, 0.8);
}

.deck-meta { min-width: 0; display: flex; flex-direction: column; gap: 6px; }

/* ON DECK: a lit sign with a steady lamp. */
.deck-tag {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 3px 9px;
    border: 1px solid color-mix(in srgb, var(--neon-green) 60%, transparent);
    border-radius: 2px;
    background: color-mix(in srgb, var(--neon-green) 12%, transparent);
    font-family: var(--font-mono);
    font-size: 0.58rem;
    font-weight: bold;
    letter-spacing: 2px;
    color: #fff;
    text-shadow: 0 0 6px var(--neon-green);
}

.deck-tag i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--neon-green);
    box-shadow: 0 0 6px var(--neon-green);
}

.deck-tag.empty {
    border-color: color-mix(in srgb, var(--chrome) 30%, transparent);
    background: transparent;
    color: var(--text-secondary);
    text-shadow: none;
}

.deck-tag.empty i { background: #2a2f38; box-shadow: none; }

.deck-title {
    font-size: 1rem;
    font-weight: bold;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.deck-by { font-family: var(--font-mono); font-size: 0.65rem; color: var(--text-secondary); }
.deck-by b { color: var(--neon-cyan); font-weight: normal; }

/* Both rows share one grid, so the transport lines up with the toggles under
   it whatever the labels say. */
.deck-transport {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    align-items: start;
    margin-top: 6px;
    max-width: 340px;
}

/* The transport: keys with travel. PLAY in cyan, SKIP neutral. */
.plate-key.deck-key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    padding: 0 14px;
    font-size: 0.65rem;
    letter-spacing: 2px;
}

.plate-key.deck-key:active { height: 34px; }
.plate-key.deck-key.is-skip { --key-ink: var(--text-secondary); }

/* REPEAT and SHUFFLE latch: while on they stay pressed in and lit. They are
   the listener's own settings, so nothing here reaches anybody else. */
.deck-toggle {
    height: 28px;
    box-sizing: border-box;
    padding: 0 10px;
    border: 1px solid color-mix(in srgb, var(--chrome) 40%, transparent);
    border-bottom-width: 3px;
    border-radius: 2px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.01));
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.55rem;
    letter-spacing: 1.5px;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

@media (hover: hover) {
    .deck-toggle:not(.on):hover { color: var(--neon-cyan); border-color: var(--neon-cyan); }
}

.deck-toggle.on {
    margin-top: 2px;
    height: 26px;
    border-bottom-width: 1px;
    border-color: var(--neon-cyan);
    background: var(--neon-cyan);
    color: #05070c;
    box-shadow: 0 0 10px color-mix(in srgb, var(--neon-cyan) 40%, transparent);
}

/* THE LIST: a tag, a rule, and a count chip. */
.deck-queue-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px 8px;
    font-family: var(--font-mono);
    font-size: 0.55rem;
    letter-spacing: 2px;
    color: color-mix(in srgb, var(--chrome) 60%, transparent);
    flex-shrink: 0;
}

.deck-queue-head i {
    flex: 1;
    height: 1px;
    background: color-mix(in srgb, var(--chrome) 18%, transparent);
}

.deck-count {
    padding: 2px 6px;
    border: 1px solid color-mix(in srgb, var(--chrome) 30%, transparent);
    border-radius: 2px;
}

.deck-queue { flex: 1; overflow-y: auto; padding: 0 12px 12px; display: flex; flex-direction: column; gap: 4px; }

.deck-track {
    display: grid;
    grid-template-columns: 26px 62px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 8px 10px;
    border-left: 2px solid color-mix(in srgb, var(--chrome) 25%, transparent);
    border-radius: 0 3px 3px 0;
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
}

@media (hover: hover) {
    .deck-track:hover { background: color-mix(in srgb, var(--chrome) 7%, transparent); }
}

.deck-track.playing {
    border-left-color: var(--neon-green);
    background: rgba(0, 255, 136, 0.05);
}

.deck-pos {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.deck-track.playing .deck-pos { color: var(--neon-green); }

.deck-thumb {
    width: 62px;
    height: 35px;
    object-fit: cover;
    border-radius: 2px;
    box-shadow: 0 0 0 1px #05070c, 0 0 0 2px color-mix(in srgb, var(--chrome) 22%, transparent);
    background: linear-gradient(140deg, #16242f, #080d16);
}

.deck-track-meta { min-width: 0; }

.deck-track-title {
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.deck-track-by {
    font-family: var(--font-mono);
    font-size: 0.58rem;
    color: var(--text-secondary);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.deck-track-by b { color: var(--neon-cyan); font-weight: normal; }

.deck-onair { color: var(--neon-green); }

/* A track's keys: out of the way until the row is pointed at. */
.deck-track-controls { display: flex; gap: 4px; align-items: center; }

.track-key {
    --key-ink: var(--neon-cyan);
    width: 24px;
    height: 24px;
    box-sizing: border-box;
    padding: 0;
    border: 1px solid color-mix(in srgb, var(--key-ink) 55%, transparent);
    border-bottom-width: 3px;
    border-radius: 2px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--key-ink) 14%, transparent), color-mix(in srgb, var(--key-ink) 3%, transparent));
    color: var(--key-ink);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    line-height: 1;
    cursor: pointer;
    transition: opacity 0.15s, background 0.15s, color 0.15s;
}

.track-key.is-kill { --key-ink: var(--neon-pink); }

@media (hover: hover) {
    .deck-track .track-key { opacity: 0; }
    .deck-track:hover .track-key,
    .deck-track:focus-within .track-key { opacity: 1; }
    .track-key:hover { background: var(--key-ink); color: #05070c; }
}

.track-key:active {
    border-bottom-width: 1px;
    margin-top: 2px;
    height: 22px;
}

.track-key:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* The link field: a recessed screen behind a ♪ prompt, and the QUEUE key. */
.deck-composer {
    border-top: 1px solid var(--border-glow);
    padding: 14px 18px;
    display: flex;
    gap: 10px;
    align-items: center;
    background: rgba(6, 10, 18, 0.5);
    flex-shrink: 0;
}

.deck-field {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 9px;
    height: 38px;
    padding: 0 12px;
    box-sizing: border-box;
    border: 1px solid color-mix(in srgb, var(--neon-cyan) 28%, transparent);
    border-radius: 3px;
    background:
        repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 3px),
        #04070c;
    box-shadow: inset 0 2px 7px rgba(0, 0, 0, 0.75);
    cursor: text;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.deck-field:focus-within {
    border-color: var(--neon-accent);
    box-shadow: inset 0 2px 7px rgba(0, 0, 0, 0.75), 0 0 10px color-mix(in srgb, var(--neon-accent) 40%, transparent);
}

.deck-prompt {
    color: var(--neon-pink);
    opacity: 0.6;
    transition: opacity 0.15s;
}

.deck-field:focus-within .deck-prompt { opacity: 1; }

#deck-url {
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 0;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.72rem;
}

#deck-url::placeholder { color: var(--text-secondary); opacity: 0.7; }

.plate-key.deck-key.is-queue { height: 38px; padding: 0 18px; }
.plate-key.deck-key.is-queue:active { height: 36px; }

@media (pointer: coarse) {
    #deck-url { font-size: 16px; }
}

/* The player's permanent home.
 *
 * An iframe that is re-parented reloads, so the player never moves in the DOM.
 * It lives here, fixed to the viewport, and is repositioned over the deck's
 * screen slot while that is on show — or shrunk to the corner when it is not,
 * which is what lets the music carry on into another channel.
 *
 * 10001 puts it level with message media: real media, above the scanlines,
 * below every piece of chrome that has to cover it. */
#deck-player-host {
    position: fixed;
    /* Above the corner panel that frames it. The panel was briefly the higher
       of the two, which painted its own background over the video and left a
       black rectangle with the audio still running. The player only ever
       occupies the panel's screen slot, so sitting above it covers nothing
       that matters. */
    z-index: 10002;
    background: #000;
    overflow: hidden;
    /* Hidden until positioned. A fixed element with auto offsets paints at its
       static position first, so the player appeared in the corner of the window
       for a frame and then jumped to its slot. positionPlayer() is what turns
       this on, and it does so only after setting the rect. */
    display: none;
}

#deck-player-host iframe { width: 100%; height: 100%; border: 0; display: block; }

/* The corner panel the deck drops into when you leave the channel.
   It says where it came from and how to stop it, because a video that keeps
   playing over an unrelated room needs to account for itself. The player is
   not inside this element — an iframe cannot be re-parented without reloading
   — it is positioned over #deck-mini-screen by the same code that positions it
   over the deck's own screen. */
#deck-mini {
    position: fixed;
    left: 88px;
    bottom: 20px;
    z-index: 10001;
    width: 240px;
    background: rgba(5, 8, 16, 0.97);
    border: 1px solid var(--border-glow);
    box-shadow: 0 0 26px rgba(0, 0, 0, 0.85);
    font-family: var(--font-mono);
}

#deck-mini.paused { opacity: 0.8; }

#deck-mini .mini-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 5px 8px;
    border-bottom: 1px solid var(--border-glow);
    background: color-mix(in srgb, var(--chrome) 8%, transparent);
}

#deck-mini .mini-source {
    font-size: 0.55rem;
    letter-spacing: 1px;
    color: var(--neon-cyan);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#deck-mini .mini-close {
    background: transparent;
    border: 1px solid color-mix(in srgb, var(--hot) 40%, transparent);
    color: var(--neon-pink);
    font-family: var(--font-mono);
    font-size: 0.6rem;
    line-height: 1;
    padding: 3px 7px;
    cursor: pointer;
    flex-shrink: 0;
}

@media (hover: hover) {
    #deck-mini .mini-close:hover { background: var(--neon-pink); color: var(--bg-main); }
}

/* The slot the player is drawn over. Holds its own shape, since the thing that
   fills it is not actually a child. */
#deck-mini-screen {
    width: 100%;
    aspect-ratio: 16 / 9;
    /* Black only until the player is drawn over it. It is a hole in the panel,
       not a surface. */
    background: #000;
    border-bottom: 1px solid color-mix(in srgb, var(--chrome) 15%, transparent);
}

#deck-mini .mini-title {
    font-size: 0.58rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 7px 8px 5px;
}

#deck-mini .mini-controls {
    display: flex;
    gap: 4px;
    padding: 0 8px 8px;
}

#deck-mini .mini-controls .deck-mini {
    flex: 1 1 auto;
    height: 28px;
    padding: 0 6px;
    white-space: nowrap;
}

#deck-mini .mini-controls .deck-mini:active { height: 26px; }

/* Out of the way on a hand terminal, where the corner is the composer. */
@media (max-width: 900px) {
    #deck-mini { left: 12px; right: auto; bottom: 78px; width: 190px; }
}

/* A narrow window: the talk is a drawer here (see "A narrow desk"), and the
   deck's screen goes above what's playing rather than beside it. */
@media (max-width: 900px) {
    .deck-now { flex-direction: column; }
    .deck-screen, #deck-screen { width: 100%; height: auto; aspect-ratio: 16 / 9; }
}

/* The directory entry's readout: traffic, roster, streams, last contact, and
   whose paper the sector carries this week. The livery colour arrives per
   entry as --sector-ink, so the amber classifieds palette stays underneath
   and each corporation tints only its own strip. */
.black-pages-item.is-joined {
    opacity: 0.72;
}

.sector-readout {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 0.58rem;
    letter-spacing: 0.5px;
    color: rgba(255, 204, 0, 0.65);
    margin-top: 6px;
}

.sector-traffic {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.traffic-bars {
    display: inline-flex;
    align-items: flex-end;
    gap: 2px;
    height: 10px;
}

.traffic-bars i {
    width: 3px;
    background: rgba(255, 204, 0, 0.18);
    display: block;
}

/* Stepped, so the bars read as a meter rather than a row of dashes. */
.traffic-bars i:nth-child(1) { height: 3px; }
.traffic-bars i:nth-child(2) { height: 5px; }
.traffic-bars i:nth-child(3) { height: 7px; }
.traffic-bars i:nth-child(4) { height: 9px; }
.traffic-bars i:nth-child(5) { height: 10px; }

.traffic-bars i.lit {
    box-shadow: 0 0 4px var(--sector-ink, var(--amber));
}

.sector-live {
    color: var(--neon-green);
    text-shadow: 0 0 6px var(--neon-green);
}

.sector-sponsor {
    margin-top: 8px;
    padding: 4px 8px;
    border: 1px solid;
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.55rem;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

.sector-motto {
    display: block;
    opacity: 0.55;
    font-style: italic;
    margin-top: 2px;
}

/* ------------------------------------------------------------------ *
 * Uplink pip and diagnostics
 *
 * The pip is unlabelled trim in the channel header that happens to be the
 * way into the diagnostics. It also reports transport state at a glance:
 * green while the live stream holds, amber once it has fallen back to polls.
 * ------------------------------------------------------------------ */
#uplink-pip {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
    cursor: pointer;
    background: var(--text-secondary);
    opacity: 0.45;
    transition: opacity 0.2s ease, box-shadow 0.2s ease;
}

#uplink-pip:hover {
    opacity: 1;
}

#uplink-pip.uplink-live {
    background: var(--neon-green);
    opacity: 0.7;
}

#uplink-pip.uplink-degraded {
    background: var(--neon-orange);
    opacity: 0.85;
    /* No transition while it frets. WebKit will not hand an opacity animation
       to the compositor when a transition is also on opacity: it drove this
       one by hand, every frame, at a tenth of a core for as long as the
       stream was down. */
    transition: none;
    animation: uplink-fret 1.6s ease-in-out infinite;
}

@keyframes uplink-fret {
    0%, 100% { opacity: 0.85; }
    50% { opacity: 0.3; }
}

/* ------------------------------------------------------------------ *
 * Hover dossier
 *
 * Sits above the composer furniture (formatting toolbar at 10070) and below
 * the drawer scrim at 10100, so it can never cover a modal or a drawer. It is
 * inert to the pointer: it exists beside what you are hovering, and taking
 * events would let it steal the hover that is keeping it open.
 * ------------------------------------------------------------------ */
#dossier-card {
    --op-ink: var(--neon-cyan);
    position: fixed;
    z-index: 10090;
    display: none;
    width: 260px;
    box-sizing: border-box;
    padding: 12px 12px 10px 15px;
    border: 1px solid color-mix(in srgb, var(--op-ink) 55%, transparent);
    border-radius: 5px;
    background:
        radial-gradient(ellipse at 0% 0%, color-mix(in srgb, var(--op-ink) 14%, transparent), transparent 60%),
        rgba(5, 8, 16, 0.97);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8), 0 0 10px color-mix(in srgb, var(--op-ink) 22%, transparent);
    font-family: var(--font-mono);
    pointer-events: none;
    overflow: hidden;
}

/* The pocket card's stripe, in the operator's tint. */
#dossier-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--op-ink);
    box-shadow: 0 0 8px var(--op-ink);
}

.dossier-head {
    display: flex;
    gap: 10px;
    align-items: center;
}

.dossier-portrait {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    padding: 2px;
    border: 1px solid color-mix(in srgb, var(--op-ink) 60%, transparent);
    border-radius: 3px;
}

.dossier-portrait img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 2px;
    object-fit: cover;
}

.dossier-who { min-width: 0; }

.dossier-name {
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: bold;
    color: var(--op-ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dossier-handle {
    font-size: 0.62rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dossier-bio {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    margin-top: 10px;
    overflow: hidden;
    font-size: 0.68rem;
    line-height: 1.45;
    color: var(--text-primary);
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.dossier-meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed color-mix(in srgb, var(--op-ink) 25%, transparent);
    font-size: 0.55rem;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

/* Reading backwards: the round trip while an older page is fetched, and the
   floor once there is nothing older to fetch. Both sit above the first message
   and neither takes pointer events — they are notices, not controls. */
.history-loading,
.history-start {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 6px 0 14px;
    pointer-events: none;
}

.history-loading::before,
.history-loading::after,
.history-start::before,
.history-start::after {
    content: "";
    height: 1px;
    background: var(--border-glow);
    flex: 1;
}

.history-loading span,
.history-start span {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    letter-spacing: 2px;
    color: var(--text-secondary);
    opacity: 0.7;
    flex-shrink: 0;
}

.history-loading span {
    color: var(--neon-cyan);
    animation: history-pulse 1.1s ease-in-out infinite;
}

@keyframes history-pulse {
    0%, 100% { opacity: 0.25; }
    50% { opacity: 1; }
}

/* Stands in for an empty message list — a channel with nothing in it, or the
   round trip while one loads. */
.list-state {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 100%;
    min-height: 120px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
    opacity: 0.75;
    user-select: none;
}

/* Boot log. Sits over the assembling HUD and reports each step of the opening
   sequence as it lands, rather than one static line for the whole wait. */
.boot-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-main);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100001;
    transition: opacity 0.35s ease;
}

.boot-overlay.boot-done {
    opacity: 0;
    pointer-events: none;
}

.boot-log {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    line-height: 1.9;
    letter-spacing: 1px;
    min-width: 280px;
}

.boot-line {
    color: var(--text-secondary);
    animation: boot-line-in 0.18s ease-out;
}

.boot-line:last-child {
    color: var(--text-primary);
}

.boot-arrow {
    color: var(--neon-accent);
}

.boot-status {
    color: var(--neon-green);
}

@keyframes boot-line-in {
    from { opacity: 0; transform: translateY(-2px); }
    to   { opacity: 1; transform: none; }
}

/* Target of a reply-parent jump: a brief pulse so the eye lands on it. */
.reply-parent-link {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.15s;
}

@media (hover: hover) {
    .reply-parent-link:hover {
        opacity: 1;
    }
}

.message-block.message-flash {
    animation: message-flash 1.1s ease-out;
}

@keyframes message-flash {
    0%   { background: color-mix(in srgb, var(--chrome) 16%, transparent); box-shadow: 0 0 20px color-mix(in srgb, var(--chrome) 12%, transparent); }
    100% { background: transparent; box-shadow: none; }
}

@media (prefers-reduced-motion: reduce) {
    .boot-line { animation: none; }
    .message-block.message-flash { animation-duration: 0.01s; }
}

/* System dialogs (uiAlert / uiConfirm / uiPrompt). Stacked above
   #modal-container so a confirmation raised from inside a modal does not
   destroy the modal underneath it. */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.82);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
    padding: 20px;
}

.dialog-card {
    width: 420px;
    max-width: 100%;
}

.dialog-message {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.55;
    color: var(--text-primary);
    white-space: pre-wrap;
    margin: 15px 0 5px;
}

.dialog-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* A message painted locally, still in flight to the server. Reads as "not
   settled yet" rather than as a rendering fault — it is replaced by the real
   row within a poll cycle. */
.message-block.message-pending {
    opacity: 0.55;
}

.message-block.message-pending .msg-meta {
    color: var(--neon-cyan);
    animation: pending-pulse 1.2s ease-in-out infinite;
}

@keyframes pending-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .message-block.message-pending .msg-meta {
        animation: none;
    }
}

/* Server and Channel Items */

/* The sectors are keys, like the rail's NEW/JOIN below them: a mono-lettered
   face (or the sector's picture) with a thick bottom edge for travel. The
   open one is lit white with a pip at the rail's edge. */
.server-icon {
    --key-ink: var(--neon-cyan);
    position: relative;
    flex-shrink: 0;
    width: 51px;
    height: 46px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    border: 1px solid color-mix(in srgb, var(--key-ink) 65%, transparent);
    border-bottom-width: 3px;
    border-radius: 3px;
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--key-ink) 12%, transparent), color-mix(in srgb, var(--key-ink) 3%, transparent)),
        rgba(4, 7, 13, 0.85);
    color: color-mix(in srgb, var(--key-ink) 80%, transparent);
    cursor: pointer;
    box-shadow: 0 0 5px color-mix(in srgb, var(--key-ink) 20%, transparent);
    transition: background 0.15s, box-shadow 0.15s, border-color 0.15s, color 0.15s;
}

.sector-mono {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: bold;
    letter-spacing: 1px;
}

.sector-face {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 1px;
    opacity: 0.75;
    transition: opacity 0.15s;
}

@media (hover: hover) {
    .server-icon:hover {
        border-color: var(--key-ink);
        background: var(--key-ink);
        color: var(--bg-main);
        box-shadow: 0 0 14px var(--key-ink);
    }
    .server-icon:hover .sector-face { opacity: 1; }
}

.server-icon:active {
    border-bottom-width: 1px;
    margin-top: 2px;
    height: 44px;
}

.server-icon.active {
    border-color: #fff;
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--key-ink) 30%, transparent), color-mix(in srgb, var(--key-ink) 8%, transparent)),
        rgba(4, 7, 13, 0.85);
    color: #fff;
    box-shadow: 0 0 14px color-mix(in srgb, var(--neon-accent) 70%, transparent);
}

.server-icon.active .sector-face { opacity: 1; }

/* Hovered, the key's face comes on like a tube: it opens out of a bright line,
   stutters, and settles under scanlines while a chrome roll-bar passes down
   it. One pass per hover, all transform and opacity. */
.sector-crt {
    position: absolute;
    inset: 2px;
    z-index: 1;
    border-radius: 1px;
    overflow: hidden;
    pointer-events: none;
}

.sector-crt::before,
.sector-crt::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    opacity: 0;
}

.sector-crt::before {
    top: 0;
    bottom: 0;
    background:
        repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.38) 0 1px, transparent 1px 3px),
        radial-gradient(ellipse at 50% 45%, rgba(255, 255, 255, 0.18), transparent 70%);
}

.sector-crt::after {
    top: 0;
    height: 45%;
    background: linear-gradient(180deg,
        transparent,
        rgba(214, 226, 240, 0.35) 30%,
        rgba(255, 255, 255, 0.9) 48%,
        rgba(150, 168, 190, 0.7) 54%,
        rgba(236, 242, 250, 0.45) 64%,
        transparent);
    transform: translateY(-110%);
}

@media (hover: hover) {
    .server-icon:hover .sector-mono,
    .server-icon:hover .sector-face {
        animation: crt-on 0.42s ease-out;
    }
    .server-icon:hover .sector-crt::before {
        animation: sector-crt-flicker 0.5s linear forwards;
    }
    .server-icon:hover .sector-crt::after {
        animation: crt-roll 0.55s cubic-bezier(0.3, 0, 0.4, 1) 0.08s;
    }
}

@keyframes crt-on {
    0% { transform: scale(1.3, 0.06); opacity: 0.2; }
    18% { transform: scale(1.08, 0.5); opacity: 1; }
    34% { transform: scale(1, 1.06); opacity: 0.55; }
    46% { transform: scale(1, 0.97); opacity: 1; }
    58% { opacity: 0.8; }
    100% { transform: none; opacity: 1; }
}

/* Its own name: it shared crt-flicker with the SYSTEM_INFO rig's screen,
   and the stylesheet keeps the last of two keyframes with one name, so the
   keys had been flickering the rig's way (and ending fully lit). */
@keyframes sector-crt-flicker {
    0% { opacity: 0; }
    10% { opacity: 1; }
    20% { opacity: 0.3; }
    30% { opacity: 0.9; }
    42% { opacity: 0.45; }
    56% { opacity: 0.85; }
    100% { opacity: 0.45; }
}

@keyframes crt-roll {
    0% { transform: translateY(-110%); opacity: 1; }
    100% { transform: translateY(240%); opacity: 1; }
}

@media (hover: hover) and (prefers-reduced-motion: reduce) {
    .server-icon:hover .sector-mono,
    .server-icon:hover .sector-face,
    .server-icon:hover .sector-crt::after {
        animation: none;
    }
    .server-icon:hover .sector-crt::before {
        animation: none;
        opacity: 0.45;
    }
}

/* The open sector's pip, flush with the rail's edge (9px of rail, 1px of border). */
.server-icon.active::before {
    content: "";
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 22px;
    background: var(--neon-accent);
    border-radius: 0 2px 2px 0;
    box-shadow: 0 0 6px var(--neon-accent);
    pointer-events: none;
}

/* New posts waiting: a count on the key's corner, hot pink wherever it sits
   on the rail (sectors count channels, the DMs bubble counts conversations). */
.rail-count {
    position: absolute;
    top: -6px;
    right: -7px;
    z-index: 2;
    min-width: 15px;
    height: 13px;
    padding: 0 3px;
    box-sizing: border-box;
    border-radius: 2px;
    background: var(--neon-pink);
    color: var(--bg-main);
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: bold;
    line-height: 13px;
    letter-spacing: 0;
    text-align: center;
    box-shadow: 0 0 0 1px var(--bg-main), 0 0 8px var(--neon-pink);
    pointer-events: none;
}

.rail-count[hidden] { display: none; }

.channel-item {
    padding: 6px 12px;
    margin-bottom: 4px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s, background-color 0.2s, border-color 0.2s, box-shadow 0.2s, opacity 0.2s, transform 0.2s, text-shadow 0.2s;
    border-left: 2px solid transparent;
}

.channel-item span {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 10px;
}

@media (hover: hover) {
    .channel-item:hover {
        background: rgba(255, 255, 255, 0.05);
        color: var(--text-primary);
    }
}

/* Selection marker.
   The previous treatment — bright bar down the left edge of a tinted pill — is
   the house style of every chat sidebar shipped since about 2023, and it reads
   as generic. A terminal marks its current line with a caret in the gutter, so
   that is what this does: the row recesses slightly instead of lighting up, and
   a caret claims it. The gutter is reserved on every row so nothing shifts
   sideways when selection moves. */
.channel-item::before {
    content: ">";
    flex-shrink: 0;
    width: 0.75em;
    margin-right: 6px;
    color: var(--neon-accent);
    opacity: 0;
    transform: translateX(-3px);
    transition: opacity 0.15s, transform 0.15s;
}

.channel-item.active::before {
    opacity: 1;
    transform: translateX(0);
}

/* Reverse video: how a terminal has always marked the current line. Solid
   accent block, background-coloured text.

   It also sidesteps a clipping problem the glow version had. The name span
   needs overflow:hidden for its ellipsis, and that clip box cuts the text
   glow off square — a visible rectangle around the text. Dark text on a solid
   block needs no text-shadow at all, so there is nothing left to clip. Any
   future treatment here should avoid text-shadow on that span for the same
   reason. The block's own glow is a box-shadow on the row, which is outside
   the span's clip box and sits inside #channel-list's 10px padding. */
.channel-item.active {
    background: var(--neon-accent);
    color: var(--bg-main) !important;
    box-shadow: 0 0 8px color-mix(in srgb, var(--chrome) 35%, transparent);
}

.channel-item.active span {
    color: var(--bg-main) !important;
    text-shadow: none !important;
}

.channel-item.active::before {
    color: var(--bg-main);
}

@media (prefers-reduced-motion: reduce) {
    .channel-item::before {
        transition: none;
    }
}

/* The accent-on-glow treatment this rule used to apply is superseded by the
   reverse-video block above — it sat later in the file and, being equally
   specific and equally !important, was quietly winning: cyan text on a cyan
   fill. Its text-shadow was also the glow that overflow:hidden clipped. */

/* Mobile Interface */
.mobile-only {
    display: none;
}

#mobile-header {
    height: 50px;
    width: 100%;
    background: rgba(6, 10, 18, 0.85);
    /* Slightly transparent */
    backdrop-filter: blur(12px);
    /* Glassmorphism */
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--neon-cyan);
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 10200;
    box-shadow: 0 0 20px color-mix(in srgb, var(--chrome) 15%, transparent);
}

#sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

@media (max-width: 768px) {
    .mobile-only {
        display: flex;
    }

    #mobile-header {
        display: flex;
    }

    #app {
        flex-direction: column;
    }

    #layout-wrapper {
        padding-top: 50px;
        position: relative;
        height: calc(100vh - 50px);
        height: calc(100dvh - 50px);
    }

    .input-field,
    #message-input {
        font-size: 16px !important;
        /* Prevents iOS zoom */
    }

    /* There is no hover here, so there is no hover row: tapping a message
       opens its tray (js/msgkeys.js), with every key in it. At most one
       message spends the space, and only while you are using it. The rule
       that hides the row is with the tray's, at the end of the file. */

    /* The tapped message is marked, so it is obvious which one the controls
       belong to once they appear. */
    .message-block.actions-open {
        background: rgba(255, 255, 255, 0.03);
        border-radius: 4px;
    }

    .sidebar {
        position: fixed;
        top: 50px;
        bottom: 0;
        z-index: 10150;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        background: var(--bg-main) !important;
        backdrop-filter: blur(20px);
    }

    /* The header and drawers sit above the global scanline layer now, which
       would otherwise leave them the only surfaces in the app without the
       texture. Same gradient and opacity, drawn inside the element rather than
       over the whole viewport. Mobile only: on a desk these are below the
       global overlay and a local copy would double it. */
    #mobile-header::after,
    .sidebar::after {
        content: "";
        position: absolute;
        inset: 0;
        background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.1) 50%);
        background-size: 100% 4px;
        opacity: 0.3;
        pointer-events: none;
        z-index: 1;
    }

    #server-sidebar {
        left: 0;
        transform: translateX(-370px);
        /* 70 (server) + 300 (channel) */
        width: 70px !important;
        border-right: 1px solid var(--border-glow);
    }

    #channel-sidebar {
        left: 70px;
        transform: translateX(-370px);
        width: 250px !important;
        border-right: 1px solid var(--neon-cyan);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    }

    #layout-wrapper.drawer-open #server-sidebar,
    #layout-wrapper.drawer-open #channel-sidebar,
    #layout-wrapper.members-open #member-sidebar {
        transform: translateX(0);
    }

    /* Shut, all the way off: a deck's talk is wider than the roster. */
    #member-sidebar {
        left: auto;
        right: 0;
        transform: translateX(100%);
        width: 200px !important;
        border-left: 1px solid var(--neon-cyan);
        border-right: none;
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
    }

    /* A deck's talk keeps its 310px if the phone has them, and always leaves
       a strip of shade beside it to tap it shut. */
    #member-sidebar.deck-rail { max-width: calc(100vw - 40px); }

    .main-content {
        width: 100%;
        border-left: none;
        overflow-x: hidden;
        /* Prevent horizontal scroll leak on mobile */
    }

    #message-list {
        width: 100%;
        overflow-x: hidden;
    }

    .message-block {
        max-width: 100%;
        box-sizing: border-box;
    }

    /* The room's own header is the hand terminal's header here (paintHandKeys).
       The sector's stays, at the top of the drawer: its name, INFO and
       SETTINGS, which a phone has no other way to reach. */
    #channel-header-mobile {
        display: none !important;
    }

    .msg-username {
        font-size: 0.85rem !important;
        white-space: nowrap;
    }

    .msg-meta {
        font-size: 0.6rem !important;
        white-space: nowrap;
    }

    .message-block.reply-block {
        margin-left: 10px !important;
        gap: 10px !important;
    }

    .message-header {
        flex-wrap: wrap;
        row-gap: 4px;
    }

    .reply-block .msg-meta {
        display: none !important;
    }

    .message-actions {
        gap: 10px !important;
    }

    .message-block.reply-block .reply-connector {
        left: -8px;
        width: 12px;
    }
}

.reply-connector {
    position: absolute;
    left: -15px;
    top: -20px;
    width: 20px;
    height: 35px;
    border-left: 1px solid var(--border-glow);
    border-bottom: 1px solid var(--border-glow);
    border-bottom-left-radius: 4px;
    pointer-events: none;
    opacity: 0.3;
}

/* Notifications & @Mentions */

.mention-highlight {
    background: color-mix(in srgb, var(--hot) 10%, transparent);
    border-left: 3px solid var(--neon-pink);
    padding-left: 10px;
    color: var(--neon-pink) !important;
    text-shadow: 0 0 5px color-mix(in srgb, var(--hot) 50%, transparent);
    position: relative;
    /* The pulse announces the mention, then the highlight holds. Pulsing for
       as long as it stayed on screen kept the page repainting every frame.
       The flicker plays in the ambient burst. */
    animation: neon-pulse 2s ease-in-out 3;
}

.mention-highlight::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(color-mix(in srgb, var(--hot) 0%, transparent) 50%, color-mix(in srgb, var(--hot) 3%, transparent) 50%);
    background-size: 100% 4px;
    pointer-events: none;
}

#autocomplete-dropdown {
    position: absolute;
    background: var(--bg-surface);
    backdrop-filter: blur(20px);
    border: 1px solid var(--neon-cyan);
    max-height: 200px;
    overflow-y: auto;
    z-index: 10060;
    box-shadow: 0 0 20px color-mix(in srgb, var(--chrome) 20%, transparent);
    display: none;
    min-width: 150px;
}

.autocomplete-item {
    padding: 10px 15px;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    border-bottom: 1px solid color-mix(in srgb, var(--chrome) 10%, transparent);
}

@media (hover: hover) {
    .autocomplete-item:hover {
        background: color-mix(in srgb, var(--chrome) 10%, transparent);
        color: var(--neon-cyan);
    }
}

/* Neural_Link Formatting */
.glitch-text {
    color: var(--neon-pink);
    text-shadow: 0.05em 0 0 rgba(255, 0, 0, 0.75),
        -0.025em -0.05em 0 rgba(0, 255, 0, 0.75),
        0.025em 0.05em 0 rgba(0, 0, 255, 0.75);
    /* The jitter plays in the ambient burst (see the end of this file). */
    display: inline-block;
}

@keyframes glitch {
    0% {
        transform: translate(0);
    }

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

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

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

    60% {
        transform: translate(2px, -2px);
    }

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

    100% {
        transform: translate(0);
    }
}

/* The format keys (app.js initFormatKeys): a tab of keys that rises out of
   the composer screen's top edge, at its left, while there's a selection in
   it. The tab wears the screen's own border and opens into it (no edge
   along the bottom); each key's face is drawn in what it does, its shortcut
   printed under it, lit when the selection already wears it. Above media,
   like everything that floats over the room (see the z-index table). */
.composer-row { position: relative; }
#formatting-toolbar.format-keys {
    position: absolute;
    bottom: calc(100% - 1px);
    left: 64px; /* until placed over the screen (paintFormatKeys) */
    z-index: 10070;
    display: flex;
    gap: 4px;
    padding: 5px 6px 4px;
    border: 1px solid var(--neon-accent);
    border-bottom: 0;
    border-radius: 4px 4px 0 0;
    background:
        repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 3px),
        #04070c;
    box-shadow: 0 -4px 12px color-mix(in srgb, var(--neon-accent) 22%, transparent);
}
#formatting-toolbar.format-keys[hidden] { display: none; }
/* The tab's foot runs on into the screen's top border, so the two read as one. */
#formatting-toolbar.format-keys::after {
    content: "";
    position: absolute;
    left: -1px;
    right: -1px;
    bottom: -1px;
    height: 1px;
    background: #04070c;
}

.format-key {
    --key-ink: var(--neon-accent);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    min-width: 34px;
    height: 34px;
    padding: 0 6px;
    box-sizing: border-box;
    border: 1px solid color-mix(in srgb, var(--key-ink) 55%, transparent);
    border-bottom-width: 3px;
    border-radius: 2px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--key-ink) 14%, transparent), color-mix(in srgb, var(--key-ink) 3%, transparent));
    color: var(--text-primary);
    cursor: pointer;
}
.format-key .fk-face { font-size: 0.82rem; line-height: 1; }
.format-key .fk-face code { font-family: var(--font-mono); font-size: 0.72rem; color: var(--neon-accent); }
.format-key .fk-face b { font-family: var(--font-sans); font-weight: 900; }
.format-key .fk-face i { font-family: Georgia, serif; font-style: italic; }
.format-key .fk-glitch { color: var(--neon-pink); text-shadow: -1.5px 0 var(--neon-cyan), 1.5px 0 var(--neon-pink); }
.format-key small { color: color-mix(in srgb, var(--key-ink) 70%, transparent); font: 700 0.44rem var(--font-mono); letter-spacing: 0.5px; }
.format-key[aria-pressed="true"] {
    background: var(--key-ink);
    color: var(--bg-main);
    border-color: var(--key-ink);
    box-shadow: 0 0 8px color-mix(in srgb, var(--key-ink) 60%, transparent);
}
.format-key[aria-pressed="true"] small,
.format-key[aria-pressed="true"] .fk-face code { color: var(--bg-main); }
.format-key:active { border-bottom-width: 1px; margin-top: 2px; height: 32px; }
.format-key:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
@media (hover: hover) {
    .format-key:hover:not([aria-pressed="true"]) { background: color-mix(in srgb, var(--key-ink) 24%, transparent); }
}

@keyframes mention-flicker {

    0%,
    100% {
        opacity: 1;
    }

    41% {
        opacity: 1;
    }

    42% {
        opacity: 0.8;
    }

    43% {
        opacity: 1;
    }

    45% {
        opacity: 0.9;
    }

    46% {
        opacity: 1;
    }
}

@keyframes neon-pulse {

    0%,
    100% {
        border-left-color: var(--neon-pink);
        box-shadow: inset 4px 0 10px -4px color-mix(in srgb, var(--hot) 20%, transparent);
    }

    50% {
        border-left-color: #ff85a2;
        box-shadow: inset 8px 0 20px -4px color-mix(in srgb, var(--hot) 40%, transparent);
    }
}

/* Reactions */
.reaction-container {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 5px;
}

.reaction-chip {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    padding: 2px 6px;
    background: color-mix(in srgb, var(--chrome) 5%, transparent);
    border: 1px solid color-mix(in srgb, var(--chrome) 20%, transparent);
    border-radius: 4px;
    cursor: pointer;
    transition: color 0.2s, background-color 0.2s, border-color 0.2s, box-shadow 0.2s;
    user-select: none;
    color: var(--text-secondary);
}

@media (hover: hover) {
    .reaction-chip:hover {
        background: color-mix(in srgb, var(--chrome) 10%, transparent);
        border-color: var(--neon-cyan);
        color: var(--text-primary);
    }
}

.reaction-chip.active {
    background: color-mix(in srgb, var(--chrome) 15%, transparent);
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
    box-shadow: 0 0 8px color-mix(in srgb, var(--chrome) 30%, transparent);
    animation: reaction-pulse 2s infinite ease-in-out;
}

@keyframes reaction-pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }

    100% {
        opacity: 1;
    }
}

.reaction-picker {
    position: absolute;
    background: var(--bg-surface);
    border: 1px solid var(--border-glow);
    padding: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    z-index: 10050;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

/* Volatile Memory Manifestation */
.volatile-flicker {
    /* Flickers in the ambient burst. */
}

@keyframes volatile-flicker {

    0%,
    100% {
        opacity: 1;
    }

    30% {
        opacity: 0.95;
    }

    31% {
        opacity: 0.8;
    }

    32% {
        opacity: 0.95;
    }

    35% {
        opacity: 1;
    }

    70% {
        opacity: 1;
    }

    71% {
        opacity: 0.9;
    }

    72% {
        opacity: 1;
    }
}

/* Neural_Link Visual Protocols */
.crash-override-glitch {
    animation: crash-glitch 0.2s infinite;
    filter: hue-rotate(90deg) brightness(1.5);
    pointer-events: none;
    user-select: none;
}

@keyframes crash-glitch {
    0% {
        transform: translate(0);
    }

    20% {
        transform: translate(-2px, 2px) skewX(2deg);
    }

    40% {
        transform: translate(-2px, -2px) skewY(-2deg);
    }

    60% {
        transform: translate(2px, 2px) skewX(-2deg);
    }

    80% {
        transform: translate(2px, -2px) skewY(2deg);
    }

    100% {
        transform: translate(0);
    }
}

/* Panels on a phone: fields and buttons big enough for a finger, and 16px
   type so iOS doesn't zoom into a field. */
@media (max-width: 768px) {
    .auth-card .input-field {
        height: 48px !important;
        font-size: 16px !important;
        margin-bottom: 12px !important;
    }
}

/* CONTRABAND // the App Store flyer taped up under the login's monitor.
 *
 * The screen becomes a column so the flyer sits below the monitor. Auto margins
 * on the first and last child do the centring instead of justify-content,
 * because centred flex content taller than its box overflows off the top where
 * nothing can scroll to it — on a short phone that would take the logo with it.
 * The grid moves to position: fixed so it stops counting toward the scroll
 * height; it covered the viewport either way. */
#auth-screen {
    flex-direction: column;
    justify-content: flex-start;
    gap: 22px;
    overflow-x: hidden;
    overflow-y: auto;
    padding-block: 24px;
    box-sizing: border-box;
}

#auth-screen::before {
    position: fixed;
}

.contraband {
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    width: 100%;
    max-width: 450px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 18px 20px 16px;
    background: rgba(10, 13, 20, 0.72);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px dashed color-mix(in srgb, var(--hot) 55%, transparent);
    color: inherit;
    text-decoration: none;
    transform: rotate(-0.6deg);
}

/* Hazard tape along the top edge, like it was slapped up in a hurry. */
.contraband::before {
    content: "";
    position: absolute;
    left: -1px;
    right: -1px;
    top: -1px;
    height: 5px;
    background: repeating-linear-gradient(-45deg,
            var(--neon-pink) 0 8px,
            transparent 8px 16px);
    opacity: 0.8;
}

/* Scanlines over the whole flyer. */
.contraband::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(0deg,
            rgba(255, 255, 255, 0.025) 0 1px,
            transparent 1px 3px);
}

/* No hover state: the flyer stays put. Keyboard focus still needs a mark,
 * so it gets an outline and nothing that moves. */
.contraband:focus-visible {
    outline: 1px solid var(--neon-cyan);
    outline-offset: 3px;
}

/* The icon, with two tinted copies of itself that slip out of register every
 * few seconds, as if the pirated firmware is not entirely stable. */
.contraband-icon {
    position: relative;
    flex-shrink: 0;
    width: 84px;
    height: 84px;
    border-radius: 19px;
    background: url('appicon.png') center / cover no-repeat;
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--chrome) 35%, transparent), 0 0 22px color-mix(in srgb, var(--chrome) 30%, transparent);
    transform: rotate(-7deg);
}

.contraband-icon::before,
.contraband-icon::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: inherit;
    opacity: 0;
    mix-blend-mode: screen;
    pointer-events: none;
}

.contraband-icon::before {
    filter: hue-rotate(140deg) saturate(2);
    animation: contraband-glitch-a 4.5s steps(1) infinite;
}

.contraband-icon::after {
    filter: hue-rotate(-60deg) saturate(2);
    animation: contraband-glitch-b 4.5s steps(1) infinite;
}

@keyframes contraband-glitch-a {
    0%, 86%, 100% { opacity: 0; transform: none; clip-path: none; }
    88% { opacity: 0.8; transform: translate(-5px, 1px); clip-path: inset(10% 0 55% 0); }
    90% { opacity: 0.8; transform: translate(4px, 0); clip-path: inset(60% 0 8% 0); }
    92% { opacity: 0.6; transform: translate(-2px, -1px); clip-path: inset(30% 0 40% 0); }
}

@keyframes contraband-glitch-b {
    0%, 87%, 100% { opacity: 0; transform: none; clip-path: none; }
    89% { opacity: 0.8; transform: translate(5px, -1px); clip-path: inset(45% 0 25% 0); }
    91% { opacity: 0.7; transform: translate(-4px, 1px); clip-path: inset(5% 0 70% 0); }
}

.contraband-sticker {
    position: absolute;
    top: -9px;
    right: -14px;
    z-index: 1;
    padding: 3px 7px 2px;
    background: var(--neon-pink);
    color: #0a0d14;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 1px;
    transform: rotate(14deg);
    box-shadow: 0 0 12px color-mix(in srgb, var(--hot) 60%, transparent);
    animation: contraband-sticker 1.6s ease-in-out infinite;
}

@keyframes contraband-sticker {
    0%, 100% { transform: rotate(14deg) scale(1); }
    50% { transform: rotate(10deg) scale(1.12); }
}

.contraband-copy {
    min-width: 0;
    text-align: left;
}

.contraband-kicker {
    font-family: var(--font-mono);
    font-size: 0.58rem;
    letter-spacing: 1px;
    color: var(--neon-pink);
    margin-bottom: 5px;
    overflow-wrap: anywhere;
}

.contraband-title {
    font-weight: 600;
    font-size: 0.98rem;
    color: #fff;
    line-height: 1.25;
}

.contraband-sub {
    font-size: 0.72rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-top: 3px;
}

.contraband-cta {
    display: inline-block;
    margin-top: 9px;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--neon-cyan);
    border-bottom: 1px solid color-mix(in srgb, var(--chrome) 40%, transparent);
    padding-bottom: 1px;
}

@media (max-width: 768px) {
    .contraband {
        max-width: 90%;
        gap: 14px;
        padding: 16px 14px 14px;
    }

    .contraband-icon {
        width: 68px;
        height: 68px;
        border-radius: 15px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .contraband-icon::before,
    .contraband-icon::after,
    .contraband-sticker {
        animation: none;
    }
}

/* THE BLACK PAGES // DISCOVERY_LAYER */
.black-pages-modal {
    color: var(--amber);
    width: 600px;
    max-width: calc(100vw - 32px);
    box-sizing: border-box;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

/* The masthead: a reader's plate, as the desk and the capsule loader wear. */
.bp-mast {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid color-mix(in srgb, var(--amber) 22%, transparent);
}
.bp-title { flex: 1; min-width: 0; font-family: var(--font-mono); }
.bp-title small { display: block; color: var(--amber); font-size: 0.55rem; letter-spacing: 4px; opacity: 0.75; }
.bp-title h2 {
    margin: 4px 0 3px;
    font: 800 clamp(1.4rem, 5vw, 2rem)/1 var(--font-sans);
    letter-spacing: clamp(4px, 1.4vw, 10px);
    color: #f4e7c6;
    text-shadow: 0 2px 0 #000, 0 0 18px color-mix(in srgb, var(--amber) 45%, transparent);
}
.bp-title span { color: color-mix(in srgb, var(--amber) 65%, transparent); font-size: 0.58rem; letter-spacing: 3px; }
/* Scoped, so the general .plate-key rule further down can't undo it. */
.black-pages-modal .bp-x { --key-ink: var(--amber); flex: none; width: 34px; height: 34px; font-size: 1.1rem; }
.black-pages-modal .bp-x:active { height: 32px; }

/* The carriage: a slot with a prompt, and how many frames are on show. */
.bp-carriage {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 14px 0;
    padding: 0 12px;
    border-bottom: 1px solid color-mix(in srgb, var(--amber) 35%, transparent);
    background: rgba(0, 0, 0, 0.5);
    cursor: text;
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}
.bp-carriage:focus-within {
    border-color: var(--amber);
    background: color-mix(in srgb, var(--amber) 7%, rgba(0, 0, 0, 0.5));
    box-shadow: 0 6px 14px -8px color-mix(in srgb, var(--amber) 60%, transparent);
}
.bp-prompt { color: var(--amber); font: 700 0.9rem var(--font-mono); opacity: 0.5; }
.bp-carriage:focus-within .bp-prompt { opacity: 1; text-shadow: 0 0 6px var(--amber); }
.bp-frames { flex: none; color: color-mix(in srgb, var(--amber) 55%, transparent); font: 0.55rem var(--font-mono); letter-spacing: 2px; }

.black-pages-search {
    flex: 1;
    min-width: 0;
    color: var(--amber);
    font-family: var(--font-mono);
    padding: 11px 0;
    outline: none;
}

.black-pages-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 10px;
}

.black-pages-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
}


.black-pages-item .server-info {
    flex: 1;
    /* Without this a long description props the row open past the strip. */
    min-width: 0;
}

.black-pages-item { gap: 12px; }

/* A phone: the key goes under the entry, and the title keeps to one line. */
@media (max-width: 520px) {
    .black-pages-item { flex-direction: column; align-items: stretch; }
    .black-pages-item .black-pages-btn.plate-key { align-self: flex-start; }
    .bp-title h2 { font-size: 1.2rem; letter-spacing: 2px; }
    .bp-title small { letter-spacing: 2px; }
}

.black-pages-item .server-handle {
    color: var(--amber);
    font-weight: bold;
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.black-pages-item .server-name {
    opacity: 0.8;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

/* CONNECT: an amber plate key. CONNECTED: the same key, lit and set down. */
.black-pages-btn.plate-key {
    --key-ink: var(--amber);
    flex: none;
    height: 32px;
    padding: 0 14px;
    font-size: 0.62rem;
    letter-spacing: 2px;
}
.black-pages-btn.plate-key:active { height: 30px; }
.black-pages-btn.plate-key:not(:disabled):hover { background: var(--amber); color: #120d02; }
.black-pages-btn.is-on-file:disabled { opacity: 0.55; cursor: default; box-shadow: none; }

/* What's in the sector, in its own words: one line. */
.black-pages-item .server-desc {
    margin: 2px 0 4px;
    color: color-mix(in srgb, var(--amber) 45%, var(--ink));
    font-size: 0.78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bp-wait {
    padding: 48px 20px;
    text-align: center;
    color: color-mix(in srgb, var(--amber) 70%, transparent);
    font: 0.7rem var(--font-mono);
    letter-spacing: 4px;
}
.bp-wait.is-fault { color: var(--neon-pink); }

/* The reader's keys, under the strip, for a keyboard. */
.bp-keys {
    display: flex;
    justify-content: center;
    gap: 18px;
    margin-top: 12px;
    color: color-mix(in srgb, var(--amber) 55%, transparent);
    font: 0.52rem var(--font-mono);
    letter-spacing: 2px;
}
.bp-keys kbd {
    display: inline-block;
    min-width: 16px;
    margin-right: 3px;
    padding: 1px 4px;
    border: 1px solid color-mix(in srgb, var(--amber) 45%, transparent);
    border-bottom-width: 2px;
    border-radius: 2px;
    color: var(--amber);
    font: 700 0.55rem var(--font-mono);
    text-align: center;
}
@media (hover: none) { .bp-keys { display: none; } }

/* Custom Scrollbar for Black Pages */
.black-pages-list::-webkit-scrollbar {
    width: 6px;
}

.black-pages-list::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.5);
}

.black-pages-list::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--amber) 30%, transparent);
}

.black-pages-list::-webkit-scrollbar-thumb:hover {
    background: color-mix(in srgb, var(--amber) 50%, transparent);
}
/* ------------------------------------------------------------------ *
 * THE BLACK PAGES, as microfiche
 *
 * An archive read on a machine: a reel, a lens and a carriage, rather than a
 * page that scrolls. The black pages always wanted to be that — a public
 * directory, amber on black, read rather than browsed — so this is how they
 * are drawn.
 *
 * So the modal becomes a reader. The list is a film strip with sprocket holes
 * down both edges, each sector is a frame with a number, the whole plate sits
 * under a lens vignette, and a frame only comes into focus when the carriage
 * stops on it. Hovering is the carriage moving.
 * ------------------------------------------------------------------ */
.black-pages-modal {
    background: #0a0806;
    border: 1px solid color-mix(in srgb, var(--amber) 30%, transparent);
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.8),
        0 40px 120px rgba(0, 0, 0, 0.9),
        inset 0 0 120px rgba(0, 0, 0, 0.8);
    position: relative;
    overflow: hidden;
}

/* The lens: light falls off toward the edges of the plate, and the glass is
   never quite clean. */
.black-pages-modal::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 5;
    background:
        radial-gradient(ellipse at 50% 42%,
            color-mix(in srgb, var(--amber) 7%, transparent) 0%,
            transparent 45%),
        radial-gradient(ellipse at 50% 50%, transparent 38%, rgba(0, 0, 0, 0.75) 100%);
}


/* The strip. Sprocket holes down both edges, and the plate itself a shade
   warmer than the reader around it. */
.black-pages-list {
    position: relative;
    padding-inline: 26px;
    background:
        repeating-linear-gradient(180deg,
            transparent 0 14px,
            color-mix(in srgb, var(--amber) 55%, transparent) 14px 22px,
            transparent 22px 36px) left / 7px 36px repeat-y,
        repeating-linear-gradient(180deg,
            transparent 0 14px,
            color-mix(in srgb, var(--amber) 55%, transparent) 14px 22px,
            transparent 22px 36px) right / 7px 36px repeat-y,
        linear-gradient(180deg, rgba(255, 255, 255, 0.015), transparent);
    background-repeat: repeat-y;
}

/* A frame on the strip: numbered, ruled top and bottom, and slightly out of
   focus until the carriage settles on it. */
.black-pages-item {
    position: relative;
    border: 0;
    border-top: 1px solid color-mix(in srgb, var(--amber) 14%, transparent);
    /* The sector's ink stays on the edge of its frame: in a directory of
       sectors that stripe is information, not decoration. */
    border-left: 2px solid var(--sector-ink, var(--amber));
    border-radius: 0;
    background: transparent;
    margin-bottom: 0;
    counter-increment: fiche;
    filter: blur(0.6px) contrast(0.9) brightness(0.9);
    opacity: 0.7;
    transition: filter 0.25s ease, opacity 0.25s ease, background 0.25s ease;
}

.black-pages-list {
    counter-reset: fiche;
}

/* The frame number, stamped in the margin like a film edge code. */
.black-pages-item::before {
    content: "FRM " counter(fiche, decimal-leading-zero);
    position: absolute;
    right: 10px;
    top: 6px;
    font-family: var(--font-mono);
    font-size: 0.45rem;
    letter-spacing: 2px;
    color: color-mix(in srgb, var(--amber) 45%, transparent);
    pointer-events: none;
}

/* Focus. The lens finds the frame, and there is a moment of hunting before it
   holds: under the pointer, under the arrow keys (the carriage), or on a
   touch screen, wherever the lens is over as the strip scrolls. */
.black-pages-item:hover,
.black-pages-item.is-carriage {
    filter: none;
    opacity: 1;
    background: color-mix(in srgb, var(--amber) 5%, transparent);
    animation: fiche-focus 0.42s ease-out;
}

@keyframes fiche-focus {
    0% { filter: blur(1.4px) brightness(1.3); }
    45% { filter: blur(0.15px) brightness(1.05); }
    62% { filter: blur(0.7px); }
    100% { filter: none; }
}

.black-pages-item .server-handle {
    letter-spacing: 3px;
    text-shadow: 0 0 14px color-mix(in srgb, var(--amber) 35%, transparent);
}

.black-pages-item .server-name {
    color: color-mix(in srgb, var(--amber) 70%, var(--ink));
    letter-spacing: 1px;
}

/* The search field sits in the carriage slot: no box of its own. */
.black-pages-search {
    background: transparent;
    border: 0;
    border-radius: 0;
    letter-spacing: 3px;
}

/* Loading a plate: it drops in, and the reader takes a moment to light. */
@keyframes fiche-plate {
    0% { opacity: 0; transform: translateY(-14px); filter: brightness(2) blur(3px); }
    60% { opacity: 1; filter: brightness(1.1) blur(0.4px); }
    75% { filter: brightness(0.9); }
    100% { opacity: 1; transform: none; filter: none; }
}

.black-pages-modal {
    animation: fiche-plate 0.55s ease-out both;
}

@media (prefers-reduced-motion: reduce) {

    .black-pages-modal,
    .black-pages-item:hover,
    .black-pages-item.is-carriage {
        animation: none;
    }
}

/* ------------------------------------------------------------------ *
 * THE CABINETS
 *
 * The arcade is desktop-only and nobody reads prose through it, so the glass
 * can be as filthy as it likes. The picture itself is composited in
 * js/projector.js — persistence, bloom, colour fringing. Everything here is
 * the furniture in front of it: scanlines, curvature, grain, and the band that
 * rolls down a tube which has never been serviced.
 *
 * All of it is drawn over the canvas and takes no pointer events, so the games
 * play exactly as before.
 * ------------------------------------------------------------------ */
.cabinet {
    position: relative;
    border-radius: 14px / 10px;
    overflow: hidden;
    isolation: isolate;
}

/* The tube is not flat. A whisper of perspective, and light pooling toward
   the middle of the glass. */
.cabinet canvas {
    display: block;
    transform: perspective(900px) rotateX(0.7deg) scale(1.012);
    transform-origin: center 55%;
}

/* Scanlines, curvature and the reflection off the glass, in one layer. */
.cabinet-glass {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    background:
        repeating-linear-gradient(180deg,
            rgba(0, 0, 0, 0.42) 0 1px,
            transparent 1px 3px),
        radial-gradient(ellipse at 50% 45%, transparent 52%, rgba(0, 0, 0, 0.8) 100%),
        linear-gradient(115deg, rgba(255, 255, 255, 0.05) 0 18%, transparent 34%);
    mix-blend-mode: multiply;
}

/* The reflection has to sit over the picture rather than under it, so it is
   its own pass — multiply would eat it. */
.cabinet-glass::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(118deg,
            rgba(255, 255, 255, 0.055) 0 14%,
            transparent 30%);
    mix-blend-mode: screen;
}

.cabinet-grain {
    position: absolute;
    inset: -40px;
    z-index: 4;
    pointer-events: none;
    opacity: 0.16;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='160' height='160' filter='url(%23n)' opacity='0.55'/></svg>");
    animation: cabinet-grain 0.5s steps(1) infinite;
}

@keyframes cabinet-grain {
    0% { transform: translate(0, 0); }
    25% { transform: translate(-12px, 7px); }
    50% { transform: translate(9px, -10px); }
    75% { transform: translate(-5px, -8px); }
    100% { transform: translate(8px, 9px); }
}

/* The refresh band: brighter where it passes, and never quite in time with
   anything else on the screen. */
.cabinet-band {
    position: absolute;
    left: 0;
    right: 0;
    z-index: 5;
    pointer-events: none;
    /* The band is a 90px strip at the head of a box the screen's height
       plus 120px, so sliding the box its own height carries the strip from
       120px above the glass to the bottom edge: the old top -120px → 100%,
       done by the compositor instead of a layout every frame. */
    top: -120px;
    height: calc(100% + 120px);
    background: linear-gradient(180deg,
            transparent,
            rgba(255, 255, 255, 0.045) 45%,
            rgba(255, 255, 255, 0.075) 52%,
            transparent) no-repeat 0 0 / 100% 90px;
    animation: cabinet-band 5.5s linear infinite;
}

@keyframes cabinet-band {
    0% { transform: translateY(0); }
    100% { transform: translateY(100%); }
}

/* Switching the cabinet on: the tube takes a moment to find its level. */
.cabinet-lit canvas {
    animation: cabinet-warmup 0.9s ease-out both;
}

@keyframes cabinet-warmup {
    0% { opacity: 0; filter: brightness(3) blur(8px); transform: perspective(900px) rotateX(0.7deg) scaleY(0.004); }
    18% { opacity: 1; filter: brightness(2.2) blur(3px); transform: perspective(900px) rotateX(0.7deg) scaleY(0.05); }
    38% { filter: brightness(1.5) blur(1px); transform: perspective(900px) rotateX(0.7deg) scale(1.012); }
    52% { filter: brightness(0.75); }
    70% { filter: brightness(1.15); }
    100% { opacity: 1; filter: none; transform: perspective(900px) rotateX(0.7deg) scale(1.012); }
}

/* The bezel: a housing rather than a border, with the screw ticks of
   something that was assembled. */
.cabinet::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 6;
    pointer-events: none;
    border-radius: inherit;
    box-shadow:
        inset 0 0 0 1px rgba(0, 0, 0, 0.9),
        inset 0 0 22px rgba(0, 0, 0, 0.85),
        inset 0 2px 0 rgba(255, 255, 255, 0.05);
}

@media (prefers-reduced-motion: reduce) {

    .cabinet-grain,
    .cabinet-band,
    .cabinet-lit canvas {
        animation: none;
    }

    .cabinet-band {
        display: none;
    }
}

/* The cabinet's own prompts belong in front of the glass, not behind it. */
#arcade-overlay {
    z-index: 8;
}

/* ------------------------------------------------------------------ *
 * THE CABINET ON A PHONE
 *
 * Only on a touch screen (js/arcade.js decides). The board is sized to what
 * is left of the screen, and under it is a zone for the thumbs: gestures by
 * default, or keys for anyone who would rather press things. Each game sets
 * --cab to its own colour: pink Grubtris, cyan Snake, green Grubout.
 *
 * The play area takes every touch itself — no scrolling, no double-tap zoom,
 * no text selection, no callout — because each of those is a delay or a
 * misfire in a game that is decided in tenths of a second. The leaderboard
 * sits below it, where the page still scrolls.
 * ------------------------------------------------------------------ */
.arcade-touch {
    --cab: var(--neon-pink);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    min-height: 100%;
    padding: 10px 16px 24px;
    font-family: var(--font-mono);
}

.arcade-touch .touch-top {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.touch-score {
    color: gold;
    font-size: 0.85rem;
    letter-spacing: 1px;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.45);
    white-space: nowrap;
}

.control-switch {
    display: flex;
    border: 1px solid var(--border-glow);
    border-radius: 4px;
    overflow: hidden;
}

.control-switch button {
    background: transparent;
    color: var(--text-secondary);
    border: 0;
    padding: 6px 8px;
    font: 700 0.55rem var(--font-mono);
    letter-spacing: 1px;
}

.control-switch button[aria-pressed="true"] {
    background: var(--cab);
    color: #000;
}

.touch-play {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.thumb-zone {
    width: 100%;
    height: 118px;
    display: flex;
    align-items: center;
    justify-content: space-around;
    border: 1px dashed color-mix(in srgb, var(--cab) 35%, transparent);
    border-radius: 12px;
    background: color-mix(in srgb, var(--cab) 3%, transparent);
}

.zone-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    pointer-events: none;
}

.zone-hint b {
    color: var(--cab);
    font-size: 0.8rem;
    letter-spacing: 1px;
    text-shadow: 0 0 8px color-mix(in srgb, var(--cab) 50%, transparent);
}

.zone-hint span {
    color: var(--text-secondary);
    font-size: 0.55rem;
    letter-spacing: 2px;
}

.thumb-zone.is-keys {
    justify-content: space-between;
    padding: 10px;
    border-style: solid;
    border-color: color-mix(in srgb, var(--cab) 25%, transparent);
}

.thumb-zone.is-keys {
    gap: 14px;
}

.pad-group {
    display: flex;
    flex: 3;
    gap: 8px;
    height: 100%;
}

.pad-group + .pad-group {
    flex: 2;
}

.pad-key {
    flex: 1;
    min-width: 0;
    height: 100%;
    display: grid;
    place-items: center;
    padding: 0;
    border-radius: 10px;
    border: 1px solid color-mix(in srgb, var(--cab) 55%, transparent);
    background: color-mix(in srgb, var(--cab) 8%, transparent);
    color: var(--cab);
    font-size: 1.4rem;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
}

.pad-key svg {
    width: 26px;
    height: 26px;
    pointer-events: none;
}

.pad-key.pad-rotate {
    flex: 1.3;
}

/* Lit the instant it is touched: the key is the feedback. */
.pad-key.is-down {
    background: var(--cab);
    color: #000;
    box-shadow: 0 0 16px color-mix(in srgb, var(--cab) 60%, transparent);
}

/* Snake's D-pad: a cross, because a row of four arrows makes the thumb look
   down to find the right one. */
.thumb-zone.is-dpad {
    height: 156px;
    border-style: solid;
    border-color: color-mix(in srgb, var(--cab) 25%, transparent);
}

.dpad {
    display: grid;
    grid-template-columns: repeat(3, 62px);
    grid-template-rows: repeat(3, 44px);
    gap: 4px;
}

.dpad .pad-key { width: 100%; }
.dpad [data-dir="up"] { grid-area: 1 / 2; }
.dpad [data-dir="left"] { grid-area: 2 / 1; }
.dpad [data-dir="right"] { grid-area: 2 / 3; }
.dpad [data-dir="down"] { grid-area: 3 / 2; }

.arcade-touch #arcade-leaderboard {
    width: 100% !important;
}

/* Only the play area takes touches; the top bar, the margins and the gaps
   still scroll the room, which is how the leaderboard is reached. So a thumb
   that slid off the D-pad nudged the whole cabinet up under whatever sits
   above the page (in the app, the ARCADE | TALK tabs), hiding HUB and the
   score. The cabinet's top is now a resting place: a nudge near it springs
   back, and a real scroll still runs on to the leaderboard at the end. (A
   second snap point on the leaderboard was tried: the run is short enough
   that nudges landed there instead, which hid the top just the same.) */
#arcade-room:has(> .arcade-touch) { scroll-snap-type: y proximity; }
.arcade-touch { scroll-snap-align: start; }

/* ------------------------------------------------------------------ *
 * THE ARCADE FLOOR
 *
 * Three machines in a row under a lit sign, built from the kit the rest of
 * the app is made of: hatched housings, tags, keys with travel, an LCD. It
 * used to be a floor grid running off to a horizon, glassy cards and light
 * pooling on the ground, which is stock synthwave and read as generated.
 * The screens still run their attract loops, because an arcade with dark
 * screens is a closed arcade.
 *
 * Markup and CSS only; each machine's high score is filled from the board.
 * ------------------------------------------------------------------ */
.arcade-hall {
    position: relative;
    min-height: 100%;
    /* The room is a flex column, and a flex item shrinks to fit it by
       default. On a phone, where the machines stack taller than the screen,
       that squeezed the hall and centred the overflow off both ends. It
       grows instead, and the room scrolls. */
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    padding: 36px 20px 56px;
    box-sizing: border-box;
    font-family: var(--font-mono);
}

/* The sign: a lightbox in a mount. Lit, steady, and made of something. */
.hall-sign {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px 34px 12px;
    border: 1px solid color-mix(in srgb, var(--neon-cyan) 55%, transparent);
    border-radius: 3px;
    background:
        repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 3px),
        #070b12;
    box-shadow:
        0 0 0 5px #0b0f18,
        0 0 0 6px color-mix(in srgb, var(--chrome) 30%, transparent),
        0 10px 26px rgba(0, 0, 0, 0.6),
        inset 0 0 22px color-mix(in srgb, var(--neon-cyan) 12%, transparent);
}

.sign-tube {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 8px;
    color: #fff;
    text-shadow: 0 0 6px var(--neon-cyan), 0 0 14px color-mix(in srgb, var(--neon-cyan) 60%, transparent);
}

.sign-strip {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #262a33;
    font-size: 0.58rem;
    letter-spacing: 5px;
    text-align: center;
    color: color-mix(in srgb, var(--amber) 90%, #fff);
}

.hall-floorplan {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 24px;
}

/* A machine: tags, a marquee, the screen, and its console. */
.cabinet-unit {
    --cab-ink: var(--neon-cyan);
    position: relative;
    width: 250px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    border: 1px solid color-mix(in srgb, var(--chrome) 35%, transparent);
    border-radius: 4px;
    background:
        repeating-linear-gradient(135deg, transparent 0 3px, color-mix(in srgb, var(--chrome) 5%, transparent) 3px 4px),
        rgba(4, 7, 13, 0.94);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 2px 10px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.cab-grid { --cab-ink: var(--neon-cyan); }
.cab-tris { --cab-ink: var(--hot); }
.cab-out { --cab-ink: var(--neon-green); }

.cabinet-unit:hover,
.cabinet-unit:focus-visible {
    border-color: var(--cab-ink);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 0 16px color-mix(in srgb, var(--cab-ink) 30%, transparent);
}

.cabinet-unit:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

.cab-head {
    display: flex;
    justify-content: space-between;
    padding: 7px 10px 0;
}

/* The marquee: a solid strip of the machine's colour. */
.cab-marquee {
    margin: 6px 8px 0;
    padding: 7px 10px;
    border-radius: 2px;
    background: var(--cab-ink);
    color: #05070c;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 3px;
    text-align: center;
}

/* The screen, set into the housing. */
.cab-screen {
    position: relative;
    height: 126px;
    margin: 8px;
    border: 1px solid color-mix(in srgb, var(--cab-ink) 30%, transparent);
    border-radius: 2px;
    background: #04060b;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.8);
    overflow: hidden;
}

.cab-glass {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    background:
        repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.4) 0 1px, transparent 1px 3px),
        radial-gradient(ellipse at 50% 45%, transparent 50%, rgba(0, 0, 0, 0.7) 100%);
}

.cab-attract {
    position: absolute;
    inset: 14px 0 0;
}

/* The machine's high score across the top of the glass, the way attract
   mode shows it, in the machine's own colour. */
.cab-hi {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 6px;
    padding: 3px 8px;
    font-size: 8px;
    letter-spacing: 1px;
    color: #fff;
    background: rgba(4, 6, 11, 0.8);
}

.cab-hi b {
    color: var(--cab-ink);
    letter-spacing: 2px;
    text-shadow: 0 0 6px var(--cab-ink);
}

.cab-hi-name {
    min-width: 0;
    max-width: 50%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-secondary);
    text-transform: uppercase;
}

/* Grub Grid's attract: a lit cell running the grid, leaving a tail. */
.attract-grid {
    background:
        repeating-linear-gradient(90deg, color-mix(in srgb, var(--cab-ink) 14%, transparent) 0 1px, transparent 1px 14px),
        repeating-linear-gradient(180deg, color-mix(in srgb, var(--cab-ink) 14%, transparent) 0 1px, transparent 1px 14px);
}

.attract-grid::before {
    content: "";
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--cab-ink);
    box-shadow: 0 0 12px var(--cab-ink), 0 0 26px var(--cab-ink);
    animation: attract-crawl 5.2s steps(14) infinite;
}

@keyframes attract-crawl {
    0% { left: 14px; top: 14px; }
    25% { left: 210px; top: 14px; }
    50% { left: 210px; top: 84px; }
    75% { left: 14px; top: 84px; }
    100% { left: 14px; top: 14px; }
}

/* Grubtris' attract: pieces falling past the screen from wherever they like,
   turning as they go. No stack — nothing is being played, the machine is just
   showing you what it is. Each piece is one block plus box-shadows for the
   other three, so a tetromino costs a single element. */
.attract-tris .tet {
    position: absolute;
    top: -34px;
    width: 10px;
    height: 10px;
    background: var(--tet-ink, var(--cab-ink));
    box-shadow: 0 0 10px color-mix(in srgb, var(--tet-ink, var(--cab-ink)) 70%, transparent);
    animation-name: tet-fall;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    opacity: 0;
}

.attract-tris .tet-i {
    --tet-ink: var(--neon-cyan);
    box-shadow:
        0 11px 0 var(--tet-ink),
        0 22px 0 var(--tet-ink),
        0 33px 0 var(--tet-ink),
        0 0 12px color-mix(in srgb, var(--tet-ink) 60%, transparent);
}

.attract-tris .tet-o {
    --tet-ink: var(--amber);
    box-shadow:
        11px 0 0 var(--tet-ink),
        0 11px 0 var(--tet-ink),
        11px 11px 0 var(--tet-ink),
        0 0 12px color-mix(in srgb, var(--tet-ink) 60%, transparent);
}

.attract-tris .tet-l {
    --tet-ink: var(--hot);
    box-shadow:
        0 11px 0 var(--tet-ink),
        0 22px 0 var(--tet-ink),
        11px 22px 0 var(--tet-ink),
        0 0 12px color-mix(in srgb, var(--tet-ink) 60%, transparent);
}

.attract-tris .tet-t {
    --tet-ink: var(--ok);
    box-shadow:
        11px 0 0 var(--tet-ink),
        22px 0 0 var(--tet-ink),
        11px 11px 0 var(--tet-ink),
        0 0 12px color-mix(in srgb, var(--tet-ink) 60%, transparent);
}

.attract-tris .tet-s {
    --tet-ink: var(--neon-purple);
    box-shadow:
        11px 0 0 var(--tet-ink),
        11px 11px 0 var(--tet-ink),
        22px 11px 0 var(--tet-ink),
        0 0 12px color-mix(in srgb, var(--tet-ink) 60%, transparent);
}

@keyframes tet-fall {
    0% { transform: translateY(0) rotate(0deg); opacity: 0; }
    12% { opacity: 0.9; }
    88% { opacity: 0.9; }
    100% { transform: translateY(190px) rotate(var(--spin, 90deg)); opacity: 0; }
}

/* The console: what the game is, and the key. */
.cab-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 2px 10px 10px;
}

.cab-blurb {
    font-size: 0.62rem;
    letter-spacing: 2px;
    text-align: center;
    color: var(--text-secondary);
}

.cab-play {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 32px;
    box-sizing: border-box;
    border: 1px solid var(--cab-ink);
    border-bottom-width: 3px;
    border-radius: 2px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--cab-ink) 16%, transparent), color-mix(in srgb, var(--cab-ink) 4%, transparent));
    color: var(--cab-ink);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 3px;
    transition: background 0.15s, color 0.15s;
}

.cabinet-unit:hover .cab-play,
.cabinet-unit:focus-visible .cab-play {
    background: var(--cab-ink);
    color: #05070c;
}

.cabinet-unit:active .cab-play {
    border-bottom-width: 1px;
    margin-top: 2px;
    height: 30px;
}

/* The token slot: a thin slit and its legend, as the first cabinets had it.
   Still at rest; it blinks only while you are standing at the machine. */
.cab-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding-top: 2px;
    font-size: 0.5rem;
    letter-spacing: 3px;
    color: var(--cab-ink);
    opacity: 0.55;
    transition: opacity 0.15s;
}

.cab-slot i {
    width: 26px;
    height: 4px;
    border-radius: 2px;
    background: #000;
    box-shadow:
        inset 0 1px 2px rgba(0, 0, 0, 0.9),
        0 0 0 1px color-mix(in srgb, var(--cab-ink) 40%, transparent);
}

.cabinet-unit:hover .cab-slot,
.cabinet-unit:focus-visible .cab-slot { opacity: 1; }

.cabinet-unit:hover .cab-slot span,
.cabinet-unit:focus-visible .cab-slot span {
    animation: cab-blink 1.4s steps(1) infinite;
}

@keyframes cab-blink {
    0%, 55% { opacity: 1; }
    56%, 100% { opacity: 0.25; }
}

@media (prefers-reduced-motion: reduce) {
    .cabinet-unit:hover .cab-slot span { animation: none; }
}

@media (prefers-reduced-motion: reduce) {
    .attract-grid::before,
    .attract-tris .tet {
        animation: none;
    }

    /* A still machine still has to look switched on: the pieces sit where
       they were rather than vanishing. */
    .attract-tris .tet {
        opacity: 0.9;
        top: 40px;
    }
}

@media (max-width: 768px) {
    .sign-tube { font-size: 1.4rem; letter-spacing: 4px; }
    .cabinet-unit { width: min(100%, 300px); }
}

/* Grubout's attract: a ball working at a wall that never quite comes down,
   with the paddle tracking it along the bottom. */
.attract-out .out-wall {
    position: absolute;
    left: 14px;
    right: 14px;
    top: 12px;
    height: 30px;
    background:
        repeating-linear-gradient(90deg,
            color-mix(in srgb, var(--cab-ink) 75%, transparent) 0 20px,
            transparent 20px 23px),
        repeating-linear-gradient(180deg,
            color-mix(in srgb, var(--cab-ink) 60%, transparent) 0 9px,
            transparent 9px 12px);
    background-blend-mode: multiply;
    box-shadow: 0 0 18px color-mix(in srgb, var(--cab-ink) 40%, transparent);
    opacity: 0.9;
}

.attract-out .out-ball {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #d9ffe9;
    box-shadow: 0 0 10px var(--cab-ink), 0 0 20px var(--cab-ink);
    /* Across by translate, up and down by transform: two properties, so the
       two bounces still run at their own speeds, and both are the
       compositor's to move. They were left and top. */
    left: 0;
    top: 0;
    animation: out-ball-x 2.3s linear infinite alternate,
               out-ball-y 1.55s ease-in-out infinite alternate;
}

@keyframes out-ball-x {
    from { translate: 26px 0; }
    to { translate: 196px 0; }
}

@keyframes out-ball-y {
    from { transform: translateY(46px); }
    to { transform: translateY(86px); }
}

.attract-out .out-paddle {
    position: absolute;
    bottom: 10px;
    width: 46px;
    height: 5px;
    background: var(--cab-ink);
    box-shadow: 0 0 12px var(--cab-ink);
    left: 0;
    animation: out-paddle 2.3s linear infinite alternate;
}

@keyframes out-paddle {
    from { transform: translateX(12px); }
    to { transform: translateX(168px); }
}

@media (prefers-reduced-motion: reduce) {

    .attract-out .out-ball,
    .attract-out .out-paddle {
        animation: none;
    }

    .attract-out .out-ball { left: 110px; top: 70px; }
    .attract-out .out-paddle { left: 90px; }
}

/* ------------------------------------------------------------------ *
 * NEW_CHANNEL: choosing a room
 *
 * Four kinds of room, drawn as cards rather than a list of radio buttons,
 * each in its own colour with a little loop of what it is like inside. The
 * radios are still there under the cards — the keyboard, screen readers and
 * the create handler all use them exactly as before.
 *
 * Transmission is double-wide and carries the volatile switch in its own
 * card, since volatility is a property of talk and of nothing else. It is
 * always there, dimmed until transmission is chosen; arming it chooses it.
 * ------------------------------------------------------------------ */
.room-forge {
    width: 640px;
    max-width: 94vw;
    max-height: 90vh;
    overflow-y: auto;
}

.forge-name {
    position: relative;
    margin-top: 12px;
}

.forge-hash {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--font-mono);
    color: var(--neon-cyan);
    opacity: 0.7;
    pointer-events: none;
}

.forge-name .input-field {
    padding-left: 28px;
    margin: 0;
}

.forge-name .input-field.input-invalid {
    border-color: var(--hot);
    box-shadow: 0 0 10px color-mix(in srgb, var(--hot) 25%, transparent);
}

.forge-name-note {
    min-height: 1.1em;
    margin-top: 5px;
    font-family: var(--font-mono);
    font-size: 0.55rem;
    letter-spacing: 1px;
    color: var(--hot);
}

.forge-label {
    margin: 10px 0 8px;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 2px;
    color: var(--neon-cyan);
}

/* Transmission across the top, the other rooms in one row beneath it —
   two columns left the wall on a line of its own. Four now, with the back
   room; the forge is wider so none of them is cramped. */
.forge-rooms {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

/* Each room's colour — the same ones its channels wear in the list. */
.room-chat { --room-ink: var(--neon-cyan); }
.room-deck { --room-ink: var(--hot); }
.room-arcade { --room-ink: var(--neon-blue); }
.room-wall { --room-ink: var(--neon-green); }
.room-backroom { --room-ink: var(--neon-purple); }

.forge-room {
    position: relative;
    /* A grid item is as wide as its content by default, and the wall's tag
       typing itself out was content — the whole column grew with it. */
    min-width: 0;
    border: 1px solid color-mix(in srgb, var(--room-ink) 22%, transparent);
    background: color-mix(in srgb, var(--room-ink) 4%, rgba(0, 0, 0, 0.35));
    border-radius: 4px;
    font-family: var(--font-mono);
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.room-wide {
    grid-column: 1 / -1;
}

.forge-room:hover {
    border-color: color-mix(in srgb, var(--room-ink) 50%, transparent);
}

.forge-room:has(input[type="radio"]:checked) {
    border-color: var(--room-ink);
    background: color-mix(in srgb, var(--room-ink) 10%, rgba(0, 0, 0, 0.35));
    box-shadow: 0 0 22px color-mix(in srgb, var(--room-ink) 25%, transparent),
        inset 0 0 18px color-mix(in srgb, var(--room-ink) 8%, transparent);
}

.forge-room:has(input[type="radio"]:focus-visible) {
    outline: 1px solid var(--room-ink);
    outline-offset: 2px;
}

/* A tick in the corner of whichever room is chosen. */
.forge-room:has(input[type="radio"]:checked)::after {
    content: "SELECTED";
    position: absolute;
    top: 9px;
    right: 10px;
    font-size: 0.45rem;
    letter-spacing: 2px;
    color: var(--room-ink);
}

/* The narrow cards have no room for the word beside their name, so they get
   a lit pip in the corner instead. */
.forge-room:not(.room-wide):has(input[type="radio"]:checked)::after {
    content: "";
    top: 8px;
    right: 8px;
    width: 6px;
    height: 6px;
    background: var(--room-ink);
    box-shadow: 0 0 8px var(--room-ink);
}

/* The part of the card that picks the room. */
.room-pick {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 12px 10px;
    cursor: pointer;
}

/* The radio stays in the page — focusable, readable — just not drawn. */
.room-pick input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* Glyph beside the name, at the name's height. */
.room-head {
    display: flex;
    align-items: center;
    gap: 8px;
}

.room-glyph {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1em;
    font-size: 0.8rem;
    line-height: 1;
    color: var(--room-ink);
    text-shadow: 0 0 10px color-mix(in srgb, var(--room-ink) 70%, transparent);
}

.room-name {
    font-size: 0.72rem;
    line-height: 1;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--text-primary);
}

.room-line {
    font-size: 0.55rem;
    line-height: 1.4;
    color: var(--text-secondary);
    min-height: 2.8em;
}

.room-wide .room-line {
    min-height: 0;
}

/* The little window into each room. */
.room-preview {
    position: relative;
    height: 26px;
    margin-top: 4px;
    overflow: hidden;
    border-top: 1px solid color-mix(in srgb, var(--room-ink) 18%, transparent);
    padding-top: 6px;
    font-size: 0.5rem;
    color: color-mix(in srgb, var(--room-ink) 80%, var(--text-secondary));
}

/* Transmission: the conversation scrolling past, and a caret waiting. */
.preview-chat i {
    display: block;
    font-style: normal;
    white-space: nowrap;
    animation: forge-scroll 4.4s steps(1) infinite;
}

.preview-chat b {
    display: inline-block;
    width: 5px;
    height: 8px;
    vertical-align: -1px;
    background: var(--room-ink);
    animation: forge-blink 1s steps(1) infinite;
}

/* An endless loop: Momo asks, Toby types his answer, the log scrolls one line
   so Momo asks again, and it snaps back to the start. The line after the
   snap looks exactly like the line before it, so it never visibly jumps. */
.preview-chat .typed {
    display: inline-block;
    vertical-align: bottom;
    overflow: hidden;
    white-space: nowrap;
    width: 0;
    animation: forge-type 4.4s steps(14) infinite;
}

@keyframes forge-type {
    0%, 10% { width: 0; }
    42%, 100% { width: 14ch; }
}

@keyframes forge-scroll {
    0%, 62% { transform: translateY(0); }
    63%, 100% { transform: translateY(-10px); }
}

@keyframes forge-blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Tape deck: a level meter that never stops. */
.preview-deck {
    display: flex;
    align-items: flex-end;
    gap: 3px;
}

.preview-deck i {
    width: 5px;
    height: 16px;
    background: var(--room-ink);
    box-shadow: 0 0 6px color-mix(in srgb, var(--room-ink) 60%, transparent);
    transform-origin: bottom;
    animation: forge-meter 0.9s ease-in-out infinite alternate;
}

.preview-deck i:nth-child(2) { animation-delay: -0.3s; animation-duration: 0.7s; }
.preview-deck i:nth-child(3) { animation-delay: -0.6s; animation-duration: 1.1s; }
.preview-deck i:nth-child(4) { animation-delay: -0.1s; animation-duration: 0.8s; }
.preview-deck i:nth-child(5) { animation-delay: -0.5s; animation-duration: 1s; }
.preview-deck i:nth-child(6) { animation-delay: -0.2s; animation-duration: 0.6s; }
.preview-deck i:nth-child(7) { animation-delay: -0.4s; animation-duration: 0.95s; }

@keyframes forge-meter {
    from { transform: scaleY(0.2); }
    to { transform: scaleY(1); }
}

/* Arcade: a score, and the cabinet waiting on a credit. */
.preview-arcade {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.preview-arcade b {
    flex: none;
    white-space: nowrap;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--room-ink);
    text-shadow: 0 0 6px var(--room-ink);
}

.preview-arcade i {
    min-width: 0;
    overflow: hidden;
    text-overflow: clip;
    white-space: nowrap;
    margin-left: 6px;
    font-style: normal;
    animation: forge-blink 1.2s steps(1) infinite;
}

/* The wall: somebody's tag, going up one character at a time. */
.preview-wall {
    display: flex;
    align-items: center;
}

.preview-wall i {
    display: inline-block;
    font-style: normal;
    white-space: nowrap;
    overflow: hidden;
    max-width: 100%;
    width: 0;
    border-right: 1px solid var(--room-ink);
    animation: forge-scrawl 4.5s steps(30) infinite;
}

@keyframes forge-scrawl {
    0% { width: 0; }
    70%, 100% { width: 30ch; }
}

/* The back room: a line said in a lit room, then the lights go out. */
.preview-backroom {
    display: flex;
    align-items: center;
}

.preview-backroom i {
    font-style: normal;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    animation: forge-lit 5s steps(1) infinite;
}

.preview-backroom b {
    position: absolute;
    left: 0;
    right: 0;
    top: 6px;
    font-weight: 700;
    letter-spacing: 2px;
    color: color-mix(in srgb, var(--room-ink) 55%, transparent);
    opacity: 0;
    animation: forge-dark 5s steps(1) infinite;
}

@keyframes forge-lit {
    0%, 64% { opacity: 1; }
    65%, 100% { opacity: 0; }
}

@keyframes forge-dark {
    0%, 70% { opacity: 0; }
    71%, 96% { opacity: 1; }
    97%, 100% { opacity: 0; }
}

/* ---- Volatile memory, inside the transmission card -------------------- */
.volatile-inline {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    column-gap: 14px;
    row-gap: 6px;
    margin: 0 12px 12px;
    padding-top: 10px;
    border-top: 1px dashed color-mix(in srgb, var(--warn) 28%, transparent);
    transition: opacity 0.2s ease;
}

/* Present but asleep until transmission is the room being made. */
.room-chat:not(:has(input[type="radio"]:checked)) .volatile-inline {
    opacity: 0.45;
}

.volatile-switch {
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
}

.volatile-switch input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

/* The toggle: a slot, and a knob that goes hot when armed — with fine hazard
   stripes in the slot, which is all the warning tape this needs. */
.vs-track {
    position: relative;
    width: 30px;
    height: 14px;
    border-radius: 7px;
    background: #0b0c10;
    border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.8);
    transition: background 0.2s ease, border-color 0.2s ease;
}

.vs-knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6a6f7c;
    transition: left 0.2s cubic-bezier(.3, 1.5, .5, 1), background 0.2s ease, box-shadow 0.2s ease;
}

.volatile-switch input:checked + .vs-track {
    border-color: var(--warn);
    background: repeating-linear-gradient(-45deg,
            color-mix(in srgb, var(--warn) 35%, transparent) 0 3px,
            transparent 3px 6px),
        #0b0c10;
}

.volatile-switch input:checked + .vs-track .vs-knob {
    left: 18px;
    background: var(--warn);
    box-shadow: 0 0 8px var(--warn);
}

.volatile-switch input:focus-visible + .vs-track {
    outline: 1px solid var(--warn);
    outline-offset: 2px;
}

.volatile-title {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--warn);
    white-space: nowrap;
}

/* The buffer, as a train of cars on a track. Armed, it runs: the car at the
 * front tips off the end and falls, then the whole train rolls up a place to
 * close the gap, and a new car rolls on at the back. Every beat, for as long
 * as it is armed — which is what the setting does to messages.
 *
 * There are more cars than fit, so there is always one waiting out of sight
 * to roll on. The row moves exactly one car's width per beat and then snaps
 * back, and because every car looks the same the snap cannot be seen. */
.volatile-buffer {
    position: relative;
    height: 12px;
    overflow: hidden;
    /* The track the cars run on. */
    background: linear-gradient(transparent 10px,
            color-mix(in srgb, var(--warn) 30%, transparent) 10px 11px,
            transparent 11px);
}

.vb-row {
    display: flex;
    gap: 2px;
    width: max-content;
}

.volatile-buffer i {
    flex: none;
    width: 10px;
    height: 8px;
    background: color-mix(in srgb, var(--text-secondary) 25%, transparent);
    transition: background 0.2s ease;
}

.volatile-inline:has(#volatile-toggle:checked) .volatile-buffer i {
    background: color-mix(in srgb, var(--warn) 65%, transparent);
}

.volatile-inline:has(#volatile-toggle:checked) .vb-row {
    animation: vb-advance 1.4s ease-in-out infinite;
}

.volatile-inline:has(#volatile-toggle:checked) .volatile-buffer i:first-child {
    transform-origin: left bottom;
    animation: vb-derail 1.4s ease-in infinite;
}

/* The train holds while the front car goes, then rolls up one car (10px wide
   plus the 2px coupling). */
@keyframes vb-advance {
    0%, 45% { transform: translateX(0); }
    100% { transform: translateX(-12px); }
}

/* The front car tips off the end of the track, goes red, and drops. */
@keyframes vb-derail {
    0% { transform: none; opacity: 1; background: color-mix(in srgb, var(--warn) 65%, transparent); }
    18% { transform: rotate(-25deg); background: var(--hot); }
    45% { transform: translate(-3px, 14px) rotate(-70deg); opacity: 0; background: var(--hot); }
    100% { transform: translate(-3px, 14px) rotate(-70deg); opacity: 0; }
}

.volatile-fine {
    grid-column: 1 / -1;
    font-size: 0.52rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

.volatile-fine .when-armed { display: none; color: var(--warn); }
.volatile-inline:has(#volatile-toggle:checked) .when-safe { display: none; }
.volatile-inline:has(#volatile-toggle:checked) .when-armed { display: inline; }

@media (max-width: 520px) {
    .forge-rooms { grid-template-columns: 1fr; }
    .room-line { min-height: 0; }
}

@media (prefers-reduced-motion: reduce) {

    .preview-chat i,
    .preview-chat b,
    .preview-deck i,
    .preview-arcade i,
    .preview-wall i,
    .preview-backroom i,
    .preview-backroom b,
    .preview-chat .typed,
    .volatile-inline:has(#volatile-toggle:checked) .vb-row,
    .volatile-inline:has(#volatile-toggle:checked) .volatile-buffer i:first-child {
        animation: none;
    }

    .preview-chat .typed { width: auto; }

    .preview-wall i { width: auto; border-right: 0; }
    .vs-knob { transition: none; }
}

/* ------------------------------------------------------------------ *
 * THE WIRE SERVICE
 *
 * Channel feeds were a URL box and a list of URLs, which hid the best thing
 * about them: a channel can be tapped into the news and talk about it as it
 * lands. So the settings are a rack, the wire one unit in it: the taps
 * themselves as wires with a light each — live, due, or waiting for their
 * first pull — then a story the way one will arrive and three plain lines of
 * what the feature does. Broadcast, the wire in reverse, is the next unit.
 * ------------------------------------------------------------------ */
.wire-room {
    width: 560px;
    max-width: 94vw;
    max-height: 90vh;
    overflow-y: auto;
    font-family: var(--font-mono);
}

.wire-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-glow);
}

.wire-label {
    margin: 18px 0 8px;
    font-size: 0.65rem;
    letter-spacing: 2px;
    color: var(--neon-accent);
}

/* ---- The rack --------------------------------------------------------- */
/* One unit per job, so what belongs together reads together. The faceplate is
   the unit's name, its real status and its main key; the body has the controls
   first and how it works last, quieter. Nothing here is only for show: a lamp
   is a tap, a number is a count. */
.rack-unit {
    border: 1px solid color-mix(in srgb, var(--chrome) 22%, transparent);
    border-radius: 4px;
    background: rgba(4, 7, 12, 0.55);
}

.rack-unit.is-live {
    border-color: color-mix(in srgb, var(--neon-pink) 60%, transparent);
    box-shadow: inset 0 0 18px color-mix(in srgb, var(--neon-pink) 8%, transparent);
}

/* Three devices from three makers in one rack. Each has its name printed
   or engraved into its face and its status in its own kind of display:
     - the wire service, black ribbed plastic printed in white, an LED per
       tap and an LCD with the count;
     - broadcast, brushed aluminium, engraved, the studio ON AIR sign let
       into it;
     - drop slots, satin graphite under a chrome trim, a chrome name, the
       count in a letterbox. */
.rack-plate {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    padding: 7px 7px;
    box-sizing: border-box;
    border-radius: 3px 3px 0 0;
}

.rack-plate > b { white-space: nowrap; }

/* A jack at each end of every plate, for the patch cords (js/rackcords.js):
   a socket in a chrome nut. Whichever a layout doesn't use stays empty. */
.rack-jack {
    flex: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: radial-gradient(circle, #000 0 2.4px, #34373e 2.9px, #dfe2e7 3.6px, #8b9098 4.8px, #2a2c31 5.4px, rgba(0, 0, 0, 0.5) 6px);
}

/* The cords hang over the rack, in its gaps and gutters only. */
.chan-grid { position: relative; }

.rack-cords {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    overflow: visible;
    pointer-events: none;
    filter: drop-shadow(1px 3px 2px rgba(0, 0, 0, 0.55));
}

/* A phone's rack has no gutter for them: no cords, and no jacks. */
@media (max-width: 599px) {
    .rack-jack,
    .rack-cords { display: none; }
    .rack-plate { padding-left: 14px; padding-right: 10px; }
}

.rack-window {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    margin-left: auto;
}

.rack-read { white-space: nowrap; }

/* ---- The wire service ---- */
.is-wire .rack-plate {
    background:
        repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 3px),
        radial-gradient(ellipse 60% 140% at 0% 0%, color-mix(in srgb, var(--hot) 7%, transparent), transparent 70%),
        linear-gradient(180deg, #1a1b1f, #111215);
    box-shadow:
        inset 0 1px 0 color-mix(in srgb, var(--hot) 18%, rgba(255, 255, 255, 0.08)),
        inset 0 -1px 0 color-mix(in srgb, var(--chrome) 16%, rgba(0, 0, 0, 0.6));
}

/* Printed white, with the maker's cyan bar. */
.is-wire .rack-plate > b {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #eef0f3;
    font: 800 0.62rem/1 var(--font-sans);
    letter-spacing: 3px;
}

.is-wire .rack-plate > b::before {
    content: "";
    width: 3px;
    height: 15px;
    background: var(--chrome);
}

.is-wire .rack-window {
    gap: 7px;
    padding: 3px 3px 3px 8px;
    border-radius: 2px;
    background: #050506;
    box-shadow: inset 0 1px 2px #000, 0 0 0 1px #000, 0 1px 0 1px rgba(255, 255, 255, 0.07);
}

.rack-lamps {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 3px;
    min-width: 0;
}

.rack-lamps:empty { display: none; }

.rack-lamps i {
    width: 5px;
    height: 9px;
    border-radius: 1px;
}

.rack-lamps .tap-live { background: var(--neon-green); box-shadow: 0 0 6px var(--neon-green); }
.rack-lamps .tap-idle { background: var(--amber); box-shadow: 0 0 5px var(--amber); }
.rack-lamps .tap-pending { background: #1c2522; }

/* A reflective LCD: dark figures, each casting its faint shadow on the
   grey-green behind it. */
.is-wire .rack-read {
    padding: 5px 8px;
    border-radius: 1px;
    background: linear-gradient(180deg, #8d9c7a, #a3b28e 30%, #98a785);
    color: #17210f;
    font: 700 0.58rem/1 var(--font-mono);
    letter-spacing: 1px;
    text-shadow: 1px 1px 0 rgba(23, 33, 15, 0.18);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.55);
}

.is-wire .rack-read.is-idle {
    color: rgba(23, 33, 15, 0.3);
    text-shadow: none;
}

/* ---- Broadcast ---- */
.bcast .rack-plate {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.25), transparent 22%, transparent 78%, rgba(0, 0, 0, 0.22)),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.06) 0 1px, rgba(0, 0, 0, 0.04) 1px 2px, transparent 2px 3px),
        linear-gradient(100deg, #9da4ae, #b9bfc7 40%, #939aa5 75%, #aab1ba);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), inset 0 -1px 0 rgba(0, 0, 0, 0.35);
}

/* Engraved: the cut filled dark, the aluminium catching light under it. */
.bcast .rack-plate > b {
    color: #1c2027;
    font: 800 0.64rem/1 var(--font-sans);
    letter-spacing: 3px;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
}

/* The studio sign in a black bezel: red glass, lit while the channel is on
   air, dark with the letters just showing when it is not. */
.air-sign {
    margin-left: auto;
    padding: 5px 10px;
    border-radius: 2px;
    background: radial-gradient(ellipse at 50% 60%, #ff4d6d, #b3102f 70%, #6a0a1d);
    color: #fff4f6;
    font: 800 0.6rem/1 var(--font-sans);
    letter-spacing: 2.5px;
    white-space: nowrap;
    text-shadow: 0 0 4px #fff, 0 0 10px var(--hot);
    box-shadow:
        0 0 0 2px #1a1c20,
        0 1px 0 2px rgba(255, 255, 255, 0.55),
        0 0 16px color-mix(in srgb, var(--hot) 60%, transparent),
        inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.air-sign.is-dark {
    background: linear-gradient(180deg, #2a0d15, #1a080d);
    color: #5a2a36;
    text-shadow: none;
    box-shadow:
        0 0 0 2px #1a1c20,
        0 1px 0 2px rgba(255, 255, 255, 0.55),
        inset 0 1px 2px rgba(0, 0, 0, 0.8);
}

/* ---- Drop slots ---- */
.is-drop .rack-plate {
    background:
        linear-gradient(180deg, #eef0f3, #8d939c) 0 0 / 100% 2px no-repeat,
        linear-gradient(180deg, #34373e, #24262b 50%, #1b1c20);
    box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.4);
}

/* Chrome lettering, the room's cyan just catching it. */
.is-drop .rack-plate > b {
    background: linear-gradient(180deg, #fff 0%, #f1f3f6 38%, #9aa1ab 52%, #dfe3e8 70%, #fff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font: 900 0.7rem/1 var(--font-sans);
    letter-spacing: 3px;
    filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.85)) drop-shadow(0 0 6px color-mix(in srgb, var(--chrome) 25%, transparent));
}

/* The letterbox: a chrome-ringed slot, the count lit in cyan inside it. */
.is-drop .rack-window {
    padding: 6px 16px;
    border-radius: 999px;
    background: #020203;
    box-shadow:
        inset 0 2px 4px #000,
        0 0 0 1px #0b0c0e,
        0 0 0 2px #a4aab2,
        0 0 0 3px #2a2c31,
        0 2px 3px 3px rgba(0, 0, 0, 0.35);
}

.is-drop .rack-read {
    color: var(--chrome);
    font: 700 0.56rem/1 var(--font-mono);
    letter-spacing: 1.5px;
    text-shadow: 0 0 5px color-mix(in srgb, var(--chrome) 70%, transparent);
}

.is-drop .rack-read.is-idle {
    color: color-mix(in srgb, var(--chrome) 38%, transparent);
    text-shadow: none;
}

.rack-body { padding: 12px; }

/* Under the taps it acts on, with how the last pull went beside it. */
.wire-pull {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 10px;
}

.wire-pull .wire-status { flex: 1; min-width: 0; }

.rack-unit .wire-new {
    margin-top: 12px;
    padding: 12px 0 0;
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    background: none;
}

.rack-unit .wire-new .wire-label { margin-top: 0; }

/* How it works, under the controls. */
.rack-notes {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

/* The note's sample: a story, as one lands. */
.wire-slip {
    display: flex;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 3px;
    background: var(--bg-main);
    font-family: var(--font-sans);
}

.wire-slip + .wire-copy { margin-top: 12px; }
.wire-slip-words { min-width: 0; }
.wire-slip .dispatch-source { font-size: 0.85rem; cursor: default; }
.wire-slip .dispatch { margin-top: 2px; font-size: 0.82rem; }
.wire-slip .dispatch-plate { cursor: default; }

@keyframes tt-blink {
    0%, 60% { opacity: 1; }
    61%, 100% { opacity: 0.35; }
}

.wire-copy {
    font-family: var(--font-sans);
    font-size: 0.72rem;
    line-height: 1.5;
    color: var(--text-primary);
}

.wire-copy p {
    margin: 0 0 8px;
}

.wire-copy ul {
    margin: 0;
    padding-left: 14px;
    color: var(--text-secondary);
}

.wire-copy li {
    margin-bottom: 4px;
}

.wire-copy b {
    color: var(--text-primary);
}

/* ---- The taps -------------------------------------------------------- */
.wire-taps {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 210px;
    overflow-y: auto;
}

.wire-empty {
    font-size: 0.6rem;
    line-height: 1.5;
    color: var(--text-secondary);
    opacity: 0.75;
}

.wire-tap {
    --tap-ink: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid color-mix(in srgb, var(--tap-ink) 25%, transparent);
    border-left: 2px solid var(--tap-ink);
    background: color-mix(in srgb, var(--tap-ink) 4%, rgba(0, 0, 0, 0.35));
}

.tap-live { --tap-ink: var(--neon-green); }
.tap-idle { --tap-ink: var(--amber); }
.tap-pending { --tap-ink: var(--text-secondary); }

/* The light on each wire. Live ones pulse with traffic. */
.tap-light {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--tap-ink);
    box-shadow: 0 0 8px var(--tap-ink);
}

.tap-live .tap-light {
    animation: tap-pulse 1.6s ease-in-out infinite;
}

@keyframes tap-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

.tap-body {
    flex: 1;
    min-width: 0;
}

.tap-host {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tap-path {
    font-size: 0.55rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tap-state {
    margin-top: 3px;
    font-size: 0.5rem;
    letter-spacing: 1px;
    color: var(--tap-ink);
}

.tap-sever {
    padding: 2px 8px !important;
    font-size: 0.55rem !important;
}

/* ---- Tapping a new one ------------------------------------------------ */
.wire-new {
    margin-top: 16px;
    padding: 12px;
    border: 1px dashed color-mix(in srgb, var(--neon-accent) 35%, transparent);
    background: color-mix(in srgb, var(--neon-accent) 3%, transparent);
}

.wire-input-row {
    display: flex;
    gap: 8px;
}

.wire-plug {
    color: var(--neon-accent);
    font-size: 1rem;
    text-shadow: 0 0 8px var(--neon-accent);
}

/* The base input carries a bottom margin for stacked forms; in a row it
   pushed the field's middle up off the plug's and the button's. The field and
   the button share a height, and the plug sits on their midline. */
.wire-input-row {
    align-items: stretch;
}

/* Specific enough to beat .auth-card input[type="text"].neon-input, which is
   where the stray bottom margin actually comes from. */
.wire-room .wire-input-row input[type="text"].neon-input {
    flex: 1;
    min-width: 0;
    height: 38px;
    margin: 0;
    box-sizing: border-box;
    border-radius: 3px;
    border-color: color-mix(in srgb, var(--neon-cyan) 28%, transparent) !important;
    background:
        repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 3px),
        #03060a !important;
    box-shadow: inset 0 2px 7px rgba(0, 0, 0, 0.75);
}

.wire-room .wire-input-row input[type="text"].neon-input:focus {
    border-color: var(--neon-cyan) !important;
    box-shadow: inset 0 2px 7px rgba(0, 0, 0, 0.75), 0 0 10px color-mix(in srgb, var(--neon-cyan) 40%, transparent);
}

.plate-key.wire-tap-key {
    height: 38px;
    padding: 0 18px;
    font-size: 0.72rem;
    letter-spacing: 3px;
}

.plate-key.wire-tap-key:active { height: 36px; }

.wire-plug {
    align-self: center;
}

.wire-samples {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    font-size: 0.5rem;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

/* The samples are keycaps: press one and its address drops into the field. */
.wire-sample {
    height: 22px;
    padding: 0 7px;
    box-sizing: border-box;
    border: 1px solid color-mix(in srgb, var(--chrome) 45%, transparent);
    border-bottom-width: 3px;
    border-radius: 3px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.5rem;
    letter-spacing: 1px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

@media (hover: hover) {
    .wire-sample:hover {
        border-color: var(--neon-cyan);
        color: var(--neon-cyan);
    }
}

.wire-sample:active {
    border-bottom-width: 1px;
    margin-top: 2px;
    height: 20px;
}

.wire-status {
    font-size: 0.55rem;
    letter-spacing: 1px;
    line-height: 1.5;
    color: var(--text-secondary);
}

.wire-status.pulling { color: var(--amber); animation: tt-blink 0.8s steps(1) infinite; }
.wire-status.done { color: var(--neon-green); }
.wire-status.partial { color: var(--amber); }
.wire-status.failed { color: var(--hot); }


/* ---- The drop slots --------------------------------------------------- */
.drop-warn {
    margin: 0 0 10px;
    color: var(--neon-pink);
    font: 0.72rem/1.5 var(--font-sans);
}

/* The address, once: a green screen, because this is the one to take away. */
.drop-fresh {
    margin-bottom: 12px;
    padding: 12px;
    border: 1px solid color-mix(in srgb, var(--neon-green) 55%, transparent);
    border-radius: 4px;
    background: color-mix(in srgb, var(--neon-green) 5%, rgba(0, 0, 0, 0.4));
}

.drop-fresh-head {
    color: var(--neon-green);
    font-size: 0.65rem;
    font-weight: bold;
    letter-spacing: 1px;
    line-height: 1.5;
}

.drop-example-label {
    margin-top: 4px;
    color: var(--text-secondary);
    font-size: 0.55rem;
    letter-spacing: 2px;
}

.drop-example {
    margin: 4px 0 8px;
    padding: 8px 10px;
    border-radius: 3px;
    background: #030805;
    color: #9dffc6;
    font: 0.68rem/1.5 var(--font-mono);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.drop-fresh-more {
    margin: 8px 0 0;
    color: var(--text-secondary);
    font-size: 0.68rem;
}

.drop-fresh-more b { color: var(--text-primary); }

.drop-row { flex-wrap: wrap; }
/* Room for the name: where there isn't, the keys go under it rather than
   squeezing it down to a letter or two. */
.drop-row .tap-body { flex: 1 1 140px; }
/* A steady lamp: a slot has no traffic to pulse with between drops. */
.drop-row .tap-light { animation: none; }

.drop-keys {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

#drop-status { margin-top: 8px; }
#drop-status:empty { display: none; }

/* CHANNEL_CONTROL: the head stays put with CLOSE in it, and the units scroll
   together under it, with one scrollbar whatever the width. Three across
   where they fit; two where they don't, the drop slots full width underneath
   (wire and broadcast stand about the same height); one on a phone. */
.wire-room.channel-control {
    display: flex;
    flex-direction: column;
    max-height: min(860px, calc(100dvh - 48px));
    overflow: hidden;
}

.channel-control .wire-top { flex: none; }

.chan-grid {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 16px;
    margin-top: 16px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--chrome) 35%, transparent) transparent;
}

/* Room between the units and the scrollbar, kept whether it shows or not. A
   phone's scrollbar floats and goes, and it can't spare the width. */
@media (min-width: 600px) {
    .chan-grid {
        padding-right: 12px;
        scrollbar-gutter: stable;
    }
}

/* One column: a gutter down each side too, for the patch cords. */
@media (min-width: 600px) and (max-width: 899px) {
    .chan-grid { padding-left: 12px; }
}

@media (min-width: 900px) {
    .wire-room.channel-control {
        width: min(1000px, calc(100vw - 48px));
        max-width: none;
    }
    .chan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .rack-unit.is-drop { grid-column: 1 / -1; }
    .rack-unit.is-drop .rack-body {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: start;
        gap: 24px;
    }
    .rack-unit.is-drop .rack-notes {
        margin-top: 0;
        padding-top: 0;
        border-top: 0;
    }
}

@media (min-width: 1280px) {
    .wire-room.channel-control { width: min(1240px, calc(100vw - 48px)); }
    .chan-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .rack-unit.is-drop { grid-column: auto; }
    .rack-unit.is-drop .rack-body { display: block; }
    .rack-unit.is-drop .rack-notes {
        margin-top: 14px;
        padding-top: 12px;
        border-top: 1px solid rgba(255, 255, 255, 0.07);
    }
}

@media (prefers-reduced-motion: reduce) {
    .tap-live .tap-light,
    .wire-status.pulling {
        animation: none;
    }
}

/* ------------------------------------------------------------------ *
 * THE ROSTER
 *
 * Presence moved from a dot column onto the avatar: a green ring, breathing
 * slowly, for someone who is here; a dimmed picture for someone who is not.
 * The dots cost every row its own column and pushed every name right.
 * ------------------------------------------------------------------ */
/* Member rows borrow .channel-item for its hover and spacing, but not the
   caret it draws for the open channel — sixteen invisible pixels on every
   member — or its left border. */
#member-list .member-row {
    gap: 9px;
    padding: 5px 6px !important;
    border-left: 0;
}

#member-list .member-row::before {
    content: none;
    display: none;
}

/* The ring is a real border on whole pixels, not stacked box-shadow spreads.
 * It was a 2.5px spread, and half a pixel cannot land on a 1x screen: the
 * browser smears it differently round the curve, and at 100% on a non-retina
 * display the circle looked lopsided. A 2px border, a 1px gap, and a glow that
 * only ever blurs — never spreads — draws the same everywhere.
 *
 * Every member gets the border, transparent when away, so the row does not
 * shift when somebody arrives. */
.member-avatar {
    position: relative;
    flex-shrink: 0;
    box-sizing: border-box;
    width: 30px;
    height: 30px;
    padding: 1px;
    border: 2px solid transparent;
    border-radius: 50%;
}

.member-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* Here: the ring, and a slow glow that breathes.
 *
 * The breath is a brighter halo on its own layer, faded in and out. It used
 * to animate the ring's box-shadow, which cannot be handed to the compositor:
 * every online member kept the whole page repainting sixty times a second,
 * and a quiet channel cost Safari a third of a core. Opacity can be. */
.is-online .member-avatar {
    border-color: var(--neon-green);
    box-shadow: 0 0 5px color-mix(in srgb, var(--neon-green) 40%, transparent);
}

.is-online .member-avatar::after {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    box-shadow: 0 0 12px color-mix(in srgb, var(--neon-green) 70%, transparent);
    opacity: 0;
    pointer-events: none;
    /* Breathes in the ambient burst. */
}

@keyframes member-here {
    50% { opacity: 1; }
}

/* Away: no ring, and the picture and the name both stepped back. */
.is-offline .member-avatar img {
    filter: grayscale(0.7);
    opacity: 0.55;
}

.is-offline .member-text {
    opacity: 0.65;
}

.member-text {
    flex: 1;
    min-width: 0;
}

.member-name {
    font-size: 0.8rem;
    font-weight: bold;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.is-online .member-name {
    text-shadow: 0 0 5px currentColor;
}

.member-meta {
    font-size: 0.55rem;
    color: var(--text-secondary);
    opacity: 0.8;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Text for screen readers only. */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

@media (prefers-reduced-motion: reduce) {
    .is-online .member-avatar { animation: none; }
}

/* ==========================================================================
   THE RAIL KEYS
   NEW and JOIN both act on sectors, so they share one bracket: two square
   keys set into the same plate. DMs goes somewhere else entirely, so it
   stands apart, in its own colour and shape: a speech bubble.

   Both are 51px wide because the rail's content box is 69px (70 less its
   border): an odd width centres on a whole pixel, an even one lands on a
   half pixel and blurs at 1x.
   ========================================================================== */

.rail-bay {
    position: relative;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: 51px;
    padding: 12px 4px 4px;
    box-sizing: border-box;
    border: 1px solid color-mix(in srgb, var(--chrome) 35%, transparent);
    border-radius: 3px;
    background:
        repeating-linear-gradient(135deg, transparent 0 3px, color-mix(in srgb, var(--chrome) 5%, transparent) 3px 4px),
        rgba(4, 7, 13, 0.85);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 2px 6px rgba(0, 0, 0, 0.5);
}

.rail-bay-tag {
    position: absolute;
    top: 2px;
    left: 0;
    right: 0;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 7px;
    line-height: 8px;
    letter-spacing: 1px;
    color: color-mix(in srgb, var(--chrome) 60%, transparent);
}

.bay-key {
    --key-ink: var(--neon-cyan);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    width: 100%;
    height: 40px;
    padding: 0;
    border: 1px solid var(--key-ink);
    border-bottom-width: 3px;
    border-radius: 2px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--key-ink) 16%, transparent), color-mix(in srgb, var(--key-ink) 4%, transparent));
    color: var(--key-ink);
    font-family: var(--font-mono);
    font-size: 0.6rem;
    letter-spacing: 1px;
    cursor: pointer;
    box-shadow: 0 0 6px color-mix(in srgb, var(--key-ink) 35%, transparent);
    transition: background 0.15s, box-shadow 0.15s, color 0.15s;
}

.bay-new { --key-ink: var(--neon-pink); }

.bay-glyph {
    font-size: 0.95rem;
    line-height: 1;
    font-weight: bold;
}

@media (hover: hover) {
    .bay-key:hover {
        background: var(--key-ink);
        color: var(--bg-main);
        box-shadow: 0 0 14px var(--key-ink);
    }
}

/* A key goes down when you press it: the thick bottom edge is its travel. */
.bay-key:active {
    border-bottom-width: 1px;
    margin-top: 2px;
    height: 38px;
}

.bay-key:focus-visible,
.rail-link:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.rail-link {
    --link-ink: var(--neon-purple);
    position: relative;
    flex-shrink: 0;
    margin-top: 16px;
    width: 51px;
    height: 40px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
}

.rail-link-bubble {
    position: absolute;
    inset: 0 0 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--link-ink);
    border-radius: 9px;
    background: color-mix(in srgb, var(--link-ink) 12%, rgba(4, 7, 13, 0.9));
    color: var(--link-ink);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 1px;
    box-shadow: 0 0 6px color-mix(in srgb, var(--link-ink) 45%, transparent);
    transition: background 0.15s, box-shadow 0.15s, color 0.15s;
}

/* The bubble's tail. */
.rail-link::after {
    content: "";
    position: absolute;
    left: 9px;
    bottom: 0;
    width: 9px;
    height: 8px;
    background: var(--link-ink);
    clip-path: polygon(0 0, 100% 0, 0 100%);
    filter: drop-shadow(0 0 3px var(--link-ink));
}

@media (hover: hover) {
    .rail-link:hover .rail-link-bubble {
        background: var(--link-ink);
        color: var(--bg-main);
        box-shadow: 0 0 14px var(--link-ink);
    }
}

.rail-link.active .rail-link-bubble {
    background: color-mix(in srgb, var(--link-ink) 32%, rgba(4, 7, 13, 0.9));
    border-color: #fff;
    color: #fff;
    box-shadow: 0 0 16px var(--link-ink);
}

/* Traffic waiting: the bubble breathes, same pace as before. */
/* Stepped rather than smooth: box-shadow cannot be handed to the compositor,
   so a smooth breath repaints the whole page every frame. Ten steps a
   half-breath reads the same and redraws a fraction as often. */
.rail-link.has-unread-dm .rail-link-bubble {
    animation: link-breathe 2.4s steps(10) infinite;
}

@keyframes link-breathe {
    0%, 100% { box-shadow: 0 0 5px var(--link-ink); }
    50% { box-shadow: 0 0 16px var(--link-ink), 0 0 28px color-mix(in srgb, var(--hot) 45%, transparent); }
}

@media (prefers-reduced-motion: reduce) {
    .rail-link.has-unread-dm .rail-link-bubble {
        animation: none;
        box-shadow: 0 0 16px var(--link-ink), 0 0 28px color-mix(in srgb, var(--hot) 45%, transparent);
    }
}

/* ==========================================================================
   NEW AND JOIN: the panels behind the keys
   NEW is a charter, pink like its key: the sector drawn as it will exist,
   redrawn as you type. JOIN is a phone line, cyan like its key: you dial a
   handle, it rings, and a carrier answers or it doesn't.
   ========================================================================== */

.sector-panel {
    --panel-ink: var(--neon-cyan);
    width: 400px;
    max-width: 94vw;
    border-color: var(--panel-ink);
}

.panel-new { --panel-ink: var(--neon-pink); }

.sector-panel .terminal-label { color: var(--panel-ink); }
.sector-panel .forge-hash { color: var(--panel-ink); }

.panel-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

/* ---- NEW: the charter ---- */

.charter-name-field {
    margin: 8px 0 0 !important;
}

.charter {
    position: relative;
    display: flex;
    gap: 14px;
    align-items: center;
    margin-top: 6px;
    padding: 14px;
    border: 1px dashed color-mix(in srgb, var(--panel-ink) 55%, transparent);
    background:
        repeating-linear-gradient(0deg, transparent 0 17px, color-mix(in srgb, var(--panel-ink) 7%, transparent) 17px 18px),
        rgba(4, 7, 13, 0.7);
    overflow: hidden;
}

/* The badge as it will sit in the rail. */
.charter-badge {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-weight: bold;
    color: var(--neon-cyan);
    background: var(--bg-surface);
    box-shadow: 0 0 16px var(--panel-ink);
}

.charter-body {
    min-width: 0;
    /* Clear of the stamp, so a long handle ellipses before it runs under. */
    padding-right: 58px;
    font-family: var(--font-mono);
}

.charter-handle {
    font-size: 1rem;
    font-weight: bold;
    color: var(--panel-ink);
    text-shadow: 0 0 8px color-mix(in srgb, var(--panel-ink) 60%, transparent);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.charter-name {
    margin-top: 2px;
    font-size: 0.7rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.charter-terms {
    margin-top: 7px;
    font-size: 0.5rem;
    line-height: 1.6;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

/* A rubber stamp, a little crooked, over the corner of the paper. */
.charter-stamp {
    position: absolute;
    right: 10px;
    top: 9px;
    padding: 2px 6px;
    border: 2px solid var(--amber);
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.55rem;
    font-weight: bold;
    letter-spacing: 2px;
    color: var(--amber);
    transform: rotate(8deg);
    opacity: 0.85;
    mix-blend-mode: screen;
}

.panel-new.is-unlisted .charter-stamp {
    border-color: var(--text-secondary);
    color: var(--text-secondary);
    border-style: dashed;
    transform: rotate(-6deg);
}

.charter-listing {
    margin-top: 12px;
    font-family: var(--font-mono);
}

.charter-listing .volatile-fine { margin-top: 5px; }

/* The volatile switch, in the directory's amber. */
.listing-switch .volatile-title { color: var(--amber); }
.listing-switch .vs-track { border-color: color-mix(in srgb, var(--amber) 35%, transparent); }
.listing-switch input:checked + .vs-track {
    border-color: var(--amber);
    background: color-mix(in srgb, var(--amber) 22%, #0b0c10);
}
.listing-switch input:checked + .vs-track .vs-knob {
    background: var(--amber);
    box-shadow: 0 0 8px var(--amber);
}
.listing-switch input:focus-visible + .vs-track { outline-color: var(--amber); }

.charter-listing .when-listed { color: var(--amber); }
.charter-listing .when-unlisted { display: none; }
.panel-new.is-unlisted .when-listed { display: none; }
.panel-new.is-unlisted .when-unlisted { display: inline; }

/* ---- JOIN: the line ---- */

.dial-log {
    margin-top: 10px;
    /* Tall enough for the longest call — dial, ring, NO CARRIER and a
       two-line reason that wraps once — so the panel never grows mid-call. */
    box-sizing: border-box;
    height: calc(6 * 1.7em + 22px);
    overflow-y: auto;
    padding: 8px 10px;
    border: 1px solid color-mix(in srgb, var(--panel-ink) 30%, transparent);
    background: rgba(0, 0, 0, 0.55);
    font-family: var(--font-mono);
    font-size: 0.62rem;
    line-height: 1.7;
    letter-spacing: 1px;
    color: var(--panel-ink);
    box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.8);
}

.dial-line.is-idle { opacity: 0.6; }
.dial-line.is-ok { color: var(--ok); text-shadow: 0 0 6px var(--ok); }
.dial-line.is-fail { color: var(--hot); }

.dial-caret {
    display: inline-block;
    width: 6px;
    height: 0.9em;
    margin-left: 3px;
    vertical-align: -1px;
    background: currentColor;
    animation: dial-caret 1s steps(1) infinite;
}

@keyframes dial-caret { 50% { opacity: 0; } }

/* The Black Pages, as a directory on the shelf rather than a stray button. */
.directory-tile {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin-top: 18px;
    padding: 10px 12px;
    border: 1px solid color-mix(in srgb, var(--amber) 45%, transparent);
    border-left-width: 4px;
    background: color-mix(in srgb, var(--amber) 6%, rgba(4, 7, 13, 0.8));
    font-family: var(--font-mono);
    text-align: left;
    color: var(--amber);
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
}

@media (hover: hover) {
    .directory-tile:hover {
        background: color-mix(in srgb, var(--amber) 14%, rgba(4, 7, 13, 0.8));
        box-shadow: 0 0 14px color-mix(in srgb, var(--amber) 35%, transparent);
    }
}

.directory-tile:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* A fat paperback: three page edges and a spine. */
.directory-book {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    width: 22px;
    height: 28px;
    padding: 0 3px 0 6px;
    border: 1px solid var(--amber);
    border-left-width: 4px;
    border-radius: 1px 3px 3px 1px;
    box-sizing: border-box;
}

.directory-book i {
    display: block;
    height: 1px;
    background: color-mix(in srgb, var(--amber) 60%, transparent);
}

.directory-copy {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.directory-ask {
    font-size: 0.5rem;
    letter-spacing: 2px;
    opacity: 0.7;
}

.directory-name {
    font-size: 0.8rem;
    font-weight: bold;
    letter-spacing: 1px;
}

.directory-line {
    font-size: 0.55rem;
    color: var(--text-secondary);
}

.directory-arrow { font-size: 1.1rem; }

@media (prefers-reduced-motion: reduce) {
    .dial-caret { animation: none; }
}

/* ==========================================================================
   SECTOR INFO AND SECTOR CONTROL
   INFO is the sector's registration: its badge in a bolted porthole, a
   readout of what's in it, and the sponsor's licence as a holographic
   sticker in the sponsor's own ink. SETTINGS is the control desk: livery,
   a roster of cards with a three-position clearance switch each, and
   DESTROY_SERVER under a flip cover you have to lift first.
   ========================================================================== */

.sector-card {
    width: 470px;
    max-width: 94vw;
    max-height: 90vh;
    overflow-y: auto;
}

/* LIVERY, as a ROM cartridge (app.js showServerSettingsModal): a charcoal
   shell with grip ridges across its top; a printed label on it with its
   band (SECTOR CARTRIDGE and a catalogue number), the sector's icon as its
   art, the name as its title and the description as its blurb (written in
   place, dashed where they can be), and its foot line; then on the shell's
   edge, the listing as a slide switch and SAVE DETAILS. */
.livery-cart {
    position: relative;
    padding: 0 12px 12px;
    border-radius: 12px 12px 4px 4px;
    background: linear-gradient(180deg, #35373d, #27282d 35%, #1d1e22);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), inset 0 -2px 0 rgba(0, 0, 0, 0.4), 0 0 0 1px #050506, 0 10px 24px rgba(0, 0, 0, 0.5);
}
.cart-grip {
    height: 20px;
    margin: 0 18px 4px;
    background: repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.5) 0 2px, rgba(255, 255, 255, 0.07) 2px 3px, transparent 3px 5px);
}
.cart-label {
    overflow: hidden;
    border-radius: 3px;
    background:
        radial-gradient(ellipse 70% 60% at 85% 20%, color-mix(in srgb, var(--chrome) 12%, transparent), transparent 70%),
        linear-gradient(180deg, #0c1734, #070d1e);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 1px 0 rgba(255, 255, 255, 0.06);
}
.cart-band {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding: 4px 10px 3px;
    background: var(--hot);
    box-shadow: 0 2px 0 var(--chrome);
    color: #fff;
}
.cart-band b { font: italic 900 0.66rem var(--font-sans); letter-spacing: 2px; }
.cart-band span { font: 700 0.55rem var(--font-mono); letter-spacing: 1px; opacity: 0.9; }
.cart-art { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; padding: 14px 12px 10px; }

/* The art window: the icon, square on the label rather than in a porthole. */
.livery-cart .livery-port { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 0; border: 0; background: none; cursor: pointer; }
.livery-cart .registry-port {
    width: 84px;
    height: 84px;
    margin: 0;
    border: 0;
    border-radius: 3px;
    background: #04070c;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), 0 2px 6px rgba(0, 0, 0, 0.5);
}
.livery-cart .registry-port::before { display: none; }
.livery-cart .sector-badge-img { border-radius: 3px; }
.livery-cart .livery-swap { padding: 1px 6px; font-size: 0.5rem; }
@media (hover: hover) {
    .livery-cart .livery-port:hover .registry-port { box-shadow: inset 0 0 0 1px var(--neon-cyan), 0 0 14px color-mix(in srgb, var(--neon-cyan) 50%, transparent); }
}

.cart-words { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.cart-title,
.cart-blurb {
    width: 100%;
    box-sizing: border-box;
    border: 0;
    background: transparent;
    color: #fff;
    outline: none;
}
.cart-title {
    padding: 2px 0 3px;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.22);
    font: italic 900 1.2rem/1.2 var(--font-sans);
    letter-spacing: 0.3px;
}
.cart-blurb {
    min-height: 66px;
    padding: 6px 7px;
    border: 1px dashed rgba(255, 255, 255, 0.16);
    border-radius: 2px;
    color: #c6cfdf;
    font: 0.76rem/1.45 var(--font-sans);
    resize: vertical;
}
.cart-title::placeholder,
.cart-blurb::placeholder { color: rgba(255, 255, 255, 0.3); }
.cart-title:focus { border-bottom: 1px solid var(--neon-accent); }
.cart-blurb:focus { border: 1px solid var(--neon-accent); }

.cart-foot {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 10px 7px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    color: rgba(255, 255, 255, 0.45);
    font: 700 0.52rem var(--font-mono);
    letter-spacing: 1px;
}
.cart-mega { margin-left: auto; color: var(--chrome); font: italic 900 0.6rem var(--font-sans); letter-spacing: 1px; }
.cart-std { padding: 0 5px; border-radius: 2px; background: #8b8e96; color: #17181c; font: italic 900 0.6rem var(--font-sans); letter-spacing: -0.3px; }
.cart-std sup { font-size: 0.45rem; }

/* The shell's edge: the listing switch, how the save went, and the key. */
.cart-edge { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.cart-switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.cart-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.cart-slot {
    position: relative;
    width: 34px;
    height: 14px;
    border-radius: 2px;
    background: #09090b;
    box-shadow: inset 0 1px 3px #000, 0 1px 0 rgba(255, 255, 255, 0.08);
}
.cart-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 10px;
    border-radius: 1px;
    background: linear-gradient(180deg, #9a9ea7, #5d6068);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
    transition: transform 0.15s, background 0.15s;
}
.cart-switch input:checked + .cart-slot .cart-slider { transform: translateX(16px); background: linear-gradient(180deg, #ffc44d, var(--amber)); box-shadow: 0 0 6px color-mix(in srgb, var(--amber) 60%, transparent); }
.cart-switch input:focus-visible + .cart-slot { outline: 2px solid #fff; outline-offset: 2px; }
.cart-switch-legend { display: flex; flex-direction: column; line-height: 1.15; }
.cart-switch-legend b { color: var(--text-secondary); font: 800 0.6rem var(--font-mono); letter-spacing: 2px; }
.cart-switch-legend small { color: var(--ink-faint); font: 700 0.46rem var(--font-mono); letter-spacing: 1px; }
.cart-switch input:checked ~ .cart-switch-legend b { color: var(--amber); }
.cart-edge .livery-status { margin-left: auto; }
.cart-save { flex: none; }
@media (prefers-reduced-motion: reduce) { .cart-slider { transition: none; } }

/* SECTOR_CONTROL: one column that scrolls as a whole, or, where there's
   room, two that fit the window and scroll each by itself: the sector's own
   things (livery, exfiltration, the danger zone) on the left, the roster
   the full height of the right. CLOSE stays in the head, always in reach.
   The roster's rows fold by the width of their column, not the window's. */
.sector-control { width: 640px; }
.control-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.control-head .terminal-label { margin: 0; }
.control-roster { container-type: inline-size; }
.control-roster .operator-list { max-height: none; overflow: visible; }

@media (min-width: 900px) {
    .sector-control {
        display: flex;
        flex-direction: column;
        width: min(1080px, calc(100vw - 48px));
        height: min(820px, calc(100dvh - 48px));
        max-height: none;
        overflow: hidden;
    }
    .control-head { flex: none; padding-bottom: 6px; }
    .control-grid {
        flex: 1;
        min-height: 0;
        display: grid;
        grid-template-columns: minmax(340px, 0.8fr) minmax(0, 1.2fr);
        gap: 28px;
    }
    .control-main,
    .control-roster {
        min-height: 0;
        overflow-y: auto;
        /* Room between what's in a column and its scrollbar, kept whether
           the bar is showing or not. */
        padding-right: 16px;
        scrollbar-gutter: stable;
        scrollbar-width: thin;
        scrollbar-color: color-mix(in srgb, var(--chrome) 35%, transparent) transparent;
    }
}

@container (max-width: 560px) {
    .control-roster .operator-card { flex-wrap: wrap; }
}

/* One column: the roster straight after the cartridge, as it always was,
   then exfiltration and the danger zone. */
@media (max-width: 899px) {
    .control-grid { display: flex; flex-direction: column; }
    .control-main { display: contents; }
    .control-roster { order: 2; }
    .control-main > :nth-child(n + 2) { order: 3; }
}

/* ---- The porthole ---- */

.registry-port {
    position: relative;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 96px;
    height: 96px;
    margin: 12px;
    border-radius: 50%;
    border: 2px solid var(--neon-accent);
    background: var(--bg-surface);
    box-shadow: 0 0 0 4px #05070c, 0 0 0 5px color-mix(in srgb, var(--chrome) 40%, transparent), 0 0 18px color-mix(in srgb, var(--neon-accent) 40%, transparent);
}

/* Twelve bolts around the rim. */
.registry-port::before {
    content: "";
    position: absolute;
    inset: -12px;
    border-radius: 50%;
    background: repeating-conic-gradient(from 13deg, #9aa7b8 0 4deg, transparent 4deg 30deg);
    -webkit-mask: radial-gradient(circle, transparent 55.5px, #000 56px 59px, transparent 59.5px);
    mask: radial-gradient(circle, transparent 55.5px, #000 56px 59px, transparent 59.5px);
    pointer-events: none;
}

.sector-badge-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.sector-badge-letters {
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: bold;
    color: var(--neon-accent);
}

/* ---- INFO ---- */

.registry-head {
    display: flex;
    gap: 20px;
    align-items: center;
    margin-top: 16px;
}

.registry-id { min-width: 0; }

.registry-name {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--neon-accent);
    text-shadow: 0 0 10px color-mix(in srgb, var(--neon-accent) 45%, transparent);
    overflow-wrap: anywhere;
}

.registry-handle {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    letter-spacing: 2px;
    color: var(--text-secondary);
}

.registry-desc {
    margin-top: 8px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    line-height: 1.5;
    white-space: pre-wrap;
    color: var(--text-primary);
}

.registry-readout {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 18px;
    font-family: var(--font-mono);
    font-size: 0.55rem;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

.registry-readout span {
    padding: 2px 6px;
    border: 1px solid color-mix(in srgb, var(--chrome) 22%, transparent);
    background: rgba(0, 0, 0, 0.3);
}

.registry-readout b { color: var(--text-primary); }
.registry-readout .registry-lit b { color: var(--ok); text-shadow: 0 0 6px var(--ok); }

/* ---- The licence sticker ---- */

.licence-sticker {
    /* Set per sponsor inline; amber when the sponsor has no ink on file. */
    --licence-ink: var(--amber);
    position: relative;
    display: flex;
    gap: 14px;
    align-items: stretch;
    margin-top: 16px;
    padding: 10px 12px;
    border: 1px solid var(--licence-ink);
    border-radius: 4px;
    background:
        linear-gradient(115deg,
            color-mix(in srgb, var(--licence-ink) 14%, transparent),
            color-mix(in srgb, var(--neon-purple) 10%, transparent) 45%,
            color-mix(in srgb, var(--neon-cyan) 10%, transparent) 70%,
            color-mix(in srgb, var(--licence-ink) 12%, transparent)),
        rgba(4, 7, 13, 0.85);
    box-shadow: 0 0 12px color-mix(in srgb, var(--licence-ink) 25%, transparent);
    overflow: hidden;
    font-family: var(--font-mono);
}

/* The hologram catching the light, now and then. */
.licence-sticker::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: -40%;
    width: 30%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.14), transparent);
    transform: skewX(-18deg);
    animation: licence-sheen 6s ease-in-out infinite;
    pointer-events: none;
}

/* left -40% → 130% of the sticker, as a transform: the sheen is 30% wide,
   so 170% of the sticker is 566.67% of itself. */
@keyframes licence-sheen {
    0%, 70% { transform: translateX(0) skewX(-18deg); }
    100% { transform: translateX(566.67%) skewX(-18deg); }
}

.licence-copy {
    flex: 1;
    min-width: 0;
}

.licence-kicker {
    font-size: 0.5rem;
    letter-spacing: 2px;
    color: var(--text-secondary);
}

.licence-name {
    margin-top: 3px;
    font-size: 0.85rem;
    font-weight: bold;
    letter-spacing: 1px;
    color: var(--licence-ink);
    text-shadow: 0 0 8px color-mix(in srgb, var(--licence-ink) 50%, transparent);
}

.licence-motto {
    margin-top: 2px;
    font-size: 0.55rem;
    color: var(--text-secondary);
}

.licence-code {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-end;
    flex-shrink: 0;
}

.licence-bars {
    display: block;
    width: 64px;
    height: 24px;
    background: repeating-linear-gradient(90deg,
        var(--licence-ink) 0 1px, transparent 1px 3px,
        var(--licence-ink) 3px 5px, transparent 5px 6px,
        var(--licence-ink) 6px 7px, transparent 7px 10px,
        var(--licence-ink) 10px 13px, transparent 13px 14px);
    opacity: 0.8;
}

.licence-serial {
    font-size: 0.45rem;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

/* ---- CONTROL: livery ---- */

.control-label {
    margin: 16px 0 8px;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 2px;
    color: var(--neon-cyan);
}

.livery {
    display: flex;
    gap: 18px;
    align-items: flex-start;
}

.livery-port {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
}

.livery-swap {
    font-family: var(--font-mono);
    font-size: 0.55rem;
    letter-spacing: 1px;
    padding: 2px 8px;
    border: 1px solid var(--neon-cyan);
    color: var(--neon-cyan);
}

@media (hover: hover) {
    .livery-port:hover .registry-port {
        box-shadow: 0 0 0 4px #05070c, 0 0 0 5px var(--neon-cyan), 0 0 26px var(--neon-cyan);
    }
    .livery-port:hover .livery-swap {
        background: var(--neon-cyan);
        color: var(--bg-main);
    }
}

.livery-port:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 4px;
}

.livery-status {
    font-family: var(--font-mono);
    font-size: 0.55rem;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

.livery-status.is-fail { color: var(--hot); }

/* ---- CONTROL: the roster ---- */

.operator-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-height: 260px;
    overflow-y: auto;
    padding-right: 4px;
}

.operator-card {
    --role-ink: var(--neon-cyan);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border: 1px solid color-mix(in srgb, var(--chrome) 14%, transparent);
    border-left: 3px solid var(--role-ink);
    background: rgba(0, 0, 0, 0.28);
    font-family: var(--font-mono);
}

.operator-card.role-editor { --role-ink: var(--ok); }
.operator-card.role-admin { --role-ink: var(--neon-pink); }

.operator-card.is-offline .member-avatar img {
    filter: grayscale(1);
    opacity: 0.55;
}

.operator-id {
    flex: 1;
    min-width: 0;
}

.operator-name {
    font-size: 0.8rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.operator-handle {
    font-size: 0.55rem;
    color: var(--text-secondary);
}

.operator-fixed {
    font-size: 0.55rem;
    letter-spacing: 2px;
    color: var(--role-ink);
}

/* Three positions, one lit. */
/* The roster's (?) key and the guide it opens: what each clearance can do,
   each tagged as its key is on the switch (app.js ROLE_GUIDE). */
.roster-head { position: relative; display: flex; align-items: center; gap: 8px; margin: 16px 0 8px; }
.roster-head .control-label { margin: 0; }
.role-help-key {
    flex: none;
    width: 18px;
    height: 18px;
    padding: 0;
    border: 1px solid color-mix(in srgb, var(--chrome) 55%, transparent);
    border-radius: 50%;
    background: color-mix(in srgb, var(--chrome) 10%, transparent);
    color: var(--chrome);
    font: 700 0.6rem/1 var(--font-mono);
    cursor: pointer;
}
.role-help-key[aria-expanded="true"],
.role-help-key:hover { background: var(--chrome); color: var(--bg-main); }
.role-help-key:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.role-help {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 5;
    width: min(460px, 100%);
    box-sizing: border-box;
    padding: 12px 14px 10px;
    border: 1px solid color-mix(in srgb, var(--chrome) 55%, transparent);
    border-radius: 3px;
    background: #05070c;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.7), 0 0 12px color-mix(in srgb, var(--chrome) 18%, transparent);
    font: 0.68rem/1.55 var(--font-sans);
    color: var(--text-secondary);
}
.role-help[hidden] { display: none; }
.role-help-row { --key-ink: var(--neon-cyan); display: grid; grid-template-columns: 52px 1fr; gap: 10px; align-items: start; padding: 6px 0; }
.role-help-row + .role-help-row { border-top: 1px dotted rgba(255, 255, 255, 0.08); }
.role-help-row.key-editor { --key-ink: var(--ok); }
.role-help-row.key-admin { --key-ink: var(--neon-pink); }
.role-help-tag {
    justify-self: start;
    padding: 3px 7px;
    border-radius: 2px;
    background: color-mix(in srgb, var(--key-ink) 18%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--key-ink) 55%, transparent);
    color: var(--key-ink);
    font: 0.55rem var(--font-mono);
    letter-spacing: 1px;
}
.role-help-row b { color: var(--text-primary); }
.role-help-note { margin: 6px 0 0; padding-top: 8px; border-top: 1px solid rgba(255, 255, 255, 0.08); font-size: 0.62rem; color: var(--ink-faint); }

.clearance {
    display: inline-flex;
    flex-shrink: 0;
    border: 1px solid color-mix(in srgb, var(--chrome) 30%, transparent);
    border-radius: 3px;
    background: #05070c;
    padding: 2px;
    gap: 2px;
}

.clearance-key {
    --key-ink: var(--neon-cyan);
    position: relative;
    cursor: pointer;
}

.clearance-key.key-editor { --key-ink: var(--ok); }
/* A clearance the sector doesn't know: no position lit, and the switch says
   it wants setting. */
.clearance.is-unknown { border-style: dashed; border-color: color-mix(in srgb, var(--amber) 70%, transparent); }
.clearance-key.key-admin { --key-ink: var(--neon-pink); }

.clearance-key input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.clearance-key span {
    display: block;
    padding: 3px 7px;
    border-radius: 2px;
    font-size: 0.55rem;
    letter-spacing: 1px;
    color: color-mix(in srgb, var(--key-ink) 55%, var(--text-secondary));
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

@media (hover: hover) {
    .clearance-key:hover span { color: var(--key-ink); }
}

.clearance-key input:checked + span {
    background: var(--key-ink);
    color: var(--bg-main);
    font-weight: bold;
    box-shadow: 0 0 8px var(--key-ink);
}

.clearance-key input:focus-visible + span {
    outline: 1px solid #fff;
    outline-offset: 1px;
}

.operator-sanctions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.sanction {
    --sanction-ink: var(--amber);
    padding: 3px 6px;
    border: 1px solid var(--sanction-ink);
    border-radius: 2px;
    background: transparent;
    color: var(--sanction-ink);
    font-family: var(--font-mono);
    font-size: 0.55rem;
    letter-spacing: 1px;
    cursor: pointer;
}

.sanction.ban-btn { --sanction-ink: var(--hot); }

@media (hover: hover) {
    .sanction:hover {
        background: var(--sanction-ink);
        color: var(--bg-main);
        box-shadow: 0 0 10px var(--sanction-ink);
    }
}

.sanction:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 1px;
}

.panel-actions-end { justify-content: flex-end; }

/* A clearance change in flight. */
.operator-card.is-pending { opacity: 0.6; }

/* ---- The danger zone ---- */

.danger-zone {
    margin-top: 18px;
    padding: 12px;
    border: 1px solid color-mix(in srgb, var(--hot) 45%, transparent);
    border-top: 0;
    background: color-mix(in srgb, var(--hot) 4%, rgba(4, 7, 13, 0.6));
    position: relative;
}

/* Hazard tape along the top edge. */
.danger-zone::before {
    content: "";
    position: absolute;
    left: -1px;
    right: -1px;
    top: 0;
    height: 5px;
    background: repeating-linear-gradient(-45deg, var(--amber) 0 6px, #111 6px 12px);
}

.danger-label {
    margin: 4px 0 10px;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 2px;
    color: var(--hot);
}

/* One row per action: what it does on the left, the guarded switch on
   the right. */
.danger-units {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.danger-unit {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 12px;
    border: 1px solid color-mix(in srgb, var(--chrome) 14%, transparent);
    background: rgba(0, 0, 0, 0.3);
    font-family: var(--font-mono);
}

.danger-title {
    font-size: 0.75rem;
    font-weight: bold;
    letter-spacing: 2px;
    color: var(--hot);
}

.danger-copy {
    flex: 1;
    min-width: 0;
}

.danger-line {
    margin-top: 3px;
    font-size: 0.55rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

/* The well: hazard stripes, the switch sunk in it, and a tinted guard
   hinged along its top edge. Lifted, it swings up toward you and stands
   over the well, so it needs a few pixels above and nothing beside. */
.arming-well {
    position: relative;
    flex-shrink: 0;
    width: 108px;
    height: 44px;
    margin-top: 10px;
    padding: 5px;
    box-sizing: border-box;
    border-radius: 3px;
    background: repeating-linear-gradient(-45deg, var(--amber) 0 6px, #111 6px 12px);
    box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.8);
    perspective: 400px;
}

/* The switch: a slot and a lever that throws left to right. */
.kill-switch {
    display: block;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.kill-switch input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.kill-switch input:disabled { cursor: default; }

.ks-slot {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 3px;
    border: 1px solid #333;
    background: #0b0c10;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.9);
    transition: background 0.2s, border-color 0.2s;
}

.ks-lever {
    position: absolute;
    top: 3px;
    bottom: 3px;
    left: 3px;
    width: 34px;
    border-radius: 2px;
    background: linear-gradient(180deg, #c3ccd8, #6b7684);
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    transition: left 0.18s cubic-bezier(.3, 1.4, .5, 1), background 0.2s, box-shadow 0.2s;
}

/* Grip lines on the lever. */
.ks-lever::after {
    content: "";
    position: absolute;
    inset: 6px 12px;
    background: repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.35) 0 1px, transparent 1px 3px);
}

.arming-well.is-armed .ks-slot {
    border-color: var(--hot);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.9), 0 0 10px color-mix(in srgb, var(--hot) 60%, transparent);
}

.kill-switch input:checked + .ks-slot {
    background: color-mix(in srgb, var(--hot) 35%, #0b0c10);
}

.kill-switch input:checked + .ks-slot .ks-lever {
    left: calc(100% - 37px);
    background: linear-gradient(180deg, #ff8fae, var(--hot));
    box-shadow: 0 0 12px var(--hot);
}

.kill-switch input:focus-visible + .ks-slot {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

.arming-guard {
    position: absolute;
    inset: 0;
    padding: 0;
    border: 1px solid color-mix(in srgb, var(--hot) 70%, transparent);
    border-radius: 3px;
    background:
        linear-gradient(160deg, rgba(255, 255, 255, 0.22), transparent 40%),
        color-mix(in srgb, var(--hot) 22%, transparent);
    backdrop-filter: blur(1.5px);
    -webkit-backdrop-filter: blur(1.5px);
    cursor: pointer;
    transform-origin: center top;
    transition: transform 0.4s cubic-bezier(.3, 1.3, .5, 1);
}

.arming-guard:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.cover-tape {
    display: inline-block;
    padding: 1px 5px;
    background: var(--amber);
    color: #111;
    font-family: var(--font-mono);
    font-size: 0.5rem;
    font-weight: bold;
    letter-spacing: 1px;
    transform: rotate(-4deg);
    transition: opacity 0.2s;
}

/* Lifted: just past upright, leaning back toward you. */
.arming-well.is-armed .arming-guard {
    transform: rotateX(105deg);
}

.arming-well.is-armed .cover-tape { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
    .licence-sticker::after { animation: none; }
    .arming-guard,
    .ks-lever { transition: none; }
}

@media (max-width: 560px) {
    .operator-card { flex-wrap: wrap; }
    .livery { flex-direction: column; align-items: center; }
}

/* ==========================================================================
   SYSTEM_INFO: the rig
   A rack unit: a brushed-aluminium faceplate with rack ears, engraved
   lettering, a vent with a fan behind it,
   a little CRT with a degauss button, status lights, a scope trace, live
   readouts, the rig modules as rack slots, and the changelog as a timeline
   whose older entries fade like a signal losing strength.
   ========================================================================== */

.sysinfo {
    position: relative;
    width: 660px;
    max-width: 94vw;
    max-height: 88vh;
    overflow-y: auto;
    animation: rig-power-on 0.45s cubic-bezier(.2, .8, .3, 1) both;
}

/* The tube warming up: a bright line that opens into a picture. */
@keyframes rig-power-on {
    0% { transform: scale(1, 0.004); filter: brightness(4); opacity: 0.6; }
    45% { transform: scale(1, 0.004); filter: brightness(4); opacity: 1; }
    100% { transform: scale(1, 1); filter: brightness(1); }
}

/* ---- Faceplate ---- */

.rig-face {
    --alu-ink: #2b3039;
    display: flex;
    align-items: stretch;
    margin: -4px -4px 0;
    border-radius: 4px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 18%, transparent 82%, rgba(0, 0, 0, 0.2)),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.06) 0 1px, rgba(0, 0, 0, 0.04) 1px 2px, transparent 2px 3px),
        linear-gradient(100deg, #9da4ae, #b9bfc7 40%, #939aa5 75%, #aab1ba);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.7),
        inset 0 -1px 0 rgba(0, 0, 0, 0.35),
        0 4px 14px rgba(0, 0, 0, 0.6);
}

.rack-ear {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    width: 22px;
    padding: 12px 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.06), rgba(0, 0, 0, 0.14));
}

.ear-left { box-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.25), inset -2px 0 0 rgba(255, 255, 255, 0.35); }
.ear-right { box-shadow: inset 1px 0 0 rgba(0, 0, 0, 0.25), inset 2px 0 0 rgba(255, 255, 255, 0.35); }

/* Slotted rack holes, punched through to the dark behind. */
.rack-ear i {
    display: block;
    width: 8px;
    height: 13px;
    border-radius: 4px;
    background: #05070a;
    box-shadow: inset 0 2px 2px rgba(0, 0, 0, 0.9), 0 1px 0 rgba(255, 255, 255, 0.55);
}

.rig-face-body {
    flex: 1;
    min-width: 0;
    display: flex;
    gap: 18px;
    align-items: center;
    padding: 16px;
}

.rig-crt-wrap {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.rig-crt {
    position: relative;
    width: 92px;
    height: 76px;
    padding: 6px;
    border-radius: 12px;
    background: #07090d;
    box-shadow: inset 0 0 0 2px #2d3441, inset 0 0 14px rgba(0, 0, 0, 0.9), 0 0 0 3px #11141b;
    overflow: hidden;
}

.rig-crt img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 18px / 24px;
    filter: saturate(1.2) contrast(1.05);
    animation: crt-flicker 5s steps(1) infinite;
}

/* Curved glass: scanlines and a highlight across the bulge. */
.rig-crt::after {
    content: "";
    position: absolute;
    inset: 6px;
    border-radius: 18px / 24px;
    background:
        radial-gradient(ellipse at 30% 20%, rgba(255, 255, 255, 0.22), transparent 45%),
        repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.28) 0 1px, transparent 1px 3px);
    box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.8);
    pointer-events: none;
}

@keyframes crt-flicker {
    0%, 96%, 100% { opacity: 1; }
    97% { opacity: 0.75; }
    98% { opacity: 0.95; }
}

.degauss-btn {
    padding: 2px 7px;
    border: 1px solid #3a4250;
    border-radius: 2px;
    background: linear-gradient(180deg, #2a303b, #171b22);
    color: #9aa7b8;
    font-family: var(--font-mono);
    font-size: 0.45rem;
    letter-spacing: 1px;
    cursor: pointer;
    box-shadow: 0 2px 0 #05070a;
}

.degauss-btn:active {
    transform: translateY(2px);
    box-shadow: none;
}

@media (hover: hover) {
    .degauss-btn:hover { color: #fff; border-color: var(--neon-cyan); }
}

.degauss-btn:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Once the tube has warmed up it stays on. Without this, removing the
   degauss class put the power-on animation back and it played again. */
.sysinfo.is-on { animation: none; }

/* Degauss: the whole picture wobbles through the rainbow and settles. */
.sysinfo.is-degaussing {
    animation: degauss 1.1s ease-out;
}

@keyframes degauss {
    0% { filter: hue-rotate(0deg); transform: none; }
    10% { filter: hue-rotate(120deg) saturate(2.5); transform: skewX(3deg) scale(1.01); }
    25% { filter: hue-rotate(240deg) saturate(2); transform: skewX(-2.5deg); }
    45% { filter: hue-rotate(330deg) saturate(1.6); transform: skewX(1.5deg); }
    65% { filter: hue-rotate(40deg); transform: skewX(-0.8deg); }
    85% { filter: hue-rotate(10deg); transform: skewX(0.3deg); }
    100% { filter: none; transform: none; }
}

.rig-ident {
    flex: 1;
    min-width: 0;
}

/* Engraved into the plate: dark-filled lettering with a bright lip below
   each stroke, where the cut catches the light. */
.rig-etch {
    color: var(--alu-ink);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55), 0 -1px 0 rgba(0, 0, 0, 0.2);
    font-family: var(--font-mono);
}

.rig-etch-name {
    font-family: var(--font-sans);
    font-size: 1.6rem;
    font-weight: 600;
    line-height: 1.05;
    letter-spacing: -0.5px;
}

.rig-etch-maker {
    margin-top: 2px;
    font-size: 0.55rem;
    letter-spacing: 0.5px;
}

.rig-etch-spec {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    margin-top: 7px;
    padding-top: 5px;
    /* An engraved rule: a dark cut with a bright lip. */
    border-top: 1px solid rgba(0, 0, 0, 0.35);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
    font-size: 0.5rem;
    font-weight: bold;
    letter-spacing: 1px;
}

/* ---- The vent, and the fan behind it ---- */

.rig-vent {
    position: relative;
    flex-shrink: 0;
    width: 96px;
    height: 84px;
    border-radius: 4px;
    background: #07090c;
    overflow: hidden;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.9), 0 1px 0 rgba(255, 255, 255, 0.55);
}

.rig-fan {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 78px;
    height: 78px;
    margin: -39px 0 0 -39px;
    border-radius: 50%;
    background:
        radial-gradient(circle, #4a525e 0 9px, #1a1e25 10px, transparent 11px),
        repeating-conic-gradient(from 0deg, #6c7582 0 20deg, #262b33 28deg, #0c0e12 34deg 72deg);
    filter: blur(0.6px);
    animation: rig-fan-spin 0.9s linear infinite;
}

@keyframes rig-fan-spin { to { transform: rotate(360deg); } }

/* The grille: aluminium louvres across the opening, each with a lit top
   edge and a shadowed bottom. */
.rig-grille {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(180deg,
        #c9ced5 0 1px,
        #a3aab4 1px 3px,
        #5f6670 3px 4px,
        transparent 4px 10px);
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.5);
}

/* ---- Status lights ---- */

.rig-leds {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 10px;
    font-family: var(--font-mono);
    font-size: 0.5rem;
    letter-spacing: 1px;
    color: var(--alu-ink);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
}

.led {
    --led: var(--ok);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* Each light is two parts. The socket (the <i>) is fixed: a dark bezel
   set into the plate and a dim lens, so it's there even when the light is
   off. The lamp (::after) sits in it and does all the blinking. Animating
   the whole <i> used to fade the bezel out with the light. */
.led i {
    position: relative;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--led) 22%, #15181e);
    box-shadow: 0 0 0 2px #1b1f26, 0 1px 0 2px rgba(255, 255, 255, 0.5), inset 0 1px 1px rgba(0, 0, 0, 0.6);
}

.led i::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, color-mix(in srgb, var(--led) 40%, white), var(--led) 60%);
    box-shadow: 0 0 8px 2px var(--led);
}

.led-uplink.is-degraded { --led: var(--amber); }
.led-uplink.is-degraded i::after { animation: led-blink 0.9s steps(1) infinite; }

.led-disk { --led: var(--amber); }
.led-disk i::after { animation: led-disk 2.3s steps(1) infinite; }

.led-grub { --led: var(--neon-pink); }
.led-grub i::after { animation: led-breathe 2.6s ease-in-out infinite; }

@keyframes led-blink { 50% { opacity: 0.15; } }

@keyframes led-disk {
    0%, 12%, 30%, 34%, 61%, 100% { opacity: 0.15; box-shadow: none; }
    8%, 32%, 58%, 63%, 66% { opacity: 1; }
}

@keyframes led-breathe { 50% { opacity: 0.35; } }

/* ---- Scope ---- */

.rig-scope {
    position: relative;
    height: 44px;
    margin-top: 14px;
    border: 1px solid color-mix(in srgb, var(--ok) 30%, transparent);
    border-radius: 3px;
    background:
        linear-gradient(color-mix(in srgb, var(--ok) 10%, transparent) 1px, transparent 1px) 0 0 / 100% 11px,
        linear-gradient(90deg, color-mix(in srgb, var(--ok) 10%, transparent) 1px, transparent 1px) 0 0 / 22px 100%,
        #030806;
    overflow: hidden;
}

.scope-trace {
    position: absolute;
    /* One tile wider than the screen, slid a tile left and round again: the
       trace runs on the compositor rather than repainting every frame. */
    inset: 0 -120px 0 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='44'%3E%3Cpath d='M0 22 Q15 4 30 22 T60 22 T90 22 T120 22' fill='none' stroke='%2300ff88' stroke-width='1.6'/%3E%3C/svg%3E") repeat-x 0 0 / 120px 44px;
    filter: drop-shadow(0 0 3px var(--ok));
    animation: scope-run 1.6s linear infinite;
}

@keyframes scope-run { to { transform: translateX(-120px); } }

/* Carrier lost: the sine collapses into hash. */
.rig-scope.is-noise .scope-trace {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='44'%3E%3Cpath d='M0 22 L6 18 L9 27 L14 20 L19 25 L23 16 L28 29 L33 21 L38 24 L44 14 L49 30 L55 22 L60 19 L66 26 L71 17 L77 28 L82 21 L88 25 L93 15 L99 29 L104 20 L110 24 L115 18 L120 22' fill='none' stroke='%23ffaa00' stroke-width='1.3'/%3E%3C/svg%3E");
    filter: drop-shadow(0 0 3px var(--amber));
    animation-duration: 0.35s;
}

.scope-label {
    position: absolute;
    right: 8px;
    top: 4px;
    font-family: var(--font-mono);
    font-size: 0.45rem;
    letter-spacing: 2px;
    color: var(--ok);
    text-shadow: 0 0 4px var(--ok);
}

.rig-scope.is-noise .scope-label { color: var(--amber); text-shadow: 0 0 4px var(--amber); }

/* ---- Readouts ---- */

.rig-readouts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 10px;
}

.readout {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px 8px;
    border: 1px solid color-mix(in srgb, var(--chrome) 18%, transparent);
    background: rgba(0, 0, 0, 0.4);
    font-family: var(--font-mono);
    min-width: 0;
}

.readout span {
    font-size: 0.45rem;
    letter-spacing: 2px;
    color: var(--text-secondary);
}

.readout b {
    font-size: 0.75rem;
    color: var(--neon-cyan);
    text-shadow: 0 0 6px color-mix(in srgb, var(--neon-cyan) 50%, transparent);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.readout-grub b { color: var(--neon-pink); text-shadow: 0 0 6px color-mix(in srgb, var(--neon-pink) 50%, transparent); }

.readout .grub-bar {
    display: block;
    height: 4px;
    margin-top: 2px;
    background: #16090e;
    border: 1px solid color-mix(in srgb, var(--neon-pink) 35%, transparent);
}

.grub-bar i {
    display: block;
    height: 100%;
    background: repeating-linear-gradient(90deg, var(--neon-pink) 0 4px, transparent 4px 5px);
    transition: width 1s linear;
}

.sysinfo.grub-low .readout-grub b { animation: led-blink 1.2s steps(1) infinite; }

/* ---- Rig modules ---- */

.sys-label {
    margin: 18px 0 8px;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 2px;
    color: var(--neon-cyan);
}

.rig-modules {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rig-module {
    display: grid;
    grid-template-columns: 10px 150px 1fr;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border: 1px solid #262c38;
    border-left: 3px solid #3a4250;
    background: linear-gradient(90deg, #141821, #0c0f15);
    font-family: var(--font-mono);
}

.module-led {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ok);
    box-shadow: 0 0 5px var(--ok);
    animation: led-disk 2.1s steps(1) infinite;
}

.module-slot {
    font-size: 0.5rem;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

.module-name {
    font-size: 0.6rem;
    color: var(--text-primary);
    overflow-wrap: anywhere;
}

/* ---- Changelog timeline ---- */

.rig-log {
    position: relative;
    list-style: none;
    margin: 0;
    padding: 0 0 0 22px;
}

/* The spine. */
.rig-log::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: linear-gradient(180deg, var(--neon-cyan), color-mix(in srgb, var(--neon-cyan) 15%, transparent));
}

.log-entry {
    /* Set per entry inline: each older release a little fainter. */
    --decay: 1;
    position: relative;
    padding: 0 0 12px;
    opacity: var(--decay);
}

.log-entry.is-deep { display: none; }
.rig-log.is-open .log-entry.is-deep { display: block; }

.log-node {
    position: absolute;
    left: -20px;
    top: 3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #0b0e14;
    border: 2px solid var(--neon-cyan);
}

.log-ver {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: bold;
    color: var(--neon-cyan);
}

.log-now {
    margin-left: 8px;
    padding: 1px 5px;
    background: var(--neon-pink);
    color: var(--bg-main);
    font-family: var(--font-mono);
    font-size: 0.45rem;
    font-weight: bold;
    letter-spacing: 1px;
    vertical-align: 2px;
}

.log-note {
    margin-top: 2px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    line-height: 1.55;
    color: var(--text-primary);
}

.log-entry.is-current .log-node {
    background: var(--neon-pink);
    border-color: var(--neon-pink);
    box-shadow: 0 0 10px var(--neon-pink);
    animation: led-breathe 2s ease-in-out infinite;
}

.log-entry.is-current .log-ver {
    font-size: 0.85rem;
    color: #fff;
    text-shadow: 0 0 8px var(--neon-cyan);
}

.dig-deeper {
    display: block;
    width: 100%;
    margin-top: 2px;
    padding: 7px;
    border: 1px dashed color-mix(in srgb, var(--neon-cyan) 40%, transparent);
    background: transparent;
    color: var(--neon-cyan);
    font-family: var(--font-mono);
    font-size: 0.55rem;
    letter-spacing: 2px;
    cursor: pointer;
}

@media (hover: hover) {
    .dig-deeper:hover { background: color-mix(in srgb, var(--neon-cyan) 10%, transparent); }
}

.dig-deeper:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.rig-log-fail {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--hot);
}

/* ---- Foot ---- */

.rig-foot {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid color-mix(in srgb, var(--chrome) 15%, transparent);
}

/* A void-if-removed sticker, slightly peeled. */
.warranty-sticker {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4px 8px;
    background:
        repeating-linear-gradient(45deg, transparent 0 4px, rgba(255, 255, 255, 0.06) 4px 5px),
        #c9ced6;
    color: #b0103a;
    font-family: var(--font-mono);
    border-radius: 2px;
    transform: rotate(-5deg);
    clip-path: polygon(0 0, 100% 0, 100% 78%, 88% 100%, 0 100%);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.warranty-sticker b { font-size: 0.55rem; letter-spacing: 1px; }
.warranty-sticker span { font-size: 0.4rem; letter-spacing: 1px; color: #333; }

.rig-foot-copy {
    flex: 1;
    min-width: 0;
    font-family: var(--font-mono);
    font-size: 0.45rem;
    line-height: 1.7;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

.rig-foot-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* Keys, on one line each: as neon buttons on a phone, PATCH INTO #TUBEGRUB
   broke over two lines inside its box. */
.plate-key.rig-key {
    height: 36px;
    padding: 0 14px;
    font-size: 0.62rem;
    letter-spacing: 2px;
    white-space: nowrap;
}

.plate-key.rig-key:active { height: 34px; }
.plate-key.rig-key.is-patch { --key-ink: var(--neon-pink); }

@media (max-width: 560px) {
    .rig-face-body { flex-direction: column; }
    .rig-readouts { grid-template-columns: repeat(2, 1fr); }
    .rig-module { grid-template-columns: 10px 1fr; }
    .module-name { grid-column: 2; }
    .rig-foot { flex-wrap: wrap; }
    .rig-foot-actions { width: 100%; justify-content: flex-end; }
    .rig-foot-actions .is-patch { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .sysinfo,
    .sysinfo.is-degaussing,
    .rig-crt img,
    .rig-fan,
    .led i::after,
    .scope-trace,
    .module-led,
    .log-entry.is-current .log-node,
    .sysinfo.grub-low .readout-grub b {
        animation: none;
    }
    .grub-bar i { transition: none; }
}

/* ==========================================================================
   OPERATOR PROFILES
   One ID card for both panels: the portrait in a scan frame, the name in the
   operator's own tint, their number and grid date, and a barcode strip down
   the edge. It sits in a card reader whose keys are what you can do with
   it. Your own panel is the same card with the fields live, and your
   settings in bays beneath.
   ========================================================================== */

.op-panel {
    width: 500px;
    max-width: 94vw;
    max-height: 90vh;
    overflow-y: auto;
}

/* ---- The ID card ---- */

.op-card {
    --op-ink: var(--neon-cyan);
    position: relative;
    display: flex;
    gap: 16px;
    margin-top: 16px;
    padding: 14px 40px 14px 14px;
    border: 1px solid color-mix(in srgb, var(--op-ink) 55%, transparent);
    border-radius: 6px;
    background:
        radial-gradient(ellipse at 0% 0%, color-mix(in srgb, var(--op-ink) 16%, transparent), transparent 60%),
        repeating-linear-gradient(0deg, transparent 0 3px, rgba(255, 255, 255, 0.015) 3px 4px),
        rgba(4, 7, 13, 0.85);
    box-shadow: 0 0 18px color-mix(in srgb, var(--op-ink) 18%, transparent);
    overflow: hidden;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.op-portrait {
    position: relative;
    flex-shrink: 0;
    width: 104px;
    height: 124px;
    padding: 6px;
    align-self: flex-start;
}

.op-portrait img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 3px;
    filter: saturate(1.1) contrast(1.05);
}

/* Corner brackets: the frame a scanner draws around what it has found. */
.op-bracket {
    position: absolute;
    width: 14px;
    height: 14px;
    border: 0 solid var(--op-ink);
    filter: drop-shadow(0 0 4px var(--op-ink));
}

.op-bracket.tl { top: 0; left: 0; border-top-width: 2px; border-left-width: 2px; }
.op-bracket.tr { top: 0; right: 0; border-top-width: 2px; border-right-width: 2px; }
.op-bracket.bl { bottom: 0; left: 0; border-bottom-width: 2px; border-left-width: 2px; }
.op-bracket.br { bottom: 0; right: 0; border-bottom-width: 2px; border-right-width: 2px; }

/* A scan bar that passes down the portrait now and then. */
.op-scanline {
    position: absolute;
    left: 6px;
    right: 6px;
    top: 6px;
    height: 2px;
    background: var(--op-ink);
    box-shadow: 0 0 10px 2px color-mix(in srgb, var(--op-ink) 70%, transparent);
    opacity: 0;
    animation: op-scan 4.5s ease-in-out infinite;
    pointer-events: none;
}

@keyframes op-scan {
    0%, 62% { top: 6px; opacity: 0; }
    66% { opacity: 0.9; }
    92% { top: calc(100% - 8px); opacity: 0.9; }
    96%, 100% { top: calc(100% - 8px); opacity: 0; }
}

.op-swap {
    position: absolute;
    left: 6px;
    right: 6px;
    bottom: 6px;
    padding: 4px 0;
    border: 0;
    background: color-mix(in srgb, var(--op-ink) 80%, black);
    color: var(--bg-main);
    font-family: var(--font-mono);
    font-size: 0.5rem;
    font-weight: bold;
    letter-spacing: 1px;
    cursor: pointer;
    opacity: 0.85;
}

@media (hover: hover) {
    .op-swap:hover { opacity: 1; background: var(--op-ink); }
}

.op-swap:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.op-id {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.op-name,
.op-name-input {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--op-ink);
    text-shadow: 0 0 10px color-mix(in srgb, var(--op-ink) 50%, transparent);
    overflow-wrap: anywhere;
    transition: color 0.3s;
}

.op-handle {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

.op-bio {
    margin-top: 8px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    color: var(--text-primary);
}

/* Editing happens on the card itself: fields that look like the card until
   you're in them. */
.op-name-input,
.op-bio-input {
    width: 100%;
    box-sizing: border-box;
    padding: 3px 6px;
    margin-left: -6px;
    border: 1px dashed color-mix(in srgb, var(--op-ink) 35%, transparent);
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.25);
    font-family: inherit;
    outline: none;
}

.op-name-input { font-family: var(--font-sans); }

.op-bio-input {
    margin-top: 8px;
    height: 64px;
    resize: vertical;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    line-height: 1.5;
    color: var(--text-primary);
}

.op-name-input:focus,
.op-bio-input:focus {
    border-style: solid;
    border-color: var(--op-ink);
    box-shadow: 0 0 8px color-mix(in srgb, var(--op-ink) 30%, transparent);
}

.op-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    margin-top: auto;
    padding-top: 10px;
    font-family: var(--font-mono);
    font-size: 0.5rem;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

.op-meta b { color: var(--op-ink); }

/* The barcode down the card's right edge. */
.op-strip {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-left: 1px solid color-mix(in srgb, var(--op-ink) 30%, transparent);
    background: repeating-linear-gradient(180deg,
        color-mix(in srgb, var(--op-ink) 55%, transparent) 0 1px, transparent 1px 3px,
        color-mix(in srgb, var(--op-ink) 55%, transparent) 3px 5px, transparent 5px 6px,
        color-mix(in srgb, var(--op-ink) 55%, transparent) 6px 7px, transparent 7px 10px);
}

.op-strip span {
    padding: 3px 1px;
    background: #05070c;
    writing-mode: vertical-rl;
    font-family: var(--font-mono);
    font-size: 0.45rem;
    letter-spacing: 3px;
    color: var(--op-ink);
}

/* ---- Tint gels ---- */

.tint-gels {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tint-gel {
    /* Each gel's colour is set inline. */
    --gel: var(--neon-cyan);
    position: relative;
    cursor: pointer;
}

.tint-gel input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

/* A square of coloured filter gel in a little frame. */
.tint-gel span {
    display: block;
    width: 34px;
    height: 24px;
    border: 2px solid #2a303b;
    border-radius: 3px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.35), transparent 45%),
        var(--gel);
    opacity: 0.55;
    transition: opacity 0.15s, box-shadow 0.15s, transform 0.15s;
}

@media (hover: hover) {
    .tint-gel:hover span { opacity: 0.85; }
}

.tint-gel input:checked + span {
    opacity: 1;
    border-color: #fff;
    box-shadow: 0 0 12px var(--gel);
}

.tint-gel input:focus-visible + span {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* ---- The card reader: the slot the card sits in, a lamp, the keys ---- */

.op-reader {
    position: relative;
    margin-top: -6px;
    padding: 16px 12px 12px;
    border: 1px solid color-mix(in srgb, var(--chrome) 32%, transparent);
    border-top: 0;
    border-radius: 0 0 4px 4px;
    background:
        repeating-linear-gradient(135deg, transparent 0 3px, color-mix(in srgb, var(--chrome) 5%, transparent) 3px 4px),
        rgba(4, 7, 13, 0.9);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* The slot: a dark slit across the top that the card's bottom edge sits in. */
.reader-slot {
    position: absolute;
    top: 0;
    left: 10px;
    right: 10px;
    height: 6px;
    border-radius: 0 0 3px 3px;
    background: #020306;
    box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.9), 0 1px 0 color-mix(in srgb, var(--chrome) 22%, transparent);
}

.reader-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.reader-lamp {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 6px;
    font-family: var(--font-mono);
    font-size: 7px;
    letter-spacing: 2px;
    color: color-mix(in srgb, var(--chrome) 60%, transparent);
}

.reader-lamp i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--neon-green);
    box-shadow: 0 0 0 2px #04070c, 0 0 0 3px color-mix(in srgb, var(--chrome) 28%, transparent), 0 0 8px var(--neon-green);
}

.reader-keys { display: flex; gap: 8px; }
.reader-keys.is-right { margin-left: auto; }

.op-reader .plate-key,
.op-links .plate-key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 32px;
    padding: 0 14px;
    font-size: 0.65rem;
    letter-spacing: 2px;
    text-decoration: none;
}

.op-reader .plate-key:active,
.op-links .plate-key:active { height: 30px; }

.plate-key.is-go { --key-ink: var(--neon-green); }

/* SAVE's lamp: dark until something on the card differs from what is on file. */
.save-lamp {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #1d2a24;
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.7);
    transition: background 0.15s, box-shadow 0.15s;
}

#save-profile.is-dirty .save-lamp {
    background: var(--neon-green);
    box-shadow: 0 0 6px var(--neon-green);
}

/* ---- The settings, in bays under the reader ---- */

.op-bay {
    position: relative;
    margin-top: 16px;
    padding: 20px 14px 14px;
    border: 1px solid color-mix(in srgb, var(--chrome) 32%, transparent);
    border-radius: 4px;
    background:
        repeating-linear-gradient(135deg, transparent 0 3px, color-mix(in srgb, var(--chrome) 5%, transparent) 3px 4px),
        rgba(4, 7, 13, 0.85);
}

.op-bay-tag {
    position: absolute;
    top: 6px;
    left: 14px;
    font-family: var(--font-mono);
    font-size: 8px;
    letter-spacing: 2px;
    color: color-mix(in srgb, var(--chrome) 60%, transparent);
}

.op-bay .tint-gels { margin-top: 4px; }

/* TAKE_IT_WITH_YOU: a line of what you get, and the key. */
.op-export { display: flex; align-items: center; gap: 14px; }
.op-export p { flex: 1; margin: 0; color: var(--text-secondary); font-size: 0.75rem; line-height: 1.45; }
.op-export .op-links { flex: none; }
@media (max-width: 520px) { .op-export { flex-direction: column; align-items: stretch; } }

.blocked-list {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.op-links {
    display: flex;
    gap: 8px;
}

@media (max-width: 520px) {
    .op-card { flex-direction: column; }
    .reader-row { flex-wrap: wrap; }
    .reader-lamp { width: 100%; margin-bottom: 4px; }
}

@media (prefers-reduced-motion: reduce) {
    .op-scanline { animation: none; display: none; }
}

/* ==========================================================================
   NEURAL_LINK: the link console, arming ephemeral, severing
   The DM header carries a small console: an EPHEMERAL switch whose fuse
   burns while it's armed, and SCRUB_HISTORY. Arming goes through a dialog
   that says what will burn, with a choice about the archive. Each link in
   the sidebar has a × that severs it.
   ========================================================================== */

.link-console {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: 14px;
    vertical-align: middle;
}

.link-ctl {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 9px;
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.35);
    font-family: var(--font-mono);
    font-size: 0.55rem;
    letter-spacing: 1px;
    cursor: pointer;
    overflow: hidden;
    transition: background 0.15s, box-shadow 0.15s, color 0.15s;
}

.link-ctl:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* ---- EPHEMERAL: a switch, and a fuse along the bottom while it burns ---- */

.ctl-eph {
    border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent);
    color: color-mix(in srgb, var(--warn) 80%, var(--text-secondary));
}

.eph-track {
    position: relative;
    width: 20px;
    height: 10px;
    border-radius: 5px;
    background: #0b0c10;
    border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent);
}

.eph-knob {
    position: absolute;
    top: 1px;
    left: 1px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #6a6f7c;
    transition: left 0.2s cubic-bezier(.3, 1.5, .5, 1), background 0.2s;
}

.ctl-eph.is-armed {
    border-color: var(--warn);
    color: var(--warn);
    background: color-mix(in srgb, var(--warn) 12%, rgba(0, 0, 0, 0.4));
    box-shadow: 0 0 10px color-mix(in srgb, var(--warn) 35%, transparent);
}

.ctl-eph.is-armed .eph-track {
    border-color: var(--warn);
    background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--warn) 35%, transparent) 0 2px, transparent 2px 4px), #0b0c10;
}

.ctl-eph.is-armed .eph-knob {
    left: 11px;
    background: var(--warn);
    box-shadow: 0 0 6px var(--warn);
}

/* The fuse: a spark running along the bottom edge, the line behind it spent. */
.eph-fuse {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--warn) var(--burnt, 0%), rgba(255, 255, 255, 0.08) var(--burnt, 0%));
    animation: eph-fuse 60s linear infinite;
}

.eph-fuse::after {
    content: "";
    position: absolute;
    top: -2px;
    left: var(--burnt, 0%);
    width: 5px;
    height: 5px;
    margin-left: -2px;
    border-radius: 50%;
    background: #fff4c2;
    box-shadow: 0 0 6px 2px var(--warn), 0 0 12px var(--hot);
    animation: eph-spark 0.15s steps(2) infinite;
}

@property --burnt {
    syntax: '<percentage>';
    inherits: true;
    initial-value: 0%;
}

@keyframes eph-fuse {
    from { --burnt: 0%; }
    to { --burnt: 100%; }
}

@keyframes eph-spark {
    50% { transform: scale(0.6); opacity: 0.7; }
}

@media (hover: hover) {
    .ctl-eph:hover { background: color-mix(in srgb, var(--warn) 18%, rgba(0, 0, 0, 0.4)); color: var(--warn); }
}

/* ---- SCRUB ---- */

.ctl-scrub {
    border: 1px solid color-mix(in srgb, var(--hot) 55%, transparent);
    color: var(--hot);
}

@media (hover: hover) {
    .ctl-scrub:hover {
        background: var(--hot);
        color: var(--bg-main);
        box-shadow: 0 0 12px var(--hot);
    }
}

/* ---- The arming dialog ---- */

.eph-arm {
    width: 440px;
    max-width: 94vw;
    border-color: var(--warn);
}

.eph-arm .terminal-label { color: var(--warn); }

/* One message at a time: it arrives, the fuse under it burns down, it goes
   to static and it's gone, and the next arrives. Two messages, offset by
   half a cycle so exactly one is on screen. */
.burn-demo {
    position: relative;
    height: 40px;
    margin-top: 14px;
    border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
    border-radius: 3px;
    background: #07080b;
    overflow: hidden;
    font-family: var(--font-mono);
    font-size: 0.65rem;
}

.burn-msg {
    position: absolute;
    inset: 0;
    padding: 9px 12px 0;
    white-space: nowrap;
    opacity: 0;
    animation: burn-msg 8s linear infinite;
}

.burn-msg + .burn-msg { animation-delay: -4s; }
.burn-msg + .burn-msg .burn-text,
.burn-msg + .burn-msg .burn-ash,
.burn-msg + .burn-msg .burn-fuse,
.burn-msg + .burn-msg .burn-fuse::after { animation-delay: -4s; }

.burn-text {
    color: var(--text-primary);
    animation: burn-text 8s linear infinite;
}

/* The same line, burnt: laid over the text and shown as it goes. */
.burn-ash {
    position: absolute;
    left: 12px;
    top: 9px;
    color: var(--warn);
    opacity: 0;
    text-shadow: 0 0 6px var(--hot);
    animation: burn-ash 8s linear infinite;
}

.burn-fuse {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 7px;
    height: 2px;
    background: color-mix(in srgb, var(--warn) 70%, transparent);
    transform-origin: left center;
    animation: burn-fuse 8s linear infinite;
}

.burn-fuse::after {
    content: "";
    position: absolute;
    right: -2px;
    top: -2px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fff4c2;
    box-shadow: 0 0 6px 2px var(--warn), 0 0 12px var(--hot);
    animation: eph-spark 0.15s steps(2) infinite;
}

/* On screen for the first half of the cycle, gone for the second. */
@keyframes burn-msg {
    0% { opacity: 0; }
    3%, 46% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

@keyframes burn-fuse {
    0%, 3% { transform: scaleX(1); }
    34%, 100% { transform: scaleX(0); }
}

@keyframes burn-text {
    0%, 34% { opacity: 1; filter: none; color: var(--text-primary); }
    37% { color: var(--warn); }
    42%, 100% { opacity: 0; filter: blur(1.5px); color: var(--hot); }
}

@keyframes burn-ash {
    0%, 35% { opacity: 0; }
    38%, 42% { opacity: 1; }
    48%, 100% { opacity: 0; }
}

.eph-copy {
    margin: 12px 0 4px;
    text-wrap: pretty;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    line-height: 1.6;
    color: var(--text-primary);
}

.eph-copy b { color: var(--warn); }

.archive-picks {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.archive-pick {
    --pick-ink: var(--neon-cyan);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 9px 12px;
    border: 1px solid color-mix(in srgb, var(--pick-ink) 28%, transparent);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.35);
    font-family: var(--font-mono);
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.15s, border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.pick-burn { --pick-ink: var(--hot); }

.archive-pick input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.archive-pick:has(input:checked) {
    opacity: 1;
    border-color: var(--pick-ink);
    background: color-mix(in srgb, var(--pick-ink) 9%, rgba(0, 0, 0, 0.4));
    box-shadow: 0 0 12px color-mix(in srgb, var(--pick-ink) 30%, transparent);
}

.archive-pick:has(input:focus-visible) {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

@media (hover: hover) {
    .archive-pick:hover { opacity: 1; }
}

.pick-head {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.7rem;
    font-weight: bold;
    letter-spacing: 1px;
    color: var(--pick-ink);
}

.pick-glyph { font-size: 0.9rem; }

.pick-line {
    padding-left: 22px;
    text-wrap: pretty;
    font-size: 0.6rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

.dialog-keys {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.dialog-keys .plate-key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 20px;
    font-size: 0.72rem;
    letter-spacing: 3px;
}

.dialog-keys .plate-key:active { height: 38px; }

/* ARM: an amber key whose lamp comes up as you reach for it. */
.plate-key.eph-arm-key { --key-ink: var(--warn); }

.arm-lamp {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #3a2a10;
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.7);
    transition: background 0.15s, box-shadow 0.15s;
}

.eph-arm-key:hover .arm-lamp,
.eph-arm-key:focus-visible .arm-lamp {
    background: var(--warn);
    box-shadow: 0 0 0 1px var(--bg-main), 0 0 8px var(--warn);
}

/* ---- Sidebar: the ephemeral mark and the sever × ---- */

.dm-eph-mark {
    font-size: 0.6rem;
    vertical-align: middle;
}

.dm-sever {
    position: relative;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-left: 6px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 3px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s, border-color 0.15s, background 0.15s;
}

/* The ×, as two bars crossed at the button's centre. */
.dm-sever::before,
.dm-sever::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 10px;
    height: 1.5px;
    margin: -0.75px 0 0 -5px;
    border-radius: 1px;
    background: currentColor;
    transform: rotate(45deg);
}

.dm-sever::after { transform: rotate(-45deg); }

/* Out of the way until you're on the row; always there on touch. */
.channel-item:hover .dm-sever,
.dm-sever:focus-visible { opacity: 1; }

@media (hover: none) {
    .dm-sever { opacity: 0.6; }
}

@media (hover: hover) {
    .dm-sever:hover {
        color: var(--hot);
        border-color: var(--hot);
        background: color-mix(in srgb, var(--hot) 12%, transparent);
    }
}

.dm-sever:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 1px;
}

/* On the selected row the background is lit, so the × goes dark. */
.channel-item.active .dm-sever { color: var(--bg-main); }

@media (hover: hover) {
    .channel-item.active .dm-sever:hover { color: var(--bg-main); background: var(--hot); border-color: var(--hot); }
}

@media (prefers-reduced-motion: reduce) {
    .eph-fuse,
    .eph-fuse::after,
    .burn-msg,
    .burn-text,
    .burn-ash,
    .burn-fuse,
    .burn-fuse::after {
        animation: none;
    }
    /* Held on the first message, fuse half burnt. */
    .burn-msg:first-child { opacity: 1; }
    .burn-fuse { transform: scaleX(0.5); }
    .eph-fuse { --burnt: 50%; }
}

/* ==========================================================================
   THE WELCOME BAY
   What an operator in no sectors sees in the main pane: three bay doors in
   the colours of their keys (JOIN cyan, THE_BLACK_PAGES amber, NEW pink),
   each with a loop of what's behind it, and a shortcut to HQ. The rail's
   NEW/JOIN keys pulse while it's up.
   ========================================================================== */

.welcome-bay {
    width: 100%;
    max-width: 820px;
    margin: auto;
    padding: 24px 8px 32px;
    font-family: var(--font-mono);
}

.welcome-head { text-align: center; }

.welcome-kicker {
    font-size: 0.6rem;
    letter-spacing: 4px;
    color: color-mix(in srgb, var(--neon-cyan) 70%, transparent);
}

/* The headline, with a pink ghost that slips out of register now and then. */
.welcome-title {
    position: relative;
    display: inline-block;
    margin: 10px 0 12px;
    font-size: clamp(1.2rem, 3.2vw, 2rem);
    font-weight: 700;
    letter-spacing: 3px;
    line-height: 1.2;
    color: #fff;
    text-shadow: 0 0 12px var(--neon-cyan), 0 0 34px color-mix(in srgb, var(--neon-cyan) 50%, transparent);
    text-wrap: balance;
}

.welcome-title::after {
    content: attr(data-ghost);
    position: absolute;
    inset: 0;
    color: var(--hot);
    text-shadow: none;
    opacity: 0;
    mix-blend-mode: screen;
    pointer-events: none;
    /* Ghosts in the ambient burst. */
}

@keyframes welcome-ghost {
    0%, 91%, 100% { opacity: 0; transform: none; clip-path: inset(0); }
    92% { opacity: 0.8; transform: translateX(-4px); clip-path: inset(15% 0 55% 0); }
    94% { opacity: 0.8; transform: translateX(3px); clip-path: inset(55% 0 10% 0); }
}

.welcome-line {
    max-width: 560px;
    margin: 0 auto;
    font-size: 0.8rem;
    line-height: 1.7;
    color: var(--text-secondary);
    text-wrap: pretty;
}

/* ---- The doors ---- */

.welcome-doors {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 28px;
}

.bay-door {
    --door-ink: var(--neon-cyan);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    min-width: 0;
    padding: 18px 16px 16px;
    border: 1px solid color-mix(in srgb, var(--door-ink) 45%, transparent);
    border-top: 3px solid var(--door-ink);
    border-radius: 4px;
    background:
        repeating-linear-gradient(0deg, transparent 0 3px, rgba(255, 255, 255, 0.015) 3px 4px),
        linear-gradient(180deg, color-mix(in srgb, var(--door-ink) 10%, #0a0d15), #06080d);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6), 0 14px 30px rgba(0, 0, 0, 0.55),
        0 0 22px color-mix(in srgb, var(--door-ink) 14%, transparent);
    color: var(--door-ink);
    font-family: var(--font-mono);
    text-align: left;
    cursor: pointer;
    overflow: hidden;
    transition: box-shadow 0.25s, border-color 0.25s, background 0.25s;
}

.door-pages { --door-ink: var(--amber); }
.door-new { --door-ink: var(--hot); }

/* Bolts in the top corners of each door. */
.bay-door::before {
    content: "";
    position: absolute;
    inset: 6px;
    pointer-events: none;
    --bolt: radial-gradient(circle, #8a97a8 0 1px, #3a4350 1.5px, transparent 2px);
    background: var(--bolt) top left / 5px 5px no-repeat, var(--bolt) top right / 5px 5px no-repeat;
}

@media (hover: hover) {
    .bay-door:hover {
        border-color: var(--door-ink);
        background:
            repeating-linear-gradient(0deg, transparent 0 3px, rgba(255, 255, 255, 0.02) 3px 4px),
            linear-gradient(180deg, color-mix(in srgb, var(--door-ink) 18%, #0a0d15), #080a10);
        box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6), 0 14px 30px rgba(0, 0, 0, 0.55),
            0 0 40px color-mix(in srgb, var(--door-ink) 35%, transparent);
    }
}

.bay-door:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

/* The key it matches in the rail. */
.door-key {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    margin-bottom: 6px;
    border: 1px solid var(--door-ink);
    border-bottom-width: 3px;
    border-radius: 3px;
    background: color-mix(in srgb, var(--door-ink) 14%, transparent);
    font-size: 1.1rem;
    font-weight: 700;
    box-shadow: 0 0 10px color-mix(in srgb, var(--door-ink) 40%, transparent);
}

/* Each glyph's ink sits a little below the middle of its line, by an amount
   that differs per glyph (measured in JetBrains Mono), so each is nudged up
   by its own amount to sit dead centre in the key's face. */
.door-key i {
    --nudge: 0px;
    display: block;
    font-style: normal;
    line-height: 1;
    transform: translateY(var(--nudge));
}

.door-join .door-key i { --nudge: -1.5px; }
.door-pages .door-key i { --nudge: -2px; }
.door-new .door-key i { --nudge: -0.5px; }

.door-kicker {
    font-size: 0.55rem;
    letter-spacing: 3px;
    opacity: 0.75;
}

.door-title {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: #fff;
    text-shadow: 0 0 8px color-mix(in srgb, var(--door-ink) 60%, transparent);
}

.door-line {
    margin-bottom: 10px;
    font-size: 0.7rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

.door-preview {
    position: relative;
    display: block;
    width: 100%;
    height: 54px;
    /* Pinned to the foot of the door, so all three line up whatever the
       length of the copy above. */
    margin-top: auto;
    border: 1px solid color-mix(in srgb, var(--door-ink) 25%, transparent);
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.5);
    overflow: hidden;
    font-size: 0.55rem;
}

/* JOIN: the call, one line at a time, then again. */
.preview-dial i {
    display: block;
    padding: 0 8px;
    font-style: normal;
    line-height: 16px;
    opacity: 0;
    animation: door-dial 4.5s steps(1) infinite;
}

.preview-dial i:first-child { padding-top: 3px; }
.preview-dial i:nth-child(2) { animation-name: door-dial-2; }
.preview-dial i:nth-child(3) { animation-name: door-dial-3; color: var(--ok); text-shadow: 0 0 6px var(--ok); }

@keyframes door-dial { 0%, 8% { opacity: 0; } 10%, 92% { opacity: 1; } 94%, 100% { opacity: 0; } }
@keyframes door-dial-2 { 0%, 28% { opacity: 0; } 30%, 92% { opacity: 1; } 94%, 100% { opacity: 0; } }
@keyframes door-dial-3 { 0%, 52% { opacity: 0; } 54%, 92% { opacity: 1; } 94%, 100% { opacity: 0; } }

/* THE_BLACK_PAGES: a page of the directory, ranked by traffic, with a
   finger running down the listings. Stepped, and opacity only. */
.preview-listing {
    padding: 4px 8px;
    box-sizing: border-box;
}

.preview-listing i {
    position: relative;
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-style: normal;
    line-height: 15px;
    color: color-mix(in srgb, var(--door-ink) 75%, transparent);
    white-space: nowrap;
}

.preview-listing b { color: var(--door-ink); font-weight: 700; letter-spacing: 0.5px; }
.preview-listing u { flex: 1; min-width: 12px; border-bottom: 1px dotted color-mix(in srgb, var(--door-ink) 45%, transparent); transform: translateY(-3px); text-decoration: none; }
.preview-listing s { text-decoration: none; letter-spacing: 1px; }

.preview-listing i::before {
    content: "";
    position: absolute;
    inset: 0 -8px;
    background: color-mix(in srgb, var(--door-ink) 16%, transparent);
    box-shadow: inset 2px 0 0 var(--door-ink);
    opacity: 0;
    animation: door-find 3.6s steps(1) infinite;
}

.preview-listing i:nth-child(2)::before { animation-delay: 1.2s; }
.preview-listing i:nth-child(3)::before { animation-delay: 2.4s; }

@keyframes door-find { 0% { opacity: 1; } 33.3%, 100% { opacity: 0; } }

/* NEW: the charter's name, and its stamp coming down on it. */
.preview-stamp b {
    position: absolute;
    left: 8px;
    top: 7px;
    font-size: 0.8rem;
    color: var(--door-ink);
    text-shadow: 0 0 6px color-mix(in srgb, var(--door-ink) 60%, transparent);
}

.preview-stamp em {
    position: absolute;
    right: 8px;
    bottom: 6px;
    padding: 2px 6px;
    border: 2px solid var(--amber);
    border-radius: 3px;
    font-style: normal;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--amber);
    transform: rotate(8deg);
    animation: door-stamp 3.2s ease-in infinite;
}

@keyframes door-stamp {
    0%, 30% { opacity: 0; transform: rotate(8deg) scale(2.2); }
    38% { opacity: 1; transform: rotate(8deg) scale(0.92); }
    42%, 90% { opacity: 1; transform: rotate(8deg) scale(1); }
    100% { opacity: 0; transform: rotate(8deg) scale(1); }
}

/* ---- HQ and the arcade ---- */

.welcome-hq {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 22px;
    padding: 12px 16px;
    border: 1px dashed color-mix(in srgb, var(--neon-cyan) 35%, transparent);
    border-radius: 4px;
    background: color-mix(in srgb, var(--neon-cyan) 4%, transparent);
}

.hq-pip {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ok);
    box-shadow: 0 0 8px var(--ok);
    animation: led-breathe 2s ease-in-out infinite;
}

.hq-copy {
    flex: 1;
    min-width: 0;
    font-size: 0.72rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

.hq-copy b { color: var(--text-primary); }

.welcome-hq .plate-key {
    flex-shrink: 0;
    height: 30px;
    padding: 0 12px;
    font-size: 0.65rem;
}

.welcome-hq .plate-key:active { height: 28px; }

/* ---- The rail keys, beckoning ---- */

.rail-bay.is-beckoning .bay-key {
    /* Stepped, as the rail's bubble: see .rail-link.has-unread-dm. */
    animation: bay-beckon 2.4s steps(10) infinite;
}

.rail-bay.is-beckoning .bay-join { animation-delay: -1.2s; }

@keyframes bay-beckon {
    0%, 100% { box-shadow: 0 0 6px color-mix(in srgb, var(--key-ink) 35%, transparent); }
    50% { box-shadow: 0 0 18px var(--key-ink), 0 0 30px color-mix(in srgb, var(--key-ink) 45%, transparent); }
}

@media (max-width: 760px) {
    .welcome-doors { grid-template-columns: 1fr; }
    .welcome-hq { flex-wrap: wrap; }
}

/* A phone: the words get the width, and the key goes under them. */
@media (max-width: 520px) {
    .welcome-hq .hq-copy { flex-basis: calc(100% - 22px); }
    .welcome-hq .plate-key { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .welcome-title::after,
    .preview-dial i,
    .preview-listing i::before,
    .preview-stamp em,
    .hq-pip,
    .rail-bay.is-beckoning .bay-key {
        animation: none;
    }
    .preview-dial i,
    .preview-stamp em,
    .preview-listing i:first-child::before { opacity: 1; }
}

/* ==========================================================================
   THE TERMS CHECKPOINT
   Shown after signup until agreed. A hazard-taped document: the zero-
   tolerance rule under a stamp, what's banned and what's yours in two
   columns, and a signature line that signs your handle when you tick it.
   ========================================================================== */

.terms-gate {
    position: relative;
    width: 600px;
    max-width: 94vw;
    max-height: 90vh;
    overflow-y: auto;
    padding-top: 30px;
    font-family: var(--font-mono);
}

.terms-tape {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
    background: repeating-linear-gradient(-45deg, var(--amber) 0 8px, #111 8px 16px);
}

.terms-kicker {
    font-size: 0.6rem;
    letter-spacing: 3px;
    color: var(--amber);
}

.terms-title {
    margin: 6px 0 16px;
    font-family: var(--font-sans);
    font-size: 1.4rem;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 0 12px color-mix(in srgb, var(--neon-cyan) 45%, transparent);
}

.terms-zero {
    position: relative;
    padding: 14px 110px 14px 14px;
    border: 1px solid var(--hot);
    border-left-width: 4px;
    background: color-mix(in srgb, var(--hot) 8%, transparent);
    border-radius: 3px;
}

.terms-zero-head {
    font-weight: 700;
    color: var(--hot);
    line-height: 1.45;
    margin-bottom: 6px;
}

.terms-zero-line {
    font-size: 0.8rem;
    line-height: 1.55;
    color: var(--text-primary);
}

/* A red rubber stamp, crooked, over the corner. */
.terms-stamp {
    position: absolute;
    right: 12px;
    top: 50%;
    padding: 5px 8px;
    border: 3px double var(--hot);
    border-radius: 4px;
    font-size: 0.6rem;
    font-weight: 900;
    letter-spacing: 2px;
    line-height: 1.3;
    text-align: center;
    color: var(--hot);
    transform: translateY(-50%) rotate(-10deg);
    opacity: 0.85;
    mix-blend-mode: screen;
}

.terms-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 16px;
}

.terms-col {
    --col-ink: var(--hot);
    padding: 12px;
    border: 1px solid color-mix(in srgb, var(--col-ink) 30%, transparent);
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.3);
}

.terms-rights { --col-ink: var(--ok); }

.terms-col-label {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--col-ink);
    margin-bottom: 8px;
}

.terms-col ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.terms-col li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 8px;
    font-size: 0.75rem;
    line-height: 1.5;
    color: var(--text-primary);
}

.terms-col li:last-child { margin-bottom: 0; }

.terms-col li::before {
    position: absolute;
    left: 0;
    top: 0;
    font-weight: 700;
    color: var(--col-ink);
}

.terms-banned li::before { content: "\2715"; }
.terms-rights li::before { content: "\2713"; }

.terms-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.terms-links a {
    padding: 4px 10px;
    border: 1px solid color-mix(in srgb, var(--neon-cyan) 40%, transparent);
    border-radius: 3px;
    font-size: 0.65rem;
    letter-spacing: 1px;
    color: var(--neon-cyan);
    text-decoration: none;
}

@media (hover: hover) {
    .terms-links a:hover { background: color-mix(in srgb, var(--neon-cyan) 12%, transparent); }
}

/* ---- The signature line ---- */

.terms-sign {
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 12px;
    margin: 20px 0 16px;
    padding: 12px;
    border: 1px dashed color-mix(in srgb, var(--neon-cyan) 30%, transparent);
    border-radius: 3px;
    cursor: pointer;
}

.terms-sign input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.sign-box {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    margin-bottom: 18px;
    border: 2px solid var(--neon-cyan);
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.4);
    position: relative;
    transition: background 0.15s, box-shadow 0.15s;
}

.terms-sign input:checked + .sign-box {
    background: var(--neon-cyan);
    box-shadow: 0 0 12px var(--neon-cyan);
}

.terms-sign input:checked + .sign-box::after {
    content: "\2713";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    color: var(--bg-main);
}

.terms-sign input:focus-visible + .sign-box {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

.sign-copy {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sign-line {
    position: relative;
    display: block;
    height: 30px;
    border-bottom: 1px solid color-mix(in srgb, var(--neon-cyan) 50%, transparent);
}

.sign-placeholder {
    position: absolute;
    left: 2px;
    bottom: 4px;
    font-size: 0.65rem;
    letter-spacing: 2px;
    color: var(--text-secondary);
    opacity: 0.6;
    text-transform: uppercase;
}

/* The handle, written in as the box is ticked. */
.sign-name {
    position: absolute;
    left: 4px;
    bottom: 2px;
    font-family: "Snell Roundhand", "Segoe Script", "Brush Script MT", cursive;
    font-size: 1.35rem;
    color: #fff;
    text-shadow: 0 0 8px color-mix(in srgb, var(--neon-cyan) 70%, transparent);
    white-space: nowrap;
    clip-path: inset(0 100% 0 0);
    transition: clip-path 0.7s ease-out;
}

.terms-sign:has(input:checked) .sign-name { clip-path: inset(0 0 0 0); }
.terms-sign:has(input:checked) .sign-placeholder { opacity: 0; }

.sign-caption {
    font-size: 0.75rem;
    color: var(--text-primary);
}

.terms-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* AGREE stays dark and dead until the box is signed; its lamp comes up
   with the tick. */
.terms-actions #terms-accept:disabled { opacity: 0.35; cursor: not-allowed; pointer-events: none; }
.terms-actions #terms-accept:not(:disabled) .key-lamp { background: var(--key-ink); box-shadow: 0 0 8px var(--key-ink); }
.terms-actions .abort-key.is-danger { --key-ink: var(--neon-pink); }

/* REPORT: the lamp is lit while the key is there to press. */
.report-keys #report-send .key-lamp { background: var(--key-ink); box-shadow: 0 0 8px var(--key-ink); }
.report-keys #report-send:disabled { opacity: 0.5; pointer-events: none; }

@media (max-width: 560px) {
    .terms-columns { grid-template-columns: 1fr; }
    .terms-zero { padding-right: 14px; padding-top: 44px; }
    .terms-stamp { top: 10px; transform: rotate(-8deg); }
}

@media (prefers-reduced-motion: reduce) {
    .sign-name { transition: none; }
}

/* ------------------------------------------------------------------ *
 * ON AIR
 *
 * A channel put on the open web (broadcast.php) wears a lamp: in its
 * header, the mobile header, the channel list and its settings. The point
 * is that nobody can forget who else is listening, so it glows and it
 * breathes, and clicking it says exactly what it means.
 * ------------------------------------------------------------------ */
.on-air-lamp {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 10px;
    padding: 3px 8px;
    border: 1px solid var(--neon-pink);
    border-radius: 3px;
    background: color-mix(in srgb, var(--neon-pink) 16%, transparent);
    color: #fff;
    font: 700 0.62rem/1 var(--font-mono);
    letter-spacing: 2px;
    text-shadow: 0 0 6px var(--neon-pink);
    box-shadow: 0 0 12px color-mix(in srgb, var(--neon-pink) 40%, transparent);
    cursor: pointer;
    vertical-align: middle;
}

.on-air-lamp i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--neon-pink);
    box-shadow: 0 0 8px var(--neon-pink);
}

.on-air-lamp.is-compact {
    padding: 4px;
    margin-left: 8px;
}

.on-air-lamp.is-static {
    margin-left: 0;
    cursor: default;
}

.on-air-pop {
    position: fixed;
    z-index: 10210;
    width: min(360px, calc(100vw - 16px));
    padding: 14px;
    border: 1px solid var(--neon-pink);
    border-radius: 6px;
    background: rgba(8, 11, 20, 0.97);
    box-shadow: 0 0 26px color-mix(in srgb, var(--neon-pink) 30%, transparent), 0 12px 30px rgba(0, 0, 0, 0.6);
    font-family: var(--font-mono);
}

.pop-head {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 0.6rem;
    letter-spacing: 1px;
}

.on-air-pop p {
    margin: 10px 0 12px;
    color: var(--text-primary);
    font: 0.8rem/1.5 var(--font-sans);
}

.pop-url {
    display: flex;
    gap: 6px;
    align-items: stretch;
    margin: 10px 0;
}

.pop-url input {
    flex: 1;
    min-width: 0;
    padding: 6px 8px;
    border: 1px solid var(--border-glow);
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.4);
    color: var(--neon-cyan);
    font: 0.7rem var(--font-mono);
}

/* Small keys in the settings and the ON AIR pop: DISMISS, COPY, OPEN,
   SEVER, PULL. */
.plate-key.wire-key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 28px;
    padding: 0 10px;
    font-size: 0.6rem;
    letter-spacing: 1.5px;
    text-decoration: none;
}

.plate-key.wire-key:active { height: 26px; }

.plate-key:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    box-shadow: none;
}

@media (hover: hover) {
    .plate-key:disabled:hover {
        background: linear-gradient(180deg, color-mix(in srgb, var(--key-ink) 16%, transparent), color-mix(in srgb, var(--key-ink) 4%, transparent));
        color: var(--key-ink);
        box-shadow: none;
    }
}

.plate-key:disabled:active {
    border-bottom-width: 3px;
    margin-top: 0;
}

.pop-note {
    color: var(--text-secondary);
    font-size: 0.6rem;
}

/* The settings: the wire's other direction. */
.bcast-state {
    margin-bottom: 10px;
    color: var(--text-secondary);
    font: 700 0.6rem var(--font-mono);
    letter-spacing: 1px;
}

/* The broadcast switch: three latching keys. The one that is set stays down
   and lit; OFF AIR lights grey, the two on-air settings pink. */
.bcast-switch {
    display: flex;
    gap: 8px;
}

.bcast-switch button {
    --key-ink: var(--neon-pink);
    flex: 1;
    height: 36px;
    box-sizing: border-box;
    border: 1px solid color-mix(in srgb, var(--key-ink) 45%, transparent);
    border-bottom-width: 4px;
    border-radius: 2px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--key-ink) 10%, transparent), color-mix(in srgb, var(--key-ink) 2%, transparent));
    color: color-mix(in srgb, var(--key-ink) 70%, transparent);
    font: 700 0.62rem var(--font-mono);
    letter-spacing: 2px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.bcast-switch button[data-mode="off"] { --key-ink: var(--text-secondary); }

@media (hover: hover) {
    .bcast-switch button:not(:disabled):not([aria-pressed="true"]):hover {
        border-color: var(--key-ink);
        color: var(--key-ink);
    }
}

/* Latched: pressed in, and lit. */
.bcast-switch button[aria-pressed="true"] {
    margin-top: 3px;
    height: 33px;
    border-bottom-width: 1px;
    border-color: var(--key-ink);
    background: var(--key-ink);
    color: #05070c;
    box-shadow: 0 0 12px color-mix(in srgb, var(--key-ink) 45%, transparent);
    cursor: default;
}

.bcast-switch button[data-mode="off"][aria-pressed="true"] {
    background: color-mix(in srgb, var(--text-secondary) 40%, #0a0d14);
    color: var(--text-primary);
    box-shadow: none;
}

.bcast-switch button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* ------------------------------------------------------------------ *
 * THE RIG KNOB
 *
 * The rail's SYSTEM_INFO button: a small panel of the rig it opens, built
 * like the SECTOR bay above it (hatched housing, a tag across the top, a key's
 * thick bottom edge) with a fan behind a guard in the rail's cyan. Perfectly
 * still at rest; hovered, the fan spins up (js: wireRigKnob) and the lamp
 * comes on; pressed, the panel goes down like a key. Nothing loops at rest.
 * ------------------------------------------------------------------ */
.rig-knob {
    --key-ink: var(--neon-cyan);
    position: relative;
    flex-shrink: 0;
    width: 51px;
    height: 56px;
    margin-bottom: 16px;
    padding: 12px 0 0;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    border: 1px solid color-mix(in srgb, var(--chrome) 35%, transparent);
    border-bottom-width: 3px;
    border-radius: 3px;
    background:
        repeating-linear-gradient(135deg, transparent 0 3px, color-mix(in srgb, var(--chrome) 5%, transparent) 3px 4px),
        rgba(4, 7, 13, 0.85);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 2px 6px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.knob-tag {
    position: absolute;
    top: 2px;
    left: 0;
    right: 0;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 7px;
    line-height: 8px;
    letter-spacing: 1px;
    color: color-mix(in srgb, var(--chrome) 60%, transparent);
    transition: color 0.15s;
    pointer-events: none;
}

.knob-well {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid color-mix(in srgb, var(--key-ink) 45%, transparent);
    background: #05080d;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.9);
    box-sizing: border-box;
    overflow: hidden;
    transition: border-color 0.15s;
    pointer-events: none;
}

.knob-fan,
.knob-guard {
    position: absolute;
    inset: 2px;
    border-radius: 50%;
}

.knob-fan {
    background:
        radial-gradient(circle, #3a4350 0 4px, #11151b 5px, transparent 6px),
        repeating-conic-gradient(from 0deg, #5c6878 0 22deg, #283039 30deg, #080a0e 36deg 72deg);
}

/* The guard: wire rings and a cross-brace, drawn in the rail's line ink. */
.knob-guard {
    --wire: color-mix(in srgb, var(--key-ink) 55%, transparent);
    background:
        linear-gradient(90deg, transparent calc(50% - 0.5px), var(--wire) calc(50% - 0.5px) calc(50% + 0.5px), transparent calc(50% + 0.5px)),
        linear-gradient(0deg, transparent calc(50% - 0.5px), var(--wire) calc(50% - 0.5px) calc(50% + 0.5px), transparent calc(50% + 0.5px)),
        repeating-radial-gradient(circle, transparent 0 3.3px, var(--wire) 3.3px 4.1px);
}

.knob-hub {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 13px;
    height: 13px;
    margin: -6.5px 0 0 -6.5px;
    box-sizing: border-box;
    border-radius: 50%;
    display: grid;
    place-items: center;
    border: 1px solid color-mix(in srgb, var(--key-ink) 70%, transparent);
    background: #05080d;
    font-family: var(--font-mono);
    font-size: 8px;
    font-weight: bold;
    line-height: 1;
    color: var(--key-ink);
    transition: background 0.15s, color 0.15s;
}

/* The lamp: dark at rest, green while the fan runs. */
.knob-led {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #1d2a24;
    transition: background 0.2s, box-shadow 0.2s;
    pointer-events: none;
}

@media (hover: hover) {
    .rig-knob:hover {
        border-color: var(--key-ink);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 0 14px color-mix(in srgb, var(--key-ink) 60%, transparent);
    }
    .rig-knob:hover .knob-tag { color: var(--key-ink); }
    .rig-knob:hover .knob-well { border-color: var(--key-ink); }
    .rig-knob:hover .knob-guard { --wire: var(--key-ink); }
    .rig-knob:hover .knob-hub { background: var(--key-ink); color: var(--bg-main); }
    .rig-knob:hover .knob-led {
        background: var(--neon-green);
        box-shadow: 0 0 6px var(--neon-green);
    }
}

.rig-knob:active {
    border-bottom-width: 1px;
    margin-top: 2px;
    height: 54px;
}

.rig-knob:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* ==========================================================================
   THE CHANNEL LIST
   Rows keep the terminal's caret and reverse-video selection. What changed is
   the furniture around them: status is a small lit AIR sign (the header's
   ON AIR lamp in miniature) and the new-posts dot (a grey ring for the muted
   log), and the moderator's move/delete keys wait behind a single ⋮ in a tray under the
   row, so every name gets the pane's width. Header and footer controls are
   keys, like the rail's.
   ========================================================================== */

.ch-list-tag {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 2px 8px;
    font-family: var(--font-mono);
    font-size: 8px;
    line-height: 9px;
    letter-spacing: 1px;
    color: color-mix(in srgb, var(--chrome) 60%, transparent);
}

.ch-list-tag i {
    flex: 1;
    height: 1px;
    background: color-mix(in srgb, var(--chrome) 22%, transparent);
}

#channel-list .channel-item .ch-name { margin-right: 0; }

#channel-list .ch-name.is-log {
    color: var(--text-secondary);
    opacity: 0.8;
}

#channel-list .channel-item.has-unread:not(.active) .ch-name {
    color: var(--text-primary);
    font-weight: 600;
}

/* A span among spans, so it undoes the name's stretch-and-clip rules. */
#channel-list .channel-item .ch-lamps {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin: 0 0 0 8px;
    overflow: visible;
}

/* New posts: a lit dot, the way it always was. */
.ch-lamp {
    display: block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--neon-cyan);
    box-shadow: 0 0 8px var(--neon-cyan);
}

/* Muted: an unlit ring. Something is there; nothing is asking for you. */
.ch-lamp.is-quiet {
    box-sizing: border-box;
    background: transparent;
    border: 1.5px solid var(--text-secondary);
    box-shadow: none;
    opacity: 0.6;
}

/* Modifier signs: the channel header's ON AIR and VOLATILE signs cut down
   to three letters that fit a row. AIR in pink, VOL in orange. Steady, like
   the header's ON AIR: a lamp that breathes all day in the corner of the eye
   is a distraction, and the colour already says it. */
.ch-lamp.ch-sign {
    --sign: var(--neon-pink);
    display: inline-flex;
    align-items: center;
    width: auto;
    height: 13px;
    padding: 0 3px 0 4px;
    box-sizing: border-box;
    border: 1px solid var(--sign);
    border-radius: 2px;
    background: color-mix(in srgb, var(--sign) 18%, transparent);
    box-shadow: 0 0 8px color-mix(in srgb, var(--sign) 35%, transparent);
    color: #fff;
    font: 700 8px/1 var(--font-mono);
    font-style: normal;
    letter-spacing: 1px;
    text-shadow: 0 0 5px var(--sign);
}

.ch-lamp.ch-sign.is-volatile { --sign: var(--neon-orange); }
/* "2 IN": the back room's light is on, and how many are under it. */
.ch-lamp.ch-sign.is-backroom { --sign: var(--neon-purple); }

/* On the selected row's solid block, the signs go dark-on-light. */
#channel-list .channel-item.active .ch-lamp.ch-sign {
    border-color: var(--bg-main);
    background: var(--bg-main);
    box-shadow: none;
    text-shadow: none;
}

.ch-menu-slot { flex: 0 0 20px; margin-left: 6px; }

/* The arrange key: three dots, out of the way until the row is pointed at. */
.ch-menu-btn {
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    margin-left: 6px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid color-mix(in srgb, var(--neon-cyan) 55%, transparent);
    border-radius: 2px;
    background: rgba(4, 7, 13, 0.6);
    color: var(--neon-cyan);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s, color 0.15s, border-color 0.15s;
}

.ch-menu-btn::before {
    content: "";
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 -5px 0 currentColor, 0 5px 0 currentColor;
}

#channel-list .channel-item:hover .ch-menu-btn,
#channel-list .channel-item.active .ch-menu-btn,
#channel-list .channel-item.tray-open .ch-menu-btn,
.ch-menu-btn:focus-visible {
    opacity: 1;
}

@media (hover: none) {
    .ch-menu-btn { opacity: 0.75; }
}

/* With a pointer, the key takes no room until its row is pointed at or
   focused, so the names keep the width. Collapsed rather than removed, so it
   can still be tabbed to; the log's placeholder is only needed where the key
   is always there. */
@media (hover: hover) {
    #channel-list .channel-item:not(:hover):not(:focus-within):not(.active):not(.tray-open) .ch-menu-btn {
        flex-basis: 0;
        width: 0;
        margin-left: 0;
        border-width: 0;
    }
    #channel-list .ch-menu-slot { display: none; }
}

@media (hover: hover) {
    .ch-menu-btn:hover {
        background: var(--neon-cyan);
        border-color: var(--neon-cyan);
        color: var(--bg-main);
    }
}

.ch-menu-btn[aria-expanded="true"] {
    background: var(--neon-cyan);
    border-color: var(--neon-cyan);
    color: var(--bg-main);
    box-shadow: 0 0 8px color-mix(in srgb, var(--neon-cyan) 60%, transparent);
}

/* On the selected row's solid block the key inverts, as the caret does. */
#channel-list .channel-item.active .ch-menu-btn {
    background: transparent;
    border-color: var(--bg-main);
    color: var(--bg-main);
    box-shadow: none;
}

#channel-list .channel-item.active .ch-menu-btn[aria-expanded="true"],
#channel-list .channel-item.active .ch-menu-btn:hover {
    background: var(--bg-main);
    color: var(--neon-accent);
}

#channel-list .channel-item.tray-open:not(.active) {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

/* The tray hangs from its row like a drawer, built like the rail's bays. */
.ch-tray {
    display: flex;
    gap: 4px;
    margin: -2px 0 6px 18px;
    padding: 6px 5px 5px;
    border: 1px solid color-mix(in srgb, var(--chrome) 35%, transparent);
    border-top: 0;
    border-radius: 0 0 3px 3px;
    background:
        repeating-linear-gradient(135deg, transparent 0 3px, color-mix(in srgb, var(--chrome) 5%, transparent) 3px 4px),
        rgba(4, 7, 13, 0.85);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.ch-tray.is-fresh { animation: ch-tray-in 0.14s ease-out; }

@keyframes ch-tray-in {
    from { opacity: 0; transform: translateY(-4px); }
}

/* Keys: a thick bottom edge for travel, as on the rail. */
.tray-key,
.plate-key {
    --key-ink: var(--neon-cyan);
    box-sizing: border-box;
    padding: 0;
    border: 1px solid var(--key-ink);
    border-bottom-width: 3px;
    border-radius: 2px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--key-ink) 16%, transparent), color-mix(in srgb, var(--key-ink) 4%, transparent));
    color: var(--key-ink);
    font-family: var(--font-mono);
    font-size: 0.6rem;
    line-height: 1;
    letter-spacing: 1px;
    cursor: pointer;
    box-shadow: 0 0 6px color-mix(in srgb, var(--key-ink) 30%, transparent);
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.tray-key {
    flex: 1;
    height: 24px;
}

.tray-key span { font-size: 0.5rem; }

/* The arrows are keys of their own, narrow, so RENAME fits beside DELETE. */
.tray-key.is-arrow { flex: 0 0 30px; font-size: 0.55rem; }

.tray-key.is-danger { --key-ink: var(--neon-pink); }

.plate-key {
    height: 24px;
    padding: 0 8px;
}

.plate-key.is-wide {
    width: 100%;
    height: 34px;
    font-size: 0.7rem;
    letter-spacing: 2px;
}

@media (hover: hover) {
    .tray-key:not(:disabled):hover,
    .plate-key:hover {
        background: var(--key-ink);
        color: var(--bg-main);
        box-shadow: 0 0 12px var(--key-ink);
    }
}

.tray-key:not(:disabled):active,
.plate-key:active {
    border-bottom-width: 1px;
    margin-top: 2px;
    height: 22px;
}

.plate-key.is-wide:active { height: 32px; }

.tray-key:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    box-shadow: none;
}

.tray-key:focus-visible,
.plate-key:focus-visible,
.ch-menu-btn:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

#admin-actions { padding: 10px; }

/* You, at the foot of the pane. */
.id-plate {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-top: 1px solid var(--border-glow);
    cursor: pointer;
    transition: background 0.15s;
}

.id-plate-face {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--neon-cyan);
    object-fit: cover;
    transition: border-color 0.15s;
}

@media (hover: hover) {
    .id-plate:hover { background: rgba(255, 255, 255, 0.04); }
    .id-plate:hover .id-plate-face { border-color: #fff; }
}

.id-plate-text { flex: 1; min-width: 0; }

.id-plate-name,
.id-plate-handle {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.id-plate-name {
    font-size: 0.9rem;
    font-weight: bold;
}

.id-plate-handle {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

@media (prefers-reduced-motion: reduce) {
    .ch-tray.is-fresh { animation: none; }
}

/* ==========================================================================
   THE COMPOSER
   The same kit as the rail and the channel list: keys with a thick bottom
   edge for travel, and between them a recessed screen with a prompt. SEND
   carries a lamp: dark while there is nothing to send, lit once there is,
   and on transmit it fires and two rings go out from the key.
   ========================================================================== */

#message-input-area {
    position: relative;
    padding: 14px 20px 18px;
    border-top: 1px solid var(--border-glow);
    background: linear-gradient(180deg, rgba(6, 10, 18, 0.2), rgba(6, 10, 18, 0.6));
}

.composer-row {
    display: flex;
    /* The keys stay down by the last line as the screen grows. */
    align-items: flex-end;
    gap: 8px;
}

.composer-key {
    --key-ink: var(--neon-cyan);
    position: relative;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    padding: 0;
    box-sizing: border-box;
    border: 1px solid var(--key-ink);
    border-bottom-width: 3px;
    border-radius: 2px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--key-ink) 16%, transparent), color-mix(in srgb, var(--key-ink) 4%, transparent));
    color: var(--key-ink);
    font-family: var(--font-mono);
    font-size: 0.6rem;
    letter-spacing: 1px;
    cursor: pointer;
    box-shadow: 0 0 6px color-mix(in srgb, var(--key-ink) 30%, transparent);
    transition: background 0.15s, color 0.15s, box-shadow 0.15s, border-color 0.15s;
}

@media (hover: hover) {
    .composer-key:hover {
        background: var(--key-ink);
        color: var(--bg-main);
        box-shadow: 0 0 14px var(--key-ink);
    }
}

.composer-key:active {
    border-bottom-width: 1px;
    margin-top: 2px;
    height: 42px;
}

.composer-key:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.composer-attach {
    flex-direction: column;
    gap: 1px;
    width: 44px;
}

.composer-attach .key-glyph {
    font-size: 1rem;
    line-height: 1;
    font-weight: bold;
}

/* The screen: a recessed pane the text is typed onto, behind a prompt. */
.composer-screen {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: flex-start;
    gap: 9px;
    min-height: 44px;
    padding: 0 12px;
    box-sizing: border-box;
    border: 1px solid color-mix(in srgb, var(--neon-cyan) 28%, transparent);
    border-radius: 3px;
    background:
        repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 3px),
        #04070c;
    box-shadow: inset 0 2px 7px rgba(0, 0, 0, 0.75);
    cursor: text;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.composer-screen:focus-within {
    border-color: var(--neon-accent);
    box-shadow: inset 0 2px 7px rgba(0, 0, 0, 0.75), 0 0 10px color-mix(in srgb, var(--neon-accent) 40%, transparent);
}

.composer-prompt {
    flex-shrink: 0;
    /* On the first line, wherever the text below it has grown to. */
    line-height: 20px;
    padding-top: 11px;
    color: var(--neon-accent);
    font-family: var(--font-mono);
    font-weight: bold;
    opacity: 0.45;
    transition: opacity 0.15s, text-shadow 0.15s;
}

.composer-screen:focus-within .composer-prompt {
    opacity: 1;
    text-shadow: 0 0 6px var(--neon-accent);
}

/* A line at a time, up to eight, then it scrolls (initComposerSizing). A
   line is 42px, so the screen round it (a pixel of border above and below)
   stands exactly as tall as the 44px keys either side. */
#message-input {
    flex: 1;
    min-width: 0;
    display: block;
    height: 42px;
    /* A line, whatever the inline height says (initComposerSizing). */
    min-height: 42px;
    max-height: 182px;
    margin: 0;
    padding: 11px 0;
    box-sizing: border-box;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 20px;
    resize: none;
    overflow-y: auto;
}

/* The placeholder stays on its line, cut short if it has to be (…), in any
   width of screen: wrapped, it stood an empty screen up to eight lines tall
   before anything had been typed, because it counts towards the height the
   screen is sized to. */
#message-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* SEND. Nothing to send: a dimmed key with a dark lamp. */
.composer-send {
    gap: 8px;
    width: 86px;
    font-size: 0.72rem;
    font-weight: bold;
    letter-spacing: 2px;
    --send-edge: color-mix(in srgb, var(--key-ink) 50%, transparent);
    --send-ink: color-mix(in srgb, var(--key-ink) 60%, transparent);
    --send-glow: none;
    border-color: var(--send-edge);
    color: var(--send-ink);
    box-shadow: var(--send-glow);
}

.send-led {
    flex-shrink: 0;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #1d2a24;
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.7);
    transition: background 0.15s, box-shadow 0.15s;
}

/* Something to send, typed or attached: the key comes up to full and its
   lamp goes green. :placeholder-shown tracks the field however its value
   changed (typing, a restored draft, a failed send put back). */
#message-input-area:has(#message-input:not(:placeholder-shown)) .composer-send,
#message-input-area:has(#image-preview:not([style*="none"])) .composer-send {
    --send-edge: var(--key-ink);
    --send-ink: var(--key-ink);
    --send-glow: 0 0 8px color-mix(in srgb, var(--key-ink) 40%, transparent);
}

#message-input-area:has(#message-input:not(:placeholder-shown)) .send-led,
#message-input-area:has(#image-preview:not([style*="none"])) .send-led {
    background: var(--neon-green);
    box-shadow: 0 0 6px var(--neon-green);
}

@media (hover: hover) {
    .composer-send:hover .send-led {
        box-shadow: 0 0 0 1px var(--bg-main), 0 0 6px var(--neon-green);
    }
}

/* Transmit: the lamp flashes white-pink and two outlines of the key go out
   from it and fade, one cyan, one pink. Transform and opacity; one pass. */
.send-wave,
.send-wave::after {
    position: absolute;
    inset: -1px -1px -3px;
    border: 2px solid var(--neon-cyan);
    border-radius: 3px;
    opacity: 0;
    pointer-events: none;
}

.send-wave::after {
    content: "";
    inset: -2px;
    border-color: var(--neon-pink);
}

.composer-send.is-firing .send-wave { animation: send-ring 0.6s cubic-bezier(0.2, 0.6, 0.3, 1); }
.composer-send.is-firing .send-wave::after { animation: send-ring-2 0.6s cubic-bezier(0.2, 0.6, 0.3, 1) 0.1s both; }
.composer-send.is-firing .send-led { animation: send-flash 0.6s steps(1, end); }

@keyframes send-ring {
    0% { opacity: 0.95; transform: scale(1); }
    100% { opacity: 0; transform: scale(1.35, 1.9); }
}

@keyframes send-ring-2 {
    0% { opacity: 0.9; transform: scale(1); }
    100% { opacity: 0; transform: scale(1.25, 1.6); }
}

@keyframes send-flash {
    0% { background: #fff; box-shadow: 0 0 10px #fff, 0 0 18px var(--neon-pink); }
    25% { background: var(--neon-pink); box-shadow: 0 0 10px var(--neon-pink); }
    50% { background: #fff; box-shadow: 0 0 10px #fff; }
    75% { background: var(--neon-pink); box-shadow: 0 0 8px var(--neon-pink); }
}

/* The strips over the composer: what it is replying to, what it carries. */
.composer-strip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 20px;
    border-top: 1px solid var(--border-glow);
    background: color-mix(in srgb, var(--neon-cyan) 6%, rgba(6, 10, 18, 0.7));
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-secondary);
}

#image-preview .composer-strip {
    margin: 10px 0 0;
    padding: 6px;
    border: 1px solid color-mix(in srgb, var(--chrome) 30%, transparent);
    border-radius: 3px;
}

.composer-tag {
    flex-shrink: 0;
    padding: 2px 5px;
    border: 1px solid color-mix(in srgb, var(--neon-cyan) 55%, transparent);
    border-radius: 2px;
    color: var(--neon-cyan);
    font-size: 0.55rem;
    letter-spacing: 1.5px;
}

.composer-strip-text {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.composer-strip-text b { color: var(--text-primary); }

/* The pictures waiting to go: a thumbnail each, its ✕ in the corner. */
.attach-thumbs {
    display: flex;
    flex: 1;
    min-width: 0;
    gap: 6px;
    overflow-x: auto;
    padding: 2px 0;
    /* Scrolls when there are more than fit, without a lit bar under them. */
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--neon-cyan) 30%, transparent) transparent;
}
.attach-thumb { position: relative; flex: none; }
.attach-thumb img {
    display: block;
    height: 56px;
    max-width: 120px;
    object-fit: cover;
    border: 1px solid color-mix(in srgb, var(--neon-cyan) 50%, transparent);
    border-radius: 2px;
}
.attach-drop {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    padding: 0;
    border: 1px solid var(--neon-pink);
    border-radius: 2px;
    background: rgba(4, 7, 12, 0.85);
    color: var(--neon-pink);
    font: 700 0.6rem/1 var(--font-mono);
    cursor: pointer;
}
.attach-drop:hover { background: var(--neon-pink); color: #0a0306; }
.attach-more {
    flex: none;
    width: 40px;
    height: 56px;
    border: 1px dashed color-mix(in srgb, var(--neon-cyan) 45%, transparent);
    border-radius: 2px;
    background: transparent;
    color: var(--neon-cyan);
    font: 700 1.1rem var(--font-mono);
    cursor: pointer;
}
.attach-more:hover { background: color-mix(in srgb, var(--neon-cyan) 10%, transparent); }
/* Pictures dragged over the composer: it says it will take them. */
#message-input-area.is-dropping .composer-screen {
    border-color: var(--neon-cyan);
    border-style: dashed;
    box-shadow: inset 0 0 18px color-mix(in srgb, var(--neon-cyan) 25%, transparent);
}

/* A gallery post: its pictures as tiles, two across, the last saying how
   many more there are. Three: one tall on the left, two stacked. */
.msg-gallery {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 150px;
    gap: 4px;
    width: min(100%, 420px);
    margin-top: 10px;
}
.msg-gallery .msg-media,
.msg-gallery-more {
    display: block;
    width: 100%;
    height: 100%;
    min-width: 0;
    border-radius: 6px;
    border: 1px solid var(--border-glow);
    background: rgba(0, 255, 255, 0.05);
    object-fit: cover;
    box-sizing: border-box;
}
.msg-gallery.g-2 { grid-auto-rows: 200px; }
.msg-gallery.g-3 > :first-child { grid-row: span 2; }
.msg-gallery-more { position: relative; overflow: hidden; border: 0; }
.msg-gallery-more .msg-media { border-radius: 6px; }
.msg-gallery-more b {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    border-radius: 6px;
    background: rgba(2, 4, 8, 0.6);
    color: #fff;
    font: 700 1.9rem var(--font-mono);
    letter-spacing: 2px;
    text-shadow: 0 0 12px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    z-index: 10002;
}

.composer-strip .plate-key { flex-shrink: 0; height: 22px; }
.composer-strip .plate-key:active { height: 20px; }

.plate-key.is-danger { --key-ink: var(--neon-pink); }

@media (prefers-reduced-motion: reduce) {
    .composer-send.is-firing .send-wave,
    .composer-send.is-firing .send-wave::after { animation: none; }
}

/* ==========================================================================
   THE CHANNEL HEADER
   The name with the glyph its room wears in the list, then its signs (ON
   AIR, VOLATILE), all one height with the settings key after them. The uplink pip
   at the far end sits in a socket, a lamp on the panel rather than a dot.
   ========================================================================== */

#current-channel-name {
    flex: 1;
    min-width: 0;
}

.chan-title {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chan-glyph { margin-right: 7px; }
.chan-glyph.glyph-deck { color: var(--neon-pink); }
.chan-glyph.glyph-arcade { color: var(--neon-blue); }
.chan-glyph.glyph-wall { color: var(--neon-green); }
.chan-glyph.glyph-backroom { color: var(--neon-purple); }

/* Signs and the key, level with each other. */
#current-channel-name .on-air-lamp,
#current-channel-name .chan-sign,
#current-channel-name .chan-gear {
    flex-shrink: 0;
    height: 24px;
    margin-left: 10px;
    box-sizing: border-box;
}

#current-channel-name .on-air-lamp { padding: 0 9px; }

/* VOLATILE: the ON AIR sign's pattern in orange. Its lamp stutters now and
   then, stepped, like a buffer about to drop something. */
.chan-sign {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 9px;
    border: 1px solid var(--neon-orange);
    border-radius: 3px;
    background: color-mix(in srgb, var(--neon-orange) 14%, transparent);
    color: #fff;
    font: 700 0.62rem/1 var(--font-mono);
    letter-spacing: 2px;
    text-shadow: 0 0 6px var(--neon-orange);
    box-shadow: 0 0 12px color-mix(in srgb, var(--neon-orange) 35%, transparent);
    cursor: help;
}

.chan-sign i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--neon-orange);
    box-shadow: 0 0 8px var(--neon-orange);
    /* Stutters in the ambient burst. */
}

@keyframes volatile-stutter {
    0%, 70%, 76%, 84%, 100% { opacity: 1; }
    72%, 80% { opacity: 0.25; }
}

.chan-gear {
    width: 28px;
    padding: 0;
    font-size: 0.85rem;
    letter-spacing: 0;
}

.chan-gear:active { height: 22px; }

/* The uplink pip, set in a socket. */
#uplink-pip {
    margin-left: 12px;
    box-shadow: 0 0 0 2px #04070c, 0 0 0 3px color-mix(in srgb, var(--chrome) 28%, transparent);
}

#uplink-pip.uplink-live {
    box-shadow: 0 0 0 2px #04070c, 0 0 0 3px color-mix(in srgb, var(--chrome) 28%, transparent), 0 0 8px var(--neon-green);
}

#uplink-pip.uplink-degraded {
    box-shadow: 0 0 0 2px #04070c, 0 0 0 3px color-mix(in srgb, var(--chrome) 28%, transparent), 0 0 8px var(--neon-orange);
}

@media (prefers-reduced-motion: reduce) {
    .chan-sign i { animation: none; }
}

/* ==========================================================================
   THE DOOMED DIALOG
   For what cannot be undone. What is about to go sits on a hazard-striped
   plate over a lit red key; confirmed, the plate collapses like a tube
   switching off before the dialog closes.
   ========================================================================== */

.dialog-card.is-doomed { width: 440px; }
.dialog-card.is-doomed .terminal-label { color: var(--neon-pink); }

.doom-plate {
    display: inline-flex;
    max-width: 100%;
    box-sizing: border-box;
    margin: 16px 0 4px;
    padding: 4px;
    border-radius: 3px;
    background: repeating-linear-gradient(-45deg, var(--neon-pink) 0 7px, #0a0d14 7px 14px);
    box-shadow: 0 0 14px color-mix(in srgb, var(--neon-pink) 35%, transparent);
}

.doom-plate span {
    min-width: 0;
    padding: 7px 14px;
    border-radius: 1px;
    background: #0a0d14;
    color: #fff;
    font: 700 1.05rem/1.2 var(--font-mono);
    letter-spacing: 2px;
    text-transform: uppercase;
    text-shadow: 0 0 8px var(--neon-pink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.is-doomed .dialog-actions {
    align-items: flex-end;
    gap: 12px;
    margin-top: 22px;
}

.doom-key {
    --key-ink: var(--neon-pink);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    height: 40px;
    padding: 0 22px;
    box-sizing: border-box;
    border: 1px solid var(--key-ink);
    border-bottom-width: 3px;
    border-radius: 2px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--key-ink) 30%, transparent), color-mix(in srgb, var(--key-ink) 10%, transparent));
    color: #fff;
    font: 700 0.75rem/1 var(--font-mono);
    letter-spacing: 3px;
    text-shadow: 0 0 8px var(--key-ink);
    box-shadow: 0 0 16px color-mix(in srgb, var(--key-ink) 50%, transparent);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.doom-led {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ff3b3b;
    box-shadow: 0 0 8px #ff3b3b, 0 0 14px var(--neon-pink);
}

@media (hover: hover) {
    .doom-key:hover {
        background: var(--key-ink);
        color: var(--bg-main);
        text-shadow: none;
    }
    .doom-key:hover .doom-led { box-shadow: 0 0 0 1px var(--bg-main), 0 0 8px #ff3b3b; }
}

.doom-key:active {
    border-bottom-width: 1px;
    margin-top: 2px;
    height: 38px;
}

.doom-key:focus-visible,
.abort-key:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

.abort-key {
    --key-ink: var(--text-secondary);
    height: 40px;
    padding: 0 16px;
    font-size: 0.7rem;
    letter-spacing: 2px;
}

.abort-key:active { height: 38px; }

/* Someone's words on the plate (DELETE_MESSAGE), not a name: their own
   case and a lighter weight. */
.doom-plate.is-quote span {
    text-transform: none;
    font-weight: 400;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
}

/* The plain dialog on the kit's keys: no plate, a lit key to go on (pink
   for danger), the grey key to back out. */
.dialog-card.is-plain .dialog-keys .plate-key:not(.abort-key) { min-width: 120px; }
.dialog-card.is-plain.is-danger { border-color: color-mix(in srgb, var(--neon-pink) 40%, transparent); }

/* Confirmed: the plate folds to a bright line and goes out; the rest dims. */
.dialog-card.is-purging .doom-plate { animation: doom-purge 0.46s cubic-bezier(0.5, 0, 0.8, 0.4) forwards; }
.dialog-card.is-purging .dialog-message,
.dialog-card.is-purging .dialog-actions { transition: opacity 0.3s; opacity: 0.25; }

/* Scrub: a bright bar runs across the plate and leaves it redacted. */
.doom-plate span { position: relative; }

.doom-plate span::before {
    content: attr(data-redact);
    position: absolute;
    inset: 0;
    padding: 7px 14px;
    overflow: hidden;
    background: #0a0d14;
    color: var(--neon-pink);
    letter-spacing: 2px;
    white-space: nowrap;
    text-shadow: 0 0 6px var(--neon-pink);
    clip-path: inset(0 100% 0 0);
    pointer-events: none;
}

.doom-plate span::after {
    content: "";
    position: absolute;
    top: -2px;
    bottom: -2px;
    left: 0;
    width: 3px;
    background: #fff;
    box-shadow: 0 0 10px #fff, 0 0 18px var(--neon-pink);
    opacity: 0;
    pointer-events: none;
}

.dialog-card.is-purging.purge-scrub .doom-plate { animation: none; }
.dialog-card.is-purging.purge-scrub .doom-plate span::before { animation: scrub-redact 0.55s linear forwards; }
.dialog-card.is-purging.purge-scrub .doom-plate span::after { animation: scrub-bar 0.55s linear forwards; }

@keyframes scrub-redact {
    to { clip-path: inset(0 0 0 0); }
}

@keyframes scrub-bar {
    0% { left: 0; opacity: 1; }
    95% { opacity: 1; }
    100% { left: 100%; opacity: 0; }
}

@keyframes doom-purge {
    0% { transform: none; opacity: 1; }
    35% { transform: scale(1.04, 0.1); opacity: 1; }
    70% { transform: scale(0.5, 0.04); opacity: 0.9; }
    100% { transform: scale(0, 0.02); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .dialog-card.is-purging .doom-plate,
    .dialog-card.is-purging .doom-plate span::before,
    .dialog-card.is-purging .doom-plate span::after { animation: none; }
}

/* ==========================================================================
   THE CABINET ON A DESK
   Built from the same kit as the rail: a HUB key and a lit marquee along the
   top, the screen in a hatched bezel, and beside it a console of bays: the
   score on an LCD (ghost 8s behind the digits, paddle lamps for Grubout),
   the week's board, and the controls as keycaps. --cab is the game's colour.
   ========================================================================== */

.arcade-desk {
    --cab: var(--neon-cyan);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 22px;
    min-height: 100%;
    box-sizing: border-box;
    padding: 18px 24px 32px;
    font-family: var(--font-mono);
}

/* Sized to the cabinet, so the HUB key lines up with the bezel's edge. */
.desk-frame {
    display: flex;
    flex-direction: column;
    gap: 22px;
    max-width: 100%;
}

.desk-top {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    width: 100%;
}

.desk-hub {
    justify-self: start;
    height: 30px;
    padding: 0 12px;
    font-size: 0.65rem;
    letter-spacing: 2px;
}

.desk-hub:active { height: 28px; }

/* The marquee: a lit sign in the game's colour. */
.desk-marquee {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 26px 10px;
    border: 1px solid var(--cab);
    border-radius: 4px;
    background:
        repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 3px),
        color-mix(in srgb, var(--cab) 12%, rgba(4, 7, 13, 0.9));
    box-shadow: 0 0 22px color-mix(in srgb, var(--cab) 35%, transparent), inset 0 0 18px color-mix(in srgb, var(--cab) 18%, transparent);
}

.marquee-kicker {
    font-size: 0.55rem;
    letter-spacing: 4px;
    color: color-mix(in srgb, var(--cab) 70%, #fff);
    opacity: 0.8;
}

.marquee-title {
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: 4px;
    color: #fff;
    text-shadow: 0 0 8px var(--cab), 0 0 18px var(--cab);
}

.desk-body {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    flex-wrap: wrap;
    gap: 22px;
}

/* Bays: the rail's hatched housing with a tag across the top. */
.desk-bezel,
.desk-bay {
    position: relative;
    box-sizing: border-box;
    border: 1px solid color-mix(in srgb, var(--chrome) 35%, transparent);
    border-radius: 4px;
    background:
        repeating-linear-gradient(135deg, transparent 0 3px, color-mix(in srgb, var(--chrome) 5%, transparent) 3px 4px),
        rgba(4, 7, 13, 0.85);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 2px 10px rgba(0, 0, 0, 0.5);
}

.desk-bezel { padding: 22px 16px 16px; }

.desk-tag {
    display: block;
    font-size: 8px;
    line-height: 9px;
    letter-spacing: 2px;
    color: color-mix(in srgb, var(--chrome) 60%, transparent);
}

.desk-bezel > .desk-tag {
    position: absolute;
    top: 7px;
    left: 16px;
}

.desk-console {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 260px;
}

.desk-bay { padding: 10px 12px 12px; }

/* The LCD. */
.readout-value {
    position: relative;
    margin-top: 8px;
    padding: 6px 12px;
    border-radius: 3px;
    background: #03060a;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.9);
    font-size: 2.1rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: 6px;
    text-align: right;
}

.readout-ghost {
    position: absolute;
    right: 6px;
    color: var(--cab);
    opacity: 0.08;
}

.readout-digits {
    position: relative;
    color: var(--cab);
    text-shadow: 0 0 8px var(--cab);
}

.readout-paddles {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
}

.paddle-pips { display: flex; gap: 6px; }

.paddle-pips i {
    width: 22px;
    height: 7px;
    border-radius: 4px;
    background: color-mix(in srgb, var(--cab) 15%, #0a0d14);
    transition: background 0.2s, box-shadow 0.2s;
}

.paddle-pips i.is-live {
    background: var(--cab);
    box-shadow: 0 0 8px var(--cab);
}

/* The board. Shared with the phone cabinet, where it sits under the play. */
.arcade-board { width: 250px; }
.desk-bay .arcade-board { width: auto; }

.arcade-touch .arcade-board {
    box-sizing: border-box;
    padding: 12px;
    border: 1px solid color-mix(in srgb, var(--chrome) 30%, transparent);
    border-radius: 4px;
    background: rgba(4, 7, 13, 0.7);
}

.lb-heading {
    margin-bottom: 8px;
    font-size: 8px;
    line-height: 11px;
    letter-spacing: 2px;
    color: color-mix(in srgb, var(--chrome) 60%, transparent);
}

.lb-row {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 5px 0;
    border-top: 1px dashed color-mix(in srgb, var(--chrome) 14%, transparent);
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.lb-row:first-child { border-top: 0; }

.lb-rank {
    flex-shrink: 0;
    width: 18px;
    height: 16px;
    border: 1px solid color-mix(in srgb, var(--chrome) 35%, transparent);
    border-radius: 2px;
    font-size: 0.6rem;
    line-height: 16px;
    text-align: center;
}

.lb-name {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lb-score {
    flex-shrink: 0;
    color: var(--cab, var(--neon-cyan));
    font-weight: 700;
    letter-spacing: 1px;
}

.lb-row.is-first { color: #ffd84a; }

.lb-row.is-first .lb-rank {
    border-color: #ffd84a;
    background: #ffd84a;
    color: #1a1400;
    box-shadow: 0 0 8px color-mix(in srgb, #ffd84a 50%, transparent);
}

.lb-empty {
    padding: 6px 0;
    font-size: 0.65rem;
    color: var(--text-secondary);
    opacity: 0.8;
}

/* The controls, as the keys you press. */
.legend-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 8px;
}

.legend-caps { display: flex; gap: 4px; }

.legend-caps kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 4px;
    box-sizing: border-box;
    border: 1px solid color-mix(in srgb, var(--chrome) 45%, transparent);
    border-bottom-width: 3px;
    border-radius: 3px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    line-height: 1;
}

.legend-caps kbd.is-wide {
    padding: 0 7px;
    font-size: 0.55rem;
    letter-spacing: 1px;
}

.legend-action {
    font-size: 0.6rem;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
    text-align: right;
}

/* The doomed dialog's typed confirmation: a recessed screen behind a >
   prompt, and a key that stays dark and locked until the words match. */
.doom-field {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 44px;
    margin-top: 14px;
    padding: 0 14px;
    box-sizing: border-box;
    border: 1px solid color-mix(in srgb, var(--neon-pink) 35%, transparent);
    border-radius: 3px;
    background:
        repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 3px),
        #04070c;
    box-shadow: inset 0 2px 7px rgba(0, 0, 0, 0.75);
    cursor: text;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.doom-field:focus-within {
    border-color: var(--neon-pink);
    box-shadow: inset 0 2px 7px rgba(0, 0, 0, 0.75), 0 0 10px color-mix(in srgb, var(--neon-pink) 35%, transparent);
}

.doom-prompt {
    color: var(--neon-pink);
    font-family: var(--font-mono);
    font-weight: bold;
    opacity: 0.6;
}

.doom-field:focus-within .doom-prompt { opacity: 1; text-shadow: 0 0 6px var(--neon-pink); }

#dialog-overlay .doom-field input {
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 0;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    letter-spacing: 1px;
}

#dialog-overlay .doom-field input::placeholder { color: var(--text-secondary); opacity: 0.5; }

@media (pointer: coarse) {
    #dialog-overlay .doom-field input { font-size: 16px; }
}

/* Locked: dark, flat, and not taking presses. */
.doom-key.is-locked {
    border-color: color-mix(in srgb, var(--key-ink) 35%, transparent);
    background: transparent;
    color: color-mix(in srgb, var(--key-ink) 45%, transparent);
    text-shadow: none;
    box-shadow: none;
    cursor: not-allowed;
}

.doom-key.is-locked .doom-led {
    background: #3a1420;
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.7);
}

@media (hover: hover) {
    .doom-key.is-locked:hover {
        background: transparent;
        color: color-mix(in srgb, var(--key-ink) 45%, transparent);
    }
    .doom-key.is-locked:hover .doom-led { box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.7); }
}

.doom-key.is-locked:active {
    border-bottom-width: 3px;
    margin-top: 0;
    height: 40px;
}

/* ==========================================================================
   SUCCESSION_PROTOCOL
   The doomed dialog in amber, for a sector changing hands rather than
   ending. Under the plate, the handover: you, three arrows, your heir, and
   an OWNER tag over you that slides across to them when you confirm.
   ========================================================================== */

.dialog-card.is-doomed.tone-handoff .terminal-label { color: var(--warn); }

.tone-handoff .doom-plate {
    background: repeating-linear-gradient(-45deg, var(--warn) 0 7px, #0a0d14 7px 14px);
    box-shadow: 0 0 14px color-mix(in srgb, var(--warn) 30%, transparent);
}

.tone-handoff .doom-plate span { text-shadow: 0 0 8px var(--warn); }

.tone-handoff .doom-key { --key-ink: var(--warn); }

.tone-handoff .doom-led {
    background: var(--warn);
    box-shadow: 0 0 8px var(--warn);
}

/* The plate stays put on a handover: it is the sector, and it carries on. */
.dialog-card.is-purging.purge-handoff .doom-plate { animation: none; }

.handoff {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 44px 1fr;
    align-items: center;
    margin: 14px 0 2px;
    padding-top: 22px;
}

.handoff-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    min-width: 0;
    padding: 8px 6px;
    border: 1px solid color-mix(in srgb, var(--chrome) 30%, transparent);
    border-radius: 3px;
    background: rgba(4, 7, 13, 0.85);
    font-family: var(--font-mono);
}

.handoff-chip b {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #fff;
    font-size: 0.8rem;
}

.handoff-chip span {
    font-size: 0.5rem;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
}

.handoff-chip.is-to {
    border-color: color-mix(in srgb, var(--warn) 55%, transparent);
    box-shadow: 0 0 10px color-mix(in srgb, var(--warn) 18%, transparent);
}

.handoff-chip.is-to span { color: var(--warn); }

.handoff-arrow {
    display: flex;
    justify-content: center;
    color: color-mix(in srgb, var(--warn) 35%, transparent);
    font-size: 0.8rem;
}

.handoff-arrow i { font-style: normal; }

/* The tag, over you to begin with; on confirm it travels to the heir. */
.owner-tag {
    position: absolute;
    top: 0;
    left: calc((100% - 44px) / 4 - 30px);
    width: 60px;
    padding: 2px 0;
    border-radius: 2px;
    background: var(--warn);
    color: #05070c;
    font: 700 0.52rem var(--font-mono);
    letter-spacing: 2px;
    text-align: center;
    box-shadow: 0 0 10px color-mix(in srgb, var(--warn) 50%, transparent);
    transition: left 0.6s cubic-bezier(0.5, 0, 0.2, 1);
}

.dialog-card.is-purging.purge-handoff .owner-tag {
    left: calc(100% - (100% - 44px) / 4 - 30px);
}

.dialog-card.is-purging.purge-handoff .handoff-arrow i {
    animation: handoff-arrow 0.6s steps(1, end) forwards;
}

.dialog-card.is-purging.purge-handoff .handoff-arrow i:nth-child(2) { animation-delay: 0.15s; }
.dialog-card.is-purging.purge-handoff .handoff-arrow i:nth-child(3) { animation-delay: 0.3s; }

@keyframes handoff-arrow {
    to { color: var(--warn); text-shadow: 0 0 6px var(--warn); }
}

@media (prefers-reduced-motion: reduce) {
    .owner-tag { transition: none; }
    .dialog-card.is-purging.purge-handoff .handoff-arrow i { animation: none; color: var(--warn); }
}

/* ---- PATCH_IN and NEW_SECTOR: keys with a lamp, fields as screens ---- */

.plate-key.sector-key.is-raise { --key-ink: var(--neon-pink); }

.key-lamp {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #1d2a24;
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.7);
    transition: background 0.15s, box-shadow 0.15s;
}

/* Lit once there is a handle to dial, or to raise. */
.panel-join:has(#join-handle:not(:placeholder-shown)) #confirm-join .key-lamp,
.panel-new:has(#new-server-handle:not(:placeholder-shown)) #create-srv-exec .key-lamp {
    background: var(--neon-green);
    box-shadow: 0 0 6px var(--neon-green);
}

.sector-panel .forge-name .input-field,
.sector-panel .charter-name-field {
    height: 44px;
    border-radius: 3px;
    border-color: color-mix(in srgb, var(--neon-cyan) 28%, transparent) !important;
    background:
        repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 3px),
        #04070c !important;
    box-shadow: inset 0 2px 7px rgba(0, 0, 0, 0.75);
}

.sector-panel .forge-name .input-field:focus,
.sector-panel .charter-name-field:focus {
    border-color: var(--neon-accent) !important;
    box-shadow: inset 0 2px 7px rgba(0, 0, 0, 0.75), 0 0 10px color-mix(in srgb, var(--neon-accent) 40%, transparent);
}

/* ==========================================================================
   EXFILTRATION_PROTOCOL (sector settings, admins only)
   A bay with what it does, the warning in amber, a phosphor screen that
   logs the copy as it is made, and the key. The key's lamp is dark until a
   copy has come out clean.
   ========================================================================== */

.exfil-bay {
    padding: 14px;
    border: 1px solid color-mix(in srgb, var(--chrome) 32%, transparent);
    border-radius: 4px;
    background:
        repeating-linear-gradient(135deg, transparent 0 3px, color-mix(in srgb, var(--chrome) 5%, transparent) 3px 4px),
        rgba(4, 7, 13, 0.85);
}

.exfil-bay p {
    margin: 0 0 10px;
    font-size: 0.78rem;
    line-height: 1.5;
    color: var(--text-primary);
}

.exfil-bay .exfil-warn {
    padding-left: 10px;
    border-left: 2px solid var(--amber);
    color: color-mix(in srgb, var(--amber) 85%, #fff);
}

.exfil-screen {
    height: 118px;
    margin: 12px 0;
    padding: 8px 12px;
    overflow-y: auto;
    border-radius: 6px / 10px;
    background:
        repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.35) 0 1px, transparent 1px 3px),
        radial-gradient(ellipse at 50% 40%, #0d2016, #030805 75%);
    box-shadow: 0 0 0 2px #05070c, 0 0 0 3px color-mix(in srgb, var(--chrome) 30%, transparent), inset 0 0 10px rgba(0, 0, 0, 0.9);
    font: 0.62rem/1.6 var(--font-mono);
    letter-spacing: 1px;
    color: #6dffab;
    text-shadow: 0 0 5px color-mix(in srgb, #35e08a 70%, transparent);
}

.exfil-screen .is-ok { color: #fff; }
.exfil-screen .is-fail { color: var(--neon-pink); text-shadow: 0 0 5px var(--neon-pink); }

.exfil-keys {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.plate-key.exfil-key {
    --key-ink: var(--amber);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 16px;
    font-size: 0.68rem;
    letter-spacing: 2px;
}

.plate-key.exfil-key:active { height: 34px; }

/* No lamp: it only lit on hover, and the log screen beside the key already
   says what the run is doing. */
.exfil-key.is-running { cursor: progress; }

#exfil-save[hidden] { display: none; }

/* ==========================================================================
   THE TERMINAL'S OWN CONTROLS (js/terminal.js)
   The switcher, the key card, the status line, permalink cards in the talk,
   and the key that counts new traffic below where you are reading.
   ========================================================================== */

/* ---- The status line: the terminal's bottom row. Desktop only. ---- */
.status-line {
    flex: none;
    display: flex;
    align-items: center;
    gap: 12px;
    height: 24px;
    padding: 0 14px;
    border-top: 1px solid color-mix(in srgb, var(--chrome) 22%, transparent);
    background: linear-gradient(180deg, #05080d, #000);
    font: 700 0.58rem/1 var(--font-mono);
    letter-spacing: 1.5px;
    color: var(--ink-dim);
    white-space: nowrap;
}
.status-line .sl-uplink { display: inline-flex; align-items: center; gap: 6px; color: var(--ok); }
.status-line .sl-uplink i { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.status-line .sl-uplink.is-degraded { color: var(--amber); }
.status-line .sl-uplink.is-degraded i { background: var(--amber); box-shadow: 0 0 6px var(--amber); }
.status-line .sl-rule { width: 1px; height: 10px; background: color-mix(in srgb, var(--chrome) 25%, transparent); }
.status-line .sl-where { color: var(--chrome); overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.status-line .sl-gap { flex: 1; }
.status-line .sl-hint { padding: 0; border: 0; background: none; color: var(--ink-dim); font: inherit; letter-spacing: inherit; cursor: pointer; }
.status-line .sl-hint:hover, .status-line .sl-hint:focus-visible { color: var(--chrome); }
.status-line .sl-hint.is-flash { color: var(--amber); }
.status-line .sl-brand { color: color-mix(in srgb, var(--ink) 40%, transparent); }
.status-line .sl-clock { color: var(--amber); font-variant-numeric: tabular-nums; }

@media (min-width: 769px) {
    #layout-wrapper { height: calc(100% - 24px); }
}
@media (max-width: 768px) {
    .status-line { display: none; }
}
@media (hover: none) {
    .status-line .sl-hint { display: none; }
}

/* ---- Keycaps, wherever a key is named ---- */
.switcher kbd,
.keycard kbd {
    display: inline-block;
    min-width: 22px;
    padding: 3px 6px 2px;
    border: 1px solid color-mix(in srgb, var(--chrome) 45%, transparent);
    border-bottom-width: 3px;
    border-radius: 3px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
    color: var(--chrome);
    font: 700 0.62rem/1.2 var(--font-mono);
    text-align: center;
}

/* ---- The switcher ---- */
.switcher { width: 520px; max-width: calc(100vw - 32px); }
.switcher-screen {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    padding: 12px 16px;
    border-radius: 8px / 14px;
    background:
        repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.35) 0 1px, transparent 1px 3px),
        radial-gradient(ellipse at 50% 40%, #0d2016, #030805 75%);
    box-shadow: 0 0 0 2px #05070c, 0 0 0 3px color-mix(in srgb, var(--chrome) 30%, transparent), inset 0 0 12px rgba(0, 0, 0, 0.9);
    color: #6dffab;
    font: 700 1rem var(--font-mono);
    text-shadow: 0 0 6px color-mix(in srgb, #35e08a 70%, transparent);
}
.switcher-screen input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: #9dffc6;
    font: 400 1rem var(--font-mono);
    text-shadow: inherit;
    caret-color: #6dffab;
}
.switcher-screen input::placeholder { color: rgba(109, 255, 171, 0.35); }
.switcher-list { display: flex; flex-direction: column; gap: 2px; margin-top: 12px; max-height: 50vh; overflow-y: auto; }
.switcher-row {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: none;
    color: var(--ink);
    font: 400 0.85rem var(--font-mono);
    text-align: left;
    cursor: pointer;
}
.switcher-row.is-active {
    border-color: color-mix(in srgb, var(--chrome) 55%, transparent);
    background: color-mix(in srgb, var(--chrome) 12%, transparent);
    box-shadow: inset 3px 0 0 var(--chrome);
}
.switcher-row .sw-glyph { color: var(--chrome); font-weight: 700; text-align: center; }
.switcher-row .sw-sector { color: var(--hot); }
.switcher-row .sw-link { color: #bc13fe; }
.switcher-row .sw-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switcher-row .sw-sub { color: var(--ink-dim); font-size: 0.62rem; letter-spacing: 1px; white-space: nowrap; }
.switcher-row.is-here .sw-sub { color: var(--amber); }
.switcher-row .sw-lamp { width: 7px; height: 7px; border-radius: 50%; background: var(--chrome); box-shadow: 0 0 6px var(--chrome); }
.switcher-none { padding: 18px 10px; color: var(--ink-dim); font: 700 0.7rem var(--font-mono); letter-spacing: 2px; text-align: center; }
.switcher-foot { display: flex; align-items: center; gap: 6px; margin-top: 12px; color: var(--ink-dim); font: 700 0.58rem var(--font-mono); letter-spacing: 1.5px; }
.switcher-foot kbd { min-width: 0; margin-left: 6px; }
.switcher-foot kbd:first-child { margin-left: 0; }

/* ---- The key card ---- */
.keycard { width: 460px; max-width: calc(100vw - 32px); max-height: calc(100dvh - 32px); overflow-y: auto; }
.keycard-group { margin: 18px 0 6px; color: var(--chrome); font: 700 0.6rem var(--font-mono); letter-spacing: 3px; opacity: 0.8; }

/* The key card on a wide window: its groups side by side, in two or three
   columns, so it fits without scrolling. A group is never split. */
.keycard-sec { break-inside: avoid; }
.keycard-sec .keycard-group { margin-top: 0; padding-top: 18px; }
@media (min-width: 780px) {
    .keycard.is-wide { width: min(780px, calc(100vw - 48px)); }
    .keycard.is-wide .keycard-secs { column-count: 2; column-gap: 40px; }
    .keycard.is-wide .keycard-row { grid-template-columns: 136px minmax(0, 1fr); gap: 12px; }
}
@media (min-width: 1100px) {
    .keycard.is-wide { width: min(1160px, calc(100vw - 64px)); }
    .keycard.is-wide .keycard-secs { column-count: 3; }
}
.keycard-row { display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 16px; padding: 6px 0; border-bottom: 1px dashed color-mix(in srgb, var(--chrome) 14%, transparent); font-size: 0.85rem; }
.keycard-keys { display: inline-flex; align-items: center; gap: 4px; flex: none; }
.keycard-keys i { color: var(--ink-dim); font-style: normal; font-size: 0.7rem; }
/* A slash command on the key card: a wide keycap that types itself. */
.keycard-cmd {
    padding: 3px 8px 2px;
    border: 1px solid color-mix(in srgb, var(--amber) 45%, transparent);
    border-bottom-width: 3px;
    border-radius: 3px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
    color: var(--amber);
    font: 700 0.62rem/1.2 var(--font-mono);
    white-space: nowrap;
    cursor: pointer;
}
.keycard-cmd:hover, .keycard-cmd:focus-visible { background: color-mix(in srgb, var(--amber) 18%, transparent); outline: none; }
.keycard-cmd:active { border-bottom-width: 1px; margin-top: 2px; }

/* ---- New traffic below: a key at the foot of the list ---- */
.new-dock {
    position: sticky;
    bottom: 0;
    height: 0;
    flex: none;
    align-self: center;
    z-index: 10040;
}
.plate-key.new-key {
    --key-ink: var(--chrome);
    position: absolute;
    left: 50%;
    bottom: 14px;
    transform: translateX(-50%);
    height: 32px;
    padding: 0 16px;
    font-size: 0.68rem;
    letter-spacing: 2px;
    white-space: nowrap;
    background: #061018;
    box-shadow: 0 0 16px color-mix(in srgb, var(--chrome) 45%, transparent), 0 8px 18px rgba(0, 0, 0, 0.6);
}
.plate-key.new-key:active { height: 30px; }

/* ---- Permalinks, unfurled: a transmission on a card ---- */
.tx-card {
    --tint: var(--chrome);
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px 12px;
    border: 1px solid color-mix(in srgb, var(--chrome) 30%, transparent);
    border-left: 3px solid var(--tint);
    border-radius: 6px;
    background: rgba(4, 7, 13, 0.85);
    color: var(--ink);
    text-decoration: none;
}
.tx-card:hover { border-color: color-mix(in srgb, var(--chrome) 60%, transparent); border-left-color: var(--tint); }
.tx-card.tint-cyan { --tint: #00d4ff; } .tx-card.tint-orange { --tint: #ff9933; } .tx-card.tint-pink { --tint: #ff3366; }
.tx-card.tint-green { --tint: #00ff88; } .tx-card.tint-purple { --tint: #bc13fe; } .tx-card.tint-white { --tint: #e8eaef; }
.tx-card-tag { display: flex; align-items: center; gap: 6px; color: var(--ink-dim); font: 700 0.56rem var(--font-mono); letter-spacing: 1.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-card-lamp { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--hot); box-shadow: 0 0 6px var(--hot); }
.tx-card-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tx-card-head img { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--tint); object-fit: cover; }
.tx-card-head b { color: var(--tint); font: 700 0.8rem var(--font-mono); }
.tx-card-head time { margin-left: auto; color: var(--ink-dim); font: 0.62rem var(--font-mono); white-space: nowrap; }
.tx-card-body { font-size: 0.88rem; line-height: 1.45; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.tx-card-shot { max-width: 100%; max-height: 180px; align-self: flex-start; border-radius: 4px; border: 1px solid color-mix(in srgb, var(--chrome) 25%, transparent); }
.tx-card.is-tuning .tx-card-tag { color: var(--chrome); }
.tx-card.is-dead { border-left-color: color-mix(in srgb, var(--ink) 25%, transparent); opacity: 0.7; }
.tx-card.is-dead .tx-card-tag { color: var(--hot); }

/* A card opened onto a message in the room: lit for a moment. Opacity only. */
.message-block.is-found { position: relative; }
.message-block.is-found::before {
    content: "";
    position: absolute;
    inset: -4px -8px;
    border-radius: 6px;
    background: color-mix(in srgb, var(--chrome) 14%, transparent);
    box-shadow: inset 3px 0 0 var(--chrome);
    pointer-events: none;
    animation: found-fade 2.2s ease-out forwards;
}
@keyframes found-fade { 0%, 40% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .message-block.is-found::before { animation: none; opacity: 0.8; } }

/* ------------------------------------------------------------------ *
 * Uplink diagnostics: the rig's test bench, as a home computer
 *
 * Instruments, not a list: a phosphor scope of the last 40 round trips,
 * segment readouts, LED columns for the spread, the carrier's figures, a
 * ten-minute timeline and the wire log (js/diagnostics.js). It re-reads once
 * a second by rewriting its numbers; nothing on it loops. The TX/RX lamps
 * flash once when a reading finds a new call or payload.
 *
 * The bench is the UPLINK II/40, a home computer from the same eighties as
 * the search's rack: a charcoal case with vents along its back, its model
 * name in teal letters drawn in two lines, its badge in grey and a smoked
 * window of boxed lamps lettered in teal and purple (and Japanese) beside
 * it, and dark keys with teal legends. It fits a laptop's screen with the
 * wire full. The instruments are on
 * its screen, blue as a BASIC prompt, in that machine's sixteen colours,
 * with the boot lines over them and Ok under.
 * ------------------------------------------------------------------ */
.diag {
    --case: #17181c;
    --teal: #36d1c4;
    --purple: #a173e6;
    --msx-blue: #3437c6;
    --msx-deep: #1d1f86;
    --msx-white: #f3f3ff;
    --msx-cyan: #62eef4;
    --msx-green: #7fe08b;
    --msx-yellow: #ece07e;
    --msx-red: #ff7d7a;
    --d-ok: var(--msx-green); --d-chrome: var(--msx-cyan); --d-warn: var(--msx-yellow); --d-hot: var(--msx-red); --d-dim: rgba(243, 243, 255, 0.5);
    width: 720px;
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    box-sizing: border-box;
    overflow-y: auto;
    padding: 0 0 12px;
    border: 0;
    border-radius: 6px;
    font-family: var(--font-mono);
    background:
        radial-gradient(rgba(255, 255, 255, 0.025) 0.6px, transparent 0.8px) 0 0 / 3px 3px,
        linear-gradient(180deg, #1d1e23, var(--case) 40%, #111215);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 0 1px #050506, 0 24px 50px rgba(0, 0, 0, 0.65);
    scrollbar-color: #3a3b42 transparent;
}
.diag .is-ok { --d: var(--d-ok); } .diag .is-chrome { --d: var(--d-chrome); }
.diag .is-warn { --d: var(--d-warn); } .diag .is-hot { --d: var(--d-hot); } .diag .is-dim { --d: var(--d-dim); }

/* The case: vents along its back, then the deck with the name and the
   cartridge slots. */
.msx-vents { height: 8px; margin: 0 22px; background: repeating-linear-gradient(90deg, #060607 0 3px, transparent 3px 7px); border-radius: 0 0 2px 2px; }
.msx-deck { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 8px 18px 0 24px; }
.msx-name small { display: block; margin: 0 0 4px 2px; color: #eceef2; font: 900 0.62rem var(--font-sans); letter-spacing: 0.5px; }
.msx-name small span { margin-left: 3px; font-size: 0.48rem; font-weight: 700; letter-spacing: 1px; }
.msx-mark { display: block; width: 310px; height: auto; max-width: 100%; }
.msx-deck-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; min-width: 0; }

/* The smoked strip: the maker's lettering in purple and teal, and the lamps
   in printed boxes. */
.msx-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 5px 10px;
    border-radius: 3px;
    background: linear-gradient(180deg, #0a0b0d, #15161a);
    box-shadow: inset 0 1px 3px #000, 0 1px 0 rgba(255, 255, 255, 0.05);
}
.msx-strip-mark { display: flex; align-items: baseline; gap: 3px; white-space: nowrap; }
.msx-strip-mark i { color: var(--purple); font: 900 0.8rem var(--font-sans); font-style: normal; }
.msx-strip-mark small { color: var(--purple); font: 900 0.62rem var(--font-sans); letter-spacing: 0.5px; }
.msx-strip-mark b { margin-left: 2px; color: var(--teal); font: italic 900 1.05rem var(--font-sans); letter-spacing: 0.5px; }
.diag-lamps { display: flex; align-items: center; gap: 6px; }
.diag-lamp { display: inline-flex; align-items: center; gap: 5px; }
.diag-lamp b {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 34px;
    padding: 2px 5px;
    border: 1px solid rgba(236, 238, 242, 0.55);
    border-radius: 1px;
    color: rgba(236, 238, 242, 0.85);
    font: 700 0.44rem/1.15 var(--font-sans);
    letter-spacing: 1px;
}
.diag-lamp b small { font: 700 0.4rem/1.2 "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", "Noto Sans JP", "Meiryo", var(--font-sans); letter-spacing: 1px; }
.diag-lamp i { --lamp: var(--msx-green); width: 6px; height: 6px; border-radius: 50%; background: color-mix(in srgb, var(--lamp) 15%, #050505); }
.diag-lamp.is-power i,
.diag-lamp.is-rate i { background: var(--lamp); box-shadow: 0 0 5px var(--lamp); }
.diag-lamp.is-rate i { --lamp: var(--teal); }
.diag-lamp.is-held i { --lamp: var(--purple); }
.diag-lamp.is-blink i { background: var(--lamp); box-shadow: 0 0 6px var(--lamp); animation: diag-blink 0.7s ease-out forwards; }
@keyframes diag-blink { 0% { opacity: 1; } 100% { opacity: 0.35; } }

/* The screen: blue as a BASIC prompt, behind its bezel, and the boot lines
   above what it shows. Inside it, the instruments take the machine's own
   colours. */
.msx-screen {
    --chrome: var(--msx-cyan);
    --ok: var(--msx-green);
    --amber: var(--msx-yellow);
    --warn: var(--msx-yellow);
    --hot: var(--msx-red);
    --ink: var(--msx-white);
    --ink-dim: rgba(243, 243, 255, 0.8);
    --ink-faint: rgba(243, 243, 255, 0.58);
    position: relative;
    margin: 12px 18px 0;
    padding: 12px 20px 10px;
    border-radius: 4px;
    background:
        repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.09) 0 1px, transparent 1px 3px),
        radial-gradient(ellipse 90% 85% at 50% 45%, var(--msx-blue), #2a2cae 85%, #24269c);
    color: var(--msx-white);
    box-shadow: 0 0 0 6px #08080a, 0 0 0 7px rgba(255, 255, 255, 0.06), inset 0 0 40px rgba(0, 0, 30, 0.45);
}
.msx-boot { color: var(--msx-white); font-size: 0.6rem; line-height: 1.4; }
.msx-title { margin: 6px 0 6px; color: var(--msx-white); font-size: 0.66rem; font-weight: 700; letter-spacing: 3px; }
.msx-title::before { content: "RUN \""; opacity: 0.75; }
.msx-title::after { content: "\""; opacity: 0.75; }
.msx-ok { display: flex; align-items: center; gap: 0.6em; margin-top: 6px; color: var(--msx-white); font-size: 0.66rem; }
.msx-ok i { width: 0.6em; height: 1.1em; background: var(--msx-white); }

/* The verdict: a lamp and a word, with the reason under it. */
.diag-verdict {
    display: flex; align-items: center; gap: 14px;
    padding: 6px 14px;
    border: 2px solid var(--d);
    background: rgba(10, 12, 80, 0.45);
}
.diag-verdict-lamp { flex: none; width: 14px; height: 14px; border-radius: 50%; background: var(--d); box-shadow: 0 0 8px var(--d), inset 0 -2px 3px rgba(0, 0, 0, 0.35); }
.diag-verdict b { display: block; color: var(--d); font-size: 1.05rem; letter-spacing: 6px; }
.diag-verdict span { display: block; margin-top: 3px; color: var(--ink-dim); font-size: 0.56rem; letter-spacing: 1.5px; line-height: 1.5; }

.diag-sub { display: flex; justify-content: space-between; gap: 8px; margin: 12px 0 6px; color: var(--msx-cyan); font-size: 0.56rem; font-weight: 700; letter-spacing: 3px; }
.diag-sub span { color: var(--ink-faint); font-weight: 400; letter-spacing: 1.5px; }

.diag-grid { display: grid; grid-template-columns: minmax(0, 1fr) 212px; gap: 0 22px; }
.diag-col { min-width: 0; }

/* The scope: a deep-blue window, a graticule, the trace in green. */
.diag-scope {
    position: relative;
    height: 86px;
    border: 2px solid rgba(243, 243, 255, 0.55);
    background: var(--msx-deep);
    overflow: hidden;
}
.diag-scope svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.diag-scope .g { stroke: rgba(140, 134, 255, 0.35); stroke-width: 1; vector-effect: non-scaling-stroke; }
.diag-scope .t { fill: none; stroke: var(--msx-green); stroke-width: 1.5; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.diag-scope .f { fill: rgba(127, 224, 139, 0.14); }
.diag-scope .m { stroke: var(--msx-yellow); stroke-width: 1; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; opacity: 0.9; }
.diag-scope .l { stroke: var(--msx-red); stroke-width: 2; vector-effect: non-scaling-stroke; opacity: 0.85; }
.diag-scope-dot { position: absolute; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; background: var(--d); transform: translateX(-3px); }
.diag-axis { position: absolute; left: 6px; color: rgba(243, 243, 255, 0.6); font-size: 0.5rem; letter-spacing: 1px; pointer-events: none; }
.diag-axis.is-median { left: auto; right: 6px; color: var(--msx-yellow); }
.diag-scope-none { position: absolute; inset: 0; display: grid; place-items: center; color: rgba(243, 243, 255, 0.6); font-size: 0.6rem; letter-spacing: 3px; }
.diag-scope-foot { display: flex; justify-content: space-between; margin-top: 4px; color: var(--ink-faint); font-size: 0.5rem; letter-spacing: 1.5px; }

/* Segment readouts. */
.diag-segs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.diag-seg { padding: 6px 7px 5px; border: 2px solid color-mix(in srgb, var(--d) 70%, transparent); background: rgba(10, 12, 80, 0.4); min-width: 0; }
.diag-seg-label { display: block; color: var(--ink-faint); font-size: 0.48rem; letter-spacing: 1.5px; }
.diag-seg b { display: block; margin-top: 2px; color: var(--d); font-size: 1rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 0.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.diag-seg small { margin-left: 2px; font-size: 0.55rem; opacity: 0.7; letter-spacing: 1px; }

/* Block columns for the spread. */
.diag-bands { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.diag-band { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.diag-band-n { color: var(--d); font-size: 0.62rem; font-variant-numeric: tabular-nums; }
.diag-band-leds { display: flex; flex-direction: column; gap: 1px; width: 100%; max-width: 46px; }
.diag-band-leds i { height: 3px; background: rgba(10, 12, 80, 0.45); }
.diag-band-leds i.on { background: var(--d); }
.diag-band-label { color: var(--ink-faint); font-size: 0.5rem; letter-spacing: 1px; }

/* The carrier's figures. */
.diag-carrier { min-width: 0; }
.diag-carrier .diag-sub:first-child { margin-top: 12px; }
.diag-row { display: flex; justify-content: space-between; gap: 10px; padding: 2px 0; border-bottom: 1px dotted rgba(243, 243, 255, 0.2); font-size: 0.6rem; letter-spacing: 1px; }
.diag-row span { color: var(--ink-dim); }
.diag-row b { color: var(--d, var(--ink)); font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.diag-ratio { height: 4px; margin: 1px 0 4px; background: color-mix(in srgb, var(--msx-yellow) 35%, var(--msx-deep)); overflow: hidden; }
.diag-ratio i { display: block; height: 100%; background: var(--msx-cyan); }

/* The timeline. */
.diag-timeline { height: 26px; position: relative; }
.diag-timeline svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.diag-timeline .track { fill: color-mix(in srgb, var(--msx-yellow) 30%, var(--msx-deep)); }
.diag-timeline .live { fill: color-mix(in srgb, var(--msx-cyan) 70%, transparent); }
.diag-timeline .rotate, .diag-timeline .retune { stroke: rgba(243, 243, 255, 0.7); stroke-width: 1; vector-effect: non-scaling-stroke; }
.diag-timeline .retune { stroke-dasharray: 2 2; }
.diag-timeline .drop { stroke: var(--msx-red); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.diag-timeline .call { stroke: color-mix(in srgb, var(--msx-green) 80%, transparent); stroke-width: 1; vector-effect: non-scaling-stroke; }
.diag-timeline .call.lost { stroke: var(--msx-red); stroke-width: 2; }
.diag-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 5px; color: var(--ink-faint); font-size: 0.5rem; letter-spacing: 1.5px; }
.diag-legend span { display: inline-flex; align-items: center; gap: 5px; }
.diag-legend i { display: inline-block; width: 10px; height: 6px; }
.diag-legend .k-live { background: color-mix(in srgb, var(--msx-cyan) 70%, transparent); }
.diag-legend .k-poll { background: color-mix(in srgb, var(--msx-yellow) 40%, var(--msx-deep)); }
.diag-legend .k-rotate { width: 1px; height: 9px; background: rgba(243, 243, 255, 0.7); }
.diag-legend .k-drop { width: 2px; height: 9px; background: var(--msx-red); }
.diag-legend .k-call { width: 1px; height: 6px; background: var(--msx-green); }
.diag-legend-now { margin-left: auto; }

/* The wire log. */
.diag-wire { border: 2px solid rgba(243, 243, 255, 0.4); background: rgba(10, 12, 80, 0.4); padding: 4px 0; }
.diag-wire-row {
    display: grid;
    grid-template-columns: 92px 44px minmax(0, 1fr) 34px 58px 54px;
    gap: 8px;
    padding: 2px 10px;
    font-size: 0.58rem;
    line-height: 1.6;
    color: var(--ink-dim);
    font-variant-numeric: tabular-nums;
}
.diag-wire-row:first-child { color: var(--ink); background: rgba(98, 238, 244, 0.1); }
.diag-wire-row .w-method { color: var(--msx-cyan); }
.diag-wire-row small { font-size: inherit; opacity: 0.55; }
.diag-wire-row .w-path { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.diag-wire-row .w-status { color: var(--msx-green); }
.diag-wire-row .w-ms { color: var(--d); text-align: right; }
.diag-wire-row .w-size { text-align: right; color: var(--ink-faint); }
.diag-wire-row.is-lost { background: color-mix(in srgb, var(--msx-red) 14%, transparent); }
.diag-wire-row.is-lost .w-status { color: var(--msx-red); }
.diag-wire-none { padding: 10px; text-align: center; color: var(--ink-faint); font-size: 0.58rem; letter-spacing: 3px; }

.diag-note { margin-top: 10px; color: var(--ink-faint); font-size: 0.5rem; letter-spacing: 1.5px; }

/* The keys: dark caps with teal legends, the function number over each,
   and the machine's badge at the end of the row. */
.diag-keys { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 10px 18px 0; }
.msx-key {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 1px;
    min-width: 96px;
    height: 36px;
    padding: 0 12px;
    border: 0;
    border-radius: 4px;
    background: linear-gradient(180deg, #34363c, #222328 70%, #1b1c20);
    color: var(--teal);
    font: 700 0.62rem var(--font-sans);
    letter-spacing: 1.5px;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 3px 0 #050506, 0 0 0 1px #050506;
}
.msx-key small { color: color-mix(in srgb, var(--teal) 70%, transparent); font-size: 0.48rem; letter-spacing: 1px; }
.msx-key:hover { color: #6ff0e4; }
.msx-key:active { transform: translateY(2px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 1px 0 #050506, 0 0 0 1px #050506; }
.msx-key:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.msx-key[aria-pressed="true"] { color: var(--purple); }
.msx-key[aria-pressed="true"] small { color: color-mix(in srgb, var(--purple) 70%, transparent); }
.msx-key.is-stop { margin-left: auto; }
.msx-badge { padding: 1px 6px; border-radius: 2px; background: #8b8e96; color: #17181c; font: italic 900 0.66rem var(--font-sans); letter-spacing: -0.5px; }
.msx-badge sup { margin-left: 1px; font-size: 0.5rem; }

@media (max-width: 640px) {
    .msx-vents { margin: 0 12px; }
    .msx-boot, .msx-badge, .msx-strip-mark { display: none; }
    .msx-deck { flex-direction: column; align-items: stretch; padding: 8px 10px 0; }
    .msx-deck-right { align-items: stretch; }
    .msx-mark { width: 230px; }
    .msx-strip { justify-content: center; padding: 6px 8px; }
    .msx-screen { margin: 12px 10px 0; padding: 14px 12px 12px; }
    .diag-grid { grid-template-columns: minmax(0, 1fr); }
    .diag-segs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .diag-wire-row { grid-template-columns: 62px 34px minmax(0, 1fr) 46px; }
    .diag-wire-row .w-status, .diag-wire-row .w-size { display: none; }
    .diag-wire-row .w-ms-part { display: none; }
    .diag-keys { margin: 14px 10px 0; }
    .msx-key { flex: 1; min-width: 0; padding: 0 8px; white-space: nowrap; }
    .msx-key.is-stop { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) { .diag-lamp.is-blink i { animation: none; } }

/* ------------------------------------------------------------------ *
 * Ambient motion runs in bursts
 *
 * The decorative loops — the glitch jitter, a mention's flicker, the ring
 * on everyone online, the volatile signs, the welcome ghost — each ran for
 * ever, and most of them change something for a sliver of each cycle. An
 * idle channel had 27 animations running, one per mention and one per
 * operator online, so the browser drew frames the whole time nothing was
 * happening. Now they share a clock, as the iOS app's do: Terminal adds
 * .ambient to <html> for 4.5s every 12s (initAmbient in js/terminal.js),
 * each effect plays one pass inside that window, and the rest of the time
 * the screen asks for no frames at all. Not under reduced motion, and not
 * in a hidden tab. Status lamps that mean something (the fretting uplink,
 * unread links, pending sends) keep their own time.
 * ------------------------------------------------------------------ */
:root.ambient .glitch-text { animation: glitch 1.5s 1; }
:root.ambient .mention-highlight { animation: neon-pulse 2s ease-in-out 3, mention-flicker 4s 1; }
:root.ambient .is-online .member-avatar::after { animation: member-here 3.2s ease-in-out 1; }
:root.ambient .volatile-flicker { animation: volatile-flicker 3s 1; }
:root.ambient .chan-sign i { animation: volatile-stutter 4s steps(1, end) 1; }
:root.ambient .welcome-title::after { animation: welcome-ghost 4s steps(1) 1; }

/* ------------------------------------------------------------------ *
 * THE DESK: the sysop's night court (js/desk.js)
 *
 * A steel desk, a docket of manila case tags, and the case in hand on
 * paper: mugshot and rap sheet, the exhibit in an evidence bag, the
 * complainant's statement on ruled paper, the scene on a teletype strip,
 * and the verdict keys on a console at the foot — the two bans under
 * hazard-striped covers. A verdict brings a rubber stamp down.
 * ------------------------------------------------------------------ */
.status-line .sl-desk { display: inline-flex; align-items: center; gap: 6px; padding: 0 2px; border: 0; background: none; color: var(--ink-dim); font: inherit; letter-spacing: inherit; cursor: pointer; }
.status-line .sl-desk[hidden] { display: none; }
.status-line .sl-desk i { width: 6px; height: 6px; border-radius: 50%; background: color-mix(in srgb, var(--amber) 30%, #000); }
.status-line .sl-desk.is-hot { color: var(--amber); }
.status-line .sl-desk.is-hot i { background: var(--hot); box-shadow: 0 0 6px var(--hot); animation: led-blink 1.2s steps(1) infinite; }
.status-line .sl-desk:hover, .status-line .sl-desk:focus-visible { color: var(--chrome); }

.desk {
    /* Each tag and poster sets its own lean inline (js/desk.js). */
    --tilt: 0deg;
    --paper: #efe6cf;
    --paper-ink: #2a2418;
    --manila: #d9c28c;
    --stamp: #c8102e;
    --tone: var(--chrome);
    position: relative;
    display: grid;
    grid-template-rows: auto 10px auto minmax(0, 1fr);
    width: min(1220px, calc(100vw - 32px));
    height: min(880px, calc(100dvh - 32px));
    border: 1px solid #5a4a2a;
    border-radius: 4px;
    background:
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 3px),
        linear-gradient(180deg, #1c1a17, #0e0d0b 40%, #12100d);
    box-shadow: 0 0 0 1px #000, 0 30px 80px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    color: var(--ink);
    font-family: var(--font-mono);
    overflow: hidden;
}
.desk .tone-hot, .desk.tone-hot { --tone: var(--hot); }
.desk .tone-red { --tone: #ff2a2a; }
.desk .tone-purple { --tone: var(--neon-purple); }
.desk .tone-warn { --tone: var(--warn); }
.desk .tone-ok { --tone: var(--ok); }
.desk .tone-chrome { --tone: var(--chrome); }
.desk .tone-amber { --tone: var(--amber); }

/* The masthead. */
.desk-mast { display: flex; align-items: center; gap: 18px; padding: 16px 20px 14px; background: linear-gradient(180deg, #24201a, #16130f); border-bottom: 1px solid #000; }

.desk-title { flex: 1; min-width: 0; }
.desk-title small { display: block; color: var(--amber); font-size: 0.58rem; letter-spacing: 4px; opacity: 0.8; }
.desk-title h2 { margin: 2px 0 2px; font: 800 2.3rem/1 var(--font-sans); letter-spacing: 12px; color: #f4e7c6; text-shadow: 0 2px 0 #000, 0 0 18px rgba(255, 170, 0, 0.35); }
.desk-title span { color: var(--ink-dim); font-size: 0.56rem; letter-spacing: 3px; }

.desk-meters { display: flex; gap: 8px; }
.desk-meter { min-width: 104px; padding: 7px 10px 6px; border: 1px solid #3a3020; border-radius: 3px; background: #050403; box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.9); }
.desk-meter b { display: block; color: var(--amber); font-size: 1.5rem; font-variant-numeric: tabular-nums; letter-spacing: 3px; text-shadow: 0 0 10px rgba(255, 170, 0, 0.55); }
.desk-meter span { display: block; color: var(--ink-faint); font-size: 0.46rem; letter-spacing: 1.5px; }
.desk-meter.is-hot b { color: #ff4040; text-shadow: 0 0 10px rgba(255, 50, 50, 0.6); }
.desk-x { --key-ink: var(--ink-dim); width: 34px; height: 34px; font-size: 1.1rem; align-self: flex-start; }
.desk-x:active { height: 32px; }

.desk-hazard { background: repeating-linear-gradient(-45deg, #f0c020 0 14px, #111 14px 28px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), inset 0 -2px 3px rgba(0, 0, 0, 0.5); }

.desk-tabs { display: flex; gap: 8px; padding: 12px 20px; background: #12100d; border-bottom: 1px solid #000; overflow-x: auto; }
.desk-tab { --key-ink: #b8a070; height: 30px; padding: 0 16px; letter-spacing: 3px; white-space: nowrap; }
.desk-tab:active { height: 28px; }
.desk-tab[aria-selected="true"] { --key-ink: var(--amber); background: var(--amber); color: #120d02; box-shadow: 0 0 14px rgba(255, 170, 0, 0.5); }

.desk-floor { min-height: 0; overflow: auto; padding: 18px 20px 24px; }
.desk-floor.is-docket, .desk-floor.is-archive { display: grid; grid-template-columns: 290px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: 22px; overflow: hidden; }
.desk-wait { padding: 40px; color: var(--amber); font-size: 0.7rem; letter-spacing: 4px; text-align: center; }
.desk-clear { grid-column: 1 / -1; align-self: center; text-align: center; padding: 60px 20px; }
.desk-clear b { display: block; font: 800 1.8rem var(--font-sans); letter-spacing: 8px; color: var(--ok); text-shadow: 0 0 20px rgba(0, 255, 136, 0.35); }
.desk-clear span { display: block; margin-top: 10px; color: var(--ink-dim); font-size: 0.62rem; letter-spacing: 3px; }
.desk-none { color: var(--ink-faint); font-size: 0.6rem; letter-spacing: 2px; line-height: 1.7; }

/* The docket: manila tags on strings. */
.docket { display: flex; flex-direction: column; gap: 12px; overflow-y: auto; padding: 4px 18px 20px 6px; }
.case-tag {
    position: relative;
    display: grid;
    gap: 3px;
    padding: 12px 14px 11px 34px;
    border: 0;
    border-radius: 3px 12px 12px 3px;
    background: linear-gradient(180deg, #e2cd98, var(--manila) 60%, #c8ae74);
    color: var(--paper-ink);
    font-family: var(--font-mono);
    text-align: left;
    cursor: pointer;
    transform: rotate(var(--tilt, 0deg));
    box-shadow: 0 2px 0 #8f7a4c, 0 6px 14px rgba(0, 0, 0, 0.5);
    transition: transform 0.25s ease, box-shadow 0.25s ease, opacity 0.45s ease;
}
.case-tag::before { content: ""; position: absolute; left: -60px; top: 22px; width: 64px; height: 1px; background: #9a8a6a; transform: rotate(-8deg); transform-origin: right; }
.tag-hole { position: absolute; left: 12px; top: 16px; width: 10px; height: 10px; border-radius: 50%; background: #0e0d0b; box-shadow: 0 0 0 3px #b89c5c, inset 0 1px 2px #000; }
.tag-no { font-size: 0.55rem; letter-spacing: 2px; opacity: 0.7; }
.tag-stamp { justify-self: start; margin: 2px 0; padding: 2px 7px; border: 2px solid var(--tone); color: var(--tone); font-weight: 800; font-size: 0.72rem; letter-spacing: 3px; transform: rotate(-3deg); filter: saturate(1.4) brightness(0.75); mix-blend-mode: multiply; }
.tag-who { font-weight: 700; font-size: 0.82rem; }
.tag-where { font-size: 0.56rem; letter-spacing: 1px; opacity: 0.7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag-fuse { height: 4px; margin-top: 4px; background: rgba(0, 0, 0, 0.25); border-radius: 2px; overflow: hidden; }
.tag-fuse i { display: block; height: 100%; background: linear-gradient(90deg, #a0601a, #e08a1a); }
.tag-fuse.is-short i { background: var(--stamp); }
.tag-age, .tag-verdict { font-size: 0.5rem; letter-spacing: 1.5px; opacity: 0.75; }
.case-tag:hover { transform: rotate(0deg) translateX(4px); }
.case-tag.is-active { transform: rotate(0deg) translateX(14px); box-shadow: 0 2px 0 #8f7a4c, 0 8px 22px rgba(0, 0, 0, 0.6), 0 0 0 2px var(--amber), 0 0 22px rgba(255, 170, 0, 0.35); }
.case-tag.is-closed { filter: grayscale(0.5) brightness(0.85); }
.case-tag.is-leaving { transform: translateX(-120%) rotate(-10deg); opacity: 0; }

/* The case file: paper on the desk. */
.casefile-slot { min-height: 0; overflow-y: auto; padding: 4px 6px 30px; }
.casefile {
    position: relative;
    max-width: 860px;
    padding: 0 0 18px;
    border-radius: 2px;
    background:
        radial-gradient(ellipse at 20% 0%, rgba(255, 255, 255, 0.5), transparent 50%),
        linear-gradient(180deg, #f3ebd6, var(--paper));
    color: var(--paper-ink);
    box-shadow: 0 1px 0 #cfc3a3, 0 2px 0 #e6dcc2, 0 3px 0 #cbbf9e, 0 18px 40px rgba(0, 0, 0, 0.65);
}
.casefile.is-decided { animation: desk-thud 0.3s ease-out; }
@keyframes desk-thud { 30% { transform: translateY(3px) scale(0.995); } }
.cf-strip { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; padding: 10px 18px; background: var(--paper-ink); color: #efe6cf; font-size: 0.56rem; letter-spacing: 2px; border-bottom: 4px solid var(--tone); }
.cf-charge { margin-left: auto; color: var(--tone); font-weight: 800; font-size: 0.7rem; letter-spacing: 4px; }

.cf-top { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 20px; padding: 18px 18px 8px; }
.mugshot { position: relative; margin: 0; padding: 12px 12px 0; background: #2b2a28; border: 6px solid #1a1918; box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.7); }
.mug-lines { position: absolute; inset: 12px 0 70px; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.mug-lines span { border-top: 1px solid rgba(255, 255, 255, 0.35); color: rgba(255, 255, 255, 0.5); font-size: 0.45rem; padding-left: 4px; }
.mugshot img { position: relative; display: block; width: 150px; height: 150px; margin: 6px auto 0; object-fit: cover; filter: grayscale(0.35) contrast(1.1); border-radius: 2px; }
.mug-placard { position: relative; margin: 10px -12px 0; padding: 8px 10px; background: #0b0b0b; color: #f0f0f0; text-align: center; border-top: 3px solid var(--ink); }
.mug-placard b { display: block; font-size: 0.9rem; letter-spacing: 1px; overflow: hidden; text-overflow: ellipsis; }
.mug-placard span { display: block; font-size: 0.55rem; opacity: 0.7; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mug-placard i { display: block; margin-top: 4px; font-style: normal; font-size: 0.48rem; letter-spacing: 2px; color: var(--amber); }

.rapsheet { margin: 0; align-self: start; border: 2px solid var(--paper-ink); }
.rapsheet::before { content: "RAP SHEET"; display: block; padding: 5px 10px; background: var(--paper-ink); color: var(--paper); font-size: 0.6rem; font-weight: 800; letter-spacing: 5px; }
.rapsheet div { display: flex; align-items: baseline; gap: 8px; padding: 6px 10px; border-bottom: 1px dashed rgba(42, 36, 24, 0.35); font-size: 0.66rem; }
.rapsheet div:last-child { border-bottom: 0; }
.rapsheet dt { letter-spacing: 1.5px; opacity: 0.75; }
.rapsheet dt::after { content: ""; flex: 1; }
.rapsheet dd { margin: 0 0 0 auto; font-weight: 800; font-variant-numeric: tabular-nums; }
.rapsheet dd.is-hot { color: var(--stamp); }
.rapsheet dd.is-ok { color: #1d6b3a; }
.rap-status { background: rgba(42, 36, 24, 0.06); }

/* Exhibit A, in its bag. */
.exhibit { padding: 10px 18px; }
.ex-bag {
    position: relative;
    padding: 24px 18px 14px;
    border: 1px solid rgba(60, 70, 80, 0.35);
    border-radius: 6px 6px 14px 14px;
    background:
        linear-gradient(115deg, rgba(255, 255, 255, 0.55) 0 18%, transparent 30% 62%, rgba(255, 255, 255, 0.3) 70%, transparent 80%),
        linear-gradient(180deg, rgba(205, 220, 232, 0.55), rgba(190, 205, 220, 0.35));
    box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.35), 0 4px 10px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}
.ex-zip { position: absolute; top: 8px; left: 10px; right: 10px; height: 5px; border-top: 2px solid #c03030; border-bottom: 2px solid #3050a0; opacity: 0.6; }
.ex-tape { position: absolute; right: -60px; bottom: 26px; width: 340px; padding: 3px 0; background: #d01a1a; color: #fff; font-size: 0.5rem; font-weight: 800; letter-spacing: 2px; white-space: nowrap; overflow: hidden; transform: rotate(-24deg); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); opacity: 0.9; }
.ex-label { position: relative; font-size: 0.55rem; font-weight: 800; letter-spacing: 3px; color: #4a5560; margin-bottom: 8px; }
.ex-words { position: relative; margin: 0; padding: 12px 14px; background: rgba(255, 255, 255, 0.7); border-left: 4px solid var(--tone); color: #111; font: 0.82rem/1.5 var(--font-mono); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 260px; overflow-y: auto; }
.ex-state { position: relative; margin-top: 8px; font-size: 0.55rem; letter-spacing: 2px; color: #6a7076; }
.ex-state.is-live { color: var(--stamp); font-weight: 800; }
.exhibit.is-empty { margin: 10px 18px; padding: 14px; border: 2px dashed rgba(42, 36, 24, 0.35); }
.exhibit.is-empty p { margin: 6px 0 0; font-size: 0.66rem; line-height: 1.6; }

.st-head { font-size: 0.56rem; font-weight: 800; letter-spacing: 3px; margin-bottom: 6px; opacity: 0.8; }
.statement { margin: 10px 18px; padding: 10px 14px 12px 44px; background: #fbf7ea; box-shadow: inset 36px 0 0 #fbf7ea, inset 37px 0 0 #e58a8a, 0 2px 6px rgba(0, 0, 0, 0.12); }
/* The ruling is the paragraph's own, so every line of text sits on one. */
.statement p { margin: 0; font: 0.8rem/24px var(--font-mono); white-space: pre-wrap; overflow-wrap: anywhere; background: repeating-linear-gradient(180deg, transparent 0 23px, #9ab8d8 23px 24px); }

.scene { margin: 12px 18px; }
.scene-tape { margin: 0; padding: 8px 0; list-style: none; background: #0a1410; border: 1px solid #1d3a2a; border-radius: 3px; box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.8); }
.scene-tape li { display: grid; grid-template-columns: 44px auto minmax(0, 1fr); gap: 10px; padding: 3px 12px; color: rgba(0, 255, 136, 0.75); font-size: 0.66rem; line-height: 1.5; }
.scene-tape li b { color: var(--ok); }
.scene-tape li span { overflow-wrap: anywhere; }
.scene-tape li.is-reported { background: color-mix(in srgb, var(--tone) 22%, transparent); box-shadow: inset 3px 0 0 var(--tone); color: #fff; }
.scene-tape time { opacity: 0.6; }

/* The verdict console. */
.verdict { margin: 16px 18px 0; padding: 14px 16px 16px; border-radius: 4px; background: linear-gradient(180deg, #24211c, #141210); color: var(--ink); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 4px 12px rgba(0, 0, 0, 0.35); }
.verdict .st-head { color: var(--amber); }
.verdict.is-closed p { margin: 0; color: var(--ink-dim); font-size: 0.7rem; letter-spacing: 2px; }
.verdict-record { display: grid; gap: 4px; margin-bottom: 12px; }
.verdict-record span { color: var(--ink-faint); font-size: 0.5rem; letter-spacing: 2px; }
.verdict-record input { padding: 8px 10px; border: 1px solid #3a3326; border-radius: 2px; background: #070605; color: var(--ink); font: 0.72rem var(--font-mono); outline: none; }
.verdict-record input:focus { border-color: var(--amber); }
.verdict-keys { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.verdict-key { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: 100%; height: 64px; padding: 0 8px; position: relative; overflow: hidden; }
.verdict-key b { font-size: 0.9rem; letter-spacing: 3px; }
.verdict-key span { font-size: 0.46rem; letter-spacing: 1.5px; opacity: 0.8; }
.verdict-key:active { height: 62px; }
.verdict-key:disabled { opacity: 0.3; cursor: not-allowed; }
.verdict-key.is-acquit { --key-ink: var(--ok); }
.verdict-key.is-redact { --key-ink: var(--amber); }
.verdict-key.is-exile { --key-ink: var(--hot); }
.verdict-key.is-banish { --key-ink: #ff2a2a; }
.hold-fill { position: absolute; left: 0; bottom: 0; height: 4px; width: 0; background: #ff2a2a; box-shadow: 0 0 10px #ff2a2a; }
.verdict-key.is-holding .hold-fill { width: 100%; transition: width 1.4s linear; }
.verdict-key.is-holding { background: color-mix(in srgb, #ff2a2a 30%, transparent); }

.guarded { position: relative; perspective: 500px; }
.guard-cover {
    position: absolute;
    inset: -4px;
    z-index: 2;
    display: grid;
    place-items: center;
    border: 1px solid #000;
    border-radius: 4px;
    background: repeating-linear-gradient(-45deg, #e8b818 0 10px, #141414 10px 20px);
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.15), 0 4px 8px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    transform-origin: 50% 0;
    transition: transform 0.35s cubic-bezier(0.3, 1.4, 0.5, 1);
}
.guard-cover span { padding: 3px 10px; background: #141414; color: #e8b818; font: 800 0.72rem var(--font-mono); letter-spacing: 3px; border: 1px solid #e8b818; }
.guard-cover:hover { transform: rotateX(-14deg); }
.guarded.is-lifted .guard-cover { transform: rotateX(-112deg); pointer-events: none; }
.guarded.is-grave .guard-cover { background: repeating-linear-gradient(-45deg, #d01a1a 0 10px, #141414 10px 20px); }
.guarded.is-grave .guard-cover span { color: #ff4040; border-color: #ff4040; }
.guarded.is-off { opacity: 0.35; }
.guarded.is-off .guard-cover { cursor: not-allowed; }

/* The stamp. */
.cf-stamp {
    position: absolute;
    left: 50%;
    /* Over the verdict console, where the hand that pressed the key is. */
    bottom: 40px;
    z-index: 3;
    padding: 10px 26px;
    border: 7px double var(--stamp);
    border-radius: 8px;
    color: #ff2440;
    border-color: #ff2440;
    background: rgba(20, 0, 4, 0.18);
    font: 900 3.4rem/1 var(--font-sans);
    letter-spacing: 8px;
    white-space: nowrap;
    text-shadow: 0 0 1px rgba(255, 36, 64, 0.6);
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -50%) rotate(-12deg);
}
.cf-stamp.is-shown { opacity: 0.9; }
.cf-stamp.is-slam { animation: desk-stamp 0.34s cubic-bezier(0.2, 1.5, 0.45, 1) both; }
@keyframes desk-stamp {
    0% { opacity: 0; transform: translate(-50%, -50%) rotate(-4deg) scale(2.8); }
    100% { opacity: 0.9; transform: translate(-50%, -50%) rotate(-12deg) scale(1); }
}

/* The banished: wanted posters, and exile slips. */
.desk-section { margin-bottom: 28px; }
.desk-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 14px; padding-bottom: 6px; border-bottom: 1px solid #3a3020; color: var(--amber); font: 800 0.9rem var(--font-sans); letter-spacing: 6px; }
.desk-h span { color: var(--ink-faint); font: 0.56rem var(--font-mono); letter-spacing: 2px; }
.posters { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 22px; }
.poster { display: grid; justify-items: center; gap: 6px; padding: 14px 14px 12px; background: radial-gradient(ellipse at 50% 30%, #efdcae, #d9bf84 80%); color: #3a2a10; text-align: center; transform: rotate(var(--tilt, 0deg)); box-shadow: 0 8px 18px rgba(0, 0, 0, 0.55); clip-path: polygon(0 2%, 4% 0, 96% 1%, 100% 4%, 99% 97%, 95% 100%, 3% 99%, 0 95%); }
.poster-head { font: 900 1.25rem var(--font-sans); letter-spacing: 5px; color: #5a1a0a; border-bottom: 3px double #5a1a0a; padding-bottom: 4px; width: 100%; }
.poster img { width: 110px; height: 110px; object-fit: cover; filter: grayscale(1) sepia(0.6) contrast(1.2); border: 4px solid #3a2a10; }
.poster b { font-size: 0.85rem; }
.poster p { margin: 0; font-size: 0.6rem; line-height: 1.5; overflow-wrap: anywhere; }
.poster small { font-size: 0.48rem; letter-spacing: 1px; opacity: 0.75; }
.poster-key { --key-ink: #3a6a2a; margin-top: 4px; padding: 0 14px; }
.slips { display: grid; gap: 8px; }
.slip { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 8px 12px; background: #17140f; border: 1px dashed #4a3e28; font-size: 0.66rem; }
.slip img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; filter: grayscale(0.6); }
.slip small { color: var(--ink-faint); font-size: 0.55rem; }

/* The elect: badges. */
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 22px; }
.badge { display: grid; justify-items: center; gap: 8px; text-align: center; }
.badge-shield {
    display: grid;
    justify-items: center;
    gap: 4px;
    width: 150px;
    padding: 18px 10px 30px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.55), transparent 35% 65%, rgba(255, 255, 255, 0.25)),
        linear-gradient(180deg, color-mix(in srgb, var(--ink) 40%, #d8d8d8), color-mix(in srgb, var(--ink) 25%, #707070));
    color: #111;
    clip-path: polygon(50% 0, 100% 14%, 100% 64%, 50% 100%, 0 64%, 0 14%);
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.5));
}
.badge-shield small { font: 900 0.62rem var(--font-sans); letter-spacing: 5px; }
.badge-shield img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; border: 3px solid #222; }
.badge-shield b { font-size: 0.72rem; max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.badge-shield i { font-style: normal; font-size: 0.5rem; letter-spacing: 2px; opacity: 0.7; }
.badge p { margin: 0; color: var(--ink-dim); font-size: 0.5rem; letter-spacing: 1.5px; line-height: 1.6; }
.badge-you { color: var(--amber); font-size: 0.56rem; letter-spacing: 3px; }
.badge .plate-key { --key-ink: var(--hot); padding: 0 12px; }
.swear-row { display: flex; align-items: center; gap: 8px; max-width: 480px; margin-top: 10px; }
.swear-row span { color: var(--amber); }
.swear-row input { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid #3a3326; background: #070605; color: var(--ink); font: 0.75rem var(--font-mono); outline: none; }
.swear-row input:focus { border-color: var(--amber); }
.swear-row .plate-key { --key-ink: var(--amber); height: 34px; padding: 0 14px; }
.swear-row .plate-key:active { height: 32px; }

/* The logbook: a ledger. */
.ledger { margin: 0; padding: 10px 0; list-style: none; background: repeating-linear-gradient(180deg, #e9efe0 0 27px, #b8c9a8 27px 28px), #e9efe0; color: #22301a; border-left: 3px double #a03030; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5); }
.ledger-line { display: grid; grid-template-columns: 130px 140px 120px minmax(0, 1fr); gap: 4px 12px; align-items: baseline; padding: 0 16px; min-height: 28px; font-size: 0.64rem; line-height: 28px; }
.ledger-line time { opacity: 0.7; }
.ledger-line em { font-style: normal; font-weight: 800; letter-spacing: 2px; }
.ledger-line q { grid-column: 2 / -1; margin-top: -6px; font-style: italic; opacity: 0.75; line-height: 1.5; }
.ledger-line.act-banished em, .ledger-line.act-exiled em, .ledger-line.act-stripped em { color: #a01010; }
.ledger-line.act-dismissed em, .ledger-line.act-pardoned em, .ledger-line.act-recalled em { color: #1d6b3a; }
.ledger-line.act-redacted em { color: #a06010; }
.ledger-line.act-sworn_in em { color: #1a4a9a; }

/* THE CENSUS: counts on amber readouts, as the masthead's meters, then thirty
   days of traffic and the week's busiest sectors on ledger paper. The bars'
   two colours are checked for colour-blind separation against this surface;
   every number beside them is in the ink. */
.census-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.census-tile { padding: 10px 12px 9px; border: 1px solid #3a3020; border-radius: 3px; background: #050403; box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.9); }
.census-tile b { display: block; color: var(--amber); font-size: 1.6rem; font-variant-numeric: tabular-nums; letter-spacing: 2px; text-shadow: 0 0 10px rgba(255, 170, 0, 0.5); }
.census-tile span { display: block; margin-top: 2px; color: var(--ink-dim); font-size: 0.5rem; letter-spacing: 1.5px; }
.census-tile small { display: block; margin-top: 3px; color: var(--ink-faint); font-size: 0.5rem; letter-spacing: 1px; }

.lines-board { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; margin-bottom: 12px; }
.lines-lamps { display: flex; flex-wrap: wrap; gap: 5px; }
.lines-lamps i { width: 13px; height: 13px; border: 1px solid #3a3020; border-radius: 50%; background: #050403; box-shadow: inset 0 0 3px #000; }
.lines-lamps i.is-on { border-color: #000; background: var(--amber); box-shadow: 0 0 7px rgba(255, 170, 0, 0.6); }
.lines-lamps.is-full i.is-on { background: #ff4040; box-shadow: 0 0 7px rgba(255, 50, 50, 0.6); }
.lines-verdict { margin: 0; color: var(--ink-dim); font-size: 0.6rem; letter-spacing: 2px; }
.lines-verdict b { margin-right: 6px; font-size: 0.72rem; letter-spacing: 3px; }
.lines-verdict.is-clear b { color: var(--ok); }
.lines-verdict.is-warn b { color: var(--amber); }
.lines-verdict.is-hot b { color: #ff4040; }
.lines-key { margin: 12px 0 6px; color: var(--ink-faint); font-size: 0.5rem; letter-spacing: 1.5px; line-height: 1.6; }
.lines-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin: 0; padding: 0; list-style: none; }
.lines-days li { min-height: 62px; padding: 6px 4px; border: 1px solid #3a3020; border-radius: 3px; background: #050403; text-align: center; }
.lines-days li.is-today { border-color: var(--amber); }
.lines-days li.is-full { border-color: #ff4040; }
.lines-days span { display: block; color: var(--ink-dim); font-size: 0.5rem; letter-spacing: 1.5px; }
.lines-days b { display: block; margin: 2px 0; color: var(--amber); font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.lines-days small { display: block; color: #ff4040; font-size: 0.48rem; letter-spacing: 0.5px; white-space: nowrap; }

.census-chart { --channels: #c98200; --links: #0896c4; margin: 0; }
.census-legend { display: flex; gap: 18px; margin-bottom: 10px; color: var(--ink-dim); font-size: 0.56rem; letter-spacing: 2px; }
.census-legend span { display: inline-flex; align-items: center; gap: 7px; }
.census-legend i { width: 10px; height: 10px; border-radius: 2px; background: var(--channels); }
.census-legend i.is-links { background: var(--links); }

.census-plot { position: relative; height: 200px; margin-left: 44px; border-bottom: 1px solid #3a3020; }
.census-grid span { position: absolute; left: 0; right: 0; height: 0; border-top: 1px dashed rgba(255, 255, 255, 0.07); }
.census-grid em { position: absolute; right: calc(100% + 8px); top: -0.55em; color: var(--ink-faint); font-size: 0.52rem; font-style: normal; font-variant-numeric: tabular-nums; }
.census-bars { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 3px; }
.census-day { position: relative; flex: 1 1 0; height: 100%; display: flex; align-items: flex-end; cursor: crosshair; }
.census-day.is-pointed { background: rgba(255, 255, 255, 0.04); }
/* Links on channels, a 2px gap between, the top end rounded. */
.census-stack { display: flex; flex-direction: column; gap: 2px; width: 100%; min-height: 0; }
.census-stack i { display: block; min-height: 2px; background: var(--channels); }
.census-stack i.is-links { background: var(--links); }
.census-stack i:first-child { border-radius: 4px 4px 0 0; }
.census-day.is-today .census-stack i { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25); }
.census-tip { position: absolute; bottom: calc(100% + 6px); transform: translateX(-50%); padding: 5px 9px; border: 1px solid #5a4a2a; border-radius: 3px; background: #0b0a08; color: var(--ink); font-size: 0.56rem; letter-spacing: 1px; white-space: nowrap; pointer-events: none; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.6); }

.census-axis { display: flex; gap: 3px; margin: 6px 0 0 44px; }
.census-axis span { flex: 1 1 0; min-width: 0; overflow: visible; white-space: nowrap; color: var(--ink-faint); font-size: 0.5rem; letter-spacing: 1px; }

.census-table { margin-top: 12px; color: var(--ink-dim); font-size: 0.6rem; }
.census-table summary { cursor: pointer; color: var(--amber); letter-spacing: 2px; }
.census-table table { margin-top: 8px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.census-table th, .census-table td { padding: 3px 14px 3px 0; text-align: left; }
.census-table th { color: var(--ink-faint); font-weight: 400; letter-spacing: 1.5px; }

/* TODAY ends at the plot's right edge, so it grows leftward from there. */
.census-axis span:last-child { display: flex; justify-content: flex-end; }

.census-busiest .ledger-line { grid-template-columns: 34px minmax(120px, 200px) 90px minmax(0, 1fr); }

/* On a phone the busiest print on two lines: the rank, the sector and its
   listing, then the counts under them. */
@media (max-width: 600px) {
    .census-busiest .ledger-line { grid-template-columns: 26px minmax(0, 1fr) auto; row-gap: 0; padding-block: 4px; line-height: 20px; }
    .census-busiest .ledger-line span { grid-column: 2 / -1; opacity: 0.8; }
    .census-plot, .census-axis { margin-left: 34px; }
}

@media (max-width: 860px) {
    .desk { width: 100vw; height: 100dvh; border-radius: 0; }
    .desk-mast { flex-wrap: wrap; padding: 12px 14px; gap: 12px; }
    .desk-title h2 { font-size: 1.6rem; letter-spacing: 8px; }
    .desk-meters { order: 3; width: 100%; }
    .desk-meter { flex: 1; min-width: 0; }
    .desk-tabs, .desk-floor { padding-left: 14px; padding-right: 14px; }
    .desk-floor.is-docket, .desk-floor.is-archive { display: flex; flex-direction: column; overflow-y: auto; }
    .docket { flex-direction: row; overflow-x: auto; overflow-y: visible; padding: 4px 4px 14px; flex: none; }
    .case-tag { flex: 0 0 220px; }
    .case-tag::before { display: none; }
    .case-tag.is-active { transform: translateY(-6px); }
    .casefile-slot { overflow: visible; padding: 0; }
    .cf-top { grid-template-columns: minmax(0, 1fr); }
    .mugshot { max-width: 260px; }
    .verdict-keys { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cf-stamp { font-size: 2.2rem; }
    .ledger-line { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); line-height: 1.5; padding: 6px 12px; }
}
@media (prefers-reduced-motion: reduce) {
    .status-line .sl-desk.is-hot i, .cf-stamp.is-slam, .casefile.is-decided { animation: none; }
    .case-tag, .guard-cover { transition: none; }
}

/* ------------------------------------------------------------------ *
 * VOTE_KICK: the ballot over the talk (js/votekick.js)
 *
 * A plate across the top of the message pane with a hazard edge: who the
 * vote is about, the countdown on an amber readout, a meter of KICK
 * against KEEP with a notch where it passes, and the two keys. In the flow
 * above #message-list, not floating, so it registers no z-index. The clock
 * is a text change once a second; nothing on it animates.
 * ------------------------------------------------------------------ */
.kick-vote {
    position: relative;
    flex: none;
    display: flex;
    margin: 10px 16px 0;
    border: 1px solid color-mix(in srgb, var(--hot) 55%, transparent);
    border-radius: 3px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--hot) 10%, #0c0a10), #08070b);
    box-shadow: 0 0 18px color-mix(in srgb, var(--hot) 18%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    font-family: var(--font-mono);
    overflow: hidden;
    /* Laid out by its own width: the talk can be a narrow column. */
    container-type: inline-size;
}
.kv-tape { flex: none; width: 12px; background: repeating-linear-gradient(-45deg, var(--hot) 0 7px, #111 7px 14px); opacity: 0.85; }
.kv-body {
    flex: 1;
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "kicker clock" "line line" "meter meter" "count count" "keys keys";
    align-items: center;
    gap: 6px 14px;
    padding: 10px 14px 11px;
}
@container (min-width: 600px) {
    .kv-body { grid-template-areas: "kicker clock" "line clock" "meter meter" "count keys"; }
    .kick-vote.is-target .kv-body { grid-template-areas: "kicker clock" "line clock"; }
}
.kv-kicker { grid-area: kicker; color: var(--hot); font-size: 0.52rem; letter-spacing: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kv-line { grid-area: line; margin: 0; color: var(--ink-dim); font-size: 0.72rem; line-height: 1.45; }
.kv-line b { color: var(--ink); }
.kv-clock {
    grid-area: clock;
    padding: 4px 10px;
    border: 1px solid #3a2a10;
    border-radius: 2px;
    background: #050403;
    color: var(--amber);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 3px;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 8px color-mix(in srgb, var(--amber) 55%, transparent);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.9);
}
.kv-meter { grid-area: meter; position: relative; display: flex; height: 6px; margin-top: 4px; background: rgba(255, 255, 255, 0.06); border-radius: 1px; overflow: visible; }
.kv-meter i { display: block; height: 100%; }
.kv-yes { background: var(--hot); box-shadow: 0 0 8px color-mix(in srgb, var(--hot) 60%, transparent); }
.kv-no { margin-left: auto; background: var(--chrome); box-shadow: 0 0 8px color-mix(in srgb, var(--chrome) 50%, transparent); }
.kv-need { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--ink); box-shadow: 0 0 4px rgba(255, 255, 255, 0.6); text-decoration: none; }
.kv-count { grid-area: count; color: var(--ink-faint); font-size: 0.52rem; letter-spacing: 1.5px; }
.kv-count .kv-k { color: var(--hot); font-weight: 700; }
.kv-count .kv-p { color: var(--chrome); font-weight: 700; }
.kv-keys { grid-area: keys; display: flex; align-items: center; gap: 8px; justify-self: end; }
.kv-keys .plate-key { height: 30px; padding: 0 16px; font-size: 0.66rem; letter-spacing: 3px; }
.kv-keys .plate-key:active { height: 28px; }
.kv-kick { --key-ink: var(--hot); }
.kv-keep { --key-ink: var(--chrome); }
.kv-veto { --key-ink: var(--amber); }
.kv-cast { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-dim); font-size: 0.56rem; letter-spacing: 2px; }
.kv-cast i { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.kv-cast.is-out { color: var(--ink-faint); }

/* The one it is about: told, never counted. */
.kick-vote.is-target .kv-body { grid-template-areas: "kicker clock" "line line"; }

/* Closed: the result, for a couple of minutes, then gone. */
.kick-vote:not(.is-open) { border-color: color-mix(in srgb, var(--ink) 25%, transparent); box-shadow: none; }
.kick-vote.is-passed { border-color: color-mix(in srgb, var(--hot) 55%, transparent); }
.kick-vote.is-failed .kv-tape, .kick-vote.is-vetoed .kv-tape { background: repeating-linear-gradient(-45deg, var(--chrome) 0 7px, #111 7px 14px); opacity: 0.5; }
.kv-result, .kick-vote:not(.is-open) .kv-body { grid-template-areas: "kicker dismiss" "line dismiss"; }
.kv-final { color: var(--ink-faint); font-size: 0.56rem; letter-spacing: 1.5px; margin-left: 6px; }
.kv-dismiss { grid-area: dismiss; width: 28px; height: 28px; padding: 0; font-size: 0.9rem; }
/* Sinks 2px, as every key does: .abort-key:active would make it 38px tall. */
.kick-vote .kv-dismiss:active { height: 26px; }

@media (max-width: 768px) {
    .kick-vote { margin: 8px 10px 0; }
    .kv-keys { justify-self: stretch; }
    .kv-keys .plate-key { flex: 1; }
}

/* ------------------------------------------------------------------ *
 * LINK TRIMMED (js/linkclean.js)
 *
 * A strip that rises off the top of the composer when a pasted link has
 * had its marketing cut, with an UNDO. 10065 in the z-index band: over the
 * message pane and its media, under the formatting toolbar. Comes in once,
 * on transform and opacity, and goes after seven seconds.
 * ------------------------------------------------------------------ */
.link-trim {
    position: absolute;
    left: 20px;
    bottom: calc(100% + 6px);
    z-index: 10065;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: calc(100% - 40px);
    padding: 6px 8px 6px 10px;
    border: 1px solid color-mix(in srgb, var(--ok) 55%, transparent);
    border-left: 3px solid var(--ok);
    border-radius: 3px;
    background: #050a08;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6), 0 0 14px color-mix(in srgb, var(--ok) 18%, transparent);
    font-family: var(--font-mono);
    animation: link-trim-in 0.22s ease-out;
}
.lt-icon { color: var(--ok); font-size: 0.95rem; transform: rotate(-90deg); }
.lt-copy { min-width: 0; display: grid; gap: 1px; }
.lt-copy b { color: var(--ok); font-size: 0.6rem; letter-spacing: 3px; }
.lt-copy span { color: var(--ink-dim); font-size: 0.56rem; letter-spacing: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lt-undo { --key-ink: var(--ink-dim); flex: none; height: 24px; padding: 0 10px; letter-spacing: 2px; }
@keyframes link-trim-in { from { opacity: 0; transform: translateY(6px); } }
@media (max-width: 768px) { .link-trim { left: 10px; max-width: calc(100% - 20px); } }
@media (prefers-reduced-motion: reduce) { .link-trim { animation: none; } }

/* ------------------------------------------------------------------ *
 * WHAT IS THIS? — the back of the box, from the login screen
 *
 * The sticker on the board's chin (.bbs-sticker, under THE BOARD) opens
 * the sheet: about.html in a frame, which asks to be closed when PATCH IN
 * is pressed.
 * ------------------------------------------------------------------ */
.about-sheet {
    position: relative;
    width: min(1120px, calc(100vw - 32px));
    height: calc(100vh - 32px);
    height: calc(100dvh - 32px);
    border: 3px solid #111842;
    border-radius: 6px;
    background: #f6f0e1;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
    overflow: hidden;
}
.about-sheet iframe { display: block; width: 100%; height: 100%; border: 0; }
.about-close { --key-ink: #111842; position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; padding: 0; background: #f6f0e1; font-size: 1.2rem; }
.about-close:active { height: 34px; }
@media (max-width: 600px) { .about-sheet { width: 100vw; height: 100dvh; border-radius: 0; border: 0; } }

/* ------------------------------------------------------------------ *
 * Link cards and EJECT (js/linkcards.js)
 *
 * A link card is small on purpose: the site in mono caps, the title on one
 * line, one line of what the page says it is. No picture — that would load
 * from the linked site in every reader's browser. It sits at the media
 * layer like the other embeds.
 *
 * EJECT replaces the pink X on a preview's corner: a small key, as if
 * ejecting the cartridge, shown when the preview is hovered (always on a
 * touch screen, which has no hover). 10003 in the z-index band, so it sits
 * over the image or video it would eject.
 * ------------------------------------------------------------------ */
.embed-slot { position: relative; max-width: 100%; }
.embed-slot.is-link { width: 420px; }

.link-card {
    position: relative;
    z-index: 10001;
    display: grid;
    gap: 2px;
    width: 100%;
    box-sizing: border-box;
    padding: 7px 12px 8px;
    border: 1px solid color-mix(in srgb, var(--chrome) 18%, transparent);
    border-left: 2px solid color-mix(in srgb, var(--chrome) 55%, transparent);
    border-radius: 3px;
    background: color-mix(in srgb, var(--chrome) 4%, rgba(4, 7, 13, 0.6));
    color: var(--ink);
    text-decoration: none;
    transition: border-color 0.15s, background-color 0.15s;
}
.link-card:hover { border-color: color-mix(in srgb, var(--chrome) 45%, transparent); border-left-color: var(--chrome); background-color: color-mix(in srgb, var(--chrome) 8%, rgba(4, 7, 13, 0.6)); }
.lc-site { color: var(--chrome); font: 700 0.55rem var(--font-mono); letter-spacing: 2px; text-transform: uppercase; opacity: 0.8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lc-title { font-size: 0.85rem; font-weight: 600; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lc-desc { color: var(--ink-dim); font-size: 0.75rem; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-card.is-loading .lc-title { width: 55%; height: 0.7rem; margin-top: 3px; border-radius: 2px; background: color-mix(in srgb, var(--chrome) 10%, transparent); }

.eject-key {
    --key-ink: var(--hot);
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 10003;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 22px;
    padding: 0 8px 0 7px;
    box-sizing: border-box;
    border: 1px solid var(--key-ink);
    border-bottom-width: 3px;
    border-radius: 2px;
    background: rgba(8, 4, 10, 0.88);
    color: var(--key-ink);
    font: 700 0.55rem var(--font-mono);
    letter-spacing: 2px;
    cursor: pointer;
    box-shadow: 0 0 8px color-mix(in srgb, var(--key-ink) 35%, transparent), 0 2px 6px rgba(0, 0, 0, 0.6);
    opacity: 0;
    transform: translateY(-3px);
    transition: opacity 0.15s, transform 0.15s, background-color 0.15s, color 0.15s;
}
.eject-glyph { font-size: 0.75rem; line-height: 1; }
.embed-slot:hover .eject-key, .eject-key:focus-visible { opacity: 1; transform: none; }
.eject-key:hover { background: var(--key-ink); color: #0a0306; }
.eject-key:active { border-bottom-width: 1px; margin-top: 2px; height: 20px; }
/* Top right on every preview, a link card's too: there it sits over the
   short site line rather than the title. A touch screen has no hover to
   bring it up, and EJECT is in the message's tray there instead. */
@media (hover: none) { .eject-key { display: none; } }
@media (max-width: 768px) { .embed-slot.is-link { width: 100%; } }
@media (prefers-reduced-motion: reduce) { .eject-key { transition: none; } }

/* In place of BLOCK on a service account's card (SYSTEM_MINDER, the news
   bot): a stamped tag saying whose voice it is. */
.house-tag {
    display: inline-flex;
    align-items: center;
    height: 30px;
    padding: 0 10px;
    border: 1px dashed color-mix(in srgb, var(--amber) 60%, transparent);
    border-radius: 2px;
    color: var(--amber);
    font: 700 0.6rem var(--font-mono);
    letter-spacing: 2px;
    opacity: 0.85;
}

/* ===================================================================
   TIME_CAPSULES (js/capsules.js)
   The Capsule Loader: amber dials in a black bezel, a log track from a
   minute to five years, SEAL under a flip cover. In the room, a canister
   where it was sealed and a band over it once it opens. Amber because a
   capsule is filed, not live. Nothing here loops: the reels roll once per
   change, the stamp lands once, an arrival thumps once.
   =================================================================== */
.capsule-loader {
    --seg: #ffb000;
    --seg-glow: rgba(255, 170, 0, 0.55);
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(600px, calc(100vw - 32px));
    max-height: calc(100dvh - 32px);
    overflow: auto;
    border: 1px solid #5a4a2a;
    border-radius: 4px;
    background:
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 3px),
        linear-gradient(180deg, #1c1a17, #0e0d0b 40%, #12100d);
    box-shadow: 0 0 0 1px #000, 0 30px 80px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    color: var(--ink);
    font-family: var(--font-mono);
}
.cl-mast { display: flex; align-items: flex-start; gap: 14px; padding: 16px 18px 12px; background: linear-gradient(180deg, #24201a, #16130f); }
.cl-title { flex: 1; min-width: 0; }
.cl-title small { display: block; color: var(--amber); font-size: 0.56rem; letter-spacing: 4px; opacity: 0.8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-title h2 { margin: 3px 0; font: 800 clamp(1.3rem, 5.4vw, 2rem)/1 var(--font-sans); letter-spacing: clamp(4px, 1.6vw, 10px); color: #f4e7c6; text-shadow: 0 2px 0 #000, 0 0 18px rgba(255, 170, 0, 0.35); }
.cl-title span { display: block; color: var(--ink-dim); font-size: 0.54rem; line-height: 1.5; letter-spacing: 2px; }
.cl-x { --key-ink: var(--ink-dim); width: 34px; height: 34px; font-size: 1.1rem; flex: none; }
.cl-x:active { height: 32px; }
.cl-hazard { flex: none; height: 8px; background: repeating-linear-gradient(-45deg, #f0c020 0 12px, #111 12px 24px); box-shadow: inset 0 -2px 3px rgba(0, 0, 0, 0.5); }

/* The dials: a bezel of five windows. */
.cl-dials {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: clamp(4px, 1.6vw, 10px);
    margin: 18px 16px 0;
    padding: 12px clamp(8px, 2.4vw, 16px) 10px;
    border: 1px solid #000;
    border-radius: 6px;
    background: linear-gradient(180deg, #0b0a08, #050403);
    box-shadow: inset 0 2px 14px rgba(0, 0, 0, 0.95), inset 0 0 0 1px rgba(255, 170, 0, 0.08), 0 1px 0 rgba(255, 255, 255, 0.05);
}
.cl-dial { display: flex; flex-direction: column; align-items: stretch; gap: 3px; }
.cl-label { color: var(--ink-faint); font-size: 0.5rem; letter-spacing: 2px; text-align: center; white-space: nowrap; }
.cl-label em { font-style: normal; color: var(--amber); margin-left: 5px; }
.cl-step {
    height: 20px;
    border: 1px solid #3a3020;
    border-radius: 2px;
    background: linear-gradient(180deg, #2a241a, #15120d);
    color: #b8a070;
    font-size: 0.55rem;
    line-height: 1;
    cursor: pointer;
    touch-action: none;
    user-select: none;
}
.cl-step:hover { color: var(--seg); border-color: #6a5528; }
.cl-step:active { background: #0a0806; color: var(--seg); transform: translateY(1px); }
.cl-window {
    position: relative;
    display: grid;
    place-items: center;
    padding: 4px clamp(4px, 1.4vw, 9px);
    border: 1px solid #1e1a12;
    border-radius: 3px;
    background: #070500;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 1);
    font: 700 clamp(1.35rem, 6.6vw, 2.5rem)/1.1 var(--font-mono);
    font-variant-numeric: tabular-nums;
    letter-spacing: 1px;
    overflow: hidden;
    cursor: ns-resize;
    touch-action: none;
    user-select: none;
}
.cl-window:focus-visible { outline: 2px solid var(--seg); outline-offset: 2px; }
.cl-window.is-gripped { border-color: #6a5528; }
/* Unlit segments behind the lit ones, as on a real display. */
.cl-ghost, .cl-face { grid-area: 1 / 1; }
.cl-ghost { color: var(--seg); opacity: 0.07; }
.cl-face { color: var(--seg); text-shadow: 0 0 8px var(--seg-glow), 0 0 2px var(--seg-glow); }
.cl-face.roll-up { animation: cl-roll-up 0.14s ease-out; }
.cl-face.roll-down { animation: cl-roll-down 0.14s ease-out; }
@keyframes cl-roll-up { from { transform: translateY(55%); opacity: 0.2; } to { transform: none; opacity: 1; } }
@keyframes cl-roll-down { from { transform: translateY(-55%); opacity: 0.2; } to { transform: none; opacity: 1; } }
.cl-gap { width: clamp(2px, 1.5vw, 10px); }
.cl-colon { align-self: center; margin-top: 18px; color: var(--seg); font: 700 clamp(1.2rem, 5vw, 2rem)/1 var(--font-mono); text-shadow: 0 0 8px var(--seg-glow); }

.cl-now { display: flex; justify-content: center; gap: 10px; margin: 8px 16px 0; font-size: 0.55rem; letter-spacing: 2px; color: var(--ink-faint); }
.cl-now b { color: var(--ink-dim); font-weight: 400; }

/* The track: a minute to five years, log scale, draggable. */
.cl-track { --at: 0%; margin: 16px 22px 0; padding: 6px 0 2px; cursor: pointer; touch-action: none; user-select: none; }
.cl-track:focus-visible { outline: 2px solid var(--seg); outline-offset: 4px; }
.cl-rail { position: relative; height: 8px; border: 1px solid #2a2418; border-radius: 4px; background: #070500; box-shadow: inset 0 1px 4px #000; }
.cl-fill { position: absolute; left: 0; top: 0; bottom: 0; width: var(--at); border-radius: 4px; background: linear-gradient(90deg, rgba(255, 170, 0, 0.15), rgba(255, 170, 0, 0.6)); }
.cl-marker { position: absolute; top: -6px; left: var(--at); width: 4px; height: 18px; margin-left: -2px; border-radius: 1px; background: var(--seg); box-shadow: 0 0 10px var(--seg-glow); }
.cl-track.is-gripped .cl-marker { width: 6px; margin-left: -3px; }
.cl-track.is-wrong .cl-fill { background: rgba(255, 51, 102, 0.3); }
.cl-track.is-wrong .cl-marker { background: var(--hot); box-shadow: 0 0 10px var(--hot); }
.cl-ticks { position: relative; height: 16px; margin-top: 4px; }
.cl-ticks span { position: absolute; transform: translateX(-50%); color: var(--ink-faint); font-size: 0.5rem; letter-spacing: 1px; }
.cl-ticks span:last-child { transform: translateX(-100%); }

.cl-readout { display: flex; align-items: baseline; justify-content: center; gap: 12px; margin: 10px 16px 0; }
.cl-readout span { color: var(--ink-faint); font-size: 0.55rem; letter-spacing: 3px; }
.cl-readout b { color: var(--seg); font-size: 1rem; letter-spacing: 2px; text-shadow: 0 0 8px var(--seg-glow); }
.cl-readout.is-wrong b { color: var(--hot); text-shadow: 0 0 8px rgba(255, 51, 102, 0.5); font-size: 0.8rem; }

.cl-quick { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 14px 16px 0; }
.cl-preset { --key-ink: #c9a860; height: 28px; padding: 0 10px; letter-spacing: 2px; }
.cl-preset:active { height: 26px; }
.cl-preset:hover { --key-ink: var(--amber); }

.cl-contents { position: relative; display: block; margin: 16px 16px 0; }
.cl-contents > span { display: block; margin-bottom: 5px; color: var(--amber); font-size: 0.55rem; letter-spacing: 4px; }
.cl-contents textarea {
    box-sizing: border-box;
    width: 100%;
    min-height: 92px;
    padding: 10px 12px 20px;
    border: 1px solid #3a3020;
    border-radius: 3px;
    background: #0a0806;
    color: var(--ink);
    font: 0.85rem/1.45 var(--font-mono);
    resize: vertical;
}
.cl-contents textarea:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 1px rgba(255, 170, 0, 0.3); }
.cl-contents i { position: absolute; right: 10px; bottom: 8px; color: var(--ink-faint); font: normal 0.5rem var(--font-mono); letter-spacing: 1px; }

.cl-keys { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin: 16px 16px 18px; }
.cl-guard { min-width: 190px; }
.cl-seal { --key-ink: var(--amber); width: 100%; height: 44px; display: flex; flex-direction: column; justify-content: center; gap: 3px; }
.cl-seal:active { height: 42px; }
.cl-seal b { font-size: 0.8rem; letter-spacing: 4px; }
.cl-seal span { font-size: 0.45rem; letter-spacing: 1px; opacity: 0.8; }
.cl-seal:hover, .cl-seal:focus-visible { background: var(--amber); color: #120d02; }

/* Sealing: the bay goes dark and the stamp lands. */
.cl-stamp {
    position: absolute;
    left: 50%;
    top: 48%;
    display: none;
    flex-direction: column;
    align-items: center;
    padding: 10px 22px 8px;
    border: 4px double var(--amber);
    border-radius: 6px;
    background: rgba(10, 8, 4, 0.92);
    color: var(--amber);
    transform: translate(-50%, -50%) rotate(-8deg);
    pointer-events: none;
}
.cl-stamp b { font: 800 2.2rem/1 var(--font-sans); letter-spacing: 12px; margin-right: -12px; }
.cl-stamp small { margin-top: 6px; font-size: 0.55rem; letter-spacing: 2px; }
.capsule-loader.is-sealing > :not(.cl-stamp):not(.cl-mast):not(.cl-hazard) { opacity: 0.35; transition: opacity 0.3s; pointer-events: none; }
.capsule-loader.is-sealed .cl-stamp { display: flex; animation: cl-stamp 0.32s cubic-bezier(0.2, 1.6, 0.4, 1); }
@keyframes cl-stamp { from { transform: translate(-50%, -50%) rotate(-8deg) scale(2.2); opacity: 0; } to { transform: translate(-50%, -50%) rotate(-8deg) scale(1); opacity: 1; } }

@media (max-width: 480px) {
    .cl-mast { padding: 14px 14px 10px; }
    .cl-title h2 { font-size: 1.35rem; letter-spacing: 4px; }
    .cl-title span { letter-spacing: 1px; }
    .cl-dials { gap: 3px; margin: 14px 10px 0; padding: 10px 6px 8px; }
    .cl-window { padding: 3px 3px; font-size: 1.3rem; letter-spacing: 0; }
    .cl-label { font-size: 0.45rem; letter-spacing: 1px; }
    .cl-label em { margin-left: 3px; }
    .cl-gap { width: 2px; }
    .cl-colon { font-size: 1.1rem; margin-top: 14px; }
    .cl-track { margin: 14px 16px 0; }
    .cl-keys { flex-direction: column-reverse; align-items: stretch; }
    .cl-guard { min-width: 0; }
}

/* In the room: the canister where it was sealed. */
.capsule-stub {
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: 420px;
    margin-top: 4px;
    padding: 10px 14px;
    border: 1px solid color-mix(in srgb, var(--amber) 35%, transparent);
    border-radius: 4px;
    background:
        repeating-linear-gradient(-45deg, rgba(255, 170, 0, 0.035) 0 8px, transparent 8px 16px),
        rgba(10, 8, 4, 0.6);
    font-family: var(--font-mono);
}
.cap-can { position: relative; flex: none; width: 26px; height: 40px; margin-top: 4px; border: 1px solid #6a5528; border-radius: 4px 4px 6px 6px; background: linear-gradient(90deg, #2a2418, #5a4a2a 40%, #2a2418); }
.cap-lid { position: absolute; left: -3px; right: -3px; top: -5px; height: 6px; border: 1px solid #6a5528; border-radius: 2px; background: #4a3c22; transform-origin: 0 100%; transition: transform 0.4s; }
.cap-band { position: absolute; left: 0; right: 0; top: 14px; height: 7px; background: repeating-linear-gradient(-45deg, #e8b818 0 4px, #141414 4px 8px); }
.cap-led { position: absolute; left: 50%; bottom: 5px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 6px var(--amber); }
.cap-body { min-width: 0; }
.cap-kicker { color: var(--amber); font-size: 0.55rem; letter-spacing: 3px; }
.cap-when { margin-top: 3px; color: var(--ink); font-size: 0.72rem; letter-spacing: 1px; }
.cap-count { margin-top: 4px; font-size: 0.6rem; letter-spacing: 2px; color: var(--ink-faint); }
.cap-count b { color: var(--amber); font-weight: 700; font-variant-numeric: tabular-nums; text-shadow: 0 0 6px rgba(255, 170, 0, 0.45); }
.capsule-stub.is-due .cap-count b { color: var(--ok); text-shadow: 0 0 6px rgba(0, 255, 136, 0.45); }
.capsule-stub.is-open { border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: rgba(10, 8, 4, 0.5); }
.capsule-stub.is-open .cap-kicker { color: var(--ok); }
.capsule-stub.is-open .cap-lid { transform: rotate(-35deg) translate(-2px, -3px); }
.capsule-stub.is-open .cap-led { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.cap-jump {
    margin-top: 5px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--chrome);
    font: 700 0.6rem var(--font-mono);
    letter-spacing: 2px;
    cursor: pointer;
}
.cap-jump:hover { text-decoration: underline; }

/* Over a capsule that has opened. */
.capsule-band {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 10px;
    margin: 4px 0 4px;
    padding: 4px 10px;
    border-left: 3px solid var(--amber);
    background: linear-gradient(90deg, rgba(255, 170, 0, 0.12), transparent 80%);
    color: var(--amber);
    font: 0.58rem var(--font-mono);
    letter-spacing: 2px;
}
.capsule-band .cap-glyph { font-style: normal; font-size: 0.8rem; }
.capsule-band .cap-jump { margin: 0; font-size: 0.55rem; }
.message-block.capsule-arrive { animation: capsule-arrive 0.9s cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes capsule-arrive {
    0% { transform: translateY(-14px) scale(0.98); opacity: 0; }
    35% { opacity: 1; }
    100% { transform: none; }
}
:root.ambient .capsule-stub:not(.is-open) .cap-led { animation: cap-led 1.2s steps(2, jump-none) 3; }
@keyframes cap-led { 50% { opacity: 0.25; } }

@media (prefers-reduced-motion: reduce) {
    .cl-face.roll-up, .cl-face.roll-down, .capsule-loader.is-sealed .cl-stamp, .message-block.capsule-arrive { animation: none; }
    .cap-lid { transition: none; }
}

/* ===================================================================
   THE BACK ROOM (js/backroom.js)
   A room that only exists while people are in it. Lit from one bulb at
   the top, a line each, IRC-dense: it is talk, not an archive. Nothing
   here loops: the lights come on once, as you pull the chain.
   =================================================================== */
#current-channel-name .chan-sign.is-backroom {
    border-color: var(--neon-purple);
    background: color-mix(in srgb, var(--neon-purple) 14%, transparent);
    text-shadow: 0 0 6px var(--neon-purple);
    box-shadow: 0 0 12px color-mix(in srgb, var(--neon-purple) 35%, transparent);
}
#current-channel-name .chan-sign.is-backroom i { background: #ffc46b; box-shadow: 0 0 8px #ffb347; }

#message-list.is-backroom {
    background:
        radial-gradient(ellipse 70% 260px at 50% 0, rgba(255, 190, 110, 0.08), transparent 70%),
        linear-gradient(180deg, rgba(188, 19, 254, 0.04), transparent 40%);
}
#message-list.is-backroom.br-lighting { animation: br-lights-on 0.9s steps(1) 1; }
@keyframes br-lights-on {
    0% { filter: brightness(0.25); }
    18% { filter: brightness(1); }
    26% { filter: brightness(0.4); }
    36%, 100% { filter: none; }
}

.br-door {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 10px;
    padding: 8px 12px;
    border: 1px solid color-mix(in srgb, var(--neon-purple) 35%, transparent);
    border-radius: 3px;
    background: rgba(10, 6, 16, 0.92);
    font: 0.62rem var(--font-mono);
    letter-spacing: 1px;
    color: var(--text-secondary);
}
.br-bulb {
    flex: none;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #ffc46b;
    box-shadow: 0 0 10px #ffb347, 0 0 2px #fff inset;
}
.br-in { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; min-width: 0; }
.br-count { color: var(--neon-purple); font-weight: 700; letter-spacing: 2px; }
.br-person { color: var(--who, var(--text-primary)); }

.br-note {
    margin: 6px 0 10px;
    padding-left: 10px;
    border-left: 2px solid color-mix(in srgb, var(--neon-purple) 45%, transparent);
    font: italic 0.72rem/1.5 var(--font-mono);
    color: var(--text-secondary);
}

.br-line {
    position: relative;
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    align-items: baseline;
    gap: 10px;
    padding: 3px 6px;
    border-radius: 3px;
    line-height: 1.45;
}
.br-line:hover { background: rgba(255, 255, 255, 0.03); }
.br-line time { font: 0.6rem var(--font-mono); color: var(--text-secondary); opacity: 0.6; }
.br-who { color: var(--who, var(--text-primary)); font-weight: 700; cursor: pointer; white-space: nowrap; }
.br-text { min-width: 0; overflow-wrap: anywhere; }
.br-text.is-action { font-style: italic; color: color-mix(in srgb, var(--text-primary) 80%, transparent); }
.br-keys { display: flex; gap: 4px; opacity: 0; transition: opacity 0.15s; }
.br-line:hover .br-keys, .br-keys:focus-within { opacity: 1; }
@media (hover: none) { .br-keys { opacity: 0.6; } }
.br-key {
    padding: 0 5px;
    border: 1px solid color-mix(in srgb, var(--text-secondary) 40%, transparent);
    border-radius: 2px;
    background: none;
    color: var(--text-secondary);
    font: 0.65rem var(--font-mono);
    cursor: pointer;
}
.br-key:hover { color: var(--neon-pink); border-color: var(--neon-pink); }

@media (max-width: 520px) {
    .br-line { grid-template-columns: auto 1fr auto; }
    .br-line time { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    #message-list.is-backroom.br-lighting { animation: none; }
    .br-keys { transition: none; }
}

/* EDIT, in place (editMessage): the composer's recessed screen, smaller, with
   CANCEL and SAVE keys under it and the keyboard's way of doing each. */
.edit-bay {
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.edit-screen {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 0 10px;
    border: 1px solid color-mix(in srgb, var(--neon-cyan) 28%, transparent);
    border-radius: 3px;
    background:
        repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 3px),
        #04070c;
    box-shadow: inset 0 2px 7px rgba(0, 0, 0, 0.75);
    cursor: text;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.edit-screen:focus-within {
    border-color: var(--neon-accent);
    box-shadow: inset 0 2px 7px rgba(0, 0, 0, 0.75), 0 0 10px color-mix(in srgb, var(--neon-accent) 40%, transparent);
}

.edit-prompt {
    flex-shrink: 0;
    padding-top: 10px;
    line-height: 20px;
    color: var(--neon-accent);
    font-family: var(--font-mono);
    font-weight: bold;
    opacity: 0.45;
    transition: opacity 0.15s, text-shadow 0.15s;
}

.edit-screen:focus-within .edit-prompt {
    opacity: 1;
    text-shadow: 0 0 6px var(--neon-accent);
}

/* A line at a time, up to eight, then it scrolls. */
.edit-input {
    flex: 1;
    min-width: 0;
    display: block;
    height: 40px;
    min-height: 40px;
    max-height: 180px;
    margin: 0;
    padding: 10px 0;
    box-sizing: border-box;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 20px;
    resize: none;
    overflow-y: auto;
}

.edit-keys {
    container-type: inline-size;
    /* Room under the keys when an edit scrolls them into sight. */
    scroll-margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.edit-hint {
    margin-right: auto;
    min-width: 0;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.55rem;
    letter-spacing: 1px;
    opacity: 0.6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.edit-keys .plate-key.edit-key {
    flex-shrink: 0;
    height: 28px;
    min-width: 84px;
    padding: 0 14px;
    font-size: 0.62rem;
    font-weight: bold;
    letter-spacing: 2px;
}

.edit-keys .plate-key.edit-key:active { height: 26px; }
.edit-keys .plate-key.edit-key:disabled:active { height: 28px; }

/* As much of the hint as fits beside the keys, or none of it. */
@container (max-width: 400px) { .edit-hint-esc { display: none; } }
@container (max-width: 300px) { .edit-hint { display: none; } }

/* ------------------------------------------------------------------ *
 * A MESSAGE'S KEYS (js/msgkeys.js)
 *
 * The hover row at the corner (REPLY, REACT, ⋮), the tray ⋮ opens under the
 * header, and the carriage: a focus wound through the room from the keyboard,
 * as the Black Pages do on a frame.
 * ------------------------------------------------------------------ */
.message-actions {
    align-items: center;
    gap: 4px;
}

.message-block:focus-within .message-actions,
.message-block.actions-open .message-actions,
.message-block.is-carriage .message-actions {
    opacity: 1;
}

.plate-key.msg-key {
    flex-shrink: 0;
    height: 18px;
    min-width: 20px;
    padding: 0 7px;
    font-size: 0.52rem;
    font-weight: bold;
    letter-spacing: 1.5px;
}

.plate-key.msg-key:active { height: 16px; }
.plate-key.msg-key.is-react { padding: 0 6px; font-size: 0.66rem; letter-spacing: 0; }
.plate-key.msg-key.is-more { width: 20px; padding: 0; font-size: 0.72rem; letter-spacing: 0; }
.plate-key.msg-key.is-more[aria-expanded="true"] {
    background: var(--key-ink);
    color: var(--bg-main);
}

/* The tray, on a touch screen: a row of keys under the header, the dangerous
   key at the far end. No box of its own; it belongs to the post. */
.msg-tray {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 6px 0 6px;
    animation: ch-tray-in 0.14s ease-out;
}

.msg-tray-gap { flex: 1 0 0; }

.plate-key.msg-tray-key {
    flex-shrink: 0;
    height: 26px;
    padding: 0 12px;
    font-size: 0.6rem;
    font-weight: bold;
    letter-spacing: 2px;
}

.plate-key.msg-tray-key:active { height: 24px; }

/* On a pointer: in the hover row, growing leftward from ⋮, the same size as
   its keys, the dangerous one furthest away past a rule. */
.msg-tray.is-inline {
    display: inline-flex;
    flex-wrap: nowrap;
    gap: 4px;
    margin: 0 2px 0 0;
    animation: msg-tray-slide 0.14s ease-out;
}

@keyframes msg-tray-slide {
    from { opacity: 0; transform: translateX(6px); }
}

.msg-tray.is-inline .plate-key.msg-tray-key {
    height: 18px;
    padding: 0 7px;
    font-size: 0.52rem;
    letter-spacing: 1.5px;
}

.msg-tray.is-inline .plate-key.msg-tray-key:active { height: 16px; }

/* The row floats over the header's right-hand end rather than taking room in
   it: in the header it held its width while invisible and squeezed long names,
   and opened in a narrow column it wrapped the header and moved the post. */
.message-header .message-actions {
    position: absolute;
    top: -1px;
    right: 0;
    z-index: 2;
    padding: 1px 0 1px 14px;
    background: linear-gradient(90deg, transparent, var(--bg-main) 12px);
}

.msg-tray-rule {
    align-self: stretch;
    width: 1px;
    margin: 2px 3px;
    background: color-mix(in srgb, var(--neon-cyan) 30%, transparent);
}

/* No hover: no row. The tray is opened by tapping the message, and its keys
   are sized for a finger. */
@media (max-width: 768px), (hover: none) {
    .message-actions,
    .message-block.actions-open .message-actions { display: none; }
    .plate-key.msg-tray-key { height: 34px; padding: 0 14px; }
    .plate-key.msg-tray-key:active { height: 32px; }
}

/* The carriage. The rest of the room goes out of focus; the frame in the
   carriage hunts for a moment, then holds. */
#message-list.has-carriage .message-block {
    transition: opacity 0.2s, filter 0.2s;
}

#message-list.has-carriage .message-block:not(.is-carriage) {
    opacity: 0.42;
    filter: blur(0.5px);
}

.message-block.is-carriage {
    outline: none;
    animation: fiche-focus 0.42s ease-out;
}

.message-block.is-carriage::after {
    content: "";
    position: absolute;
    inset: -6px -8px;
    border-radius: 4px;
    background: color-mix(in srgb, var(--neon-cyan) 4%, transparent);
    pointer-events: none;
}

.msg-carriage-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    margin-top: 8px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.55rem;
    letter-spacing: 1px;
}

.msg-carriage-legend kbd {
    display: inline-block;
    min-width: 9px;
    margin-right: 5px;
    padding: 1px 4px;
    border: 1px solid color-mix(in srgb, var(--neon-cyan) 50%, transparent);
    border-bottom-width: 2px;
    border-radius: 2px;
    color: var(--neon-cyan);
    font: inherit;
    text-align: center;
}

@media (prefers-reduced-motion: reduce) {
    .msg-tray,
    .msg-tray.is-inline,
    .message-block.is-carriage { animation: none; }
    #message-list.has-carriage .message-block { transition: none; }
}

/* ------------------------------------------------------------------ *
 * SEARCH (js/search.js): GURABU•SCAN
 *
 * Rack gear from an eighties that went differently: two units from two
 * makers, screwed into the same rack through slotted ears.
 *
 * The upper is the scanner, in the livery of a Japanese home computer:
 * matte black plastic, an italic wordmark in yellow (its English not quite
 * right; Gurabuscan.png), twin slashes, a ruled model line and a
 * filled badge, every control's legend printed in the same yellow. A drilled speaker
 * vent, a yellow-to-red LED signal meter, a yellow vacuum-fluorescent band
 * display with a red marker, function keys (OFF among them, its lamp
 * red), a status read-out in the same yellow. Its keys are that yellow
 * too, darker and worn, with black legends.
 *
 * The lower is HARUSAME's tape recorder, the intercept log: ribbed
 * charcoal, white legends in English only (not that kind of maker), a vent of slots, a boxed slot legend, lamps
 * with their names over them, a red REC block at its end and the maker's
 * name in dots under its screen; what's caught scrolls up that screen, in
 * white and silver, the recorder's red marking the channel, the match and
 * the one in focus, its own charcoal key for OLDER RESULTS.
 *
 * The room's neon catches the metal, pink from the top left and cyan from
 * the bottom right, and stays on it. The green readout is where you type,
 * as everywhere. One size whatever it finds (85% of the screen); the log
 * takes the rest and scrolls.
 * ------------------------------------------------------------------ */
.search-card.scanner {
    --vfd: #ffd84a;
    --vfd-dim: rgba(255, 216, 74, 0.28);
    --livery: #f0d43a;
    --gs-red: #ff4b3e;
    --hr-red: #ee4a3c;
    --silk: color-mix(in srgb, var(--livery) 72%, transparent);
    --ear: 34px;
    position: relative;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 820px;
    max-width: calc(100vw - 24px);
    height: 85vh;
    height: 85dvh;
    box-sizing: border-box;
    font-family: var(--font-mono);
}

/* A rack unit: an ear each side behind a seam, two screws through each
   ear's slots, and the room's neon on its edges. Each maker paints its own
   face below. */
.scan-unit {
    --face: linear-gradient(180deg, #1b1b1e, #141416 60%, #101012);
    --texture: radial-gradient(rgba(255, 255, 255, 0.03) 0.6px, transparent 0.8px) 0 0 / 3px 3px;
    position: relative;
    flex: none;
    box-sizing: border-box;
    padding: 14px calc(var(--ear) + 12px);
    border-radius: 3px;
    background:
        linear-gradient(90deg,
            transparent calc(var(--ear) - 1px), rgba(0, 0, 0, 0.7) calc(var(--ear) - 1px) var(--ear), rgba(255, 255, 255, 0.05) var(--ear) calc(var(--ear) + 1px), transparent calc(var(--ear) + 1px),
            transparent calc(100% - var(--ear) - 1px), rgba(0, 0, 0, 0.7) calc(100% - var(--ear) - 1px) calc(100% - var(--ear)), rgba(255, 255, 255, 0.05) calc(100% - var(--ear)) calc(100% - var(--ear) + 1px), transparent calc(100% - var(--ear) + 1px)),
        radial-gradient(ellipse 60% 120% at 0% 0%, color-mix(in srgb, var(--hot) 8%, transparent), transparent 70%),
        radial-gradient(ellipse 60% 120% at 100% 100%, color-mix(in srgb, var(--chrome) 6%, transparent), transparent 70%),
        var(--texture),
        var(--face);
    box-shadow:
        inset 0 1px 0 color-mix(in srgb, var(--hot) 22%, rgba(255, 255, 255, 0.1)),
        inset 0 -1px 0 color-mix(in srgb, var(--chrome) 18%, rgba(0, 0, 0, 0.6)),
        0 0 0 1px #050608,
        0 18px 40px rgba(0, 0, 0, 0.55);
}

/* The screws, top and bottom of each ear: a domed head with a cross, in a
   dark slot. */
.scan-unit::before,
.scan-unit::after {
    --head: radial-gradient(circle 6px at 50% 50%, #5d616b 0, #3b3e46 62%, #1d1e23 84%, rgba(0, 0, 0, 0.7) 94%, transparent 100%);
    --shine: radial-gradient(circle 4px at 40% 34%, rgba(255, 255, 255, 0.38), transparent);
    --hole: radial-gradient(ellipse closest-side, #000 72%, transparent 100%);
    --cross-a: linear-gradient(45deg, transparent 38%, rgba(0, 0, 0, 0.8) 38% 62%, transparent 62%);
    --cross-b: linear-gradient(-45deg, transparent 38%, rgba(0, 0, 0, 0.8) 38% 62%, transparent 62%);
    content: "";
    position: absolute;
    top: 9px;
    bottom: 9px;
    left: calc((var(--ear) - 14px) / 2);
    width: 14px;
    pointer-events: none;
    background:
        var(--cross-a) 4px 6px / 6px 6px no-repeat,
        var(--cross-b) 4px 6px / 6px 6px no-repeat,
        var(--shine) 1px 3px / 12px 12px no-repeat,
        var(--head) 1px 3px / 12px 12px no-repeat,
        var(--hole) 0 0 / 14px 18px no-repeat,
        var(--cross-a) 4px calc(100% - 6px) / 6px 6px no-repeat,
        var(--cross-b) 4px calc(100% - 6px) / 6px 6px no-repeat,
        var(--shine) 1px calc(100% - 3px) / 12px 12px no-repeat,
        var(--head) 1px calc(100% - 3px) / 12px 12px no-repeat,
        var(--hole) 0 100% / 14px 18px no-repeat;
}
.scan-unit::after { left: auto; right: calc((var(--ear) - 14px) / 2); }

/* The link cords between the makers (js/search.js layCords): drawn over
   the whole set, from the scanner's LINK jacks to the recorder's IN jacks. */
.scan-cords {
    position: absolute;
    inset: 0;
    z-index: 3;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
    filter: drop-shadow(1px 3px 2px rgba(0, 0, 0, 0.55));
}

/* Jacks. A DIN socket for data (a metal shield, its pins), a phono socket
   for video (a yellow collar); each maker's printing beside its own. */
.scan-ports,
.log-ports { display: flex; gap: 12px; }
.scan-port,
.log-port { display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--silk); font: 700 0.36rem/1.1 var(--font-sans); letter-spacing: 1px; white-space: nowrap; }
.scan-port small,
.log-port small { font-size: inherit; }
.scan-port small i { display: block; font: 700 0.32rem/1.2 "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", "Noto Sans JP", "Meiryo", var(--font-sans); font-style: normal; letter-spacing: 1px; opacity: 0.8; text-align: center; }
.scan-port b,
.log-port b { display: block; width: 14px; height: 14px; border-radius: 50%; }
.is-data > b { background: radial-gradient(circle, #0a0a0b 0 3.4px, #b6bac2 3.9px, #e0e2e7 5px, #6c6f78 6.4px, #222327 6.9px, transparent 7px); }
.is-video > b { background: radial-gradient(circle, #0a0a0b 0 1.4px, #c9ccd3 1.8px, #c9ccd3 2.4px, #e8c62a 2.8px, #b49616 4.4px, #9a9ea7 4.9px, #d8dbe0 5.8px, #45474e 6.6px, transparent 7px); }
.scan-link-field { flex: none; }
.log-ports { flex: none; margin-right: auto; }

/* A printed legend over each control, a rule running off to its right. */
.scan-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.scan-legend {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    column-gap: 6px;
    color: var(--silk);
    font: 700 0.5rem/1.1 var(--font-sans);
    letter-spacing: 2.5px;
    white-space: nowrap;
}
.scan-legend::after { content: ""; grid-row: 1; grid-column: 2; height: 1px; background: currentColor; opacity: 0.35; }
.scan-legend small { grid-row: 2; grid-column: 1; font: 700 0.42rem/1.2 "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", "Noto Sans JP", "Meiryo", var(--font-sans); letter-spacing: 2px; opacity: 0.75; }

.scan-case { display: flex; gap: 14px; }

/* The speaker vent: the plastic drilled through. */
.scan-grille {
    flex: none;
    width: 56px;
    border-radius: 2px;
    background:
        radial-gradient(circle, transparent 1.6px, #19191c 2.1px) 0 0 / 7px 7px,
        #030304;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6), 0 1px 0 1px rgba(255, 255, 255, 0.04);
}

.scan-face {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.scan-top { display: flex; align-items: flex-end; gap: 14px; }

/* The livery: the wordmark outlined in yellow and leaning, twin slashes,
   the model line ruled off them, the badge filled. */
.scan-brand { display: flex; align-items: center; min-width: 0; margin-right: auto; }
/* The wordmark: Gurabuscan.png, drawn by hand. */
.scan-brand b { flex: none; display: block; }
.scan-brand b img { display: block; width: auto; height: 24px; }
.scan-slashes {
    flex: none;
    width: 18px;
    height: 26px;
    margin: 0 0 0 10px;
    background: linear-gradient(90deg, var(--livery) 0 5px, transparent 5px 9px, var(--livery) 9px 14px, transparent 14px);
    transform: skewX(-22deg);
}
.scan-model {
    flex: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-left: -2px;
    color: var(--livery);
    font: 800 0.56rem var(--font-sans);
    letter-spacing: 1px;
    white-space: nowrap;
}
.scan-model > span { padding: 0 2px 1px 8px; border-bottom: 1.5px solid var(--livery); }
.scan-model small { padding-left: 10px; font-size: 0.42rem; letter-spacing: 1px; opacity: 0.85; }
.scan-badge {
    flex: none;
    align-self: flex-start;
    margin: 2px 0 0 8px;
    padding: 1px 4px;
    border-radius: 1px;
    background: var(--livery);
    color: #141416;
    font: italic 900 0.5rem var(--font-sans);
    letter-spacing: 0.5px;
}
.scan-badge i { margin-left: 1px; font-size: 0.4rem; }

/* Read-outs sit behind dark glass, let into the panel. */
.scan-meter,
.scan-status,
.scanner .search-screen {
    border-radius: 2px;
    background-color: #050608;
    box-shadow: 0 0 0 1px #000, 0 1px 0 1px rgba(255, 255, 255, 0.05), inset 0 2px 8px rgba(0, 0, 0, 0.9);
}

/* The signal meter: a segment for every three caught. */
.scan-signal { flex: none; }
.scan-meter { display: flex; align-items: flex-end; gap: 3px; height: 22px; padding: 4px 6px; }
.scan-meter i { --seg: var(--livery); --i: 0; width: 5px; height: 100%; border-radius: 1px; background: color-mix(in srgb, var(--seg) 10%, #050505); }
.scan-meter i:nth-child(n + 7) { --seg: var(--amber); }
.scan-meter i:nth-child(n + 9) { --seg: var(--gs-red); }
.scan-meter i.is-lit { background: var(--seg); box-shadow: 0 0 5px var(--seg); }
@keyframes seg-hold { from, to { background: var(--seg); box-shadow: 0 0 5px var(--seg); } }
/* Switched on: each segment lights in turn to the top, and they fall back
   from the top down. */
.is-booting .scan-meter i { animation: seg-hold calc(960ms - var(--i) * 80ms) calc(150ms + var(--i) * 40ms); }
/* An answer: the meter jumps to full and settles to what was caught. */
.scan-meter.is-landing i { animation: seg-hold calc(120ms + (9 - var(--i)) * 28ms); }

/* The scanner's keys: its livery's yellow gone darker with years of use,
   black legends; polished where thumbs land, grimy at the edges, the paint
   rubbed pale along an edge (a different stretch on each key), the legends
   a little rubbed away. */
.scan-off,
.scanner .search-op {
    --wx: 30%;
    --wy: 70%;
    border: 0;
    border-radius: 3px;
    background:
        radial-gradient(ellipse 34% 2.5px at var(--wx) 1px, rgba(255, 247, 210, 0.55), transparent),
        radial-gradient(ellipse 2.5px 32% at calc(100% - 1px) var(--wy), rgba(255, 247, 210, 0.35), transparent),
        radial-gradient(ellipse 60% 55% at 50% 55%, rgba(255, 242, 180, 0.24), transparent 70%),
        radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(60, 45, 0, 0.38) 100%),
        linear-gradient(180deg, #d4b72f, #b09520);
    color: rgba(20, 20, 22, 0.86);
    text-shadow: 0 1px 0 rgba(255, 240, 170, 0.3);
    cursor: pointer;
    box-shadow: 0 3px 0 #6b5810, 0 4px 0 #000, 0 0 0 1px #000;
}
.scanner .search-op:nth-child(2) { --wx: 72%; --wy: 30%; }
.scanner .search-op:nth-child(3) { --wx: 18%; --wy: 40%; }
.scanner .search-op:nth-child(4) { --wx: 84%; --wy: 76%; }
.scanner .search-op:nth-child(5) { --wx: 44%; --wy: 22%; }
.scanner .search-op:nth-child(6) { --wx: 62%; --wy: 82%; }
.scanner .search-op:nth-child(7) { --wx: 26%; --wy: 28%; }
.scan-off { --wx: 76%; --wy: 66%; }
.scan-off:hover,
.scanner .search-op:hover { filter: brightness(1.06); }
.scan-off:active,
.scanner .search-op:active { transform: translateY(3px); box-shadow: 0 0 0 #6b5810, 0 1px 0 #000, 0 0 0 1px #000; }
.scan-off:focus-visible,
.scanner .search-op:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* OFF: one of them, the red power lamp lit beside its legend. */
.scan-off {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 30px;
    padding: 0 10px;
    font: 900 0.6rem var(--font-mono);
    letter-spacing: 2px;
}
.scan-off::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--gs-red);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55), 0 0 6px var(--gs-red);
}

.scanner .search-screen { margin: 0; }
.search-screen input::-webkit-search-cancel-button { display: none; }

/* The band display: yellow VFD segments on dark glass, a scale along it,
   the bands under it as its buttons, and a red marker that slides to the
   one chosen. */
.scan-dial {
    position: relative;
    padding: 8px 12px 4px;
    border-radius: 2px;
    background:
        repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.3) 0 1px, transparent 1px 3px),
        radial-gradient(ellipse at 50% 40%, #1a1606, #060502 80%);
    box-shadow: 0 0 0 1px #000, 0 1px 0 1px rgba(255, 255, 255, 0.05), inset 0 2px 10px rgba(0, 0, 0, 0.9);
}

.scan-scale {
    display: flex;
    justify-content: space-between;
    padding: 0 6% 3px;
    border-bottom: 1px solid var(--vfd-dim);
    background: repeating-linear-gradient(90deg, var(--vfd-dim) 0 1px, transparent 1px 8px) bottom / 100% 5px no-repeat;
    color: var(--vfd);
    font: 700 0.56rem var(--font-mono);
    letter-spacing: 1px;
    text-shadow: 0 0 6px color-mix(in srgb, var(--vfd) 70%, transparent);
    opacity: 0.8;
}

.scan-needle {
    --at: 3;
    position: absolute;
    top: 19px;
    bottom: 28px;
    left: calc(12px + (100% - 24px) * (var(--at) / 6));
    width: 3px;
    margin-left: -1.5px;
    border-radius: 2px;
    background: var(--gs-red);
    box-shadow: 0 0 6px var(--gs-red), 0 0 14px color-mix(in srgb, var(--gs-red) 60%, transparent);
    transition: left 0.45s cubic-bezier(0.3, 1.3, 0.5, 1);
}

.scan-bands { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 4px; }
.scan-bands .search-scope {
    padding: 4px 0 2px;
    border: 0;
    background: none;
    color: var(--vfd-dim);
    font: 900 0.62rem var(--font-mono);
    letter-spacing: 3px;
    cursor: pointer;
}
.scan-bands .search-scope[aria-pressed="true"] { color: var(--vfd); text-shadow: 0 0 8px var(--vfd); }
.scan-bands .search-scope:disabled { opacity: 0.4; cursor: not-allowed; }
.scan-bands .search-scope:focus-visible { outline: 1px solid var(--vfd); outline-offset: -2px; }

/* Switched on: the band display says HELLO, then flickers up. */
.is-booting .scan-dial > :not(.scan-needle):not(.scan-hello) { animation: vfd-on 0.55s steps(1) 0.75s backwards; }
.is-booting .scan-needle { animation: vfd-on 0.55s steps(1) 0.85s backwards; }
.scan-hello {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--vfd);
    font: 800 1.05rem var(--font-mono);
    letter-spacing: 10px;
    text-shadow: 0 0 8px color-mix(in srgb, var(--vfd) 70%, transparent);
    opacity: 0;
    pointer-events: none;
}
.is-booting .scan-hello { animation: vfd-hello 0.72s steps(1) 0.05s; }
@keyframes vfd-hello {
    0% { opacity: 0.8; }
    8% { opacity: 0.15; }
    16%, 92% { opacity: 1; }
    100% { opacity: 0; }
}

/* The annunciators along its top, as real scanners print them on the
   glass: dark but legible till lit. And its clock. */
.scan-annun {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: -3px 0 3px;
    font: 800 0.44rem var(--font-sans);
    letter-spacing: 1.5px;
}
.scan-annun [data-a] { color: color-mix(in srgb, var(--vfd) 14%, transparent); }
.scan-annun [data-a].is-lit { color: var(--vfd); text-shadow: 0 0 6px color-mix(in srgb, var(--vfd) 70%, transparent); }
.scan-clock {
    margin-left: auto;
    color: var(--vfd);
    font: 700 0.62rem var(--font-mono);
    letter-spacing: 1px;
    text-shadow: 0 0 6px color-mix(in srgb, var(--vfd) 70%, transparent);
}
@keyframes vfd-on {
    0% { opacity: 0; }
    20% { opacity: 0.7; }
    30% { opacity: 0.1; }
    45% { opacity: 0.9; }
    60% { opacity: 0.35; }
    75%, 100% { opacity: 1; }
}

/* Glass over the band display: a streak of the room's light across it. */
.scan-dial::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: linear-gradient(112deg, transparent 0 18%, rgba(255, 255, 255, 0.05) 24%, rgba(255, 255, 255, 0.015) 31%, transparent 37%);
}

/* Scanning: while it asks, the marker sweeps the bands. */
.scan-dial.is-scanning .scan-needle { animation: scan-sweep 0.5s ease-in-out infinite alternate; }
@keyframes scan-sweep {
    from { left: 14px; }
    to { left: calc(100% - 14px); }
}

/* A slip torn off a dot-matrix printout, taped over the band display: the
   room it's tuned from, in faded ribbon ink, two bits of clear tape
   holding it on, not quite straight. */
.scan-band-field { position: relative; }
.scan-slip {
    position: absolute;
    top: -7px;
    right: 18px;
    z-index: 1;
    max-width: 46%;
    transform: rotate(-1.4deg);
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.55));
}
.scan-slip-paper {
    display: block;
    padding: 3px 14px 3px 12px;
    background:
        repeating-linear-gradient(90deg, rgba(120, 110, 90, 0.05) 0 1px, transparent 1px 4px),
        linear-gradient(180deg, #f1ecdf, #e3dccb);
    /* Torn on the left, cut along the perforation on the right. */
    clip-path: polygon(3px 0, 100% 0, 100% 100%, 2px 100%, 0 82%, 3px 64%, 1px 46%, 4px 28%, 0 12%);
}
.scan-slip-paper b {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: rgba(34, 36, 52, 0.88);
    font: 800 0.68rem/1.25 var(--font-mono);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    /* Printed in dots by the head's pins. */
    -webkit-mask: radial-gradient(circle, #000 0.72px, transparent 0.92px) 0 0 / 1.6px 1.6px;
    mask: radial-gradient(circle, #000 0.72px, transparent 0.92px) 0 0 / 1.6px 1.6px;
}
.scan-slip::before,
.scan-slip::after {
    content: "";
    position: absolute;
    z-index: 1;
    top: -4px;
    bottom: -4px;
    width: 14px;
    background: linear-gradient(180deg, rgba(250, 250, 238, 0.34), rgba(250, 250, 238, 0.22));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.scan-slip::before { left: -5px; transform: rotate(9deg); }
.scan-slip::after { right: -6px; transform: rotate(-6deg); }

/* The preset keys (they type the operators) and the status read-out. */
.scan-lower { display: flex; align-items: flex-start; gap: 14px; }
.scan-presets-field { flex: 1; }

.scan-presets { display: flex; gap: 5px; overflow-x: auto; scrollbar-width: none; padding: 1px 1px 6px; }
.scan-presets::-webkit-scrollbar { display: none; }
.scanner .search-op {
    flex: none;
    padding: 7px 8px 6px;
    font: 800 0.56rem var(--font-mono);
    letter-spacing: 0.5px;
}

.scan-status-field { flex: none; }
.scan-status {
    display: flex;
    align-items: center;
    width: 132px;
    height: 28px;
    padding: 0 10px;
    box-sizing: border-box;
}
.scanner .search-count {
    color: var(--vfd);
    font: 700 0.62rem var(--font-mono);
    letter-spacing: 2px;
    text-shadow: 0 0 6px color-mix(in srgb, var(--vfd) 65%, transparent);
    white-space: nowrap;
}
.scanner .search-count:empty::before { content: "STANDBY"; opacity: 0.35; }

/* The lower unit: HARUSAME's tape recorder, ribbed charcoal with white
   legends and rounder corners, its screws slotted rather than crossed. */
.scan-log {
    --face: linear-gradient(180deg, #2a2b2f, #222326 50%, #1b1c1f);
    --texture: repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.025) 0 1px, rgba(0, 0, 0, 0.12) 1px 2px, transparent 2px 5px);
    --silk: rgba(236, 238, 242, 0.72);
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 8px;
    border-radius: 7px;
}
.scan-log::before,
.scan-log::after {
    --head: radial-gradient(circle 6px at 50% 50%, #7a7e88 0, #4b4e56 62%, #24252b 84%, rgba(0, 0, 0, 0.7) 94%, transparent 100%);
    --slot: linear-gradient(transparent 3px, rgba(0, 0, 0, 0.85) 3px 5px, transparent 5px);
    background:
        var(--slot) 3px 5px / 8px 8px no-repeat,
        var(--shine) 1px 3px / 12px 12px no-repeat,
        var(--head) 1px 3px / 12px 12px no-repeat,
        var(--hole) 0 0 / 14px 18px no-repeat,
        var(--slot) 3px calc(100% - 5px) / 8px 8px no-repeat,
        var(--shine) 1px calc(100% - 3px) / 12px 12px no-repeat,
        var(--head) 1px calc(100% - 3px) / 12px 12px no-repeat,
        var(--hole) 0 100% / 14px 18px no-repeat;
}

.log-head { display: flex; align-items: center; gap: 12px; flex: none; }

/* A vent of slots. */
.log-vents {
    flex: none;
    width: 96px;
    height: 24px;
    background: repeating-linear-gradient(90deg, #08090a 0 3px, transparent 3px 6px);
    box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.6);
}

/* The boxed slot legend, with the slot it names. */
.log-slot {
    flex: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border: 1px solid var(--silk);
    border-radius: 2px;
    color: var(--silk);
    font: 700 0.5rem var(--font-sans);
    letter-spacing: 2px;
    white-space: nowrap;
}
/* The cassette behind its smoked window: two reels, turning while it
   records. */
.log-cassette {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 70px;
    height: 20px;
    padding: 0 8px;
    box-sizing: border-box;
    overflow: hidden;
    border-radius: 3px;
    background: linear-gradient(180deg, #4a4c54, #26272c);
    box-shadow: inset 0 1px 3px #000, 0 1px 0 rgba(255, 255, 255, 0.06);
}
.log-cassette::before { content: ""; position: absolute; left: 14px; right: 14px; bottom: 2px; height: 1.5px; background: #0c0c0e; }
.log-cassette::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(112deg, transparent 20%, rgba(255, 255, 255, 0.1) 30%, transparent 42%);
    pointer-events: none;
}
.log-reel { position: relative; display: grid; place-items: center; width: 15px; height: 15px; font-style: normal; }
.log-reel::before {
    content: "";
    position: absolute;
    inset: 0;
    margin: auto;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: repeating-radial-gradient(circle, #08080a 0 0.8px, #17181b 0.8px 1.6px);
    box-shadow: 0 0 0 0.6px rgba(255, 255, 255, 0.22);
}
.log-reel b {
    position: relative;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background:
        radial-gradient(circle, #0b0b0c 0 1.3px, transparent 1.6px),
        conic-gradient(#e2e4e8 0 25deg, #8d9098 25deg 95deg, #e2e4e8 95deg 145deg, #8d9098 145deg 215deg, #e2e4e8 215deg 265deg, #8d9098 265deg 335deg, #e2e4e8 335deg);
}
.log-cassette.is-turning b { animation: reel-turn 0.9s linear infinite; }
@keyframes reel-turn { to { transform: rotate(-360deg); } }

/* The product line's own lettering: chunky, white, close-set. */
.log-line {
    flex: none;
    color: #e9ebef;
    font: 900 0.9rem var(--font-sans);
    letter-spacing: -0.5px;
    text-shadow: 0 1px 0 #000;
}
.log-line b { margin-left: 3px; font-weight: 900; }

/* Lamps with their names over them: dark till lit. */
.log-lamps { flex: none; display: flex; gap: 10px; }
.log-lamp { display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--silk); font: 700 0.42rem var(--font-sans); letter-spacing: 1px; }
.log-lamp small { font-size: inherit; line-height: 1.1; }
.log-lamp { --lamp: var(--hr-red); }
#log-lock { --lamp: var(--amber); }
.log-lamp:last-child { --lamp: #6ee08a; }
.log-lamp i { width: 18px; height: 5px; border-radius: 1px; background: color-mix(in srgb, var(--lamp) 10%, #050505); box-shadow: inset 0 1px 1px #000; }
.log-lamp.is-lit i { background: var(--lamp); box-shadow: 0 0 6px var(--lamp); }

/* The red block at its end. */
.log-rec {
    flex: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-self: stretch;
    margin: -14px -12px 0 4px;
    padding: 10px 14px 4px;
    border-radius: 0 0 2px 2px;
    background: linear-gradient(180deg, var(--hr-red), color-mix(in srgb, var(--hr-red) 80%, #000));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), inset 1px 0 0 rgba(0, 0, 0, 0.3);
    color: #fff4f0;
    position: relative;
    z-index: 1;
}
.log-rec b { display: flex; align-items: center; gap: 8px; font: 900 1.2rem/1 var(--font-sans); letter-spacing: 1px; }
/* REC's own lamp: lit while it records (a search on its way), and blinks
   twice as the set comes on. */
.log-rec-lamp { width: 7px; height: 7px; border-radius: 50%; background: #5a1410; box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.6), 0 1px 0 rgba(255, 255, 255, 0.2); }
.log-rec-lamp.is-lit { background: #fff1e8; box-shadow: 0 0 6px #fff1e8, 0 0 12px #ffd2c4; }
.is-booting .log-rec-lamp { animation: rec-blink 0.36s steps(1) 0.35s 2; }
@keyframes rec-blink {
    0% { background: #fff1e8; box-shadow: 0 0 6px #fff1e8, 0 0 12px #ffd2c4; }
    50%, 100% { background: #5a1410; box-shadow: none; }
}
.log-rec small { margin-top: 2px; font: 700 0.36rem var(--font-sans); letter-spacing: 1px; opacity: 0.8; white-space: nowrap; }

/* The maker's name in dots under the screen, and the model line. */
.log-foot { flex: none; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
.log-foot-left { display: flex; align-items: center; gap: 14px; min-width: 0; }

/* The tape counter: red seven-segment LEDs behind a smoked window, which
   one is LOCKED and how many; the unlit segments just visible. */
.log-counter-field { flex: none; display: flex; align-items: center; gap: 6px; }
.log-counter-legend { color: var(--silk); font: 700 0.42rem/1.15 var(--font-sans); letter-spacing: 1.5px; }
.log-counter {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px 5px;
    border-radius: 2px;
    background: radial-gradient(ellipse at 50% 40%, #1c0907, #080303 80%);
    box-shadow: 0 0 0 1px #000, 0 1px 0 1px rgba(255, 255, 255, 0.06), inset 0 1px 3px #000;
}
.log-counter b { padding: 0 1px; color: color-mix(in srgb, var(--hr-red) 55%, #000); font: 700 0.7rem/1 var(--font-mono); }
.seg7 { display: block; width: 9px; height: 15px; overflow: visible; transform: skewX(-6deg); }
.seg7 polygon { fill: color-mix(in srgb, var(--hr-red) 12%, #120505); }
.seg7 polygon.is-on { fill: #ff5a48; filter: drop-shadow(0 0 1.5px #ff3b28); }

/* An asset tag somebody's stuck on it: silver foil, a barcode, whose it
   is, a little crooked. */
.log-asset {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    padding: 2px 6px 2px 4px;
    border-radius: 1px;
    background: linear-gradient(160deg, #e2e4e9, #aeb2ba 55%, #cfd2d8);
    color: #1b1c20;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
    transform: rotate(0.8deg);
}
.log-asset > i {
    flex: none;
    width: 22px;
    height: 14px;
    background: linear-gradient(90deg, #111 0 1px, transparent 1px 2px, #111 2px 4px, transparent 4px 5px, #111 5px 6px, transparent 6px 8px, #111 8px 9px, transparent 9px 10px, #111 10px 12px, transparent 12px 13px) 0 0 / 13px 100%;
}
.log-asset > span { display: flex; flex-direction: column; min-width: 0; }
.log-asset b, .log-asset small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-sans); letter-spacing: 0.5px; text-transform: uppercase; }
.log-asset b { max-width: 130px; font-size: 0.46rem; font-weight: 900; line-height: 1.15; }
.log-asset small { font-size: 0.32rem; font-weight: 700; line-height: 1.15; }

.log-maker { grid-column: 2; align-self: center; display: flex; color: #dfe1e6; filter: drop-shadow(0 1px 0 #000); }
.log-maker .dot-word { display: block; }
.log-model { justify-self: end; color: var(--silk); font: 700 0.42rem var(--font-sans); letter-spacing: 1px; white-space: nowrap; }
.log-model b { margin-left: 4px; color: #e9ebef; font-size: 0.7rem; letter-spacing: 0; }

/* The screen: a tube behind glass, its corners dimmer, a streak of the
   room across it. */
.log-screen {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    overflow: hidden;
    border-radius: 2px;
    background:
        repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.015) 0 1px, transparent 1px 3px),
        #06070a;
    box-shadow: 0 0 0 1px #000, 0 1px 0 1px rgba(255, 255, 255, 0.05), inset 0 4px 12px rgba(0, 0, 0, 0.8);
}
.log-screen::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background:
        linear-gradient(115deg, transparent 0 16%, rgba(255, 255, 255, 0.045) 22%, rgba(255, 255, 255, 0.012) 30%, transparent 36%),
        radial-gradient(ellipse 85% 80% at 50% 50%, transparent 58%, rgba(0, 0, 0, 0.5) 100%);
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.55);
}
/* Switched on: the picture opens on the tube from a bright line (the tube
   itself, its glass and black, stays where it is). */
.is-booting .log-screen > .search-results { animation: crt-on 0.5s cubic-bezier(0.2, 0.8, 0.3, 1) 0.1s backwards; }
@keyframes crt-on {
    0% { transform: scale(0.04, 0.006); background-color: #dfeaff; }
    40% { transform: scale(1, 0.006); background-color: #dfeaff; }
    70% { background-color: rgba(223, 234, 255, 0.08); }
    100% { transform: none; background-color: transparent; }
}

.log-screen > .search-results {

    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 6px 4px 14px;
    overflow-y: auto;
    border-radius: 2px;
    color: var(--ink);
    scrollbar-color: #33363f transparent;
}

/* Switched off (js/search.js watchSearchPowerDown): a still copy of the set
   over the room. Its screen flares, folds to a line, then to a dot; the
   rack and the room's dimming fade after. */
.scan-ghost {
    position: fixed;
    inset: 0;
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    animation: ghost-room 0.62s ease-in forwards;
}
.scan-ghost .search-card { animation: ghost-set 0.62s ease-in forwards; }
.scan-ghost .log-screen > .search-results { animation: crt-off 0.34s cubic-bezier(0.6, 0, 0.8, 0.4) forwards; }
@keyframes ghost-room {
    from { background: rgba(0, 0, 0, 0.8); }
    to { background: rgba(0, 0, 0, 0); }
}
@keyframes ghost-set {
    0%, 45% { opacity: 1; filter: none; }
    55% { filter: brightness(0.55); }
    100% { opacity: 0; filter: brightness(0.4); }
}
@keyframes crt-off {
    0% { transform: none; background-color: rgba(223, 234, 255, 0.1); }
    12% { transform: none; background-color: #dfeaff; }
    55% { transform: scale(1, 0.006); background-color: #eef4ff; }
    85% { transform: scale(0.02, 0.006); background-color: #fff; opacity: 1; }
    100% { transform: scale(0, 0); background-color: #fff; opacity: 0; }
}

/* An answer comes in: static across the tube for a moment, then the lines
   written in one after another. */
.log-screen::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    background:
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 2px),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.06) 0 1px, transparent 1px 3px),
        repeating-linear-gradient(37deg, rgba(255, 255, 255, 0.05) 0 2px, transparent 2px 5px);
}
.log-screen.is-tuning::before { animation: static-burst 0.3s steps(5); }
@keyframes static-burst {
    0% { opacity: 0.95; background-position: 0 0, 0 0, 0 0; }
    25% { background-position: 0 1px, 2px 0, 3px 1px; }
    50% { opacity: 0.6; background-position: 0 2px, 1px 0, 1px 3px; }
    100% { opacity: 0; background-position: 0 3px, 3px 0, 2px 2px; }
}
.scan-tape .search-hit { --n: 0; }
.scan-tape.is-arriving .search-hit { animation: hit-in 0.2s ease-out calc(0.18s + var(--n) * 30ms) backwards; }
@keyframes hit-in {
    from { opacity: 0; transform: translateX(-6px); filter: brightness(2.2); }
    to { opacity: 1; transform: none; filter: none; }
}
/* Leaving one for the next with ↑ ↓: a moment's afterglow where it was. */
.scan-tape .search-hit.is-afterglow { animation: afterglow 0.5s ease-out; }
@keyframes afterglow {
    from { background-color: color-mix(in srgb, var(--hr-red) 16%, transparent); box-shadow: inset 3px 0 0 color-mix(in srgb, var(--hr-red) 60%, transparent); }
    to { background-color: transparent; box-shadow: none; }
}

/* Help, nothing caught, keep typing: on the log, mid-screen. */
.scan-tape > .search-help,
.scan-tape > .switcher-none { margin: auto 0; text-align: center; }
.scan-tape > .switcher-none { color: #c9ccd3; font: 800 0.7rem var(--font-mono); letter-spacing: 3px; opacity: 0.75; }
.scan-tape .search-help { padding: 10px 16px; color: var(--ink-dim); font: 0.72rem/1.7 var(--font-mono); }
.scan-tape .search-help p { margin: 0 0 8px; }
.scan-tape .search-help b { color: #fff; }

/* The help: a word of thanks from the scanner's maker over it. */
.scan-tape .scan-manual .scan-manual-hello { margin: 0 0 12px; color: #fff; font-size: 0.64rem; font-weight: 700; letter-spacing: 1px; }

/* The makers' warranty cards (search for either's name), each in its own
   house style. */
.scan-tape > .scan-warranty { max-width: 540px; margin: auto; font: 0.7rem/1.6 var(--font-mono); }
.scan-warranty p { margin: 0 14px 8px; }
.scan-warranty dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; margin: 10px 14px; }
.scan-warranty dd { margin: 0; }

/* GURABU•SCAN's: in its livery's yellow, double-ruled, two languages. */
.scan-warranty.is-gurabu { padding: 0 0 10px; border: 3px double color-mix(in srgb, var(--livery) 70%, transparent); color: #efe3a6; }
.is-gurabu header { display: flex; align-items: baseline; gap: 12px; padding: 4px 12px; background: var(--livery); color: #141416; font: 800 0.56rem var(--font-sans); letter-spacing: 1.5px; }
.is-gurabu header b { font-style: italic; font-weight: 900; }
.is-gurabu header span { margin-left: auto; }
.is-gurabu header small { margin-left: 8px; font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", "Noto Sans JP", "Meiryo", var(--font-sans); }
.is-gurabu dt { color: var(--silk); font: 700 0.5rem/1.5 var(--font-sans); letter-spacing: 1.5px; }
.is-gurabu dt small { display: block; font: 700 0.42rem/1.2 "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", "Noto Sans JP", "Meiryo", var(--font-sans); opacity: 0.8; }
.is-gurabu dd { color: #fff; font-size: 0.66rem; font-weight: 700; }
.is-gurabu .scan-warranty-warn { color: var(--gs-red); font-size: 0.6rem; font-weight: 700; }
.is-gurabu .scan-warranty-sign { margin-top: 10px; color: var(--livery); font-weight: 700; text-align: center; }

/* HARUSAME's: plain and proper. Its name in dots, a red rule, small print
   in grey, the caution boxed in red, and a stub to cut off and send. */
.scan-warranty.is-harusame { padding: 4px 0 0; color: #b9bcc4; font: 0.64rem/1.65 var(--font-sans); text-align: center; }
.scan-warranty-logo { display: flex; justify-content: center; color: #eceef2; }
.scan-warranty-logo .dot-word { width: 140px; height: auto; }
.is-harusame h3 { margin: 8px auto 12px; padding-bottom: 6px; max-width: 260px; border-bottom: 2px solid var(--hr-red); color: #fff; font: 800 0.6rem var(--font-sans); letter-spacing: 5px; }
.is-harusame p { margin: 0 28px 8px; }
.is-harusame .scan-warranty-warn { margin: 12px 40px; padding: 6px 10px; border: 1px solid var(--hr-red); color: var(--hr-red); font-size: 0.52rem; font-weight: 800; letter-spacing: 1px; }
.is-harusame .scan-warranty-sign { color: #eceef2; font-family: Georgia, "Times New Roman", serif; font-style: italic; }
.scan-warranty-stub { margin-top: 14px; padding-top: 4px; border-top: 1px dashed rgba(236, 238, 242, 0.45); text-align: left; }
.scan-warranty-cut { display: block; margin: 0 14px 4px; color: rgba(236, 238, 242, 0.55); font: 700 0.42rem var(--font-sans); letter-spacing: 2px; }
.is-harusame dl { grid-template-columns: auto 1fr auto 1fr; margin: 4px 14px 2px; }
.is-harusame dt { color: rgba(236, 238, 242, 0.6); font: 700 0.44rem/1.9 var(--font-sans); letter-spacing: 1.5px; }
.is-harusame dd { min-width: 60px; border-bottom: 1px solid rgba(236, 238, 242, 0.35); color: #fff; font: 700 0.6rem/1.7 var(--font-mono); }
.scan-tape.is-stale .search-hit { opacity: 0.4; }

/* An intercept: channel, who, when; then the words, matches underlined in
   the recorder's red. */
.scan-tape .search-hit {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 8px 14px 9px;
    border: 0;
    border-bottom: 1px dashed rgba(236, 238, 242, 0.1);
    background: none;
    color: var(--ink);
    text-align: left;
    cursor: pointer;
}
.scan-tape .search-hit:hover { background: rgba(255, 255, 255, 0.03); }
.scan-tape .search-hit.is-carriage {
    background: color-mix(in srgb, var(--hr-red) 11%, transparent);
    box-shadow: inset 3px 0 0 var(--hr-red);
}
.search-hit-where { display: flex; align-items: baseline; gap: 10px; min-width: 0; font-size: 0.56rem; letter-spacing: 1px; white-space: nowrap; color: var(--ink-dim); }
.search-hit-where b { color: var(--hr-red); letter-spacing: 1.5px; }
.search-hit-who { font-weight: 700; color: #f2f3f6; overflow: hidden; text-overflow: ellipsis; }
.search-hit-where time { margin-left: auto; }
.search-hit-lock { color: var(--hr-red); font-style: normal; font-weight: 900; letter-spacing: 2px; }
.search-hit-text { font: 0.82rem/1.45 var(--font-mono); overflow-wrap: anywhere; }
.search-hit-text mark { background: none; color: #fff; font-weight: 700; text-decoration: underline 2px var(--hr-red); text-underline-offset: 3px; }
.search-hit-pic { margin-left: 8px; padding: 0 5px; border: 1px solid rgba(236, 238, 242, 0.45); border-radius: 2px; color: #d9dbe0; font: 700 0.5rem var(--font-mono); font-style: normal; letter-spacing: 1.5px; vertical-align: 2px; }

/* OLDER RESULTS: one of the recorder's own keys, charcoal with a white
   legend. */
.scanner .plate-key.search-more {
    align-self: center;
    height: 28px;
    margin: 10px 0 4px;
    padding: 0 16px;
    border: 0;
    border-radius: 3px;
    background: linear-gradient(180deg, #3a3b40, #232428);
    color: #eceef2;
    font-weight: 800;
    letter-spacing: 2px;
    box-shadow: 0 3px 0 #000, 0 0 0 1px #45464c;
}
.scanner .plate-key.search-more:hover { color: #fff; }
.scanner .plate-key.search-more:active { transform: translateY(2px); box-shadow: 0 1px 0 #000, 0 0 0 1px #45464c; }
.scanner .plate-key.search-more:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.scanner .switcher-foot { margin-top: 6px; }

.status-line .sl-search { letter-spacing: inherit; }

/* A phone: narrower ears, no speaker or plate, the presets scroll, the
   status under them. */
@media (max-width: 600px) {
    .search-card.scanner { --ear: 20px; max-width: calc(100vw - 16px); }
    .scan-unit { padding: 12px calc(var(--ear) + 8px); }
    .scan-unit::before, .scan-unit::after { left: calc((var(--ear) - 14px) / 2); transform: scale(0.8); }
    .scan-unit::after { left: auto; right: calc((var(--ear) - 14px) / 2); }
    .scan-log { padding-bottom: 8px; }
    .scan-top { gap: 10px; }
    .scan-brand, .scan-brand b { flex: 1 1 auto; min-width: 0; }
    .scan-brand b img { width: 100%; max-width: 160px; height: auto; }
    .scan-grille, .scan-slashes, .scan-model, .scan-badge, .log-vents, .log-slot, .log-model { display: none; }
    .log-rec { margin: -12px -8px 0 0; padding: 8px 10px 3px; }
    .log-rec small { display: none; }
    .log-foot { grid-template-columns: auto auto; justify-content: space-between; }
    .log-maker { grid-column: 2; }
    .log-asset, .scan-link-field, .log-ports, .scan-cords, .log-counter-legend { display: none; }
    .log-maker .dot-word { width: 150px; height: auto; }
    .scan-lower { flex-direction: column; align-items: stretch; gap: 8px; }
    .scan-status { width: 100%; }
    .scanner .switcher-foot { display: none; }
}


@media (prefers-reduced-motion: reduce) {
    .scan-needle { transition: none; }
}

/* ------------------------------------------------------------------ *
 * THE BOARD (js/bbslogin.js): the login as a dial-up bulletin board.
 * One green screen in a red home terminal; the menu lines are its buttons,
 * the prompts its fields. Green is where you type, as in search and the
 * switcher.
 * ------------------------------------------------------------------ */
#auth-screen.bbs-screen { align-items: center; padding-inline: 16px; }

/* The monitor, then the flyer and the back of the box under it, one width,
   the three together in the middle of the screen. */
.bbs-screen > .contraband { max-width: 520px; }
.bbs-screen > :last-child { margin-bottom: auto; }

/* A solid set, with thick plastic all round: above the page's grid (9000)
   so nothing shows through it, and above the scanlines (10000), which a
   plastic case doesn't have (the glass draws its own). It's a home terminal in the livery of a red Japanese home
   computer: red plastic, the maker's white lettering and a bank of vents
   across the top, the screen let into a charcoal deck, and on the chin its
   LEDs with their names over them and the model's badge. */
.bbs-monitor {
    --case-red: #b8333f;
    --deck: #33363e;
    position: relative;
    z-index: 10001;
    flex-shrink: 0;
    width: 100%;
    max-width: 720px;
    margin: auto 0 0;
    padding: 14px 44px 0;
    box-sizing: border-box;
    border-radius: 16px;
    /* Weathered, top layer first: scratches and scuffs, a patch worn shiny
       where hands rest on the chin, grime in the
       bottom edge, the top sun-faded paler (unevenly), then the plastic. */
    background:
        linear-gradient(24deg, transparent calc(50% - 0.6px), rgba(255, 226, 220, 0.3) 50%, transparent calc(50% + 0.6px)) 84% 3% / 74px 14px no-repeat,
        linear-gradient(-6deg, transparent calc(50% - 0.5px), rgba(255, 226, 220, 0.18) 50%, transparent calc(50% + 0.5px)) 6% 1.5% / 120px 10px no-repeat,
        linear-gradient(80deg, transparent calc(50% - 0.5px), rgba(255, 226, 220, 0.2) 50%, transparent calc(50% + 0.5px)) 99% 62% / 8px 90px no-repeat,
        linear-gradient(-75deg, transparent calc(50% - 0.5px), rgba(255, 226, 220, 0.16) 50%, transparent calc(50% + 0.5px)) 0.8% 78% / 9px 34px no-repeat,
        linear-gradient(3deg, transparent calc(50% - 0.5px), rgba(255, 226, 220, 0.2) 50%, transparent calc(50% + 0.5px)) 74% 99.2% / 140px 8px no-repeat,
        linear-gradient(40deg, transparent calc(50% - 0.5px), rgba(255, 226, 220, 0.24) 50%, transparent calc(50% + 0.5px)) 52% 96% / 18px 12px no-repeat,
        linear-gradient(-48deg, transparent calc(50% - 0.5px), rgba(30, 4, 8, 0.3) 50%, transparent calc(50% + 0.5px)) 93% 2% / 16px 12px no-repeat,
        linear-gradient(-12deg, transparent calc(50% - 0.5px), rgba(255, 226, 220, 0.22) 50%, transparent calc(50% + 0.5px)) 89% 5% / 40px 10px no-repeat,
        linear-gradient(68deg, transparent calc(50% - 0.5px), rgba(255, 226, 220, 0.24) 50%, transparent calc(50% + 0.5px)) 1.5% 46% / 10px 46px no-repeat,
        linear-gradient(8deg, transparent calc(50% - 0.5px), rgba(255, 226, 220, 0.2) 50%, transparent calc(50% + 0.5px)) 30% 99% / 90px 8px no-repeat,
        linear-gradient(-30deg, transparent calc(50% - 0.5px), rgba(30, 4, 8, 0.35) 50%, transparent calc(50% + 0.5px)) 62% 97% / 26px 14px no-repeat,
        radial-gradient(ellipse 30% 9% at 42% 96%, rgba(255, 255, 255, 0.07), transparent 70%),
        linear-gradient(0deg, rgba(40, 5, 10, 0.3), transparent 12px),
        radial-gradient(ellipse 45% 14% at 68% 0%, rgba(255, 228, 214, 0.1), transparent 70%),
        linear-gradient(180deg, rgba(255, 232, 222, 0.1), transparent 22%),
        radial-gradient(rgba(255, 255, 255, 0.035) 0.6px, transparent 0.8px) 0 0 / 3px 3px,
        radial-gradient(ellipse at 30% 0%, rgba(255, 255, 255, 0.12), transparent 55%),
        linear-gradient(172deg, #c63c48 0%, var(--case-red) 40%, #962733 100%);
    box-shadow:
        inset 0 2px 0 rgba(255, 255, 255, 0.18),
        inset 0 -8px 0 rgba(0, 0, 0, 0.3),
        inset 3px 0 0 rgba(255, 255, 255, 0.05),
        inset -3px 0 0 rgba(0, 0, 0, 0.18),
        0 0 0 1px #3a0c12,
        0 28px 70px rgba(0, 0, 0, 0.75);
}

/* Across the top: DENPA's lettering in white (the name, and the kind of
   set at half its height, their feet in line) and a bank of vents, clear of
   the charcoal deck. */
.bbs-brand {
    display: flex;
    align-items: flex-end;
    gap: 14px;
    height: 30px;
    margin-bottom: 32px;
    color: #f6f2ec;
    white-space: nowrap;
}
.bbs-maker { flex: none; display: block; width: auto; height: 28px; }
.bbs-kind { flex: none; display: block; width: auto; height: 14px; margin-bottom: 1px; }
.bbs-brand .bbs-vents {
    flex: 1;
    align-self: stretch;
    min-width: 40px;
    margin-left: 10px;
    border-radius: 2px;
    background: repeating-linear-gradient(90deg, #3a0b12 0 3px, transparent 3px 7px);
    box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.25);
}

/* The glass is one size, as a tube is: 4:3, set by the width alone. What
   doesn't fit scrolls inside it, as a terminal does, with no bar. */
.bbs-crt {
    position: relative;
    box-sizing: border-box;
    aspect-ratio: 4 / 3;
    margin: 0;
    padding: 26px 30px 28px;
    border-radius: 22px;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: none;
    color: #6dffab;
    font: 400 0.95rem/1.65 var(--font-mono);
    text-shadow: 0 0 5px rgba(53, 224, 138, 0.6);
    background:
        repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.35) 0 1px, transparent 1px 3px),
        radial-gradient(ellipse at 50% 40%, #0d2016, #020503 80%);
    /* The glass, then the charcoal deck it's let into, then the step down
       from the red. */
    box-shadow:
        inset 0 0 30px rgba(0, 0, 0, 0.95),
        0 0 0 3px #05070c,
        0 0 0 16px var(--deck),
        0 0 0 17px rgba(0, 0, 0, 0.45),
        0 -2px 0 18px rgba(0, 0, 0, 0.25);
}

.bbs-crt::-webkit-scrollbar { display: none; }

/* Years of the same board: its logo, menu and prompts burned into the
   phosphor, faint, laid out exactly as the board draws them and under it,
   so they show where the screen differs (the dial-in, a new account's
   prompts). Under the live text, over the glass: the glass is its own
   stacking context for that. */
.bbs-crt { isolation: isolate; }
.bbs-burn {
    position: absolute;
    inset: 0;
    z-index: -1;
    padding: inherit;
    color: #6dffab;
    text-shadow: none;
    opacity: 0.075;
    pointer-events: none;
}
.bbs-burn .bbs-item b { color: inherit; text-shadow: none; }
.bbs-burn .bbs-banner { filter: grayscale(1) brightness(1.3) sepia(1) hue-rotate(75deg) saturate(3.2); opacity: 1; }

/* Its own display rules would otherwise beat the hidden attribute. */
.bbs-crt [hidden] { display: none !important; }

.bbs-dial { white-space: pre; color: rgba(109, 255, 171, 0.5); min-height: 3.3em; }

.bbs-banner {
    display: block;
    width: min(260px, 70%);
    margin: 4px 0 14px;
    /* The logo in the screen's one colour, as a monochrome tube draws it. */
    filter: grayscale(1) brightness(1.3) sepia(1) hue-rotate(75deg) saturate(3.2) drop-shadow(0 0 6px rgba(53, 224, 138, 0.55));
    opacity: 0.92;
}

.bbs-menu { display: flex; flex-direction: column; margin-bottom: 14px; }

.bbs-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: fit-content;
    padding: 1px 6px;
    margin-left: -6px;
    border: 0;
    border-radius: 2px;
    background: none;
    color: inherit;
    font: inherit;
    text-shadow: inherit;
    letter-spacing: 1px;
    text-align: left;
    cursor: pointer;
}

.bbs-item b { color: #6fe7ff; text-shadow: 0 0 5px rgba(0, 212, 255, 0.6); font-weight: 700; }
.bbs-item i { font-style: normal; color: #ff6f91; text-shadow: 0 0 5px rgba(255, 51, 102, 0.6); visibility: hidden; }
.bbs-item.is-here i { visibility: visible; }

@media (hover: hover) {
    .bbs-item:hover { background: rgba(109, 255, 171, 0.12); }
}

.bbs-item:focus-visible { outline: 1px solid #6dffab; outline-offset: 1px; }

.bbs-head { margin: 4px 0 2px; color: #ff6f91; text-shadow: 0 0 5px rgba(255, 51, 102, 0.6); letter-spacing: 2px; }

/* The answer starts a space after its prompt, as a board printed it. */
.bbs-line { display: flex; align-items: baseline; gap: 1ch; cursor: text; }
.bbs-ask { flex-shrink: 0; }

.bbs-input {
    flex: 1;
    min-width: 0;
    padding: 0;
    border: 0;
    outline: none;
    background: transparent;
    color: #b6ffd2;
    caret-color: #6dffab;
    font: inherit;
    text-shadow: inherit;
}

/* Autofill paints its own yellow box; keep it the screen's. */
.bbs-input:-webkit-autofill {
    -webkit-text-fill-color: #b6ffd2;
    -webkit-box-shadow: 0 0 0 40px #06120a inset;
    transition: background-color 9999s;
}

.bbs-line:focus-within .bbs-ask { color: #b6ffd2; }

.bbs-hint { margin-top: 6px; color: rgba(109, 255, 171, 0.45); font-size: 0.8rem; }

.bbs-say { min-height: 1.65em; margin-top: 10px; white-space: pre-wrap; }
.bbs-say.is-hot { color: #ff6f91; text-shadow: 0 0 5px rgba(255, 51, 102, 0.6); }
.bbs-say.is-ok { color: #6fe7ff; text-shadow: 0 0 5px rgba(0, 212, 255, 0.6); }

.bbs-go { margin-top: 8px; }

/* The chin: LEDs that report real traffic, the sticker, the model's badge. */
.bbs-plate {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    height: 74px;
    margin-top: 17px;
    padding: 0 0 4px;
    color: #f6f2ec;
    font: 800 0.46rem var(--font-sans);
    letter-spacing: 1.5px;
}

/* The model's badge, a plate glued to the plastic: the name in black
   italic, a rule, the standard's mark boxed; it steps aside when the chin
   is too narrow for it and the sticker both. */
.bbs-model {
    display: flex;
    align-items: center;
    white-space: nowrap;
    padding: 3px;
    border: 2px solid #f6f2ec;
    border-radius: 2px;
    background: #f6f2ec;
    color: #15151a;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
.bbs-model i { padding: 0 4px 0 3px; font: italic 900 0.66rem var(--font-sans); letter-spacing: -0.3px; }
.bbs-model b { padding: 0 6px 0 0; margin-right: 3px; border-right: 2px solid var(--case-red); color: var(--case-red); font: italic 900 0.72rem var(--font-sans); letter-spacing: 0; }
.bbs-model em { padding: 1px 5px; background: #15151a; color: #f6f2ec; font: italic 900 0.66rem var(--font-sans); letter-spacing: -0.5px; }

/* WHAT IS TUBE GRUB?, as a vinyl sticker on the chin, in line with the
   lamps and the badge: on the plastic, not over the screen. Die-cut with a
   white margin, a touch crooked as stickers are, the corner lifting. It
   stays put under the pointer. */
.bbs-sticker {
    position: relative;
    flex: none;
    width: 184px;
    padding: 0;
    border: 0;
    background: none;
    color: #111842;
    text-align: left;
    font: inherit;
    letter-spacing: normal;
    cursor: pointer;
    transform: rotate(-2deg);
    /* The shadow is the button's, so the cut corner below doesn't clip it. */
    filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.25)) drop-shadow(0 4px 6px rgba(0, 0, 0, 0.5));
}

/* The sticker, with its lifted corner cut out of it... */
.bbs-sticker-face {
    display: flex;
    align-items: stretch;
    border: 3px solid #fff;
    border-radius: 7px;
    background:
        radial-gradient(ellipse 40% 60% at 82% 30%, rgba(150, 110, 50, 0.12), transparent 70%),
        linear-gradient(180deg, #f2ead6, #ebe1c8);
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 18px), calc(100% - 18px) 100%, 0 100%);
}

/* ...and the corner's underside, folded back over it. */
.bbs-sticker::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    width: 18px;
    height: 18px;
    background: linear-gradient(315deg, transparent 50%, #ebe5d4 50%, #c9c2ae 100%);
    border-radius: 0 0 5px 0;
}

.bbs-sticker:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

.bbs-sticker-stripes {
    flex: none;
    width: 16px;
    border-radius: 3px 0 0 3px;
    background: linear-gradient(90deg, #ff2e6a 0 33.3%, #ffd21f 33.3% 66.6%, #00d4ff 66.6%);
}

.bbs-sticker-copy { display: grid; gap: 1px; padding: 8px 12px 9px 10px; }
.bbs-sticker-kicker { color: #ff2e6a; font: 900 0.52rem var(--font-mono); letter-spacing: 2px; }
.bbs-sticker-title { font: 900 0.95rem/1.2 var(--font-sans); }

/* Keys in the colours of the set's own keyboard: a red STOP, blue arrows. */
.bbs-keys { display: flex; align-items: center; gap: 6px; }
.bbs-key {
    --key: #7a7f88;
    height: 26px;
    min-width: 26px;
    padding: 0 6px;
    border: 0;
    border-radius: 4px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--key) 100%, #fff 18%), var(--key) 55%, color-mix(in srgb, var(--key) 80%, #000));
    color: #f6f2ec;
    font: 800 0.5rem var(--font-sans);
    letter-spacing: 1px;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 3px 0 color-mix(in srgb, var(--key) 45%, #000), 0 0 0 1px rgba(0, 0, 0, 0.45);
}
.bbs-key.is-stop {
    --key: #e2362f;
    min-width: 52px;
    /* The most-pressed key: worn shiny in the middle. */
    background:
        radial-gradient(ellipse 55% 45% at 50% 42%, rgba(255, 255, 255, 0.2), transparent 70%),
        linear-gradient(180deg, color-mix(in srgb, var(--key) 100%, #fff 18%), var(--key) 55%, color-mix(in srgb, var(--key) 80%, #000));
}
.bbs-key.is-arrow { --key: #2a6fd6; display: grid; place-items: center; padding: 0; }
.bbs-key.is-arrow svg { display: block; }
.bbs-key.is-down-arrow svg { transform: rotate(180deg); }
.bbs-key:active,
.bbs-key.is-down { transform: translateY(2px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 0 color-mix(in srgb, var(--key) 45%, #000), 0 0 0 1px rgba(0, 0, 0, 0.45); }
.bbs-key:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* LEDs let into the red, each with its name printed over it. */
.bbs-lamps { display: flex; gap: 14px; }
.bbs-lamp { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; }
.bbs-lamp small { font-size: inherit; }
.bbs-lamp i { width: 7px; height: 7px; border-radius: 50%; background: #2b0d10; box-shadow: inset 0 1px 1px #000, 0 0 0 1.5px rgba(0, 0, 0, 0.35); transition: background 0.12s, box-shadow 0.12s; }
.bbs-lamp.is-on i { background: #4dff8e; box-shadow: 0 0 6px #4dff8e, 0 0 0 1.5px rgba(0, 0, 0, 0.35); }
.bbs-lamp.is-power i { background: #ff3b2f; box-shadow: 0 0 6px #ff3b2f, 0 0 0 1.5px rgba(0, 0, 0, 0.35); }
#bbs-carrier:not(.is-on) i { background: #5a1020; box-shadow: 0 0 4px rgba(255, 51, 102, 0.5); }

@media (max-width: 700px) {
    .bbs-model { display: none; }
}

@media (max-width: 520px) {
    .bbs-monitor { padding: 10px 22px 0; border-radius: 14px; }
    .bbs-brand { height: 22px; margin-bottom: 26px; gap: 10px; }
    .bbs-maker { height: 20px; }
    .bbs-kind { height: 10px; }
    .bbs-keys { display: none; }
    .bbs-lamp:not(.is-power):not(#bbs-carrier) { display: none; }
    .bbs-plate { height: 52px; margin-top: 12px; }
    .bbs-sticker { width: 150px; }
    .bbs-sticker-copy { padding: 5px 9px 6px 7px; }
    .bbs-sticker-kicker { font-size: 0.42rem; letter-spacing: 1px; white-space: nowrap; }
    .bbs-sticker-title { font-size: 0.8rem; }
    /* 4:3 is too short at this width: one fixed height instead. */
    .bbs-crt { aspect-ratio: auto; height: 460px; padding: 16px 16px 18px; font-size: 16px; line-height: 1.6; }
    .bbs-line { padding-block: 4px; }
    .bbs-item { width: 100%; padding-block: 6px; align-items: flex-start; }

}

/* ==========================================================================
   THE HAND TERMINAL: the phone's chrome
   The desk's panes don't fit on a phone, so the header carries what their
   headers would: the drawer and search on the left, the room's name in the
   middle, and the room's own keys on the right (paintHandKeys). The same
   plate keys as the desk, a size up for a thumb.
   ========================================================================== */

#mobile-header {
    gap: 10px;
    padding: 0 12px;
    background: rgba(6, 10, 18, 0.9);
    border-bottom-color: color-mix(in srgb, var(--chrome) 45%, transparent);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
}

.hand-keys {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    /* As wide as the left pair either side, so a room with no keys of its
       own (a wall, the links' empty list) keeps its name in the middle. */
    min-width: 70px;
}

#mobile-action-buttons { justify-content: flex-end; }

#mobile-current-name {
    flex: 1;
    min-width: 0;
    display: block;
    margin: 0;
    overflow: hidden;
    font-size: 0.85rem;
    letter-spacing: 1px;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#mobile-current-name .on-air-lamp { margin-left: 6px; vertical-align: middle; }

.plate-key.hand-key {
    position: relative;
    min-width: 32px;
    height: 32px;
    padding: 0;
    font-size: 1rem;
    letter-spacing: 0;
}

.plate-key.hand-key.is-word {
    padding: 0 10px;
    font-size: 0.6rem;
    letter-spacing: 1px;
}

.plate-key.hand-key:active { height: 30px; }

/* A link waiting: the DMs button is in the drawer, so the drawer key says so. */
#mobile-drawer-toggle.has-waiting::after {
    content: "";
    position: absolute;
    top: -4px;
    right: -4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--neon-pink);
    box-shadow: 0 0 0 2px #060a12, 0 0 8px var(--neon-pink);
}

/* The link console, at the same height as the keys beside it. */
.link-ctl.hand-key {
    height: 32px;
    padding: 0 9px;
    border-bottom-width: 3px;
    box-sizing: border-box;
}

.wall-filament.plate-key {
    padding: 0 6px;
    background-color: #04070c;
}

.wall-filament option { background: #04070c; }

.arcade-retry.plate-key {
    display: inline-flex;
    align-items: center;
    height: 34px;
    padding: 0 20px;
    font-size: 0.7rem;
    letter-spacing: 2px;
}

.arcade-hub-key.plate-key { height: 30px; padding: 0 10px; }

@media (max-width: 768px) {
    /* The composer: narrower keys, so the screen gets the width (paintOnAir
       words the placeholder short, too). */
    #message-input-area { padding: 10px 12px 12px; }

    .composer-send {
        width: 66px;
        gap: 6px;
        letter-spacing: 1px;
    }
}

/* ==========================================================================
   THE WIRE: dispatches
   A NEWS_BOT story is drawn as its source talking (wireStory): a call-sign
   plate in the source's ink where the avatar would be, the source's name,
   NEWS_BOT as the small print, then the headline as the link and the summary
   under it. No box round it, so the room talks round the wire as it does
   round anyone.
   ========================================================================== */

/* A press pass, not a key: a flat card with a band of the source's ink
   across the top, WIRE printed in it, and the call sign under it. No travel
   and no glow, so it never reads as something to press. */
.dispatch-plate {
    --src: var(--neon-cyan);
    flex-shrink: 0;
    display: grid;
    grid-template-rows: 11px 1fr;
    place-items: center;
    width: 40px;
    height: 40px;
    box-sizing: border-box;
    overflow: hidden;
    border-radius: 3px;
    background: #070b14;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--src) 40%, transparent);
    color: var(--src);
    font: 800 0.6rem var(--font-mono);
    letter-spacing: 0.5px;
    cursor: pointer;
}

.dispatch-plate::before {
    content: "WIRE";
    align-self: stretch;
    justify-self: stretch;
    background: var(--src);
    color: #05080f;
    font: 800 6.5px/11px var(--font-mono);
    letter-spacing: 1.5px;
    text-align: center;
}

.dispatch-plate.is-drop::before { content: "DROP"; }

.dispatch-source {
    min-width: 0;
    overflow: hidden;
    color: var(--src);
    font-weight: bold;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.dispatch-via {
    flex-shrink: 0;
    font: 0.55rem var(--font-mono);
    letter-spacing: 1px;
    color: var(--text-secondary);
    opacity: 0.75;
    white-space: nowrap;
}

.dispatch-hl {
    color: var(--text-primary);
    font-weight: 700;
    line-height: 1.35;
    text-decoration: none;
    border-bottom: 1px solid color-mix(in srgb, var(--src) 35%, transparent);
    transition: border-color 0.15s, color 0.15s;
}

/* A story with nowhere to go: a drop with no link. Nothing to follow, so no
   underline promising there is. */
span.dispatch-hl { border-bottom: 0; }

@media (hover: hover) {
    a.dispatch-hl:hover {
        color: #fff;
        border-bottom-color: var(--src);
    }
}

a.dispatch-hl:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.dispatch-dek {
    margin-top: 3px;
    color: var(--text-secondary);
    font-size: 0.92em;
    line-height: 1.45;
    white-space: pre-line;
}

@media (max-width: 768px) {
    /* The source and its small print share the line with the clock. */
    .dispatch-via { display: none; }
}
