:root {
    color-scheme: dark;
    --bg: #071316;
    --panel: rgba(10, 27, 31, 0.94);
    --panel-2: #10252a;
    --line: rgba(150, 242, 225, 0.15);
    --text: #eef9f7;
    --muted: #8da5a5;
    --accent: #5eead4;
    --accent-2: #ff9c55;
    --danger: #ff6b72;
    --chrome: rgba(7, 19, 22, 0.9);
    --solid: #0a1b1f;
    --field-bg: #0d2227;
    --secondary-bg: #173239;
    --primary-ink: #04211d;
    --assistant-bubble: rgba(16, 37, 42, .88);
    --user-bubble: rgba(94,234,212,.11);
    --glow-1: rgba(94, 234, 212, 0.12);
    --glow-2: rgba(255, 156, 85, 0.08);
    --chat-font-size: 17px;
    --story-font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top: env(safe-area-inset-top, 0px);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="cyber"] {
    --bg: #090616; --panel: rgba(18, 10, 38, .95); --panel-2: #19102f; --line: rgba(200, 133, 255, .2);
    --text: #f8f1ff; --muted: #aa9abb; --accent: #c77dff; --accent-2: #32e6ff; --chrome: rgba(9, 6, 22, .9);
    --solid: #120a26; --field-bg: #19102f; --secondary-bg: #281745; --primary-ink: #170622;
    --assistant-bubble: rgba(30, 17, 53, .9); --user-bubble: rgba(199,125,255,.13);
    --glow-1: rgba(199,125,255,.16); --glow-2: rgba(50,230,255,.09);
}
:root[data-theme="amber"] {
    --bg: #17110b; --panel: rgba(35, 25, 15, .96); --panel-2: #2d2115; --line: rgba(239, 190, 113, .2);
    --text: #fff4df; --muted: #b7a58a; --accent: #f0bd68; --accent-2: #d77d45; --chrome: rgba(23,17,11,.92);
    --solid: #23190f; --field-bg: #2d2115; --secondary-bg: #46321e; --primary-ink: #291705;
    --assistant-bubble: rgba(48, 35, 21, .9); --user-bubble: rgba(240,189,104,.13);
    --glow-1: rgba(240,189,104,.13); --glow-2: rgba(215,125,69,.08);
}
:root[data-theme="forest"] {
    --bg: #0d1510; --panel: rgba(21, 34, 25, .96); --panel-2: #1a2a1f; --line: rgba(167, 213, 154, .18);
    --text: #edf7ea; --muted: #94a990; --accent: #9bd487; --accent-2: #d8a760; --chrome: rgba(13,21,16,.92);
    --solid: #152219; --field-bg: #1a2a1f; --secondary-bg: #29402f; --primary-ink: #10200e;
    --assistant-bubble: rgba(27, 44, 32, .9); --user-bubble: rgba(155,212,135,.12);
    --glow-1: rgba(155,212,135,.12); --glow-2: rgba(216,167,96,.07);
}
:root[data-theme="rose"] {
    --bg: #160a11; --panel: rgba(36, 15, 27, .96); --panel-2: #2b1422; --line: rgba(255, 144, 190, .19);
    --text: #fff1f7; --muted: #b89aa8; --accent: #ff8fbd; --accent-2: #c8a4ff; --chrome: rgba(22,10,17,.92);
    --solid: #240f1b; --field-bg: #2b1422; --secondary-bg: #452037; --primary-ink: #2b0818;
    --assistant-bubble: rgba(47, 21, 37, .9); --user-bubble: rgba(255,143,189,.12);
    --glow-1: rgba(255,143,189,.14); --glow-2: rgba(200,164,255,.08);
}
:root[data-theme="daylight"] {
    color-scheme: light; --bg: #eef7f5; --panel: rgba(249, 255, 253, .97); --panel-2: #ffffff; --line: rgba(20, 91, 81, .16);
    --text: #16332f; --muted: #607d78; --accent: #1aa891; --accent-2: #d66d32; --chrome: rgba(244,252,250,.92);
    --solid: #f9fffd; --field-bg: #ffffff; --secondary-bg: #dcefeb; --primary-ink: #ffffff;
    --assistant-bubble: rgba(255,255,255,.94); --user-bubble: rgba(26,168,145,.12);
    --glow-1: rgba(26,168,145,.12); --glow-2: rgba(214,109,50,.07);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; overflow: hidden; background: var(--bg); color: var(--text); }
