/* Import 8-bit style font */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

/* Global Retro 8-bit Theme */
body {
    font-family: 'Press Start 2P', cursive;
    margin: 0;
    background-color: #000000;
    color: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    line-height: 1.6;
}

/* Welcome Screen & Arcade Cabinet Styles */
.arcade-cabinet {
    width: 100%;
    max-width: 800px;
    background-color: #220033;
    border: 6px solid #ffcc00;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 0 20px rgba(255, 204, 0, 0.7), 
                inset 0 0 15px rgba(255, 204, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    margin: 0 auto;
}

.arcade-cabinet::before {
    content: '';
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 15px;
    background-color: #ffcc00;
    border-radius: 8px 8px 0 0;
}

.cabinet-screen {
    background-color: #000022;
    border: 8px solid #333;
    border-radius: 6px;
    padding: 40px;
    width: 100%;
    text-align: center;
    margin-bottom: 30px;
    position: relative;
    box-shadow: 0 0 10px rgba(0, 0, 255, 0.5), 
                inset 0 0 8px rgba(0, 0, 255, 0.3);
    overflow: hidden;
}

.cabinet-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(to right, 
        rgba(255,255,255,0.2), 
        rgba(255,255,255,0.8), 
        rgba(255,255,255,0.2));
    border-radius: 3px;
}

.cabinet-controls {
    display: flex;
    justify-content: space-around;
    width: 100%;
    margin: 0 auto 20px;
}

.joystick {
    width: 40px;
    height: 40px;
    background-color: #ff3300;
    border-radius: 50%;
    position: relative;
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.7);
}

.joystick::after {
    content: '';
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 30px;
    background-color: #000;
    border-left: 2px solid #ff3300;
    border-right: 2px solid #ff3300;
}

.arcade-text {
    color: #00ff00;
    font-size: 1.8em;
    margin: 40px 0;
    text-shadow: 0 0 8px rgba(0, 255, 0, 0.7);
    animation: pulse 1.5s infinite alternate;
}

.smaller-text {
    color: #00ccff;
    font-size: 0.9em;
    margin-top: 30px;
}

.blink-text {
    color: #ffcc00;
    font-size: 2.5em;
    text-transform: uppercase;
    margin-bottom: 30px;
    text-shadow: 0 0 10px rgba(255, 204, 0, 0.8);
    animation: blink 1s infinite alternate;
}

.pixel-character {
    width: 80px;
    height: 80px;
    margin: 20px auto;
    background-image: 
        linear-gradient(to right, transparent 33%, #000022 33%, #000022 66%, transparent 66%),
        linear-gradient(to bottom, #00ff00 25%, #ffcc00 25%, #ffcc00 75%, #ff3300 75%);
    position: relative;
    animation: bounce 2s infinite alternate;
}

.pixel-character::before {
    content: "";
    position: absolute;
    top: -20px;
    left: 15px;
    width: 50px;
    height: 20px;
    background-color: #ffffff;
    clip-path: polygon(0% 100%, 33% 0%, 66% 0%, 100% 100%);
}

.arcade-button {
    padding: 15px 40px;
    background-color: #ff3300;
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 1.5em;
    margin-top: 10px;
    cursor: pointer;
    font-family: 'Press Start 2P', cursive;
    box-shadow: 0 8px 0 #aa2200, 
                0 0 20px rgba(255, 51, 0, 0.6);
    position: relative;
    transition: all 0.1s;
    text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5);
}

.arcade-button:hover {
    transform: translateY(2px);
    box-shadow: 0 6px 0 #aa2200, 
                0 0 25px rgba(255, 51, 0, 0.8);
}

.arcade-button:active {
    transform: translateY(8px);
    box-shadow: 0 0 0 #aa2200, 
                0 0 30px rgba(255, 51, 0, 1);
}

/* Coin slot decoration */
.coin-slot {
    position: absolute;
    right: 20px;
    bottom: 80px;
    width: 30px;
    height: 5px;
    background-color: #333;
    border: 2px solid #666;
    border-radius: 2px;
}

.coin-slot::before {
    content: "INSERT COIN";
    position: absolute;
    top: -25px;
    left: -30px;
    font-size: 0.6em;
    color: #ffcc00;
}

/* Arcade cabinet speakers */
.speakers {
    position: absolute;
    bottom: 30px;
    left: 30px;
    display: flex;
    gap: 10px;
}

.speaker {
    width: 40px;
    height: 40px;
    background-color: #333;
    border-radius: 50%;
    display: grid;
    grid-template: repeat(3, 1fr) / repeat(3, 1fr);
    padding: 5px;
}

.speaker-hole {
    background-color: #111;
    border-radius: 50%;
    margin: 2px;
}

@keyframes blink {
    0% { opacity: 1; }
    40% { opacity: 1; }
    60% { opacity: 0.8; }
    100% { opacity: 1; }
}

@keyframes pulse {
    from { transform: scale(1); }
    to { transform: scale(1.05); }
}

@keyframes bounce {
    from { transform: translateY(0); }
    to { transform: translateY(-10px); }
}

/* Scanlines effect for the cabinet screen */
.cabinet-screen::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15),
        rgba(0, 0, 0, 0.15) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
}

