/*
 * Gelatinous Web Client -- Terminal/Brutalist Corporate theme
 *
 * Mobile-first layout using CSS grid and 100dvh.
 * Color palette from the Gelatinous website design language.
 * No Bootstrap, no jQuery, no frameworks.
 */

/* ----------------------------------------------------------------
   Custom properties
   ---------------------------------------------------------------- */
:root {
    /* Ground, plate, raised — mirrored from the site's --terminal-bg-*.
       The client used to sit on neutral greys, which read cooler and
       greyer than every other surface. These are the Atlas values. */
    --bg-dark: #0b0e14;      /* ink — the ground */
    --bg-medium: #11161f;    /* plate — the input bar */
    --bg-light: #182030;     /* plate-hi — the input field itself */
    /* Amber is the house accent — it marks the control you are using.
       Same value as the site's --terminal-accent so the client and the
       website agree. */
    --amber: #e0a86f;
    --amber-dim: #b8834f;
    --amber-glow: rgba(224, 168, 111, 0.3);

    /* Green stays STATE, never decoration: connected, and success
       messages. It is paired with --yellow (connecting / warning) and
       --red (disconnected / error), so it has to keep reading as "good". */
    --green: #5fd38d;
    --green-dim: #4a9d6d;
    /* Bone, not white — matches the site's --terminal-text. This is only
       the DEFAULT colour for unstyled output; ANSI-coloured game text is
       inline-styled by ansi_up and is unaffected by anything here. */
    --text: #d8d3c4;         /* bone */
    --text-muted: #8f8d82;   /* bone-dim */
    --yellow: #e6c547;
    --red: #e85555;
    --border: #232c3a;       /* cool rule, matching --terminal-border */
    --glow: rgba(95, 211, 141, 0.3);

    --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
    --font-size: 14px;
    --context-font-size: 14px;
    --line-height: 1.4;
}

/* ----------------------------------------------------------------
   Reset & base
   ---------------------------------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background: var(--bg-dark);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: var(--font-size);
    line-height: var(--line-height);
    -webkit-text-size-adjust: 100%;
}

/* ----------------------------------------------------------------
   App shell -- 2-row CSS grid
   ---------------------------------------------------------------- */
#app {
    display: grid;
    grid-template-rows: 1fr auto;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* ----------------------------------------------------------------
   Connection state (floating in output area)
   ---------------------------------------------------------------- */
#connection-state {
    position: sticky;
    top: 0;
    float: right;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 6px;
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-dark);
    border-radius: 0 0 0 3px;
    user-select: none;
    -webkit-user-select: none;
    z-index: 1;
}

#connection-state .state-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: background 0.3s ease;
}

#connection-state .state-dot.connected {
    background: var(--green);
    box-shadow: 0 0 4px var(--glow);
}

#connection-state .state-dot.connecting {
    background: var(--yellow);
    animation: pulse 1.2s ease-in-out infinite;
}

#connection-state .state-dot.disconnected {
    background: var(--red);
}

#connection-state .latency {
    font-size: 11px;
    color: var(--text-muted);
}

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

/* ----------------------------------------------------------------
   Output area (middle)
   ---------------------------------------------------------------- */
#output {
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 10px;
    background: var(--bg-dark);
    scroll-behavior: auto;
    /* overscroll-behavior prevents pull-to-refresh on mobile */
    overscroll-behavior: contain;
}

#output-inner {
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    font-family: var(--font-mono);
    font-size: var(--font-size);
    line-height: var(--line-height);
    color: var(--text);
}

/* Auto-scroll sentinel -- invisible element at the bottom */
#scroll-sentinel {
    height: 1px;
    width: 1px;
}

/* MORE indicator when scrolled up */
#more-indicator {
    position: sticky;
    bottom: 0;
    display: none;
    text-align: center;
    padding: 2px 0;
    background: linear-gradient(transparent, var(--bg-dark) 40%);
    color: var(--yellow);
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 1px;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
}

#more-indicator.visible {
    display: block;
}

/* Custom scrollbar (Firefox + WebKit) */
#output {
    scrollbar-width: thin;
    scrollbar-color: var(--bg-light) var(--bg-dark);
}
#output::-webkit-scrollbar {
    width: 6px;
}
#output::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
#output::-webkit-scrollbar-thumb {
    background: var(--bg-light);
    border-radius: 3px;
}
#output::-webkit-scrollbar-thumb:hover {
    background: var(--border);
}

/* ----------------------------------------------------------------
   Reconnect overlay
   ---------------------------------------------------------------- */
#reconnect-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 100;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
    color: var(--text);
    font-size: 14px;
}

#reconnect-overlay.visible {
    display: flex;
}

#reconnect-overlay .reconnect-msg {
    color: var(--yellow);
    font-weight: bold;
}

#reconnect-overlay .reconnect-detail {
    color: var(--text-muted);
    font-size: 12px;
}

/* ----------------------------------------------------------------
   Input area (bottom)
   ---------------------------------------------------------------- */
#input-area {
    display: flex;
    align-items: flex-end;
    gap: 0;
    padding: 6px 8px;
    background: var(--bg-medium);
    border-top: 1px solid var(--border);
    /* Safe area for notched phones */
    padding-bottom: max(6px, env(safe-area-inset-bottom));
    flex-shrink: 0;
}

#input-field {
    flex: 1;
    resize: none;
    overflow-y: auto;
    min-height: 36px;
    max-height: 120px;   /* ~4 lines */
    padding: 7px 10px;
    background: var(--bg-light);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 3px;
    font-family: var(--font-mono);
    /* Use max() to prevent iOS zoom on focus (needs >= 16px) */
    font-size: max(var(--font-size), 16px);
    line-height: var(--line-height);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#input-field:focus {
    border-color: var(--amber-dim);
    box-shadow: 0 0 0 1px var(--amber-glow);
}

#input-field::placeholder {
    color: var(--text-muted);
    /* 0.6 left "Enter command..." at ~2.6:1 against the darker ground.
       0.8 lifts it to ~3.3:1 — still clearly a hint, actually legible. */
    opacity: 0.8;
}

#send-btn {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    margin-left: 6px;
    background: transparent;
    color: var(--amber-dim);
    border: 1px solid var(--border);
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

#send-btn:hover,
#send-btn:active {
    color: var(--amber);
    border-color: var(--amber-dim);
}

/* ----------------------------------------------------------------
   Mobile adjustments
   ---------------------------------------------------------------- */
