* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary-purple: #8e44ad;
    --primary-purple-dark: #7d3c98;
    --primary-text: #f5f5f5;
    --secondary-text: #cccccc;
    --background-dark: #121212;
    --card-background: #1e1e1e;
    --border-color: #333333;
    --correct-color: #27ae60;
    --pending-color: #f39c12;
    --incorrect-color: #e74c3c;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    background-color: var(--background-dark);
    color: var(--primary-text);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    max-width: 800px;
    width: 100%;
    background-color: var(--card-background);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    padding: 30px;
}

.screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.hidden {
    display: none !important;
}

h1 {
    margin-bottom: 20px;
    color: var(--primary-text);
    font-size: 2.5rem;
}

h2 {
    margin-bottom: 15px;
    color: var(--primary-text);
    font-size: 2rem;
}

h3 {
    color: var(--primary-text);
}

p {
    margin-bottom: 20px;
    font-size: 1.1rem;
    color: var(--secondary-text);
}

button {
    background-color: var(--primary-purple);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s, transform 0.1s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

button:hover {
    background-color: var(--primary-purple-dark);
}

button:active {
    transform: scale(0.98);
}

#start-screen {
    animation: fadeIn 0.5s ease-in-out;
}

/* Player Setup Styles */
#player-setup-screen {
    width: 100%;
}

.player-setup-controls {
    margin-bottom: 25px;
    width: 100%;
    max-width: 400px;
}

.player-setup-controls label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    text-align: left;
    color: var(--primary-text);
}

.player-setup-controls select {
    width: 100%;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    background-color: var(--card-background);
    color: var(--primary-text);
    cursor: pointer;
}

.player-names-container {
    width: 100%;
    max-width: 400px;
    margin-bottom: 25px;
}

.player-input {
    margin-bottom: 15px;
    text-align: left;
}

.player-input label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--primary-text);
}

.player-input input {
    width: 100%;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    background-color: var(--card-background);
    color: var(--primary-text);
}

.buttons-row {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 400px;
    gap: 10px;
}

.full-width-button {
    width: 100%;
}

#back-to-menu {
    background-color: #6c757d;
}

#back-to-menu:hover {
    background-color: #5a6268;
}

/* Player scores in results screen */
#player-scores {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.round-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-weight: 600;
    background-color: rgba(142, 68, 173, 0.1);
    padding: 10px;
    border-radius: 8px;
}

.round-header h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--primary-purple);
}

.player-score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-radius: 10px;
    background-color: rgba(142, 68, 173, 0.05);
    transition: all 0.3s ease;
}

.player-score-item.winner {
    background-color: rgba(241, 196, 15, 0.2);
    border-left: 4px solid #f1c40f;
}

.player-name {
    font-weight: 600;
    flex: 1;
}

.score-info {
    font-weight: 500;
}

.total-score {
    margin-left: 15px;
    color: var(--primary-purple);
}

.game-header {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 20px;
    padding: 0 10px;
}

.score, .progress, .current-player, .timer {
    font-size: 1.1rem;
    font-weight: 600;
}

.timer {
    color: var(--incorrect-color);
}

.navigation-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 30px;
    padding: 0 10px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
}

.nav-button {
    padding: 8px 15px;
    font-size: 0.9rem;
    background-color: #5f6769;
    border-radius: 8px;
    color: white;
    border: none;
}

.nav-button:hover {
    background-color: #4a5052;
}

.nav-button:disabled {
    background-color: #444;
    cursor: not-allowed;
    opacity: 0.6;
}

.indicator-circles {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.circle {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: #444;
    cursor: pointer;
    transition: all 0.3s ease;
}

.circle.correct {
    background-color: var(--correct-color);
}

.circle.incorrect {
    background-color: var(--incorrect-color);
}

.circle.pending {
    background-color: var(--pending-color);
}

.circle.current {
    border: 2px solid var(--primary-purple);
    transform: scale(1.2);
}

.image-container {
    width: 100%;
    height: 350px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    overflow: hidden;
    border-radius: 16px;
    background-color: #2a2a2a;
    position: relative;
}

#game-image {
    max-width: 100%;
    max-height: 100%;
    min-height: 250px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 5px;
    transition: opacity 0.3s ease;
    display: block;
    margin: 0 auto;
}