.tv-container, .mobile-container {
    background-color: #000000;
    padding: 20px 40px;
    border-radius: 8px;
    border: 4px solid #00ff00;
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.5);
    text-align: center;
    max-width: 90%;
    width: 1200px; /* Adjust for TV */
}
.tv-container {
    min-height: 600px; /* Ensure TV view is large */
    display: flex;
    flex-direction: column;
}
.mobile-container {
    width: 400px; /* Adjust for phones */
    max-width: 95%;
}

header {
    border-bottom: 1px solid #00ff00;
    padding-bottom: 15px;
    margin-bottom: 20px;
    position: relative;
}
header h1 {
    margin: 0;
    color: #00ff00;
    font-size: 2.5em;
    text-transform: uppercase;
    text-shadow: 4px 4px 0px #00aa00;
    letter-spacing: 2px;
}
.control-button {
    position: absolute;
    top: 10px;
    padding: 12px 20px;
    background-color: #440000;
    color: white;
    border: 2px solid #ff0000;
    border-radius: 0;
    cursor: pointer;
    font-size: 0.9em;
    font-family: 'Press Start 2P', cursive;
    text-transform: uppercase;
}
#home-button, #home-button-host, #leave-button-player { left: 10px; background-color: #000044; border-color: #0000ff;}
#restart-button { right: 10px; background-color: #444400; border-color: #ffff00; color: white;}

main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.center-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
}

h2 {
    color: #ffff00;
    font-size: 1.8em;
    margin-bottom: 20px;
    text-shadow: 3px 3px 0px #aa7700;
}

h3 {
    color: #00ffff;
    font-size: 1.4em;
    margin-bottom: 15px;
    text-shadow: 2px 2px 0px #007777;
}

input, select {
    background-color: #000000;
    border: 2px solid #00ff00;
    color: #00ff00;
    padding: 12px;
    font-size: 1.2em;
    margin-bottom: 15px;
    width: 100%;
    font-family: 'Press Start 2P', cursive;
    border-radius: 0;
}

button {
    background-color: #000088;
    color: white;
    border: 2px solid #0000ff;
    padding: 15px 30px;
    margin: 10px 0;
    font-size: 1.2em;
    cursor: pointer;
    font-family: 'Press Start 2P', cursive;
    text-transform: uppercase;
    border-radius: 0;
    transition: all 0.2s;
}

button:hover {
    background-color: #0000ff;
    transform: scale(1.05);
}

#host-qr-code, #player-qr-code {
    margin: 20px auto;
    width: 256px; /* Standard QR size */
    height: 256px;
    border: 4px solid #00ff00;
    display: flex; /* For potential placeholder/loading */
    justify-content: center;
    align-items: center;
    image-rendering: pixelated;
}
#host-qr-code img, #player-qr-code img {
    display: block;
    width: 100%;
    height: 100%;
}

/* Lobby */
.lobby-flex {
    display: flex;
    justify-content: space-around;
    align-items: flex-start;
    width: 100%;
    margin-top: 30px;
}
.qr-join, .player-list {
    flex-basis: 45%;
}
#player-list-display {
    list-style: none;
    padding: 0;
    text-align: left;
    max-height: 300px;
    overflow-y: auto;
}
#player-list-display li {
    background-color: #000088;
    margin-bottom: 10px;
    padding: 12px 15px;
    border: 2px solid #0000ff;
    font-size: 1.1em;
}
#player-list-display li .player-name { font-weight: bold; }
#player-list-display li .player-status { font-size: 0.8em; color: #00ffff; margin-left: 10px; }

/* Question Section */
#question-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 20px;
    margin: 0;
    height: 100%;
    overflow-y: auto;
}

#question-header {
    margin-bottom: 10px;
}

