
        :root {
            --candle-glow: rgba(235, 175, 75, 0.22);
            --bull-emerald: #10b981;
            --bull-deep: #065f46;
            --bear-crimson: #991b1b;
            --gold-foil: #d4af37;
            --brass-mid: #9c7a3c;
            --brass-dark: #4a3718;
            --ledger-paper: #f3ead8;
            --ledger-grid: rgba(16, 105, 80, 0.08);
            --ink-primary: #1c1915;
            --ink-crimson: #7f1d1d;
            --ink-emerald: #064e3b;
        }

        * {
            box-sizing: border-box;
            user-select: none;
        }

        input, textarea, select {
            user-select: text;
        }

        body {
            margin: 0;
            padding: 0;
            min-height: 100vh;
            background-color: #090706;
            color: var(--ledger-paper);
            font-family: 'Cormorant Garamond', Georgia, serif;
            overflow: hidden;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            position: relative;
        }

        /* Moody Mahogany Desk & Flickering Banker's Lamp / Candle Ambiance */
        .study-surface {
            position: fixed;
            inset: 0;
            background: 
                radial-gradient(circle at 82% 16%, rgba(245, 180, 66, 0.26) 0%, rgba(180, 95, 25, 0.12) 24%, transparent 55%),
                radial-gradient(circle at 50% 52%, rgba(32, 22, 16, 0.88) 0%, #070504 85%),
                repeating-linear-gradient(90deg, rgba(255,255,255,0.012) 0px, rgba(255,255,255,0.012) 2px, transparent 2px, transparent 16px);
            z-index: 0;
            transition: filter 0.8s ease;
        }

        .study-surface.arcane-mode {
            background: 
                radial-gradient(circle at 50% 50%, rgba(16, 185, 129, 0.18) 0%, rgba(6, 78, 59, 0.14) 38%, transparent 72%),
                radial-gradient(circle at 82% 16%, rgba(212, 175, 55, 0.16) 0%, transparent 45%),
                #040807;
        }

        /* Ambient Flickering Brass Candle on Study Desk */
        .candle-container {
            position: fixed;
            top: 22px;
            right: 34px;
            width: 56px;
            height: 56px;
            border-radius: 50%;
            background: radial-gradient(circle, #3c2a1a 60%, #1c130b 100%);
            border: 2px solid #8c6a32;
            box-shadow: 0 0 35px rgba(245, 175, 60, 0.42), inset 0 0 12px #000;
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 5;
            pointer-events: none;
        }

        .candle-wax {
            width: 42px;
            height: 42px;
            border-radius: 50%;
            background: radial-gradient(circle at 50% 50%, #ffdf9e 0%, #c88a3b 45%, #5a3816 95%);
            position: relative;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .candle-flame {
            width: 11px;
            height: 21px;
            background: radial-gradient(ellipse at bottom, #ffffff 10%, #ffdd55 45%, #ff6a00 85%, transparent 100%);
            border-radius: 50% 50% 50% 50% / 65% 65% 35% 35%;
            transform-origin: bottom center;
            animation: flicker 2.8s infinite alternate ease-in-out;
            box-shadow: 0 0 18px #ffaa22, 0 0 36px #ff6600;
        }

        @keyframes flicker {
            0%, 100% { transform: scale(1) rotate(-1deg); opacity: 0.95; }
            25% { transform: scale(1.06, 0.96) rotate(2deg); opacity: 1; }
            50% { transform: scale(0.95, 1.05) rotate(-2deg); opacity: 0.88; }
            75% { transform: scale(1.04, 0.98) rotate(1deg); opacity: 0.98; }
        }

        /* Subtle Ambient Live Market Ticker Strip */
        .market-ticker-ribbon {
            position: fixed;
            bottom: 54px;
            left: 50%;
            transform: translateX(-50%);
            width: min(920px, 92vw);
            overflow: hidden;
            font-family: 'JetBrains Mono', monospace;
            font-size: 0.68rem;
            color: rgba(212, 175, 55, 0.72);
            background: rgba(12, 10, 8, 0.65);
            border-top: 1px solid rgba(212, 175, 55, 0.22);
            border-bottom: 1px solid rgba(212, 175, 55, 0.22);
            padding: 3px 0;
            z-index: 15;
            pointer-events: none;
            white-space: nowrap;
        }

        .ticker-track {
            display: inline-block;
            animation: tickerScroll 36s linear infinite;
        }

        @keyframes tickerScroll {
            0% { transform: translateX(0%); }
            100% { transform: translateX(-50%); }
        }

        /* Particle Canvas */
        #magic-particles {
            position: fixed;
            inset: 0;
            pointer-events: none;
            z-index: 40;
        }

        /* Top Trading Codex HUD / Controls */
        .grimoire-toolbar {
            position: fixed;
            top: 12px;
            left: 50%;
            transform: translateX(-50%);
            z-index: 50;
            display: flex;
            flex-wrap: wrap;
            gap: 7px;
            align-items: center;
            justify-content: center;
            background: rgba(15, 12, 10, 0.88);
            backdrop-filter: blur(8px);
            border: 1px solid rgba(180, 140, 68, 0.48);
            padding: 6px 14px;
            border-radius: 999px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.85), inset 0 0 12px rgba(212, 175, 55, 0.14);
            max-width: 96vw;
        }

        .arcane-btn {
            font-family: 'Cinzel', serif;
            font-size: 0.73rem;
            font-weight: 700;
            letter-spacing: 0.05em;
            color: #ebd6ad;
            background: linear-gradient(180deg, #282019 0%, #15110d 100%);
            border: 1px solid #82642f;
            padding: 5px 11px;
            border-radius: 999px;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            gap: 5px;
            transition: all 0.25s ease;
            white-space: nowrap;
        }

        .arcane-btn:hover {
            border-color: #e5c16c;
            color: #fff;
            box-shadow: 0 0 14px rgba(212, 175, 55, 0.45);
            transform: translateY(-1px);
        }

        .arcane-btn.emerald-accent {
            border-color: #10b981;
            background: linear-gradient(180deg, #0d2b22 0%, #071712 100%);
            color: #6ee7b7;
        }

        .arcane-btn.emerald-accent:hover {
            border-color: #34d399;
            box-shadow: 0 0 16px rgba(16, 185, 129, 0.55);
            color: #ffffff;
        }

        /* 3D Book Stage */
        .book-stage {
            position: relative;
            width: 94vw;
            max-width: 1140px;
            height: 75vh;
            max-height: 720px;
            min-height: 490px;
            perspective: 2400px;
            z-index: 10;
            display: flex;
            align-items: center;
            justify-content: center;
            margin-top: 18px;
        }

        /* ================= CLOSED MOKAUS BOOK COVER (INTEGRATED PICTURE) ================= */
        .closed-grimoire {
            position: relative;
            width: min(465px, 86vw);
            aspect-ratio: 896 / 1200;
            height: auto;
            max-height: 75vh;
            border-radius: 8px 18px 18px 8px;
            background-color: #141a15;
            box-shadow:
                -14px 22px 45px rgba(0, 0, 0, 0.94),
                0 0 28px rgba(212, 175, 55, 0.24),
                10px 8px 0 #d6c5a3,
                13px 11px 0 #9c865e,
                16px 14px 0 #c7b48e,
                19px 17px 25px rgba(0,0,0,0.88);
            border: 2px solid #785826;
            cursor: pointer;
            transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.6s ease, box-shadow 0.4s ease;
            transform-style: preserve-3d;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 0;
            overflow: hidden;
        }

        .book-cover-artwork {
            width: 100%;
            height: 100%;
            object-fit: cover;
            object-position: center;
            display: block;
            border-radius: 6px 16px 16px 6px;
            pointer-events: none;
            transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1), filter 0.4s ease;
        }

        .closed-grimoire:hover .book-cover-artwork {
            transform: scale(1.018);
            filter: brightness(1.05) contrast(1.03);
        }

        .cover-sheen-overlay {
            position: absolute;
            inset: 0;
            background: linear-gradient(115deg, transparent 25%, rgba(255, 232, 165, 0.14) 48%, rgba(16, 185, 129, 0.08) 54%, transparent 75%);
            opacity: 0;
            transition: opacity 0.4s ease;
            pointer-events: none;
        }
        .closed-grimoire:hover .cover-sheen-overlay {
            opacity: 1;
        }

        .cover-unseal-pill {
            position: absolute;
            bottom: 12px;
            left: 54%;
            transform: translateX(-50%);
            background: rgba(12, 10, 8, 0.85);
            backdrop-filter: blur(4px);
            border: 1px solid rgba(212, 175, 55, 0.65);
            color: #f3dc96;
            font-family: 'Cinzel', serif;
            font-size: 0.65rem;
            font-weight: 700;
            letter-spacing: 0.14em;
            text-transform: uppercase;
            padding: 4px 12px;
            border-radius: 999px;
            box-shadow: 0 4px 14px rgba(0, 0, 0, 0.9);
            opacity: 0.88;
            transition: all 0.3s ease;
            pointer-events: none;
            white-space: nowrap;
        }
        .closed-grimoire:hover .cover-unseal-pill {
            opacity: 1;
            border-color: #34d399;
            color: #a7f3d0;
            box-shadow: 0 0 16px rgba(16, 185, 129, 0.55);
        }

        .closed-grimoire:hover {
            transform: translateY(-6px) rotateY(-4deg) rotateX(2deg);
            box-shadow:
                -18px 28px 55px rgba(0, 0, 0, 0.95),
                0 0 38px rgba(212, 175, 55, 0.32),
                inset 16px 0 24px rgba(0, 0, 0, 0.85),
                12px 10px 0 #d6c5a3,
                15px 13px 0 #9c865e,
                18px 16px 0 #c7b48e;
        }

        .closed-grimoire.opening {
            transform: rotateY(-85deg) scale(1.06);
            opacity: 0;
            pointer-events: none;
        }

        .closed-grimoire.hidden-state {
            display: none;
        }

        /* Leather Spine Ribs */
        .spine-ridges {
            position: absolute;
            left: 0;
            top: 0;
            bottom: 0;
            width: 44px;
            background: linear-gradient(90deg, #090605 0%, #261a14 45%, #0d0907 100%);
            border-right: 2px solid #7c5c26;
            display: flex;
            flex-direction: column;
            justify-content: space-evenly;
            padding: 25px 0;
            z-index: 2;
        }

        .spine-rib {
            height: 12px;
            width: 100%;
            background: linear-gradient(180deg, #4a3718 0%, #c9a24b 45%, #2e200c 100%);
            box-shadow: 0 3px 6px rgba(0,0,0,0.85);
        }

        /* Antique Brass Corner Protectors */
        .corner-clasp {
            position: absolute;
            width: 78px;
            height: 78px;
            z-index: 4;
            pointer-events: none;
            filter: drop-shadow(2px 4px 5px rgba(0,0,0,0.85));
        }
        .corner-tl { top: 4px; left: 38px; }
        .corner-tr { top: 4px; right: 4px; transform: scaleX(-1); }
        .corner-bl { bottom: 4px; left: 38px; transform: scaleY(-1); }
        .corner-br { bottom: 4px; right: 4px; transform: scale(-1, -1); }

        /* Embossed Gold-Foil Ledger Frame */
        .cover-filigree-border {
            position: absolute;
            inset: 18px 18px 18px 54px;
            border: 2px solid #9c7a3c;
            border-radius: 6px 14px 14px 6px;
            box-shadow: inset 0 0 18px rgba(0,0,0,0.9), 0 0 8px rgba(212,175,55,0.25);
            pointer-events: none;
        }

        .cover-filigree-border::after {
            content: '';
            position: absolute;
            inset: 6px;
            border: 1px dashed rgba(212, 175, 55, 0.5);
            border-radius: 4px 10px 10px 4px;
        }

        /* Central Gold-Foil Candlestick & Compass Astrolabe Medallion */
        .astrolabe-medallion {
            position: relative;
            width: 224px;
            height: 224px;
            margin-left: 28px;
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 5;
            transition: transform 0.5s ease;
        }

        .closed-grimoire:hover .astrolabe-medallion {
            transform: scale(1.04);
        }

        .astrolabe-ring-outer {
            position: absolute;
            inset: 0;
            animation: spinSlow 48s linear infinite;
        }

        .astrolabe-ring-inner {
            position: absolute;
            inset: 28px;
            animation: spinReverse 32s linear infinite;
        }

        .emerald-seal-core {
            width: 84px;
            height: 84px;
            border-radius: 50%;
            background: radial-gradient(circle at 35% 30%, #6ee7b7 0%, #059669 36%, #064e3b 76%, #021f17 100%);
            border: 4px solid #d4af37;
            box-shadow:
                0 0 25px rgba(16, 185, 129, 0.7),
                0 0 55px rgba(212, 175, 55, 0.35),
                inset 0 0 16px rgba(255, 255, 255, 0.55);
            position: relative;
            display: flex;
            align-items: center;
            justify-content: center;
            animation: emeraldPulse 3.5s infinite ease-in-out;
        }

        @keyframes spinSlow {
            from { transform: rotate(0deg); }
            to { transform: rotate(360deg); }
        }
        @keyframes spinReverse {
            from { transform: rotate(360deg); }
            to { transform: rotate(0deg); }
        }
        @keyframes emeraldPulse {
            0%, 100% { box-shadow: 0 0 22px rgba(16, 185, 129, 0.65), 0 0 45px rgba(212, 175, 55, 0.28), inset 0 0 14px rgba(255,255,255,0.5); }
            50% { box-shadow: 0 0 36px rgba(52, 211, 153, 0.92), 0 0 70px rgba(212, 175, 55, 0.52), inset 0 0 20px rgba(255,255,255,0.8); }
        }

        .cover-title-plate {
            margin-left: 28px;
            margin-top: 16px;
            text-align: center;
            z-index: 5;
            padding: 0 18px;
        }

        .cover-title-text {
            font-family: 'Cinzel Decorative', serif;
            font-size: 1.28rem;
            font-weight: 900;
            letter-spacing: 0.12em;
            color: #e3c16f;
            text-shadow: 0 2px 4px #000, 0 0 14px rgba(212, 175, 55, 0.4);
        }

        .cover-deck-text {
            font-family: 'Cinzel', serif;
            font-size: 0.7rem;
            font-weight: 700;
            letter-spacing: 0.16em;
            color: #c5a872;
            margin-top: 4px;
        }

        .cover-subtitle-text {
            font-family: 'JetBrains Mono', monospace;
            font-size: 0.7rem;
            letter-spacing: 0.12em;
            color: #6ee7b7;
            margin-top: 10px;
            text-transform: uppercase;
            animation: pulseText 2.4s infinite ease-in-out;
        }

        @keyframes pulseText {
            0%, 100% { opacity: 0.7; }
            50% { opacity: 1; text-shadow: 0 0 10px rgba(52, 211, 153, 0.85); }
        }

        /* ================= OPEN AGED LEDGER SPREAD ================= */
        .open-grimoire {
            position: relative;
            width: 100%;
            height: 100%;
            background: linear-gradient(135deg, #241913 0%, #120c09 50%, #211711 100%);
            border-radius: 14px;
            padding: 14px 18px;
            box-shadow:
                0 28px 65px rgba(0, 0, 0, 0.95),
                0 0 0 3px #6b4e22,
                0 0 0 6px #17120e,
                inset 0 0 30px rgba(0, 0, 0, 0.9);
            display: none;
            opacity: 0;
            transform: scale(0.94);
            transition: opacity 0.65s ease, transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
            transform-style: preserve-3d;
        }

        .open-grimoire.visible {
            display: flex;
        }

        .open-grimoire.active {
            opacity: 1;
            transform: scale(1);
        }

        /* Layered Paper Thickness Stacks */
        .page-stack-left, .page-stack-right {
            position: relative;
            flex: 1;
            height: 100%;
            display: flex;
            background: #c7b48e;
            border-radius: 6px;
            transition: padding 0.3s ease;
        }

        .page-stack-left {
            padding-left: var(--left-stack, 10px);
            background: repeating-linear-gradient(90deg, #9c865e 0px, #e3d5b8 2px, #856e48 3px);
            border-radius: 8px 2px 2px 8px;
            box-shadow: -4px 4px 12px rgba(0,0,0,0.65);
        }

        .page-stack-right {
            padding-right: var(--right-stack, 12px);
            background: repeating-linear-gradient(90deg, #856e48 0px, #e3d5b8 2px, #9c865e 3px);
            border-radius: 2px 8px 8px 2px;
            box-shadow: 4px 4px 12px rgba(0,0,0,0.65);
        }

        /* Individual Ruled Antique Financial Ledger Sheet */
        .parchment-page {
            position: relative;
            width: 100%;
            height: 100%;
            background-color: var(--ledger-paper);
            background-image:
                radial-gradient(circle at 50% 50%, rgba(255, 252, 242, 0.55) 0%, rgba(212, 188, 142, 0.35) 82%, rgba(145, 112, 62, 0.58) 100%),
                linear-gradient(to right, rgba(153, 27, 27, 0.14) 1px, transparent 1px),
                repeating-linear-gradient(0deg, transparent 0px, transparent 23px, rgba(6, 95, 70, 0.08) 24px);
            background-size: 100% 100%, 100% 100%, 100% 24px;
            background-position: 0 0, 22px 0, 0 0;
            color: var(--ink-primary);
            padding: 24px 30px 38px 32px;
            overflow-y: auto;
            overflow-x: hidden;
            scrollbar-width: thin;
            scrollbar-color: #8c6a38 transparent;
        }

        .parchment-page::-webkit-scrollbar {
            width: 5px;
        }
        .parchment-page::-webkit-scrollbar-thumb {
            background: rgba(120, 86, 40, 0.45);
            border-radius: 4px;
        }

        .left-sheet {
            border-radius: 6px 0 0 6px;
            box-shadow:
                inset -24px 0 32px -12px rgba(45, 28, 10, 0.4),
                inset 4px 0 12px rgba(95, 68, 30, 0.22);
            border-right: 1px solid rgba(75, 50, 20, 0.35);
        }

        .right-sheet {
            border-radius: 0 6px 6px 0;
            box-shadow:
                inset 24px 0 32px -12px rgba(45, 28, 10, 0.4),
                inset -4px 0 12px rgba(95, 68, 30, 0.22);
        }

        /* Central Spine Crease & Emerald/Gold Silk Bookmark Ribbon */
        .center-spine-crease {
            position: absolute;
            top: 12px;
            bottom: 12px;
            left: 50%;
            width: 34px;
            transform: translateX(-50%);
            background: linear-gradient(90deg, 
                transparent 0%, 
                rgba(30, 18, 6, 0.22) 32%, 
                rgba(15, 8, 2, 0.55) 50%, 
                rgba(30, 18, 6, 0.22) 68%, 
                transparent 100%);
            pointer-events: none;
            z-index: 25;
        }

        .silk-ribbon {
            position: absolute;
            top: -6px;
            left: 50%;
            transform: translateX(-50%);
            width: 14px;
            height: calc(100% + 26px);
            background: linear-gradient(90deg, #032b20 0%, #065f46 45%, #d4af37 50%, #065f46 55%, #021f17 100%);
            z-index: 26;
            pointer-events: none;
            box-shadow: 2px 4px 8px rgba(0,0,0,0.65);
            clip-path: polygon(0 0, 100% 0, 100% 96%, 50% 100%, 0 96%);
        }

        /* 3D Animated Turning Leaf Overlay */
        .turning-leaf {
            position: absolute;
            top: 14px;
            bottom: 14px;
            width: calc(50% - 18px);
            background-color: var(--ledger-paper);
            background-image: radial-gradient(circle at 50% 50%, rgba(255, 252, 242, 0.55) 0%, rgba(195, 165, 112, 0.55) 100%);
            z-index: 35;
            pointer-events: none;
            display: none;
            backface-visibility: hidden;
            box-shadow: 0 12px 35px rgba(0, 0, 0, 0.55);
            padding: 24px 30px;
            overflow: hidden;
            color: var(--ink-primary);
        }

        .turning-leaf.flip-next {
            display: block;
            right: 18px;
            transform-origin: left center;
            border-radius: 0 6px 6px 0;
            animation: pageFlipNext 0.68s cubic-bezier(0.45, 0.05, 0.55, 0.95) forwards;
        }

        .turning-leaf.flip-prev {
            display: block;
            left: 18px;
            transform-origin: right center;
            border-radius: 6px 0 0 6px;
            animation: pageFlipPrev 0.68s cubic-bezier(0.45, 0.05, 0.55, 0.95) forwards;
        }

        @keyframes pageFlipNext {
            0% { transform: rotateY(0deg) skewY(0deg); filter: brightness(1); }
            45% { transform: rotateY(-85deg) skewY(-3deg); filter: brightness(0.84); box-shadow: -25px 15px 40px rgba(0,0,0,0.6); }
            100% { transform: rotateY(-180deg) skewY(0deg); filter: brightness(0.7); }
        }

        @keyframes pageFlipPrev {
            0% { transform: rotateY(0deg) skewY(0deg); filter: brightness(1); }
            45% { transform: rotateY(85deg) skewY(3deg); filter: brightness(0.84); box-shadow: 25px 15px 40px rgba(0,0,0,0.6); }
            100% { transform: rotateY(180deg) skewY(0deg); filter: brightness(0.7); }
        }

        /* Ledger Typography & Bull/Bear Callouts */
        .chapter-kicker {
            font-family: 'JetBrains Mono', monospace;
            font-size: 0.68rem;
            letter-spacing: 0.14em;
            text-transform: uppercase;
            color: var(--ink-emerald);
            font-weight: 700;
            border-bottom: 1px solid rgba(6, 78, 59, 0.28);
            padding-bottom: 4px;
            margin-bottom: 8px;
            display: flex;
            justify-content: space-between;
        }

        .page-heading {
            font-family: 'Cinzel', serif;
            font-size: 1.32rem;
            line-height: 1.24;
            font-weight: 900;
            color: #1c1610;
            margin-bottom: 10px;
            text-shadow: 0 1px 0 rgba(255,255,255,0.6);
        }

        .drop-cap::first-letter {
            font-family: 'Cinzel Decorative', serif;
            float: left;
            font-size: 2.95rem;
            line-height: 0.82;
            padding: 4px 10px 2px 0;
            color: var(--ink-emerald);
            text-shadow: 1px 1px 0 #d4af37;
        }

        .formula-axiom-box {
            margin: 10px 0;
            padding: 8px 12px;
            background: rgba(6, 78, 59, 0.07);
            border-left: 3px solid var(--ink-emerald);
            border-right: 3px solid var(--gold-foil);
            font-family: 'JetBrains Mono', monospace;
            font-size: 0.8rem;
            font-weight: 600;
            color: #064e3b;
            text-align: center;
        }

        .risk-warning-box {
            margin: 10px 0;
            padding: 8px 12px;
            background: rgba(153, 27, 27, 0.08);
            border-left: 3px solid var(--bear-crimson);
            font-family: 'Cormorant Garamond', serif;
            font-size: 0.92rem;
            color: #7f1d1d;
        }

        .mono-stat {
            font-family: 'JetBrains Mono', monospace;
        }

        .page-footer-num {
            position: absolute;
            bottom: 10px;
            font-family: 'JetBrains Mono', monospace;
            font-size: 0.72rem;
            font-weight: 700;
            color: #5e4423;
            letter-spacing: 0.1em;
        }
        .footer-left { left: 28px; }
        .footer-right { right: 28px; }

        /* Glowing Gold/Emerald Ink Reveal Animation for Newly Conjured Lessons */
        @keyframes ledgerInkReveal {
            0% {
                opacity: 0;
                filter: blur(4px);
                text-shadow: 0 0 16px #10b981, 0 0 28px #d4af37;
                color: #065f46;
            }
            60% {
                opacity: 1;
                filter: blur(0);
                text-shadow: 0 0 10px #34d399;
                color: #064e3b;
            }
            100% {
                opacity: 1;
                text-shadow: none;
                color: var(--ink-primary);
            }
        }

        .newly-conjured {
            animation: ledgerInkReveal 1.6s ease-out forwards;
        }

        /* Bottom Navigation Bar */
        .bottom-nav-controls {
            position: fixed;
            bottom: 12px;
            left: 50%;
            transform: translateX(-50%);
            z-index: 50;
            display: flex;
            align-items: center;
            gap: 14px;
            background: rgba(15, 12, 10, 0.88);
            backdrop-filter: blur(8px);
            border: 1px solid rgba(180, 140, 68, 0.48);
            padding: 5px 16px;
            border-radius: 999px;
            box-shadow: 0 8px 25px rgba(0,0,0,0.85);
        }

        /* Modal Drawers for Search / Index */
        .arcane-modal-backdrop {
            position: fixed;
            inset: 0;
            background: rgba(4, 4, 6, 0.84);
            backdrop-filter: blur(5px);
            z-index: 80;
            display: none;
            align-items: center;
            justify-content: center;
            padding: 16px;
        }
        .arcane-modal-backdrop.open {
            display: flex;
        }
        .arcane-modal-card {
            width: 100%;
            max-width: 580px;
            max-height: 82vh;
            overflow-y: auto;
            background: linear-gradient(145deg, #1d1612 0%, #0f0c0a 100%);
            border: 2px solid #8c6a32;
            border-radius: 14px;
            padding: 22px;
            color: #efe2c6;
            box-shadow: 0 24px 60px rgba(0,0,0,0.95), 0 0 30px rgba(212, 175, 55, 0.22);
        }

        /* Toast Notification */
        .arcane-toast {
            position: fixed;
            bottom: 84px;
            left: 50%;
            transform: translateX(-50%) translateY(15px);
            background: rgba(6, 36, 27, 0.95);
            border: 1px solid #10b981;
            color: #d1fae5;
            font-family: 'Cinzel', serif;
            font-size: 0.78rem;
            padding: 8px 18px;
            border-radius: 999px;
            box-shadow: 0 0 22px rgba(16, 185, 129, 0.45);
            opacity: 0;
            pointer-events: none;
            transition: all 0.35s ease;
            z-index: 90;
            text-align: center;
        }
        .arcane-toast.show {
            opacity: 1;
            transform: translateX(-50%) translateY(0);
        }

        /* Responsive Mobile / Narrow Screen Single-Page Adaptation */
        @media (max-width: 768px) {
            .book-stage {
                height: 72vh;
                margin-top: 42px;
            }
            .open-grimoire {
                flex-direction: column;
                padding: 10px;
            }
            .page-stack-left {
                display: none;
            }
            .open-grimoire.mobile-show-left .page-stack-left {
                display: flex;
            }
            .open-grimoire.mobile-show-left .page-stack-right {
                display: none;
            }
            .center-spine-crease, .silk-ribbon {
                display: none;
            }
            .parchment-page {
                border-radius: 6px;
                padding: 18px 18px 36px 20px;
            }
            .turning-leaf {
                width: calc(100% - 20px);
                left: 10px !important;
                right: 10px !important;
            }
            .candle-container {
                width: 36px;
                height: 36px;
                top: 10px;
                right: 10px;
            }
            .candle-wax { width: 26px; height: 26px; }
        }
    
/* ===================== v2: REALISTIC BOOK ===================== */
#magic-particles{z-index:2}
.book-rig{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;transform-style:preserve-3d;transition:transform .4s ease-out;will-change:transform}
.closed-grimoire{position:relative;display:block;width:auto;height:min(72vh,650px);max-height:none;max-width:86vw;aspect-ratio:896/1200;background:none;border:0;border-radius:0;overflow:visible;box-shadow:none!important;transform-origin:11% 50%;transform-style:preserve-3d;transition:transform 1.05s cubic-bezier(.55,.05,.25,1),opacity .6s ease;z-index:20}
.closed-grimoire:not(.swung):hover{transform:rotateY(-13deg)}
.closed-grimoire.swung{transform:rotateY(-179deg);pointer-events:none}
.closed-grimoire.faded{opacity:0}
.closed-grimoire:hover .book-cover-artwork{transform:none;filter:drop-shadow(-12px 20px 24px rgba(0,0,0,.9)) drop-shadow(0 0 26px rgba(212,175,55,.28)) brightness(1.05)}
.book-cover-artwork{width:100%;height:100%;object-fit:fill;border-radius:0;backface-visibility:hidden;-webkit-backface-visibility:hidden;filter:drop-shadow(-10px 18px 22px rgba(0,0,0,.85)) drop-shadow(0 0 18px rgba(212,175,55,.16));transition:filter .4s ease}
.closed-grimoire::before{content:'';position:absolute;top:0;bottom:0;left:9%;width:6%;background:linear-gradient(90deg,transparent,rgba(0,0,0,.5),transparent);backface-visibility:hidden;pointer-events:none}
.cover-sheen-overlay{background:radial-gradient(circle at var(--mx,30%) var(--my,25%),rgba(255,236,170,.34),rgba(16,185,129,.07) 34%,transparent 58%);backface-visibility:hidden;-webkit-backface-visibility:hidden;-webkit-mask-size:100% 100%;mask-size:100% 100%}
.cover-unseal-pill{backface-visibility:hidden;-webkit-backface-visibility:hidden}
.cover-back{position:absolute;inset:0;transform:rotateY(180deg);backface-visibility:hidden;-webkit-backface-visibility:hidden;-webkit-mask-size:100% 100%;mask-size:100% 100%;
 background:radial-gradient(ellipse at 60% 40%,rgba(212,175,55,.16),transparent 60%),repeating-linear-gradient(45deg,rgba(212,175,55,.07) 0 2px,transparent 2px 9px),linear-gradient(120deg,#0b2219,#16402f 50%,#0a1d15)}
.cover-back::after{content:'';position:absolute;inset:9% 8% 9% 14%;border:1px solid rgba(212,175,55,.5);box-shadow:inset 0 0 0 5px rgba(0,0,0,.18),inset 0 0 0 6px rgba(212,175,55,.25)}
.closed-pages{position:absolute;margin:auto;transform:translate(8px,6px);-webkit-mask-size:100% 100%;mask-size:100% 100%;transition:opacity .4s ease;
 background:repeating-linear-gradient(0deg,#efe3c6 0 2px,#a38c60 2px 3px),#d9c9a4}
.book-rig.is-open .closed-pages{opacity:0}
.open-grimoire{position:absolute;inset:0;display:flex;visibility:hidden;pointer-events:none;opacity:0;transform:translateX(var(--ox,0px)) scale(var(--os,.9)) translateZ(-2px);transform-origin:50% 50%;transition:opacity .45s ease,transform .95s cubic-bezier(.3,.1,.2,1)}
.open-grimoire.visible{visibility:visible;pointer-events:auto}
.open-grimoire.show{opacity:1}
.open-grimoire.active{transform:translateX(0px) scale(1) translateZ(-2px)}
.turning-leaf{background:none;padding:0;overflow:visible;box-shadow:none;border-radius:0;transform-style:preserve-3d;backface-visibility:visible}
.turning-leaf .leaf-face{position:absolute;inset:0;height:100%;width:100%;overflow:hidden;backface-visibility:hidden;-webkit-backface-visibility:hidden}
.turning-leaf .leaf-back{transform:rotateY(180deg)}
.leaf-face::after{content:'';position:absolute;inset:0;pointer-events:none;opacity:0;background:linear-gradient(90deg,rgba(20,10,0,.6),rgba(20,10,0,.06) 55%,rgba(255,240,200,.22))}
.flip-prev .leaf-face::after,.peek-prev .leaf-face::after{background:linear-gradient(270deg,rgba(20,10,0,.6),rgba(20,10,0,.06) 55%,rgba(255,240,200,.22))}
.turning-leaf.flip-next{display:block;right:18px;left:auto;transform-origin:left center;animation:flipNextV2 .95s cubic-bezier(.42,.05,.3,1) forwards}
.turning-leaf.flip-prev{display:block;left:18px;right:auto;transform-origin:right center;animation:flipPrevV2 .95s cubic-bezier(.42,.05,.3,1) forwards}
.turning-leaf.peek-next,.turning-leaf.unpeek-next{display:block;right:18px;left:auto;transform-origin:left center}
.turning-leaf.peek-prev,.turning-leaf.unpeek-prev{display:block;left:18px;right:auto;transform-origin:right center}
.turning-leaf.peek-next{animation:peekN .35s ease forwards}.turning-leaf.unpeek-next{animation:peekN .3s ease reverse forwards}
.turning-leaf.peek-prev{animation:peekP .35s ease forwards}.turning-leaf.unpeek-prev{animation:peekP .3s ease reverse forwards}
.peek-next .leaf-front,.peek-prev .leaf-front{box-shadow:-14px 10px 24px rgba(0,0,0,.45)}
.flip-next .leaf-front::after,.flip-prev .leaf-front::after{animation:shadeA .95s ease-in forwards}
.flip-next .leaf-back::after,.flip-prev .leaf-back::after{animation:shadeB .95s ease-out forwards}
.flip-next .leaf-face,.flip-prev .leaf-face{animation:leafCast .95s ease-in-out}
@keyframes peekN{from{transform:rotateY(0)}to{transform:rotateY(-10deg)}}
@keyframes peekP{from{transform:rotateY(0)}to{transform:rotateY(10deg)}}
@keyframes flipNextV2{0%{transform:rotateY(var(--fs,0deg))}28%{transform:rotateY(-48deg) skewY(-2deg) translateZ(16px)}55%{transform:rotateY(-104deg) skewY(1.2deg) translateZ(12px)}100%{transform:rotateY(-180deg)}}
@keyframes flipPrevV2{0%{transform:rotateY(var(--fs,0deg))}28%{transform:rotateY(48deg) skewY(2deg) translateZ(16px)}55%{transform:rotateY(104deg) skewY(-1.2deg) translateZ(12px)}100%{transform:rotateY(180deg)}}
@keyframes shadeA{0%{opacity:0}60%{opacity:.85}100%{opacity:1}}
@keyframes shadeB{0%{opacity:1}40%{opacity:.7}100%{opacity:0}}
@keyframes leafCast{0%,100%{box-shadow:0 0 0 rgba(0,0,0,0)}50%{box-shadow:-34px 22px 55px rgba(0,0,0,.6)}}
@media (max-width:768px){.turning-leaf{display:none!important}.closed-grimoire{height:min(66vh,600px)}}

/* MOKAUS BOOK: hearth-lit atmosphere and tactile book mechanics */
:root{--gold-foil:#e0a84d}
body{background:#080503}
.study-surface{background:radial-gradient(ellipse at 50% 100%,rgba(132,35,10,.27),transparent 46%),radial-gradient(ellipse at 50% 92%,rgba(255,103,19,.13),transparent 24%),linear-gradient(180deg,#080706 0%,#100906 72%,#1b0b05 100%);animation:hearthBreath 5.5s ease-in-out infinite alternate}
@keyframes hearthBreath{from{filter:brightness(.88)}to{filter:brightness(1.12)}}
#magic-particles{z-index:2;mix-blend-mode:screen;opacity:.9}
.book-stage{perspective:3000px;perspective-origin:50% 48%}
.book-rig{transform-style:preserve-3d}
.closed-grimoire{transform-origin:10% 50%;transition:transform 1.35s cubic-bezier(.22,.78,.2,1),opacity .7s ease;backface-visibility:visible}
.closed-grimoire:not(.swung):hover{transform:rotateY(-8deg) rotateX(1deg) translateY(-3px)}
.closed-grimoire.swung{transform:rotateY(-180deg);transition-duration:1.45s;transition-timing-function:cubic-bezier(.62,.02,.34,1);filter:drop-shadow(22px 24px 24px rgba(0,0,0,.65))}
.open-grimoire{transform-origin:10% 50%;transition:opacity .55s ease,transform 1.25s cubic-bezier(.2,.72,.18,1)}
.open-grimoire.active{transform:translateX(0) scale(1) translateZ(0);filter:drop-shadow(0 26px 22px rgba(0,0,0,.38))}
.page-stack-left,.page-stack-right{transform-style:preserve-3d;filter:drop-shadow(0 8px 7px rgba(0,0,0,.26))}
.parchment-page{background-color:#eadbbd;background-image:radial-gradient(ellipse at 48% 50%,rgba(255,251,235,.8),rgba(211,183,132,.28) 78%,rgba(103,69,34,.43)),linear-gradient(to right,rgba(153,27,27,.13) 1px,transparent 1px),repeating-linear-gradient(0deg,transparent 0 23px,rgba(6,95,70,.075) 24px);}
.turning-leaf{perspective:1800px;transform-style:preserve-3d}
.turning-leaf .leaf-face{backface-visibility:hidden;box-shadow:inset 0 0 1px rgba(73,45,16,.65)}
.turning-leaf.flip-next{animation:realFlipNext 1.08s cubic-bezier(.44,.02,.28,1) forwards}
.turning-leaf.flip-prev{animation:realFlipPrev 1.08s cubic-bezier(.44,.02,.28,1) forwards}
@keyframes realFlipNext{0%{transform:rotateY(var(--fs,0deg)) translateZ(0) scaleX(1);filter:brightness(1)}20%{transform:rotateY(-34deg) translateZ(10px) scaleX(.98);filter:brightness(.96)}48%{transform:rotateY(-92deg) translateZ(24px) scaleX(.94);filter:brightness(.82)}76%{transform:rotateY(-148deg) translateZ(11px) scaleX(.98);filter:brightness(.91)}100%{transform:rotateY(-180deg) translateZ(0) scaleX(1);filter:brightness(1)}}
@keyframes realFlipPrev{0%{transform:rotateY(var(--fs,0deg)) translateZ(0) scaleX(1);filter:brightness(1)}20%{transform:rotateY(34deg) translateZ(10px) scaleX(.98);filter:brightness(.96)}48%{transform:rotateY(92deg) translateZ(24px) scaleX(.94);filter:brightness(.82)}76%{transform:rotateY(148deg) translateZ(11px) scaleX(.98);filter:brightness(.91)}100%{transform:rotateY(180deg) translateZ(0) scaleX(1);filter:brightness(1)}}
.flip-next .leaf-front::after,.flip-prev .leaf-front::after{animation:shadeA 1.08s ease-in forwards}
.flip-next .leaf-back::after,.flip-prev .leaf-back::after{animation:shadeB 1.08s ease-out forwards}
@media(prefers-reduced-motion:reduce){.study-surface{animation:none}.closed-grimoire,.open-grimoire{transition-duration:.01ms!important}.turning-leaf.flip-next,.turning-leaf.flip-prev{animation-duration:.01ms!important}}

/* Cosmic gallery: a calm starfield that keeps the cover as the focal point. */
:root{--gold-foil:#d9bd80}
body{min-height:100svh;background:#05070e}
.study-surface{background:radial-gradient(ellipse at 50% 54%,rgba(40,48,78,.24),transparent 48%),radial-gradient(ellipse at 16% 20%,rgba(24,45,79,.25),transparent 42%),radial-gradient(ellipse at 83% 78%,rgba(95,62,41,.12),transparent 40%),linear-gradient(145deg,#05070e 0%,#0a0d17 52%,#05070e 100%);animation:none}
.study-surface.arcane-mode{background:radial-gradient(ellipse at 50% 48%,rgba(16,85,78,.2),transparent 48%),radial-gradient(ellipse at 16% 20%,rgba(24,45,79,.25),transparent 42%),linear-gradient(145deg,#05070e 0%,#091318 52%,#05070e 100%)}
.study-surface::before,.study-surface::after{content:"";position:absolute;inset:-20%;pointer-events:none;background-image:radial-gradient(1px 1px at 8% 23%,rgba(255,255,255,.6) 50%,transparent 100%),radial-gradient(1px 1px at 34% 76%,rgba(190,209,255,.46) 50%,transparent 100%),radial-gradient(1px 1px at 68% 34%,rgba(255,225,177,.55) 50%,transparent 100%),radial-gradient(1px 1px at 91% 68%,rgba(255,255,255,.42) 50%,transparent 100%);background-size:310px 280px;opacity:.4;animation:starDrift 90s linear infinite}
.study-surface::after{background-size:470px 420px;background-position:120px 50px;opacity:.22;animation-duration:140s;animation-direction:reverse}
@keyframes starDrift{to{transform:translate3d(42px,-36px,0)}}
#magic-particles{z-index:2;mix-blend-mode:screen;opacity:.78}
.candle-container{display:none!important}
 .book-stage{perspective:2600px;perspective-origin:50% 48%;animation:none}

.closed-grimoire{transition:transform 1.15s cubic-bezier(.3,.7,.25,1),opacity .55s ease;filter:drop-shadow(-20px 28px 30px rgba(0,0,0,.62)) drop-shadow(0 0 32px rgba(142,165,209,.12))}
.closed-grimoire:not(.swung):hover{transform:none!important}
.closed-grimoire:hover .book-cover-artwork{transform:none!important;filter:inherit!important}
.closed-grimoire:hover .cover-sheen-overlay{opacity:0!important}
.closed-grimoire:hover .cover-unseal-pill{border-color:rgba(212,175,55,.65);color:#f3dc96;box-shadow:0 4px 14px rgba(0,0,0,.9)}
.closed-grimoire:hover .astrolabe-medallion{transform:none}
.closed-grimoire.swung{filter:drop-shadow(22px 24px 24px rgba(0,0,0,.5))}
.open-grimoire.active{filter:drop-shadow(0 26px 22px rgba(0,0,0,.4))}
.market-ticker-ribbon{background:rgba(5,7,14,.78)}
@media(max-width:768px){
 body{min-height:100svh;overflow:hidden}
 .grimoire-toolbar{top:max(8px,env(safe-area-inset-top));left:8px;right:8px;transform:none;width:auto;max-width:none;flex-wrap:nowrap;justify-content:flex-start;gap:6px;overflow-x:auto;overflow-y:hidden;padding:7px 9px;border-radius:16px;scrollbar-width:none}
 .grimoire-toolbar::-webkit-scrollbar{display:none}
 .arcane-btn{font-size:.62rem;padding:7px 9px;flex:0 0 auto}
 .book-stage{width:100vw;height:calc(100svh - 108px);min-height:0;max-height:none;margin:46px 0 54px;perspective:1800px}
 .closed-grimoire{height:min(62svh,570px);width:auto;max-width:calc(100vw - 34px);aspect-ratio:896/1200}
 .closed-grimoire:not(.swung):hover{transform:none!important}
 .closed-grimoire.swung{transform:rotateY(-180deg)}
 .open-grimoire{inset:0 8px;height:100%;padding:8px;border-radius:10px}
 .open-grimoire .page-stack-right{min-height:0;flex:1}
 .open-grimoire .parchment-page{padding:16px 15px 42px 18px;font-size:.91rem;line-height:1.42}
 .open-grimoire .page-stack-left{display:none}
 .open-grimoire.mobile-show-left .page-stack-left{display:flex}
 .open-grimoire.mobile-show-left .page-stack-right{display:none}
 .center-spine-crease,.silk-ribbon{display:none}
 .bottom-nav-controls{bottom:max(8px,env(safe-area-inset-bottom));gap:7px;padding:7px 10px;max-width:calc(100vw - 20px);white-space:nowrap}
 .bottom-nav-controls .arcane-btn{font-size:.62rem;padding:6px 8px}
 .market-ticker-ribbon{bottom:58px;width:96vw;font-size:.56rem}
 .candle-container{display:none}
}
@media(max-width:390px){
 .book-stage{height:calc(100svh - 100px);margin-top:44px}
 .closed-grimoire{height:min(58svh,500px);max-width:calc(100vw - 24px)}
 .grimoire-toolbar .arcane-btn{font-size:.58rem;padding:6px 8px}
 .open-grimoire .parchment-page{padding:13px 12px 38px 15px;font-size:.86rem}
 .market-ticker-ribbon{bottom:55px}
}
@media(prefers-reduced-motion:reduce){.study-surface::before,.study-surface::after,.book-stage{animation:none!important}}

/* The open cover reveals the controls and folio navigation as part of the spread. */
.grimoire-toolbar{position:absolute!important;top:8px;left:50%;right:auto;transform:translateX(-50%);z-index:55;width:max-content;max-width:calc(100% - 28px);}
.bottom-nav-controls{position:absolute;left:50%;right:auto;bottom:8px;transform:translateX(-50%);z-index:55;width:max-content;max-width:calc(100% - 28px);}
.open-grimoire{padding:54px 18px 58px;transform-origin:50% 50%;transform:translateY(18px) scale(.985) translateZ(-12px);opacity:0;transition:opacity .65s ease,transform 1.15s cubic-bezier(.25,.7,.2,1);backface-visibility:visible;}
.open-grimoire.active{transform:translateY(0) scale(1) translateZ(0);}
.open-grimoire.closing{opacity:0;transition-delay:.72s;}
.closed-grimoire{transform-origin:10% 50%;transform-style:preserve-3d;transition:transform 1.6s cubic-bezier(.68,.02,.24,1),opacity .45s ease;}
.closed-grimoire.swung{transform:rotateY(-180deg);transition-duration:1.6s;transition-timing-function:cubic-bezier(.68,.02,.24,1);}
.closed-pages{transform:translate(9px,6px) translateZ(-10px);filter:drop-shadow(10px 12px 14px rgba(0,0,0,.38));}
.book-rig{transform-style:preserve-3d;}
@media(max-width:768px){
 .open-grimoire{padding:48px 8px 56px;transform-origin:50% 50%;transform:translateY(14px) scale(.99) translateZ(-8px);}
 .open-grimoire.active{transform:translateY(0) scale(1) translateZ(0);}
 .grimoire-toolbar{top:5px;width:calc(100% - 12px);max-width:none;gap:5px;padding:5px 7px;overflow-x:auto;overflow-y:hidden;flex-wrap:nowrap;justify-content:flex-start;border-radius:12px;scrollbar-width:none;}
 .grimoire-toolbar::-webkit-scrollbar{display:none}
 .grimoire-toolbar .arcane-btn{font-size:.56rem;padding:6px 8px;}
 .bottom-nav-controls{bottom:5px;width:calc(100% - 12px);max-width:none;justify-content:space-between;gap:4px;padding:5px 7px;border-radius:12px;}
 .bottom-nav-controls .arcane-btn{font-size:.55rem;padding:6px 7px;}
 .bottom-nav-controls .mono-stat{font-size:.55rem;white-space:nowrap;}
}

/* Independent control rail: navigation sits above the toolbar, outside the folios. */
.grimoire-toolbar{position:fixed!important;top:auto!important;left:50%!important;right:auto!important;bottom:10px!important;transform:translateX(-50%)!important;z-index:55;width:max-content;max-width:calc(100vw - 24px);flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;}
.grimoire-toolbar::-webkit-scrollbar{display:none}
.bottom-nav-controls{position:fixed!important;left:50%!important;right:auto!important;top:auto!important;bottom:68px!important;transform:translateX(-50%)!important;z-index:55;width:max-content;max-width:calc(100vw - 24px);}
.book-stage{height:calc(100svh - 170px);min-height:0;max-height:calc(100svh - 170px);margin:0 0 138px;}
.open-grimoire{padding:16px 18px;transform:translateY(22px) scale(.94) rotateX(3deg) translateZ(-10px);transition:opacity .38s ease,transform .68s cubic-bezier(.2,.75,.18,1);}
.open-grimoire.active{transform:translateY(0) scale(1) rotateX(0) translateZ(0);}
.open-grimoire.closing{opacity:0;transition-delay:0s;transform:translateY(12px) scale(.96) rotateX(-2deg);}
.closed-grimoire{transform-origin:14% 55%;transition:transform .76s cubic-bezier(.2,.78,.2,1),opacity .34s ease;}
.closed-grimoire:not(.swung):hover{transform:rotateY(-8deg) rotateX(1deg) translateY(-3px)!important;}
.closed-grimoire.swung{transform:translate3d(9vw,-4vh,28px) rotateZ(-7deg) rotateY(-15deg) scale(.87)!important;transition-duration:.76s;transition-timing-function:cubic-bezier(.2,.78,.2,1);}
.closed-grimoire:hover .cover-sheen-overlay{opacity:1!important;}
.closed-grimoire:hover .book-cover-artwork{filter:drop-shadow(-12px 20px 24px rgba(0,0,0,.72)) drop-shadow(0 0 26px rgba(212,175,55,.3)) brightness(1.07)!important;}
.parchment-page{scroll-behavior:smooth;overscroll-behavior:contain;}
.language-picker select{appearance:none;color:#ebd6ad;background:#17130f;border:1px solid #82642f;border-radius:999px;padding:6px 9px;font:700 .68rem 'Cinzel',serif;cursor:pointer;}
.language-picker select:focus-visible,.arcane-btn:focus-visible,.closed-grimoire:focus-visible{outline:2px solid #f4d98e;outline-offset:3px;}
.special-page{min-height:100%;display:flex;flex-direction:column;gap:12px;padding-bottom:20px;}
.special-page-copy{font-size:1.05rem;line-height:1.5;color:#3f3529;margin:0;}
.intro-media-section{margin-top:auto;border:1px solid rgba(112,82,42,.32);border-radius:12px;padding:12px;background:rgba(255,248,229,.56);}
.intro-media-heading{display:flex;flex-direction:column;gap:3px;color:#433524;font-family:'Cinzel',serif;font-size:.79rem;}
.intro-media-heading span{font: .78rem 'Cormorant Garamond',Georgia,serif;color:#645747;}
.intro-media-frame{height:clamp(120px,24vh,220px);margin:10px 0;border-radius:9px;overflow:hidden;background:linear-gradient(135deg,#10131c,#222b34);display:grid;place-items:center;}
.intro-media-player,.intro-media-image{width:100%;height:100%;object-fit:contain;}
.media-empty-state{display:grid;place-items:center;gap:6px;color:#d8c9a6;font:700 1.4rem 'Cinzel',serif;letter-spacing:.1em;text-align:center;padding:15px;}
.media-empty-state span{font: .85rem 'Cormorant Garamond',Georgia,serif;letter-spacing:0;color:#c4b89e;}
body[data-theme="dark"] .theme-light-media,body[data-theme="light"] .theme-dark-media{display:none;}
.media-upload-row{display:flex;flex-wrap:wrap;gap:8px;}
.media-upload-row label{flex:1 1 145px;display:grid;gap:4px;color:#51412d;font-size:.78rem;font-weight:700;}
.media-upload-row input{max-width:100%;color:#403729;font: .72rem 'JetBrains Mono',monospace;}
.media-status{min-height:1em;margin:5px 0 0;color:#12634b;font-size:.78rem;}
.notes-label{font-family:'Cinzel',serif;font-size:.9rem;font-weight:700;color:#423321;}
.outro-notes{width:100%;min-height:clamp(150px,32vh,310px);resize:vertical;border:1px solid rgba(112,82,42,.5);border-radius:10px;padding:12px;background:rgba(255,250,236,.72);color:#2c241b;font:1rem/1.5 'Cormorant Garamond',Georgia,serif;}
.outro-notes:focus-visible{outline:2px solid #547765;outline-offset:2px;}
.notes-download{align-self:flex-start;background:linear-gradient(180deg,#15372c,#0a2019);border-color:#357761;color:#d2f1df;}
body[data-theme="light"]{background:#d9d0bf;color:#2f2a22;}
body[data-theme="light"] .study-surface{background:radial-gradient(ellipse at 50% 42%,rgba(255,255,255,.9),transparent 60%),linear-gradient(145deg,#e8e2d5,#c9c0af);}
body[data-theme="light"] .parchment-page{background-color:#f4eddf;background-image:radial-gradient(ellipse at 48% 50%,rgba(255,255,255,.88),rgba(232,219,192,.36) 78%,rgba(157,129,88,.22)),linear-gradient(to right,rgba(153,27,27,.1) 1px,transparent 1px),repeating-linear-gradient(0deg,transparent 0 23px,rgba(6,95,70,.06) 24px);}
body[data-theme="light"] .grimoire-toolbar,body[data-theme="light"] .bottom-nav-controls{background:rgba(248,244,234,.94);border-color:rgba(135,103,52,.6);box-shadow:0 8px 24px rgba(45,36,22,.18);}
body[data-theme="light"] .arcane-btn{background:linear-gradient(180deg,#f8f1e3,#e8dec9);color:#41331e;border-color:#9b7d46;}
body[data-theme="light"] .language-picker select{background:#f8f1e3;color:#41331e;}
body[data-theme="light"] .mono-stat{color:#49391f;}
@media(max-width:768px){
 .book-stage{height:calc(100svh - 150px);max-height:calc(100svh - 150px);margin:0 0 calc(124px + env(safe-area-inset-bottom));}
 .open-grimoire{padding:8px 8px 10px;}
 .grimoire-toolbar{bottom:max(7px,env(safe-area-inset-bottom))!important;width:calc(100vw - 12px);max-width:none;justify-content:flex-start;}
 .bottom-nav-controls{bottom:calc(48px + env(safe-area-inset-bottom))!important;width:calc(100vw - 12px);max-width:none;}
 .intro-media-frame{height:clamp(110px,20svh,180px);}
 .special-page{gap:8px;}
 .intro-media-section{padding:9px;}
 .media-upload-row input{font-size:.62rem;}
}
@media(max-width:390px){
 .book-stage{height:calc(100svh - 140px);max-height:calc(100svh - 140px);margin-bottom:calc(116px + env(safe-area-inset-bottom));}
 .special-page-copy{font-size:.94rem;}
 .grimoire-toolbar .arcane-btn{font-size:.55rem;padding:6px 7px;}
}
@media(prefers-reduced-motion:reduce){.closed-grimoire,.open-grimoire,.parchment-page{scroll-behavior:auto;transition-duration:.01ms!important}.closed-grimoire.swung{transition-duration:.01ms!important}}
.turning-leaf.flip-next,.turning-leaf.flip-prev{animation-duration:.68s!important;}
.flip-next .leaf-front::after,.flip-prev .leaf-front::after{animation-duration:.68s!important;}
.flip-next .leaf-back::after,.flip-prev .leaf-back::after{animation-duration:.68s!important;}

/* Clean résumé and numbered contents folios. */
.cv-page{gap:clamp(7px,1.3vh,14px)}
.cv-heading-row{display:flex;align-items:center;gap:14px}
.cv-photo-placeholder{width:64px;height:64px;flex:0 0 64px;border:1px solid rgba(112,82,42,.48);border-radius:50%;background:rgba(255,250,236,.68);display:grid;place-items:center;color:#75603e}
.cv-photo-placeholder svg{width:30px;height:30px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round}
.cv-heading-copy{min-width:0}.cv-heading-copy .page-heading{margin:0}.cv-heading-copy p{margin:3px 0 0;color:#75664f;font:italic .95rem 'Cormorant Garamond',Georgia,serif}
.cv-form-grid{display:grid;grid-template-columns:1fr 1fr;gap:9px 12px}
.cv-form-grid label{display:grid;gap:4px;color:#675338;font:700 .65rem 'Cinzel',serif;letter-spacing:.06em;text-transform:uppercase}
.cv-form-grid label span{min-height:30px;padding:6px 8px;border-bottom:1px solid rgba(112,82,42,.36);color:#342b20;font: .9rem 'Cormorant Garamond',Georgia,serif;letter-spacing:0;text-transform:none;outline:none}
.cv-form-grid label span:focus{border-color:#39755f;background:rgba(255,255,255,.3)}
.cv-wide{grid-column:1/-1}.cv-video-placeholder{margin-top:auto;min-height:64px;border:1px dashed rgba(112,82,42,.42);border-radius:10px;display:flex;align-items:center;justify-content:center;gap:10px;color:#746044;background:rgba(255,250,236,.38);font:700 .7rem 'Cinzel',serif;letter-spacing:.08em;text-transform:uppercase}
.cv-video-placeholder svg{width:25px;height:25px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linejoin:round;stroke-linecap:round}
.toc-page{gap:8px}.toc-list{list-style:none;padding:0;margin:4px 0 0;display:grid;gap:3px;overflow:auto}.toc-list li button{width:100%;display:flex;align-items:baseline;gap:8px;padding:5px 3px;border:0;border-bottom:1px solid rgba(112,82,42,.2);background:transparent;text-align:left;color:#382d20;cursor:pointer;font: .91rem 'Cormorant Garamond',Georgia,serif}.toc-list li button:hover,.toc-list li button:focus-visible{color:#176349;background:rgba(255,255,255,.24);outline:none}.toc-number,.toc-folio{font:700 .65rem 'JetBrains Mono',monospace;color:#8a6b37;white-space:nowrap}.toc-entry-title{min-width:0}.toc-leader{flex:1;min-width:10px;border-bottom:1px dotted rgba(112,82,42,.42)}
.grimoire-toolbar{position:fixed!important;top:max(10px,env(safe-area-inset-top))!important;bottom:auto!important;left:50%!important;right:auto!important;transform:translateX(-50%)!important;z-index:55;width:max-content;max-width:calc(100vw - 20px);flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none}
.grimoire-toolbar::-webkit-scrollbar{display:none}.bottom-nav-controls{bottom:max(10px,env(safe-area-inset-bottom))!important}
.book-stage{height:calc(100svh - 178px);max-height:calc(100svh - 178px);margin:78px 0 74px}
.closed-grimoire:not(.swung):hover{transform:none!important}
.closed-grimoire:hover .cover-sheen-overlay{opacity:1!important}
@media(max-width:768px){.grimoire-toolbar{top:max(6px,env(safe-area-inset-top))!important;width:calc(100vw - 12px);max-width:none}.book-stage{height:calc(100svh - 156px);max-height:calc(100svh - 156px);margin:64px 0 calc(74px + env(safe-area-inset-bottom))}.bottom-nav-controls{bottom:max(6px,env(safe-area-inset-bottom))!important;width:calc(100vw - 12px);gap:4px}.cv-heading-row{gap:9px}.cv-photo-placeholder{width:52px;height:52px;flex-basis:52px}.cv-form-grid{gap:6px 8px}.cv-form-grid label span{font-size:.82rem;padding:5px 6px}.toc-list li button{font-size:.84rem;padding:4px 2px}}
@media(max-width:390px){.book-stage{height:calc(100svh - 144px);max-height:calc(100svh - 144px);margin-top:60px;margin-bottom:calc(68px + env(safe-area-inset-bottom))}.cv-page{gap:6px}.cv-form-grid{gap:5px 6px}.cv-form-grid label{font-size:.57rem}.toc-list li button{gap:5px;font-size:.77rem}}
