:root {
    /* Cool & Neutral Tones */
    --bg-dark: #1B1F17;
    --panel-bg: #2C3028;
    --accent-green: #364831;
    --slate-grey: #5E6355;
    
    /* Warm Tones */
    --gold: #BCA362;
    --gold-dark: #897650;
    --red-muted: #A1504D;
    --brown-dark: #43362D;
    
    /* Text & Parchment */
    --parchment: #CECCB3;
    --parchment-dark: #A5A59E;

    --font-title: 'Cinzel Decorative', cursive;
    --font-body: 'IM Fell English SC', serif;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-dark);
    background-image: url('assets/bg-castle.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: var(--parchment);
    font-family: var(--font-body);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

#game-container {
    width: 100%;
    max-width: 600px;
    height: 80vh;
    position: relative;
    border: 2px solid var(--gold-dark);
    border-radius: 10px;
    background: rgba(44, 48, 40, 0.85); /* Slightly transparent --panel-bg */
    box-shadow: 0 0 30px rgba(188, 163, 98, 0.15); /* Soft gold glow */
    overflow: hidden;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease-in-out;
    padding: 20px;
    box-sizing: border-box;
}

.screen.active {
    opacity: 1;
    pointer-events: auto;
}

.screen.scroll {
    justify-content: flex-start;
    overflow-y: auto;
}

h1, h2, h3 {
    font-family: var(--font-title);
    color: var(--gold);
    margin-bottom: 20px;
}

h1.title {
    font-size: 3rem;
}

.glow-text {
    text-shadow: 0 0 10px var(--gold);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid transparent;
    border-top: 3px solid var(--gold);
    border-bottom: 3px solid var(--gold);
    border-radius: 50%;
    animation: spin 2s linear infinite;
    margin-top: 30px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.input-group {
    margin-bottom: 20px;
    width: 80%;
}

.input-group label {
    display: block;
    margin-bottom: 10px;
    font-size: 1.2rem;
}

input[type="text"], input[type="number"] {
    width: 100%;
    padding: 10px;
    background: rgba(27, 31, 23, 0.7); /* Based on bg-dark */
    border: 1px solid var(--slate-grey);
    color: var(--parchment);
    font-family: var(--font-body);
    font-size: 1.1rem;
    text-align: center;
    border-radius: 5px;
}

input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 10px rgba(188, 163, 98, 0.4);
}

.medieval-btn {
    background: linear-gradient(to bottom, var(--red-muted), var(--brown-dark));
    border: 2px solid var(--gold-dark);
    color: var(--parchment);
    font-family: var(--font-title);
    font-size: 1.2rem;
    padding: 10px 30px;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.3s ease;
    margin-top: 20px;
}

.medieval-btn:hover {
    background: linear-gradient(to bottom, #b5605d, var(--red-muted));
    box-shadow: 0 0 15px var(--gold);
    transform: scale(1.05);
    color: #ffffff;
}

.subtitle {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 20px;
}

/* Coin Animations */
.coin-container {
    perspective: 1000px;
    margin: 40px auto;
    width: 120px;
    height: 120px;
}

.coin {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 2s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.coin-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: var(--font-title);
    font-size: 1.5rem;
    font-weight: bold;
    border: 4px solid var(--gold);
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5), 0 0 15px var(--gold-dark);
}

.heads-face {
    background: url('assets/coin.png') no-repeat center center;
    background-size: cover;
    color: transparent; /* hide text since we have an image */
}

.tails-face {
    background: url('assets/coin.png') no-repeat center center;
    background-size: cover;
    filter: grayscale(100%);
    color: transparent;
    transform: rotateY(180deg);
}

.tossing {
    animation: toss 2s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}

@keyframes toss {
    0% {
        transform: rotateY(0deg) translateY(0);
    }
    50% {
        transform: rotateY(1800deg) translateY(-150px);
    }
    100% {
        transform: rotateY(3600deg) translateY(0);
    }
}

.hidden {
    display: none !important;
}

.final-score {
    background: rgba(27, 31, 23, 0.6);
    border: 1px solid var(--slate-grey);
    padding: 20px;
    margin: 20px 0;
    border-radius: 10px;
    font-size: 1.2rem;
}

.magician-note-container {
    background: url('https://www.transparenttextures.com/patterns/aged-paper.png'), var(--parchment);
    color: var(--bg-dark);
    padding: 20px;
    margin-top: 20px;
    border: 2px solid var(--gold-dark);
    border-radius: 5px;
    font-size: 1.1rem;
    line-height: 1.6;
    text-align: left;
    height: 150px;
    display: flex;
    flex-direction: column;
    box-shadow: inset 0 0 20px rgba(44, 48, 40, 0.4);
}

#magician-note {
    overflow-y: auto;
    flex-grow: 1;
    margin: 0;
    padding-right: 10px;
}

#note-loader {
    text-align: center;
    font-style: italic;
    color: var(--slate-grey);
    animation: pulse 1.5s infinite;
}


@keyframes pulse {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

/* --- Snowfall Effect --- */
.snow {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 1; /* Below the game container */
    background-image: 
        url('data:image/svg+xml;utf8,<svg width="400" height="400" viewBox="0 0 400 400" xmlns="http://www.w3.org/2000/svg"><circle cx="50" cy="50" r="2.5" fill="white" opacity="0.8"/><circle cx="250" cy="150" r="2" fill="white" opacity="0.6"/><circle cx="100" cy="300" r="3" fill="white" opacity="0.7"/><circle cx="350" cy="250" r="2.5" fill="white" opacity="0.5"/><circle cx="200" cy="350" r="1.5" fill="white" opacity="0.9"/></svg>'),
        url('data:image/svg+xml;utf8,<svg width="250" height="250" viewBox="0 0 250 250" xmlns="http://www.w3.org/2000/svg"><circle cx="20" cy="80" r="1.5" fill="white" opacity="0.5"/><circle cx="180" cy="30" r="1" fill="white" opacity="0.4"/><circle cx="90" cy="200" r="2" fill="white" opacity="0.6"/><circle cx="220" cy="180" r="1.5" fill="white" opacity="0.5"/><circle cx="130" cy="120" r="1" fill="white" opacity="0.7"/></svg>');
    animation: snow-fall 25s linear infinite;
}
@keyframes snow-fall {
    0% { background-position: 0px 0px, 0px 0px; }
    100% { background-position: 150px 800px, -100px 500px; }
}