@media (max-width: 600px) {
    :root {
        --font-size: 13px;
    }

    #status-bar {
        padding: 3px 8px;
        font-size: 11px;
    }

    #output {
        padding: 6px 8px;
    }

    #input-area {
        padding: 4px 6px;
        padding-bottom: max(4px, env(safe-area-inset-bottom));
    }
}

/* ----------------------------------------------------------------
   System messages (connection info, errors)
   ---------------------------------------------------------------- */
.sys-msg {
    color: var(--text-muted);
    font-style: italic;
}

.sys-msg.error {
    color: var(--red);
}

.sys-msg.success {
    color: var(--green);
}

.sys-msg.warning {
    color: var(--yellow);
}

.sys-echo {
    color: var(--yellow);
}

/* ====================================================================
   SKINS — CHROME ONLY  (2026-08-03)
   --------------------------------------------------------------------
   THE PROTOCOL OWNS GAME COLOUR. ansi_up runs with `use_classes = false`
   (see js/gel.js), so every coloured character the game sends is styled
   inline from the xterm-256 table and NO stylesheet — including this one
   — can reach it. A room title is the same cyan here, in Mudlet, and
   over raw telnet. That is deliberate and must stay true.

   A skin therefore dresses the room around the text: ground, input bar,
   field, borders, muted status. Not one character of game output.

   Consequence: every skin is DARK. The ANSI palette is fixed, so the
   ground has to keep it legible — and must not collide with a colour the
   palette uses (a navy ground eats |b, a maroon one swallows |r).
   ==================================================================== */

/* GENERATED SKINS (build_skins.py) BEGIN */
[data-skin="terminal"] {
    --bg-dark: #1a1a1a;
    --bg-medium: #2a2a2a;
    --bg-light: #3a3a3a;
    --amber: #5fd38d;
    --amber-dim: #4a9d6d;
    --amber-glow: rgba(95, 211, 141, 0.30);
    --text: #e0e0e0;
    --text-muted: #999999;
    --border: #404040;
}
[data-skin="stray"] {
    --bg-dark: #0d0a12;
    --bg-medium: #16111c;
    --bg-light: #201828;
    --amber: #ff3d9a;
    --amber-dim: #c42d76;
    --amber-glow: rgba(255, 61, 154, 0.32);
    --text: #e6dde4;
    --text-muted: #8d8393;
    --border: #2c2136;
}
[data-skin="dub"] {
    --bg-dark: #0e120c;
    --bg-medium: #151b12;
    --bg-light: #1e2818;
    --amber: #f0c34e;
    --amber-dim: #c29a34;
    --amber-glow: rgba(240, 195, 78, 0.30);
    --text: #e8e0c8;
    --text-muted: #979274;
    --border: #33471f;
}
[data-skin="prism"] {
    --bg-dark: #101014;
    --bg-medium: #17171e;
    --bg-light: #20202a;
    --amber: #9d7bff;
    --amber-dim: #7a5fd0;
    --amber-glow: rgba(157, 123, 255, 0.32);
    --text: #dcdce4;
    --text-muted: #8f8f9c;
    --border: #2a2a38;
}
[data-skin="laughing"] {
    --bg-dark: #0a1018;
    --bg-medium: #101a26;
    --bg-light: #182636;
    --amber: #56a8e8;
    --amber-dim: #3d7fb5;
    --amber-glow: rgba(86, 168, 232, 0.30);
    --text: #e6eef7;
    --text-muted: #8b98a8;
    --border: #24384c;
}
[data-skin="ed"] {
    --bg-dark: #171008;
    --bg-medium: #221809;
    --bg-light: #2f2210;
    --amber: #ff8c3a;
    --amber-dim: #cc6a24;
    --amber-glow: rgba(255, 140, 58, 0.32);
    --text: #f2e7d4;
    --text-muted: #a89478;
    --border: #3d2c14;
}
/* GENERATED SKINS (build_skins.py) END */


/* ================================================================
   CYBERPUNK TBG GAME CLIENT — GC-0.2 PLAY SHELL
   Presentation only. Donor transport remains owned by gel.js.
   ================================================================ */

:root {
    --tbg-bg: #071014;
    --tbg-panel: rgba(6, 18, 23, 0.94);
    --tbg-panel-soft: rgba(8, 23, 29, 0.82);
    --tbg-line: rgba(82, 190, 211, 0.32);
    --tbg-line-strong: rgba(82, 190, 211, 0.62);
    --tbg-text: #c8d8dc;
    --tbg-muted: #70868c;
    --tbg-accent: #55c8dd;
}

html,
body {
    margin: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--tbg-bg);
}

body {
    color: var(--tbg-text);
}

#app.tbg-client {
    width: 100vw;
    height: 100dvh;
    display: grid;
    grid-template-rows: 48px minmax(0, 1fr) auto;
    background:
        linear-gradient(rgba(4, 12, 16, 0.95), rgba(4, 12, 16, 0.98));
}

#client-header {
    min-width: 0;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: stretch;
    border-bottom: 1px solid var(--tbg-line-strong);
    background: rgba(3, 12, 16, 0.98);
}

.client-brand {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0 1rem;
    border-right: 1px solid var(--tbg-line);
    white-space: nowrap;
    letter-spacing: 0.08em;
    font-weight: 700;
}

.brand-primary {
    color: var(--tbg-accent);
}

.brand-secondary {
    color: var(--tbg-text);
}

#client-tabs {
    min-width: 0;
    display: flex;
    align-items: stretch;
    overflow-x: auto;
    scrollbar-width: none;
}

#client-tabs::-webkit-scrollbar {
    display: none;
}

.client-tab {
    appearance: none;
    border: 0;
    border-right: 1px solid rgba(82, 190, 211, 0.12);
    border-bottom: 2px solid transparent;
    padding: 0 1rem;
    background: transparent;
    color: var(--tbg-muted);
    font: inherit;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
}

.client-tab.active {
    color: var(--tbg-accent);
    border-bottom-color: var(--tbg-accent);
    background: rgba(82, 190, 211, 0.055);
}

.client-tab:disabled {
    opacity: 0.38;
}

#client-header #connection-state {
    position: static;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.45rem;
    padding: 0 0.85rem;
    min-width: 105px;
    color: var(--tbg-muted);
    background: transparent;
    border: 0;
}

#client-workspace {
    min-height: 0;
    min-width: 0;
    position: relative;
    overflow: hidden;
}

.client-panel {
    display: none;
    width: 100%;
    height: 100%;
}

