@import url('https://fonts.googleapis.com/css2?family=Gochi+Hand&family=Great+Vibes&family=Mountains+of+Christmas:wght@400;700&display=swap');

* {
    touch-action: manipulation;
}

:root {
    font-size: 20px;
    --primary: #D62828;
    /* Modern Red */
    --primary-dark: #ad1d1d;
    --secondary: #2F3E46;
    /* Slate */
    --accent: #EAE2B7;
    /* Soft Gold/Beige */
    --bg: #FAFAFA;
    --surface: #FFFFFF;
    --text: #1a1a1a;
    --text-muted: #666;
    --border: #e0e0e0;
    --radius: 12px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}



* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: "Gochi Hand", serif;
    -webkit-font-smoothing: antialiased;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

body {
    background-color: var(--bg);
    color: var(--text);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.app-container {
    width: 100%;
    /* max-width removed for fullscreen */
    background: var(--surface);
    min-height: 100vh;
    display: flex;
    display: flex;
    flex-direction: column;
}

.flag-icon {
    height: 24px;
    width: auto;
    vertical-align: middle;
    margin-right: 8px;
}

/* ... existing mobile styles ... */

@media (min-width: 768px) {

    /* Simple Fullscreen Desktop */
    body {
        background-color: var(--bg);
    }

    .app-container {
        max-width: 100%;
        min-height: 100vh;
        height: auto;
        border-radius: 0;
        box-shadow: none;
    }

    /* Better Layout for Desktop */
    main {
        padding: 3rem;
        max-width: 900px;
        margin: 0 auto;
        width: 100%;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 2.2rem;
    }

    .question-text {
        font-size: 2.5rem;
    }

    /* Responsive Grids */
    .vote-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }

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

    .player-item {
        border: 1px solid var(--border);
        border-radius: var(--radius);
        padding: 15px;
        flex-direction: column;
        text-align: center;
        background: var(--bg);
        transition: transform 0.2s;
    }

    .player-item:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    }

    .player-item span {
        margin-bottom: 5px;
    }

    .player-role {
        margin-left: 0;
        margin-top: 5px;
    }

    /* Podium Desktop */
    .podium-container {
        height: 350px;
        gap: 40px;
    }

    .podium-item {
        width: 120px;
    }

    .rank-1 .podium-block {
        height: 180px;
    }

    .rank-2 .podium-block {
        height: 130px;
    }

    .rank-3 .podium-block {
        height: 90px;
    }

    .podium-avatar {
        font-size: 5rem;
    }

    .rank-1 .podium-avatar {
        font-size: 6rem;
    }
}

/* Header */
header {
    background: var(--surface);
    padding: 1.5rem;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.site-logo {
    height: 2.5em;
    width: auto;
    object-fit: contain;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--primary);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: rgba(214, 40, 40, 0.1);
}

.score-pill {
    background: #fff;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-right: auto;
    /* push to left if in flex */
    margin-left: 1rem;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Content */
main {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
}

.screen {
    display: none;
    flex-direction: column;
    height: 100%;
    animation: fadeScale 0.3s ease-out;
}

.screen.active {
    display: flex;
}

@keyframes fadeScale {
    from {
        opacity: 0;
        transform: scale(0.98);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 1.5rem;
    letter-spacing: -0.5px;
}

p {
    line-height: 1.6;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* Screen Home */
#screen-home {
    justify-content: center;
    text-align: center;
}

#screen-home h2 {
    font-size: 2rem;
    color: var(--primary);
}

/* Inputs */
.form-group {
    margin-bottom: 1.25rem;
    width: 100%;
}

.avatar-grid {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
    /* Fix: Allow wrapping for secret avatars */
}

.avatar-btn {
    font-size: 1.8rem;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
}

.avatar-btn:hover {
    background: var(--surface);
    transform: scale(1.1);
}

.avatar-btn.selected {
    border-color: var(--primary);
    background: #fff0f0;
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text);
}

input,
select {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    background: var(--bg);
    color: var(--text);
    transition: all 0.2s;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(214, 40, 40, 0.1);
}