#question-intro-text {
    margin: 10px 0;
}

#question-text {
    margin: 10px 0 20px 0;
}

#answer-options {
    margin-top: 10px;
}

.question-counter {
    font-size: 1.3em;
    color: #ffff00;
    margin-bottom: 20px;
}

.question-intro {
    font-size: 1.2em;
    color: #00ffff;
    margin-bottom: 20px;
}

#question-text {
    font-size: 1.6em;
    color: #ffffff;
    margin-bottom: 30px;
    line-height: 1.6;
    text-shadow: 2px 2px 0px #444444;
}

/* Answer Buttons */
#answer-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 30px;
}

.answer-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 30px;
    width: 100%;
}

.answer-options button, 
.answer-button {
    padding: 15px 25px;
    font-size: 1.3em;
    background-color: #000088;
    border: 3px solid #0000ff;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    font-family: 'Press Start 2P', cursive;
    text-transform: uppercase;
    border-radius: 0;
    width: 100%;
}

.answer-options button:hover,
.answer-button:hover {
    background-color: #0000ff;
    transform: scale(1.03);
}

.answer-button:disabled {
    background-color: #222233;
    border-color: #444466;
    color: #444466;
    cursor: not-allowed;
}

.answer-button.selected {
    background-color: #0000dd;
    color: white;
    border-color: #3333ff;
}

.answer-button.correct {
    background-color: #008800;
    border-color: #00ff00;
    color: white;
}

.answer-button.incorrect {
    background-color: #880000;
    border-color: #ff0000;
    color: white;
}

#answer-feedback {
    margin-top: 20px;
    padding: 15px;
    border: 2px solid;
    text-align: center;
    font-weight: bold;
    font-size: 1.2em;
}

#answer-feedback.correct {
    background-color: #004400;
    border-color: #00ff00;
    color: #00ff00;
}

#answer-feedback.incorrect {
    background-color: #440000;
    border-color: #ff0000;
    color: #ff0000;
}

#answer-feedback.missed {
    background-color: #444400;
    border-color: #ffff00;
    color: #ffff00;
}

/* Results Section */
#results-section {
    position: relative;
    z-index: 10;
    background-color: inherit;
    padding: 15px;
    margin-top: 10px;
}

#results-options-list {
    list-style: none;
    padding: 0;
    margin: 20px 0;
}

#results-options-list li {
    padding: 12px;
    margin: 10px 0;
    text-align: left;
    border: 2px solid #333333;
    font-size: 1.1em;
}

#results-options-list li.correct-answer {
    background-color: #004400;
    border-color: #00ff00;
    color: #00ff00;
}

#results-options-list li.incorrect-answer {
    background-color: #440000;
    border-color: #ff0000;
    color: #ff0000;
}

#results-player-answers {
    list-style: none;
    padding: 0;
    margin: 20px 0;
}

#results-player-answers li { 
    margin-bottom: 10px;
    font-size: 1.1em;
}
#results-player-answers .correct { color: #00ff00; }
#results-player-answers .incorrect { color: #ff0000; }

#leaderboard-display, #final-leaderboard,
#leaderboard-display-host, #final-leaderboard-host {
    list-style: none;
    padding: 0;
    margin: 20px 0;
    text-align: left;
    font-size: 1.2em;
}

#leaderboard-display li, #final-leaderboard li,
#leaderboard-display-host li, #final-leaderboard-host li {
    display: flex;
    justify-content: space-between;
    padding: 12px 15px;
    margin: 10px 0;
    background-color: #000088;
    border: 2px solid #0000ff;
}

#leaderboard-display li span, #final-leaderboard li span,
#leaderboard-display-host li span, #final-leaderboard-host li span {
    font-weight: bold;
}

#winner-announcement, #winner-announcement-host {
    font-size: 1.5em;
    color: #ffff00;
    margin: 20px 0;
    padding: 15px;
    background-color: #000000;
    border: 3px solid #ffff00;
    animation: blinkBorder 1s infinite alternate;
}

@keyframes blinkBorder {
    from { border-color: #ffff00; }
    to { border-color: #aaaa00; }
}

#witty-remarks-tv div {
    margin: 10px 0;
    font-style: italic;
    color: #00ffff;
}

.loading-text { color: #00ffff; font-size: 1em; }
.spinner {
    width: 50px;
    height: 50px;
    background-color: #00ff00;
    position: relative;
    animation: spin 2s linear infinite;
}

.spinner::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000000;
    transform: rotateY(90deg);
}

.error-message {
    background-color: #880000;
    color: white;
    padding: 15px;
    margin: 20px 0;
    border: 2px solid #ff0000;
    text-align: center;
    animation: fadeIn 0.3s ease;
    font-size: 1.1em;
}

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

#question-section, #results-section, #game-over-section {
    animation: slideInUp 0.3s ease;
}