.client-panel.active {
    display: block;
}

#play-panel {
    position: relative;
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 250px;
    overflow: hidden;
}

#play-background {
    position: absolute;
    inset: 0 250px 0 0;
    z-index: 0;
    pointer-events: none;

    /*
       GC-0.3 will supply Room/area/Zone imagery here.
       Keep empty now rather than inventing world metadata.
    */

    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    opacity: 0;
}

#play-panel #output {
    position: relative;
    inset: auto;
    z-index: 1;
    min-width: 0;
    min-height: 0;
    height: auto;
    overflow-y: auto;
    padding: 1.4rem 1.6rem 2.2rem;
    box-sizing: border-box;
    background:
        linear-gradient(
            90deg,
            rgba(3, 12, 16, 0.93) 0%,
            rgba(3, 12, 16, 0.82) 70%,
            rgba(3, 12, 16, 0.90) 100%
        );
}

#play-panel #output-inner {
    max-width: 1100px;
    min-height: 100%;
}

#context-panel {
    position: relative;
    z-index: 2;
    min-width: 0;
    overflow-y: auto;
    border-left: 1px solid var(--tbg-line-strong);
    background: var(--tbg-panel);
    font-size: var(--context-font-size);
}

.context-section {
    padding: 1rem;
    border-bottom: 1px solid var(--tbg-line);
}

.context-heading {
    margin-bottom: 0.75rem;
    color: var(--tbg-accent);
    font-size: 0.72em;
    font-weight: 700;
    letter-spacing: 0.12em;
}

.context-placeholder {
    color: var(--tbg-muted);
    font-size: 0.78em;
    line-height: 1.5;
}

#app.tbg-client #input-area {
    --command-input-height: 42px;

    position: relative;
    min-width: 0;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: end;
    gap: 0.55rem;
    padding: 0.55rem 0.75rem;
    border-top: 1px solid var(--tbg-line-strong);
    background: rgba(3, 12, 16, 0.99);
    box-sizing: border-box;
}

#command-prompt {
    color: var(--tbg-accent);
    font-weight: 700;
}

#app.tbg-client #input-field {
    width: 100%;
    height: var(--command-input-height);
    min-width: 0;
    min-height: 42px;
    max-height: none;
    resize: none;
    box-sizing: border-box;
}

#app.tbg-client #send-btn {
    flex: none;
}

#command-input-resizer {
    position: absolute;
    z-index: 25;
    top: -5px;
    right: 0;
    left: 0;
    height: 10px;
    cursor: row-resize;
    touch-action: none;
    outline: none;
}

#command-input-resizer::after {
    content: "";
    position: absolute;
    top: 4px;
    right: 0;
    left: 0;
    height: 1px;
    background: var(--tbg-line-strong);
    transition:
        height 120ms ease,
        top 120ms ease,
        background-color 120ms ease;
}

#command-input-resizer:hover::after,
#command-input-resizer:focus-visible::after,
body.command-input-resizing #command-input-resizer::after {
    top: 3px;
    height: 3px;
    background: var(--tbg-accent);
}

body.command-input-resizing,
body.command-input-resizing * {
    cursor: row-resize !important;
    user-select: none !important;
}

@media (max-width: 850px) {
    #app.tbg-client {
        grid-template-rows: auto minmax(0, 1fr) auto;
    }

    #client-header {
        grid-template-columns: 1fr auto;
    }

    .client-brand {
        min-height: 42px;
    }

    #client-tabs {
        grid-column: 1 / -1;
        grid-row: 2;
        border-top: 1px solid rgba(82, 190, 211, 0.12);
    }

    .client-tab {
        min-height: 38px;
    }

    #play-panel {
        grid-template-columns: 1fr;
    }

    #context-panel {
        display: none;
    }

    #play-background {
        right: 0;
    }
}

@media (max-width: 520px) {
    .brand-primary {
        display: none;
    }

    .client-brand {
        padding: 0 0.75rem;
    }

    #client-header #connection-state {
        min-width: 0;
    }

    #state-text,
    #latency {
        display: none;
    }

    #play-panel #output {
        padding: 1rem 0.85rem 1.8rem;
    }
}


/* ================================================================
   GC-0.2A — NEON DRIFTERS CLIENT MASTHEAD

   Mirrors the established public-site masthead scale and wordmark
   treatment without importing Bootstrap/site CSS into the game client.
   ================================================================ */

#app.tbg-client {
    grid-template-rows: 68px minmax(0, 1fr) auto;
}

#client-header {
    min-height: 68px;
    background:
        linear-gradient(
            90deg,
            rgba(131, 200, 217, 0.055),
            transparent 35%
        ),
        #0b1013;
    border-top: 1px solid #111b20;
}

#client-header::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 180px;
    height: 1px;
    background: var(--tbg-accent);
    opacity: 0.72;
    pointer-events: none;
}

#client-header {
    position: relative;
}

.client-brand {
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 0;
    min-width: 180px;
    padding: 0 1.25rem;
    line-height: 1;
}

.client-wordmark {
    color: #eef5f7;
    font-family: inherit;
    font-size: 0.96rem;
    font-weight: 800;
    letter-spacing: 0.13em;
    line-height: 1;
    text-transform: uppercase;
    white-space: nowrap;
}

.client-wordmark-o {
    display: inline-block;
    width: 0.88em;
    height: 0.88em;
    margin: 0 0.04em;
    border: 1px solid currentColor;
    border-radius: 50%;
    color: var(--tbg-accent);
    line-height: 0.76em;
    text-align: center;
    transform: translateY(-0.01em);
}

.client-tagline {
    margin-top: 0.45rem;
    color: #82949b;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    line-height: 1;
    white-space: nowrap;
}

#client-tabs {
    align-items: stretch;
}

.client-tab {
    min-height: 68px;
    padding: 0 1.05rem;
    color: var(--tbg-muted);
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.075em;
    text-transform: uppercase;
    transition:
        color 120ms ease,
        background-color 120ms ease,
        border-color 120ms ease;
}

.client-tab:hover:not(:disabled),
.client-tab:focus-visible:not(:disabled) {
    color: #eef5f7;
}

.client-tab.active {
    color: var(--tbg-accent);
}

#client-header #connection-state {
    min-height: 68px;
    padding: 0 1.1rem;
    font-size: 0.72rem;
}

.client-header-tools {
    min-width: 0;
    display: flex;
    align-items: stretch;
}

