﻿/* Chat shell terminal theme */
body.chat-shell .chat-container {
    position: relative;
    z-index: 2;
    padding: 20px;
    align-items: stretch;
    justify-content: center;
    background: transparent;
}

body.chat-shell .terminal-frame {
    width: min(1680px, 100%);
    height: calc(100vh - 40px);
    background: linear-gradient(180deg, rgba(44, 31, 18, 0.98) 0%, rgba(14, 9, 6, 0.98) 100%);
    border: 1px solid rgba(255, 190, 92, 0.22);
    border-radius: 18px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.75), inset 0 0 0 1px rgba(255, 231, 186, 0.04), inset 0 0 60px rgba(255, 124, 0, 0.08);
    overflow: hidden;
    position: relative;
}

body.chat-shell .terminal-frame::before {
    content: "";
    position: absolute;
    inset: 14px;
    border-radius: 12px;
    box-shadow: inset 0 0 50px rgba(255, 116, 0, 0.08), inset 0 0 140px rgba(0, 0, 0, 0.65);
    pointer-events: none;
    z-index: 0;
}

body.chat-shell .chat-main {
    position: relative;
    z-index: 1;
    grid-template-columns: minmax(0, 1fr) 320px;
    grid-template-rows: 1fr auto;
    height: calc(100% - 52px);
    background: transparent;
}

body.chat-shell .chat-window {
    padding: 28px 38px 160px;
    background: radial-gradient(circle at 50% 45%, rgba(255, 144, 0, 0.06), transparent 38%), linear-gradient(180deg, rgba(9, 6, 4, 0.96) 0%, rgba(14, 8, 5, 0.98) 100%);
    align-items: stretch;
    font-size: 24px;
    color: #ffad33;
    text-shadow: 0 0 7px rgba(255, 153, 0, 0.26);
}

body.chat-shell .chat-window::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 16%, transparent 84%, rgba(255, 255, 255, 0.02)), radial-gradient(circle at center, transparent 60%, rgba(0, 0, 0, 0.2));
    pointer-events: none;
}

body.chat-shell .message {
    width: 100%;
}

body.chat-shell .message-text {
    position: relative;
    padding: 0;
    margin: 0 0 26px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    max-width: 100%;
    width: 100%;
    color: #ffad33;
    font-size: clamp(24px, 2.1vw, 34px);
    line-height: 1.18;
    letter-spacing: 0.02em;
}

body.chat-shell .game-message .message-text::before,
body.chat-shell .user-message .message-text::before {
    display: inline-block;
    margin-right: 12px;
    color: rgba(255, 205, 132, 0.88);
}

body.chat-shell .game-message .message-text::before {
    content: ">";
}

body.chat-shell .user-message .message-text {
    color: #ffe0a3;
    padding-left: 68px;
}

body.chat-shell .user-message .message-text::before {
    content: "cmd>";
    position: absolute;
    left: 0;
}

body.chat-shell .user-message .message-text:hover,
body.chat-shell .game-message .message-text:hover {
    background: transparent;
    transform: none;
    box-shadow: none;
}

body.chat-shell .generated-scene-image {
    border-radius: 0;
    border: 1px solid rgba(255, 189, 96, 0.22);
    box-shadow: 0 0 24px rgba(255, 145, 0, 0.16);
}

body.chat-shell .stats-sidebar {
    padding: 18px 16px 18px 18px;
    background: linear-gradient(180deg, rgba(23, 16, 10, 0.98) 0%, rgba(10, 7, 5, 0.98) 100%);
    border-left: 1px solid rgba(255, 173, 51, 0.24);
    border-radius: 0;
    box-shadow: inset 18px 0 24px rgba(0, 0, 0, 0.22);
    min-width: 0;
    height: 100%;
    overflow-y: auto;
}

body.chat-shell .stats-header {
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 184, 92, 0.18);
}

body.chat-shell .stats-heading {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

body.chat-shell .stats-heading-main {
    font-family: "Press Start 2P", "VT323", monospace;
    font-size: 12px;
    color: #ffd37a;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

body.chat-shell .stats-heading-sub {
    font-size: 26px;
    color: rgba(255, 201, 120, 0.86);
}

body.chat-shell .stats-heading-location {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 100%;
    margin-top: 4px;
    padding: 6px 10px;
    border: 1px solid rgba(255, 184, 92, 0.2);
    background:
        linear-gradient(90deg, rgba(255, 166, 77, 0.16), rgba(255, 184, 92, 0.05)),
        rgba(20, 11, 4, 0.7);
    color: rgba(255, 220, 163, 0.92);
    font-family: "Press Start 2P", "VT323", monospace;
    font-size: 10px;
    letter-spacing: 0.04em;
    line-height: 1.5;
    text-transform: uppercase;
    box-shadow: inset 0 0 0 1px rgba(255, 214, 153, 0.04);
    box-sizing: border-box;
}

body.chat-shell .stats-heading-location-label {
    flex: 0 0 auto;
    color: rgba(255, 179, 92, 0.7);
}

body.chat-shell .stats-heading-location-value {
    flex: 1 1 auto;
    min-width: 0;
    text-align: center;
    overflow-wrap: break-word;
    word-break: normal;
}

body.chat-shell .stats-heading-location.is-empty {
    opacity: 0.72;
}

body.chat-shell .stats-summary,
body.chat-shell #inventory,
body.chat-shell #clothing,
body.chat-shell #vehicle-panel {
    background: rgba(255, 136, 0, 0.04);
    border: 1px solid rgba(255, 173, 51, 0.12);
    border-radius: 10px;
    padding: 12px;
}

body.chat-shell .stats-summary {
    gap: 10px;
    margin-bottom: 12px;
}

body.chat-shell .stats-portrait-image {
    width: 100%;
    max-width: 164px;
    height: auto;
    aspect-ratio: 1;
    border-radius: 4px;
    border-color: rgba(255, 184, 92, 0.2);
    box-shadow: 0 0 18px rgba(255, 138, 0, 0.14);
}

body.chat-shell .stat-row {
    align-items: flex-start;
    font-size: 24px;
    color: #ffad33;
}

body.chat-shell .stat-label {
    color: var(--terminal-sidebar-label);
}

body.chat-shell .stat-value {
    color: var(--terminal-sidebar-value);
}

body.chat-shell .inventory-section-label {
    color: var(--terminal-sidebar-label);
    font-size: 20px;
}

body.chat-shell .inventory-count-badge {
    color: var(--terminal-amber);
    background: color-mix(in srgb, var(--terminal-amber) 8%, transparent);
    border-color: color-mix(in srgb, var(--terminal-amber) 18%, transparent);
    border-radius: 4px;
}

body.chat-shell .inventory-list {
    padding-left: 0;
    gap: 10px;
}

body.chat-shell .inventory-item {
    padding: 0 0 2px 14px;
    color: var(--terminal-sidebar-value);
    font-size: 22px;
}

body.chat-shell .inventory-item::before {
    content: ">";
    position: absolute;
    left: 0;
    color: var(--terminal-sidebar-label);
}

body.chat-shell .inventory-item .item-qty,
body.chat-shell .inventory-item .item-creature-meta,
body.chat-shell .inventory-item .creature-ability {
    color: var(--terminal-sidebar-meta);
}

body.chat-shell .inventory-item .item-info,
body.chat-shell .inventory-item .ability-info {
    background: rgba(7, 6, 5, 0.98);
    border: 1px solid color-mix(in srgb, var(--terminal-amber) 20%, transparent);
    color: var(--terminal-sidebar-value);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}

body.chat-shell .chat-input {
    padding: 18px 24px 24px;
    background: linear-gradient(180deg, rgba(17, 11, 7, 0.94) 0%, rgba(12, 8, 5, 0.98) 100%);
    border-top: 1px solid rgba(255, 179, 73, 0.15);
    height: auto;
}

body.chat-shell .chat-input form {
    max-width: none;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) repeat(5, auto);
    gap: 10px;
    align-items: center;
}