.guess-container {
    display: flex;
    width: 100%;
    margin-bottom: 20px;
    margin-top: 10px;
}

#guess-input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 10px 0 0 10px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
    background-color: #2a2a2a;
    color: var(--primary-text);
}

#guess-input:focus {
    border-color: var(--primary-purple);
}

#submit-guess {
    border-radius: 0 10px 10px 0;
    background-color: var(--primary-purple);
    color: white;
    font-weight: bold;
    padding-left: 20px;
    padding-right: 20px;
    position: relative;
    box-shadow: 0 2px 6px rgba(142, 68, 173, 0.4);
}

#submit-guess:hover {
    background-color: var(--primary-purple-dark);
}

.feedback {
    padding: 15px;
    border-radius: 10px;
    width: 100%;
    margin-top: 10px;
    font-weight: 600;
    animation: fadeIn 0.5s ease;
}

.correct {
    background-color: rgba(39, 174, 96, 0.2);
    color: #2ecc71;
    border: 1px solid rgba(39, 174, 96, 0.3);
}

.incorrect {
    background-color: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.3);
}

#result-details {
    margin: 20px 0;
    width: 100%;
    text-align: left;
}

.result-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 10px;
    padding: 12px;
    border-radius: 10px;
    background-color: rgba(142, 68, 173, 0.1);
}

.result-item.correct {
    background-color: rgba(39, 174, 96, 0.2);
}

.result-item.incorrect {
    background-color: rgba(231, 76, 60, 0.2);
}

.result-icon {
    margin-right: 10px;
    font-weight: bold;
    font-size: 1.2rem;
}

.question-header {
    width: 100%;
    line-height: 1.4;
}

.question-header strong {
    color: var(--primary-purple);
}

.question-header small {
    display: block;
    margin-top: 3px;
    color: var(--secondary-text);
    font-size: 0.9rem;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

.fade-in {
    animation: fadeIn 0.5s ease;
}

.fade-in-up {
    animation: fadeInUp 0.5s ease;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .container {
        padding: 20px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .image-container {
        height: 250px;
    }
    
    .game-header {
        flex-direction: column;
        align-items: center;
    }
    
    .score, .progress, .current-player, .timer {
        margin-bottom: 10px;
    }
    
    .buttons-row {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }
    
    #back-to-menu, #start-game, #play-again, #replay-same-players {
        width: 100%;
    }
    
    #replay-same-players {
        margin-bottom: 0;
    }
}

/* Sound indicator */
.sound-controls {
    position: absolute;
    top: 15px;
    right: 15px;
    cursor: pointer;
    z-index: 100;
    background-color: rgba(255, 255, 255, 0.7);
    padding: 5px 10px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    font-size: 0.9rem;
}

.sound-icon {
    margin-right: 5px;
}

/* Player Transition Screen */
.next-player-info {
    margin: 30px 0;
    text-align: center;
}

.next-player-info h3 {
    color: var(--primary-purple);
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.next-player-info p {
    font-size: 1.1rem;
    color: var(--secondary-text);
}

/* Category Display */
.category-display {
    text-align: center;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--primary-text);
    background-color: rgba(142, 68, 173, 0.2);
    padding: 5px 10px;
    border-radius: 10px;
    width: 100%;
}

#current-category {
    text-transform: capitalize;
    font-weight: 700;
    color: var(--primary-purple);
}

/* Style for the replay button */
#replay-same-players {
    background-color: #2ecc71;
    margin-bottom: 10px;
}

#replay-same-players:hover {
    background-color: #27ae60;
}

/* Perfect score animation */
.sweep-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
}

