/* ===== RESET ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    width: 100%; height: 100%;
    overflow: hidden;
    font-family: 'EB Garamond', serif;
    background: #12100a;
}

/* ===== SCENE ===== */
.scene {
    position: relative;
    width: 100%; height: 100vh;
    overflow: hidden;
    background: #14110b;
}

/* ===== LIBRARY ===== */
.library {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 62%;
    z-index: 1;
    overflow: hidden;
}

.library-shelves {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
}

/* Each shelf row will be generated by JS */
.shelf-row {
    flex: 1;
    display: flex;
    align-items: flex-end;
    border-bottom: 8px solid #2E1C0A;
    padding: 0 2px;
    box-shadow: 0 3px 4px rgba(0,0,0,0.5);
    background: linear-gradient(180deg, #3a3028 0%, #2E2418 85%, #3D2810 95%, #2E1C0A 100%);
}

.bg-book {
    flex-shrink: 0;
    border-radius: 1px 2px 2px 1px;
    box-shadow: inset -1px 0 2px rgba(0,0,0,0.3), inset 1px 0 1px rgba(255,255,255,0.06);
}

/* Dimmer over library */
.library-dimmer {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(5,3,2,0.35) 0%,
        rgba(5,3,2,0.25) 30%,
        rgba(5,3,2,0.3) 70%,
        rgba(5,3,2,0.5) 100%
    );
    z-index: 2;
}

/* ===== DESK ===== */
.desk {
    position: absolute;
    bottom: 0; left: 0;
    width: 100%; height: 38%;
    z-index: 3;
    background: linear-gradient(
        180deg,
        #2a1e10 0%,
        #2E1C0A 15%,
        #241608 50%,
        #1a1008 100%
    );
}

.desk-edge-strip {
    display: none;
}

/* ===== LAMP LIGHT ===== */
.lamp-light {
    position: absolute;
    inset: 0;
    background: radial-gradient(
        ellipse 45% 55% at 50% 55%,
        rgba(255,190,90,0.09) 0%,
        rgba(255,150,50,0.04) 30%,
        transparent 60%
    );
    z-index: 4;
    pointer-events: none;
}

/* ===== LAMP ===== */
.lamp {
    position: absolute;
    bottom: 37%; right: 18%;
    z-index: 15;
}

.lamp-svg { display: block; }

.flame-wrap {
    position: absolute;
    top: 16px; left: 36px;
    width: 18px; height: 30px;
}