body.chat-shell .chat-input input[type="text"] {
    padding: 14px 16px;
    margin-right: 0;
    border: 1px solid rgba(255, 173, 51, 0.22);
    border-radius: 8px;
    font-size: 28px;
    background: rgba(0, 0, 0, 0.45);
    color: #ffd37a;
    text-align: left;
    caret-color: #ffad33;
    box-shadow: inset 0 0 12px rgba(255, 145, 0, 0.06);
}

body.chat-shell .chat-input input[type="text"]:focus {
    background: rgba(0, 0, 0, 0.6);
    box-shadow: inset 0 0 16px rgba(255, 145, 0, 0.08), 0 0 0 1px rgba(255, 173, 51, 0.14);
}

body.chat-shell .chat-input input[type="text"]::placeholder {
    color: rgba(255, 196, 112, 0.42);
    text-align: left;
}

body.chat-shell .chat-input button,
body.chat-shell #settings-panel button,
body.chat-shell #help-panel button,
body.chat-shell #settings-panel select,
body.chat-shell #settings-panel input[type="range"] {
    border-radius: 8px;
}

body.chat-shell .chat-input button {
    padding: 12px 14px;
    margin-left: 0;
    border: 1px solid rgba(255, 173, 51, 0.18);
    background: linear-gradient(180deg, rgba(70, 42, 14, 0.95) 0%, rgba(30, 17, 7, 0.98) 100%);
    color: #ffd37a;
    font-size: 19px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

body.chat-shell .chat-input button:hover {
    background: linear-gradient(180deg, rgba(92, 54, 15, 0.98) 0%, rgba(40, 23, 9, 1) 100%);
    transform: translateY(-1px);
}

body.chat-shell .undo-button,
body.chat-shell #settings-btn {
    background: linear-gradient(180deg, rgba(62, 38, 16, 0.96) 0%, rgba(24, 15, 6, 1) 100%);
}

body.chat-shell #turn-changes,
body.chat-shell #message-turn-changes {
    background: #000;
    border: 1px solid var(--terminal-border);
    color: color-mix(in srgb, var(--terminal-amber-soft) 72%, white);
    border-radius: 0;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.52);
    text-shadow: none;
}

body.chat-shell .stats-sidebar .ui-emoji,
body.chat-shell .stats-sidebar .item-emoji,
body.chat-shell .stats-sidebar .pixel-emoji-image,
body.chat-shell #turn-changes .ui-emoji,
body.chat-shell #turn-changes .item-emoji,
body.chat-shell #turn-changes .pixel-emoji-image,
body.chat-shell #message-turn-changes .ui-emoji,
body.chat-shell #message-turn-changes .item-emoji,
body.chat-shell #message-turn-changes .pixel-emoji-image {
    filter: var(--theme-emoji-filter);
}

body.chat-shell #settings-modal,
body.chat-shell #help-modal {
    background: transparent;
}

body.chat-shell #settings-panel,
body.chat-shell #help-panel {
    background: linear-gradient(180deg, var(--terminal-modal-bg-top) 0%, var(--terminal-modal-bg-bottom) 100%);
    border: 1px solid var(--terminal-border);
    color: var(--terminal-modal-text);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
    width: min(1020px, 96vw);
    max-width: 92vw;
    padding: 44px 34px 32px;
    gap: 22px;
    position: relative;
    max-height: min(88vh, 960px);
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

body.chat-shell #help-panel {
    width: min(960px, 94vw);
    position: relative;
    padding: 18px 42px 38px;
    gap: 28px;
}

body.chat-shell .modal-close,
body.chat-shell #settings-close,
body.chat-shell #help-close {
    position: absolute;
    top: 0;
    right: 26px;
}

body.chat-shell #settings-panel select,
body.chat-shell .font-selector select {
    border: 1px solid color-mix(in srgb, var(--terminal-border) 82%, transparent);
    background: var(--terminal-modal-control-bg);
    color: var(--terminal-modal-text);
    color-scheme: dark;
}

body.chat-shell .settings-section {
    display: grid;
    grid-template-columns: 170px 180px minmax(180px, 1fr) minmax(140px, 220px);
    align-items: center;
    gap: 18px 14px;
    margin-top: 0;
}

body.chat-shell .settings-section span {
    white-space: nowrap;
    font-size: 22px;
    line-height: 1.3;
}

body.chat-shell .settings-button-row--sfx {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    padding-inline: 0;
    width: 100%;
}

body.chat-shell #settings-panel .settings-button-row--sfx button {
    min-width: 0;
    width: 100%;
    min-height: 58px;
    font-size: 11px;
    padding-inline: 10px;
}

body.chat-shell #settings-panel button,
body.chat-shell #settings-panel select,
body.chat-shell #settings-panel input[type="range"] {
    flex: 0 0 auto;
}

body.chat-shell #settings-panel button:not(#settings-close) {
    width: auto;
    min-width: 180px;
    min-height: 58px;
    font-size: 13px;
    border: 1px solid color-mix(in srgb, var(--terminal-border) 82%, transparent);
    background: var(--terminal-modal-button-bg);
    color: var(--terminal-modal-text);
    box-shadow: inset 0 1px 0 color-mix(in srgb, var(--terminal-amber-soft) 10%, transparent);
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

