:root {
    /* Light Mode Defaults */
    --bg-color: #f4f4f9;
    --card-bg: #ffffff;
    --text-color: #333333;
    --heading-color: #000000;
    --subtext-color: #666666;
    --border-color: #dddddd;
    --input-bg: #ffffff;
    --input-border: #dddddd;
    --drawer-bg: #ffffff;
    --hover-bg: #f0f0f0;
    --accent-color: #002244;
    --nav-active-bg: #002244;
    --nav-active-text: #ffffff;
    --shadow-color: rgba(0,0,0,0.1);
    --locked-bg: #f0f0f0;
}

[data-theme="dark"] {
    /* Dark Mode Overrides */
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-color: #e0e0e0;
    --heading-color: #ffffff;
    --subtext-color: #aaaaaa;
    --border-color: #444444;
    --input-bg: #2d2d2d;
    --input-border: #444444;
    --drawer-bg: #1e1e1e;
    --hover-bg: #333333;
    --accent-color: #90caf9;
    --nav-active-bg: #64b5f6;
    --nav-active-text: #000000;
    --shadow-color: rgba(0,0,0,0.5);
    --locked-bg: #2a2a2a;
}

/* --- Mobile "App-Like" Standards --- */
html, body {
    /* Stop the "Rubber Band" bounce effect */
    overscroll-behavior-y: none;
    /* Disable double-tap to zoom */
    touch-action: manipulation;
    /* Ensure fonts don't auto-scale */
    -webkit-text-size-adjust: 100%;
}

/* Prevent iOS zooming in when you tap a text box */
input, select, textarea {
    font-size: 16px !important; 
}

/* Remove the grey "highlight box" when tapping buttons on iOS */
* {
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
    padding-bottom: 40px !important; /* Standard padding, no longer needs to clear a fixed footer */
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: background-color 0.3s, color 0.3s;
}

h1 { margin-bottom: 20px; color: var(--heading-color); }
h2, h3, strong { color: var(--heading-color); }

/* --- Login Form --- */
.login-container {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px var(--shadow-color);
    text-align: center;
    max-width: 400px;
    width: 100%;
}

input {
    padding: 10px;
    margin: 10px 0;
    width: 80%;
    border: 1px solid var(--input-border);
    border-radius: 4px;
    background-color: var(--input-bg);
    color: var(--text-color);
}

button.login-btn {
    background-color: #333;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
}

/* --- Game Grid --- */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    width: 100%;
    max-width: 1200px;
}

.question-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 4px var(--shadow-color);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.2s ease;
    height: 100%; /* Forces card to fill the grid cell height */
    box-sizing: border-box;
}

.question-card.locked-bg {
    background-color: var(--locked-bg);
    border: 1px solid var(--border-color);
}

.category-badge {
    background-color: var(--hover-bg);
    color: var(--subtext-color);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    align-self: flex-start;
    margin-bottom: 10px;
    text-transform: uppercase;
    font-weight: bold;
}

.question-text {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--heading-color);
}

.options-container {
    display: flex;
    gap: 10px;
    flex-wrap: wrap; /* Allows buttons to stack if they don't fit */
}

/* --- Radio Button Styling --- */
.option-label {
    flex: 1 1 auto;
    min-width: 80px;
    cursor: pointer;
    position: relative;
}

.option-label input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.option-box {
    display: block;
    padding: 15px 10px;
    text-align: center;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-weight: bold;
    transition: all 0.2s;
    background-color: var(--card-bg);
    color: var(--subtext-color);
    position: relative;
    overflow: hidden;
}

.option-box.locked {
    background-color: var(--locked-bg) !important;
    border-color: var(--border-color) !important;
    color: var(--subtext-color) !important;
    cursor: not-allowed;
    pointer-events: none;
}
.option-box.resolved-correct {
    background-color: rgba(40, 167, 69, 0.2) !important; /* Semi-transparent green */
    border-color: #28a745 !important;
    color: #28a745 !important;
    box-shadow: 0 0 10px rgba(40, 167, 69, 0.5);
}
.option-box.resolved-correct::after {
    content: "✓";
    position: absolute;
    top: 5px; right: 5px; color: #28a745; font-size: 1rem;
}
.option-box.resolved-wrong {
    background-color: rgba(220, 53, 69, 0.1) !important;
    border-color: #dc3545 !important;
    color: #dc3545 !important;
    opacity: 0.8;
}

