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

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --success-color: #27ae60;
    --error-color: #e74c3c;
    --warning-color: #f39c12;
    --purple-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --light-bg: #ecf0f1;
    --white: #ffffff;
    --text-color: #2c3e50;
    --text-light: #7f8c8d;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 8px 15px rgba(0, 0, 0, 0.2);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--purple-gradient);
    min-height: 100vh;
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
}

.app-container {
    min-height: 100vh;
    position: relative;
}

/* Screen Management */
.screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Lobby Screen Styles */
.lobby-container {
    max-width: 800px;
    width: 100%;
    text-align: center;
}

.header {
    color: var(--white);
    margin-bottom: 50px;
}

.header h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.header h1 i {
    margin-right: 20px;
    color: #f8c471;
}

.subtitle {
    font-size: 1.3rem;
    font-weight: 300;
    opacity: 0.9;
}

.lobby-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

.option-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 40px 30px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.option-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--secondary-color);
}

.option-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-hover);
}

.option-icon {
    font-size: 3rem;
    color: var(--secondary-color);
    margin-bottom: 20px;
}

.option-card h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.option-card p {
    color: var(--text-light);
    margin-bottom: 25px;
    line-height: 1.5;
}

.join-form {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.join-form input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    text-align: center;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 2px;
}

.join-form input:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px 25px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: var(--secondary-color);
    color: var(--white);
}

.btn-primary:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--success-color);
    color: var(--white);
}

.btn-secondary:hover {
    background: #229954;
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    color: var(--white);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.btn-danger {
    background: var(--error-color);
    color: var(--white);
}

.btn-danger:hover {
    background: #cb4335;
}

.back-to-single {
    margin-top: 30px;
}

/* Waiting Room Styles */
.waiting-container {
    max-width: 600px;
    width: 100%;
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 40px;
    box-shadow: var(--shadow);
}

.room-info {
    text-align: center;
    margin-bottom: 40px;
}

.room-info h2 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.room-code-share p {
    color: var(--text-light);
    margin-bottom: 15px;
}

.code-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    background: var(--light-bg);
    padding: 20px;
    border-radius: 8px;
    margin: 0 auto;
    max-width: 300px;
}

.code-display span {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: 3px;
}

.copy-btn {
    background: var(--secondary-color);
    color: var(--white);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
}

.copy-btn:hover {
    background: #2980b9;
    transform: scale(1.1);
}

.players-waiting {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 40px;
    padding: 30px;
    background: var(--light-bg);
    border-radius: var(--border-radius);
}

.player-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.player-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--secondary-color);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    transition: var(--transition);
}

.player-avatar.waiting {
    background: var(--text-light);
    animation: pulse 2s infinite;
}

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

.player-name {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.player-status {
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
}

.player-status.ready {
    background: #d5f4e6;
    color: #1e8449;
}

.player-status.waiting {
    background: #fef9e7;
    color: #b7950b;
}

.vs-divider {
    font-size: 2rem;
    font-weight: 900;
    color: var(--error-color);
    background: var(--white);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
}

/* Game Screen Styles */
.game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 30px;
    background: var(--white);
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.player-score-card {
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 200px;
}

.player-score-card.player1 {
    flex-direction: row;
}

.player-score-card.player2 {
    flex-direction: row-reverse;
}

.player-score-card .player-avatar {
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
}

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

.player-score-card.player2 .score-info {
    text-align: center;
}

.score-display {
    display: flex;
    align-items: baseline;
    gap: 5px;
}

.score {
    font-size: 2rem;
    font-weight: 700;
    color: var(--secondary-color);
}

.score-label {
    font-size: 0.8rem;
    color: var(--text-light);
}

.answer-indicator {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--light-bg);
    color: var(--text-light);
    transition: var(--transition);
}

.answer-indicator.answered {
    background: var(--success-color);
    color: var(--white);
    animation: checkmark 0.5s ease;
}

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

.question-counter {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.timer-display {
    display: flex;
    justify-content: center;
}

.timer-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--warning-color);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    position: relative;
}

.timer-circle.warning {
    background: var(--error-color);
    animation: timerWarning 0.5s infinite;
}

/* Question Container */
.question-container {
    max-width: 900px;
    margin: 0 auto;
}