body {
    background:
        radial-gradient(circle at 15% 10%, var(--glow-1), transparent 32%),
        radial-gradient(circle at 85% 80%, var(--glow-2), transparent 30%),
        var(--bg);
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.app-shell { width: 100%; min-width: 0; height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; }
.topbar {
    padding: calc(12px + var(--safe-top)) 14px 12px;
    display: grid;
    min-width: 0; grid-template-columns: 42px minmax(0, 1fr) 42px 42px;
    gap: 8px;
    align-items: center;
    border-bottom: 1px solid var(--line);
    background: var(--chrome);
    backdrop-filter: blur(18px);
    z-index: 5;
}
.brand-mark {
    width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center;
    color: var(--primary-ink); font-weight: 900; background: linear-gradient(145deg, var(--accent), var(--accent-2));
    box-shadow: 0 8px 28px rgba(94, 234, 212, 0.16);
}
.brand-copy { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.brand-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-copy span { color: var(--muted); font-size: 12px; }
.brand-copy .status-separator { margin: 0 5px; color: var(--line); }
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #66797a; }
.status-dot.online { background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.status-dot.busy { background: var(--accent-2); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.icon-button, .voice-button, .send-button {
    border: 1px solid var(--line); color: var(--text); background: rgba(255,255,255,.035);
    width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; font-size: 21px;
}
.chat { min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 22px 14px 34px; scroll-behavior: smooth; }
.welcome-card {
    width: 100%; max-width: 560px; margin: min(18vh, 120px) auto 0; padding: 26px; border: 1px solid var(--line);
    border-radius: 24px; background: linear-gradient(155deg, rgba(17,44,48,.92), rgba(9,24,28,.84));
    box-shadow: 0 24px 70px rgba(0,0,0,.28);
}
.eyebrow { color: var(--accent); letter-spacing: .16em; font-size: 10px; font-weight: 800; }
h1, h2, p { margin-top: 0; }
.welcome-card h1 { margin: 10px 0 12px; font-size: clamp(28px, 9vw, 46px); line-height: 1.05; }
.welcome-card p, .hint { color: var(--muted); line-height: 1.65; }
.primary-button, .secondary-button, .danger-button, .file-button {
    border: 0; border-radius: 14px; min-height: 44px; padding: 11px 15px; font-weight: 750;
}
.primary-button { color: var(--primary-ink); background: var(--accent); }
.secondary-button, .file-button { color: var(--text); background: var(--secondary-bg); border: 1px solid var(--line); text-align: center; }
.danger-button { color: #ffd9db; background: rgba(255, 107, 114, .13); border: 1px solid rgba(255,107,114,.25); }
.wide { width: 100%; }

.message { max-width: 760px; margin: 0 auto 22px; }
.message-content { min-width: 0; width: 100%; }
.message-avatar { display: none; flex: 0 0 auto; width: 40px; height: 40px; overflow: hidden; border: 1px solid var(--line); border-radius: 50%; place-items: center; color: #071316; background: linear-gradient(145deg, hsl(var(--avatar-hue, 170) 72% 70%), hsl(calc(var(--avatar-hue, 170) + 45) 72% 62%)); font-weight: 850; }
.message-avatar img { width: 100%; height: 100%; object-fit: cover; }
.message-meta { display: flex; gap: 8px; align-items: center; margin-bottom: 7px; color: var(--muted); font-size: 12px; }
.message-meta strong { color: var(--text); font-size: 14px; }
.message-body {
    white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.72; font-size: var(--chat-font-size); font-family: var(--story-font); padding: 15px 17px;
    border-radius: 7px 20px 20px 20px; background: var(--assistant-bubble); border: 1px solid var(--line);
}
.message.assistant .message-body { white-space: normal; }
.story-paragraph { margin: 0 0 .82em; text-indent: 2em; }
.story-paragraph:last-child { margin-bottom: 0; }
.story-paragraph.dialogue { text-indent: 0; }
.message.user .message-meta { justify-content: flex-end; }
.message.user .message-body { margin-left: 38px; border-radius: 20px 7px 20px 20px; background: var(--user-bubble); }
.message.assistant .message-body { margin-right: 18px; }
.message.pending .message-body::after { content: '●'; color: var(--accent); animation: pulse 1s infinite; }
.message-actions { display: flex; gap: 5px; margin-top: 7px; opacity: .72; }
.message.user .message-actions { justify-content: flex-end; }
.message-action {
    width: 34px; height: 30px; display: grid; place-items: center; padding: 0; color: var(--muted);
    border: 1px solid transparent; border-radius: 9px; background: transparent;
}
.message-action svg { width: 16px; height: 16px; }
.message-action:active { color: var(--accent); border-color: var(--line); background: var(--field-bg); }

.node-card {
    margin: 13px 18px 0 0; border: 1px solid var(--line); border-radius: 17px; overflow: hidden;
    background: linear-gradient(145deg, var(--field-bg), var(--solid)); box-shadow: 0 10px 28px rgba(0,0,0,.12);
}
.node-card summary {
    display: flex; align-items: center; gap: 9px; padding: 12px 14px; cursor: pointer; color: var(--accent);
    font-size: 13px; font-weight: 850; list-style: none; letter-spacing: .04em;
}
.node-card summary::-webkit-details-marker { display: none; }
.node-card summary svg { width: 17px; height: 17px; }
.node-card summary::after, .choice-card summary::after { content: '展开'; color: var(--muted); font-size: 10px; font-weight: 650; letter-spacing: 0; }
.node-card[open] summary::after, .choice-card[open] summary::after { content: '收起'; }
.node-turn { margin-left: auto; color: var(--muted); font-size: 11px; font-weight: 650; letter-spacing: 0; }
.node-grid { display: grid; gap: 1px; padding: 0 10px 11px; }
.node-row { display: grid; grid-template-columns: 25px 58px 1fr; gap: 6px; align-items: start; padding: 8px 5px; border-top: 1px solid var(--line); }
.node-row svg { width: 16px; height: 16px; margin-top: 2px; color: var(--accent-2); }
.node-row b { color: var(--muted); font-size: 12px; line-height: 1.5; }
.node-row span { color: var(--text); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }

.choice-card { margin: 12px 18px 0 0; border: 1px solid var(--line); border-radius: 17px; overflow: hidden; background: linear-gradient(145deg, var(--field-bg), var(--solid)); }
.choice-card summary { display: flex; align-items: center; gap: 8px; padding: 12px 14px; color: var(--muted); cursor: pointer; list-style: none; font-size: 12px; font-weight: 800; letter-spacing: .05em; }
.choice-card summary::-webkit-details-marker { display: none; }
.choice-card summary svg { width: 15px; height: 15px; color: var(--accent); }
.choice-card summary::after { margin-left: auto; }
.choice-list { display: grid; gap: 8px; padding: 0 10px 10px; }
.choice-button {
    width: 100%; display: grid; grid-template-columns: 28px 1fr; gap: 8px; padding: 11px 12px; text-align: left;
    color: var(--text); background: var(--field-bg); border: 1px solid var(--line); border-radius: 13px; line-height: 1.42;
}
.choice-number { color: var(--accent); font-size: 11px; font-weight: 900; padding-top: 2px; }
.choice-copy strong, .choice-copy small { display: block; }
.choice-copy strong { font-size: 14px; }
.choice-copy small { margin-top: 3px; color: var(--muted); font-size: 12px; }
.choice-button:active { border-color: var(--accent); background: var(--user-bubble); transform: translateY(1px); }
.choice-button[disabled] { opacity: .52; cursor: default; }
.free-action { border-style: dashed; }

:root[data-layout="document"] .message { margin-bottom: 30px; }
:root[data-layout="document"] .message.assistant .message-meta { display: none; }
:root[data-layout="document"] .message-body { padding: 3px 2px; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
:root[data-layout="document"] .message.user .message-body {
    margin-left: 34px; padding: 11px 14px; border-left: 3px solid var(--accent); border-radius: 0 10px 10px 0; background: var(--user-bubble);
}
:root[data-layout="document"] .message.assistant .message-body { margin-right: 0; }
:root[data-layout="document"] .message-meta { margin-bottom: 10px; }

:root[data-layout="bubbles"] .message.user { display: flex; flex-direction: row-reverse; gap: 10px; align-items: flex-start; }
:root[data-layout="bubbles"] .message.user .message-avatar { display: grid; }
:root[data-layout="bubbles"] .message.user .message-content { width: auto; max-width: calc(100% - 50px); }
:root[data-layout="bubbles"] .message.user .message-content { display: flex; flex-direction: column; align-items: flex-end; }
:root[data-layout="bubbles"] .message.user .message-body { margin: 0; max-width: 100%; }
:root[data-layout="bubbles"] .message.assistant { display: block; margin-bottom: 28px; }
:root[data-layout="bubbles"] .message.assistant > .message-avatar,
:root[data-layout="bubbles"] .message.assistant .message-meta { display: none; }
:root[data-layout="bubbles"] .message.assistant .message-content { width: 100%; max-width: none; }
:root[data-layout="bubbles"] .message.assistant .message-body {
    width: 100%; max-width: none; margin: 0; padding: 3px 2px; border: 0; border-radius: 0; background: transparent; box-shadow: none;
}
:root[data-layout="bubbles"] .character-speech { display: flex; align-items: flex-start; gap: 9px; margin: .85em 0 1em; text-indent: 0; }
:root[data-layout="bubbles"] .speech-avatar {
    flex: 0 0 36px; width: 36px; height: 36px; display: grid; place-items: center; overflow: hidden;
    border: 1px solid hsl(var(--avatar-hue) 58% 62% / .55); border-radius: 50%;
    color: hsl(var(--avatar-hue) 80% 88%); background: hsl(var(--avatar-hue) 32% 28%); font-size: 13px; font-weight: 850;
}
:root[data-layout="bubbles"] .speech-avatar img { width: 100%; height: 100%; object-fit: cover; }
:root[data-layout="bubbles"] .speech-content { min-width: 0; max-width: min(78%, 560px); }
:root[data-layout="bubbles"] .speech-name { display: block; margin: 0 0 4px 3px; color: var(--muted); font-size: 11px; font-weight: 750; }
:root[data-layout="bubbles"] .speech-bubble {
    width: fit-content; padding: 9px 12px; border: 1px solid var(--line); border-radius: 4px 15px 15px;
    color: var(--text); background: var(--assistant-bubble); box-shadow: 0 7px 20px rgba(0,0,0,.08); line-height: 1.65; overflow-wrap: anywhere;
}

.story-dock { min-width: 0; border-top: 1px solid var(--line); background: var(--chrome); backdrop-filter: blur(18px); }
.story-dock > details { max-width: 800px; margin: 0 auto; }
.story-dock > details > summary { display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 9px 14px; cursor: pointer; list-style: none; color: var(--muted); }
.story-dock > details > summary::-webkit-details-marker { display: none; }
.story-dock > details > summary::after { content: '展开'; margin-left: auto; color: var(--accent); font-size: 11px; }
.story-dock > details[open] > summary::after { content: '收起'; }
.story-dock > details > summary strong { color: var(--text); font-size: 13px; }
.dock-mark { color: var(--accent); font-size: 18px; }
#storyDockMeta { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.story-dock-content { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 10px; max-height: min(46dvh, 440px); overflow-y: auto; padding: 0 12px 12px; overscroll-behavior: contain; }
.dock-section { min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--solid); }
.dock-section h3 { margin: 0 0 8px; color: var(--accent-2); font-size: 12px; letter-spacing: .05em; }
.dock-section .node-grid { padding: 0; }
.dock-section .node-row { grid-template-columns: 22px 50px 1fr; padding-inline: 2px; }
.dock-section .choice-list { padding: 0; }
.dock-empty { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }

.composer {
    min-width: 0; padding: 10px 10px calc(10px + var(--safe-bottom)); display: grid; grid-template-columns: minmax(0, 1fr) 42px 42px; gap: 8px;
    align-items: end; border-top: 1px solid var(--line); background: var(--chrome); backdrop-filter: blur(18px);
}
.composer textarea {
    width: 100%; min-width: 0; resize: none; max-height: 150px; min-height: 44px; padding: 11px 14px; border-radius: 15px;
    border: 1px solid var(--line); outline: none; color: var(--text); background: var(--panel-2); line-height: 1.45;
}
.composer textarea:focus { border-color: rgba(94,234,212,.55); box-shadow: 0 0 0 3px rgba(94,234,212,.08); }
.send-button { color: var(--primary-ink); background: var(--accent); font-weight: 900; }
.send-button:disabled { opacity: .35; }

.backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.55); backdrop-filter: blur(3px); }
.settings-panel {
    position: fixed; z-index: 21; top: 0; right: 0; bottom: 0; width: min(92vw, 430px); transform: translateX(102%);
    transition: transform .25s ease; background: var(--panel); border-left: 1px solid var(--line); backdrop-filter: blur(22px);
    display: grid; grid-template-rows: auto auto 1fr;
}
.settings-panel.open { transform: translateX(0); }
.panel-head { padding: calc(18px + var(--safe-top)) 18px 15px; display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 4px 0 0; }
.settings-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; padding: 9px 10px; border-bottom: 1px solid var(--line); background: var(--chrome); }
.settings-tab { min-height: 38px; padding: 7px 4px; color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 10px; font-weight: 750; }
.settings-tab.active { color: var(--primary-ink); background: var(--accent); }
.panel-body { overflow-y: auto; padding: 18px 18px calc(28px + var(--safe-bottom)); }
.settings-view { display: none; }
.settings-view.active { display: block; }
.section-title { margin: 24px 0 10px; color: var(--accent-2); font-size: 12px; font-weight: 800; letter-spacing: .08em; }
.section-title.first { margin-top: 0; }
.field { display: grid; gap: 7px; margin-bottom: 12px; color: var(--muted); font-size: 13px; }
.field input, .field select, .field textarea {
    width: 100%; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--line); color: var(--text); background: var(--field-bg); outline: none;
}
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; }
.toggle-row span small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.toggle-row.compact { padding: 4px 0 8px; }
.toggle-row input { width: 22px; height: 22px; accent-color: var(--accent); }
.security-note {
    margin: 0 0 12px; padding: 10px 12px; border-radius: 11px; color: #c8d8d6; background: rgba(255,156,85,.08);
    border: 1px solid rgba(255,156,85,.16); font-size: 12px; line-height: 1.55;
}
.remember-badge {
    display: inline-block; margin: 0 0 8px; padding: 7px 10px; border-radius: 999px; color: var(--accent);
    background: var(--user-bubble); border: 1px solid var(--line); font-size: 12px; font-weight: 800;
}
.data-import { margin-top: 9px; }
.version-card { display: flex; align-items: center; justify-content: space-between; padding: 13px; border: 1px solid var(--line); border-radius: 13px; background: var(--field-bg); }
.version-card span { color: var(--muted); font-size: 12px; }
.hint.small { margin-top: 9px; font-size: 12px; }
.content-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 12px; }
.content-summary div { min-width: 0; padding: 11px; border-radius: 12px; background: var(--field-bg); border: 1px solid var(--line); }
.content-summary small, .content-summary strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.content-summary small { color: var(--muted); margin-bottom: 5px; }
.button-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 9px; }
.file-button { display: grid; place-items: center; font-size: 12px; }
.file-button input { display: none; }
.panel-body button + button { margin-top: 9px; }