/* --- HERO OPTION STYLES (Teams / Coins) --- */
.hero-box {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    border-width: 2px;
    border-style: solid;
    color: white !important;
    /* Default state: slightly dimmed background */
    opacity: 0.6; 
    filter: grayscale(30%);
    transition: all 0.2s ease-in-out;
}

/* Selected Hero State */
.option-label input[type="radio"]:checked + .hero-box {
    opacity: 1;
    filter: grayscale(0%);
    box-shadow: 0 0 15px rgba(0,0,0,0.3);
    transform: scale(1.02);
}

.team-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.3));
}

/* --- DUAL SCOREBOARD STYLE --- */
.scoreboard-container {
    grid-column: 1 / -1; /* Stretch across the grid */
    background: linear-gradient(180deg, #2b2b2b 0%, #1a1a1a 100%);
    border: 1px solid #444;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    color: white;
    box-shadow: 0 6px 12px rgba(0,0,0,0.4);
    position: relative;
    overflow: hidden;
    margin-bottom: 20px;
}

/* Glossy reflection */
.scoreboard-container::before {
    content: "";
    position: absolute; top: 0; left: 0; right: 0; height: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0) 100%);
    pointer-events: none;
}

.scoreboard-half {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 120px;
    z-index: 1;
}

.sb-logo {
    width: 80px; height: 80px; object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.6));
}

.sb-input {
    background: black;
    color: #f0ad4e; /* Scoreboard LED Yellow */
    border: 2px solid #333;
    border-radius: 6px;
    width: 80px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 2.5rem;
    font-weight: bold;
    text-align: center;
    padding: 10px 0;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.8);
}
.sb-input:focus {
    outline: none; border-color: #f0ad4e;
    box-shadow: 0 0 15px rgba(240, 173, 78, 0.4);
}

.sb-divider {
    font-size: 2rem;
    font-weight: bold;
    color: #666;
    margin: 0 10px;
    z-index: 1;
}

.sb-team-name {
    font-size: 0.9rem;
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 1px;
    color: #ccc;
}

.missing-pick {
    border: 2px solid #dc3545 !important; /* Force red border */
    box-shadow: 0 0 10px rgba(220, 53, 69, 0.3) !important;
    animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
  40%, 60% { transform: translate3d(4px, 0, 0); }
}

#validation-feedback {
    transition: all 0.3s ease;
}

/* --- Static Validate Button (Bottom of Content) --- */
.validate-bar {
    position: static !important; /* Inline flow, not fixed */
    width: 100%;
    max-width: 800px;
    margin: 30px auto 10px auto;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    text-align: center;
    z-index: 1;
}

.btn-validate {
    width: 100%; 
    max-width: 400px;
    padding: 15px 0;
    font-size: 1.1rem;
    font-weight: bold;
    color: white;
    background: #002244;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    display: inline-block;
    transition: transform 0.2s;
}
.btn-validate:active { transform: scale(0.95); }


@media (max-width: 600px) {
    body {
        padding: 10px;
        padding-bottom: 40px !important;
    }

    .grid-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .question-card {
        padding: 15px;
    }

    .scoreboard-container {
        padding: 15px 5px;
        gap: 5px;
    }

    .scoreboard-half {
        width: auto;
        flex: 1;
    }

    .sb-logo {
        width: 50px;
        height: 50px;
    }

    .sb-input {
        width: 60px;
        font-size: 1.8rem;
        padding: 5px 0;
    }

    .sb-divider {
        font-size: 1.5rem;
        margin: 0 5px;
    }

    .option-box {
        padding: 12px 5px;
        font-size: 0.95rem;
    }

    .login-container {
        padding: 1.5rem;
        width: 100%;
        box-sizing: border-box;
    }

    /* Mobile Validate Bar */
    .validate-bar {
        padding: 0 !important;
        margin-top: 20px;
    }
    .btn-validate {
        width: 100%;
        max-width: 100%;
        border-radius: 8px !important;
    }
}