        :root {
            --bg-deep: #08060e;
            --bg: #0e0b16;
            --bg-card: rgba(18, 14, 28, 0.85);
            --border: rgba(212, 168, 83, 0.15);
            --border-hover: rgba(212, 168, 83, 0.4);
            --text: #e0d6c8;
            --text-muted: #8a7f72;
            --gold: #d4a853;
            --gold-light: #f5d98a;
            --gold-dark: #a07830;
            --crimson: #8b2252;
            --crimson-light: #c44570;
            --glow-gold: 0 0 30px rgba(212, 168, 83, 0.2);
            --font-display: 'Cinzel', serif;
            --font-body: 'Inter', Arial, sans-serif;
            --topbar-h: 64px;
        }

        * { box-sizing: border-box; margin: 0; padding: 0; }

        html { scroll-behavior: smooth; }

        body {
            font-family: var(--font-body);
            color: var(--text);
            background: var(--bg-deep);
            background-image:
                radial-gradient(900px 500px at 80% -10%, rgba(139, 34, 82, 0.12), transparent 60%),
                radial-gradient(700px 400px at -10% 10%, rgba(212, 168, 83, 0.07), transparent 60%);
            min-height: 100vh;
            line-height: 1.6;
        }

        ::-webkit-scrollbar { width: 9px; height: 9px; }
        ::-webkit-scrollbar-track { background: transparent; }
        ::-webkit-scrollbar-thumb { background: var(--gold-dark); border-radius: 4px; }

        a { color: inherit; text-decoration: none; }
        code {
            font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
            background: rgba(212, 168, 83, 0.1);
            border: 1px solid rgba(212, 168, 83, 0.2);
            color: var(--gold-light);
            padding: 1px 6px;
            border-radius: 6px;
            font-size: 0.9em;
        }

        /* ─── Topbar ─── */
        .topbar {
            position: sticky;
            top: 0;
            z-index: 50;
            height: var(--topbar-h);
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0 24px;
            background: rgba(8, 6, 14, 0.82);
            backdrop-filter: blur(12px);
            border-bottom: 1px solid var(--border);
        }

        .topbar-logo {
            font-family: var(--font-display);
            font-size: 22px;
            font-weight: 900;
            color: var(--gold);
            letter-spacing: 0.02em;
        }
        .topbar-logo span { color: var(--crimson-light); }

        .topbar-back {
            display: inline-flex;
            align-items: center;
            gap: 7px;
            font-size: 14px;
            font-weight: 600;
            color: var(--text-muted);
            padding: 8px 14px;
            border: 1px solid var(--border);
            border-radius: 10px;
            transition: color 0.25s, border-color 0.25s;
        }
        .topbar-back:hover { color: var(--gold-light); border-color: var(--border-hover); }

        /* ─── Layout ─── */
        .qwrap {
            max-width: 1240px;
            margin: 0 auto;
            display: flex;
            gap: 36px;
            padding: 36px 24px 80px;
            align-items: flex-start;
        }

        /* ─── Sidebar ─── */
        .qsidebar {
            width: 268px;
            flex-shrink: 0;
            position: sticky;
            top: calc(var(--topbar-h) + 24px);
            align-self: flex-start;
            max-height: calc(100vh - var(--topbar-h) - 48px);
            overflow-y: auto;
            padding: 20px;
            border-radius: 18px;
            background: var(--bg-card);
            border: 1px solid var(--border);
            backdrop-filter: blur(8px);
        }

        .qside-title {
            font-family: var(--font-display);
            font-size: 13px;
            font-weight: 700;
            letter-spacing: 0.16em;
            text-transform: uppercase;
            color: var(--gold);
            margin-bottom: 16px;
        }

        .qside-group {
            font-size: 11px;
            font-weight: 700;
            letter-spacing: 0.1em;
            text-transform: uppercase;
            color: var(--text-muted);
            margin: 6px 0 10px;
        }

        .qquest {
            display: flex;
            align-items: center;
            gap: 9px;
            padding: 10px 12px;
            border-radius: 12px;
            font-weight: 600;
            font-size: 14px;
            color: var(--text);
            background: rgba(212, 168, 83, 0.08);
            border: 1px solid rgba(212, 168, 83, 0.2);
            margin-bottom: 12px;
        }
        .qquest .ico { font-size: 17px; }

        .qtoc { list-style: none; display: flex; flex-direction: column; gap: 2px; }
        .qtoc a {
            display: block;
            padding: 8px 12px 8px 16px;
            font-size: 13.5px;
            color: var(--text-muted);
            border-left: 2px solid transparent;
            border-radius: 0 8px 8px 0;
            transition: color 0.2s, background 0.2s, border-color 0.2s;
        }
        .qtoc a:hover { color: var(--gold-light); background: rgba(212, 168, 83, 0.05); }
        .qtoc a.active {
            color: var(--gold-light);
            border-left-color: var(--gold);
            background: rgba(212, 168, 83, 0.08);
            font-weight: 600;
        }

        /* ─── Content ─── */
        .qcontent { flex: 1; min-width: 0; }

        .qhead { margin-bottom: 36px; }
        .qhead h1 {
            font-family: var(--font-display);
            font-size: clamp(30px, 5vw, 46px);
            font-weight: 700;
            margin-bottom: 12px;
            background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 45%, var(--crimson-light) 100%);
            -webkit-background-clip: text;
            background-clip: text;
            -webkit-text-fill-color: transparent;
        }
        .qhead p { color: var(--text-muted); font-size: 16px; max-width: 720px; }

        .qsec {
            scroll-margin-top: calc(var(--topbar-h) + 20px);
            padding: 26px 0;
            border-top: 1px solid var(--border);
        }
        .qsec:first-of-type { border-top: none; padding-top: 0; }

        .qh2 {
            font-family: var(--font-display);
            font-size: clamp(20px, 3vw, 26px);
            font-weight: 700;
            color: var(--text);
            margin-bottom: 14px;
        }
        .qsec p { color: var(--text-muted); font-size: 15px; margin-bottom: 14px; }
        .qsec p strong { color: var(--text); font-weight: 600; }
        .qsec ul { color: var(--text-muted); font-size: 15px; margin: 0 0 14px 2px; list-style: none; }
        .qsec ul li { padding: 4px 0 4px 18px; position: relative; }
        .qsec ul li::before { content: "•"; color: var(--gold); position: absolute; left: 0; }

        /* Quick chain */
        .qchain {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 8px;
            margin-top: 8px;
        }
        .qchain-step {
            padding: 8px 14px;
            border-radius: 10px;
            background: var(--bg-card);
            border: 1px solid var(--border);
            font-size: 13px;
            font-weight: 600;
            color: var(--gold-light);
        }
        .qchain-arrow { color: var(--text-muted); font-size: 15px; }

        /* Item chips */
        .item-grid { display: flex; flex-wrap: wrap; gap: 9px; margin: 4px 0 6px; }
        .item-chip {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            font-size: 13px;
            color: var(--text);
            background: rgba(255, 255, 255, 0.03);
            border: 1px solid var(--border);
            padding: 6px 11px;
            border-radius: 11px;
        }
        .item-chip img { width: 24px; height: 24px; image-rendering: pixelated; filter: drop-shadow(0 1px 2px rgba(0,0,0,.5)); }
        .item-label { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); margin: 14px 0 7px; }

        /* NPC location */
        .npc-line {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 9px;
            margin-top: 6px;
            font-size: 14px;
            color: var(--text-muted);
        }
        .npc-name { color: var(--text); font-weight: 600; }
        .npc-loc {
            font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
            background: rgba(212, 168, 83, 0.1);
            border: 1px solid rgba(212, 168, 83, 0.22);
            color: var(--gold-light);
            padding: 2px 9px;
            border-radius: 8px;
            font-size: 12.5px;
            white-space: nowrap;
        }

        /* Callout */
        .callout {
            margin-top: 18px;
            padding: 18px 20px;
            border-radius: 14px;
            background: rgba(139, 34, 82, 0.07);
            border: 1px solid rgba(139, 34, 82, 0.22);
        }
        .callout h3 {
            font-family: var(--font-display);
            font-size: 15px;
            color: var(--crimson-light);
            margin-bottom: 7px;
        }
        .callout p { font-size: 14px; margin: 0; }

        /* Dye recipe cards */
        .dye-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(238px, 1fr));
            gap: 15px;
            margin-top: 18px;
        }
        .dye-card {
            padding: 17px 18px;
            border-radius: 15px;
            background: var(--bg-card);
            border: 1px solid var(--border);
            transition: border-color 0.3s, box-shadow 0.3s, transform 0.3s;
        }
        .dye-card:hover { border-color: var(--border-hover); box-shadow: var(--glow-gold); transform: translateY(-2px); }
        .dye-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 13px; }
        .dye-card-head > img { width: 34px; height: 34px; image-rendering: pixelated; flex-shrink: 0; }
        .dye-swatch { width: 13px; height: 13px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.25); flex-shrink: 0; }
        .dye-card-name { font-family: var(--font-display); font-size: 14.5px; font-weight: 700; color: var(--gold-light); line-height: 1.2; }
        .dye-ingredients { display: flex; flex-wrap: wrap; gap: 7px; }
        .dye-ing { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; color: var(--text-muted); }
        .dye-ing img { width: 21px; height: 21px; image-rendering: pixelated; }
        .dye-ing b { color: var(--text); font-weight: 600; }
        .dye-cost { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 13px; font-weight: 700; color: var(--gold); }

        /* ─── Responsive ─── */
        @media (max-width: 880px) {
            .qwrap { flex-direction: column; gap: 22px; padding: 22px 16px 60px; }
            .qsidebar {
                position: static;
                width: 100%;
                max-height: none;
            }
            .qtoc { flex-direction: row; flex-wrap: wrap; gap: 6px; }
            .qtoc a { border-left: none; border: 1px solid var(--border); border-radius: 9px; padding: 7px 11px; }
            .qtoc a.active { border-color: var(--border-hover); }
        }