.question-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 40px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-question {
    text-align: center;
    color: var(--text-light);
}

.loading-question i {
    font-size: 2rem;
    margin-bottom: 15px;
    color: var(--secondary-color);
}

.quote-text {
    font-size: 1.6rem;
    line-height: 1.8;
    font-style: italic;
    color: var(--text-color);
    text-align: center;
    margin: 0;
    position: relative;
    padding: 0 30px;
}

.quote-text::before,
.quote-text::after {
    content: '"';
    font-size: 4rem;
    color: var(--secondary-color);
    position: absolute;
    font-family: serif;
}

.quote-text::before {
    left: -10px;
    top: -20px;
}

.quote-text::after {
    right: -10px;
    bottom: -30px;
}

/* Answer Section */
.answer-section {
    text-align: center;
    margin-bottom: 30px;
}

.answer-prompt h3 {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.speed-hint {
    color: var(--text-light);
    font-size: 1.1rem;
    margin-bottom: 30px;
}

.answer-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    max-width: 600px;
    margin: 0 auto;
}

.answer-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 25px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: 600;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.answer-btn:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.answer-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.yes-btn {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: var(--white);
}

.no-btn {
    background: linear-gradient(135deg, #e74c3c, #ec7063);
    color: var(--white);
}

.btn-icon {
    font-size: 2rem;
}

.btn-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.main-text {
    font-size: 1.5rem;
    font-weight: 700;
}

.sub-text {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Result Section */
.result-section {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 40px;
    box-shadow: var(--shadow);
    text-align: center;
}

.result-message {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 20px;
    padding: 20px;
    border-radius: 8px;
}

.result-message.correct {
    background: #d5f4e6;
    color: #1e8449;
}

.result-message.incorrect {
    background: #fadbd8;
    color: #922b21;
}

.quote-attribution {
    font-size: 1.1rem;
    color: var(--text-color);
    background: var(--light-bg);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.next-question-timer {
    font-size: 1.2rem;
    color: var(--text-light);
    font-weight: 500;
}

.next-question-timer span {
    color: var(--secondary-color);
    font-weight: 700;
}

/* Results Screen */
.results-container {
    max-width: 600px;
    width: 100%;
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 40px;
    box-shadow: var(--shadow);
    text-align: center;
}

.results-header {
    margin-bottom: 40px;
}

.trophy-icon {
    font-size: 4rem;
    color: #ffd700;
    margin-bottom: 20px;
    animation: bounce 2s infinite;
}

.results-header h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.final-scores {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 40px;
}

.final-player-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 25px;
    background: var(--light-bg);
    border-radius: var(--border-radius);
    position: relative;
}

.final-player-card.winner {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: var(--primary-color);
}

.player-position {
    font-size: 2rem;
    font-weight: 900;
    width: 50px;
    text-align: center;
}

.final-player-card .player-avatar {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
}

.player-details {
    flex: 1;
    text-align: left;
}

.player-final-score {
    font-size: 2rem;
    font-weight: 700;
    color: var(--secondary-color);
}

.player-accuracy {
    font-size: 1rem;
    color: var(--text-light);
}

.results-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Connection Status */
.connection-status {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--success-color);
    color: var(--white);
    padding: 10px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 1000;
    transition: var(--transition);
}

.connection-status.disconnected {
    background: var(--error-color);
    animation: pulse 2s infinite;
}

/* Animations */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

@keyframes checkmark {
    0% { transform: scale(0.5); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

@keyframes timerWarning {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .lobby-options {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .option-card {
        padding: 30px 20px;
    }

    .header h1 {
        font-size: 2.5rem;
    }

    .players-waiting {
        flex-direction: column;
        gap: 30px;
        padding: 20px;
    }

    .vs-divider {
        transform: rotate(90deg);
    }

    .game-header {
        flex-direction: column;
        gap: 20px;
        padding: 20px;
    }

    .player-score-card {
        width: 100%;
        justify-content: center;
    }

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

    .quote-text {
        font-size: 1.3rem;
        padding: 0 20px;
    }

    .final-scores {
        gap: 15px;
    }

    .final-player-card {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .screen {
        padding: 15px;
    }

    .question-card {
        padding: 25px;
    }

    .answer-btn {
        padding: 20px;
        font-size: 1rem;
    }

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