.client-settings {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0 0.8rem;
    border-left: 1px solid rgba(82, 190, 211, 0.12);
    border-right: 1px solid rgba(82, 190, 211, 0.12);
    white-space: nowrap;
}

.client-setting-label {
    color: var(--tbg-muted);
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.1em;
}

.client-setting-select {
    min-width: 5.6rem;
    padding: 0.3rem 1.35rem 0.3rem 0.45rem;
    border: 1px solid var(--tbg-line);
    border-radius: 2px;
    background: var(--bg-light);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    line-height: 1.2;
    cursor: pointer;
}

.client-setting-select:hover {
    border-color: var(--tbg-line-strong);
}

.client-setting-select:focus-visible {
    outline: 2px solid var(--tbg-accent);
    outline-offset: 2px;
}

.client-setting-button {
    appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.45rem;
    border: 1px solid var(--tbg-line);
    border-radius: 2px;
    background: transparent;
    color: var(--tbg-accent);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    line-height: 1.2;
    cursor: pointer;
}

.client-setting-button-label {
    color: var(--tbg-muted);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.client-setting-button:hover {
    border-color: var(--tbg-line-strong);
    color: #eef5f7;
}

.client-setting-button:focus-visible {
    outline: 2px solid var(--tbg-accent);
    outline-offset: 2px;
}

.client-log-control {
    position: relative;
}

.client-log-summary {
    list-style: none;
}

.client-log-summary::-webkit-details-marker {
    display: none;
}

.client-log-control[open] .client-log-summary {
    border-color: var(--tbg-line-strong);
    background: rgba(82, 190, 211, 0.055);
}

.client-log-actions {
    position: absolute;
    z-index: 60;
    top: calc(100% + 0.45rem);
    right: 0;
    width: 11.5rem;
    padding: 0.35rem;
    border: 1px solid var(--tbg-line-strong);
    background: rgba(3, 12, 16, 0.99);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.42);
}

.client-log-actions button {
    appearance: none;
    width: 100%;
    padding: 0.55rem 0.65rem;
    border: 0;
    border-bottom: 1px solid rgba(82, 190, 211, 0.12);
    background: transparent;
    color: var(--tbg-text);
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.06em;
    text-align: left;
    cursor: pointer;
}

.client-log-actions button:last-child {
    border-bottom: 0;
}

.client-log-actions button:hover:not(:disabled) {
    color: var(--tbg-accent);
    background: rgba(82, 190, 211, 0.055);
}

.client-log-actions button:focus-visible {
    outline: 2px solid var(--tbg-accent);
    outline-offset: -3px;
}

.client-log-actions button:disabled {
    color: var(--tbg-muted);
    cursor: default;
    opacity: 0.48;
}

/* Supersede the old GC-0.2 mobile brand rule. */
@media (max-width: 850px) {
    #app.tbg-client {
        grid-template-rows: auto minmax(0, 1fr) auto;
    }

    #client-header {
        grid-template-columns: 1fr auto;
    }

    .client-brand {
        min-height: 58px;
        padding: 0 1rem;
    }

    #client-header #connection-state {
        min-height: 58px;
    }

    .client-settings {
        min-height: 58px;
    }

    #client-tabs {
        min-height: 42px;
    }

    .client-tab {
        min-height: 42px;
        padding: 0 0.9rem;
    }
}

@media (max-width: 520px) {
    #client-header {
        grid-template-columns: 1fr;
    }

    .client-brand {
        grid-column: 1;
        grid-row: 1;
        min-width: 0;
        padding: 0 0.8rem;
    }

    .client-wordmark {
        font-size: 0.88rem;
    }

    .client-tagline {
        font-size: 0.56rem;
    }

    .client-settings {
        min-height: 40px;
        gap: 0.3rem;
        padding: 0 0.5rem;
    }

    .client-setting-select {
        min-width: 5.1rem;
    }

    #client-header #connection-state {
        min-height: 40px;
        padding: 0 0.65rem;
    }

    .client-header-tools {
        grid-column: 1;
        grid-row: 2;
        justify-content: flex-end;
        border-top: 1px solid rgba(82, 190, 211, 0.12);
    }

    #client-tabs {
        grid-row: 3;
    }

    /* Do not hide the NEON DRIFTERS name on narrow clients. */
    .brand-primary {
        display: initial;
    }
}


/* GC-0.2A live visual tune — slightly stronger client branding */
.client-wordmark {
    font-size: 1.10rem;
}

.client-tagline {
    font-size: 0.67rem;
}

.client-brand {
    min-width: 195px;
}

@media (max-width: 520px) {
    .client-wordmark {
        font-size: 0.98rem;
    }

    .client-tagline {
        font-size: 0.60rem;
    }
}


/* GC-0.2B — return to public NEON DRIFTERS site */
.client-tab-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    text-decoration: none;
    color: var(--tbg-muted);
}

.client-tab-back:hover,
.client-tab-back:focus-visible {
    color: #eef5f7;
    text-decoration: none;
    background: rgba(82, 190, 211, 0.045);
}


/* ================================================================
   GC-0.3C1 — LOCATION ARTWORK

   Server resolves what the character/client is allowed to know.
   Browser only presents the resolved stable image key.
   ================================================================ */

#play-background {
    opacity: 1;
    overflow: hidden;
    background: #071014;
}

.play-background-layer {
    position: absolute;
    inset: 0;

    background-position: center center;
    background-repeat: no-repeat;
    background-size: cover;

    opacity: 0;

    filter:
        brightness(0.62)
        saturate(0.72)
        contrast(1.04);

    transform: scale(1.015);

    transition:
        opacity 420ms ease,
        transform 900ms ease;

    will-change: opacity;
}

.play-background-layer.active {
    opacity: 0.58;
    transform: scale(1);
}

/*
 * The prose remains authoritative and dominant. This translucent layer
 * provides enough image visibility for atmosphere without sacrificing
 * ANSI/text readability.
 */
#play-panel #output {
    background:
        linear-gradient(
            90deg,
            rgba(3, 12, 16, 0.79) 0%,
            rgba(3, 12, 16, 0.68) 62%,
            rgba(3, 12, 16, 0.80) 100%
        );
}

/* Mobile receives slightly stronger darkening for readability. */
@media (max-width: 850px) {
    .play-background-layer.active {
        opacity: 0.48;
    }

    #play-panel #output {
        background: rgba(3, 12, 16, 0.76);
    }
}

@media (prefers-reduced-motion: reduce) {
    .play-background-layer {
        transition: none;
        transform: none;
    }
}