body.chat-shell #settings-panel button:not(#settings-close):hover {
    background: var(--terminal-modal-button-bg-hover);
    border-color: color-mix(in srgb, var(--terminal-amber) 45%, transparent);
    transform: translateY(-1px);
}

body.chat-shell #settings-panel button:not(#settings-close).toggled {
    background: var(--terminal-modal-button-active-bg);
    border-color: color-mix(in srgb, var(--terminal-amber) 65%, transparent);
    color: var(--terminal-modal-heading);
    box-shadow: inset 0 1px 0 color-mix(in srgb, var(--terminal-amber-soft) 28%, transparent);
}

body.chat-shell #settings-panel button#settings-home-btn,
body.chat-shell #settings-panel button#settings-fullscreen-btn {
    justify-self: start;
}

body.chat-shell #settings-panel select {
    width: 100%;
    min-width: 0;
    min-height: 58px;
    font-size: 15px;
    text-align: center;
    text-align-last: center;
}

body.chat-shell #settings-panel select option,
body.chat-shell #settings-panel select optgroup {
    background: #2f2f2f;
    color: var(--terminal-modal-text);
}

body.chat-shell #settings-panel select option:checked,
body.chat-shell #settings-panel select option:hover {
    background: #3a3a3a;
    color: var(--terminal-modal-text);
    box-shadow: inset 0 0 0 9999px #3a3a3a;
}

body.chat-shell #settings-panel input[type="range"] {
    width: 100%;
    min-width: 0;
    transform: none;
}

body.chat-shell .font-selector {
    display: grid;
    grid-template-columns: 170px minmax(0, 1fr);
    align-items: center;
    gap: 18px 14px;
}

body.chat-shell .font-selector select {
    width: 100%;
    text-align: center;
    text-align-last: center;
}

body.chat-shell .modal-close,
body.chat-shell #settings-close,
body.chat-shell #help-close {
    min-width: 60px;
    width: 60px;
    min-height: 60px;
    border: 0;
    background: transparent;
    color: var(--terminal-modal-text);
    box-shadow: none;
    justify-self: end;
    font-size: 38px;
    line-height: 1;
    padding: 0;
}

body.chat-shell .help-section {
    display: grid;
    grid-template-columns: 285px minmax(0, 1fr);
    gap: 15px 27px;
    align-items: start;
}

body.chat-shell .help-section span {
    font-size: 33px;
    line-height: 1.3;
}

body.chat-shell .help-heading {
    font-size: 38px;
    color: var(--terminal-modal-heading);
}