.flame {
    width: 12px; height: 24px;
    margin: 0 auto;
    background: radial-gradient(ellipse 50% 80% at 50% 90%, #FFF8E0 0%, #FFD54F 25%, #FF9800 55%, #E65100 80%, transparent 100%);
    border-radius: 50% 50% 50% 50% / 70% 70% 30% 30%;
    animation: flame 0.13s ease-in-out infinite alternate;
    position: relative;
}

.flame-core {
    position: absolute;
    bottom: 2px; left: 50%;
    transform: translateX(-50%);
    width: 5px; height: 12px;
    background: radial-gradient(ellipse at 50% 90%, #fff 0%, #FFF9C4 50%, #FFD54F 100%);
    border-radius: 50% 50% 50% 50% / 70% 70% 30% 30%;
    animation: flameCore 0.11s ease-in-out infinite alternate;
}

@keyframes flame {
    0%   { transform: scaleX(1) scaleY(1) rotate(-1deg); }
    33%  { transform: scaleX(0.9) scaleY(1.05) rotate(0.5deg); }
    66%  { transform: scaleX(1.06) scaleY(0.95) rotate(-0.5deg); }
    100% { transform: scaleX(0.94) scaleY(1.03) rotate(1deg); }
}

@keyframes flameCore {
    0%   { transform: translateX(-50%) scaleX(1) scaleY(1); }
    100% { transform: translateX(-50%) scaleX(0.8) scaleY(1.1); }
}

.light-cone {
    position: absolute;
    top: 40px; left: -100px;
    width: 300px; height: 350px;
    background: radial-gradient(ellipse 50% 55% at 55% 0%, rgba(255,200,100,0.07) 0%, rgba(255,170,70,0.02) 45%, transparent 70%);
    pointer-events: none;
}

/* ============================================
   ===== 3D BOOK =====
   ============================================ */
.book-scene {
    position: absolute;
    bottom: 33%;
    left: 50%;
    transform: translateX(-55%);
    z-index: 10;
    perspective: 800px;
}

.book-link {
    display: block;
    text-decoration: none;
    cursor: pointer;
}

.book {
    width: 320px;
    height: 220px;
    position: relative;
    transform-style: preserve-3d;
    transform: rotateX(55deg) rotateZ(-8deg);
    transition: transform 0.6s ease;
    animation: bookFloat 5s ease-in-out infinite;
}

@keyframes bookFloat {
    0%, 100% { transform: rotateX(55deg) rotateZ(-8deg) translateY(0); }
    50% { transform: rotateX(55deg) rotateZ(-8deg) translateY(-6px); }
}

.book-link:hover .book {
    transform: rotateX(55deg) rotateZ(-8deg) translateY(-8px);
}

.book-face {
    position: absolute;
    backface-visibility: hidden;
}

/* --- TOP COVER --- */
.book-cover {
    width: 320px; height: 220px;
    background: linear-gradient(135deg, #5A2D0C 0%, #4A2308 30%, #3D1C06 70%, #2E1504 100%);
    border: 1.5px solid #1A0A02;
    border-radius: 2px 4px 4px 2px;
    transform: translateZ(50px);
    overflow: hidden;
}

.leather-texture {
    position: absolute; inset: 0;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(80,40,15,0.15) 0%, transparent 40%),
        radial-gradient(circle at 70% 60%, rgba(90,50,20,0.1) 0%, transparent 35%),
        radial-gradient(circle at 50% 80%, rgba(70,35,10,0.12) 0%, transparent 30%);
    opacity: 0.6;
}

.cover-glow {
    position: absolute; inset: 0;
    background: radial-gradient(ellipse 65% 55% at 50% 45%, rgba(255,220,120,0.18) 0%, rgba(218,165,32,0.06) 40%, transparent 65%);
    animation: coverGlow 3s ease-in-out infinite;
    pointer-events: none;
}

@keyframes coverGlow {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Gold border */
.cover-border {
    position: absolute;
    top: 12px; left: 12px; right: 12px; bottom: 12px;
    border: 2px solid rgba(218,175,40,0.55);
    border-radius: 2px;
    box-shadow: 0 0 8px rgba(218,165,32,0.1), inset 0 0 8px rgba(218,165,32,0.05);
}

.cover-border-inner {
    position: absolute;
    top: 6px; left: 6px; right: 6px; bottom: 6px;
    border: 1px solid rgba(218,175,40,0.35);
    border-radius: 1px;
}

/* Corner filigree */
.corner-fl {
    position: absolute;
    width: 18px; height: 18px;
    border-color: rgba(212,160,23,0.4);
    border-style: solid;
    border-width: 0;
}
.corner-fl::after {
    content: '';
    position: absolute;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: rgba(212,160,23,0.25);
}
.corner-tl { top: -2px; left: -2px; border-top-width: 1.5px; border-left-width: 1.5px; }
.corner-tl::after { top: 3px; left: 3px; }
.corner-tr { top: -2px; right: -2px; border-top-width: 1.5px; border-right-width: 1.5px; }
.corner-tr::after { top: 3px; right: 3px; }
.corner-bl { bottom: -2px; left: -2px; border-bottom-width: 1.5px; border-left-width: 1.5px; }
.corner-bl::after { bottom: 3px; left: 3px; }
.corner-br { bottom: -2px; right: -2px; border-bottom-width: 1.5px; border-right-width: 1.5px; }
.corner-br::after { bottom: 3px; right: 3px; }

/* --- TITLE --- */
.book-title {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 10px;
}

.title-line {
    display: block;
    font-family: 'Cinzel Decorative', serif;
    color: #D4A017;
    text-align: center;
    text-shadow:
        0 0 10px rgba(218,165,32,0.6),
        0 0 25px rgba(218,165,32,0.3),
        0 0 50px rgba(218,165,32,0.15);
    animation: titleGlow 3s ease-in-out infinite;
}

.line-1 { font-size: 22px; font-weight: 700; animation-delay: 0s; }
.line-2 { font-size: 14px; font-weight: 400; opacity: 0.8; animation-delay: 0.2s; }
.line-3 { font-size: 28px; font-weight: 900; letter-spacing: 0.08em; animation-delay: 0.4s; }
.line-4 {
    font-size: 11px; font-weight: 400;
    font-family: 'EB Garamond', serif;
    font-style: italic;
    opacity: 0.5;
    text-shadow: 0 0 8px rgba(218,165,32,0.3);
    animation: none;
    margin-top: 4px;
}

.title-divider {
    width: 80px; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(212,160,23,0.5), transparent);
    margin: 4px 0;
}

.title-ornament {
    color: rgba(212,160,23,0.35);
    font-size: 14px;
    line-height: 1;
}
.top-ornament { margin-bottom: 4px; }
.bottom-ornament { margin-top: 2px; }

@keyframes titleGlow {
    0%, 100% {
        text-shadow: 0 0 10px rgba(218,165,32,0.5), 0 0 25px rgba(218,165,32,0.25), 0 0 50px rgba(218,165,32,0.1);
        color: #D4A020;
    }
    50% {
        text-shadow: 0 0 18px rgba(255,210,80,0.9), 0 0 40px rgba(218,165,32,0.5), 0 0 70px rgba(218,165,32,0.25), 0 0 100px rgba(218,165,32,0.1);
        color: #F0D060;
    }
}

/* Hover intensify */
.book-link:hover .title-line {
    text-shadow:
        0 0 20px rgba(255,220,80,1),
        0 0 50px rgba(218,165,32,0.6),
        0 0 90px rgba(218,165,32,0.3),
        0 0 130px rgba(218,165,32,0.12);
    color: #FFF0A0;
}

.book-link:hover .cover-glow {
    opacity: 1;
    background: radial-gradient(ellipse 70% 60% at 50% 45%, rgba(255,220,120,0.28) 0%, rgba(218,165,32,0.08) 40%, transparent 65%);
}

/* --- FRONT EDGE --- */
.book-front {
    display: none;
}

/* --- RIGHT EDGE (pages) --- */
.book-right {
    width: 50px; height: 220px;
    background: linear-gradient(90deg, #E8DCC0 0%, #DDD0B0 30%, #D0C4A0 70%, #C8BA98 100%);
    transform: rotateY(90deg) translateZ(320px);
    transform-origin: left;
    border-right: 1px solid #B8A880;
}

/* Page line texture */
.page-lines {
    position: absolute; inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent 0px,
        transparent 1.2px,
        rgba(180,160,120,0.18) 1.2px,
        rgba(180,160,120,0.18) 1.6px
    );
}

.book-right .page-lines {
    background: repeating-linear-gradient(
        90deg,
        transparent 0px,
        transparent 1.2px,
        rgba(180,160,120,0.18) 1.2px,
        rgba(180,160,120,0.18) 1.6px
    );
}

/* --- BOTTOM --- */
.book-bottom {
    width: 320px; height: 220px;
    background: #2E1504;
    transform: translateZ(0px);
}

/* --- SPINE --- */
.book-spine {
    display: none;
}

.spine-band {
    display: none;
}

/* --- BACK EDGE --- */
.book-back {
    display: none;
}

/* Book shadow on desk */
.book-desk-shadow {
    position: absolute;
    bottom: -20px; left: 5%;
    width: 90%; height: 30px;
    background: radial-gradient(ellipse, rgba(0,0,0,0.5) 0%, transparent 70%);
    filter: blur(12px);
    z-index: -1;
}

/* Title glow halo under the book */
.title-glow-halo {
    position: absolute;
    top: -80px; left: -80px; right: -80px; bottom: -80px;
    background:
        radial-gradient(ellipse 45% 40% at 50% 50%, rgba(218,165,32,0.14) 0%, transparent 60%),
        radial-gradient(ellipse 60% 55% at 50% 50%, rgba(255,200,80,0.06) 0%, transparent 70%);
    animation: haloBreath 4s ease-in-out infinite;
    pointer-events: none;
    z-index: -1;
}

/* Divine light rays behind book */
.title-glow-halo::before {
    content: '';
    position: absolute;
    inset: -40px;
    background:
        conic-gradient(
            from 0deg at 50% 50%,
            transparent 0deg,
            rgba(218,165,32,0.04) 15deg,
            transparent 30deg,
            rgba(218,165,32,0.03) 50deg,
            transparent 65deg,
            rgba(218,165,32,0.05) 85deg,
            transparent 100deg,
            rgba(218,165,32,0.03) 120deg,
            transparent 140deg,
            rgba(218,165,32,0.04) 165deg,
            transparent 180deg,
            rgba(218,165,32,0.04) 200deg,
            transparent 220deg,
            rgba(218,165,32,0.03) 245deg,
            transparent 265deg,
            rgba(218,165,32,0.05) 290deg,
            transparent 310deg,
            rgba(218,165,32,0.03) 340deg,
            transparent 360deg
        );
    animation: raysRotate 30s linear infinite;
    border-radius: 50%;
}

@keyframes haloBreath {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.12); }
}

@keyframes raysRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ===== DESK ITEMS ===== */
.desk-items {
    position: absolute;
    bottom: 0; left: 0;
    width: 100%; height: 45%;
    z-index: 9;
    pointer-events: none;
}

.writing-set {
    position: absolute;
    bottom: 37%; left: 18%;
    opacity: 0.6;
}

.parchment {
    position: absolute;
    bottom: 37%; left: 5%;
    opacity: 0.85;
    transform: rotate(-2deg);
}

/* Newton's Cradle */
.newtons-cradle {
    position: absolute;
    bottom: 30%; left: 62%;
    width: 140px; height: 120px;
    opacity: 0.55;
}

.cradle-frame {
    position: absolute;
    top: 0; left: 0;
}

.cradle-balls {
    position: absolute;
    top: 20px; left: 30px;
    display: flex;
    gap: 0px;
    align-items: flex-start;
}

.cradle-string-ball {
    width: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform-origin: top center;
}

.cradle-string {
    width: 1px; height: 62px;
    background: rgba(180,160,120,0.4);
}