/* ================================================================
   GC-0.2C — RESIZABLE CONTEXT PANEL
   ================================================================ */

#play-panel {
    --context-panel-width: 320px;

    grid-template-columns:
        minmax(0, 1fr)
        var(--context-panel-width);
}

/*
 * Location artwork belongs only behind the primary play area.
 * Its right edge follows the resizable context panel.
 */
#play-background {
    right: var(--context-panel-width);
}

#context-panel {
    position: relative;
    min-width: 0;
}

#context-resizer {
    position: absolute;
    z-index: 10;

    top: 0;
    bottom: 0;
    left: -5px;

    width: 10px;

    cursor: col-resize;
    touch-action: none;

    outline: none;
}

#context-resizer::after {
    content: "";

    position: absolute;
    top: 0;
    bottom: 0;
    left: 4px;

    width: 1px;

    background: var(--tbg-line-strong);

    transition:
        width 120ms ease,
        left 120ms ease,
        background-color 120ms ease;
}

#context-resizer:hover::after,
#context-resizer:focus-visible::after,
body.context-resizing #context-resizer::after {
    left: 3px;
    width: 3px;
    background: var(--tbg-accent);
}

body.context-resizing,
body.context-resizing * {
    cursor: col-resize !important;
    user-select: none !important;
}

@media (max-width: 850px) {
    #context-resizer {
        display: none;
    }

    /*
     * Context panel is hidden at this breakpoint, so artwork again owns
     * the full horizontal play surface.
     */
    #play-background {
        right: 0;
    }
}


/* ================================================================
   GC-0.2C1 — CONTEXT RESIZER REPAIR

   The resize handle is now its own grid column rather than a
   negatively-positioned child of the scrolling context panel.
   ================================================================ */

#play-panel {
    --context-panel-width: 320px;
    --context-resizer-width: 8px;

    grid-template-columns:
        minmax(0, 1fr)
        var(--context-resizer-width)
        var(--context-panel-width);
}

#play-background {
    right: calc(
        var(--context-panel-width) +
        var(--context-resizer-width)
    );
}

#context-panel {
    border-left: 0;
}

#context-resizer {
    position: relative;
    z-index: 20;

    width: var(--context-resizer-width);
    height: 100%;

    cursor: col-resize;
    touch-action: none;
    outline: none;

    background: rgba(82, 190, 211, 0.035);
    border-left: 1px solid var(--tbg-line);
    border-right: 1px solid var(--tbg-line);
    box-sizing: border-box;
}

#context-resizer::after {
    content: "";

    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;

    width: 1px;

    background: var(--tbg-line-strong);
    transform: translateX(-50%);

    transition:
        width 120ms ease,
        background-color 120ms ease;
}

#context-resizer:hover,
#context-resizer:focus-visible,
body.context-resizing #context-resizer {
    background: rgba(82, 190, 211, 0.10);
}

#context-resizer:hover::after,
#context-resizer:focus-visible::after,
body.context-resizing #context-resizer::after {
    width: 3px;
    background: var(--tbg-accent);
}

@media (max-width: 850px) {
    #play-panel {
        grid-template-columns: 1fr;
    }

    #context-resizer {
        display: none;
    }

    #play-background {
        right: 0;
    }
}

/* ================================================================
   LOCAL CONTEXT PANEL VISIBILITY / MOBILE DRAWER
   Contents stay mounted; only their shell presentation changes.
   ================================================================ */

#context-panel-backdrop,
#context-panel-close {
    display: none;
}

#play-panel.context-panel-hidden {
    grid-template-columns: minmax(0, 1fr) 0 0;
}

#play-panel.context-panel-hidden #play-background {
    right: 0;
}

#play-panel.context-panel-hidden #context-resizer {
    width: 0;
    overflow: hidden;
    visibility: hidden;
    pointer-events: none;
    border: 0;
}

#play-panel.context-panel-hidden #context-panel {
    overflow: hidden;
    visibility: hidden;
    pointer-events: none;
}

@media (max-width: 850px) {
    #play-panel,
    #play-panel.context-panel-hidden {
        grid-template-columns: 1fr;
    }

    #context-panel {
        display: block;
        position: absolute;
        z-index: 30;
        top: 0;
        right: 0;
        bottom: 0;
        width: min(
            var(--context-panel-width),
            calc(100% - 2.75rem)
        );
        max-width: 520px;
        overflow-y: auto;
        visibility: hidden;
        border-left: 1px solid var(--tbg-line-strong);
        box-shadow: -12px 0 28px rgba(0, 0, 0, 0.42);
        pointer-events: none;
        transform: translateX(100%);
        transition:
            transform 180ms ease,
            visibility 180ms ease;
    }

    #play-panel:not(.context-panel-hidden) #context-panel {
        overflow-y: auto;
        visibility: visible;
        pointer-events: auto;
        transform: translateX(0);
    }

    #context-panel-backdrop {
        display: block;
        position: absolute;
        z-index: 25;
        inset: 0;
        visibility: hidden;
        background: rgba(1, 6, 8, 0.62);
        opacity: 0;
        pointer-events: none;
        transition:
            opacity 180ms ease,
            visibility 180ms ease;
    }

    #play-panel:not(.context-panel-hidden) #context-panel-backdrop {
        visibility: visible;
        opacity: 1;
        pointer-events: auto;
    }

    #context-panel-close {
        appearance: none;
        position: sticky;
        z-index: 1;
        top: 0;
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 0.45rem;
        padding: 0.65rem 0.8rem;
        border: 0;
        border-bottom: 1px solid var(--tbg-line);
        background: rgba(3, 12, 16, 0.98);
        color: var(--tbg-accent);
        font-family: var(--font-mono);
        font-size: 0.68em;
        font-weight: 700;
        letter-spacing: 0.1em;
        cursor: pointer;
    }

    #context-panel-close:hover {
        color: #eef5f7;
    }

    #context-panel-close:focus-visible {
        outline: 2px solid var(--tbg-accent);
        outline-offset: -3px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #context-panel,
    #context-panel-backdrop {
        transition: none;
    }
}

/* ================================================================
   GC-0.4E — CHARACTER WORKSPACE
   Read-only presentation of authoritative Character identity,
   Attributes and visible Skills.
   ================================================================ */

#character-panel {
    overflow-y: auto;
    background:
        linear-gradient(
            135deg,
            rgba(82, 190, 211, 0.035),
            transparent 36%
        ),
        #061015;
}