/* Fix for checkboxes */
input[type="checkbox"] {
    width: 24px;
    height: 24px;
    padding: 0;
    margin: 0;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: var(--primary);
    /* Modern browser support */
}

/* Buttons */
.btn {
    background-color: var(--text);
    color: white;
    border: none;
    padding: 16px;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: transform 0.1s, opacity 0.2s;
    margin-top: 1rem;
}

.btn:active {
    transform: scale(0.98);
}

.btn:hover {
    opacity: 0.9;
}

#btn-create-lobby,
#btn-start-game,
#btn-confirm-join {
    background-color: var(--primary);
}

.btn-secondary {
    background-color: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-secondary:hover {
    background-color: var(--bg);
}

/* Lobby List */
#lobby-code-display {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: 2px;
    margin: 1rem 0;
    color: var(--primary);
    background: rgba(214, 40, 40, 0.05);
    padding: 1rem;
    border-radius: var(--radius);
    text-align: center;
}

.player-list {
    list-style: none;
    width: 100%;
    margin-top: 1rem;
}

.player-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-weight: 500;
}

.player-item:last-child {
    border-bottom: none;
}

.player-role {
    font-size: 0.75rem;
    background: var(--secondary);
    color: white;
    padding: 4px 8px;
    border-radius: 99px;
    margin-left: auto;
    font-weight: 600;
    text-transform: uppercase;
}

/* Game Card */
.question-card {
    margin-top: auto;
    margin-bottom: auto;
    text-align: center;
    padding: 2rem 0;
}

.question-text {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
    letter-spacing: -0.5px;
}

.timer {
    font-size: 4rem;
    font-weight: 800;
    color: var(--primary);
    text-align: center;
    font-variant-numeric: tabular-nums;
    margin-bottom: 1rem;
}

/* Vote Grid */
.vote-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    width: 100%;
    margin-top: auto;
}

.vote-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 16px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.vote-btn:hover {
    border-color: var(--text-muted);
}

.vote-btn.selected {
    background-color: var(--secondary);
    color: white;
    border-color: var(--secondary);
    box-shadow: 0 4px 12px rgba(47, 62, 70, 0.2);
}

/* Results */
.winner-card {
    text-align: center;
    padding: 2rem 0;
}

.winner-name {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary);
    margin: 0.5rem 0;
}

.score-item {
    display: flex;
    justify-content: space-between;
    padding: 16px;
    background: var(--bg);
    border-radius: var(--radius);
    margin-bottom: 8px;
    font-weight: 500;
}

.score-item span:last-child {
    font-weight: 700;
    color: var(--primary);
}

/* Helper */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-4 {
    margin-top: 2rem;
}

