/* Part 2 of 7 of the game's stylesheet (was style.css; the parts load in order, so rule
   order is exactly as before). Mostly: Modals, game layout, map/location cards, Hard Mode filter, particles, damage popups, impact flashes, screen shake, tactile buttons, book theme. */

/* MODALS */
#overlay, #confirm-overlay, #levelup-overlay {
    position: fixed; inset: 0; 
    /* [BETA CHANGE] Removed backdrop-filter:blur for mobile performance */
    background: rgba(10, 12, 16, 0.98); 
    display: flex; align-items: center; justify-content: center; z-index: 9999; 
    overflow-y: auto; padding: 20px 0; 
}
#overlay:not(.active), #confirm-overlay:not(.active), #levelup-overlay:not(.active) { display: none; }

.modal-box { 
    background: #1e2227; border: 1px solid var(--accent-gold); 
    padding: 30px; width: 90%; max-width: 420px; text-align: center; 
    box-shadow: 0 20px 50px rgba(0,0,0,0.8); 
    margin: auto; 
    height: auto; max-height: 90dvh; overflow-y: auto;
    border-radius: 8px;
    position:relative;
}
    
    /* SELECT BUTTONS */

    .confirm-btn-group { display: flex; gap: 10px; margin-top: 20px; }
    .confirm-btn { flex: 1; padding: 18px; cursor: pointer; text-transform: uppercase; font-weight: bold; font-family: var(--font-head); border-radius: 6px; box-shadow: 0 4px 0 rgba(0,0,0,0.3); }
    .c-yes { background: #6b2e2e; color: #ffcccc; border: 1px solid #e15f5f; }
    .c-yes:hover { background: #853333; }
    .c-no { background: #2c313a; color: #fff; border: 1px solid var(--border-color); }
    .c-no:hover { background: #3a404a; }

    /* ICONS */
    .enemy-icon.boss { width:140px; }

    .legacy-btn { cursor: pointer; padding: 6px 12px; border: none; border-radius: 4px; font-weight: bold; transition: 0.2s; box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
    .legacy-btn:hover { opacity: 0.9; transform: translateY(-1px); }
 
    /* HERO DASHBOARD */
    .hero-group { position: relative;
        box-shadow: 0 2px 10px rgba(0,0,0,0.2);
        border: 1px solid #2d313f;
        border-radius: 8px;
        padding: 16px;
        margin-bottom: 16px;
    }

    .hero-group-title {
        font-family: var(--font-head);
        color: #da5d5d; /* Crimson red title header tint */
        font-size: 0.85rem;
        font-weight: bold;
        text-transform: uppercase;
        letter-spacing: 0.1em;
        margin-bottom: 14px;
        border-bottom: 1px solid #2d313f;
        padding-bottom: 6px;
    }

    /* Compact Stats Grid */
    .stat-label { font-family: var(--font-head); color: #8e94a6; font-weight: bold; font-size: 0.9rem; letter-spacing: 0.05em; }

    .xp-container { background: #15181c; height: 8px; width: 100%; margin: 10px 0; border: 1px solid var(--border-color); position: relative; border-radius: 4px; }

    /* SANCTUARY */
    #sanctuary-ui { align-items: top !important; justify-content: top !important; text-align: center;
        /*border: 2px solid var(--accent-gold);*/
        box-shadow: inset 0 0 80px rgba(var(--accent-gold-rgb), 0.1);
        border-radius: 8px;
        animation: fadeIn 0.5s ease-out;
        position: relative;
        flex-direction: column !important;
        width: 100% !important;
        height: auto !important;
        background: rgba(0,0,0,0.8) !important;/*var(--bg-dark) !important;*/
        padding: 0 !important;
        box-sizing: border-box;
        background: #0d0e12;
        display: flex;
        flex-direction: column;
        height: 100%;
    }
    .sanc-title { font-size:13px; color: var(--accent-gold); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 5px; font-family: var(--font-head); text-shadow: 0 2px 10px rgba(0,0,0,0.5); }
    @keyframes breathe { 0% { transform: scale(1); opacity: 0.8; } 50% { transform: scale(1.1); opacity: 1; } 100% { transform: scale(1); opacity: 0.8; } }
    @keyframes fadeIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

    /* LOCATION THEMES (Glows) */

    .icon-preview { vertical-align: middle; margin-right: 12px; filter: sepia(0.3) drop-shadow(0 2px 2px rgba(0,0,0,0.5)); width: 100%; height: 100%; padding:25px; display: block; /* Essential for your spider pixel art */ object-fit: contain; /* Ensures the spider isn't stretched if the aspect ratio differs */ }

    /* DYNAMIC ZONES (Background Tints) */
    .zone-theme-0 { --z-col: var(--accent-gold); --z-bg: rgba(var(--accent-gold-rgb), 0.1); }
    .zone-theme-1 { --z-col: #bcaaa4; --z-bg: rgba(141, 110, 99, 0.1); }
    .zone-theme-2 { --z-col: #4cd137; --z-bg: rgba(76, 209, 55, 0.1); }
    .zone-theme-3 { --z-col: #74c0fc; --z-bg: rgba(116, 192, 252, 0.1); }
    .zone-theme-4 { --z-col: #ff5c5c; --z-bg: rgba(255, 92, 92, 0.1); }
    .zone-theme-5 { --z-col: #c56cf0; --z-bg: rgba(197, 108, 240, 0.1); }
    .zone-theme-6 { --z-col: #c56cf0; --z-bg: rgba(197, 108, 240, 0.1); }

    /* Add this at line 617 of style.css */
    .zone-theme-7 { --z-col: #c56cf0; --z-bg: rgba(116, 192, 252, 0.1); }


    #view-combat[class*="zone-theme-"] { 
        background: radial-gradient(circle at 50% 30%, var(--z-bg), transparent 70%); 
        transition: background 0.8s ease; 
    }
    #view-combat[class*="zone-theme-"] .combat-card { border-color: var(--z-col); box-shadow: 0 0 15px var(--z-bg); }
    #view-combat[class*="zone-theme-"] .card-header b { color: var(--z-col); }

    /* BUTTON DELAY */
    .btn-busy { position: relative; pointer-events: none; opacity: 0.7; overflow: hidden; }
    .btn-busy::after {
        content: ''; position: absolute; top: 0; left: 0; bottom: 0; width: 0%;
        background: rgba(255, 255, 255, 0.2); animation: loadBar var(--duration) linear forwards; z-index: 1;
    }
    @keyframes loadBar { from { width: 0%; } to { width: 100%; } }

    /* TEXT ADJUSTMENTS */
    #st-class-big { color: var(--text-main); font-family: var(--font-head); letter-spacing: 1px; text-shadow: 0 2px 2px #000; }

    /* Transform-only so it runs on the compositor. The red tint that used to be a
       filter keyframe here is now the .hit-flash overlay added by triggerFX(). */
    @keyframes impact-enemy {
        0% { transform: scale(1); }
        10% { transform: scale(0.9) translateX(-4px); }
        25% { transform: scale(0.95) translateX(4px); }
        40% { transform: scale(1) translateX(-2px); }
        60% { transform: translateX(2px); }
        100% { transform: scale(1) translateX(0); }
    }
    .fx-damage-enemy { animation: impact-enemy 0.5s ease-out; }
    
    /* --- PROLOGUE MODAL --- */
    #intro-overlay { animation: fadeIn 2s ease-in; /* Solid black background for cinematic feel */ /* The Magic Sauce: Transitions */ opacity: 0; visibility: hidden; display: flex !important; /* Keep it as flex, controlled by visibility */ transition: opacity 0.8s ease-in-out, visibility 0.8s; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.96); /* Darker, cinematic backdrop */ backdrop-filter: blur(10px); z-index: 5000; /* BOOTSTRAP BEHAVIOR: Overlay is the scroll container */ overflow-y: scroll; flex-direction: column; align-items: center; /* Centers horizontally */ justify-content: flex-start; /* Starts at the top for long content */ padding: 60px 20px; /* Gives the book breathing room at top/bottom */ display: flex;
    }
    
    /* --- VISIBILITY CONTROL --- */
    #game-interface, #nav-dock { display: none !important; }
    body.game-running #game-interface { display: flex !important; }
    body.game-running #nav-dock { display: flex !important; }

    /* --- SETTINGS MODAL --- */
    #settings-overlay {
        position: fixed; inset: 0; background: rgba(0, 0, 0, 0.95);
        display: none; align-items: center; justify-content: center; z-index: 3000;
    }
    #settings-overlay.active { display: flex; }
    
    #data-io-area:focus { outline: none; border-color: var(--accent-gold); color: var(--accent-gold); }
    
    /* --- LOCKED BUTTON STYLE --- */

    /* --- BOSS AURA FX --- */
/*    @keyframes boss-pulse {
        0% { filter: drop-shadow(0 0 2px var(--glow-col)) brightness(1); transform: scale(1); }
        50% { filter: drop-shadow(0 0 25px var(--glow-col)) brightness(1.3); transform: scale(1.05); }
        100% { filter: drop-shadow(0 0 2px var(--glow-col)) brightness(1); transform: scale(1); }
    }
    .boss-aura { animation: boss-pulse 2s infinite ease-in-out !important; }
*/
    /* --- HALL OF FAME STYLES --- */
    #records-overlay {
        position: fixed; inset: 0; background: rgba(18, 20, 24, 0.95);
        display: none; align-items: center; justify-content: center; z-index: 4000;
    }
    #records-overlay.active { display: flex; }

    #records-list {
        overflow-y: auto;
        background: rgba(0,0,0,0.2); border: 1px solid var(--border-color); border-radius: 4px;
        box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
    }

    /* Rank Colors */

    /* Scrollbar styling for the list */
    #records-list::-webkit-scrollbar { width: 6px; }
    #records-list::-webkit-scrollbar-track { background: var(--bg-dark); }
    #records-list::-webkit-scrollbar-thumb { background: var(--border-color); }
    
    /*.view-hero-scrollable-content::-webkit-scrollbar { width: 6px; }
    .view-hero-scrollable-content::-webkit-scrollbar-track { background: var(--bg-dark); }
    .view-hero-scrollable-content::-webkit-scrollbar-thumb { background: var(--border-color); }
        */
    
    /* --- DESKTOP DASHBOARD TRANSFORMATION (OPTIMIZED FIT) --- */
@media (min-width: 1024px) {
    
    /* 1. RESET BODY LAYOUT */
    body.game-running {
        padding: 0;
        overflow: hidden;
    }

    /* 2. GRID LAYOUT */
    body.game-running #game-interface {
        max-width: 1400px; 
        width: 100%;
        height: 100dvh;
        display: grid !important; 
        /* 3 Columns: Map | Combat | Hero */
        grid-template-columns: 340px 1fr 340px; 
        grid-template-rows: 1fr;
        gap: 20px;
        padding: 20px;
        margin: 0 auto;
    }

    /* 3. PANEL CARDS */
    body.game-running .panel {
        display: flex !important;
        flex-direction: column;
        height: 100%;
        padding: 0;
        background: rgba(33, 37, 43, 0.85);
        border: 1px solid var(--border-color);
        box-shadow: 0 15px 40px rgba(0,0,0,0.4);
        overflow: hidden; 
        border-radius: 8px;
        position: relative;
        /* Remove backdrop-filter to save the GPU */
        backdrop-filter: none;
        background: rgba(30, 34, 40, 0.98); /* Make it slightly more opaque to compensate */
    }
    
    /* Headers */
    body.game-running .panel h3 {
        margin: 0;
        padding: 15px;
        background: #191c21;
        border-bottom: 2px solid var(--border-color);
        font-size: 15px;
        text-align: center;
        flex-shrink: 0; 
        letter-spacing: 2px;
        box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    }

    /* 4. SCROLLING CONTAINERS */
    /* Map & Hero panels need internal scrolling */
    body.game-running #loc-container, 
    body.game-running #view-hero .hero-group {
        padding: 15px; 
    }
	body.game-running .hero-group {		
		border-radius: 0;
		border-left: 0;
		border-right: 0;
	}

    body.game-running #loc-container {
        overflow-y: auto;
        height: 100%;
        padding-bottom: 30px;
        display: flex !important;
        flex-direction: column;
        padding: 15px;
    }

    body.game-running #view-hero {
        overflow-y: auto; 
    }

    /* 5. COMBAT PANEL SPECIFICS (THE FIX) */
    body.game-running #view-combat {
        background: radial-gradient(circle at 50% 30%, rgba(255,255,255,0.02), rgba(0,0,0,0.4));
        /*border: 1px solid var(--accent-gold); */
        padding: 0; /* Remove padding here, apply to inner container if needed */
        display: flex;
        flex-direction: column;
        /* FIX: Allow scrolling if height is too small */
        overflow-y: auto; 
        justify-content: flex-start;
        background-position: center !important;
    }

    body.game-running #combat-ui {
        max-width: 550px;
        width: 100%;
        /* FIX: Margin auto centers vertically BUT is safe (won't clip top) */
        margin: auto; 
        padding: 20px;
        display: flex;
        flex-direction: column;
        /* FIX: Ensure it takes up vertical space if needed */
        min-height: min-content;
    }

    /* FIX: Make the Log Flexible */
    body.game-running #log-feed {
        /* Allow it to shrink to 80px or grow to 200px based on screen space */
        flex: 1 1 auto;
        min-height: 80px; 
        max-height: 200px;
        overflow-y: auto;
    }
    
    /* Tighten up target card slightly on desktop */
    body.game-running #card-target {
        min-height: 180px;
    }

    /* 6. HIDE MOBILE NAV */
    body.game-running #nav-dock {
        display: none !important;
    }

    /* 7. MODAL FIXES */
    body.game-running .modal-box {
        max-width: 500px;
        border: 1px solid var(--accent-gold);
        box-shadow: 0 0 100px rgba(0,0,0,0.7);
    }
    
    /* 8. VISUAL POLISH */
    body.game-running .location-card {
        /*padding: 15px;*/
        flex-direction: row;
        align-items: flex-start;
        gap: 10px;
    }
    
    /* Scrollbars */
    /*::-webkit-scrollbar { width: 6px !important; }
    ::-webkit-scrollbar-track { background: #121418 !important; }
    ::-webkit-scrollbar-thumb { background: #48505c; border-radius: 4px; !important }
    ::-webkit-scrollbar-thumb:hover { background: var(--accent-gold) !important; }
*/
    /* Disable masks if you still notice scrolling stutter */
    #log-feed {
        mask-image: none;
        -webkit-mask-image: none;
    }
}

    /* Scrollbars */
    ::-webkit-scrollbar { width: 6px !important; }
    ::-webkit-scrollbar-track { background: var(--bg-dark) !important; }
    ::-webkit-scrollbar-thumb { background: var(--border-color) !important; }
    ::-webkit-scrollbar-thumb:hover { background: var(--accent-gold) !important; }


