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

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    background-color: #0a0a08;
    color: #d4c5a9;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.15rem;
    line-height: 1.8;
}

/* ==============================================
   FULLSCREEN LAYOUT — Cinematic, no scroll
   ============================================== */

#game-container {
    width: 100%;
    height: 100vh;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ==============================================
   INK WASH ART — Fills the screen
   ============================================== */

#scene-art {
    position: absolute;
    top: 40px;
    left: 0;
    width: 100%;
    height: 60%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    z-index: 0;
}

#scene-art svg {
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    animation: artFadeIn 2.5s ease-out 0.2s forwards;
}

/* Gradient overlay to darken bottom for subtitle readability */
#scene-art::after {
    content: '';
    position: absolute;
    bottom: -5%;
    left: 0;
    width: 100%;
    height: 50%;
    background: linear-gradient(to bottom, transparent 0%, rgba(10, 10, 8, 0.85) 60%, rgba(10, 10, 8, 1) 100%);
    pointer-events: none;
    z-index: 1;
}

@keyframes artFadeIn {
    from { opacity: 0; transform: scale(1.03); }
    to { opacity: 1; transform: scale(1); }
}

/* Ink stroke drawing animation */
.ink-stroke {
    fill: none;
    stroke: #8b5a2b;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    animation: inkDraw 3s ease-out forwards;
}

.ink-stroke-thin {
    fill: none;
    stroke: #5a4a35;
    stroke-width: 1;
    stroke-linecap: round;
    stroke-dasharray: 800;
    stroke-dashoffset: 800;
    animation: inkDraw 2.5s ease-out forwards;
}

.ink-wash {
    opacity: 0;
    animation: washReveal 2s ease-out forwards;
}

.ink-fill {
    opacity: 0;
    animation: washReveal 1.5s ease-out forwards;
}

/* Layered reveal timing */
.layer-1 { animation-delay: 0.3s; }
.layer-2 { animation-delay: 1s; }
.layer-3 { animation-delay: 1.6s; }

.layer-1.ink-stroke, .layer-1.ink-stroke-thin { animation-delay: 0.3s; }
.layer-2.ink-stroke, .layer-2.ink-stroke-thin { animation-delay: 1s; }
.layer-3.ink-stroke, .layer-3.ink-stroke-thin { animation-delay: 1.6s; }

/* Scene title */
.scene-title {
    fill: #5a4a35;
    font-family: Georgia, 'Times New Roman', serif;
    opacity: 0;
    animation: titleFade 2s ease-out 0.5s forwards;
}

@keyframes inkDraw {
    to { stroke-dashoffset: 0; }
}

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

@keyframes titleFade {
    from { opacity: 0; }
    to { opacity: 0.5; }
}

/* Ambient animations for SVG elements */
.flame-flicker {
    animation: flicker 1.5s ease-in-out infinite alternate;
    transform-origin: center bottom;
}

@keyframes flicker {
    0% { opacity: 0.5; transform: scaleY(0.95) translateX(-1px); }
    25% { opacity: 0.8; transform: scaleY(1.05) translateX(0.5px); }
    50% { opacity: 0.6; transform: scaleY(0.98) translateX(1px); }
    75% { opacity: 0.9; transform: scaleY(1.02) translateX(-0.5px); }
    100% { opacity: 0.55; transform: scaleY(0.97) translateX(0px); }
}

.dust-drift {
    animation: driftRight 12s linear infinite;
}

@keyframes driftRight {
    from { transform: translateX(-20px); opacity: 0; }
    15% { opacity: 0.15; }
    85% { opacity: 0.15; }
    to { transform: translateX(40px); opacity: 0; }
}

.dust-drift-slow {
    animation: driftRight 18s linear infinite;
    animation-delay: 3s;
}

.float-up {
    animation: floatUp 6s ease-out infinite;
}

@keyframes floatUp {
    from { transform: translateY(0); opacity: 0.3; }
    50% { opacity: 0.15; }
    to { transform: translateY(-30px); opacity: 0; }
}

.float-up-slow {
    animation: floatUp 10s ease-out infinite;
    animation-delay: 2s;
}

.sway {
    animation: sway 4s ease-in-out infinite alternate;
    transform-origin: center bottom;
}

@keyframes sway {
    from { transform: rotate(-1deg); }
    to { transform: rotate(1deg); }
}

.pulse-glow {
    animation: pulseGlow 3s ease-in-out infinite alternate;
}

@keyframes pulseGlow {
    from { opacity: 0.15; }
    to { opacity: 0.3; }
}

.shimmer {
    animation: shimmer 5s ease-in-out infinite alternate;
}

@keyframes shimmer {
    0% { opacity: 0.08; }
    50% { opacity: 0.18; }
    100% { opacity: 0.08; }
}

.buzzard-circle {
    animation: buzzardCircle 8s linear infinite;
    transform-origin: center center;
}

@keyframes buzzardCircle {
    from { transform: rotate(0deg) translateX(5px) rotate(0deg); }
    to { transform: rotate(360deg) translateX(5px) rotate(-360deg); }
}

.river-flow {
    animation: riverFlow 6s ease-in-out infinite alternate;
}

@keyframes riverFlow {
    from { transform: translateX(-3px); }
    to { transform: translateX(3px); }
}

/* ==============================================
   VIOLENCE LAYER — Art transition trigger
   ============================================== */

.violence-layer {
    transition: opacity 1.5s ease-in;
}

#game-container.violence-active .violence-layer {
    opacity: 1 !important;
}