.character-sheet {
    width: min(1500px, calc(100% - 3rem));
    margin: 0 auto;
    padding: 2rem 0 3rem;
    box-sizing: border-box;
}

.character-sheet__header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 2rem;

    padding: 0 0 1.35rem;
    border-bottom: 1px solid var(--tbg-line-strong);
}

.character-sheet__eyebrow {
    margin-bottom: 0.45rem;
    color: var(--tbg-muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.18em;
}

.character-sheet__name {
    margin: 0;

    color: #eef5f7;
    font-size: clamp(1.45rem, 2.4vw, 2.35rem);
    font-weight: 600;
    letter-spacing: 0.04em;
}

.character-sheet__identity {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.3rem;

    color: #d0dde1;
    font-size: 0.9rem;
    letter-spacing: 0.08em;
}

.character-sheet__identity-label {
    color: var(--tbg-accent);
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.16em;
}

.character-sheet__section {
    margin-top: 1.6rem;
}

.character-sheet__section-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;

    margin-bottom: 0.8rem;
}

.character-sheet__section-heading h2 {
    margin: 0;

    color: var(--tbg-accent);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.16em;
}

.character-sheet__section-heading span {
    color: var(--tbg-muted);
    font-size: 0.62rem;
    letter-spacing: 0.12em;
}

.character-attributes {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.7rem;
}

.character-attribute {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    gap: 0.25rem 0.8rem;

    min-width: 0;
    padding: 0.8rem 0.9rem;

    border: 1px solid var(--tbg-line);
    background: rgba(7, 20, 26, 0.76);
}

.character-attribute__name {
    min-width: 0;

    color: #d7e3e6;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.055em;
    text-transform: uppercase;
}

.character-attribute__value {
    grid-row: 1 / 3;
    grid-column: 2;

    align-self: center;

    color: var(--tbg-accent);
    font-size: 1.45rem;
    font-weight: 600;
    line-height: 1;
}

.character-attribute__descriptor {
    color: var(--tbg-muted);
    font-size: 0.7rem;
}

.character-skills {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
    gap: 0.9rem;
}

.character-skill-group {
    min-width: 0;

    border: 1px solid var(--tbg-line);
    background: rgba(7, 20, 26, 0.70);
}

.character-skill-group__heading {
    margin: 0;
    padding: 0.55rem 0.7rem;

    border-bottom: 1px solid var(--tbg-line);

    color: var(--tbg-accent);
    background: rgba(82, 190, 211, 0.035);

    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.character-skill {
    display: grid;
    grid-template-columns:
        minmax(7rem, 1fr)
        2.2rem
        minmax(5.6rem, 0.72fr);
    align-items: baseline;
    gap: 0.55rem;

    min-width: 0;
    padding: 0.42rem 0.7rem;

    border-bottom: 1px solid rgba(82, 190, 211, 0.07);
}

.character-skill:last-child {
    border-bottom: 0;
}

.character-skill__name {
    min-width: 0;
    overflow: hidden;

    color: #cedadd;
    font-size: 0.74rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.character-skill__rating {
    color: var(--tbg-accent);
    font-size: 0.78rem;
    font-weight: 700;
    text-align: center;
}

.character-skill__descriptor {
    min-width: 0;
    overflow: hidden;

    color: var(--tbg-muted);
    font-size: 0.67rem;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 1100px) {
    .character-attributes {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .character-skills {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 680px) {
    .character-sheet {
        width: calc(100% - 1.5rem);
        padding-top: 1.1rem;
    }

    .character-sheet__header {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.8rem;
    }

    .character-sheet__identity {
        align-items: flex-start;
    }

    .character-attributes,
    .character-skills {
        grid-template-columns: 1fr;
    }

    .character-sheet__section-heading span {
        display: none;
    }
}

/* ================================================================
   GC-0.5E4 — INVENTORY WORKSPACE
   Projection of authoritative physical inventory state and server-authored
   command conveniences.
   ================================================================ */

#inventory-panel {
    overflow-y: auto;
    background:
        linear-gradient(
            135deg,
            rgba(82, 190, 211, 0.035),
            transparent 36%
        ),
        #061015;
}

.inventory-sheet {
    width: min(1500px, calc(100% - 3rem));
    margin: 0 auto;
    padding: 2rem 0 3rem;
    box-sizing: border-box;
}

.inventory-sheet__header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 2rem;
    padding-bottom: 1.35rem;
    border-bottom: 1px solid var(--tbg-line-strong);
}

.inventory-sheet__eyebrow {
    margin-bottom: 0.45rem;
    color: var(--tbg-muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.18em;
}

.inventory-sheet__title {
    margin: 0;
    color: #eef5f7;
    font-size: clamp(1.45rem, 2.4vw, 2.35rem);
    font-weight: 600;
    letter-spacing: 0.04em;
}

.inventory-sheet__status {
    color: var(--tbg-accent);
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-align: right;
}

.inventory-layout {
    display: grid;
    grid-template-columns: minmax(15rem, 0.8fr) minmax(18rem, 1fr) minmax(22rem, 1.4fr);
    gap: 1rem;
    padding-top: 1.25rem;
    align-items: start;
}

.inventory-section {
    min-width: 0;
    border: 1px solid var(--tbg-line);
    background: rgba(7, 20, 26, 0.72);
}

.inventory-section__heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.8rem 0.9rem;
    border-bottom: 1px solid var(--tbg-line);
    background: rgba(14, 33, 42, 0.7);
}

.inventory-section__heading h2 {
    margin: 0;
    color: #e5eff2;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.13em;
}

.inventory-section__heading span {
    color: var(--tbg-muted);
    font-size: 0.56rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-align: right;
}

.inventory-hands,
.inventory-items {
    display: grid;
    gap: 0.65rem;
    padding: 0.75rem;
}

.inventory-hand {
    min-width: 0;
    border: 1px solid var(--tbg-line);
    background: rgba(3, 12, 16, 0.72);
}

.inventory-hand.is-unavailable {
    opacity: 0.55;
}

.inventory-hand__heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.65rem;
    border-bottom: 1px solid rgba(103, 158, 176, 0.18);
}

.inventory-hand__label {
    color: #dbe8eb;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.inventory-hand__state {
    color: var(--tbg-muted);
    font-size: 0.52rem;
    font-weight: 700;
    letter-spacing: 0.1em;
}

.inventory-item {
    min-width: 0;
    border-left: 2px solid rgba(82, 190, 211, 0.48);
    background: rgba(7, 21, 27, 0.72);
}

.inventory-item__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.6rem 0.7rem;
}