body.chat-shell .settings-section:has(#sfx-typing-toggle),
body.chat-shell .settings-section:has(#sfx-pack-select),
body.chat-shell .settings-section:has(#story-model-select),
body.chat-shell .settings-section:has(#theme-hue-slider),
body.chat-shell .settings-section:has(#theme-brightness-slider),
body.chat-shell .settings-section:has(#settings-home-btn) {
    grid-template-columns: 170px minmax(0, 1fr);
}

@media (max-width: 768px) {
    body.chat-shell #settings-modal,
    body.chat-shell #help-modal {
        align-items: flex-start;
        overflow-y: auto;
        padding: 12px 0;
    }

    body.chat-shell #settings-panel {
        width: min(92vw, 520px);
        padding: 16px;
        max-height: calc(100dvh - 24px);
    }

    body.chat-shell #help-panel {
        max-height: calc(100dvh - 24px);
    }

    body.chat-shell .settings-section,
    body.chat-shell .font-selector,
    body.chat-shell .settings-section:has(#sfx-typing-toggle),
    body.chat-shell .settings-section:has(#sfx-pack-select),
    body.chat-shell .settings-section:has(#story-model-select),
    body.chat-shell .settings-section:has(#theme-hue-slider),
    body.chat-shell .settings-section:has(#theme-brightness-slider),
    body.chat-shell .settings-section:has(#settings-home-btn) {
        grid-template-columns: 1fr;
    }

    body.chat-shell .settings-button-row--sfx {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body.chat-shell #settings-panel button,
    body.chat-shell #settings-panel select,
    body.chat-shell #settings-panel input[type="range"] {
        width: 100%;
    }
}

@media (max-width: 1200px) {
    body.chat-shell .chat-main {
        grid-template-columns: minmax(0, 1fr) 280px;
    }

    body.chat-shell .chat-input form {
        grid-template-columns: auto minmax(0, 1fr) repeat(3, auto);
    }
}

@media (max-width: 768px) {
    body.chat-shell {
        overflow: auto;
    }

    body.chat-shell .chat-container {
        padding: 0;
    }

    body.chat-shell .terminal-frame {
        height: 100vh;
        border-radius: 0;
    }

    body.chat-shell .chat-main {
        grid-template-columns: 1fr;
    }

    body.chat-shell .chat-window {
        padding: 18px 16px 150px;
    }

    body.chat-shell .message-text {
        font-size: 24px;
    }

    body.chat-shell .chat-input {
        padding: 14px 12px 18px;
    }

    body.chat-shell .chat-input form {
        grid-template-columns: 1fr;
    }

    body.chat-shell .chat-input button {
        width: 100%;
    }

    body.chat-shell .stats-sidebar {
        z-index: 3300;
        width: min(92vw, 320px);
        height: 100vh;
        border-left: 1px solid rgba(255, 173, 51, 0.24);
    }

    body.chat-shell .stats-flex {
        flex-direction: column;
    }

    body.chat-shell #inventory,
    body.chat-shell #currency {
        width: 100%;
    }

    body.chat-shell #stats-btn {
        display: inline-flex;
    }
}

/* Chat shell terminal theme v2: flatter and closer to a classic terminal */
body.chat-shell {
    --ui-pixel-font: "Press Start 2P", "Courier New", monospace;
    --terminal-font: "VT323", "Courier New", monospace;
    --terminal-amber: #f59b2f;
    --terminal-amber-soft: #ffb24a;
    --terminal-bg: #140a04;
    --terminal-bg-2: #090402;
    --terminal-line: rgba(245, 155, 47, 0.16);
    --terminal-line-soft: rgba(245, 155, 47, 0.08);
    --chat-font: var(--terminal-font);
    --shared-terminal-bg:
        radial-gradient(circle at center, rgba(95, 35, 0, 0.15) 0%, transparent 56%),
        linear-gradient(180deg, #120802 0%, #090402 100%);
    background: var(--shared-terminal-bg);
}

body.chat-shell * {
    scrollbar-color: rgba(245, 155, 47, 0.35) transparent;
}

body.chat-shell .chat-container {
    padding: 6px;
}

body.chat-shell .terminal-frame {
    height: calc(100vh - 12px);
    border-radius: 8px;
    border: 1px solid #27211c;
    background: linear-gradient(180deg, #2a2a2a 0%, #171717 100%);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.03), 0 18px 50px rgba(0, 0, 0, 0.7);
}

body.chat-shell .terminal-frame::before {
    inset: 18px 14px 14px;
    border-radius: 4px;
    box-shadow: inset 0 0 24px rgba(255, 148, 0, 0.12), inset 0 0 90px rgba(0, 0, 0, 0.8);
}

body.chat-shell .chat-main {
    grid-template-columns: minmax(0, 1fr) 300px;
    height: calc(100% - 32px);
    background: #0b0502;
    transform-origin: center 84px;
    transform: perspective(700px) rotateX(0.78deg) scale(1.02, 1.028);
    animation: terminalSurfaceDrift 6.5s ease-in-out infinite;
}

body.chat-shell .chat-window,
body.chat-shell .stats-sidebar,
body.chat-shell .chat-input {
    position: relative;
}

body.chat-shell .chat-window {
    padding: 24px 26px 110px;
    background:
        radial-gradient(circle at center, rgba(95, 35, 0, 0.18) 0%, transparent 58%),
        linear-gradient(180deg, var(--terminal-bg) 0%, var(--terminal-bg-2) 100%);
    font-family: var(--chat-font);
    font-variant-ligatures: none;
    font-feature-settings: "liga" 0, "calt" 0;
    font-size: 27px;
    line-height: 1.02;
    text-shadow: 0 0 4px rgba(245, 155, 47, 0.35);
}

body.chat-shell .chat-window::before {
    background:
        repeating-linear-gradient(
            to bottom,
            rgba(255, 194, 120, 0.06) 0,
            rgba(255, 194, 120, 0.06) 1px,
            rgba(0, 0, 0, 0.035) 1px,
            rgba(0, 0, 0, 0.035) 2px,
            transparent 2px,
            transparent 4px
        );
    opacity: 0.7;
}

body.chat-shell .chat-window::after {
    content: "";
    position: absolute;
    inset: -18%;
    pointer-events: none;
    background:
        radial-gradient(circle at 14% 18%, rgba(255, 228, 188, 0.05) 0 0.9px, transparent 1.4px),
        radial-gradient(circle at 72% 26%, rgba(255, 216, 164, 0.045) 0 1.1px, transparent 1.7px),
        radial-gradient(circle at 34% 78%, rgba(255, 233, 198, 0.04) 0 0.8px, transparent 1.3px),
        radial-gradient(circle at 84% 68%, rgba(255, 207, 142, 0.04) 0 1px, transparent 1.5px),
        radial-gradient(circle at 58% 52%, rgba(255, 221, 178, 0.035) 0 0.9px, transparent 1.4px),
        radial-gradient(circle at 22% 58%, rgba(255, 198, 126, 0.03) 0 1.2px, transparent 1.8px);
    background-size: 180px 140px, 220px 170px, 160px 150px, 240px 200px, 200px 160px, 260px 220px;
    background-repeat: repeat;
    mix-blend-mode: screen;
    opacity: 0.14;
    will-change: transform;
    transform: translate3d(0, 0, 0);
    animation: terminal-grain-drift 22s linear infinite;
}

body.chat-shell .message-text {
    font-family: var(--chat-font);
    font-variant-ligatures: none;
    font-feature-settings: "liga" 0, "calt" 0;
    color: var(--terminal-amber);
    font-size: clamp(26px, 1.75vw, 34px);
    line-height: 1.03;
    letter-spacing: 0;
    margin: 0 0 18px;
}

@keyframes terminal-grain-drift {
    0% {
        transform: translate3d(0, 0, 0);
    }
    25% {
        transform: translate3d(-1.2%, 0.8%, 0);
    }
    50% {
        transform: translate3d(-2.1%, -1%, 0);
    }
    75% {
        transform: translate3d(-0.8%, -1.8%, 0);
    }
    100% {
        transform: translate3d(0, 0, 0);
    }
}

body.chat-shell .game-message .message-text::before,
body.chat-shell .user-message .message-text::before {
    content: none;
}

body.chat-shell .user-message .message-text {
    color: var(--terminal-amber-user);
    padding-left: 0;
}

body.chat-shell .stats-sidebar {
    padding: 18px 10px 16px 12px;
    border-left: 0;
    background: transparent;
    box-shadow: none;
}

body.chat-shell .stats-header {
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--terminal-line);
}

body.chat-shell .stats-heading-main,
body.chat-shell .stats-heading-sub,
body.chat-shell .chat-input button,
body.chat-shell .chat-input input[type="text"],
body.chat-shell #settings-panel,
body.chat-shell #settings-panel button,
body.chat-shell #settings-panel select,
body.chat-shell .inventory-count-badge,
body.chat-shell #stats-close {
    font-family: var(--ui-pixel-font);
}

body.chat-shell .modal-close,
body.chat-shell #settings-close,
body.chat-shell #help-close {
    font-family: var(--ui-pixel-font);
}

body.chat-shell .stats-heading-main {
    font-size: 10px;
    color: var(--terminal-sidebar-label);
    letter-spacing: 0.04em;
}

body.chat-shell .stats-heading-sub {
    font-size: 14px;
    color: var(--terminal-sidebar-value);
}

body.chat-shell .stats-heading-location {
    display: inline-grid;
    grid-template-columns: max-content minmax(0, max-content);
    border-color: color-mix(in srgb, var(--terminal-sidebar-label) 28%, transparent);
    background:
        linear-gradient(90deg, color-mix(in srgb, var(--terminal-sidebar-label) 18%, transparent), transparent),
        rgba(0, 0, 0, 0.22);
    color: var(--terminal-sidebar-value);
    font-family: var(--ui-pixel-font);
    font-size: 9px;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--terminal-sidebar-value) 8%, transparent);
    width: fit-content;
    max-width: 100%;
    align-self: flex-start;
}

body.chat-shell .stats-heading-location-label {
    color: var(--terminal-sidebar-label);
}

body.chat-shell .stats-heading-location-value {
    color: inherit;
    text-align: left;
}

body.chat-shell .stats-summary,
body.chat-shell #inventory,
body.chat-shell #clothing,
body.chat-shell #vehicle-panel {
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 6px 0;
}

body.chat-shell .stats-summary {
    margin-bottom: 10px;
    padding-top: 12px;
}

body.chat-shell .stats-portrait-image {
    max-width: 120px;
    border-radius: 0;
    border: 1px solid var(--terminal-line-soft);
    box-shadow: none;
}

body.chat-shell .stat-row {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    justify-content: start;
    gap: 14px;
    align-items: start;
    font-family: var(--terminal-font);
    font-size: 28px;
    line-height: 1;
}

body.chat-shell .stat-label,
body.chat-shell .stat-value,
body.chat-shell .inventory-section-label,
body.chat-shell .inventory-item,
body.chat-shell .inventory-item .item-qty,
body.chat-shell .inventory-item .item-creature-meta,
body.chat-shell .inventory-item .creature-ability {
    font-family: var(--terminal-font);
}

body.chat-shell .stat-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    white-space: nowrap;
}