/* Screen shake on violence */
@keyframes screenShake {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-3px, 2px); }
    20% { transform: translate(4px, -1px); }
    30% { transform: translate(-2px, 3px); }
    40% { transform: translate(3px, -2px); }
    50% { transform: translate(-1px, 1px); }
    60% { transform: translate(2px, -3px); }
    70% { transform: translate(-4px, 1px); }
    80% { transform: translate(1px, 2px); }
    90% { transform: translate(-2px, -1px); }
}

#game-container.violence-active #scene-art {
    animation: screenShake 0.6s ease-out 1;
}

/* ==============================================
   SUBTITLE AREA — Pinned to bottom of screen
   ============================================== */

#subtitle-area {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    width: 85%;
    max-width: 750px;
    z-index: 10;
    text-align: center;
    pointer-events: none;
}

#subtitle-area > * {
    pointer-events: auto;
}

#scene-text {
    text-align: center;
    min-height: 3.5em;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Click to continue prompt */
.continue-prompt {
    color: #7a7060;
    font-size: 0.7rem;
    margin-top: 1rem;
    opacity: 0;
    animation: promptPulse 2s ease-in-out infinite;
    cursor: pointer;
    user-select: none;
}

.continue-prompt.fading-out {
    opacity: 0 !important;
    animation: none;
    transition: opacity 0.3s ease-out;
}

@keyframes promptPulse {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 0.6; }
}

/* Subtitle paragraphs — only one visible at a time */
.subtitle-p {
    line-height: 1.7;
    opacity: 0;
    transition: opacity 0.6s ease-out;
    text-shadow: 0 2px 12px rgba(0,0,0,1), 0 0 40px rgba(0,0,0,0.9), 0 0 60px rgba(0,0,0,0.5);
    font-size: 0.95rem;
    max-width: 650px;
    margin: 0 auto;
    padding: 0.5em 1em;
}

.subtitle-p.revealed {
    opacity: 1;
}

.subtitle-p.fading-out {
    opacity: 0;
    transition: opacity 0.5s ease-in;
}

/* Individual words fade in */
.word {
    opacity: 0;
    transition: opacity 0.3s ease-out;
    display: inline;
}

.word.visible {
    opacity: 1;
}

/* === Keyword effects === */

/* The Judge */
.kw-judge {
    color: #c0b090;
    text-shadow: 0 0 12px rgba(192, 176, 144, 0.3), 0 2px 8px rgba(0,0,0,0.8);
    font-style: italic;
}

/* Blood/violence */
.kw-blood {
    color: #8b2020;
    text-shadow: 0 0 8px rgba(139, 32, 32, 0.4), 0 2px 8px rgba(0,0,0,0.8);
}

/* Landscape */
.kw-land {
    color: #b89a6a;
}

/* Fire */
.kw-fire {
    color: #c4783a;
    text-shadow: 0 0 10px rgba(196, 120, 58, 0.3), 0 2px 8px rgba(0,0,0,0.8);
}

/* War/philosophy */
.kw-war {
    color: #d4c5a9;
    font-variant: small-caps;
    letter-spacing: 0.05em;
    text-shadow: 0 0 15px rgba(212, 197, 169, 0.2), 0 2px 8px rgba(0,0,0,0.8);
}

/* Divider */
#divider {
    border: none;
    border-top: 1px solid #2a2520;
    margin: 1.5rem auto;
    max-width: 200px;
    opacity: 0;
    transition: opacity 0.6s ease-out;
}

#divider.revealed {
    opacity: 1;
}

/* ==============================================
   CHOICES — Fade in below subtitle
   ============================================== */

#choices {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    align-items: center;
    text-align: center;
}

.choice {
    color: #d4c5a9;
    text-decoration: none;
    cursor: pointer;
    padding: 0.4rem 1.5rem;
    border: 1px solid transparent;
    border-radius: 2px;
    transition: border-color 0.3s, color 0.3s, opacity 0.3s, transform 0.3s, text-shadow 0.3s;
    opacity: 0;
    transform: translateY(6px);
    font-size: 1rem;
    text-shadow: 0 2px 8px rgba(0,0,0,0.8);
}

.choice.revealed {
    opacity: 0.6;
    transform: translateY(0);
}

.choice:hover {
    border-color: #6b1c1c;
    color: #e8dcc6;
    opacity: 1;
    text-shadow: 0 0 12px rgba(107, 28, 28, 0.3);
}

/* ==============================================
   HUD — Top bar, minimal
   ============================================== */

#hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #7a7060;
    font-size: 0.8rem;
    padding: 0.8rem 1.5rem;
    z-index: 20;
    background: linear-gradient(to bottom, rgba(10,10,8,0.6) 0%, transparent 100%);
}

#title-label {
    font-variant: small-caps;
    letter-spacing: 0.3em;
    color: #6b1c1c;
    font-size: 0.9rem;
    opacity: 0.6;
}

#inventory-display {
    font-style: italic;
}

.health-low {
    color: #6b1c1c !important;
}

/* ==============================================
   CONTROLS — Bottom-right, minimal
   ============================================== */

#controls {
    position: absolute;
    bottom: 12px;
    right: 16px;
    display: flex;
    gap: 0.8rem;
    z-index: 20;
    opacity: 0.4;
    transition: opacity 0.3s;
}

#controls:hover {
    opacity: 1;
}

#controls button {
    background: none;
    border: 1px solid #2a2520;
    color: #7a7060;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 0.7rem;
    padding: 0.3rem 0.8rem;
    cursor: pointer;
    transition: color 0.3s, border-color 0.3s;
}

#controls button:hover {
    color: #d4c5a9;
    border-color: #6b1c1c;
}

#controls button.music-active {
    color: #6b1c1c;
    border-color: #6b1c1c;
}