.cradle-ball {
    width: 14px; height: 14px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #C0B090, #8B7A60 50%, #5A4A30 100%);
    box-shadow: 0 1px 3px rgba(0,0,0,0.4), inset 0 1px 2px rgba(255,255,255,0.1);
}

/* Left ball swings out then rests when right swings */
.ball-left {
    animation: swingLeft 1.6s ease-in-out infinite;
}

/* Right ball swings out then rests when left swings */
.ball-right {
    animation: swingRight 1.6s ease-in-out infinite;
}

@keyframes swingLeft {
    0%   { transform: rotate(0deg); }
    50%  { transform: rotate(0deg); }
    75%  { transform: rotate(30deg); }
    100% { transform: rotate(0deg); }
}

@keyframes swingRight {
    0%   { transform: rotate(0deg); }
    25%  { transform: rotate(-30deg); }
    50%  { transform: rotate(0deg); }
    100% { transform: rotate(0deg); }
}

/* Physics desk objects */
.desk-object {
    position: absolute;
    pointer-events: none;
}

.magnifying-glass {
    bottom: 28%; right: 12%;
    opacity: 0.45;
    transform: rotate(25deg);
}

.hourglass {
    bottom: 16%; right: 42%;
    opacity: 0.4;
}

.prism {
    bottom: 26%; left: 35%;
    opacity: 0.4;
    transform: rotate(-8deg);
}

.compass-tool {
    bottom: 18%; right: 20%;
    opacity: 0.38;
    transform: rotate(12deg);
}

.pocket-watch {
    bottom: 24%; left: 25%;
    opacity: 0.4;
    transform: rotate(-15deg);
}

.telescope {
    bottom: 34%; left: 36%;
    opacity: 0.4;
    transform: rotate(-5deg);
}

.armillary {
    bottom: 26%; right: 6%;
    opacity: 0.42;
}

.pendulum-obj {
    top: 20%; left: 8%;
    opacity: 0.35;
}

.balance-scale {
    bottom: 20%; left: 10%;
    opacity: 0.38;
}

.small-globe {
    bottom: 14%; left: 42%;
    opacity: 0.4;
}

/* Scattered papers */
.desk-paper {
    position: absolute;
    pointer-events: none;
    opacity: 0.85;
    transition: opacity 0.3s ease;
}

.desk-paper text {
    fill: #000;
    opacity: 1;
}

.paper-wave {
    bottom: 10%; right: 8%;
    transform: rotate(4deg);
}

.paper-thermo {
    bottom: 6%; left: 30%;
    transform: rotate(-3deg);
}

.paper-quantum {
    bottom: 18%; left: 52%;
    transform: rotate(7deg);
}

.paper-em {
    bottom: 4%; right: 30%;
    transform: rotate(-5deg);
}

/* ===== PARTICLES ===== */
.particles {
    position: absolute;
    inset: 0;
    z-index: 16;
    pointer-events: none;
    overflow: hidden;
}

/* ===== VIGNETTE ===== */
.vignette {
    position: absolute; inset: 0;
    background: radial-gradient(
        ellipse 50% 45% at 48% 48%,
        transparent 0%,
        rgba(5,3,2,0.3) 40%,
        rgba(5,3,2,0.7) 70%,
        rgba(5,3,2,0.92) 100%
    );
    z-index: 17;
    pointer-events: none;
}

/* ===== CURSOR LIGHT (lantern reveal) ===== */
.cursor-light {
    position: fixed;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle,
        rgba(255,220,150,0.3) 0%,
        rgba(255,200,120,0.18) 15%,
        rgba(255,180,100,0.08) 35%,
        rgba(255,160,80,0.02) 55%,
        transparent 70%
    );
    pointer-events: none;
    z-index: 17;
    transform: translate(-50%, -50%);
    transition: opacity 0.4s ease;
    opacity: 0;
    mix-blend-mode: screen;
}

/* ===== CURSOR GLOW ===== */
.cursor-glow {
    position: fixed;
    width: 250px;
    height: 250px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(218,165,32,0.08) 0%, rgba(255,200,100,0.03) 30%, transparent 60%);
    pointer-events: none;
    z-index: 18;
    transform: translate(-50%, -50%);
    transition: opacity 0.3s ease;
    opacity: 0;
}

/* ===== ENTER HINT ===== */
.enter-hint {
    position: absolute;
    bottom: 7%; left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    opacity: 0;
    animation: fadeUp 2s ease forwards 2.5s;
}

.enter-hint p {
    font-family: 'EB Garamond', serif;
    font-style: italic;
    font-size: clamp(0.9rem, 1.8vw, 1.3rem);
    color: rgba(200,170,110,0.45);
    letter-spacing: 0.12em;
    animation: hintPulse 3.5s ease-in-out infinite;
}

