        :root,
        html[data-theme="light"] {
            color-scheme: light;
            --ink-bg: 246 243 236;
            --ink-card: 255 253 249;
            --ink-elevated: 244 240 232;
            --ink-input: 238 233 223;
            --ink-border: 211 202 185;
            --ink-deep: 39 30 17;
            --gold: 157 109 30;
            --gold-light: 181 128 37;
            --gold-muted: 125 94 45;
            --gold-dim: 151 133 101;
            --primary-top: 235 199 124;
            --primary-bottom: 207 153 57;
            --editor-surface: 250 247 241;
            --preview-surface: 253 251 247;
            --cream: 43 45 39;
            --cream-muted: 91 91 81;
            --cream-subtle: 125 122 109;
            --success: 50 119 77;
            --danger: 178 67 58;
            --page-glow: rgba(190, 137, 49, 0.13);
            --panel-border: rgba(92, 75, 49, 0.13);
            --panel-shadow: 0 18px 50px rgba(79, 61, 35, 0.08), 0 2px 8px rgba(79, 61, 35, 0.05);
            --terminal: 31 35 31;
        }
        html[data-theme="dark"] {
            color-scheme: dark;
            --ink-bg: 18 21 18;
            --ink-card: 25 29 25;
            --ink-elevated: 30 35 30;
            --ink-input: 36 42 36;
            --ink-border: 55 63 55;
            --ink-deep: 28 22 10;
            --gold: 202 164 92;
            --gold-light: 226 198 139;
            --gold-muted: 164 139 88;
            --gold-dim: 112 100 72;
            --primary-top: 226 198 139;
            --primary-bottom: 202 164 92;
            --editor-surface: 36 42 36;
            --preview-surface: 30 35 30;
            --cream: 222 219 204;
            --cream-muted: 166 164 150;
            --cream-subtle: 122 126 114;
            --success: 111 166 121;
            --danger: 204 106 95;
            --page-glow: rgba(202, 164, 92, 0.08);
            --panel-border: rgba(235, 230, 207, 0.055);
            --panel-shadow: 0 20px 55px rgba(0, 0, 0, 0.22), 0 2px 8px rgba(0, 0, 0, 0.18);
            --terminal: 12 15 13;
        }
        * { scrollbar-width: thin; scrollbar-color: rgb(var(--ink-border)) transparent; }
        ::selection { color: rgb(var(--ink-deep)); background: rgb(var(--gold) / 0.42); }
        ::-webkit-scrollbar { width: 6px; height: 6px; }
        ::-webkit-scrollbar-track { background: transparent; }
        ::-webkit-scrollbar-thumb { background: rgb(var(--ink-border)); border-radius: 999px; }
        ::-webkit-scrollbar-thumb:hover { background: rgb(var(--gold-muted) / 0.72); }
        html, body { min-height: 100%; background: rgb(var(--ink-bg)); transition: background-color .28s ease, color .28s ease; }
        body { letter-spacing: 0.006em; }
        body::before {
            content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0;
            background:
                radial-gradient(ellipse 70% 55% at 12% -8%, var(--page-glow) 0%, transparent 72%),
                radial-gradient(ellipse 55% 42% at 92% 92%, rgb(var(--success) / 0.045) 0%, transparent 72%);
        }
        body::after {
            content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .32;
            background-image: linear-gradient(rgb(var(--cream) / .018) 1px, transparent 1px), linear-gradient(90deg, rgb(var(--cream) / .018) 1px, transparent 1px);
            background-size: 28px 28px;
            mask-image: linear-gradient(to bottom, black, transparent 72%);
        }
        html[data-theme="light"] body::after { opacity: .55; }
        [x-cloak] { display: none !important; }
        button, input, textarea, select { font: inherit; }
        button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
            outline: 2px solid rgb(var(--gold) / .78); outline-offset: 2px;
        }
        .ink-card {
            background: rgb(var(--ink-card) / .9);
            border: 1px solid var(--panel-border);
            box-shadow: var(--panel-shadow);
            backdrop-filter: blur(18px) saturate(115%);
            transition: background-color .28s ease, border-color .28s ease, box-shadow .28s ease;
        }
        .app-header { position: relative; overflow: hidden; }
        .app-header::after {
            content: ''; position: absolute; inset: auto 0 0; height: 1px;
            background: linear-gradient(90deg, transparent, rgb(var(--gold) / .45), transparent);
        }
        .brand-logo { filter: drop-shadow(0 8px 16px rgb(var(--gold) / .08)); }
        .brand-logo .logo-shell { fill: rgb(var(--ink-deep)); }
        .brand-logo .logo-hub-text { fill: rgb(var(--ink-deep)); }
        .drag-ghost { opacity: .28; background: rgb(var(--ink-input)) !important; border: 1px dashed rgb(var(--gold)) !important; }
        .gold-glow:focus-within { box-shadow: 0 0 0 1px rgb(var(--gold) / .42), 0 0 0 4px rgb(var(--gold) / .08); }
        .toggle-track { transition: background-color .25s ease; }
        .toggle-dot { transition: transform .25s cubic-bezier(.34,1.56,.64,1); }
        .theme-toggle {
            display: inline-flex; align-items: center; gap: .55rem; min-height: 40px; padding: .45rem .72rem;
            color: rgb(var(--cream-muted)); background: rgb(var(--ink-input) / .72);
            border: 1px solid var(--panel-border); border-radius: .75rem;
            transition: color .2s ease, background-color .2s ease, border-color .2s ease, transform .2s ease;
        }
        .theme-toggle:hover { color: rgb(var(--cream)); background: rgb(var(--ink-input)); border-color: rgb(var(--gold) / .28); transform: translateY(-1px); }
        .theme-toggle-icon { width: 1rem; height: 1rem; color: rgb(var(--gold)); }
        .primary-action {
            color: rgb(var(--ink-deep)); background: linear-gradient(180deg, rgb(var(--primary-top)), rgb(var(--primary-bottom)));
            box-shadow: 0 9px 24px rgb(var(--gold) / .19), inset 0 1px 0 rgb(255 255 255 / .25);
        }
        .primary-action:hover { filter: saturate(1.06) brightness(1.04); box-shadow: 0 12px 30px rgb(var(--gold) / .28); transform: translateY(-1px); }
        .primary-action:active { transform: scale(.97); }
        .secondary-action { box-shadow: inset 0 1px 0 rgb(var(--cream) / .025); }
        .editor-surface { background-color: rgb(var(--editor-surface)) !important; }
        .preview-surface { background-color: rgb(var(--preview-surface)) !important; }
        .terminal-panel { background: rgb(var(--terminal)); border: 1px solid rgb(var(--cream) / .055); }
        .soft-gold-panel { background: rgb(var(--gold) / .055) !important; }
        .soft-panel { background: rgb(var(--cream) / .025) !important; }
        select option { background-color: rgb(var(--ink-card)); color: rgb(var(--cream)); }
        html[data-theme="light"] [class*="border-white"] { border-color: rgb(75 65 50 / .12) !important; }
        html[data-theme="light"] [class*="hover:border-white"]:hover { border-color: rgb(75 65 50 / .22) !important; }
        .prose mjx-container { outline: none !important; }
        .prose mjx-container svg { max-width: none !important; height: auto !important; display: inline !important; }
        mjx-container:not([display="true"]) { display: inline-block !important; margin: 0 !important; }
        mjx-container[display="true"] { margin: .75em 0 !important; }
        html[data-theme="light"] .prose-invert {
            --tw-prose-body: rgb(var(--cream)); --tw-prose-headings: rgb(var(--cream));
            --tw-prose-lead: rgb(var(--cream-muted)); --tw-prose-links: rgb(var(--gold));
            --tw-prose-bold: rgb(var(--cream)); --tw-prose-counters: rgb(var(--cream-subtle));
            --tw-prose-bullets: rgb(var(--gold-muted)); --tw-prose-hr: rgb(var(--ink-border));
            --tw-prose-quotes: rgb(var(--cream)); --tw-prose-quote-borders: rgb(var(--gold));
            --tw-prose-captions: rgb(var(--cream-subtle)); --tw-prose-code: rgb(var(--cream));
            --tw-prose-pre-code: rgb(var(--cream)); --tw-prose-pre-bg: rgb(var(--ink-elevated));
            --tw-prose-th-borders: rgb(var(--ink-border)); --tw-prose-td-borders: rgb(var(--ink-border));
        }
        .workspace-shell { height: calc(100vh - 140px); }
        @media (max-width: 1023px) {
            .app-header { align-items: flex-start; }
            .header-actions { width: 100%; justify-content: flex-end; }
            .workspace-shell { height: auto; flex-direction: column; }
            .problem-sidebar { width: 100% !important; max-height: 280px; }
            .workspace-panel { min-height: 720px; }
        }
        @media (max-width: 640px) {
            .header-actions { justify-content: flex-start; }
            .workspace-panel { min-height: 760px; padding: 1rem; }
            .app-header > div:first-child { align-items: flex-start; gap: .8rem; }
            .brand-logo { width: 8.4rem; height: auto; margin-top: .15rem; }
        }
        @media (prefers-reduced-motion: reduce) {
            *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
        }

.logo-text { font-family: "New Computer Modern Mono", "Courier New", monospace; font-weight: bold; font-size: 64px; }
