:root {
    --teak: #8B6914;
    --cream: #F5E6C8;
    --forest: #2D5016;
    --amber: #D4A017;
    --ruby: #9B1B30;
    --sapphire: #1B3A6B;
    --nicholas-color: #2952A3;
    --david-color: #D4930B;
    --bg-dark: #0D0B08;
    --panel-dark: rgba(13, 11, 8, 0.85);
    --panel-border: rgba(212, 160, 23, 0.15);
    --text-primary: #F5E6C8;
    --text-secondary: rgba(245, 230, 200, 0.65);
    --lavender: #B8A9C9;
    --gold-thought: #E8C547;
}

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

body {
    background: var(--bg-dark);
    color: var(--text-primary);
    font-family: 'DM Sans', sans-serif;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

.font-serif {
    font-family: 'Playfair Display', serif;
}

.font-sans {
    font-family: 'DM Sans', sans-serif;
}

/* Vignette overlay */
.vignette {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.7) 100%);
    pointer-events: none;
    z-index: 1;
}

/* Film grain */
.grain {
    position: absolute;
    inset: 0;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 2;
}

/* Typewriter cursor */
@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.typewriter-cursor {
    animation: blink 0.8s infinite;
}

/* Breathing animation for portraits */
@keyframes breathe {
    0%, 100% { transform: scale(1) translateY(0); }
    50% { transform: scale(1.005) translateY(-2px); }
}

.portrait-breathe {
    animation: breathe 4s ease-in-out infinite;
}

/* Pulse for continue indicator */
@keyframes pulse-down {
    0%, 100% { transform: translateY(0); opacity: 0.6; }
    50% { transform: translateY(4px); opacity: 1; }
}

.pulse-indicator {
    animation: pulse-down 1.5s ease-in-out infinite;
}

/* Choice hover glow */
.choice-btn {
    transition: all 0.3s ease;
    border: 1px solid rgba(212, 160, 23, 0.2);
    background: rgba(13, 11, 8, 0.8);
}

.choice-btn:hover {
    border-color: var(--amber);
    box-shadow: 0 0 20px rgba(212, 160, 23, 0.2), inset 0 0 20px rgba(212, 160, 23, 0.05);
    transform: scale(1.02);
    background: rgba(212, 160, 23, 0.08);
}

/* Fade transitions */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-100%); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes shakeScreen {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-3px); }
    20%, 40%, 60%, 80% { transform: translateX(3px); }
}

@keyframes screenPulse {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.15); }
}

.animate-fadeIn {
    animation: fadeIn 0.8s ease forwards;
}

.animate-fadeInUp {
    animation: fadeInUp 0.6s ease forwards;
}

.animate-slideDown {
    animation: slideDown 0.5s ease forwards;
}

.animate-slideInLeft {
    animation: slideInLeft 0.4s ease forwards;
}

.screen-shake {
    animation: shakeScreen 0.4s ease;
}

.screen-pulse {
    animation: screenPulse 0.6s ease;
}

/* Dialogue box styling */
.dialogue-box {
    background: linear-gradient(180deg, rgba(13, 11, 8, 0.75) 0%, rgba(13, 11, 8, 0.92) 30%);
    border-top: 1px solid rgba(212, 160, 23, 0.15);
    backdrop-filter: blur(12px);
}

/* Stat bars */
.stat-bar {
    height: 4px;
    border-radius: 2px;
    background: rgba(245, 230, 200, 0.1);
    overflow: hidden;
}

.stat-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.8s ease, background-color 0.5s ease;
}

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

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(212, 160, 23, 0.3);
    border-radius: 2px;
}

/* Title screen */
@keyframes gentleSway {
    0%, 100% { transform: translateX(0) scale(1.05); }
    50% { transform: translateX(-10px) scale(1.05); }
}

.bg-sway {
    animation: gentleSway 20s ease-in-out infinite;
}

/* Loading animation */
@keyframes crossGlow {
    0%, 100% { opacity: 0.3; filter: drop-shadow(0 0 5px rgba(212, 160, 23, 0.3)); }
    50% { opacity: 1; filter: drop-shadow(0 0 20px rgba(212, 160, 23, 0.8)); }
}

.cross-glow {
    animation: crossGlow 2s ease-in-out infinite;
}

/* Responsive */
@media (max-width: 768px) {
    .dialogue-box {
        min-height: 35vh;
    }
}

/* Event banner */
@keyframes bannerSlide {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.event-banner {
    animation: bannerSlide 0.6s ease forwards;
}

/* Menu overlay */
.menu-overlay {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
}

/* Chapter card */
@keyframes chapterFadeIn {
    0% { opacity: 0; transform: scale(0.95); }
    20% { opacity: 1; transform: scale(1); }
    80% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(1.02); }
}

.chapter-card {
    animation: chapterFadeIn 4s ease forwards;
}