body.chat-shell .stat-value {
    margin-left: 0;
    justify-self: start;
    text-align: left;
    white-space: nowrap;
}

body.chat-shell .inventory-section-label {
    font-size: 14px;
    color: var(--terminal-sidebar-label);
    letter-spacing: 0;
    margin: 10px 0 8px;
}

body.chat-shell .inventory-count-badge {
    font-size: 8px;
    color: color-mix(in srgb, var(--terminal-amber-soft) 82%, white);
    border-radius: 0;
    padding: 4px 6px;
    border-width: 1px;
}

body.chat-shell .inventory-item {
    font-size: 26px;
    line-height: 1;
    padding-left: 10px;
}

body.chat-shell .inventory-item::before {
    left: 0;
}

body.chat-shell .chat-input {
    padding: 8px 18px 14px;
    background: linear-gradient(180deg, #100803 0%, #0a0402 100%);
    border-top: 1px solid #25160d;
}

body.chat-shell .chat-input form {
    grid-template-columns: auto minmax(0, 1fr) auto auto auto auto auto;
    gap: 8px;
}

body.chat-shell .chat-input input[type="text"] {
    min-height: 36px;
    padding: 10px 12px;
    border: 1px solid var(--terminal-line);
    border-radius: 0;
    background: rgba(0, 0, 0, 0.22);
    color: color-mix(in srgb, var(--terminal-amber-soft) 78%, white);
    box-shadow: none;
    font-size: 10px;
    line-height: 1.4;
    text-transform: lowercase;
}

body.chat-shell .chat-input input[type="text"]:focus {
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--terminal-amber) 12%, transparent);
}

body.chat-shell .chat-input input[type="text"]::placeholder {
    color: color-mix(in srgb, var(--terminal-amber-soft) 46%, transparent);
}

body.chat-shell .chat-input button {
    min-height: 36px;
    padding: 10px 12px;
    border-radius: 0;
    border: 1px solid var(--terminal-line);
    background: #1a1009;
    color: color-mix(in srgb, var(--terminal-amber-soft) 80%, white);
    box-shadow: none;
    font-size: 8px;
}

body.chat-shell .chat-input button:hover {
    background: #21140b;
    transform: none;
}

body.chat-shell #stats-close {
    font-size: 12px;
    color: color-mix(in srgb, var(--terminal-amber-soft) 80%, white);
}

body.chat-shell #turn-changes,
body.chat-shell #message-turn-changes,
body.chat-shell #settings-panel {
    border-radius: 0;
    font-family: var(--terminal-font);
}

body.chat-shell #turn-changes,
body.chat-shell #message-turn-changes {
    font-size: 26px;
    letter-spacing: 0.01em;
}

body.chat-shell #settings-panel {
    font-size: 10px;
}

@media (max-width: 1200px) {
    body.chat-shell .chat-main {
        grid-template-columns: minmax(0, 1fr) 260px;
    }
}

@media (max-width: 768px) {
    body.chat-shell .terminal-frame {
        height: 100vh;
    }

    body.chat-shell .chat-main {
        grid-template-columns: 1fr;
    }

    body.chat-shell .chat-window {
        padding: 18px 16px 140px;
    }

    body.chat-shell .chat-input form {
        grid-template-columns: 1fr;
    }

    body.chat-shell .chat-input input[type="text"],
    body.chat-shell .chat-input button {
        width: 100%;
    }
}

/* Chat shell terminal theme v3: no top bar, no bottom bar, inline prompt */
body.chat-shell {
    background: var(--shared-terminal-bg);
    overflow-x: hidden;
}

body.chat-shell .chat-container {
    padding: 0;
}

body.chat-shell .terminal-frame {
    height: 100vh;
    border-radius: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

body.chat-shell .sidebar-hide-reveal {
    position: absolute;
    top: 4px;
    right: 0;
    width: 128px;
    height: 92px;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 8px;
    padding: 10px;
    z-index: 80;
    pointer-events: auto;
}

body.chat-shell #fullscreen-btn,
body.chat-shell #sidebar-hide-btn {
    width: 34px;
    height: 34px;
    border: 1px solid color-mix(in srgb, var(--terminal-amber) 28%, transparent);
    background: rgba(12, 7, 4, 0.9);
    color: color-mix(in srgb, var(--terminal-amber-soft) 92%, white);
    font-size: 16px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 180ms ease, transform 180ms ease, border-color 180ms ease, color 180ms ease;
    cursor: pointer;
}

body.chat-shell .sidebar-hide-reveal:hover #fullscreen-btn,
body.chat-shell .sidebar-hide-reveal:hover #sidebar-hide-btn,
body.chat-shell.sidebar-hover-active #fullscreen-btn,
body.chat-shell.sidebar-hover-active #sidebar-hide-btn,
body.chat-shell #fullscreen-btn:focus-visible,
body.chat-shell #sidebar-hide-btn:focus-visible {
    opacity: 1;
    transform: translateY(0);
}

body.chat-shell #fullscreen-btn:hover,
body.chat-shell #sidebar-hide-btn:hover {
    border-color: color-mix(in srgb, var(--terminal-amber) 60%, transparent);
    color: color-mix(in srgb, var(--terminal-amber-soft) 85%, white);
}

body.chat-shell .terminal-frame::before {
    inset: 0;
    border-radius: 0;
    box-shadow: none;
}