/* Footer */
.app-footer {
    padding: 1rem;
    text-align: center;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.app-footer p {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 0;
}

/* Info Button */
.btn-info {
    background: none;
    border: none;
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.btn-info:hover {
    opacity: 1;
    text-decoration: underline;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s;
}

.modal-content {
    background: var(--surface);
    padding: 2rem;
    border-radius: var(--radius);
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    animation: floatUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-content h3 {
    color: var(--primary);
    margin-bottom: 1rem;
}

.modal-content ul {
    text-align: left;
    margin-bottom: 2rem;
    list-style: none;
}

.modal-content li {
    margin-bottom: 0.8rem;
    color: var(--text);
    font-size: 0.95rem;
}

@keyframes floatUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

.video-container {
    position: relative;
    padding-bottom: 56.25%;
    /* 16:9 */
    height: 0;
    overflow: hidden;
    border-radius: 8px;
    background: #000;
    margin-bottom: 1rem;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.countdown-badge {
    display: inline-block;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    margin-bottom: 1.5rem;
    background: rgba(0, 0, 0, 0.03);
    padding: 6px 12px;
    padding: 6px 12px;
    border-radius: 6px;
}

/* Grinch Mode */
.grinch-mode {
    background-color: #eafbea !important;
    /* Light green bg */
    border: 2px solid #2ecc71;
}

.grinch-mode .question-text {
    color: #1e8449 !important;
    /* Dark Green */
}

.grinch-mode h2,
.grinch-mode .timer {
    color: #27ae60 !important;
}

.grinch-badge {
    background: #2ecc71;
    color: white;
    padding: 4px 12px;
    border-radius: 99px;
    font-weight: bold;
    display: inline-block;
    margin-bottom: 0.5rem;
    animation: shake 0.5s infinite alternate;
}

@keyframes shake {
    from {
        transform: rotate(-5deg);
    }

    to {
        transform: rotate(5deg);
    }
}

/* Podium Styles */
.podium-container {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 15px;
    margin-bottom: 2rem;
    height: 220px;
    /* Fixed height for structure */
}

.podium-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 80px;
    position: relative;
    animation: slideUp 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    opacity: 0;
}

/* Animations delays */
.podium-item.rank-1 {
    animation-delay: 0.6s;
    order: 2;
    /* Center */
}

.podium-item.rank-2 {
    animation-delay: 0.4s;
    order: 1;
    /* Left */
}

.podium-item.rank-3 {
    animation-delay: 0.2s;
    order: 3;
    /* Right */
}

.podium-avatar {
    font-size: 3rem;
    margin-bottom: 5px;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

.podium-block {
    width: 100%;
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 8px 8px 0 0;
    color: white;
    font-weight: 800;
    display: flex;
    justify-content: center;
    padding-top: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    position: relative;
}

.rank-1 .podium-avatar {
    font-size: 4rem;
}

.rank-1 .podium-block {
    height: 120px;
    background: linear-gradient(180deg, #f1c40f 0%, #b7950b 100%);
    /* Gold */
}

.rank-2 .podium-block {
    height: 85px;
    background: linear-gradient(180deg, #bdc3c7 0%, #7f8c8d 100%);
    /* Silver */
}

.rank-3 .podium-block {
    height: 60px;
    background: linear-gradient(180deg, #e67e22 0%, #d35400 100%);
    /* Bronze */
}

.podium-rank {
    font-size: 2rem;
    opacity: 0.5;
}

.podium-name {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
    text-align: center;
}

.podium-score {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: bold;
    margin-bottom: 2px;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

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

/* Easter Egg: Grinch Walk */
#grinch-overlay {
    pointer-events: none;
    /* Let clicks pass through */
}

.grinch-walk {
    animation: walkAcross 4s linear forwards;
}

@keyframes walkAcross {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-300vw);
        /* Move fully left off screen */
    }
}

/* Easter Egg List */
.easter-egg-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
    text-align: left;
}

.egg-item {
    padding: 10px;
    border: 1px solid var(--border);
    margin-bottom: 8px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0.5;
    background: #f5f5f5;
    transition: all 0.3s;
}

.egg-item.unlocked {
    opacity: 1;
    background: #fff;
    border-color: #ffd700;
    box-shadow: 0 4px 10px rgba(255, 215, 0, 0.2);
}

.egg-icon {
    font-size: 1.5rem;
}

.egg-info h4 {
    margin: 0;
    font-size: 1rem;
    color: var(--text);
}

.egg-info p {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: #ffffff;
    color: #000000;
    padding: 12px 24px;
    border-radius: 99px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    animation: slideDownFade 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: auto;
    max-width: 90vw;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.hunter-title {
    font-size: 0.75rem;
    color: #e74c3c;
    background: #fadbd8;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
    font-weight: 700;
    vertical-align: middle;
    display: inline-block;
}

.toast.fade-out {
    animation: fadeOutUp 0.5s forwards;
}

@keyframes slideDownFade {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

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

@keyframes fadeOutUp {
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* Fix for Xmas 2024 Song Modal Size */
#modal-xmas2024 .modal-content {
    max-width: 450px;
    width: 95%;
    padding: 1.5rem 1rem;
    max-height: 85vh;
    overflow-y: auto;
}

#modal-xmas2024 .video-container {
    margin-bottom: 0.5rem;
}