/* Dark Fantasy Theme with Visual Enhancements */

/* ========================================
   GLOBAL RESET & BASE STYLES
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Check for reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

body {
    font-family: 'Almendra', 'Georgia', serif;
    background: #0a0a0a;
    color: #e0e0e0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

/* Vignette Effect on Body */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, transparent 0%, rgba(0, 0, 0, 0.3) 50%, rgba(0, 0, 0, 0.7) 100%);
    pointer-events: none;
    z-index: 0;
}

/* ========================================
   PARALLAX BACKGROUND SYSTEM
   ======================================== */
.parallax-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
}

.parallax-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: transform 0.3s ease-out;
}

/* Layer 1: Distant Mountains (slowest) */
.parallax-layer-1 {
    background: linear-gradient(180deg, 
        rgba(20, 10, 30, 0.8) 0%, 
        rgba(40, 20, 50, 0.6) 50%, 
        rgba(20, 10, 30, 0.8) 100%);
    z-index: 2;
}

/* Layer 2: Mid-ground Forest (medium speed) */
.parallax-layer-2 {
    background: linear-gradient(180deg, 
        transparent 0%, 
        rgba(10, 20, 10, 0.4) 30%, 
        rgba(20, 40, 20, 0.5) 70%, 
        rgba(10, 20, 10, 0.6) 100%);
    z-index: 3;
}

/* Layer 3: Foreground Mist (fastest) */
.parallax-layer-3 {
    background: linear-gradient(180deg, 
        rgba(50, 50, 60, 0.1) 0%, 
        transparent 30%, 
        transparent 70%, 
        rgba(30, 30, 40, 0.3) 100%);
    z-index: 4;
    will-change: opacity;
    animation: mistFloat 20s ease-in-out infinite;
}

@keyframes mistFloat {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.5; }
}

/* ========================================
   PARTICLES.JS CONTAINER
   ======================================== */
#particles-js {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* ========================================
   FLAVOR ILLUSTRATIONS SYSTEM
   ======================================== */
.flavor-illustration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999;
    animation: fadeIn 0.8s ease-in;
    backdrop-filter: blur(5px);
}

.flavor-illustration img {
    max-width: 90%;
    max-height: 80vh;
    border: 3px solid #d4af37;
    border-radius: 8px;
    box-shadow: 0 0 40px rgba(212, 175, 55, 0.5), inset 0 0 20px rgba(0, 0, 0, 0.5);
    filter: sepia(0.3) contrast(1.1);
    animation: illustrationZoom 0.8s ease-out;
    -webkit-backdrop-filter: blur(5px); /* Safari support */
    backdrop-filter: blur(5px);
}

@keyframes illustrationZoom {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* ========================================
   GAME CONTAINER WITH DYNAMIC STATES
   ======================================== */
.game-container {
    position: relative;
    z-index: 5;
    width: 100%;
    max-width: 900px;
    background: rgba(20, 10, 10, 0.95);
    border: 3px solid #8b0000;
    border-radius: 15px;
    box-shadow: 0 0 30px rgba(139, 0, 0, 0.5), inset 0 0 50px rgba(0, 0, 0, 0.5);
    padding: 30px;
    backdrop-filter: blur(10px);
    transition: border-color 0.5s ease, box-shadow 0.5s ease;
}

/* Environment-based UI States */
.game-container.env-forest {
    border-color: #2d5016;
    box-shadow: 0 0 30px rgba(45, 80, 22, 0.5), inset 0 0 50px rgba(0, 0, 0, 0.5);
}

.game-container.env-town {
    border-color: #5a5a5a;
    box-shadow: 0 0 30px rgba(90, 90, 90, 0.5), inset 0 0 50px rgba(0, 0, 0, 0.5);
}

.game-container.env-castle {
    border-color: #4a4a6a;
    box-shadow: 0 0 30px rgba(74, 74, 106, 0.5), inset 0 0 50px rgba(0, 0, 0, 0.5);
}

.game-container.env-road {
    border-color: #8b4513;
    box-shadow: 0 0 30px rgba(139, 69, 19, 0.4), inset 0 0 50px rgba(0, 0, 0, 0.5);
}

/* The Gauntlet (Days 81-100) - Corrupted UI */
.game-container.env-gauntlet {
    border-color: #8b0000;
    box-shadow: 
        0 0 40px rgba(139, 0, 0, 0.7), 
        inset 0 0 50px rgba(0, 0, 0, 0.5),
        0 0 60px rgba(138, 43, 226, 0.4);
    animation: corruptionPulse 3s ease-in-out infinite;
}

.game-container.env-gauntlet::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 10px,
            rgba(138, 43, 226, 0.05) 10px,
            rgba(138, 43, 226, 0.05) 12px
        ),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 10px,
            rgba(255, 0, 0, 0.05) 10px,
            rgba(255, 0, 0, 0.05) 12px
        );
    pointer-events: none;
    border-radius: 15px;
    opacity: 0.5;
}

@keyframes corruptionPulse {
    0%, 100% { filter: hue-rotate(0deg); }
    50% { filter: hue-rotate(10deg); }
}

.screen {
    display: none;
}