@media (min-width: 1024px) {
    /*body.game-running .desktop-only-header { display: block !important; }*/
    body.game-running #sanctuary-ui { border-top-left-radius:0px; border-top-right-radius:0px; }
}

/* --- MAP SELECTION UPDATES --- */

/* The selected state for a location card */
.location-card.loc-selected {
    border-color: #fff;
    background: linear-gradient(90deg, #2c3e50, #23272e);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.15);
    /* Use transform for the "pop" effect instead of margins */
    transform: scale(1.02);
    z-index: 10;
    /* Do NOT add margin-top or padding changes here */
}

/* The warning/confirm text container - hidden by default */

/* Show it when the parent card is selected */

/* Text Colors */

/* Header styling */
.story-header {
    display: block; /* Makes the span act like a div */
    text-transform: uppercase;
    font-size: 0.85em;
    opacity: 0.7;
    margin-bottom: 15px;
    letter-spacing: 1px;
    font-weight: bold;
}

/* Item styling */
.story-point {
    display: block; /* Makes the span act like a div */
    margin-bottom: 15px;
}

/* Remove margin from the last item */
.story-point:last-child {
    margin-bottom: 0;
}

/* Hard Mode Theme: Slightly red/sepia tint, higher contrast */
body.hard-mode #view-combat {
    filter: sepia(0.2) contrast(1.05) brightness(1.1) hue-rotate(-10deg);
}

