@font-face {
    font-family: "NeoDunggeunmo Code";
    src: url("fonts/neodgm-code-v1.601.woff2") format("woff2");
    font-display: swap;
}

:root {
    font-family: Gulim, Dotum, "돋움", system-ui, sans-serif;
    color: #101010;
    background: #748181;
    color-scheme: light;
    --desktop: #748181;
    --chrome: #c0c0c0;
    --chrome-light: #ffffff;
    --chrome-mid: #808080;
    --chrome-dark: #000000;
    --title: #000080;
    --title-text: #ffffff;
    --terminal-bg: #020603;
    --terminal-panel: #061008;
    --terminal-green: #72d97d;
    --terminal-strong: #a6f0a8;
    --terminal-dim: #3f8c49;
    --terminal-faint: #173d1d;
    --terminal-amber: #d6aa49;
    --terminal-error: #ff8f78;
}

* { box-sizing: border-box; }
html, body, #app { width: 100%; height: 100%; }
body { margin: 0; min-width: 320px; overflow: hidden; background: var(--desktop); }
button, input, summary { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, summary:focus-visible, a:focus-visible { outline: 2px dotted #000; outline-offset: -4px; }
button:disabled { color: #777; text-shadow: 1px 1px #fff; cursor: not-allowed; }

.game-shell {
    position: relative;
    display: grid;
    grid-template-rows: 25px 28px minmax(0, 1fr) 88px 23px;
    width: 100%;
    height: 100dvh;
    min-height: 520px;
    overflow: hidden;
    border: 2px solid;
    border-color: var(--chrome-light) var(--chrome-dark) var(--chrome-dark) var(--chrome-light);
    background: var(--chrome);
}

.window-titlebar {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    margin: 2px 2px 0;
    padding: 2px 3px;
    background: var(--title);
    color: var(--title-text);
    font-size: 12px;
}
.window-titlebar h1 { overflow: hidden; margin: 0; color: inherit; font: inherit; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.window-icon { display: grid; width: 16px; height: 16px; place-items: center; border: 1px solid #fff; color: #fff; font-size: 10px; }
.window-mode { margin-left: auto; color: #d8d8ff; font-size: 11px; white-space: nowrap; }
.window-controls { display: flex; gap: 2px; }
.window-controls i { display: grid; width: 18px; height: 17px; place-items: center; border: 2px solid; border-color: #fff #000 #000 #fff; background: var(--chrome); color: #000; font-style: normal; line-height: 1; }

.window-menu {
    position: relative;
    z-index: 20;
    display: flex;
    align-items: center;
    min-width: 0;
    padding: 1px 5px;
    border-bottom: 1px solid var(--chrome-mid);
    background: var(--chrome);
    font-size: 12px;
}
.window-menu > button, .window-menu summary {
    border: 1px solid transparent;
    background: transparent;
    padding: 4px 8px;
    list-style: none;
    cursor: default;
}
.window-menu > button:hover:not(:disabled), .window-menu summary:hover, .menu-popover[open] > summary { border-color: #000; background: var(--title); color: #fff; }
.window-menu summary::-webkit-details-marker { display: none; }
.menu-popover { position: relative; }
.menu-sheet {
    position: absolute;
    top: 100%;
    left: 0;
    display: grid;
    gap: 5px;
    width: 225px;
    max-height: min(520px, calc(100dvh - 70px));
    overflow: auto;
    border: 2px solid;
    border-color: #fff #000 #000 #fff;
    background: var(--chrome);
    padding: 8px;
    box-shadow: 2px 2px 0 rgba(0, 0, 0, .45);
}
.menu-sheet label { display: flex; align-items: center; justify-content: space-between; gap: 7px; }
.menu-sheet input:not([type="checkbox"]):not([type="range"]) { min-width: 0; width: 115px; }
.menu-sheet button, .menu-sheet a, .tool-buttons button {
    border: 2px solid;
    border-color: #fff #000 #000 #fff;
    background: var(--chrome);
    padding: 4px 7px;
    color: #000;
    text-align: center;
    text-decoration: none;
}
.menu-sheet button:active:not(:disabled) { border-color: #000 #fff #fff #000; }
.record-menu, .settings-menu { width: 250px; }
.tools-menu { width: 330px; right: 0; left: auto; }
.tool-buttons { display: flex; flex-wrap: wrap; gap: 4px; }
.replica-inspector pre { max-height: 180px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font: 10px monospace; }
.menu-spacer { flex: 1; }
.connection-lamp { padding: 0 6px; color: #800000; white-space: nowrap; }
.connection-lamp.online { color: #006000; }

.desktop-alert {
    position: absolute;
    z-index: 30;
    top: 56px;
    left: 8px;
    right: 8px;
    border: 2px solid;
    border-color: #fff #000 #000 #fff;
    background: #ffffcc;
    padding: 7px 10px;
    font-size: 12px;
}

.game-workspace {
    display: grid;
    grid-template-columns: minmax(0, 72fr) minmax(290px, 28fr);
    min-width: 0;
    min-height: 0;
    gap: 4px;
    padding: 4px;
    overflow: hidden;
    background: var(--desktop);
}

.terminal-window {
    position: relative;
    display: grid;
    grid-template-rows: 23px minmax(0, 1fr) 30px;
    min-width: 0;
    min-height: 0;
    border: 3px solid;
    border-color: #111 #eee #eee #111;
    background: var(--terminal-bg);
    color: var(--terminal-green);
    font-family: "NeoDunggeunmo Code", D2Coding, GulimChe, monospace;
    font-size: var(--terminal-font-size, 14px);
}
.terminal-caption {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
    border-bottom: 1px solid var(--terminal-faint);
    padding: 2px 8px;
    background: var(--terminal-panel);
    color: var(--terminal-dim);
    font-size: 11px;
    white-space: nowrap;
}
.terminal-caption strong { overflow: hidden; color: var(--terminal-green); text-overflow: ellipsis; }
.terminal-output {
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    padding: 8px 10px 18px;
    scrollbar-color: var(--terminal-dim) var(--terminal-bg);
}
.terminal-entry {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 8px;
    padding: 1px 0;
    line-height: 1.42;
}
.entry-prefix { color: var(--terminal-dim); }
.entry-text { min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.terminal-entry.command { color: var(--terminal-strong); }
.terminal-entry.command .entry-prefix { color: var(--terminal-strong); }
.terminal-entry.story, .terminal-entry.location { color: #92d9a0; }
.terminal-entry.combat { color: #a7daa5; }
.terminal-entry.reward { color: var(--terminal-amber); }
.terminal-entry.party { color: #73c9c9; }
.terminal-entry.error { color: var(--terminal-error); }
.terminal-entry.error .entry-prefix { color: #ff6450; }
.transcript-trimmed { color: var(--terminal-dim); text-align: center; }

.terminal-command {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr) 46px;
    align-items: center;
    gap: 6px;
    border-top: 1px solid var(--terminal-dim);
    background: var(--terminal-panel);
    padding: 3px 7px;
}
.terminal-command label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.terminal-command .prompt { color: var(--terminal-strong); white-space: nowrap; }
.terminal-command input {
    min-width: 0;
    height: 23px;
    border: 0;
    border-bottom: 1px solid var(--terminal-dim);
    outline: 0;
    background: #020603;
    padding: 1px 4px;
    color: var(--terminal-strong);
    caret-color: var(--terminal-strong);
    font: inherit;
}
.terminal-command input::placeholder { color: var(--terminal-faint); }
.terminal-command.shortcut-mode input { cursor: pointer; color: var(--terminal-dim); caret-color: transparent; }
.terminal-command.text-mode { border-top-color: var(--terminal-strong); box-shadow: inset 0 1px 0 var(--terminal-faint); }
.terminal-command button, .unseen-events {
    border: 1px solid var(--terminal-dim);
    background: #0b1b0d;
    padding: 2px 5px;
    color: var(--terminal-green);
    font: 12px "NeoDunggeunmo Code", monospace;
}
.terminal-command button:disabled { color: var(--terminal-faint); text-shadow: none; }
.command-suggestions {
    position: absolute;
    z-index: 12;
    right: 6px;
    bottom: 30px;
    left: 6px;
    display: grid;
    max-height: 215px;
    overflow: auto;
    border: 1px solid var(--terminal-green);
    background: #061008;
    box-shadow: 4px 4px 0 #000;
}
.command-suggestions button {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border: 0;
    border-bottom: 1px dotted var(--terminal-dim);
    background: transparent;
    padding: 5px 8px;
    color: var(--terminal-green);
    text-align: left;
}
.command-suggestions button:hover, .command-suggestions button:focus { background: var(--terminal-green); color: #020603; }
.command-suggestions span { color: var(--terminal-dim); }
.command-suggestions button:hover span, .command-suggestions button:focus span { color: #173d1d; }
.unseen-events { position: absolute; z-index: 10; right: 14px; bottom: 40px; padding: 5px 8px; }
.terminal-search-results {
    position: absolute;
    z-index: 11;
    top: 29px;
    right: 8px;
    width: min(560px, calc(100% - 16px));
    max-height: 55%;
    overflow: auto;
    border: 1px solid var(--terminal-amber);
    background: #0c0d06;
    padding: 6px;
    color: var(--terminal-amber);
    box-shadow: 5px 5px #000;
}
.terminal-search-results > div { display: flex; justify-content: space-between; border-bottom: 1px dashed #705b2b; }
.terminal-search-results button { border: 0; background: none; color: var(--terminal-amber); }
.terminal-search-results p { margin: 5px 0; white-space: pre-wrap; }

.auxiliary-dock {
    display: grid;
    grid-auto-rows: minmax(0, 1fr);
    min-width: 0;
    min-height: 0;
    gap: 4px;
}
.aux-window {
    display: grid;
    grid-template-rows: 22px 25px minmax(0, 1fr);
    min-width: 0;
    min-height: 0;
    border: 2px solid;
    border-color: #fff #000 #000 #fff;
    background: var(--chrome);
    font-size: 11px;
}
.aux-window > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 5px;
    margin: 2px;
    padding: 1px 3px 1px 5px;
    background: var(--title);
    color: #fff;
    font-weight: 700;
}
.aux-window > header button { display: grid; width: 17px; height: 16px; place-items: center; border: 2px solid; border-color: #fff #000 #000 #fff; background: var(--chrome); padding: 0; color: #000; line-height: 1; }
.aux-tabs { display: flex; align-items: end; padding: 1px 4px 0; border-bottom: 1px solid #808080; }
.aux-tabs button {
    min-width: 52px;
    height: 22px;
    margin-right: -1px;
    border: 2px solid;
    border-color: #fff #555 #808080 #fff;
    background: #aaa;
    padding: 1px 5px;
}
.aux-tabs button.selected { position: relative; z-index: 1; height: 24px; border-bottom-color: var(--chrome); background: var(--chrome); font-weight: 700; }
.aux-content { min-height: 0; overflow: auto; padding: 5px; }
.identity-line, .aux-list-item > div, .skill-row > div, .item-row > div, .quest-pane { display: grid; gap: 2px; }
.identity-line { grid-template-columns: 1fr auto; align-items: center; border-bottom: 1px solid #808080; padding-bottom: 4px; }
.identity-line span, .aux-list-item span, .skill-row span, .item-row span, .quest-pane span, .quest-pane small { color: #4b4b4b; }
.meter-row { display: grid; grid-template-columns: 18px minmax(0, 1fr) max-content; align-items: center; gap: 4px; margin: 4px 0; }
.meter-row progress { width: 100%; height: 11px; border: 1px solid #555; accent-color: #aa2525; }
.meter-row.energy progress { accent-color: #b28b20; }
.meter-row strong { font-size: 10px; }
.compact-row { display: flex; justify-content: space-between; gap: 5px; margin: 4px 0; border-bottom: 1px dotted #888; }
.info-lines { display: grid; grid-template-columns: 76px 1fr; gap: 2px 4px; margin-top: 4px; }
.info-lines strong { grid-row: 1 / span 20; }
.aux-list-item, .skill-row, .item-row { margin-bottom: 4px; border: 1px solid #808080; background: #d4d4d4; padding: 4px; }
.selectable-entity { cursor: pointer; }
.selectable-entity:hover, .selectable-entity:focus-visible { border-color: #000080; background: #e4e4ff; outline: 1px dotted #000; }
.selectable-entity.selected { border: 2px solid #000080; background: #c9d3ff; padding: 3px; }
.disabled-item { color: #777; }
.skill-row, .item-row { display: grid; grid-template-columns: minmax(0, 1fr) max-content; gap: 4px; }
.skill-library-row.active-skill { border-left: 4px solid #000080; }
.skill-slot-editor { display: grid !important; grid-template-columns: 40px repeat(4, 24px); align-content: center; gap: 2px; }
.skill-slot-editor button { min-width: 24px; padding-inline: 0; }
.skill-slot-editor button.assigned { border-color: #000 #fff #fff #000; background: #fff1a8; color: #000080; font-weight: 700; }
.skill-row button, .item-row button, .loading-copy button {
    border: 2px solid;
    border-color: #fff #000 #000 #fff;
    background: var(--chrome);
    padding: 2px 6px;
    font-size: 10px;
}
.skill-row button:active:not(:disabled), .item-row button:active:not(:disabled) { border-color: #000 #fff #fff #000; }
.mini-map { display: grid; gap: 4px; align-content: start; min-width: 0; }
.map-graph { display: block; width: 100%; min-width: 420px; height: auto; border: 2px inset #fff; background: #f4f4ef; color-scheme: light; }
.map-edge { stroke: #505b5d; stroke-width: 3; }
.map-edge.locked { stroke: #8a5c5c; stroke-dasharray: 8 6; }
.map-compass text { fill: #596164 !important; font: 700 11px "GalmuriMono11", monospace; }
.map-node.reachable rect { fill: #d8e4dd !important; stroke: #304a43; stroke-width: 2; }
.map-node.current rect { fill: #fff1a8 !important; stroke: #6b5211; stroke-width: 3; }
.map-node.locked rect { fill: #d2c7c7 !important; stroke: #784c4c; stroke-dasharray: 5 3; }
.map-node text { pointer-events: none; font-family: "GalmuriMono11", monospace; fill: #111 !important; }
.map-node .map-node-hop { fill: #3a3a3a !important; }
.map-node.actionable { cursor: pointer; }
.map-node.actionable:hover rect, .map-node.actionable:focus rect { stroke: #0057a8; stroke-width: 4; }
.map-node.actionable:focus { outline: none; }
.map-node-name { font-size: 12px; font-weight: 700; }
.map-node-hop { font-size: 9px; }
.map-legend { display: flex; flex-wrap: wrap; gap: 8px; color: #444; font-size: 10px; }
.map-legend span { display: inline-flex; align-items: center; gap: 3px; }
.map-legend i { width: 11px; height: 8px; border: 1px solid #304a43; background: #d8e4dd; }
.map-legend i.current { border-color: #6b5211; background: #fff1a8; }
.map-legend i.locked { border-color: #784c4c; background: #d2c7c7; }
.map-help { color: #444; }
.ground-loot-title { margin: 8px 0 4px; border-bottom: 1px solid #808080; }
.ground-loot span { overflow-wrap: anywhere; }
.quest-pane p { margin: 3px 0; }
.quest-pane progress { width: 100%; height: 13px; }
.empty-state { margin: 8px 3px; color: #555; }
.connection-window { grid-template-rows: 22px minmax(0, 1fr); }
.loading-copy { display: grid; gap: 8px; place-content: center; text-align: center; }

.action-hud {
    position: relative;
    z-index: 15;
    display: grid;
    grid-template-columns: max-content minmax(160px, .7fr) minmax(420px, 1.8fr) minmax(220px, .8fr) max-content;
    align-items: stretch;
    gap: 4px;
    min-width: 0;
    border-top: 1px solid #fff;
    padding: 4px 5px;
    background: var(--chrome);
}
.action-hud button {
    min-width: 0;
    overflow: hidden;
    border: 2px solid;
    border-color: #fff #000 #000 #fff;
    background: var(--chrome);
    padding: 3px 5px;
    text-overflow: ellipsis;
    font-size: 11px;
}
.action-hud button:active:not(:disabled), .action-hud button.selected { border-color: #000 #fff #fff #000; }
.action-hud kbd { border: 1px solid #777; background: #e2e2e2; padding: 0 3px; color: #000; font: 10px monospace; }
.hud-system-actions { display: grid; grid-template-columns: repeat(2, minmax(42px, 1fr)); gap: 3px; }
.hud-system-actions button, .interaction-action, .movement-actions button { display: grid; place-content: center; gap: 3px; text-align: center; }
.hud-targets { display: flex; flex-wrap: wrap; align-content: center; gap: 2px; min-width: 0; overflow: auto; border: 1px inset #fff; padding: 3px; background: #b5b5b5; }
.selected-target-label { flex: 1 0 100%; overflow: hidden; color: #000080; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.hud-targets button { display: flex; align-items: center; gap: 3px; max-width: 110px; height: 25px; padding: 2px 4px; white-space: nowrap; }
.hud-targets button span { overflow: hidden; text-overflow: ellipsis; }
.hud-skills { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; min-width: 0; }
.skill-action { position: relative; display: grid; grid-template-columns: max-content minmax(0, 1fr); grid-template-rows: 1fr 1fr; align-items: center; gap: 1px 5px; text-align: left; }
.skill-action kbd { grid-row: 1 / span 2; font-size: 14px; font-weight: 700; }
.skill-action strong, .skill-action span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.skill-action span { color: #444; font-size: 9px; }
.skill-action i { position: absolute; right: 3px; bottom: 3px; border: 1px solid #806000; background: #fff1a8; padding: 1px 3px; color: #5d4200; font: 700 9px monospace; }
.skill-action.empty { color: #666; }
.hud-context-actions { position: relative; display: grid; grid-template-columns: minmax(80px, 1fr) minmax(120px, 1.4fr); gap: 3px; }
.movement-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; }
.movement-actions button { padding-inline: 2px; }
.interaction-menu { position: absolute; z-index: 20; right: 0; bottom: calc(100% + 4px); display: grid; min-width: 190px; border: 2px solid; border-color: #fff #000 #000 #fff; background: var(--chrome); padding: 4px; box-shadow: 2px 2px #333; }
.interaction-menu button { text-align: left; }
.action-hud.loading { display: flex; align-items: center; }
.mobile-aux-toggle { display: none; margin-left: auto; }

.window-statusbar {
    display: grid;
    grid-template-columns: 1.4fr 1fr max-content;
    gap: 3px;
    padding: 2px 4px;
    border-top: 1px solid #808080;
    background: var(--chrome);
    font-size: 10px;
}
.window-statusbar span { min-width: 0; overflow: hidden; border: 1px solid; border-color: #808080 #fff #fff #808080; padding: 2px 5px; text-overflow: ellipsis; white-space: nowrap; }

.character-creation {
    position: absolute;
    z-index: 200;
    inset: 0;
    display: grid;
    overflow: auto;
    padding: clamp(12px, 4vw, 48px);
    place-items: center;
    background: #10182aee;
}
.creation-window {
    width: min(980px, 100%);
    border: 3px solid;
    border-color: #fff #202020 #202020 #fff;
    padding: 4px;
    background: var(--chrome);
    box-shadow: 12px 14px 0 #0008;
}
.creation-window > header { padding: 12px 16px; background: var(--title); color: #fff; }
.creation-window > header span { float: right; color: #bfc9ff; font: 12px "NeoDunggeunmo Code", monospace; }
.creation-window h2 { margin: 0 0 5px; font-size: 24px; }
.creation-window header p, .creation-roll p { margin: 0; font-size: 13px; }
.creation-columns { display: grid; grid-template-columns: .8fr 1.2fr; gap: 8px; padding: 10px; }
.creation-columns fieldset { min-width: 0; margin: 0; border: 2px groove #fff; padding: 8px; }
.creation-columns legend { padding: 0 6px; font-weight: 700; }
.creation-cards { display: grid; gap: 6px; }
.creation-card {
    display: grid;
    gap: 3px;
    width: 100%;
    border: 2px solid;
    border-color: #fff #404040 #404040 #fff;
    padding: 8px 10px;
    background: #d5d5d5;
    text-align: left;
    cursor: pointer;
}
.creation-card:hover, .creation-card.selected { background: #e9e9ff; }
.creation-card.selected { border-color: #000 #fff #fff #000; outline: 2px solid var(--title); outline-offset: -5px; }
.creation-card strong { color: var(--title); font-size: 16px; }
.creation-card span { font-weight: 700; }
.creation-card small { color: #414141; }
.creation-roll { display: grid; grid-template-columns: 1fr max-content max-content; align-items: center; gap: 12px; margin: 0 10px 10px; border: 2px groove #fff; padding: 10px; }
.creation-roll h3 { margin: 0 0 3px; font-size: 15px; }
.creation-roll button, .confirm-character {
    border: 2px solid;
    border-color: #fff #000 #000 #fff;
    padding: 9px 14px;
    background: var(--chrome);
    font-weight: 700;
}
.creation-roll output { min-width: 205px; border: 1px inset #fff; padding: 9px; background: #fff; font-weight: 700; text-align: center; }
.creation-window > footer { display: flex; align-items: center; gap: 12px; border-top: 1px solid #888; padding: 10px; }
.creation-summary { display: grid; gap: 3px; margin-right: auto; }
.creation-summary span { color: #555; font-size: 12px; }
.creation-summary strong { font-size: 16px; }
.confirm-character:not(:disabled) { background: var(--title); color: #fff; cursor: pointer; }
.creation-error { margin: 0 10px 10px; border: 1px solid #8a0000; padding: 8px; background: #fff0ec; color: #8a0000; }

@media (max-width: 1099px) {
    .game-workspace { grid-template-columns: minmax(0, 65fr) minmax(260px, 35fr); }
    .terminal-caption span { display: none; }
    .action-hud { grid-template-columns: max-content minmax(130px, .6fr) minmax(360px, 1.7fr) minmax(170px, .7fr); }
    .action-hud > .mobile-aux-toggle { display: none; }
    .movement-actions button span { display: none; }
}

@media (max-width: 760px) {
    .character-creation { display: block; padding: 8px; }
    .creation-window { margin: 0 auto; box-shadow: none; }
    .creation-columns { grid-template-columns: 1fr; }
    .class-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .creation-roll { grid-template-columns: 1fr 1fr; }
    .creation-roll > div { grid-column: 1 / -1; }
    .creation-roll output { min-width: 0; }
    .creation-window > footer { align-items: stretch; flex-direction: column; }
    .confirm-character { min-height: 44px; }
    .game-shell { min-height: 440px; grid-template-rows: 25px 28px minmax(0, 1fr) 142px 23px; }
    .window-mode, .window-controls, .connection-lamp { display: none; }
    .window-menu { overflow: visible; }
    .window-menu > button, .window-menu summary { padding-inline: 6px; }
    .tools-menu { right: auto; left: -150px; }
    .game-workspace { display: block; min-height: 0; padding: 3px; }
    .terminal-window { width: 100%; height: 100%; }
    .auxiliary-dock { display: none; width: 100%; height: 100%; }
    .game-workspace.mobile-stack-1 .terminal-window,
    .game-workspace.mobile-stack-2 .terminal-window,
    .game-workspace.mobile-stack-3 .terminal-window { display: none; }
    .game-workspace.mobile-stack-1 .auxiliary-dock,
    .game-workspace.mobile-stack-2 .auxiliary-dock,
    .game-workspace.mobile-stack-3 .auxiliary-dock { display: block; }
    .game-workspace.mobile-stack-1 .aux-window:not(.top-dock),
    .game-workspace.mobile-stack-2 .aux-window:not(.middle-dock),
    .game-workspace.mobile-stack-3 .aux-window:not(.bottom-dock) { display: none; }
    .aux-window { width: 100%; height: 100%; }
    .connection-window { display: grid !important; }
    .action-hud { grid-template-columns: 90px minmax(0, 1fr) 108px; grid-template-rows: minmax(0, 1fr) 34px; grid-template-areas: "system skills context" "targets targets auxiliary"; gap: 3px; padding: 3px; }
    .hud-system-actions { grid-area: system; grid-template-columns: 1fr; }
    .hud-skills { grid-area: skills; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); }
    .hud-context-actions { grid-area: context; grid-template-columns: 1fr; }
    .hud-targets { grid-area: targets; flex-wrap: nowrap; align-items: center; overflow-x: auto; }
    .selected-target-label { flex: 0 0 90px; }
    .hud-targets button { flex: 0 0 auto; height: 25px; }
    .movement-actions { grid-template-columns: repeat(4, 1fr); }
    .movement-actions button { min-height: 25px; }
    .movement-actions button span { display: none; }
    .action-hud > .mobile-aux-toggle { display: block; grid-area: auxiliary; min-height: 30px; }
    .mobile-aux-toggle { display: block; }
    .window-statusbar { grid-template-columns: 1fr max-content; }
    .window-statusbar span:nth-child(2) { display: none; }
    .terminal-command { grid-template-columns: max-content minmax(0, 1fr); }
    .terminal-command button { display: none; }
    .terminal-entry { grid-template-columns: 1fr; gap: 0; margin-bottom: 3px; }
    .entry-prefix { font-size: 11px; }
}

@media (max-width: 430px) {
    .class-cards { grid-template-columns: 1fr; }
    .creation-roll { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
    .window-titlebar h1 { max-width: calc(100vw - 42px); }
    .menu-sheet { position: fixed; top: 52px; right: 4px; left: 4px; width: auto; }
    .tools-menu { left: 4px; }
    .terminal-caption { font-size: 10px; }
    .terminal-output { padding-inline: 6px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; }
}