.question-intro, #question-text {
    animation: fadeIn 0.5s ease;
}

@media (max-width: 600px) {
    .mobile-container {
        width: 100%;
    }
    body { font-size: 12px; }
     h1 {font-size: 1.3em;}
     h2 {font-size: 1.1em;}
    .answer-button { padding: 12px 15px; font-size: 1em; }
     .lobby-flex { flex-direction: column; align-items: center;}
     .qr-join, .player-list { width: 90%; margin-bottom: 20px;}
}

#continue-button {
    display: block;
    width: 80%;
    margin: 30px auto;
    padding: 15px 20px;
    background-color: #008800;
    color: white;
    border: 3px solid #00ff00;
    font-size: 1.3em;
    cursor: pointer;
    font-family: 'Press Start 2P', cursive;
    text-align: center;
    border-radius: 0;
}

#continue-button:hover {
    background-color: #00aa00;
    transform: scale(1.05);
}

/* Footer */
footer {
    margin-top: 30px;
    padding-top: 15px;
    border-top: 1px solid #00ff00;
    color: #00ff00;
    font-size: 0.8em;
}

/* Timer */
#timer, #timer-host {
    font-size: 2.5em;
    color: #ffff00;
    background-color: #000000;
    width: 80px;
    height: 80px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 20px;
    border: 3px solid #ffff00;
}

/* Make sure the game genre is visible */
.game-genres {
    color: #00ffff;
    font-size: 1.2em;
    margin: 15px 0;
    padding: 10px;
    background-color: #000044;
    border: 2px solid #0000ff;
}

/* Added pixel border style */
.pixel-border {
    position: relative;
    border: 4px solid #00ff00;
    box-shadow: 0 0 0 4px #000000, 0 0 0 8px #00ff00;
    margin: 8px;
}

/* Basic Focus handling for Keyboard/Remote */
button:focus, input:focus, select:focus {
     outline: 2px solid #0d6efd;
     outline-offset: 2px;
}
/* Style currently focused element distinctly for TV */
body.tv-active *:focus {
     box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.5);
}

/* Answer Options (TV Display) */
.answer-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 30px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.answer-option {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    font-size: 1.4em;
    text-align: left;
    border: 2px solid #dee2e6;
    transition: all 0.3s ease;
}

.answer-option:hover {
    background-color: #e9ecef;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.confirm-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.confirm-content {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    max-width: 90%;
    width: 400px;
}

.confirm-content h3 {
    margin-top: 0;
    color: #333;
}

.confirm-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.confirm-buttons button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

#confirm-leave {
    background-color: #dc3545;
    color: white;
}

#cancel-leave {
    background-color: #6c757d;
    color: white;
}

#confirm-leave:hover {
    background-color: #c82333;
}

#cancel-leave:hover {
    background-color: #5a6268;
}

#scoreboard-section {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    text-align: center;
}

#scoreboard-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.scoreboard-item {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.scoreboard-item .player-name {
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 5px;
}

.scoreboard-item .player-score {
    font-size: 1.4em;
    color: #007bff;
}

.correct-answer {
    font-size: 1.2em;
    color: #198754;
    margin: 20px 0;
    padding: 10px;
    background-color: #d1e7dd;
    border-radius: 4px;
}

.player-info {
    text-align: center;
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.player-info h2 {
    margin: 0 0 10px 0;
    color: #333;
}

.player-info p {
    margin: 5px 0;
    color: #666;
}

button.submitted {
    background-color: #28a745;
    color: white;
    cursor: not-allowed;
    opacity: 0.8;
    pointer-events: none;
}

button.submitted:hover {
    background-color: #28a745;
    color: white;
    cursor: not-allowed;
    opacity: 0.8;
    pointer-events: none;
}

.tts-loading-indicator {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    margin: 10px 0;
    padding: 8px 12px;
    background-color: #000044;
    border: 3px solid #0000ff;
    box-shadow: 0 0 8px #00ffff;
    color: #00ffff;
    font-family: 'Press Start 2P', cursive;
    text-transform: uppercase;
    animation: blinkBorder 1.5s infinite alternate;
}

.tts-loading-indicator p {
    margin: 0 15px 0 0;
    font-size: 0.9em;
    text-shadow: 0 0 5px #00ffff;
}

/* Replace the spinner with a retro pixel-style loading animation */
.tts-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    background-color: transparent;
    position: relative;
}