/* Make the background darker/redder */

	/* Standard Enemy */

/* HARD MODE: The Void Filter */
body.hard-mode #card-target .bar-track {
    filter: hue-rotate(240deg) saturate(1.5) drop-shadow(0 0 5px #8e6ead);
    animation: void-pulse 3s infinite ease-in-out;
}
/*body.hard-mode .enemy-icon {
    filter: hue-rotate(240deg) saturate(1.5) drop-shadow(0 0 5px #8e6ead);
    animation: void-pulse 3s infinite ease-in-out;
}*/

@keyframes void-pulse {
    0% { transform: scale(1); filter: hue-rotate(240deg) saturate(1.5) drop-shadow(0 0 5px #8e6ead); }
    50% { transform: scale(1); filter: hue-rotate(260deg) saturate(2) drop-shadow(0 0 15px #c56cf0); }
    100% { transform: scale(1); filter: hue-rotate(240deg) saturate(1.5) drop-shadow(0 0 5px #8e6ead); }
}
@keyframes shake-subtle {
    0% { transform: translate(0, 0) rotate(0deg); }
    20% { transform: translate(-3px, 2px) rotate(-1deg); }  /* Snappy but small initial hit */
    40% { transform: translate(2px, -1px) rotate(0.5deg); } /* Tiny rebound */
    60% { transform: translate(-1px, 1px) rotate(-0.5deg); }/* Micro settling */
    80% { transform: translate(0.5px, 0) rotate(0deg); }    /* Barely visible dampening */
    100% { transform: translate(0, 0) rotate(0deg); }       /* Perfect rest */
}

.anim-shake {
    backface-visibility: hidden;
    /* Reduced duration slightly to 0.3s so the smaller movement feels crisp, not floaty */
    animation: shake-subtle 0.3s cubic-bezier(.36,.07,.19,.97) both; 
}

/*
.anim-shake {
    backface-visibility: hidden;
    animation: shake-hard 0.3s linear both; 
}*/

/* --- PARTICLE EFFECTS --- */
.particle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%; /* Make it 2px for square pixels if you prefer retro */
    pointer-events: none;
    z-index: 100;
    opacity: 0;
    animation: particle-pop 0.6s ease-out forwards;
}

/* Colors for different effects */
.p-blood { background-color: #ff4d4d; box-shadow: 0 0 4px #b33939; }
.p-gold { background-color: var(--accent-gold); box-shadow: 0 0 4px var(--gold-bright); }
.p-magic { background-color: var(--magic); box-shadow: 0 0 4px #8e44ad; }
.p-ice { background-color: #00bcd4; box-shadow: 0 0 4px #fff; }

@keyframes particle-pop {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        /* Move to the dynamic destination set in JS */
        transform: translate(var(--tx), var(--ty)) scale(0);
        opacity: 0;
    }
}

/* --- 2. IMPACT FLASHES --- */

/* Hit flash: an overlay div appended by triggerFX('enemy'). Only opacity animates.
   (Replaces a .fx-damage-enemy::after rule that collided with #enemy-sprite::after —
   the ID rule won the background, so the hit just applied mix-blend-mode + a scale
   animation to the masked grime overlay, which is expensive to repaint.) */
.hit-flash {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    background: radial-gradient(circle at center, rgba(255, 70, 50, 0.55) 0%, rgba(255, 70, 50, 0) 70%);
    opacity: 0;
    will-change: opacity;
    animation: hit-flash 0.25s ease-out;
}
@keyframes hit-flash {
    0% { opacity: 1; }
    100% { opacity: 0; }
}


/* When the player gets hit, the UI shakes slightly */
.fx-damage-player {
    animation: shake-small 0.3s ease-in-out;
}

/*@keyframes flash-hit {
    0% { filter: brightness(5) sepia(1) saturate(5) hue-rotate(-50deg); transform: scale(1.1); }
    50% { filter: brightness(2) sepia(1) hue-rotate(-50deg); transform: scale(1.05); }
    100% { filter: none; transform: scale(1); }
}*/

@keyframes shake-small {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* --- 3. SCREEN SHAKE (Heavy) --- */
/* For Critical Hits or Big Boss Attacks */
/*.anim-shake {
    animation: shake-hard 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake-hard {
    10%, 90% { transform: translate3d(-4px, 0, 0); }
    20%, 80% { transform: translate3d(8px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-8px, 0, 0); }
    40%, 60% { transform: translate3d(8px, 0, 0); }
}*/

/* --- 4. TACTILE BUTTONS --- */
/* Make buttons feel like they are actually being pressed */
.btn-action:active {
    transform: translateY(2px);
    box-shadow: inset 0 3px 5px rgba(0,0,0,0.5);
}


/* [NEW CSS] Add to bottom of style.css */

/* Color for the passive progress bar */

/* [NEW CSS] Add to bottom of style.css */

/* Color for the passive progress bar */
#combo-bar-fill {
    background: var(--safe); /* Green */
    box-shadow: 0 0 5px var(--safe);
}

#combo-display {
    position: absolute;
    /* Move it near the bottom-right of the ENEMY card */
    bottom: 30px; 
    right: 10px; 
    text-align: right;
    pointer-events: none;
    z-index: 1000;
    
    /* Keep existing styles */
    transform: skewX(-15deg) rotate(-5deg);
    filter: drop-shadow(4px 4px 0px rgba(0,0,0,0.8));
    animation: combo-pop 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* --- BOOK / GRIMOIRE THEME (Consolidated & Fixed) --- */

/* 1. The Main Container (Visuals + Layout + Animation) */
.modal-box.book-theme {
    /* --- VISUALS (The Grimoire Look) --- */ /* Leather Frame */
    text-align: left !important;
    
    /* --- LAYOUT (The Scroll Fix) --- */ /* Stacks Header, Text, Button vertically */       /* Prevents off-screen overflow */
    box-sizing: border-box;

    /* --- ANIMATION (The Scroll Opening) --- */
    animation: bookOpen 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    opacity: 0; /* Start hidden */
    transform: scale(0.95) translateY(10px);
    transition: transform 1.5s cubic-bezier(0.22, 1, 0.36, 1);
    position: relative; /* Aged parchment color */ /* Thin gold "inlay" */
    /* Elegant Leather/Gold Border */
    /* Layout Logic: Removed fixed heights */
    display: flex;
    flex-direction: column; /* Allow it to grow with text */
    min-height: auto; /* Generous breathing room */
    margin: auto; /* Centers it in the scrollable overlay */
    overflow: initial;
    /* Layout: Grow with content */
    width: 95%;
    max-width: 650px !important;
    height: auto !important;
    max-height: none !important;
    margin-bottom: 60px; /* Extra space at the bottom after the button */
    /* Visuals: Aged Parchment & Leather */
    background-color: var(--parchment) !important;
    background-image: radial-gradient(circle, rgba(0,0,0,0) 40%, rgba(139, 69, 19, 0.15) 100%) !important;
    outline: 2px solid var(--accent-gold); /* Gold inlay line */
    outline-offset: -8px;
    color: var(--blood-dark);
    box-shadow: 0 30px 60px rgba(0,0,0,0.8), inset 0 0 100px rgba(93, 64, 55, 0.2) !important;
}

/* 2. Headers (Softer Book Style) */
.book-theme h1, .book-theme h2 {
    color: var(--blood) !important;
    font-family: 'Cinzel', serif;
    text-shadow: none !important;
    letter-spacing: 2px !important;
    text-align: center !important;
    padding-bottom: 15px !important;
    margin-bottom: 0px;
    background-position: bottom center !important;
    background-size: 100% 1px !important;
    background-repeat: no-repeat !important;
    border: none !important; /* Remove default borders */
}
.book-theme h2 {
    

    margin-bottom: 25px !important;
}

/* 3. The Text Container (Scrollable & Fading) */
#story-text-container {
    /* --- SCROLLING BEHAVIOR --- */        
    min-height: 250px;        
    flex-grow: 1;            
    
    margin: 15px 0;          

    /* --- TYPOGRAPHY --- */
    background: transparent !important;
    border: none !important;
    font-size: 1.1rem !important;
    font-weight: 600;

    /* --- ANIMATION (The Fade In) --- */
    margin-top:0px;
    opacity: 1;
    transition: opacity 1s ease-in; /* Text fades in smoothly on the page */
    overflow-y: visible !important; /* Text no longer scrolls inside */    /* No height limit */
    /*font-size: 1.25rem !important;*/
    color: var(--ink) !important;
    overflow: visible !important;
    max-height: none;
    font-family: 'Crimson Pro', serif;
    /*font-size: 1.25rem !important;*/
    line-height: 1.8;
    margin-bottom: 40px;
}

/* The class JS adds to trigger the text fade */

/* Custom Scrollbar for the Book */
#story-text-container::-webkit-scrollbar { width: 8px; }
#story-text-container::-webkit-scrollbar-track { background: transparent; }
#story-text-container::-webkit-scrollbar-thumb { background-color: rgba(93, 64, 55, 0.4); border-radius: 4px; }

/* 4. Drop Cap Styling */
.book-theme #story-text-container::first-letter {
    font-family: 'Cinzel', serif;
    font-size: 3.5em !important;
    float: left;
    line-height: 0.8;
    margin-right: 12px;
    margin-top: -2px; 
    color: var(--blood);
}

/* 5. Buttons (Paper/Ink Style) */
.book-theme .confirm-btn:hover {
    background: var(--ink-soft) !important;
    color: var(--parchment) !important;
}

/* 6. Animations Definitions */
@keyframes bookOpen {
    from { opacity: 0; transform: translateY(40px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

