/* Global Styles */
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@300..700&family=Poppins:wght@300;400;600&display=swap');

:root {
    --bg-color: #f4f4f9;
    --text-color: #333;
    --card-bg: #ffffff;
    --header-bg: #2c3e50;
    --header-text: #ffffff;
    --primary-color: #3498db;
    --secondary-color: #2ecc71;
    --border-color: #ddd;
    --input-bg: #ffffff;
    --shadow-color: rgba(0,0,0,0.1);
}

body.dark-mode {
    --bg-color: #1a1a1a;
    --text-color: #f0f0f0;
    --card-bg: #2d2d2d;
    --header-bg: #000000;
    --header-text: #f0f0f0;
    --primary-color: #5dade2;
    --secondary-color: #58d68d;
    --border-color: #444;
    --input-bg: #333;
    --shadow-color: rgba(0,0,0,0.5);
}

body {
    font-family: 'Poppins', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    margin: 0;
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
}

h1, h2, h3, .btn-primary, .option-btn, .status-bar {
    font-family: 'Fredoka', sans-serif;
    margin-bottom: 1rem;
    color: var(--text-color);
}

button {
    cursor: pointer;
    transition: opacity 0.2s, background-color 0.2s;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

/* Container & Layout */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px var(--shadow-color);
    color: var(--text-color);
}

/* Forms */
input[type="text"], input[type="password"], input[type="email"], input[type="number"], select, textarea {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 16px;
    background-color: var(--input-bg);
    color: var(--text-color);
}

/* Header Class (to replace inline styles) */
.main-header {
    background-color: var(--header-bg);
    color: var(--header-text);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.main-header a {
    color: var(--header-text);
}


.btn-primary {
    width: 100%;
    padding: 12px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: bold;
}

.btn-primary:hover {
    background-color: #0056b3;
}

.error-msg {
    color: #dc3545;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
    display: none;
}

/* Game Play */
.status-bar {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    font-weight: bold;
    color: #555;
    background: white;
    padding: 10px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 20px;
}

.option-btn {
    padding: 25px;
    font-size: 18px;
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: bold;
    box-shadow: 0 4px 0 rgba(0,0,0,0.2);
}

.option-btn:active {
    transform: translateY(4px);
    box-shadow: none;
}

.btn-a { background-color: #e21b3c; }
.btn-b { background-color: #1368ce; }
.btn-c { background-color: #d89e00; }
.btn-d { background-color: #26890c; }

/* Host Dashboard Specific */
.host-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 300px;
    background: #2c3e50;
    color: white;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.main-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    background: #ecf0f1;
}

.pin-box {
    background: white;
    color: #333;
    padding: 15px;
    text-align: center;
    border-radius: 8px;
}

.pin-code {
    font-size: 36px;
    font-weight: 800;
    letter-spacing: 4px;
    display: block;
}

.player-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.player-card {
    background: white;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-bottom: 4px solid transparent;
}

.player-card.active { border-bottom-color: #2ecc71; }
.player-card.inactive { border-bottom-color: #e74c3c; opacity: 0.7; }

.status-dot {
    height: 10px;
    width: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
}
.dot-active { background-color: #2ecc71; }
.dot-inactive { background-color: #e74c3c; }

/* Scoreboard Enhancements */
.scoreboard-podium {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    height: 300px;
    margin-bottom: 30px;
}

.podium-place {
    width: 100px;
    text-align: center;
    color: white;
    font-weight: bold;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    margin: 0 10px;
    position: relative;
}

.podium-bar {
    width: 100%;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
}

.place-1 .podium-bar { height: 200px; background: #f1c40f; /* Gold */ font-size: 2em; }
.place-2 .podium-bar { height: 150px; background: #bdc3c7; /* Silver */ font-size: 1.5em; }
.place-3 .podium-bar { height: 100px; background: #cd7f32; /* Bronze */ font-size: 1.2em; }

.podium-name {
    margin-bottom: 10px;
    font-weight: bold;
    color: #333;
}

.podium-score {
    font-size: 0.8em;
    opacity: 0.9;
}

/* Animation */
@keyframes popUp {
    from { transform: scaleY(0); }
    to { transform: scaleY(1); }
}

.podium-bar {
    transform-origin: bottom;
    animation: popUp 0.5s ease-out forwards;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .host-container {
        flex-direction: column;
        height: auto;
        overflow: visible;
    }

    .sidebar {
        width: 100%;
        box-sizing: border-box;
        padding: 15px;
    }

    .main-content {
        padding: 15px;
    }

    .options-grid {
        grid-template-columns: 1fr; /* Stack buttons on mobile */
        gap: 10px;
    }

    .option-btn {
        padding: 20px;
        font-size: 16px;
    }

    .scoreboard-podium {
        height: auto;
        min-height: 200px;
    }
    
    .podium-place {
        width: 30%;
        margin: 0 1%;
    }

    .container {
        padding: 10px;
    }

    .card {
        padding: 1.5rem;
    }
    
    /* Adjust font sizes */
    h1 { font-size: 1.5em; }
    h2 { font-size: 1.3em; }
    
    /* Hide less important elements if needed */
    .hide-mobile { display: none; }
}


/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.card {
    animation: fadeIn 0.5s ease-out;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.1);
}

.btn-primary:active, .option-btn:active {
    transform: scale(0.98);
}

/* iOS Safari Fix: Explicit hidden class */
.hidden {
    display: none !important;
    visibility: hidden !important;
}
