:root {
    --text-color: #d4b58e; /* parchment/wax color */
    --accent-red: #8b0000; /* Dark blood red / Gryffindor red */
    --bg-dark: #0a0610; /* Very dark moody purple/black */
    --twitch-purple: #9146FF;
}

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

body {
    background-color: var(--bg-dark);
    font-family: 'Playfair Display', serif;
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
    padding: 2rem;
    background-image: radial-gradient(circle at center, #1b102b 0%, #050308 100%);
}

/* Base magical/spooky background image to be added if generated */
body::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    /* We'll load the image if we had it, but mostly we rely on gradients and CSS */
    background: url('bg.png') no-repeat center center/cover;
    opacity: 0.15;
    z-index: -2;
}

h1, h2 {
    font-family: 'Cinzel', serif;
    text-shadow: 0 0 10px rgba(212, 181, 142, 0.3);
}

.candle-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.letter-container {
    background: rgba(20, 15, 25, 0.85);
    border: 1px solid #3d2a18;
    box-shadow: 0 0 40px rgba(0,0,0,0.8), inset 0 0 20px rgba(139, 0, 0, 0.1);
    max-width: 600px;
    width: 100%;
    padding: 3rem;
    position: relative;
    z-index: 10;
    border-radius: 4px;
    backdrop-filter: blur(5px);
    
    /* Parchment-like texture */
    background-image: 
        linear-gradient(to bottom, transparent, rgba(0,0,0,0.6)),
        url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="0.8" numOctaves="4" stitchTiles="stitch"/></filter><rect width="100" height="100" filter="url(%23noise)" opacity="0.05"/></svg>');
}

/* Wax Seal decoration */
.letter-container::before {
    content: '';
    position: absolute;
    top: -25px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: radial-gradient(circle at 30% 30%, #a00, var(--accent-red));
    border-radius: 50%;
    box-shadow: 2px 3px 5px rgba(0,0,0,0.5), inset -2px -2px 5px rgba(0,0,0,0.5);
    z-index: 11;
    /* Simulated "H" for Hogwarts or similar engraved look */
    display: flex;
    align-items: center;
    justify-content: center;
}

.wax-seal {
    position: absolute;
    top: -25px;
    right: 30px;
    width: 60px;
    height: 60px;
    z-index: 12;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Cinzel', serif;
    font-size: 24px;
    color: #4a0000;
    font-weight: bold;
    text-shadow: 1px 1px 1px rgba(255,100,100,0.3);
}
.wax-seal::after {
    content: 'H';
}

.letter-content {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeUp 2s 1s forwards ease-out;
}

@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.salutation {
    font-size: 2rem;
    color: #ffd700;
    margin-bottom: 1.5rem;
    letter-spacing: 2px;
}

p {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 1.5rem;
}

.highlight {
    color: var(--twitch-purple);
    font-weight: bold;
    text-shadow: 0 0 8px rgba(145, 70, 255, 0.6);
}

.twitch-reference {
    border-left: 3px solid var(--twitch-purple);
    padding-left: 1rem;
    margin: 2rem 0;
    background: linear-gradient(90deg, rgba(145, 70, 255, 0.1) 0%, transparent 100%);
}

.invitation-core {
    text-align: center;
    margin: 3rem 0;
    padding: 2rem;
    border: 1px solid var(--text-color);
    position: relative;
    background: rgba(0, 0, 0, 0.4);
}

.invitation-core h2 {
    color: var(--accent-red);
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.datetime {
    font-family: 'Cinzel', serif;
    font-size: 1.3rem;
    color: #fff;
    text-shadow: 0 0 5px #fff;
}

.date, .time {
    margin: 0.5rem 0;
    cursor: text;
    transition: 0.3s;
}

.date:hover, .time:hover {
    color: #ffd700;
    text-shadow: 0 0 10px #ffd700;
}

.game-reference {
    font-style: italic;
    color: #aaa;
}

.game-reference strong {
    color: #ff9718;
    font-style: normal;
}

.closing {
    margin-top: 3rem;
    text-align: right;
    font-size: 1.2rem;
}

/* Fog Animation */
.fog {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 300px;
    background: url('https://raw.githubusercontent.com/danielstuart14/CSS_FOG_ANIMATION/master/fog1.png') repeat-x;
    background-size: 200% auto;
    background-position: center bottom;
    z-index: 5;
    opacity: 0.3;
    animation: drift 60s linear infinite;
    pointer-events: none;
    mix-blend-mode: screen;
}

@keyframes drift {
    0% { background-position: 0 bottom; }
    100% { background-position: -200% bottom; }
}

/* Floating Candles */
.floating-candle {
    position: absolute;
    width: 15px;
    height: 40px;
    background: #e6dac3;
    border-radius: 3px;
    box-shadow: inset -2px 0 5px rgba(0,0,0,0.2);
    animation: float var(--float-dur) ease-in-out infinite alternate;
}

.flame {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 15px;
    background: #ffaa00;
    border-radius: 50% 50% 20% 20%;
    box-shadow: 0 0 15px 5px rgba(255, 170, 0, 0.6), 0 0 30px 10px rgba(255, 100, 0, 0.4);
    animation: flicker var(--flicker-dur) infinite alternate;
}

@keyframes flicker {
    0% { transform: translateX(-50%) scale(0.9); opacity: 0.8; }
    100% { transform: translateX(-50%) scale(1.1); opacity: 1; }
}

@keyframes float {
    0% { transform: translateY(0); }
    100% { transform: translateY(-20px); }
}

@media (max-width: 768px) {
    .letter-container {
        padding: 2rem;
    }
}