body.chat-shell .terminal-frame::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image:
        radial-gradient(rgba(255, 210, 140, 0.045) 0.6px, transparent 0.8px),
        radial-gradient(rgba(0, 0, 0, 0.04) 0.7px, transparent 0.9px);
    background-size: 5px 5px, 7px 7px;
    background-position: 0 0, 2px 3px;
    opacity: 0.16;
    mix-blend-mode: screen;
    animation: none;
    z-index: 1;
}

body.chat-shell .chat-main {
    height: 100%;
    grid-template-columns: minmax(0, 1fr) 390px;
    grid-template-rows: 1fr;
    grid-template-areas: "chat-window stats-sidebar";
    background: transparent;
    transform: scaleX(1.012);
    transform-origin: center center;
    animation: none;
}

body.chat-shell.sidebar-collapsed .chat-main {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "chat-window";
}

body.chat-shell .chat-window {
    padding: 20px 24px 72px 42px;
    background: transparent;
    font-size: 34px;
    line-height: 1.02;
    align-items: flex-start;
    z-index: 1;
    overflow-x: visible;
}

body.chat-shell.sidebar-collapsed .chat-window {
    padding-right: 34px;
}

body.chat-shell .chat-window::after {
    display: none;
}

body.chat-shell .chat-window::before {
    display: none;
}

body.chat-shell .message-text {
    margin: 0 0 14px;
    font-size: clamp(36px, 2.35vw, 46px);
    line-height: 1.04;
    text-shadow:
        0 0 3px var(--terminal-bloom-strong),
        0 0 10px var(--terminal-bloom-mid),
        0 0 20px var(--terminal-bloom-soft);
}

body.chat-shell .generated-scene-image {
    filter: none;
}

body.chat-shell #theme-hue-slider {
    width: 100%;
    min-width: 0;
}

body.chat-shell #theme-brightness-slider {
    width: 100%;
    min-width: 0;
}

body.chat-shell #theme-hue-value {
    min-width: 72px;
    text-align: right;
    justify-self: end;
}

body.chat-shell #theme-brightness-value {
    min-width: 72px;
    text-align: right;
    justify-self: end;
}

@media (min-width: 769px) {
    body.chat-shell .settings-section:has(#theme-hue-slider),
    body.chat-shell .settings-section:has(#theme-brightness-slider) {
        grid-template-columns: 170px minmax(0, 1fr) auto;
    }
}

body.chat-shell .chat-input-inline {
    margin-top: 0;
    padding: 0;
    background: transparent !important;
    border: 0 !important;
    border-top: 0 !important;
    height: auto;
    position: static !important;
    bottom: auto !important;
    z-index: auto !important;
    box-shadow: none !important;
    width: auto !important;
    max-width: 100%;
    align-self: flex-start !important;
    display: block !important;
}

body.chat-shell .chat-input-inline form {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    background: transparent !important;
    box-shadow: none !important;
    border: 0 !important;
}

body.chat-shell .terminal-input-line {
    display: block !important;
    min-height: 54px;
    padding-left: 0;
    background: transparent !important;
    box-shadow: none !important;
    border: 0 !important;
    position: relative;
    width: 100% !important;
    text-align: left;
    user-select: text;
    -webkit-user-select: text;
}

body.chat-shell .terminal-input-render {
    display: inline-block !important;
    width: auto !important;
    max-width: 100%;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: var(--chat-font);
    font-size: clamp(36px, 2.35vw, 46px);
    line-height: 1.04;
    color: var(--terminal-amber-user);
    text-align: left;
    user-select: text;
    -webkit-user-select: text;
    vertical-align: top;
    text-shadow:
        0 0 3px var(--terminal-bloom-strong),
        0 0 10px var(--terminal-bloom-mid),
        0 0 20px var(--terminal-bloom-soft);
}

body.chat-shell[data-chat-font="modern"] .chat-window {
    font-size: 22px;
}

body.chat-shell[data-chat-font="modern"] .message-text {
    font-size: clamp(20px, 1.45vw, 28px);
}

body.chat-shell[data-chat-font="modern"] .terminal-input-render {
    font-size: clamp(20px, 1.45vw, 28px);
}

body.chat-shell[data-chat-font="modern"] .chat-input-inline input[type="text"] {
    font-size: clamp(20px, 1.45vw, 28px);
}

body.chat-shell .terminal-selection {
    background: var(--terminal-selection-bg);
    color: var(--terminal-selection-text);
    text-shadow: none;
}

body.chat-shell .terminal-cursor {
    display: inline-block !important;
    width: 0.56em;
    min-height: 1em;
    background: var(--terminal-amber);
    color: #120802;
    box-shadow:
        0 0 8px var(--terminal-bloom-strong),
        0 0 20px var(--terminal-bloom-mid);
    animation: dosBlockBlink 1s steps(1, end) infinite;
    vertical-align: baseline;
    user-select: none;
    -webkit-user-select: none;
}

body.chat-shell .chat-input-inline input[type="text"] {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
    padding: 0;
    border: 0;
    background: transparent !important;
    background-color: transparent !important;
    color: transparent !important;
    box-shadow: none !important;
    font-family: var(--chat-font);
    font-size: clamp(31px, 2vw, 39px);
    line-height: 1.02;
    caret-color: transparent;
    text-transform: none;
    appearance: none;
    -webkit-appearance: none;
    border-radius: 0;
    z-index: 2;
    text-align: left !important;
    justify-self: start;
    opacity: 0 !important;
    overflow: hidden !important;
    pointer-events: auto;
    user-select: text;
    -webkit-user-select: text;
}

body.chat-shell .terminal-input-line::selection,
body.chat-shell .terminal-input-render::selection,
body.chat-shell .terminal-cursor::selection {
    background: var(--terminal-selection-bg);
    color: var(--terminal-selection-text);
}

body.chat-shell .terminal-input-line::-moz-selection,
body.chat-shell .terminal-input-render::-moz-selection,
body.chat-shell .terminal-cursor::-moz-selection {
    background: var(--terminal-selection-bg);
    color: var(--terminal-selection-text);
}

body.chat-shell .stats-sidebar::selection,
body.chat-shell .stats-sidebar *::selection,
body.chat-shell #settings-panel::selection,
body.chat-shell #settings-panel *::selection,
body.chat-shell #help-panel::selection,
body.chat-shell #help-panel *::selection {
    background: var(--terminal-selection-bg);
    color: var(--terminal-selection-text);
}

body.chat-shell .stats-sidebar::-moz-selection,
body.chat-shell .stats-sidebar *::-moz-selection,
body.chat-shell #settings-panel::-moz-selection,
body.chat-shell #settings-panel *::-moz-selection,
body.chat-shell #help-panel::-moz-selection,
body.chat-shell #help-panel *::-moz-selection {
    background: var(--terminal-selection-bg);
    color: var(--terminal-selection-text);
}