.sweep-text {
    font-size: 5rem;
    font-weight: 800;
    color: gold;
    text-shadow: 
        0 0 10px rgba(255, 215, 0, 0.7),
        0 0 20px rgba(255, 215, 0, 0.5),
        0 0 30px rgba(255, 215, 0, 0.3),
        3px 3px 5px rgba(0, 0, 0, 0.5);
    transform: scale(0.5);
    opacity: 0;
    letter-spacing: 2px;
}

.sweep-animation {
    animation: sweepEffect 2s ease-in-out forwards;
}

.sweep-text-animation {
    animation: sweepTextEffect 2s ease-in-out forwards;
}

@keyframes sweepEffect {
    0% { opacity: 0; visibility: visible; }
    20% { opacity: 1; visibility: visible; }
    80% { opacity: 1; visibility: visible; }
    100% { opacity: 0; visibility: hidden; }
}

@keyframes sweepTextEffect {
    0% { transform: scale(0.5); opacity: 0; }
    30% { transform: scale(1.3); opacity: 1; }
    50% { transform: scale(1); opacity: 1; }
    80% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.2); opacity: 0; }
}

/* Perfect game animation (15/15) */
.perfect-game-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    z-index: 1500;
    opacity: 0;
    visibility: hidden;
    background: radial-gradient(circle, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0.7) 100%);
}

.perfect-game-text {
    font-size: 4rem;
    font-weight: 900;
    color: #ffdf00;
    text-shadow: 
        0 0 10px rgba(255, 215, 0, 0.8),
        0 0 20px rgba(255, 215, 0, 0.6),
        0 0 30px rgba(255, 215, 0, 0.4),
        0 0 40px rgba(255, 215, 0, 0.2),
        4px 4px 6px rgba(0, 0, 0, 0.6);
    transform: scale(0.5);
    opacity: 0;
    text-align: center;
    letter-spacing: 3px;
    line-height: 1.2;
}

.perfect-game-score {
    font-size: 5rem;
    font-weight: 900;
    color: #ffdf00;
    margin-top: 0.5rem;
    text-shadow: 
        0 0 10px rgba(255, 215, 0, 0.8),
        0 0 20px rgba(255, 215, 0, 0.6),
        0 0 30px rgba(255, 215, 0, 0.4),
        0 0 40px rgba(255, 215, 0, 0.2),
        4px 4px 6px rgba(0, 0, 0, 0.6);
    opacity: 0;
    transform: scale(0.5);
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: #f00;
    opacity: 0;
    animation: confettiAnimation 3s ease-in-out forwards;
    z-index: 1400;
}

@keyframes confettiAnimation {
    0% {
        transform: translateY(-10px) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(calc(100vh)) rotate(360deg);
        opacity: 0;
    }
}

.perfect-game-animation {
    animation: perfectGameEffect 3.5s ease-in-out forwards;
}

.perfect-game-text-animation {
    animation: perfectGameTextEffect 3.5s ease-in-out forwards;
}

.perfect-game-score-animation {
    animation: perfectGameScoreEffect 3.5s ease-in-out 0.5s forwards;
}

@keyframes perfectGameEffect {
    0% { opacity: 0; visibility: visible; }
    15% { opacity: 1; visibility: visible; }
    85% { opacity: 1; visibility: visible; }
    100% { opacity: 0; visibility: hidden; }
}

@keyframes perfectGameTextEffect {
    0% { transform: scale(0.5); opacity: 0; }
    25% { transform: scale(1.2); opacity: 1; }
    35% { transform: scale(1); opacity: 1; }
    85% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.1); opacity: 0; }
}

@keyframes perfectGameScoreEffect {
    0% { transform: scale(0.5); opacity: 0; }
    25% { transform: scale(1.3); opacity: 1; }
    45% { transform: scale(1); opacity: 1; }
    85% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.1); opacity: 0; }
}

.tournament-return-button {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(255, 255, 255, 0.9);
    color: #333;
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 8px 12px;
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    z-index: 1000;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.tournament-return-button:hover {
    background-color: rgba(255, 255, 255, 1);
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.tournament-return-button.hidden {
    display: none;
}

.btn-icon {
    width: 16px;
    height: 16px;
    margin-right: 5px;
}