@keyframes hintPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; text-shadow: 0 0 15px rgba(218,165,32,0.15); }
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateX(-50%) translateY(12px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ============================================
   ===== ZOOM TRANSITION =====
   Only animate transform & opacity (GPU-composited).
   Blur is handled by a backdrop-filter overlay that
   fades via opacity — no per-frame filter repaint.
   ============================================ */

/* GPU layer promotion — hint once, composite cheaply */
.scene,
.newton-scene {
    will-change: transform, opacity;
}

/* ── Transition overlay (black fade + blur) ── */
.zoom-blur-layer {
    position: fixed;
    inset: 0;
    z-index: 45;
    pointer-events: none;
    background: #000;
    opacity: 0;
    will-change: opacity;
    transition: opacity 1s ease;
}

.zoom-blur-layer.blackout-in {
    opacity: 1;
    transition: opacity 1s ease-in;
}

.zoom-blur-layer.blackout-out {
    opacity: 0;
    transition: opacity 1.2s ease-out;
}

/* ── Home scene: fade out to black ── */
.scene.zoom-into-book {
    animation: homeFadeOut 1s ease-in forwards;
}

@keyframes homeFadeOut {
    0%   { opacity: 1; }
    100% { opacity: 0; }
}

/* ── Newton scene: start blurred, unblur as black fades ── */
.newton-scene.newton-arrive-blurred {
    filter: blur(20px);
    opacity: 1;
    transition: filter 1.4s ease-out, opacity 0.3s ease;
}

.newton-scene.newton-arrive-clear {
    filter: blur(0px);
    transition: filter 1.4s ease-out;
}

/* ── Newton scene: departing ── */
.newton-scene.newton-zoom-out {
    animation: newtonDepart 0.8s ease-in forwards;
}

@keyframes newtonDepart {
    0%   { opacity: 1; }
    100% { opacity: 0; }
}

/* ── Home scene: arriving back ── */
.scene.zoom-arrive-home {
    animation: homeArrival 0.8s ease-out forwards;
}

@keyframes homeArrival {
    0%   { opacity: 0; }
    100% { opacity: 1; }
}

/* Reset home scene after returning */
.scene.zoom-reset {
    transform: scale(1);
    opacity: 1;
}

/* ============================================
   ===== BOOKMARK NAV (dropdown menu) =====
   ============================================ */
.bookmark-ribbon {
    position: fixed;
    top: 0;
    right: 40px;
    z-index: 50;
    display: none;
}

.bookmark-ribbon.bookmark-visible {
    display: block;
}

.bookmark-tab {
    background: linear-gradient(180deg, #f0e6d0 0%, #e8dcc0 100%);
    color: #3a2a18;
    font-family: 'EB Garamond', serif;
    font-size: 13px;
    letter-spacing: 0.05em;
    padding: 6px 16px 8px;
    text-align: center;
    border: 1px solid rgba(160,140,100,0.4);
    border-top: none;
    border-radius: 0 0 5px 5px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.25);
    cursor: pointer;
    position: relative;
    transition: background 0.2s ease, border-color 0.2s ease;
    user-select: none;
}

.bookmark-tab:hover {
    background: linear-gradient(180deg, #f4ead4 0%, #ece0c8 100%);
    border-color: rgba(160,140,100,0.6);
}

.bookmark-tab::after {
    display: none;
}

.bookmark-text {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.bookmark-text::after {
    content: '▾';
    font-size: 10px;
    transition: transform 0.3s ease;
}

.bookmark-ribbon.menu-is-open .bookmark-text::after {
    transform: rotate(180deg);
}

/* Dropdown menu — paper sheet slides down */
.bookmark-menu {
    position: absolute;
    top: 100%;
    right: -20px;
    min-width: 220px;
    background: linear-gradient(180deg, #f0e6d0 0%, #e8dcc0 60%, #e0d4b8 100%);
    border: 1px solid rgba(160,140,100,0.4);
    border-top: none;
    border-radius: 0 0 4px 4px;
    padding: 0 10px;
    max-height: 0;
    overflow: hidden;
    box-shadow: none;
    opacity: 0;
    pointer-events: none;
    transition: max-height 0.35s ease, opacity 0.25s ease, padding 0.35s ease, box-shadow 0.3s ease;
}

.bookmark-menu.menu-open {
    max-height: 300px;
    padding: 10px 10px 14px;
    opacity: 1;
    pointer-events: auto;
    box-shadow: 0 6px 20px rgba(0,0,0,0.3), 0 1px 3px rgba(0,0,0,0.15);
}

.bookmark-btn {
    display: block;
    width: 100%;
    padding: 7px 10px;
    background: transparent;
    border: none;
    color: #3a2a18;
    font-family: 'EB Garamond', serif;
    font-size: 14.5px;
    cursor: pointer;
    transition: color 0.2s ease;
    text-align: left;
    text-decoration: none;
    line-height: 1.4;
}

.bookmark-btn:hover {
    text-decoration: underline;
    text-decoration-color: rgba(58,42,24,0.4);
    text-underline-offset: 2px;
    color: #2a1a08;
}

.bookmark-btn.active {
    color: #9a7a2a;
    font-weight: 700;
}

/* ============================================
   ===== NEWTON SCENE =====
   ============================================ */
.newton-scene {
    position: fixed;
    inset: 0;
    z-index: 40;
    overflow: hidden;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

.newton-scene.newton-visible {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

/* Sky */
.newton-sky {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, #4a90d9 0%, #7ab8e8 35%, #a8d8f0 60%, #d4eef8 80%, #e8f5e0 100%);
}

/* Sun */
.newton-sun {
    position: absolute;
    top: -40px;
    right: 80px;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,250,200,0.9) 0%, rgba(255,240,150,0.5) 30%, rgba(255,220,100,0.15) 60%, transparent 80%);
    box-shadow: 0 0 80px rgba(255,240,150,0.4), 0 0 160px rgba(255,220,100,0.15);
}

/* Clouds */
.newton-clouds {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.cloud {
    position: absolute;
    animation: cloudDrift linear infinite;
}

.cloud-1 { top: 8%; left: -15%; animation-duration: 60s; }
.cloud-2 { top: 15%; left: -20%; animation-duration: 80s; animation-delay: -25s; }
.cloud-3 { top: 5%; left: -10%; animation-duration: 70s; animation-delay: -40s; }

@keyframes cloudDrift {
    from { transform: translateX(0); }
    to { transform: translateX(calc(100vw + 250px)); }
}

.cloud-puff {
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,0.85);
}

.cloud-1 .cp1 { width: 80px; height: 40px; top: 10px; left: 0; }
.cloud-1 .cp2 { width: 100px; height: 50px; top: 0; left: 30px; }
.cloud-1 .cp3 { width: 70px; height: 35px; top: 12px; left: 90px; }

.cloud-2 .cp1 { width: 60px; height: 30px; top: 8px; left: 0; }
.cloud-2 .cp2 { width: 80px; height: 40px; top: 0; left: 20px; }
.cloud-2 .cp3 { width: 55px; height: 28px; top: 10px; left: 70px; }

.cloud-3 .cp1 { width: 90px; height: 45px; top: 10px; left: 0; }
.cloud-3 .cp2 { width: 110px; height: 55px; top: 0; left: 35px; }
.cloud-3 .cp3 { width: 80px; height: 40px; top: 12px; left: 100px; }

/* Hills */
.newton-hills {
    position: absolute;
    bottom: 15%;
    left: 0;
    width: 100%;
    height: 30%;
}

/* Apple tree */
.newton-tree {
    position: absolute;
    bottom: 8%;
    left: 10%;
}

/* Newton figure */
.newton-figure {
    position: absolute;
    bottom: 8%;
    left: calc(10% + 200px);
}

/* Falling apple container */
.falling-apple-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 5;
}

/* Foreground grass */
.newton-grass {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 18%;
    background: linear-gradient(180deg, #4a9a3a 0%, #3d8a30 30%, #358028 60%, #2d7020 100%);
}

.newton-grass-blades {
    position: absolute;
    bottom: 16%;
    left: 0;
    width: 100%;
    height: 40px;
    pointer-events: none;
    overflow: hidden;
}

.grass-blade {
    position: absolute;
    bottom: 0;
    width: 3px;
    background: linear-gradient(to top, #4a9a3a, #6ab84a);
    border-radius: 50% 50% 0 0;
    transform-origin: bottom center;
    animation: grassSway 3s ease-in-out infinite;
}

@keyframes grassSway {
    0%, 100% { transform: rotate(-5deg); }
    50% { transform: rotate(5deg); }
}

/* Birds */
.newton-birds {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 6;
}

/* Pollen */
.newton-pollen {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 7;
    overflow: hidden;
}

/* Green vignette */
.newton-vignette {
    position: absolute;
    inset: 0;
    background: radial-gradient(
        ellipse 60% 55% at 50% 50%,
        transparent 0%,
        rgba(20,60,10,0.08) 50%,
        rgba(10,40,5,0.2) 80%,
        rgba(5,30,0,0.35) 100%
    );
    z-index: 8;
    pointer-events: none;
}

/* ============================================
   ===== DIALOGUE BOX =====
   ============================================ */
.dialogue-box {
    position: fixed;
    top: 6%;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    z-index: 50;
    max-width: 700px;
    width: 90%;
    padding: 24px 32px 20px;
    background: linear-gradient(180deg, rgba(15,12,8,0.88) 0%, rgba(10,8,5,0.92) 100%);
    border: 1px solid rgba(218,165,32,0.2);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 16px rgba(218,165,32,0.06);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.dialogue-box.dialogue-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.dialogue-box.dialogue-fade-out {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.dialogue-text {
    font-family: 'EB Garamond', serif;
    font-size: clamp(1rem, 2.2vw, 1.35rem);
    color: rgba(220,200,160,0.92);
    text-align: center;
    line-height: 1.6;
    min-height: 1.6em;
}

.dialogue-cursor {
    text-align: center;
    color: rgba(218,165,32,0.5);
    font-size: 10px;
    margin-top: 10px;
    animation: cursorBlink 1.2s ease-in-out infinite;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.dialogue-cursor.cursor-visible {
    opacity: 1;
}

@keyframes cursorBlink {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; }
}

/* ── Acceleration dialogue override ── */
.accel-dialogue-box {
    top: auto;
    bottom: 8%;
}

/* ============================================
   ===== NEWTON ZOOM TO TREE =====
   ============================================ */
.newton-scene.newton-zoom-to-tree {
    animation: zoomToTree 1.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes zoomToTree {
    0%   { transform: scale(1) translate(0, 0); }
    100% { transform: scale(1.8) translate(-18%, 10%); }
}

/* ============================================
   ===== LAWS OVERLAY =====
   ============================================ */
.laws-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    pointer-events: none;
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    padding: 5% 3%;
    gap: 24px;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.laws-overlay.laws-visible {
    opacity: 1;
}

.law-card {
    flex: 1;
    max-width: 300px;
    padding: 22px 24px;
    background: linear-gradient(135deg, rgba(15,12,8,0.88) 0%, rgba(20,16,10,0.92) 100%);
    border: 1px solid rgba(218,165,32,0.3);
    border-radius: 8px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.5), 0 0 12px rgba(218,165,32,0.08);
    pointer-events: none;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.laws-visible .law-card {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.law-number {
    font-family: 'Cinzel Decorative', serif;
    font-size: 28px;
    font-weight: 700;
    color: #D4A017;
    text-shadow: 0 0 12px rgba(218,165,32,0.4);
    margin-bottom: 4px;
}

.law-title {
    font-family: 'Cinzel', serif;
    font-size: 15px;
    font-weight: 700;
    color: rgba(220,200,160,0.95);
    margin-bottom: 8px;
    letter-spacing: 0.03em;
}

.law-desc {
    font-family: 'EB Garamond', serif;
    font-size: 13.5px;
    color: rgba(200,180,140,0.75);
    line-height: 1.5;
    margin-bottom: 12px;
}

.law-equation {
    font-family: 'EB Garamond', serif;
    font-size: 22px;
    font-style: italic;
    color: #D4A017;
    text-shadow: 0 0 8px rgba(218,165,32,0.3);
    text-align: center;
}

/* ── Law II glow effect ── */
.law-card-2 {
    cursor: pointer;
    animation: law2Glow 2s ease-in-out infinite;
    border-width: 2px;
}

@keyframes law2Glow {
    0%, 100% {
        box-shadow: 0 6px 24px rgba(0,0,0,0.5), 0 0 20px rgba(218,165,32,0.2), 0 0 40px rgba(218,165,32,0.1);
        border-color: rgba(218,165,32,0.5);
        transform: translateY(0) scale(1);
    }
    50% {
        box-shadow: 0 6px 24px rgba(0,0,0,0.5), 0 0 35px rgba(218,165,32,0.5), 0 0 70px rgba(218,165,32,0.25), 0 0 100px rgba(218,165,32,0.1);
        border-color: rgba(255,210,80,0.8);
        transform: translateY(-2px) scale(1.02);
    }
}

/* ── Law II expanded (focused) state ── */
.laws-overlay.law2-focused {
    justify-content: center;
}

.laws-overlay.law2-focused .law-card-1,
.laws-overlay.law2-focused .law-card-3 {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
    max-width: 0;
    padding: 0;
    margin: 0;
    overflow: hidden;
    flex: 0;
    border: none;
    box-shadow: none;
    transition: opacity 0.5s ease, transform 0.5s ease, max-width 0.5s ease, padding 0.5s ease, flex 0.5s ease;
}

.laws-overlay.law2-focused .law-card-2 {
    max-width: 520px;
    animation: none;
    cursor: default;
    box-shadow: 0 8px 40px rgba(0,0,0,0.6), 0 0 32px rgba(218,165,32,0.2);
    border-color: rgba(218,165,32,0.5);
    transition: max-width 0.6s ease, box-shadow 0.5s ease;
}

/* ── F=ma breakdown ── */
.fma-breakdown {
    margin-top: 20px;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.6s ease 0.3s, max-height 0.6s ease 0.1s;
}

.laws-overlay.law2-focused .fma-breakdown {
    opacity: 1;
    max-height: 400px;
}

.fma-equation-large {
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 20px;
}

.fma-component {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.fma-symbol {
    font-family: 'EB Garamond', serif;
    font-size: 48px;
    font-style: italic;
    font-weight: 700;
    line-height: 1;
}

.fma-symbol-f { color: #e8a832; }
.fma-symbol-eq { color: rgba(220,200,160,0.6); font-weight: 400; font-size: 40px; }
.fma-symbol-m { color: #6ab4e8; }
.fma-symbol-a { color: #e86a6a; }

.fma-label {
    font-family: 'EB Garamond', serif;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: 3px;
    white-space: nowrap;
}

.fma-label-f { color: #e8a832; border: 1px solid rgba(232,168,50,0.3); }
.fma-label-m { color: #6ab4e8; border: 1px solid rgba(106,180,232,0.3); }
.fma-label-a { color: #e86a6a; border: 1px solid rgba(232,106,106,0.3); }

.fma-divider {
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(218,165,32,0.25), transparent);
    margin: 16px 0;
}

.fma-details {
    display: flex;
    justify-content: space-around;
    gap: 16px;
}

.fma-detail {
    flex: 1;
    text-align: center;
}

.fma-detail-symbol {
    font-family: 'EB Garamond', serif;
    font-size: 20px;
    font-style: italic;
    font-weight: 700;
    margin-bottom: 4px;
}

.fma-detail-symbol-f { color: #e8a832; }
.fma-detail-symbol-m { color: #6ab4e8; }
.fma-detail-symbol-a { color: #e86a6a; }

.fma-detail-name {
    font-family: 'Cinzel', serif;
    font-size: 11px;
    font-weight: 700;
    color: rgba(220,200,160,0.9);
    margin-bottom: 4px;
}

.fma-detail-desc {
    font-family: 'EB Garamond', serif;
    font-size: 12.5px;
    color: rgba(200,180,140,0.65);
    line-height: 1.4;
}

.fma-detail-unit {
    font-family: 'EB Garamond', serif;
    font-size: 11.5px;
    font-style: italic;
    color: rgba(200,180,140,0.45);
    margin-top: 3px;
}

/* ── Next button ── */
.next-btn {
    position: fixed;
    bottom: 6%;
    right: 6%;
    z-index: 55;
    font-family: 'EB Garamond', serif;
    font-size: 18px;
    color: #D4A017;
    background: linear-gradient(135deg, rgba(15,12,8,0.9) 0%, rgba(20,16,10,0.95) 100%);
    border: 1px solid rgba(218,165,32,0.4);
    border-radius: 6px;
    padding: 10px 28px;
    cursor: pointer;
    letter-spacing: 0.05em;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4), 0 0 12px rgba(218,165,32,0.1);
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity 0.5s ease, transform 0.5s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.next-btn.next-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.next-btn:hover {
    border-color: rgba(255,210,80,0.7);
    box-shadow: 0 4px 16px rgba(0,0,0,0.4), 0 0 20px rgba(218,165,32,0.25);
}

/* ============================================
   ===== ACCELERATION SCENE (Lesson 1.1) =====
   ============================================ */
.accel-scene {
    position: fixed;
    inset: 0;
    z-index: 40;
    overflow: hidden;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

.accel-scene.accel-visible {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.accel-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, #0a0e1a 0%, #141828 40%, #1a2040 100%);
}

.accel-title {
    position: absolute;
    top: 6%;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Cinzel', serif;
    font-size: clamp(16px, 2.5vw, 24px);
    font-weight: 700;
    color: rgba(220,200,160,0.85);
    letter-spacing: 0.08em;
    text-shadow: 0 0 12px rgba(218,165,32,0.3);
    z-index: 2;
}

.accel-floor {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 30%;
    background: linear-gradient(180deg, #1a1a2e 0%, #12121f 100%);
    border-top: 1px solid rgba(100,100,160,0.15);
}

.accel-orb-track {
    position: absolute;
    top: 50%;
    left: 10%;
    right: 10%;
    height: 80px;
    transform: translateY(-50%);
    z-index: 3;
}

.accel-orb {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: radial-gradient(circle at 38% 35%, #8ec8ff 0%, #4a90d9 40%, #2a60a0 70%, #1a3a6a 100%);
    box-shadow: 0 0 20px rgba(100,160,255,0.4), 0 0 40px rgba(80,140,240,0.15), 0 4px 12px rgba(0,0,0,0.5);
}

.accel-velocity-label {
    position: absolute;
    bottom: 60px;
    left: 0;
    width: 50px;
    text-align: center;
    font-family: 'EB Garamond', serif;
    font-size: 22px;
    font-style: italic;
    z-index: 4;
    transition: left 0s;
}

.vel-sign {
    color: #6ae86a;
    font-style: normal;
    font-weight: 700;
    transition: color 0.15s ease;
}

.vel-sign.vel-negative {
    color: #e86a6a;
}

.vel-symbol {
    color: rgba(220,200,160,0.9);
    text-shadow: 0 0 8px rgba(218,165,32,0.3);
}

.accel-vignette {
    position: absolute;
    inset: 0;
    background: radial-gradient(
        ellipse 55% 50% at 50% 50%,
        transparent 0%,
        rgba(5,5,15,0.3) 50%,
        rgba(2,2,10,0.7) 100%
    );
    z-index: 5;
    pointer-events: none;
}

/* Acceleration scene arrive/depart (reuse blackout pattern) */
.accel-scene.accel-arrive-blurred {
    filter: blur(20px);
    opacity: 1;
    transition: filter 1.4s ease-out, opacity 0.3s ease;
}

.accel-scene.accel-arrive-clear {
    filter: blur(0px);
    transition: filter 1.4s ease-out;
}

.accel-scene.accel-zoom-out {
    animation: accelDepart 0.8s ease-in forwards;
}

@keyframes accelDepart {
    0%   { opacity: 1; }
    100% { opacity: 0; }
}

/* ── Origin marker (center of track) ── */
.accel-origin-marker {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 0;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

.origin-line {
    width: 1px;
    height: 100%;
    background: repeating-linear-gradient(
        180deg,
        rgba(220,200,160,0.25) 0px,
        rgba(220,200,160,0.25) 4px,
        transparent 4px,
        transparent 8px
    );
}

.origin-label {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'EB Garamond', serif;
    font-size: 13px;
    color: rgba(200,180,140,0.5);
}

/* ── Displacement label (follows orb) ── */
.accel-displacement-label {
    position: absolute;
    bottom: 90px;
    left: 0;
    width: 50px;
    text-align: center;
    font-family: 'EB Garamond', serif;
    font-size: 15px;
    font-style: italic;
    color: rgba(220,200,160,0.9);
    z-index: 4;
    transition: left 0s;
    opacity: 0;
    pointer-events: none;
    white-space: nowrap;
}

.accel-displacement-label.disp-visible {
    opacity: 1;
    transition: opacity 0.6s ease, left 0s;
}

.disp-sign {
    font-style: normal;
    font-weight: 700;
    color: #6ae86a;
    transition: color 0.15s ease;
}

.disp-sign.disp-negative {
    color: #e86a6a;
}

/* ── Formula display (Δx = vt) ── */
.accel-formula {
    position: fixed;
    top: 15%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 55;
    font-family: 'EB Garamond', serif;
    font-size: 34px;
    font-style: italic;
    color: #D4A017;
    text-shadow: 0 0 12px rgba(218,165,32,0.3);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease;
}

.accel-formula.formula-visible {
    opacity: 1;
}

.formula-delta {
    font-style: normal;
}

.formula-eq {
    color: rgba(220,200,160,0.6);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .book { transform: rotateX(55deg) rotateZ(-8deg) scale(0.7); animation: none; }
    .lamp { right: 8%; transform: scale(0.75); transform-origin: bottom right; }
}

@media (max-width: 480px) {
    .book { transform: rotateX(55deg) rotateZ(-8deg) scale(0.5); }
    .lamp { right: 4%; transform: scale(0.6); }
}

/* ===== PRACTICE PANEL ===== */
.practice-panel {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: none;
    flex-direction: column;
    overflow: hidden;
    background: radial-gradient(ellipse 80% 70% at 50% 45%, #1e1810 0%, #110d07 70%, #060403 100%);
    color: #d6c8b4;
    font-family: 'EB Garamond', serif;
    padding: 5vh 6vw;
}
.practice-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 18% 22%, rgba(218,165,32,0.05), transparent 40%),
        radial-gradient(circle at 82% 78%, rgba(194,89,62,0.05), transparent 40%);
    pointer-events: none;
}
.practice-panel.practice-visible {
    display: flex;
    animation: practice-fade-in 0.7s ease-out;
}
@keyframes practice-fade-in {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.practice-header {
    flex-shrink: 0;
    padding: 0 8px 18px;
    border-bottom: 1px solid rgba(184,146,74,0.25);
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    position: relative;
    z-index: 1;
}
.practice-title {
    font-family: 'Cinzel', serif;
    font-size: clamp(20px, 2.4vw, 28px);
    letter-spacing: 0.06em;
    color: #d8c890;
    text-shadow: 0 0 12px rgba(218,165,32,0.2);
}
.practice-progress {
    font-size: 14px;
    color: rgba(214,200,180,0.65);
    font-style: italic;
    letter-spacing: 0.04em;
}

.practice-formula-ref {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 18px;
    background: linear-gradient(180deg, rgba(50,38,24,0.55), rgba(30,22,12,0.65));
    border: 1px solid rgba(184,146,74,0.4);
    border-radius: 3px;
    box-shadow: 0 0 14px rgba(218,165,32,0.08), inset 0 0 12px rgba(218,165,32,0.04);
}
.formula-ref-label {
    font-family: 'Cinzel', serif;
    font-size: 10px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: rgba(184,146,74,0.85);
}
.formula-ref-eq {
    font-family: 'EB Garamond', serif;
    font-size: 22px;
    color: #f0d890;
    text-shadow: 0 0 10px rgba(218,165,32,0.25);
    letter-spacing: 0.02em;
}
.formula-ref-eq i {
    font-style: italic;
    color: #e8c890;
}

.practice-body {
    flex: 1;
    display: flex;
    gap: 32px;
    padding: 28px 8px 0;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.practice-question {
    flex: 1.5;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow-y: auto;
}
.question-type {
    font-size: 11px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: rgba(184,146,74,0.85);
    margin-bottom: 10px;
}
.question-text {
    font-size: clamp(17px, 1.6vw, 21px);
    line-height: 1.6;
    color: #e8dcc4;
    margin-bottom: 22px;
}
.question-text b { color: #f0d890; font-weight: 700; }
.question-text i { color: #e8c890; }

.question-answer-area {
    flex: 1;
}

.fr-input-wrap {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-top: 4px;
}
.fr-input {
    background: rgba(20,15,8,0.6);
    border: 1px solid rgba(184,146,74,0.4);
    color: #f0e4cc;
    font-family: 'EB Garamond', serif;
    font-size: 22px;
    padding: 10px 16px;
    width: 180px;
    border-radius: 2px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.fr-input:focus {
    border-color: #c2593e;
    box-shadow: 0 0 0 3px rgba(194,89,62,0.15);
}
.fr-input:disabled {
    opacity: 0.7;
    color: #c4dca0;
    border-color: rgba(111,160,64,0.5);
}
.fr-unit {
    color: rgba(214,200,180,0.7);
    font-style: italic;
    font-size: 17px;
}

.mc-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.mc-option {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 12px 16px;
    background: rgba(20,15,8,0.45);
    border: 1px solid rgba(184,146,74,0.22);
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
}
.mc-option:hover:not(.mc-locked) {
    background: rgba(36,26,14,0.7);
    border-color: rgba(184,146,74,0.55);
}
.mc-option.mc-selected {
    background: rgba(56,38,18,0.6);
    border-color: #b8924a;
}
.mc-option.mc-correct {
    background: rgba(40,70,30,0.45);
    border-color: #6fa040;
}
.mc-option.mc-wrong {
    background: rgba(80,30,20,0.45);
    border-color: #c2593e;
    opacity: 0.55;
}
.mc-option.mc-locked {
    cursor: default;
}
.mc-letter {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(184,146,74,0.15);
    border: 1px solid rgba(184,146,74,0.4);
    color: #d8c890;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Cinzel', serif;
    font-size: 14px;
    font-weight: 700;
}
.mc-option.mc-correct .mc-letter {
    background: rgba(111,160,64,0.25);
    border-color: #6fa040;
    color: #c4dca0;
}
.mc-option.mc-wrong .mc-letter {
    background: rgba(194,89,62,0.2);
    border-color: #c2593e;
    color: #f0c0a8;
}
.mc-text {
    font-size: 16px;
    line-height: 1.5;
    color: #e8dcc4;
}

.practice-controls {
    display: flex;
    gap: 12px;
    margin-top: 18px;
}
.practice-submit, .practice-next {
    padding: 9px 26px;
    background: linear-gradient(180deg, #6a4220, #4a2c10);
    border: 1px solid #8B6914;
    color: #f0e4cc;
    font-family: 'Cinzel', serif;
    font-size: 14px;
    letter-spacing: 0.1em;
    cursor: pointer;
    border-radius: 2px;
    transition: all 0.2s ease;
    text-transform: uppercase;
}
.practice-submit:hover, .practice-next:hover {
    background: linear-gradient(180deg, #7a5230, #5a3c20);
    box-shadow: 0 2px 14px rgba(184,146,74,0.25);
}
.practice-submit:disabled { opacity: 0.4; cursor: not-allowed; }
.practice-next { display: none; }
.practice-next.next-visible { display: inline-block; }

.practice-feedback {
    margin-top: 16px;
    padding: 12px 18px;
    border-radius: 3px;
    font-size: 15px;
    line-height: 1.55;
    display: none;
    max-width: 720px;
}
.practice-feedback b { color: inherit; font-weight: 700; }
.practice-feedback i { font-style: italic; }
.practice-feedback.feedback-correct {
    background: rgba(40,70,30,0.28);
    border-left: 3px solid #6fa040;
    color: #c4dca0;
    display: block;
}
.practice-feedback.feedback-wrong {
    background: rgba(80,30,20,0.3);
    border-left: 3px solid #c2593e;
    color: #f0c0a8;
    display: block;
}

.practice-complete {
    text-align: center;
    padding-top: 60px;
}
.complete-title {
    font-family: 'Cinzel Decorative', serif;
    font-size: 42px;
    color: #d8c890;
    text-shadow: 0 0 18px rgba(218,165,32,0.3);
    letter-spacing: 0.04em;
}
.complete-sub {
    margin-top: 18px;
    font-style: italic;
    color: rgba(214,200,180,0.75);
    font-size: 17px;
}

/* ===== CALCULATOR ===== */
.practice-calculator {
    flex: 0 0 280px;
    background: linear-gradient(180deg, rgba(26,20,12,0.78), rgba(14,10,6,0.9));
    border: 1px solid rgba(184,146,74,0.32);
    border-radius: 4px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 6px 30px rgba(0,0,0,0.45), inset 0 0 30px rgba(184,146,74,0.04);
    align-self: flex-start;
    max-height: 100%;
}
.calc-label {
    font-family: 'Cinzel', serif;
    font-size: 12px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: rgba(184,146,74,0.85);
    margin-bottom: 10px;
    text-align: center;
}
.calc-display {
    background: rgba(8,6,3,0.85);
    border: 1px solid rgba(184,146,74,0.3);
    border-radius: 2px;
    padding: 14px 16px;
    text-align: right;
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 22px;
    color: #f0e4cc;
    margin-bottom: 14px;
    min-height: 54px;
    word-break: break-all;
    overflow-x: auto;
    text-shadow: 0 0 8px rgba(218,165,32,0.15);
}
.calc-keys {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 7px;
}
.calc-key {
    padding: 12px 0;
    background: linear-gradient(180deg, #3a2818, #2a1c10);
    border: 1px solid #5a3818;
    color: #e8dcc4;
    font-family: 'Cinzel', serif;
    font-size: 16px;
    cursor: pointer;
    border-radius: 2px;
    transition: background 0.12s ease, border-color 0.12s ease, transform 0.06s ease;
}
.calc-key:hover {
    background: linear-gradient(180deg, #4a3220, #3a2418);
    border-color: #8B6914;
}
.calc-key:active { transform: translateY(1px); }
.calc-key.calc-op { color: #d8c890; }
.calc-key.calc-clear {
    color: #c2593e;
    border-color: rgba(194,89,62,0.4);
}
.calc-key.calc-eq {
    background: linear-gradient(180deg, #8a4020, #6a2c10);
    border-color: #c2593e;
    color: #f0e4cc;
    font-weight: 700;
}
.calc-key.calc-eq:hover {
    background: linear-gradient(180deg, #a85030, #8a3a20);
    box-shadow: 0 0 12px rgba(194,89,62,0.3);
}

@media (max-width: 900px) {
    .practice-body { flex-direction: column; gap: 18px; }
    .practice-calculator { flex: 0 0 auto; width: 100%; max-width: 360px; align-self: center; }
}

.practice-lesson-next {
    display: inline-block;
    margin-top: 32px;
    padding: 12px 36px;
    background: linear-gradient(180deg, #8a4020, #6a2c10);
    border: 1px solid #c2593e;
    color: #f0e4cc;
    font-family: 'Cinzel', serif;
    font-size: 15px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    border-radius: 2px;
    transition: all 0.2s ease;
    box-shadow: 0 0 18px rgba(194,89,62,0.15);
}
.practice-lesson-next:hover {
    background: linear-gradient(180deg, #a85030, #8a3a20);
    box-shadow: 0 0 26px rgba(194,89,62,0.35);
    transform: translateY(-1px);
}

/* ===== LESSON 1.2 — ACCELERATION SCENE ===== */
.accel2-scene {
    position: fixed;
    inset: 0;
    z-index: 40;
    overflow: hidden;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}
.accel2-scene.accel2-visible {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.accel2-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, #150a1f 0%, #1d1232 40%, #2a1855 100%);
}

.accel2-title {
    position: absolute;
    top: 6%;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Cinzel', serif;
    font-size: clamp(16px, 2.5vw, 24px);
    font-weight: 700;
    color: rgba(220,200,160,0.85);
    letter-spacing: 0.08em;
    text-shadow: 0 0 14px rgba(218,165,32,0.35);
    z-index: 2;
}

.accel2-floor {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 30%;
    background: linear-gradient(180deg, #1a142a 0%, #120e22 100%);
    border-top: 1px solid rgba(160,120,200,0.18);
}

.accel2-orb-track {
    position: absolute;
    top: 50%;
    left: 6%;
    right: 6%;
    height: 100px;
    transform: translateY(-50%);
    z-index: 3;
}

.accel2-origin-marker {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
}
.accel2-origin-marker .origin-line {
    position: absolute;
    top: -10px;
    bottom: -10px;
    left: 50%;
    width: 0;
    border-left: 2px dotted rgba(220,200,160,0.45);
    transform: translateX(-50%);
}
.accel2-origin-marker .origin-label {
    position: absolute;
    bottom: -28px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'EB Garamond', serif;
    font-size: 16px;
    color: rgba(220,200,160,0.7);
    font-style: italic;
}

.accel2-orb {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    transition: left 0s;
    will-change: left;
}
.accel2-orb-1 {
    background: radial-gradient(circle at 38% 35%, #8ec8ff 0%, #4a90d9 40%, #2a60a0 70%, #1a3a6a 100%);
    box-shadow: 0 0 22px rgba(100,160,255,0.5), 0 0 44px rgba(80,140,240,0.18), 0 4px 12px rgba(0,0,0,0.5);
}
.accel2-orb-2 {
    background: radial-gradient(circle at 38% 35%, #ffd08c 0%, #e8842c 40%, #b25416 70%, #7a3208 100%);
    box-shadow: 0 0 22px rgba(255,160,80,0.5), 0 0 44px rgba(240,120,60,0.18), 0 4px 12px rgba(0,0,0,0.5);
}

.accel2-data-block {
    position: absolute;
    bottom: 56px;
    left: 0;
    width: 44px;
    text-align: center;
    z-index: 4;
    transition: left 0s;
    pointer-events: none;
    font-family: 'EB Garamond', serif;
}
.accel2-data-block .data-row {
    white-space: nowrap;
    transform: translateX(-50%);
    margin-left: 22px; /* shift center over orb (half of orb width) */
    font-size: 14px;
    line-height: 1.35;
    color: rgba(220,200,160,0.85);
    text-shadow: 0 0 6px rgba(0,0,0,0.7);
}
.accel2-data-block .data-key {
    color: #f0d890;
    font-style: italic;
    font-weight: 700;
}
.accel2-data-block .data-key i { font-style: italic; }
.accel2-data-block .data-val {
    color: #f0e4cc;
    font-variant-numeric: tabular-nums;
}
.accel2-data-block .data-unit {
    color: rgba(220,200,160,0.6);
    font-style: italic;
    font-size: 12px;
}
.accel2-data-block .data-row-acc {
    opacity: 0;
    transition: opacity 0.6s ease;
}
.accel2-scene.accel2-show-acc .accel2-data-block .data-row-acc {
    opacity: 1;
}

/* When the grid is shown, hide the original single-pair track */
.accel2-scene.accel2-show-grid .accel2-orb-track {
    display: none;
}

/* ===== 3-ROW ACCELERATION GRID ===== */
.accel2-grid {
    position: absolute;
    top: 24%;
    left: 6%;
    right: 6%;
    bottom: 36%;
    z-index: 3;
    display: none;
    flex-direction: column;
    gap: 14px;
    justify-content: space-around;
}
.accel2-scene.accel2-show-grid .accel2-grid {
    display: flex;
    animation: gridFadeIn 0.7s ease-out;
}
@keyframes gridFadeIn {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

.accel2-grid-row {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 22px;
}
.grid-row-label {
    flex: 0 0 130px;
    text-align: right;
    font-family: 'EB Garamond', serif;
    font-size: 19px;
    color: #f0d890;
    text-shadow: 0 0 10px rgba(218,165,32,0.2);
    letter-spacing: 0.02em;
}
.grid-row-label i { font-style: italic; }

.grid-row-track {
    flex: 1;
    position: relative;
    height: 56px;
    background: linear-gradient(180deg, rgba(20,15,30,0.55), rgba(14,10,20,0.65));
    border-top: 1px solid rgba(160,120,200,0.2);
    border-bottom: 1px solid rgba(160,120,200,0.2);
    border-radius: 2px;
    overflow: visible;
}

.grid-origin {
    position: absolute;
    top: -4px;
    bottom: -4px;
    left: 50%;
    width: 0;
    border-left: 2px dotted rgba(220,200,160,0.45);
    transform: translateX(-50%);
    pointer-events: none;
}

.grid-orb {
    position: absolute;
    width: 28px;
    height: 28px;
    bottom: 14px;
    border-radius: 50%;
    visibility: hidden;
}

.accel2-vignette {
    position: absolute;
    inset: 0;
    background: radial-gradient(
        ellipse 55% 50% at 50% 50%,
        transparent 0%,
        rgba(10,5,20,0.3) 50%,
        rgba(5,2,12,0.7) 100%
    );
    z-index: 5;
    pointer-events: none;
}

.accel2-scene.accel2-arrive-blurred {
    filter: blur(20px);
    opacity: 1;
    transition: filter 1.4s ease-out, opacity 0.3s ease;
}
.accel2-scene.accel2-arrive-clear {
    filter: blur(0px);
    transition: filter 1.4s ease-out;
}
.accel2-scene.accel2-zoom-out {
    animation: accelDepart 0.8s ease-in forwards;
}

/* Formula for lesson 1.2 — positioned same as accel-formula */
.accel2-formula {
    /* Inherits .accel-formula positioning + .formula-visible reveal */
}