body.chat-shell .chat-input-inline input[type="text"]:focus {
    box-shadow: none;
    outline: none;
    background: transparent !important;
    background-color: transparent !important;
}

body.chat-shell .chat-input-inline input[type="text"]::placeholder {
    color: transparent;
}

body.chat-shell .chat-input-inline input[type="text"]:-webkit-autofill,
body.chat-shell .chat-input-inline input[type="text"]:-webkit-autofill:hover,
body.chat-shell .chat-input-inline input[type="text"]:-webkit-autofill:focus,
body.chat-shell .chat-input-inline input[type="text"]:-webkit-autofill:active {
    -webkit-text-fill-color: transparent;
    -webkit-box-shadow: 0 0 0 1000px transparent inset !important;
    box-shadow: 0 0 0 1000px transparent inset !important;
    transition: background-color 9999s ease-in-out 0s;
    background-color: transparent !important;
}

@media (max-width: 768px), (hover: none) and (pointer: coarse) {
    body.chat-shell .terminal-input-render {
        display: none !important;
    }

    body.chat-shell .terminal-input-line {
        min-height: auto;
    }

    body.chat-shell .chat-input-inline input[type="text"] {
        position: static !important;
        inset: auto !important;
        display: block !important;
        min-height: 52px !important;
        height: auto !important;
        min-width: 0 !important;
        padding: 12px 14px !important;
        border: 1px solid var(--terminal-line) !important;
        background: rgba(0, 0, 0, 0.3) !important;
        background-color: rgba(0, 0, 0, 0.3) !important;
        color: color-mix(in srgb, var(--terminal-amber-soft) 82%, white) !important;
        caret-color: var(--terminal-amber) !important;
        opacity: 1 !important;
        overflow: visible !important;
        z-index: auto !important;
        font-size: 18px !important;
        line-height: 1.25 !important;
        box-shadow: inset 0 0 0 1px rgba(255, 173, 51, 0.06) !important;
    }

    body.chat-shell .chat-input-inline input[type="text"]:focus {
        outline: none;
        background: rgba(0, 0, 0, 0.34) !important;
        background-color: rgba(0, 0, 0, 0.34) !important;
        box-shadow:
            inset 0 0 0 1px rgba(255, 173, 51, 0.16),
            0 0 0 1px rgba(255, 173, 51, 0.12) !important;
    }

    body.chat-shell .chat-input-inline input[type="text"]::placeholder {
        color: color-mix(in srgb, var(--terminal-amber-soft) 50%, transparent) !important;
    }

    body.chat-shell .chat-input-inline input[type="text"]:-webkit-autofill,
    body.chat-shell .chat-input-inline input[type="text"]:-webkit-autofill:hover,
    body.chat-shell .chat-input-inline input[type="text"]:-webkit-autofill:focus,
    body.chat-shell .chat-input-inline input[type="text"]:-webkit-autofill:active {
        -webkit-text-fill-color: color-mix(in srgb, var(--terminal-amber-soft) 82%, white) !important;
        -webkit-box-shadow: 0 0 0 1000px rgba(0, 0, 0, 0.3) inset !important;
        box-shadow: 0 0 0 1000px rgba(0, 0, 0, 0.3) inset !important;
        background-color: rgba(0, 0, 0, 0.3) !important;
    }
}

body.chat-shell .terminal-submit,
body.chat-shell .terminal-aux-button,
body.chat-shell #settings-btn,
body.chat-shell .undo-button {
    display: none !important;
}

body.chat-shell .stats-sidebar {
    padding-top: 18px;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 50 !important;
    overflow: visible !important;
}

body.chat-shell.sidebar-collapsed .stats-sidebar {
    display: none !important;
}

body.chat-shell .stats-flex,
body.chat-shell #inventory,
body.chat-shell .inventory-list,
body.chat-shell .inventory-item {
    position: relative;
    z-index: 51;
}

body.chat-shell .inventory-item:hover,
body.chat-shell .inventory-item:focus-within,
body.chat-shell .inventory-item[data-item-info]:hover,
body.chat-shell .inventory-item[data-item-info]:focus-within {
    z-index: 60;
}

body.chat-shell .stats-flex {
    flex: 1 1 auto;
    max-height: none;
    overflow: visible !important;
}

body.chat-shell .stats-sidebar-actions {
    position: sticky;
    bottom: 12px;
    z-index: 70;
    display: flex;
    justify-content: flex-end;
    margin-top: auto;
    padding-top: 14px;
    pointer-events: none;
}

body.chat-shell #img-btn.stats-image-button {
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    max-width: 100%;
    min-height: 40px;
    padding: 9px 11px;
    border: 1px solid color-mix(in srgb, var(--terminal-amber) 52%, transparent);
    border-radius: 0;
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--terminal-amber) 18%, #120703) 0%, rgba(8, 4, 2, 0.96) 100%);
    color: color-mix(in srgb, var(--terminal-amber-soft) 84%, white);
    font-family: var(--ui-pixel-font);
    font-size: 9px;
    line-height: 1.2;
    letter-spacing: 0;
    text-transform: uppercase;
    text-shadow:
        0 0 3px var(--terminal-bloom-mid),
        0 0 9px var(--terminal-bloom-soft);
    box-shadow:
        inset 0 0 0 1px rgba(255, 220, 150, 0.04),
        0 0 18px rgba(245, 155, 47, 0.12);
    cursor: pointer;
}

body.chat-shell #img-btn.stats-image-button:hover:not(:disabled),
body.chat-shell #img-btn.stats-image-button:focus-visible {
    border-color: color-mix(in srgb, var(--terminal-amber) 72%, white);
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--terminal-amber) 25%, #160804) 0%, rgba(10, 4, 2, 0.98) 100%);
}

body.chat-shell #img-btn.stats-image-button:disabled {
    opacity: 0.62;
    cursor: wait;
}

body.chat-shell #img-btn.stats-image-button::before {
    content: "\25A3";
    font-size: 11px;
    line-height: 1;
}

body.chat-shell #inventory {
    padding-top: 12px;
}

body.chat-shell #clothing,
body.chat-shell #vehicle-panel,
body.chat-shell .inventory-list {
    border: 0 !important;
    padding-left: 0;
}

body.chat-shell .stats-header {
    margin-bottom: 12px;
    padding-bottom: 0;
    border-bottom: 0;
}