.tts-spinner::before {
    content: "";
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: transparent;
    box-shadow: 
        0px 0px 0 #00ffff,
        4px 0px 0 #00ffff,
        8px 0px 0 #00ffff,
        12px 0px 0 #00ffff;
    animation: pixelLoading 1s steps(4) infinite;
}

@keyframes pixelLoading {
    0% {
        box-shadow: 
            0px 0px 0 #00ffff,
            4px 0px 0 transparent,
            8px 0px 0 transparent,
            12px 0px 0 transparent;
    }
    25% {
        box-shadow: 
            0px 0px 0 transparent,
            4px 0px 0 #00ffff,
            8px 0px 0 transparent,
            12px 0px 0 transparent;
    }
    50% {
        box-shadow: 
            0px 0px 0 transparent,
            4px 0px 0 transparent,
            8px 0px 0 #00ffff,
            12px 0px 0 transparent;
    }
    75% {
        box-shadow: 
            0px 0px 0 transparent,
            4px 0px 0 transparent,
            8px 0px 0 transparent,
            12px 0px 0 #00ffff;
    }
    100% {
        box-shadow: 
            0px 0px 0 #00ffff,
            4px 0px 0 transparent,
            8px 0px 0 transparent,
            12px 0px 0 transparent;
    }
}

.play-tts-button {
    display: none;
    padding: 15px 25px;
    margin: 15px auto;
    background-color: #008800;
    color: white;
    border: 3px solid #00ff00;
    font-family: 'Press Start 2P', cursive;
    cursor: pointer;
    font-size: 1.2em;
    text-transform: uppercase;
    animation: blinkBorder 1s infinite alternate;
}

.play-tts-button:hover {
    background-color: #00aa00;
    transform: scale(1.05);
}

@keyframes spin {
    0% { transform: rotate3d(1, 1, 0, 0deg); }
    100% { transform: rotate3d(1, 1, 0, 360deg); }
}

/* Processing Results Section */
.processing-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    margin: 20px 0;
    background-color: #000066;
    border: 4px solid #0000ff;
    animation: blinkBorder 1s infinite alternate;
}

.processing-results h2 {
    color: #00ffff;
    margin-bottom: 20px;
    text-shadow: 3px 3px 0px #000088;
}

.processing-results .spinner {
    margin: 20px 0;
}

/* Winner announcement with TTS */
.winner-tts-announcement {
    font-size: 1.6em;
    color: #00ff00;
    padding: 15px;
    margin: 20px 0;
    background-color: #000066;
    border: 3px solid #00ff00;
    text-align: center;
    animation: fadeIn 0.5s ease, blinkBorder 1.5s infinite alternate;
}

/* Coin animation */
@keyframes insertCoin {
    0% { 
        opacity: 0;
        transform: translateY(-100px) rotate(0deg);
    }
    20% { 
        opacity: 1;
        transform: translateY(-50px) rotate(180deg);
    }
    40% { 
        transform: translateY(-25px) rotate(360deg);
    }
    60% { 
        transform: translateY(-12px) rotate(540deg);
    }
    80% { 
        transform: translateY(-5px) rotate(720deg);
    }
    100% { 
        transform: translateY(0) rotate(900deg);
        opacity: 0;
    }
}

.coin {
    position: absolute;
    width: 20px;
    height: 20px;
    background-color: #ffcc00;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(255, 204, 0, 0.8);
    opacity: 0;
    pointer-events: none;
    z-index: 10;
}

.coin.animate {
    animation: insertCoin 1s forwards;
}

/* Coin slot hover effect */
.coin-slot:hover {
    background-color: #444;
    cursor: pointer;
}

.coin-slot:hover::before {
    color: #ffff00;
    text-shadow: 0 0 5px rgba(255, 255, 0, 0.8);
}

/* Retro Fireworks Animation */
@keyframes firework {
    0% { 
        transform: translate(-50%, 100%);
        width: 2px;
        height: 2px;
        opacity: 1;
    }
    50% {
        width: 2px;
        height: 2px;
        opacity: 1;
    }
    100% {
        width: 300px;
        height: 300px;
        opacity: 0;
        transform: translate(-50%, -50%);
    }
}