.inventory-item__name {
    min-width: 0;
    overflow: hidden;
    color: #dce9ec;
    font-size: 0.8rem;
    line-height: 1.3;
    text-overflow: ellipsis;
}

.inventory-item__count {
    flex: 0 0 auto;
    color: var(--tbg-muted);
    font-size: 0.52rem;
    font-weight: 700;
    letter-spacing: 0.09em;
}

.inventory-item__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.42rem;
    padding: 0 0.7rem 0.62rem;
}

.inventory-item__action {
    appearance: none;
    min-height: 1.75rem;
    padding: 0.3rem 0.58rem;
    border: 1px solid rgba(255, 185, 86, 0.5);
    background: rgba(61, 39, 12, 0.42);
    color: #f0d2a6;
    font-family: var(--font-mono);
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
}

.inventory-item__action:hover,
.inventory-item__action:focus-visible {
    border-color: rgba(255, 199, 116, 0.9);
    background: rgba(115, 70, 16, 0.46);
    color: #fff1d8;
}

.inventory-item__action:focus-visible {
    outline: 1px solid var(--tbg-accent);
    outline-offset: 2px;
}

.inventory-item__contents {
    display: grid;
    gap: 0.45rem;
    margin: 0 0.55rem 0.55rem 0.75rem;
    padding-left: 0.6rem;
    border-left: 1px solid rgba(82, 190, 211, 0.22);
}

.inventory-item__warning {
    padding: 0 0.7rem 0.55rem;
    color: #d9b36d;
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.inventory-empty {
    padding: 0.7rem;
    color: var(--tbg-muted);
    font-size: 0.72rem;
    font-style: italic;
}

@media (max-width: 1050px) {
    .inventory-layout {
        grid-template-columns: 1fr 1fr;
    }

    .inventory-section--carried {
        grid-column: 1 / -1;
    }
}

@media (max-width: 700px) {
    .inventory-sheet {
        width: min(100% - 1.5rem, 1500px);
    }

    .inventory-sheet__header {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.75rem;
    }

    .inventory-sheet__status {
        text-align: left;
    }

    .inventory-layout {
        grid-template-columns: 1fr;
    }

    .inventory-section--carried {
        grid-column: auto;
    }

    .inventory-section__heading span {
        display: none;
    }
}

/* ================================================================
   GC-0.4E1 — AUTHORITATIVE CLIENT PANEL VISIBILITY

   #play-panel has its own display:grid declaration, which otherwise
   outranks the generic .client-panel visibility rule by CSS
   specificity. The workspace owns which full-screen panel is visible.
   ================================================================ */

#client-workspace > .client-panel:not(.active) {
    display: none;
}

#client-workspace > #play-panel.client-panel.active {
    display: grid;
}

#client-workspace > #character-panel.client-panel.active {
    display: block;
}

#client-workspace > #inventory-panel.client-panel.active {
    display: block;
}

/* ================================================================
   TRUSTED OBSERVER-AUTHORIZED INTERACTIONS
   ================================================================ */

.inline-room-interaction {
    appearance: none;
    display: inline;
    margin: 0;
    padding: 0 0.06em;
    border: 0;
    border-bottom: 1px dotted rgba(82, 190, 211, 0.62);
    border-radius: 0;
    background: transparent;
    color: #a9e3ed;
    font: inherit;
    line-height: inherit;
    text-align: inherit;
    cursor: pointer;
}

.inline-room-interaction--character {
    border-bottom-color: rgba(210, 117, 255, 0.64);
    color: #d8b5eb;
}

.inline-room-interaction--object {
    border-bottom-color: rgba(255, 185, 86, 0.64);
    color: #dfc49d;
}

.inline-room-interaction:hover,
.inline-room-interaction:focus-visible {
    background: rgba(82, 190, 211, 0.11);
    color: #f1fbfd;
}

.inline-room-interaction:focus-visible {
    outline: 1px solid var(--tbg-accent);
    outline-offset: 2px;
}

.inline-room-interaction:disabled {
    padding: 0;
    border-bottom-color: transparent;
    background: transparent;
    color: inherit;
    cursor: text;
}

.trusted-interactions {
    display: flex;
    flex-direction: column;
    gap: 0.68rem;
    min-width: 0;
}

.trusted-interactions[hidden],
.interaction-popover[hidden] {
    display: none;
}

.trusted-interaction-group {
    min-width: 0;
}

.trusted-interaction-group__heading {
    margin: 0 0 0.3rem;
    color: var(--tbg-muted);
    font-family: var(--font-mono);
    font-size: 0.55em;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.trusted-interaction-group__items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.42rem;
    min-width: 0;
}

.trusted-interaction {
    display: inline-flex;
    min-width: 0;
    border: 1px solid rgba(82, 190, 211, 0.38);
    background: rgba(3, 12, 16, 0.78);
}

.trusted-interaction--character {
    border-color: rgba(210, 117, 255, 0.44);
}

.trusted-interaction--object {
    border-color: rgba(255, 185, 86, 0.44);
}

.trusted-interaction button,
.interaction-popover button {
    appearance: none;
    border: 0;
    font-family: var(--font-mono);
    cursor: pointer;
}

.trusted-interaction__action,
.trusted-interaction__label {
    min-height: 2rem;
    padding: 0.38rem 0.52rem;
    background: transparent;
    color: var(--tbg-accent);
    font-size: 0.72em;
    text-align: left;
}

.trusted-interaction__label {
    display: inline-flex;
    align-items: center;
    color: var(--tbg-text);
    overflow-wrap: anywhere;
}

.trusted-interaction--character .trusted-interaction__action {
    color: #dca5f7;
}

.trusted-interaction--object .trusted-interaction__action {
    color: #edbd78;
}