body.chat-shell #stats-btn {
    display: none !important;
}

@keyframes terminalSurfaceDrift {
    0% { transform: perspective(700px) rotateX(0.78deg) scale(1.02, 1.028) translateY(0); }
    25% { transform: perspective(700px) rotateX(0.86deg) scale(1.022, 1.031) translateY(-0.22px); }
    50% { transform: perspective(700px) rotateX(0.7deg) scale(1.019, 1.03) translateY(0.18px); }
    75% { transform: perspective(700px) rotateX(0.82deg) scale(1.022, 1.029) translateY(-0.12px); }
    100% { transform: perspective(700px) rotateX(0.78deg) scale(1.02, 1.028) translateY(0); }
}

@keyframes dosBlockBlink {
    0% { opacity: 1; }
    49% { opacity: 1; }
    50% { opacity: 0; }
    100% { opacity: 0; }
}

@media (max-width: 1200px) {
    body.chat-shell .chat-main {
        grid-template-columns: minmax(0, 1fr) 330px;
    }
}

@media (max-width: 768px) {
    body.chat-shell .sidebar-hide-reveal {
        display: none;
    }

    body.chat-shell #help-panel {
        width: min(94vw, 780px);
        padding: 22px 24px 28px;
    }

    body.chat-shell .help-section {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    body.chat-shell .help-section span {
        font-size: 24px;
    }

    body.chat-shell .help-heading {
        font-size: 28px;
    }

    body.chat-shell .chat-container {
        padding: 0;
    }

    body.chat-shell .terminal-frame {
        height: 100vh;
        border: 0;
    }

    body.chat-shell .chat-main {
        grid-template-columns: 1fr;
    }

    body.chat-shell .chat-window {
        padding: 18px 16px 18px;
    }

    body.chat-shell .message-text,
    body.chat-shell .terminal-input-render {
        font-size: 28px;
    }

    body.chat-shell .terminal-cursor {
        width: 0.56em;
        height: 26px;
    }

    body.chat-shell .stats-overlay.visible {
        background: rgba(0, 0, 0, 0.28);
    }

    body.chat-shell .stats-sidebar {
        display: none !important;
        position: fixed;
        left: 50%;
        bottom: 14px;
        bottom: max(14px, env(safe-area-inset-bottom));
        transform: translateX(-50%);
        width: min(92vw, 360px);
        height: auto;
        max-height: 82vh;
        z-index: 3300 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding: 18px 14px 20px;
        border: 1px solid rgba(255, 173, 51, 0.24);
        background: rgba(9, 4, 2, 0.96);
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
    }

    body.chat-shell .stats-sidebar.open {
        display: flex !important;
    }

    body.chat-shell .stats-header {
        position: sticky;
        top: 0;
        background: rgba(9, 4, 2, 0.96);
        z-index: 2;
        padding-bottom: 8px;
        margin-bottom: 10px;
    }

    body.chat-shell .stat-row {
        display: grid;
        grid-template-columns: max-content minmax(0, 1fr);
        gap: 10px;
        align-items: start;
        font-size: 20px;
    }

    body.chat-shell .stat-label {
        min-width: 0;
        white-space: nowrap;
    }

    body.chat-shell .stat-value {
        white-space: nowrap;
        text-align: left;
        justify-self: start;
    }

    body.chat-shell #currency {
        white-space: nowrap;
    }

    body.chat-shell .inventory-item,
    body.chat-shell .item-name {
        font-size: 18px;
        line-height: 1.15;
    }

    body.chat-shell .inventory-item .item-info,
    body.chat-shell .inventory-item .ability-info,
    body.chat-shell .inventory-item[data-item-info]:hover .item-info,
    body.chat-shell .inventory-item[data-item-info]:focus-within .item-info,
    body.chat-shell .inventory-item .creature-ability:hover .ability-info,
    body.chat-shell .inventory-item .creature-ability:focus-within .ability-info,
    body.chat-shell .inventory-item .item-creature-abilities:hover ~ .item-info,
    body.chat-shell .inventory-item .item-creature-abilities:focus-within ~ .item-info {
        display: none !important;
    }
}

/* Sidebar readability fix */
body.chat-shell .stats-heading-main {
    font-size: 19px;
}

body.chat-shell .stats-heading-sub {
    font-size: 35px;
}

body.chat-shell .stats-heading-location {
    font-size: 14px;
    padding: 8px 10px 4px;
}

body.chat-shell #current-location-display.stats-heading-location {
    display: inline-flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: auto !important;
    max-width: calc(100% - 8px) !important;
    flex: 0 0 auto !important;
    align-self: flex-start !important;
    text-align: center;
}

body.chat-shell #current-location-display .stats-heading-location-label {
    display: block;
    line-height: 1;
}

body.chat-shell #current-location-display .stats-heading-location-value {
    display: block;
    flex: 0 1 auto;
    min-width: 0;
    line-height: 1.5;
    text-align: center;
    margin-bottom: -0.1em;
}

body.chat-shell .stat-row {
    font-size: 32px;
}

body.chat-shell .inventory-section-label {
    font-size: 16px;
}

body.chat-shell .inventory-section-label.inventory-section-label--count {
    font-size: 13px;
}

body.chat-shell .inventory-section-label.inventory-section-label--count {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

body.chat-shell .inventory-section-title {
    font-size: 17px;
}

body.chat-shell .inventory-section-label.inventory-section-label--count,
body.chat-shell .inventory-section-label.inventory-section-label--count span {
    font-family: var(--ui-pixel-font);
    line-height: 1.2;
}

body.chat-shell .inventory-count-badge {
    font-size: 14px;
    padding: 5px 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    line-height: 1;
}

body.chat-shell .inventory-item,
body.chat-shell .item-name,
body.chat-shell .inventory-item .item-qty,
body.chat-shell .inventory-item .item-creature-meta,
body.chat-shell .inventory-item .creature-ability {
    font-size: 29px;
}

body.chat-shell .inventory-item .item-qty,
body.chat-shell .inventory-item .item-creature-meta,
body.chat-shell .inventory-item .creature-ability {
    font-size: 18px;
}


body.chat-shell .inventory-item .item-info,
body.chat-shell .inventory-item .ability-info {
    position: absolute;
    z-index: 10000 !important;
}

body.chat-shell #stats-close {
    font-size: 16px;
}

@media (prefers-reduced-motion: reduce) {
    body.chat-shell .chat-window::after {
        animation: none;
        opacity: 0.08;
        transform: translate3d(0, 0, 0);
    }
}