.screen.active {
    display: block;
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* ========================================
   THEMATIC TYPOGRAPHY & TEXT EFFECTS
   ======================================== */
h1 {
    font-family: 'Cinzel', serif;
    color: #ffd700;
    text-shadow: 
        0 0 10px rgba(255, 215, 0, 0.5), 
        2px 2px 4px #000,
        0 0 20px rgba(255, 215, 0, 0.3);
    letter-spacing: 1px;
}

h2 {
    font-family: 'Cinzel', serif;
    color: #ffaa00;
    text-shadow: 
        0 0 8px rgba(255, 170, 0, 0.4), 
        1px 1px 3px #000;
    letter-spacing: 0.5px;
}

h3 {
    font-family: 'MedievalSharp', cursive;
    color: #e0b068;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

/* Character Creation */
.title {
    font-family: 'Cinzel', serif;
    text-align: center;
    font-size: 3em;
    color: #ffd700;
    text-shadow: 
        0 0 10px rgba(255, 215, 0, 0.5), 
        0 0 20px rgba(255, 68, 68, 0.3),
        2px 2px 4px #000,
        0 0 40px rgba(139, 0, 0, 0.4);
    margin-bottom: 10px;
    font-weight: 700;
    letter-spacing: 2px;
}

.subtitle {
    font-family: 'Almendra', serif;
    text-align: center;
    font-size: 1.2em;
    color: #c0c0c0;
    margin-bottom: 40px;
    font-style: italic;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.character-selection {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.class-card {
    background: linear-gradient(135deg, #2a1a1a 0%, #3a2020 100%);
    border: 2px solid #6b0000;
    border-radius: 10px;
    padding: 25px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.class-card:hover {
    transform: translateY(-5px);
    border-color: #ff4444;
    box-shadow: 0 5px 25px rgba(255, 68, 68, 0.4);
}

.class-card h2 {
    color: #ff6666;
    font-size: 1.8em;
    margin-bottom: 10px;
}

.class-card p {
    color: #bbb;
    margin-bottom: 15px;
    font-style: italic;
}

.class-card .stats {
    display: flex;
    justify-content: space-around;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #4a2020;
}

.class-card .stats span {
    color: #ffaa00;
    font-weight: bold;
    font-size: 1.1em;
}

/* Daily Event */
.day-header {
    background: linear-gradient(135deg, #3a1010 0%, #2a0808 100%);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
    border: 2px solid #6b0000;
    position: relative;
}

.day-header h2 {
    color: #ff4444;
    font-size: 2em;
    text-align: center;
    margin-bottom: 15px;
}

.power-level-display {
    text-align: center;
    margin: 15px 0;
    padding: 10px;
    background: rgba(212, 175, 55, 0.1);
    border: 2px solid #d4af37;
    border-radius: 8px;
}

.power-label {
    color: #ffaa00;
    font-size: 1.3em;
    font-weight: bold;
    margin-right: 8px;
}

.power-value {
    color: #d4af37;
    font-size: 1.5em;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

.character-stats {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 15px;
}

.stat-item {
    background: rgba(139, 0, 0, 0.2);
    padding: 8px 15px;
    border-radius: 5px;
    border: 1px solid #8b0000;
}

.stat-label {
    color: #aaa;
    margin-right: 5px;
}

#player-class, #player-str, #player-int, #player-hp, #player-agi {
    color: #ffaa00;
    font-weight: bold;
}

.active-effects {
    margin-top: 10px;
    padding: 10px;
    background: rgba(255, 215, 0, 0.1);
    border-radius: 5px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.effect-badge {
    background: rgba(42, 26, 26, 0.8);
    border: 1px solid #d4af37;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 0.85em;
    color: #ffaa00;
}

.event-content {
    background: rgba(42, 26, 26, 0.6);
    padding: 25px;
    border-radius: 10px;
    border: 2px solid #4a2020;
}

.event-content h3 {
    color: #ff6666;
    font-size: 1.8em;
    margin-bottom: 15px;
    text-align: center;
}

.event-content p {
    color: #ccc;
    font-size: 1.1em;
    line-height: 1.6;
    margin-bottom: 30px;
    text-align: center;
}

.choices {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* ========================================
   GOTHIC BUTTON STYLING
   ======================================== */
button:not(.modal-btn):not(.audio-btn):not(.save-game-btn), 
.choice-btn, 
.action-btn {
    font-family: 'Almendra', serif;
    position: relative;
    background: linear-gradient(135deg, #2a1a1a 0%, #3a2020 100%);
    border: 3px solid;
    border-image: linear-gradient(135deg, #d4af37, #f4d03f, #d4af37) 1;
    padding: 15px 20px;
    color: #e0e0e0;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1em;
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

button:not(.modal-btn):not(.audio-btn):not(.save-game-btn):hover:not(:disabled), 
.choice-btn:hover:not(:disabled), 
.action-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #3a2020 0%, #4a2828 100%);
    box-shadow: 
        0 0 15px rgba(212, 175, 55, 0.6),
        0 2px 8px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

button:not(.modal-btn):not(.audio-btn):not(.save-game-btn):active:not(:disabled),
.choice-btn:active:not(:disabled),
.action-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 
        0 0 10px rgba(212, 175, 55, 0.4),
        inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

.choice-btn {
    background: linear-gradient(135deg, #2a1a1a 0%, #3a2020 100%);
    border: 2px solid #6b0000;
    border-radius: 8px;
    padding: 15px 20px;
    color: #e0e0e0;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    font-size: 1em;
}

.choice-btn:hover {
    border-color: #ff4444;
    background: linear-gradient(135deg, #3a2020 0%, #4a2828 100%);
    transform: translateX(5px);
}

.choice-text {
    font-weight: bold;
    color: #ffaa00;
    margin-bottom: 8px;
}

.choice-effect {
    color: #aaa;
    font-size: 0.9em;
    font-style: italic;
}

/* Boss Fight */
.boss-title {
    text-align: center;
    color: #ff0000;
    font-size: 2.5em;
    margin-bottom: 30px;
    text-shadow: 0 0 20px #ff0000;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { text-shadow: 0 0 20px #ff0000; }
    50% { text-shadow: 0 0 40px #ff0000, 0 0 60px #ff4444; }
}

.battle-arena {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    gap: 20px;
}

.combatant {
    flex: 1;
    background: rgba(42, 26, 26, 0.6);
    padding: 20px;
    border-radius: 10px;
    border: 2px solid #6b0000;
}

.combatant h3 {
    color: #ff6666;
    font-size: 1.5em;
    margin-bottom: 15px;
    text-align: center;
}

.combatant-stats {
    margin-bottom: 15px;
}

.combatant-stats div {
    margin: 8px 0;
    color: #ccc;
}

.combatant-stats .power-stat {
    font-size: 1.1em;
    font-weight: bold;
    color: #ffaa00;
    padding: 5px 0;
    border-bottom: 1px solid #6b0000;
    margin-bottom: 10px;
}

.combatant-stats span {
    color: #ffaa00;
    font-weight: bold;
}

.vs-text {
    font-size: 2em;
    color: #ff4444;
    text-shadow: 0 0 10px #ff0000;
}

.health-bar {
    width: 100%;
    height: 25px;
    background: #2a0808;
    border: 2px solid #6b0000;
    border-radius: 5px;
    overflow: hidden;
}

.health-fill {
    height: 100%;
    transition: width 0.5s ease;
}

.player-health {
    background: linear-gradient(90deg, #00aa00, #00ff00);
}

.boss-health {
    background: linear-gradient(90deg, #aa0000, #ff0000);
}

.battle-log {
    background: rgba(20, 10, 10, 0.8);
    border: 2px solid #4a2020;
    border-radius: 8px;
    padding: 15px;
    max-height: 150px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.battle-log p {
    color: #ccc;
    margin: 5px 0;
    font-size: 0.95em;
}

.battle-log p:last-child {
    color: #ffaa00;
}

.battle-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.action-btn {
    background: linear-gradient(135deg, #2a1a1a 0%, #3a2020 100%);
    border: 2px solid #6b0000;
    border-radius: 8px;
    padding: 15px 25px;
    color: #e0e0e0;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.action-btn:hover:not(:disabled) {
    border-color: #ff4444;
    background: linear-gradient(135deg, #3a2020 0%, #4a2828 100%);
    transform: scale(1.05);
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Boss Telegraph Indicator */
.boss-status-indicator {
    text-align: center;
    padding: 10px;
    margin-top: 10px;
    border-radius: 5px;
    font-weight: bold;
    font-size: 0.9em;
}

/* Status Effects Display */
.status-effects-display {
    margin-top: 10px;
    padding: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    min-height: 30px;
    justify-content: center;
}

.status-effect {
    display: inline-block;
    padding: 4px 8px;
    background: rgba(139, 0, 0, 0.3);
    border: 1px solid #8b0000;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: bold;
    color: #ffa500;
    cursor: help;
    transition: all 0.2s;
}

.status-effect:hover {
    background: rgba(139, 0, 0, 0.5);
    transform: scale(1.05);
}

/* Environmental Modifier Display */
.environmental-modifier-display {
    margin: 15px 0;
    padding: 10px 15px;
    background: linear-gradient(135deg, rgba(50, 50, 100, 0.3), rgba(30, 30, 60, 0.3));
    border: 2px solid #4a90e2;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 0 15px rgba(74, 144, 226, 0.3);
}

.env-modifier {
    font-size: 1.1em;
    font-weight: bold;
    color: #87ceeb;
    text-shadow: 0 0 10px rgba(74, 144, 226, 0.5);
    cursor: help;
}

.boss-status-charging {
    background: rgba(255, 0, 0, 0.2);
    border: 2px solid #ff0000;
    color: #ff4444;
    animation: telegraph-pulse 1s infinite;
}

@keyframes telegraph-pulse {
    0%, 100% {
        box-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
    }
    50% {
        box-shadow: 0 0 30px rgba(255, 0, 0, 0.8);
    }
}

.boss-status-phase2 {
    background: rgba(255, 100, 0, 0.2);
    border: 2px solid #ff6400;
    color: #ffaa00;
}

.boss-status-desperation {
    background: rgba(138, 43, 226, 0.2);
    border: 2px solid #8a2be2;
    color: #da70d6;
}

/* Game Over */
#game-over h2 {
    text-align: center;
    font-size: 3em;
    margin-bottom: 20px;
    color: #ff4444;
    text-shadow: 0 0 20px #ff0000;
}

#game-over-message {
    text-align: center;
    font-size: 1.3em;
    color: #ccc;
    margin-bottom: 30px;
}

.final-stats {
    background: rgba(42, 26, 26, 0.6);
    padding: 25px;
    border-radius: 10px;
    border: 2px solid #6b0000;
    margin-bottom: 30px;
}

.final-stats div {
    margin: 10px 0;
    color: #ccc;
    font-size: 1.1em;
}

.final-stats span {
    color: #ffaa00;
    font-weight: bold;
}

.restart-btn {
    display: block;
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
    background: linear-gradient(135deg, #8b0000 0%, #aa0000 100%);
    border: 2px solid #ff4444;
    border-radius: 8px;
    padding: 15px 30px;
    color: #fff;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.restart-btn:hover {
    background: linear-gradient(135deg, #aa0000 0%, #cc0000 100%);
    transform: scale(1.05);
    box-shadow: 0 5px 25px rgba(255, 68, 68, 0.4);
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #1a0a0a;
}

::-webkit-scrollbar-thumb {
    background: #6b0000;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #8b0000;
}

/* Responsive Design */
@media (max-width: 768px) {
    .title {
        font-size: 2em;
    }
    
    .character-selection {
        grid-template-columns: 1fr;
    }
    
    .battle-arena {
        flex-direction: column;
    }
    
    .battle-actions {
        flex-direction: column;
    }
    
    .action-btn {
        width: 100%;
    }
}

/* Milestone Notification */
/* Notification Container - stacks notifications vertically */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 15px;
    pointer-events: none;
    max-width: 400px;
}

.milestone-notification {
    position: relative;
    transform: translateX(120%) scale(0.7);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    pointer-events: none;
}

.milestone-notification.show {
    transform: translateX(0) scale(1);
    opacity: 1;
}

.milestone-content {
    background: linear-gradient(135deg, #2a1a1a 0%, #3a2020 100%);
    border: 3px solid #d4af37;
    border-radius: 15px;
    padding: 30px 40px;
    box-shadow: 0 0 50px rgba(212, 175, 55, 0.6), inset 0 0 30px rgba(212, 175, 55, 0.1);
    display: flex;
    align-items: center;
    gap: 20px;
    animation: celebrationPulse 0.5s ease-in-out;
}

@keyframes celebrationPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.milestone-icon {
    font-size: 4em;
    animation: iconSpin 0.6s ease-in-out;
}

@keyframes iconSpin {
    0% { transform: rotate(0deg) scale(0); }
    60% { transform: rotate(360deg) scale(1.2); }
    100% { transform: rotate(360deg) scale(1); }
}

.milestone-text {
    text-align: left;
}

.milestone-title {
    color: #ffaa00;
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 5px;
}

.milestone-name {
    color: #d4af37;
    font-size: 1.8em;
    font-weight: bold;
    margin-bottom: 5px;
    text-shadow: 0 0 15px rgba(212, 175, 55, 0.5);
}

.milestone-power {
    color: #aaa;
    font-size: 1em;
    font-style: italic;
}

@media (max-width: 768px) {
    .notification-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .milestone-content {
        padding: 20px 25px;
        flex-direction: column;
        text-align: center;
    }
    
    .milestone-text {
        text-align: center;
    }
    
    .milestone-icon {
        font-size: 3em;
    }
    
    .milestone-name {
        font-size: 1.5em;
    }
}

/* Save/Load System Styles */

/* Player Name Input */
.name-input-section {
    text-align: center;
    margin: 20px 0 30px 0;
}

.name-label {
    display: block;
    color: #ffaa00;
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 10px;
}

.name-input {
    width: 100%;
    max-width: 400px;
    padding: 12px 20px;
    font-size: 1.1em;
    background: rgba(42, 26, 26, 0.6);
    border: 2px solid #6b0000;
    border-radius: 8px;
    color: #e0e0e0;
    text-align: center;
    transition: all 0.3s ease;
}

.name-input:focus {
    outline: none;
    border-color: #ff4444;
    box-shadow: 0 0 15px rgba(255, 68, 68, 0.3);
}

.name-input::placeholder {
    color: #666;
}

/* Save Slots Section */
.save-slots-section {
    margin-bottom: 30px;
}

.section-title {
    text-align: center;
    color: #d4af37;
    font-size: 2em;
    margin-bottom: 20px;
    text-shadow: 0 0 15px rgba(212, 175, 55, 0.5);
}

.save-slots-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.save-slot-card {
    background: linear-gradient(135deg, #2a1a1a 0%, #3a2020 100%);
    border: 2px solid #6b0000;
    border-radius: 10px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.save-slot-card:hover {
    transform: translateY(-3px);
    border-color: #d4af37;
    box-shadow: 0 5px 20px rgba(212, 175, 55, 0.3);
}

.save-slot-card.empty {
    opacity: 0.6;
    cursor: default;
}

.save-slot-card.empty:hover {
    transform: none;
    border-color: #6b0000;
    box-shadow: none;
}

.slot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #4a2020;
}

.slot-number {
    color: #ffaa00;
    font-weight: bold;
    font-size: 1.1em;
}

.delete-slot-btn {
    background: rgba(139, 0, 0, 0.3);
    border: 1px solid #8b0000;
    border-radius: 5px;
    padding: 5px 10px;
    color: #ff6666;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.delete-slot-btn:hover {
    background: rgba(139, 0, 0, 0.6);
    border-color: #ff4444;
    transform: scale(1.05);
}

.slot-info {
    color: #ccc;
    font-size: 0.95em;
}

.slot-info div {
    margin: 6px 0;
}

.slot-class {
    color: #ffaa00;
    font-weight: bold;
    font-size: 1.1em;
}

.slot-power {
    color: #d4af37;
    font-weight: bold;
}

.slot-timestamp {
    color: #888;
    font-size: 0.85em;
    font-style: italic;
    margin-top: 8px;
}

.empty-slot-text {
    color: #666;
    font-style: italic;
    text-align: center;
    padding: 20px 0;
}

/* Save Game Button */
.save-game-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #2a1a1a 0%, #3a2020 100%);
    border: 2px solid #d4af37;
    border-radius: 8px;
    padding: 10px 15px;
    color: #d4af37;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.save-game-btn:hover {
    background: linear-gradient(135deg, #3a2020 0%, #4a2828 100%);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.4);
    transform: scale(1.05);
}

/* Save Notification */
.save-notification {
    position: fixed;
    top: 50px;
    right: 50px;
    background: linear-gradient(135deg, #2a1a1a 0%, #3a2020 100%);
    border: 2px solid #d4af37;
    border-radius: 10px;
    padding: 15px 25px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 5px 25px rgba(212, 175, 55, 0.5);
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 1000;
}

.save-notification.show {
    opacity: 1;
    transform: translateX(0);
}

.save-icon {
    font-size: 1.5em;
}

.save-text {
    color: #d4af37;
    font-weight: bold;
    font-size: 1.1em;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    animation: fadeIn 0.3s ease-in;
}

.modal-content {
    background: linear-gradient(135deg, #2a1a1a 0%, #3a2020 100%);
    border: 3px solid #8b0000;
    border-radius: 15px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 0 40px rgba(139, 0, 0, 0.6);
}

.modal-content h3 {
    color: #ff6666;
    font-size: 1.8em;
    margin-bottom: 15px;
    text-align: center;
}

.modal-content p {
    color: #ccc;
    font-size: 1.1em;
    margin-bottom: 25px;
    text-align: center;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.modal-btn {
    padding: 12px 30px;
    font-size: 1.1em;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid;
}

.confirm-btn {
    background: linear-gradient(135deg, #2a6a2a 0%, #3a8a3a 100%);
    border-color: #00ff00;
    color: #fff;
}

.confirm-btn:hover {
    background: linear-gradient(135deg, #3a8a3a 0%, #4aaa4a 100%);
    box-shadow: 0 5px 20px rgba(0, 255, 0, 0.3);
}

.cancel-btn {
    background: linear-gradient(135deg, #6a2a2a 0%, #8a3a3a 100%);
    border-color: #ff4444;
    color: #fff;
}

.cancel-btn:hover {
    background: linear-gradient(135deg, #8a3a3a 0%, #aa4a4a 100%);
    box-shadow: 0 5px 20px rgba(255, 68, 68, 0.3);
}

/* Responsive adjustments for save system */
@media (max-width: 768px) {
    .save-slots-container {
        grid-template-columns: 1fr;
    }
    
    .save-game-btn {
        position: static;
        width: 100%;
        margin-top: 10px;
    }
    
    .save-notification {
        top: 20px;
        right: 20px;
        left: 20px;
        transform: translateY(-200px);
    }
    
    .save-notification.show {
        transform: translateY(0);
    }
    
    .modal-content {
        padding: 20px;
    }
    
    .modal-buttons {
        flex-direction: column;
    }
    
    .modal-btn {
        width: 100%;
    }
}

/* Hide old controls */
.audio-controls {
    display: none !important;
}

#daily-event .save-game-btn {
    display: none !important;
}

/* Pause Menu */
.pause-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2100;
}

.pause-menu-content {
    background: linear-gradient(135deg, #2a1a1a 0%, #3a2020 100%);
    border: 3px solid #d4af37;
    border-radius: 15px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 50px rgba(212, 175, 55, 0.6);
}

.pause-title {
    text-align: center;
    color: #d4af37;
    font-size: 2em;
    margin-bottom: 25px;
    text-shadow: 0 0 15px rgba(212, 175, 55, 0.5);
}

.pause-section {
    margin-bottom: 25px;
    padding: 20px;
    background: rgba(42, 26, 26, 0.5);
    border: 2px solid #6b0000;
    border-radius: 10px;
}

.pause-section h3 {
    color: #ffaa00;
    font-size: 1.3em;
    margin-bottom: 15px;
    text-align: center;
}

.pause-action-btn {
    width: 100%;
    background: linear-gradient(135deg, #2a1a1a 0%, #3a2020 100%);
    border: 2px solid #d4af37;
    border-radius: 8px;
    padding: 12px 20px;
    color: #e0e0e0;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.pause-action-btn:hover {
    background: linear-gradient(135deg, #3a2020 0%, #4a2828 100%);
    border-color: #ffaa00;
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(212, 175, 55, 0.4);
}

.resume-btn {
    background: linear-gradient(135deg, #2a4a2a 0%, #3a6a3a 100%);
    border-color: #4ade80;
    margin-top: 15px;
}

.resume-btn:hover {
    background: linear-gradient(135deg, #3a6a3a 0%, #4a8a4a 100%);
    border-color: #86efac;
}

/* Pause Button */
.pause-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #2a1a1a 0%, #3a2020 100%);
    border: 2px solid #d4af37;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.5em;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 3px 15px rgba(212, 175, 55, 0.4);
}

.pause-btn:hover {
    background: linear-gradient(135deg, #3a2020 0%, #4a2828 100%);
    border-color: #ffaa00;
    transform: scale(1.1);
    box-shadow: 0 5px 20px rgba(212, 175, 55, 0.6);
}

/* Audio Controls in Pause Menu */
.pause-section .audio-btn {
    width: 100%;
    background: linear-gradient(135deg, #2a1a1a 0%, #3a2020 100%);
    border: 2px solid #d4af37;
    border-radius: 8px;
    padding: 10px 15px;
    color: #e0e0e0;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 15px;
}

.pause-section .audio-btn:hover {
    background: linear-gradient(135deg, #3a2020 0%, #4a2828 100%);
    border-color: #ffaa00;
    transform: scale(1.05);
}

.pause-section .audio-btn.muted {
    opacity: 0.6;
}

.pause-section .volume-sliders {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pause-section .volume-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pause-section .volume-control label {
    color: #ffaa00;
    font-size: 0.9em;
    font-weight: bold;
    min-width: 50px;
}

.pause-section .volume-control input[type="range"] {
    flex: 1;
    height: 6px;
    background: rgba(107, 0, 0, 0.5);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.pause-section .volume-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: #d4af37;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pause-section .volume-control input[type="range"]::-webkit-slider-thumb:hover {
    background: #ffaa00;
    transform: scale(1.2);
}

.pause-section .volume-control input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #d4af37;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.pause-section .volume-control input[type="range"]::-moz-range-thumb:hover {
    background: #ffaa00;
    transform: scale(1.2);
}

.pause-section .volume-value {
    color: #e0e0e0;
    font-size: 0.9em;
    min-width: 45px;
    text-align: right;
}

/* Responsive */
@media (max-width: 768px) {
    .pause-menu-content {
        padding: 20px;
        max-width: 90%;
    }
    
    .pause-title {
        font-size: 1.5em;
    }
    
    .pause-btn {
        width: 45px;
        height: 45px;
        font-size: 1.2em;
    }
}

/* Smooth transitions */
.screen {
    animation: fadeIn 0.5s ease-in;
}

/* Damage shake animation */
@keyframes damageShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.shake {
    animation: damageShake 0.5s ease-in-out;
}

/* Respect reduced motion preference for shake */
@media (prefers-reduced-motion: reduce) {
    .shake {
        animation: none;
        opacity: 0.8;
    }
}

/* Level up particles effect (CSS only) */
@keyframes sparkle {
    0% {
        opacity: 1;
        transform: translateY(0) scale(0);
    }
    50% {
        opacity: 0.8;
        transform: translateY(-30px) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-60px) scale(0);
    }
}

.sparkle-particle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #d4af37;
    border-radius: 50%;
    pointer-events: none;
    animation: sparkle 1s ease-out forwards;
}

/* Health bar smooth transition */
.health-fill {
    transition: width 0.5s ease, background 0.3s ease;
}

/* Responsive audio controls */
@media (max-width: 768px) {
    .audio-controls {
        bottom: 10px;
        right: 10px;
        left: 10px;
        padding: 10px;
    }
    
    .volume-control {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .volume-control input[type="range"] {
        width: 100%;
    }
}

/* Destiny Points Display */
.destiny-points-display {
    text-align: center;
    margin: 10px 0;
    padding: 8px;
    background: rgba(147, 51, 234, 0.1);
    border: 2px solid #9333ea;
    border-radius: 8px;
}

.dp-label {
    color: #c084fc;
    font-size: 1.2em;
    font-weight: bold;
    margin-right: 8px;
}

.dp-value {
    color: #e9d5ff;
    font-size: 1.4em;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(147, 51, 234, 0.5);
}

/* Gold Display */
.gold-display {
    text-align: center;
    margin: 10px 0;
    padding: 8px;
    background: rgba(218, 165, 32, 0.1);
    border: 2px solid #daa520;
    border-radius: 8px;
}

.gold-label {
    color: #f4d03f;
    font-size: 1.2em;
    font-weight: bold;
    margin-right: 8px;
}

.gold-value {
    color: #ffd700;
    font-size: 1.4em;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(218, 165, 32, 0.5);
}

.essences-display {
    text-align: center;
    margin: 10px 0;
    padding: 8px;
    background: rgba(75, 0, 130, 0.1);
    border: 2px solid #8b00ff;
    border-radius: 8px;
}

.essences-label {
    color: #8b00ff;
    font-size: 1.2em;
    font-weight: bold;
    margin-right: 8px;
}

.essences-value {
    color: #a020f0;
    font-size: 1.4em;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(139, 0, 255, 0.5);
}

/* Shop Items Display */
.shop-items {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.shop-item {
    padding: 15px;
    background: rgba(74, 32, 32, 0.3);
    border: 2px solid #8b4513;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.shop-item:hover {
    background: rgba(74, 32, 32, 0.5);
    border-color: #daa520;
    transform: translateY(-2px);
}

.shop-item.unaffordable {
    opacity: 0.5;
    border-color: #666;
}

.shop-item button {
    margin-top: 10px;
    padding: 8px 16px;
    background: #8b4513;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s ease;
}

.shop-item button:hover:not(:disabled) {
    background: #daa520;
    transform: scale(1.05);
}

.shop-item button:disabled {
    background: #666;
    cursor: not-allowed;
}

/* Ability Info on Character Cards */
.ability-info {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #4a2020;
    color: #c084fc;
    font-size: 0.9em;
    font-style: italic;
}

.ability-info strong {
    color: #e9d5ff;
}

/* Skill Tree Access Button */
.skill-tree-access {
    margin-top: 15px;
    text-align: center;
}

.skill-tree-btn {
    background: linear-gradient(135deg, #581c87 0%, #7e22ce 100%);
    border: 2px solid #9333ea;
    border-radius: 8px;
    padding: 12px 25px;
    color: #e9d5ff;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.skill-tree-btn:hover {
    background: linear-gradient(135deg, #6b21a8 0%, #9333ea 100%);
    box-shadow: 0 0 20px rgba(147, 51, 234, 0.6);
    transform: scale(1.05);
}

/* Skill Tree Screen */
.skill-tree-header {
    background: linear-gradient(135deg, #3a1010 0%, #2a0808 100%);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 2px solid #9333ea;
}

.skill-tree-header h2 {
    color: #c084fc;
    font-size: 2.5em;
    text-align: center;
    margin-bottom: 15px;
    text-shadow: 0 0 20px rgba(147, 51, 234, 0.8);
}

.skill-tree-stats {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
}

.close-skill-tree-btn {
    display: block;
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
    background: linear-gradient(135deg, #2a1a1a 0%, #3a2020 100%);
    border: 2px solid #6b0000;
    border-radius: 8px;
    padding: 10px 20px;
    color: #e0e0e0;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-skill-tree-btn:hover {
    border-color: #ff4444;
    background: linear-gradient(135deg, #3a2020 0%, #4a2828 100%);
    transform: translateX(-5px);
}

/* Skill Tree Content */
.skill-tree-content {
    max-height: 60vh;
    overflow-y: auto;
    padding: 10px;
}

.skill-tier {
    margin-bottom: 30px;
    background: rgba(42, 26, 26, 0.4);
    padding: 20px;
    border-radius: 10px;
    border: 2px solid #4a2020;
}

.tier-title {
    color: #ffaa00;
    font-size: 1.8em;
    text-align: center;
    margin-bottom: 8px;
}

.tier-description {
    color: #aaa;
    text-align: center;
    margin-bottom: 20px;
    font-style: italic;
}

.skill-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

.skill-card {
    background: linear-gradient(135deg, #2a1a1a 0%, #3a2020 100%);
    border: 2px solid #6b0000;
    border-radius: 10px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.skill-card.available {
    border-color: #9333ea;
}

.skill-card.available:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(147, 51, 234, 0.4);
    border-color: #c084fc;
}

.skill-card.locked {
    opacity: 0.6;
    cursor: not-allowed;
    border-color: #4a2020;
}

.skill-card.purchased {
    border-color: #22c55e;
    background: linear-gradient(135deg, #1a2a1a 0%, #2a3a2a 100%);
}

.skill-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #4a2020;
}

.skill-name {
    color: #ffaa00;
    font-size: 1.2em;
    font-weight: bold;
}

.skill-cost {
    background: rgba(147, 51, 234, 0.2);
    border: 1px solid #9333ea;
    border-radius: 5px;
    padding: 3px 10px;
    color: #c084fc;
    font-size: 0.9em;
    font-weight: bold;
}

.skill-card.purchased .skill-cost {
    background: rgba(34, 197, 94, 0.2);
    border-color: #22c55e;
    color: #86efac;
}

.skill-description {
    color: #ccc;
    font-size: 0.95em;
    margin-bottom: 10px;
    line-height: 1.4;
}

.skill-effect {
    color: #9333ea;
    font-size: 0.9em;
    font-weight: bold;
    margin-bottom: 8px;
}

.skill-prerequisite {
    color: #ff6666;
    font-size: 0.85em;
    font-style: italic;
}

.skill-status {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 1.5em;
}

.skill-card.purchased .skill-status::after {
    content: '✅';
}

.skill-card.locked .skill-status::after {
    content: '🔒';
}

.skill-card.available .skill-status::after {
    content: '✨';
}

/* Responsive Skill Tree */
@media (max-width: 768px) {
    .skill-grid {
        grid-template-columns: 1fr;
    }
    
    .skill-tree-header h2 {
        font-size: 2em;
    }
    
    .tier-title {
        font-size: 1.5em;
    }
}

/* Character Screen Styles */
.character-screen-btn {
    background: linear-gradient(135deg, #1a4a4a 0%, #2a6a6a 100%);
    border: 2px solid #4ade80;
    border-radius: 8px;
    padding: 12px 25px;
    color: #e0e0e0;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: 10px;
}

.character-screen-btn:hover {
    background: linear-gradient(135deg, #2a6a6a 0%, #3a8a8a 100%);
    box-shadow: 0 0 20px rgba(74, 222, 128, 0.6);
    transform: scale(1.05);
}

.character-screen-header {
    background: linear-gradient(135deg, #3a1010 0%, #2a0808 100%);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 2px solid #4ade80;
}

.character-screen-header h2 {
    color: #4ade80;
    font-size: 2.5em;
    text-align: center;
    margin-bottom: 15px;
    text-shadow: 0 0 20px rgba(74, 222, 128, 0.8);
}

.close-character-screen-btn {
    display: block;
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
    background: linear-gradient(135deg, #2a1a1a 0%, #3a2020 100%);
    border: 2px solid #6b0000;
    border-radius: 8px;
    padding: 10px 20px;
    color: #e0e0e0;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-character-screen-btn:hover {
    border-color: #ff4444;
    background: linear-gradient(135deg, #3a2020 0%, #4a2828 100%);
    transform: translateX(-5px);
}

.character-screen-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    max-height: 65vh;
    overflow-y: auto;
}

/* Paper Doll Section */
.paper-doll-section {
    background: rgba(42, 26, 26, 0.4);
    padding: 20px;
    border-radius: 10px;
    border: 2px solid #4a2020;
}

.paper-doll-section .section-title {
    color: #ffaa00;
    font-size: 1.5em;
    text-align: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #4a2020;
    padding-bottom: 10px;
}

.equipment-slots {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 25px;
}

.equipment-slot {
    background: linear-gradient(135deg, #2a1a1a 0%, #3a2020 100%);
    border: 2px solid #6b0000;
    border-radius: 8px;
    padding: 12px;
    transition: all 0.3s ease;
}

.equipment-slot:hover {
    border-color: #4ade80;
}

.slot-label {
    color: #aaa;
    font-size: 0.9em;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.slot-content {
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-slot {
    color: #666;
    font-style: italic;
    font-size: 0.9em;
}

.equipped-item {
    width: 100%;
    background: rgba(74, 222, 128, 0.1);
    border: 1px solid #4ade80;
    border-radius: 5px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.equipped-item:hover {
    background: rgba(74, 222, 128, 0.2);
    transform: scale(1.02);
}

.equipped-item-name {
    color: #4ade80;
    font-weight: bold;
    font-size: 1.1em;
    margin-bottom: 5px;
}

.equipped-item-stats {
    color: #ffaa00;
    font-size: 0.85em;
}

.equipped-item-rarity {
    color: #aaa;
    font-size: 0.8em;
    text-transform: uppercase;
    margin-top: 3px;
}

/* Total Stats Display */
.total-stats-display {
    background: rgba(139, 0, 0, 0.2);
    border: 2px solid #8b0000;
    border-radius: 8px;
    padding: 15px;
}

.total-stats-display h4 {
    color: #d4af37;
    font-size: 1.2em;
    text-align: center;
    margin-bottom: 15px;
}

.stats-breakdown {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stat-line {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: rgba(42, 26, 26, 0.5);
    border-radius: 5px;
}

.stat-line.power-line {
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid #d4af37;
    margin-top: 5px;
}

.stat-name {
    color: #aaa;
    min-width: 45px;
    font-weight: bold;
}

.stat-value {
    color: #ffaa00;
    font-weight: bold;
    font-size: 1.2em;
    min-width: 40px;
}

.stat-breakdown-detail {
    color: #888;
    font-size: 0.85em;
    margin-left: auto;
}

/* Backpack Section */
.backpack-section {
    background: rgba(42, 26, 26, 0.4);
    padding: 20px;
    border-radius: 10px;
    border: 2px solid #4a2020;
}

.backpack-section .section-title {
    color: #ffaa00;
    font-size: 1.5em;
    text-align: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #4a2020;
    padding-bottom: 10px;
}

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    max-height: 500px;
    overflow-y: auto;
}

.empty-inventory-message {
    grid-column: 1 / -1;
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 40px 20px;
}

.inventory-item {
    background: linear-gradient(135deg, #2a1a1a 0%, #3a2020 100%);
    border: 2px solid #6b0000;
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    min-height: 120px;
    display: flex;
    flex-direction: column;
}

.inventory-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(74, 222, 128, 0.3);
}

.inventory-item.common {
    border-color: #aaa;
}

.inventory-item.rare {
    border-color: #5e9cff;
    box-shadow: 0 0 10px rgba(94, 156, 255, 0.2);
}

.inventory-item.epic {
    border-color: #d4af37;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

.item-icon {
    font-size: 2em;
    text-align: center;
    margin-bottom: 8px;
}

.item-name {
    color: #ffaa00;
    font-weight: bold;
    font-size: 0.95em;
    margin-bottom: 5px;
    text-align: center;
}

.item-type {
    color: #aaa;
    font-size: 0.75em;
    text-align: center;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.item-stats {
    color: #4ade80;
    font-size: 0.8em;
    margin-top: auto;
}

.item-actions {
    display: flex;
    gap: 5px;
    margin-top: 8px;
}

.item-action-btn {
    flex: 1;
    background: rgba(74, 222, 128, 0.2);
    border: 1px solid #4ade80;
    border-radius: 4px;
    padding: 5px;
    color: #4ade80;
    font-size: 0.75em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.item-action-btn:hover {
    background: rgba(74, 222, 128, 0.4);
}

.item-action-btn.discard {
    background: rgba(139, 0, 0, 0.2);
    border-color: #ff4444;
    color: #ff6666;
}

.item-action-btn.discard:hover {
    background: rgba(139, 0, 0, 0.4);
}

/* Item tooltip */
.item-tooltip {
    position: absolute;
    background: rgba(20, 10, 10, 0.95);
    border: 2px solid #d4af37;
    border-radius: 8px;
    padding: 12px;
    z-index: 1000;
    pointer-events: none;
    max-width: 250px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.8);
}

.tooltip-name {
    color: #ffaa00;
    font-weight: bold;
    font-size: 1.1em;
    margin-bottom: 5px;
}

.tooltip-description {
    color: #ccc;
    font-size: 0.9em;
    margin-bottom: 8px;
    line-height: 1.4;
}

.tooltip-stats {
    color: #4ade80;
    font-size: 0.85em;
    margin-bottom: 5px;
}

.tooltip-value {
    color: #888;
    font-size: 0.8em;
}

/* Responsive Character Screen */
@media (max-width: 768px) {
    .character-screen-content {
        grid-template-columns: 1fr;
    }
    
    .inventory-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .character-screen-header h2 {
        font-size: 2em;
    }
    
    .skill-tree-access {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    
    .character-screen-btn {
        margin-left: 0;
        width: 100%;
    }
}

/* Combat Quick-Bar System */
.combat-quick-bar {
    margin-top: 15px;
    padding: 10px;
    background: linear-gradient(135deg, rgba(20, 10, 10, 0.95), rgba(45, 27, 27, 0.95));
    border: 2px solid #8b0000;
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(139, 0, 0, 0.3);
}

.quick-bar-label {
    font-size: 0.9em;
    color: #ffaa00;
    text-align: center;
    margin-bottom: 8px;
    text-shadow: 0 0 5px #ff9900;
}

.quick-bar-slots {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.quick-slot {
    position: relative;
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #1a1a1a, #2d2d2d);
    border: 2px solid #555;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}

.quick-slot:hover:not(.disabled) {
    border-color: #ffaa00;
    box-shadow: 0 0 15px rgba(255, 170, 0, 0.5), inset 0 0 10px rgba(0, 0, 0, 0.5);
    transform: translateY(-2px);
}

.quick-slot.disabled {
    filter: grayscale(100%);
    opacity: 0.5;
    cursor: not-allowed;
}

.quick-slot.highlight {
    border-color: #ff4444;
    box-shadow: 0 0 20px rgba(255, 68, 68, 0.8);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 20px rgba(255, 68, 68, 0.8); }
    50% { box-shadow: 0 0 30px rgba(255, 68, 68, 1); }
}

.slot-keybind {
    position: absolute;
    top: 2px;
    left: 2px;
    background: rgba(0, 0, 0, 0.7);
    color: #ffaa00;
    font-size: 0.7em;
    font-weight: bold;
    padding: 2px 5px;
    border-radius: 3px;
}

.slot-icon {
    font-size: 2em;
    text-align: center;
}

.empty-slot-text {
    font-size: 0.4em;
    color: #666;
}

.slot-quantity {
    position: absolute;
    bottom: 2px;
    right: 2px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: 0.7em;
    font-weight: bold;
    padding: 2px 5px;
    border-radius: 3px;
    border: 1px solid #555;
}

.slot-item-name {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: #ffaa00;
    font-size: 0.65em;
    padding: 3px 6px;
    border-radius: 3px;
    white-space: nowrap;
    margin-top: 3px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 10;
}

.quick-slot:hover .slot-item-name {
    opacity: 1;
}

/* Add to Hotbar button styling */
.add-to-hotbar-section {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #444;
}

.add-to-hotbar-btn {
    background: linear-gradient(135deg, #2d1b1b, #4a2d2d);
    color: #ffaa00;
    border: 2px solid #ffaa00;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: bold;
    transition: all 0.3s ease;
    margin-top: 5px;
    width: 100%;
}

.add-to-hotbar-btn:hover {
    background: linear-gradient(135deg, #4a2d2d, #6d3d3d);
    box-shadow: 0 0 10px rgba(255, 170, 0, 0.5);
    transform: translateY(-1px);
}

.add-to-hotbar-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Hotbar Slot Selector Modal */
.hotbar-slot-selector {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(20, 10, 10, 0.98);
    border: 3px solid #8b0000;
    border-radius: 10px;
    padding: 20px;
    z-index: 1000;
    box-shadow: 0 0 30px rgba(139, 0, 0, 0.8);
}

.hotbar-slot-selector h3 {
    color: #ffaa00;
    text-align: center;
    margin-bottom: 15px;
    text-shadow: 0 0 10px #ff9900;
}

.hotbar-slot-options {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.hotbar-slot-option {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #1a1a1a, #2d2d2d);
    border: 2px solid #555;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
}

.hotbar-slot-option:hover {
    border-color: #ffaa00;
    box-shadow: 0 0 10px rgba(255, 170, 0, 0.5);
}

.hotbar-slot-option .slot-keybind {
    position: absolute;
    top: 2px;
    left: 2px;
}

.hotbar-slot-option .current-item {
    font-size: 1.5em;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999;
}

.cancel-hotbar-btn {
    background: #444;
    color: #fff;
    border: 1px solid #666;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s ease;
}

.cancel-hotbar-btn:hover {
    background: #555;
}

/* End-Game Narrative Overlay */
.narrative-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 3000;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 1s ease-in;
}

.narrative-content {
    position: relative;
    width: 90%;
    max-width: 1200px;
    height: 80vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.narrative-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0.3;
    z-index: 1;
    border-radius: 15px;
}

.narrative-text-container {
    position: relative;
    z-index: 2;
    max-width: 900px;
    padding: 40px;
    background: rgba(20, 10, 10, 0.85);
    border: 3px solid rgba(139, 0, 0, 0.8);
    border-radius: 15px;
    box-shadow: 0 0 60px rgba(139, 0, 0, 0.6);
    animation: slideUp 1.5s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.narrative-title {
    font-size: 3.5em;
    color: #ffd700;
    text-shadow: 0 0 30px #ffaa00, 0 0 60px #ff6600;
    margin-bottom: 30px;
    font-weight: bold;
    letter-spacing: 2px;
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        text-shadow: 0 0 20px #ffaa00, 0 0 40px #ff6600;
    }
    to {
        text-shadow: 0 0 40px #ffaa00, 0 0 80px #ff6600;
    }
}

.narrative-quote {
    font-size: 1.5em;
    color: #e0e0e0;
    line-height: 1.8;
    margin-bottom: 30px;
    font-style: italic;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
    padding: 20px;
    border-left: 4px solid #d4af37;
    border-right: 4px solid #d4af37;
    background: rgba(0, 0, 0, 0.3);
}

.narrative-outcome {
    font-size: 1.3em;
    color: #ffcc66;
    line-height: 1.6;
    margin-bottom: 40px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.narrative-continue-btn {
    padding: 18px 50px;
    font-size: 1.3em;
    font-weight: bold;
    background: linear-gradient(135deg, #8b0000 0%, #aa0000 100%);
    border: 3px solid #ffd700;
    border-radius: 10px;
    color: #ffd700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    box-shadow: 0 5px 20px rgba(139, 0, 0, 0.5);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.narrative-continue-btn:hover {
    background: linear-gradient(135deg, #aa0000 0%, #cc0000 100%);
    border-color: #ffeb3b;
    box-shadow: 0 8px 30px rgba(255, 215, 0, 0.4);
    transform: scale(1.05);
}

/* Class-specific narrative backgrounds */
.narrative-bg-vanguard {
    background: linear-gradient(135deg, rgba(139, 0, 0, 0.3), rgba(70, 20, 20, 0.3)),
                url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><text y="50" font-size="40" fill="rgba(255,215,0,0.1)">⚔️</text></svg>');
    background-size: 100px 100px;
}

.narrative-bg-shadow {
    background: linear-gradient(135deg, rgba(30, 0, 60, 0.3), rgba(10, 10, 40, 0.3)),
                url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><text y="50" font-size="40" fill="rgba(200,200,255,0.1)">🗡️</text></svg>');
    background-size: 100px 100px;
}

.narrative-bg-occultist {
    background: linear-gradient(135deg, rgba(75, 0, 130, 0.3), rgba(40, 0, 80, 0.3)),
                url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><text y="50" font-size="40" fill="rgba(200,0,255,0.1)">🔮</text></svg>');
    background-size: 100px 100px;
}

/* Mobile responsiveness for narrative overlay */
@media (max-width: 768px) {
    .narrative-title {
        font-size: 2.2em;
    }
    
    .narrative-quote {
        font-size: 1.2em;
        padding: 15px;
    }
    
    .narrative-outcome {
        font-size: 1.1em;
    }
    
    .narrative-text-container {
        padding: 25px;
    }
    
    .narrative-continue-btn {
        padding: 15px 35px;
        font-size: 1.1em;
    }
}

/* Town Theme Variations - Tiered Progression System */

/* Tier 1: Nature/Forest Theme (Green/Brown) */
.game-container.town-nature {
    background: linear-gradient(135deg, rgba(20, 30, 10, 0.95) 0%, rgba(30, 40, 20, 0.9) 50%, rgba(20, 30, 10, 0.95) 100%);
    border-color: #4a7c2e;
    box-shadow: 0 0 30px rgba(74, 124, 46, 0.5), inset 0 0 50px rgba(0, 0, 0, 0.5);
}

.game-container.town-nature .event-content {
    background: linear-gradient(135deg, rgba(30, 40, 20, 0.8) 0%, rgba(40, 50, 30, 0.7) 100%);
}

.game-container.town-nature .choice-btn {
    background: linear-gradient(135deg, #2a4020 0%, #3a5030 100%);
    border-color: #4a7c2e;
}

.game-container.town-nature .choice-btn:hover {
    border-color: #6fa849;
    box-shadow: 0 5px 25px rgba(111, 168, 73, 0.4);
}

/* Tier 2: City Theme (Grey/Blue) */
.game-container.town-city {
    background: linear-gradient(135deg, rgba(15, 20, 30, 0.95) 0%, rgba(25, 35, 50, 0.9) 50%, rgba(15, 20, 30, 0.95) 100%);
    border-color: #4a6b8a;
    box-shadow: 0 0 30px rgba(74, 107, 138, 0.5), inset 0 0 50px rgba(0, 0, 0, 0.5);
}

.game-container.town-city .event-content {
    background: linear-gradient(135deg, rgba(20, 30, 45, 0.8) 0%, rgba(30, 40, 55, 0.7) 100%);
}

.game-container.town-city .choice-btn {
    background: linear-gradient(135deg, #203050 0%, #304560 100%);
    border-color: #4a6b8a;
}

.game-container.town-city .choice-btn:hover {
    border-color: #5a8bc0;
    box-shadow: 0 5px 25px rgba(90, 139, 192, 0.4);
}

/* Tier 3: War Theme (Grey/Red) */
.game-container.town-war {
    background: linear-gradient(135deg, rgba(30, 15, 15, 0.95) 0%, rgba(45, 25, 25, 0.9) 50%, rgba(30, 15, 15, 0.95) 100%);
    border-color: #8a4a4a;
    box-shadow: 0 0 30px rgba(138, 74, 74, 0.5), inset 0 0 50px rgba(0, 0, 0, 0.5);
}

.game-container.town-war .event-content {
    background: linear-gradient(135deg, rgba(40, 20, 20, 0.8) 0%, rgba(50, 30, 30, 0.7) 100%);
}

.game-container.town-war .choice-btn {
    background: linear-gradient(135deg, #502020 0%, #603030 100%);
    border-color: #8a4a4a;
}

.game-container.town-war .choice-btn:hover {
    border-color: #c05a5a;
    box-shadow: 0 5px 25px rgba(192, 90, 90, 0.4);
}

/* Tier 4: Astral Theme (Blue/Gold) */
.game-container.town-astral {
    background: linear-gradient(135deg, rgba(10, 15, 35, 0.95) 0%, rgba(20, 25, 50, 0.9) 50%, rgba(10, 15, 35, 0.95) 100%);
    border-color: #ffd700;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.5), inset 0 0 50px rgba(0, 0, 0, 0.5);
    animation: astralPulse 3s ease-in-out infinite;
}

@keyframes astralPulse {
    0%, 100% { 
        box-shadow: 0 0 30px rgba(255, 215, 0, 0.5), inset 0 0 50px rgba(0, 0, 0, 0.5);
    }
    50% { 
        box-shadow: 0 0 40px rgba(255, 215, 0, 0.7), inset 0 0 50px rgba(0, 0, 0, 0.5);
    }
}

.game-container.town-astral .event-content {
    background: linear-gradient(135deg, rgba(15, 20, 45, 0.8) 0%, rgba(25, 30, 60, 0.7) 100%);
}

.game-container.town-astral .choice-btn {
    background: linear-gradient(135deg, #1a2555 0%, #2a3570 100%);
    border-color: #ffd700;
}

.game-container.town-astral .choice-btn:hover {
    border-color: #ffed4e;
    box-shadow: 0 5px 25px rgba(255, 237, 78, 0.6);
}

.game-container.town-astral .title,
.game-container.town-astral #event-title {
    text-shadow: 0 0 20px #ffd700, 0 0 40px #ffed4e;
}

/* Prologue Screen Styles */
#prologue-screen {
    /* Inherits from .screen */
}

.prologue-event-content {
    /* Match .event-content styling with darker theme */
    background: linear-gradient(135deg, rgba(20, 10, 10, 0.95) 0%, rgba(40, 20, 20, 0.9) 100%);
    border: 3px solid #8b0000;
    border-radius: 15px;
    padding: 30px;
    max-width: 800px;
    margin: 0 auto;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.8);
}

.prologue-title {
    color: #ff6666;
    font-size: 2em;
    margin-bottom: 25px;
    text-align: center;
    text-shadow: 0 0 10px rgba(255, 102, 102, 0.5);
}

.prologue-text {
    color: #fff;
    /* Use rem for scalable font sizes */
    font-size: clamp(1rem, 2.5vw, 1.5rem);
    line-height: 1.8;
    margin-bottom: 2.5rem;
    text-align: center;
    white-space: pre-wrap;
    /* Match body font stack for consistency */
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.prologue-text p {
    margin-bottom: clamp(1.25rem, 3vw, 1.875rem);
    opacity: 0;
    animation: fadeInText 1s ease-in forwards;
}

.prologue-text.typewriter p {
    opacity: 1;
}

@keyframes fadeInText {
    to { opacity: 1; }
}

@keyframes typewriter {
    from { width: 0; }
    to { width: 100%; }
}

.prologue-continue-btn {
    background: linear-gradient(135deg, #8b0000 0%, #ff4444 100%);
    color: #fff;
    border: 2px solid #ff6666;
    padding: clamp(0.75rem, 2vw, 1rem) clamp(1.5rem, 4vw, 2.5rem);
    font-size: clamp(1rem, 2vw, 1.2rem);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    text-transform: uppercase;
    font-family: inherit;
}

.prologue-continue-btn:hover {
    background: linear-gradient(135deg, #ff4444 0%, #ff6666 100%);
    box-shadow: 0 0 20px rgba(255, 68, 68, 0.6);
    transform: translateY(-2px);
}

/* Prologue Stage Styles - Grid-based centering */
#prologue-stage {
    position: fixed;
    inset: 0; /* Forces cover of all 4 corners */
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 99999;
    display: grid;
    place-items: center; /* THE FIX: Centers children perfectly on both axes */
    margin: 0;
    padding: 0;
    overflow: hidden;
    box-sizing: border-box;
    /* Add gradient mask for fading edge effect */
    -webkit-mask-image: linear-gradient(
        to bottom,
        transparent 0%,
        black 15%,
        black 85%,
        transparent 100%
    );
    mask-image: linear-gradient(
        to bottom,
        transparent 0%,
        black 15%,
        black 85%,
        transparent 100%
    );
}

#prologue-content {
    width: 90vw;
    max-width: 800px;
    text-align: center;
    position: relative;
    box-sizing: border-box;
}

#prologue-scroll {
    animation: cinematicScroll 25s linear forwards;
}

#prologue-scroll p {
    color: #fff;
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    margin-bottom: 2rem;
    line-height: 1.8;
    font-family: 'Georgia', serif;
    box-sizing: border-box;
}

@keyframes cinematicScroll {
    0% { 
        transform: translateY(100vh); 
    }
    100% { 
        transform: translateY(-120vh); 
    }
}

#prologue-action {
    /* When shown, this will be centered by the Grid parent */
    opacity: 0;
}

#continue-btn {
    padding: 1rem 2rem;
    font-size: 1.2rem;
    background: linear-gradient(135deg, #8b0000 0%, #ff4444 100%);
    color: #fff;
    border: 2px solid #ff6666;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    text-transform: uppercase;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

#continue-btn:hover {
    background: linear-gradient(135deg, #ff4444 0%, #ff6666 100%);
    box-shadow: 0 0 20px rgba(255, 68, 68, 0.6);
    transform: translateY(-2px);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Respect user motion preferences */
@media (prefers-reduced-motion: reduce) {
    #prologue-scroll {
        animation: cinematicScrollReduced 10s linear forwards;
    }
    
    @keyframes cinematicScrollReduced {
        0% {
            transform: translateY(50vh);
        }
        100% {
            transform: translateY(-50vh);
        }
    }
}

/* Elite Captain Cutscene Styles */
.elite-captain-cutscene {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, rgba(20, 0, 0, 0.95) 0%, rgba(50, 0, 0, 0.95) 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.5s ease-in;
    overflow-y: auto;
}

.elite-cutscene-content {
    width: 90%;
    max-width: 700px;
    text-align: center;
    padding: 3rem;
    margin: auto;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 3px solid rgba(139, 0, 0, 0.8);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(139, 0, 0, 0.7), inset 0 0 30px rgba(139, 0, 0, 0.2);
}

.elite-cutscene-header h1 {
    color: #ff4444;
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    text-shadow: 0 0 20px rgba(255, 68, 68, 0.8), 0 0 40px rgba(139, 0, 0, 0.6);
    margin-bottom: 2rem;
    font-weight: bold;
    animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% {
        text-shadow: 0 0 20px rgba(255, 68, 68, 0.8), 0 0 40px rgba(139, 0, 0, 0.6);
    }
    50% {
        text-shadow: 0 0 30px rgba(255, 68, 68, 1), 0 0 60px rgba(139, 0, 0, 0.8);
    }
}

.elite-cutscene-body {
    margin-bottom: 2.5rem;
}

.elite-cutscene-text {
    color: #fff;
    font-size: clamp(1rem, 2.5vw, 1.3rem);
    line-height: 1.8;
    margin-bottom: 1.5rem;
    text-align: center;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.elite-cutscene-text p {
    margin-bottom: 1.5rem;
    opacity: 0;
    animation: fadeInText 0.8s ease-in forwards;
}

.elite-cutscene-text p:nth-child(1) { animation-delay: 0.2s; }
.elite-cutscene-text p:nth-child(2) { animation-delay: 0.6s; }
.elite-cutscene-text p:nth-child(3) { animation-delay: 1s; }
.elite-cutscene-text p:nth-child(4) { animation-delay: 1.4s; }

.elite-cutscene-text .elite-name {
    color: #ff6666;
    font-weight: bold;
    font-size: 1.2em;
    text-shadow: 0 0 10px rgba(255, 68, 68, 0.6);
}

.elite-cutscene-text .elite-stats {
    color: #ffaa44;
    font-weight: bold;
}

.elite-cutscene-btn {
    background: linear-gradient(135deg, #8b0000 0%, #ff4444 100%);
    color: #fff;
    border: 2px solid #ff6666;
    padding: clamp(0.75rem, 2vw, 1rem) clamp(2rem, 5vw, 3rem);
    font-size: clamp(1rem, 2vw, 1.3rem);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    text-transform: uppercase;
    font-family: inherit;
    opacity: 0;
    animation: fadeInText 0.8s ease-in 1.8s forwards;
}

.elite-cutscene-btn:hover {
    background: linear-gradient(135deg, #ff4444 0%, #ff6666 100%);
    box-shadow: 0 0 25px rgba(255, 68, 68, 0.8);
    transform: translateY(-2px);
}

.elite-cutscene-btn:focus,
.elite-cutscene-btn:focus-visible {
    outline: 3px solid #ff6666;
    outline-offset: 3px;
    box-shadow: 0 0 25px rgba(255, 68, 68, 0.8);
}

.elite-cutscene-btn:active {
    transform: translateY(0);
}

/* Respect user motion preferences */
@media (prefers-reduced-motion: reduce) {
    .elite-captain-cutscene {
        animation: none;
    }
    .elite-cutscene-header h1 {
        animation: none;
    }
    .elite-cutscene-text p,
    .elite-cutscene-btn {
        animation: none;
        opacity: 1;
    }
}

/* First Step Screen Styles */
#first-step-screen.active {
    text-align: center;
    padding: clamp(2rem, 5vw, 3.75rem) clamp(1.5rem, 4vw, 2.5rem);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.first-step-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(2rem, 4vw, 2.5rem);
    max-width: 800px;
    width: 90%;
    margin: auto;
    /* Backdrop blur for consistency */
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: clamp(2rem, 4vw, 3rem);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.day-counter {
    font-size: clamp(2rem, 5vw, 3rem);
    color: #ff4444;
    text-shadow: 0 0 20px #ff0000, 0 0 40px #8b0000;
    font-weight: bold;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.first-step-message {
    font-size: clamp(1rem, 2.5vw, 1.5rem);
    color: #e0e0e0;
    font-style: italic;
    max-width: 600px;
    line-height: 1.6;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.take-first-step-btn {
    background: linear-gradient(135deg, #8b0000 0%, #ff4444 100%);
    color: #fff;
    border: 3px solid #ff6666;
    padding: clamp(1rem, 2.5vw, 1.25rem) clamp(2rem, 4vw, 3.125rem);
    font-size: clamp(1.1rem, 2.5vw, 1.5rem);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: inherit;
}

.take-first-step-btn:hover {
    background: linear-gradient(135deg, #ff4444 0%, #ff6666 100%);
    box-shadow: 0 0 30px rgba(255, 68, 68, 0.8);
    transform: scale(1.05);
}

/* Pulse Animation */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(255, 68, 68, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 40px rgba(255, 68, 68, 0.8);
    }
}

.pulse-animation {
    animation: pulse 2s ease-in-out infinite;
}

/* Fade transitions */
.fade-in {
    animation: fadeIn 1s ease-in forwards;
}

.fade-out {
    animation: fadeOut 1s ease-out forwards;
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Responsive Media Queries for Opening Scenes */

/* Tablet and smaller screens */
@media (max-width: 768px) {
    .prologue-event-content {
        width: 95%;
        padding: 1.5rem;
    }
    
    .prologue-text {
        margin-bottom: 2rem;
    }
    
    .prologue-continue-btn {
        width: 100%;
        max-width: 300px;
    }
    
    #first-step-screen {
        padding: 1.5rem 1rem;
    }
    
    .first-step-content {
        width: 95%;
        padding: 1.5rem;
        gap: 1.5rem;
    }
    
    .take-first-step-btn {
        width: 100%;
        max-width: 300px;
    }
}

/* Mobile phones */
@media (max-width: 480px) {
    .prologue-event-content {
        width: 100%;
        padding: 1rem;
        border-radius: 0;
    }
    
    .prologue-text {
        line-height: 1.6;
        margin-bottom: 1.5rem;
    }
    
    .prologue-text p {
        margin-bottom: 1rem;
    }
    
    .prologue-continue-btn {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
        width: 100%;
        max-width: 250px;
    }
    
    #first-step-screen {
        padding: 1rem 0.5rem;
    }
    
    .first-step-content {
        width: 100%;
        padding: 1rem;
        gap: 1rem;
        border-radius: 0;
    }
    
    .day-counter {
        text-shadow: 0 0 15px #ff0000, 0 0 30px #8b0000;
    }
    
    .first-step-message {
        line-height: 1.5;
    }
    
    .take-first-step-btn {
        padding: 0.875rem 1.5rem;
        font-size: 1.1rem;
        width: 100%;
        max-width: 250px;
        letter-spacing: 0.5px;
    }
}

/* High-resolution displays */
@media (min-width: 1920px) {
    .prologue-event-content {
        max-width: 900px;
    }
    
    .first-step-content {
        max-width: 900px;
    }
}

/* ============================================
   SECRET SKILLS STYLING
   ============================================ */

.secret-skills-container {
    padding: 10px;
    background: rgba(26, 0, 51, 0.3);
    border-radius: 8px;
    border: 1px solid #4b0082;
}

.secret-skills-label {
    font-size: 1.1em;
    font-weight: bold;
    margin-bottom: 10px;
    color: #8b00ff;
    text-shadow: 0 0 10px #8b00ff;
}

.secret-skills-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.secret-skill-btn {
    background: linear-gradient(135deg, #1a0033 0%, #4b0082 100%);
    border: 2px solid #8b00ff;
    box-shadow: 0 0 20px #8b00ff, 0 0 40px #4b0082;
    animation: forbiddenPulse 2s ease-in-out infinite;
    color: #fff;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Cinzel', serif;
    font-size: 0.9em;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 120px;
}

.secret-skill-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #4b0082 0%, #8b00ff 100%);
    transform: scale(1.05);
    box-shadow: 0 0 30px #8b00ff, 0 0 60px #4b0082;
}

.secret-skill-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    animation: none;
}

.secret-skill-btn .skill-icon {
    font-size: 1.5em;
}

.secret-skill-btn .skill-name {
    font-weight: bold;
    font-size: 0.95em;
}

.secret-skill-btn .skill-cost {
    font-size: 0.85em;
    color: #aaa;
}

@keyframes forbiddenPulse {
    0%, 100% {
        box-shadow: 0 0 20px #8b00ff, 0 0 40px #4b0082;
    }
    50% {
        box-shadow: 0 0 30px #8b00ff, 0 0 60px #4b0082;
    }
}

/* Mobile responsiveness for secret skills */
@media (max-width: 768px) {
    .secret-skills-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .secret-skill-btn {
        width: 100%;
        max-width: 250px;
    }
}

/* ============================================
   MERCHANT SCREEN STYLES (Silas, the Void Merchant)
   ============================================ */

.merchant-screen {
    background: linear-gradient(135deg, #1a0033 0%, #4b0082 100%);
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    position: relative;
}

.merchant-content {
    width: 100%;
    max-width: 900px;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid #8b00ff;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 0 30px #8b00ff, 0 0 60px #4b0082;
}

.merchant-header {
    text-align: center;
    margin-bottom: 20px;
}

.merchant-title {
    font-size: 2.2em;
    color: #ffd700;
    text-shadow: 0 0 10px #8b00ff, 0 0 20px #4b0082;
    margin: 0 0 10px 0;
    font-family: 'Cinzel', serif;
}

.merchant-subtitle {
    font-size: 1.1em;
    color: #bb99ff;
    font-style: italic;
    margin: 0;
}

.merchant-stats {
    display: flex;
    justify-content: space-around;
    gap: 20px;
    margin: 20px 0;
    padding: 15px;
    background: rgba(75, 0, 130, 0.3);
    border-radius: 10px;
    border: 1px solid #8b00ff;
}

.merchant-stats .stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.merchant-stats .stat-label {
    font-size: 0.9em;
    color: #aaa;
}

.merchant-stats .stat-item span:last-child {
    font-size: 1.3em;
    font-weight: bold;
    color: #ffd700;
}

.merchant-offerings {
    display: flex;
    flex-direction: column;
    gap: 25px;
    margin: 20px 0;
}

.merchant-section {
    background: rgba(0, 0, 0, 0.4);
    padding: 20px;
    border-radius: 10px;
    border: 1px solid #6a0dad;
}

.merchant-section .section-title {
    font-size: 1.4em;
    color: #bb99ff;
    margin: 0 0 10px 0;
    font-family: 'Cinzel', serif;
}

.merchant-section .section-description {
    color: #aaa;
    font-size: 0.95em;
    margin: 0 0 15px 0;
    font-style: italic;
}

.skills-shop {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.skill-card {
    display: flex;
    gap: 15px;
    background: rgba(75, 0, 130, 0.2);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #6a0dad;
    transition: all 0.3s ease;
}

.skill-card:hover {
    background: rgba(75, 0, 130, 0.4);
    border-color: #8b00ff;
    box-shadow: 0 0 15px rgba(139, 0, 255, 0.3);
}

.skill-card .skill-icon {
    font-size: 3em;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 60px;
}

.skill-card .skill-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.skill-card .skill-name {
    font-size: 1.2em;
    color: #ffd700;
    margin: 0;
    font-family: 'Cinzel', serif;
}

.skill-card .skill-description {
    color: #ddd;
    margin: 0;
    font-size: 0.95em;
}

.skill-card .skill-cost {
    color: #aaa;
    font-size: 0.9em;
    margin: 0;
}

.skill-card .unlocked-badge {
    color: #00ff00;
    font-weight: bold;
    font-size: 1.1em;
}

.unlock-skill-btn {
    background: linear-gradient(135deg, #6a0dad 0%, #8b00ff 100%);
    color: white;
    border: 2px solid #8b00ff;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    transition: all 0.3s ease;
    align-self: flex-start;
}

.unlock-skill-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #8b00ff 0%, #9d4edd 100%);
    transform: scale(1.05);
    box-shadow: 0 0 20px #8b00ff;
}

.unlock-skill-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.merchant-btn {
    background: linear-gradient(135deg, #4b0082 0%, #6a0dad 100%);
    color: white;
    border: 2px solid #8b00ff;
    padding: 15px 30px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: bold;
    transition: all 0.3s ease;
    width: 100%;
    font-family: 'Almendra', serif;
}

.merchant-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #6a0dad 0%, #8b00ff 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(139, 0, 255, 0.5);
}

.merchant-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.merchant-btn.leave-btn {
    margin-top: 20px;
    background: linear-gradient(135deg, #8b0000 0%, #dc143c 100%);
    border-color: #ff6b6b;
}

.merchant-btn.leave-btn:hover {
    background: linear-gradient(135deg, #a52a2a 0%, #ff4444 100%);
    box-shadow: 0 5px 20px rgba(220, 20, 60, 0.5);
}

.exchange-option,
.crafting-option {
    display: flex;
    justify-content: center;
}

/* Mobile responsiveness for merchant screen */
@media (max-width: 768px) {
    .merchant-content {
        padding: 15px;
    }
    
    .merchant-title {
        font-size: 1.6em;
    }
    
    .merchant-stats {
        flex-direction: column;
        gap: 10px;
    }
    
    .skill-card {
        flex-direction: column;
        text-align: center;
    }
    
    .skill-card .skill-icon {
        font-size: 2.5em;
    }
    
    .unlock-skill-btn {
        align-self: center;
        width: 100%;
    }
}