.trusted-interaction__info {
    min-width: 2.5rem;
    min-height: 2rem;
    padding: 0.38rem 0.45rem;
    border-left: 1px solid rgba(82, 190, 211, 0.24) !important;
    background: rgba(82, 190, 211, 0.06);
    color: var(--tbg-muted);
    font-size: 0.52em;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.trusted-interaction button:hover,
.trusted-interaction button:focus-visible,
.interaction-popover button:hover,
.interaction-popover button:focus-visible {
    background: rgba(82, 190, 211, 0.14);
    color: #f1fbfd;
}

.trusted-interaction button:focus-visible,
.interaction-popover button:focus-visible {
    position: relative;
    z-index: 1;
    outline: 2px solid var(--tbg-accent);
    outline-offset: -2px;
}

.interaction-popover {
    position: fixed;
    z-index: 120;
    width: min(19rem, calc(100vw - 1rem));
    max-height: calc(100vh - 1rem);
    overflow: auto;
    padding: 0.75rem;
    border: 1px solid var(--tbg-line-strong);
    border-radius: 2px;
    background: rgba(3, 12, 16, 0.985);
    color: var(--tbg-text);
    box-shadow: 0 16px 38px rgba(0, 0, 0, 0.62);
    font-family: var(--font-mono);
    font-size: var(--context-font-size);
}

.interaction-popover__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.interaction-popover__header h2 {
    margin: 0;
    color: #edf7f9;
    font-size: 0.84em;
    line-height: 1.3;
}

.interaction-popover__close {
    flex: 0 0 auto;
    min-width: 2rem;
    min-height: 2rem;
    background: transparent;
    color: var(--tbg-muted);
    font-size: 1em;
}

.interaction-popover__description {
    margin: 0.55rem 0 0;
    color: #c9d9dd;
    font-size: 0.7em;
    line-height: 1.45;
}

.interaction-popover__rows {
    display: grid;
    grid-template-columns: minmax(4rem, auto) minmax(0, 1fr);
    gap: 0.28rem 0.7rem;
    margin: 0.65rem 0 0;
    padding-top: 0.55rem;
    border-top: 1px solid rgba(82, 190, 211, 0.16);
    font-size: 0.62em;
    line-height: 1.4;
}

.interaction-popover__rows dt {
    color: var(--tbg-muted);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.interaction-popover__rows dd {
    min-width: 0;
    margin: 0;
    color: var(--tbg-text);
    overflow-wrap: anywhere;
}

.interaction-popover__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.7rem;
}

.interaction-popover__action {
    min-height: 2rem;
    padding: 0.4rem 0.65rem;
    border: 1px solid var(--tbg-line) !important;
    background: rgba(82, 190, 211, 0.07);
    color: var(--tbg-accent);
    font-size: 0.64em;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.client-log-actions button:not(:disabled) {
    opacity: 1;
    pointer-events: auto;
}

#session-log-download:not(:disabled) {
    color: var(--tbg-accent);
    background: rgba(82, 190, 211, 0.08);
}

@media (max-width: 600px), (pointer: coarse) {
    .inline-room-interaction:not(:disabled) {
        display: inline-block;
        min-height: 1.85em;
        margin: -0.18em 0;
        padding: 0.18em 0.12em;
    }

    .trusted-interaction__action,
    .trusted-interaction__label,
    .trusted-interaction__info {
        min-height: 2.75rem;
    }

    .interaction-popover.is-mobile {
        inset: auto 0 0 0;
        width: 100%;
        max-width: 100%;
        max-height: min(70vh, 28rem);
        padding: 0.9rem max(0.8rem, env(safe-area-inset-right))
            max(0.9rem, env(safe-area-inset-bottom))
            max(0.8rem, env(safe-area-inset-left));
        border-width: 1px 0 0;
        border-radius: 0;
    }
}

/* =================================================================
   GPS minimap — compact right-panel 5x5 navigation presentation
   ================================================================= */

.gps-minimap-section {
    padding: 1rem;
}

.gps-minimap-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0;
    cursor: pointer;
    list-style: none;
    user-select: none;
    -webkit-user-select: none;
}

.gps-minimap-summary::-webkit-details-marker {
    display: none;
}

.gps-minimap-section[open] .gps-minimap-summary {
    margin-bottom: 0.75rem;
}

.gps-minimap-toggle-mark {
    color: var(--text-muted);
    font-size: 0.9em;
    transition: transform 120ms ease;
}

.gps-minimap-section:not([open]) .gps-minimap-toggle-mark {
    transform: rotate(-90deg);
}

.gps-minimap-status {
    padding: 0.65rem 0.5rem;
    border: 1px solid var(--border);
    text-align: center;
    letter-spacing: 0.08em;
}

.gps-minimap-active[hidden] {
    display: none;
}

.gps-minimap-header {
    margin-bottom: 0.5rem;
    text-align: center;
}

.gps-minimap-name {
    color: var(--text);
    font-size: 0.76em;
    font-weight: 700;
    letter-spacing: 0.06em;
}

.gps-minimap-coordinates {
    margin-top: 0.15rem;
    color: var(--text-muted);
    font-size: 0.68em;
    white-space: nowrap;
}

.gps-minimap-compass {
    width: max-content;
    max-width: 100%;
    margin: 0 auto;
    font-family: var(--font-mono);
}

.gps-minimap-middle {
    display: grid;
    grid-template-columns: 1.5rem auto 1.5rem;
    align-items: center;
    justify-content: center;
}

.gps-minimap-direction {
    color: var(--text-muted);
    font-size: 0.72em;
    font-weight: 700;
    text-align: center;
}

.gps-minimap-north,
.gps-minimap-south {
    line-height: 1.25;
}

.gps-minimap-grid {
    display: grid;
    grid-template-columns: repeat(5, 2ch);
    grid-template-rows: repeat(5, 1.25em);
    align-items: center;
    justify-items: center;
    font-size: 0.82em;
    font-weight: 700;
    line-height: 1;
}

.gps-minimap-cell {
    display: inline-block;
    width: 2ch;
    white-space: pre;
    text-align: center;
}

/* Shared semantic palette with the text GPS. */
.gps-minimap-cell--current {
    color: #ff4f4f;
    text-shadow: 0 0 5px rgba(255, 79, 79, 0.45);
}

.gps-minimap-cell--road {
    color: var(--yellow);
}

.gps-minimap-cell--poi {
    color: #ff62e8;
}

.gps-minimap-cell--structure {
    color: #f2eee2;
}

.gps-minimap-cell--vegetation {
    color: var(--green);
}

.gps-minimap-cell--water {
    color: #4f8fff;
}

.gps-minimap-cell--deep_water {
    color: #78c7ff;
}

.gps-minimap-cell--marsh {
    color: #55d8d0;
}

.gps-minimap-cell--open_ground {
    color: var(--text-muted);
}

.gps-minimap-cell--blank {
    color: transparent;
}

.gps-minimap-cell--other {
    color: var(--text);
}

@media (prefers-reduced-motion: reduce) {
    .gps-minimap-toggle-mark {
        transition: none;
    }
}