.editor-dialog {
    width: min(94vw, 720px); max-height: 92dvh; margin: auto; padding: 0; color: var(--text);
    border: 1px solid var(--line); border-radius: 22px; background: var(--solid); box-shadow: 0 26px 90px rgba(0,0,0,.58);
}
.editor-dialog::backdrop { background: rgba(0,0,0,.68); backdrop-filter: blur(4px); }
.dialog-head {
    position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between;
    padding: 17px 18px; border-bottom: 1px solid var(--line); background: var(--panel);
}
.dialog-head h2 { margin: 4px 0 0; }
.dialog-body { padding: 18px 18px calc(24px + var(--safe-bottom)); overflow-y: auto; }
.avatar-editor-row { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 13px; align-items: start; margin-bottom: 15px; }
.avatar-preview { width: 74px; height: 74px; overflow: hidden; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 22px; color: #071316; background: linear-gradient(145deg, hsl(var(--avatar-hue, 170) 72% 70%), hsl(calc(var(--avatar-hue, 170) + 45) 72% 62%)); font-size: 26px; font-weight: 900; }
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.avatar-upload { min-height: 38px; margin-bottom: 7px; }
.avatar-editor-row .secondary-button { width: 100%; min-height: 38px; }
.avatar-editor-row .hint { margin: 7px 0 0; }
.editor-dialog[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.entry-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 12px; }
.entry-toolbar .secondary-button { min-height: 38px; padding: 8px 12px; }
.world-entries-editor { display: grid; gap: 12px; margin-bottom: 16px; }
.world-entry-card { padding: 13px; border-radius: 15px; border: 1px solid var(--line); background: var(--field-bg); }
.world-entry-card .entry-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.world-entry-card .remove-entry { min-height: 34px; padding: 6px 10px; border-radius: 10px; color: #ffd9db; background: rgba(255,107,114,.12); border: 1px solid rgba(255,107,114,.22); }
.world-entry-card textarea { min-height: 100px; resize: vertical; }
.world-entry-card .toggle-row { padding-bottom: 0; }
.advanced-editor { margin: 4px 0 16px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.025); }
.advanced-editor summary { cursor: pointer; color: var(--accent-2); font-weight: 750; }
.advanced-editor[open] summary { margin-bottom: 14px; }
.prompt-inspector { margin: 0; padding: 14px; min-height: 260px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); background: var(--field-bg); border: 1px solid var(--line); border-radius: 13px; font: 12px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; }
.inspector-dialog { width: min(94vw, 800px); }

.toast {
    position: fixed; z-index: 40; left: 50%; bottom: calc(90px + var(--safe-bottom)); transform: translateX(-50%);
    max-width: calc(100vw - 30px); padding: 10px 14px; border-radius: 12px; color: var(--text); background: var(--secondary-bg);
    border: 1px solid var(--line); box-shadow: 0 14px 40px rgba(0,0,0,.35); text-align: center;
}

@media (min-width: 800px) {
    .chat { padding-inline: 28px; }
    .composer { padding-inline: max(18px, calc((100vw - 800px) / 2)); }
}

@media (max-width: 560px) {
    .story-dock-content { grid-template-columns: 1fr; }
}