.fireworks-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
    overflow: hidden;
}

.firework {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 2px;
    height: 2px;
    border-radius: 50%;
    background-color: #ff0000;
    box-shadow: 0 0 10px 5px rgba(255, 0, 0, 0.5);
    transform-origin: center bottom;
    animation: firework 1.5s ease-out forwards;
}

.firework::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: #ff0000;
    box-shadow: 0 0 8px 4px rgba(255, 0, 0, 0.5);
    transform: scale(0.9);
    opacity: 0.8;
}

.firework::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-image: 
        radial-gradient(circle, transparent 0%, rgba(255, 0, 0, 0.5) 100%),
        linear-gradient(45deg, transparent 45%, #fff 45%, #fff 55%, transparent 55%),
        linear-gradient(135deg, transparent 45%, #fff 45%, #fff 55%, transparent 55%);
    animation: spin 1s linear infinite;
}

.firework.blue {
    background-color: #0000ff;
    box-shadow: 0 0 10px 5px rgba(0, 0, 255, 0.5);
}

.firework.blue::before {
    background-color: #0000ff;
    box-shadow: 0 0 8px 4px rgba(0, 0, 255, 0.5);
}

.firework.blue::after {
    background-image: 
        radial-gradient(circle, transparent 0%, rgba(0, 0, 255, 0.5) 100%),
        linear-gradient(45deg, transparent 45%, #fff 45%, #fff 55%, transparent 55%),
        linear-gradient(135deg, transparent 45%, #fff 45%, #fff 55%, transparent 55%);
}

.firework.green {
    background-color: #00ff00;
    box-shadow: 0 0 10px 5px rgba(0, 255, 0, 0.5);
}

.firework.green::before {
    background-color: #00ff00;
    box-shadow: 0 0 8px 4px rgba(0, 255, 0, 0.5);
}

.firework.green::after {
    background-image: 
        radial-gradient(circle, transparent 0%, rgba(0, 255, 0, 0.5) 100%),
        linear-gradient(45deg, transparent 45%, #fff 45%, #fff 55%, transparent 55%),
        linear-gradient(135deg, transparent 45%, #fff 45%, #fff 55%, transparent 55%);
}

.firework.yellow {
    background-color: #ffff00;
    box-shadow: 0 0 10px 5px rgba(255, 255, 0, 0.5);
}

.firework.yellow::before {
    background-color: #ffff00;
    box-shadow: 0 0 8px 4px rgba(255, 255, 0, 0.5);
}

.firework.yellow::after {
    background-image: 
        radial-gradient(circle, transparent 0%, rgba(255, 255, 0, 0.5) 100%),
        linear-gradient(45deg, transparent 45%, #fff 45%, #fff 55%, transparent 55%),
        linear-gradient(135deg, transparent 45%, #fff 45%, #fff 55%, transparent 55%);
}

.firework.purple {
    background-color: #ff00ff;
    box-shadow: 0 0 10px 5px rgba(255, 0, 255, 0.5);
}

.firework.purple::before {
    background-color: #ff00ff;
    box-shadow: 0 0 8px 4px rgba(255, 0, 255, 0.5);
}

.firework.purple::after {
    background-image: 
        radial-gradient(circle, transparent 0%, rgba(255, 0, 255, 0.5) 100%),
        linear-gradient(45deg, transparent 45%, #fff 45%, #fff 55%, transparent 55%),
        linear-gradient(135deg, transparent 45%, #fff 45%, #fff 55%, transparent 55%);
}

.winner-congratulations {
    font-size: 2em;
    color: #ffff00;
    text-shadow: 0 0 10px rgba(255, 255, 0, 0.8);
    margin: 20px 0;
    padding: 20px;
    background-color: #000066;
    border: 4px solid #ffff00;
    animation: pulse 1.5s infinite alternate;
    text-align: center;
}

/* Result GIF container */
.result-gif-container {
    width: 100%;
    max-width: 300px;
    height: 200px;
    margin: 15px auto;
    border: 4px solid #ffcc00;
    border-radius: 10px;
    overflow: hidden;
    background-color: #000;
    box-shadow: 0 0 15px rgba(255, 204, 0, 0.7);
    position: relative;
    z-index: 100;
    display: block !important;
}

.result-gif-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    position: relative;
    z-index: 101;
}

.result-gif-container p {
    color: #ffcc00;
    text-align: center;
    margin: 5px 0;
    font-size: 1em;
    position: relative;
    z-index: 102;
}