@import url('https://fonts.googleapis.com/css2?family=New+Rocker&family=Cinzel:wght@400;700&display=swap');

:root {
    --bg-dark: #0f0c29;
    --parchment-bg: #eaddcf;
    --parchment-shadow: rgba(0, 0, 0, 0.5);
    --text-color: #2c2c2c;
    --header-font: 'New Rocker', cursive;
    --body-font: 'Cinzel', serif;
    --accent-color: #59191f; /* Blood red accent */
    --button-bg: #3e2723;
    --button-text: #eaddcf;
    --button-hover: #5d4037;
}

body {
    font-family: var(--body-font);
    background: url('/static/UI/background.avif') no-repeat center center fixed;
    background-size: cover;
    color: var(--text-color);
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    box-sizing: border-box;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--header-font);
    color: var(--button-text); /* Light text on dark bg for main headers */
    text-shadow: 2px 2px 4px #000;
    margin-bottom: 1rem;
}

h1 {
    font-size: 3rem;
    text-align: center;
    margin-bottom: 30px;
}

/* Utilities */
.text-center { text-align: center; }
.hidden { display: none !important; }
.text-danger { color: #8b0000; font-weight: bold; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.m-2 { margin: 0.5rem; }

.game-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Limit width for lobby screens to look good on wide screens */
.lobby-container {
    max-width: 600px;
    margin: 0 auto;
}

/* Top: Story Section */
.story-section {
    width: 100%;
    min-height: 150px;
    height: auto;
    /* Do NOT restrict height or overflow here to allow it to grow */
}

/* Bottom: Split Pane */
.bottom-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    /* Ensure items stretch to the tallest height */
    align-items: stretch;
}

.role-action-panel, .player-list-panel {
    /* Ensure they fill the grid cell height */
    height: 100%;
}

/* Parchment Box Component */
.parchment-box {
    background-color: var(--parchment-bg);
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.05'/%3E%3C/svg%3E");
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 10px 20px var(--parchment-shadow), inset 0 0 40px rgba(160, 82, 45, 0.1);
    border: 1px solid #d7c4b0;
    color: #3e2723;
    position: relative;
    box-sizing: border-box;
}

.parchment-box::before {
    content: '';
    position: absolute;
    top: 2px; left: 2px; right: 2px; bottom: 2px;
    border: 2px solid #3e2723;
    pointer-events: none;
    opacity: 0.3;
}

/* Specific Header Colors inside Parchment */
.parchment-box h2, .parchment-box h3, .parchment-box h4 {
    color: #3e2723;
    text-shadow: none;
    border-bottom: 2px solid #3e2723;
    padding-bottom: 5px;
}

/* Avatar Frame */
.avatar-frame {
    border: 8px ridge #5d4037;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    display: block;
    margin: 0 auto;
    max-width: 100%;
    height: auto;
    background-color: #000;
}

/* Buttons */
button {
    background-color: var(--button-bg);
    color: var(--button-text);
    border: 2px solid #2e1e1a;
    padding: 10px 20px;
    font-family: var(--body-font);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

button:hover {
    background-color: var(--button-hover);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

button:disabled {
    background-color: #555;
    color: #888;
    cursor: not-allowed;
    border-color: #444;
}

/* Secondary Buttons / Links */
button.btn-link, button.btn-secondary {
    background: transparent;
    border: none;
    color: #3e2723;
    text-decoration: underline;
    box-shadow: none;
    margin-top: 10px;
}

button.btn-link:hover, button.btn-secondary:hover {
    background: transparent;
    color: var(--accent-color);
    box-shadow: none;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: #3e2723;
}

input[type="text"], input[type="number"] {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 2px solid #3e2723;
    padding: 10px;
    font-family: var(--body-font);
    font-size: 1.2rem;
    color: #000;
    box-sizing: border-box;
    transition: border-color 0.3s;
}

input[type="text"]:focus, input[type="number"]:focus {
    outline: none;
    border-bottom-color: var(--accent-color);
}

input::placeholder {
    color: rgba(62, 39, 35, 0.5);
    font-style: italic;
}

/* Checkboxes */
.form-check {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #3e2723;
    cursor: pointer;
}

/* Lists (Players/Team) */
ul {
    list-style-type: none;
    padding: 0;
}

li {
    padding: 8px;
    border-bottom: 1px solid rgba(62, 39, 35, 0.2);
}

li:last-child {
    border-bottom: none;
}

li.disabled {
    text-decoration: line-through;
    color: #888;
}

/* Lobby Room Code */
.room-code-display {
    border: 2px dashed #3e2723;
    padding: 10px;
    margin: 10px 0;
    background: rgba(62, 39, 35, 0.1);
    font-size: 1.5rem;
    font-family: var(--body-font);
}

/* Story Text */
#game-intro {
    font-size: 1.1rem;
    line-height: 1.6;
    text-align: justify;
    /* No overflow or fixed height */
}

#game-intro strong {
    color: var(--accent-color);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .bottom-section {
        grid-template-columns: 1fr; /* Stack vertically */
    }

    h1 {
        font-size: 2rem;
    }
}
