* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* Screen Management */
.screen {
    display: none;
    min-height: 100vh;
    padding: 20px;
}

.screen.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

/* Cards */
.card {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 40px;
    max-width: 600px;
    margin: 0 auto;
}

.card.center {
    text-align: center;
}

.card h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    color: #333;
    text-align: center;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 40px;
    font-size: 1.1rem;
}

/* Configuration Sections */
.config-section {
    margin-bottom: 30px;
}

.config-label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
    font-size: 0.95rem;
}

.icon {
    margin-right: 8px;
}

/* Button Groups */
.button-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 12px;
}

.level-btn, .time-btn, .points-btn {
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.level-btn:hover, .time-btn:hover, .points-btn:hover {
    background: #e5e7eb;
    transform: translateY(-2px);
}

.level-btn.active, .time-btn.active, .points-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

/* Team Inputs */
#teamInputs {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.team-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.team-input:focus {
    outline: none;
    border-color: #667eea;
}

.link-btn {
    background: none;
    border: none;
    color: #667eea;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 0;
    font-size: 0.9rem;
}

.link-btn:hover {
    color: #764ba2;
}

/* Primary Button */
.primary-btn {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 16px 24px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.primary-btn:active {
    transform: translateY(0);
}

/* Game Screen */
#gameScreen .container {
    max-width: 1200px;
}

.game-header {
    background: white;
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.team-info h2 {
    font-size: 2rem;
    color: #333;
    margin-bottom: 8px;
}

.level-badge {
    display: inline-block;
    padding: 6px 16px;
    background: #f3f4f6;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #667eea;
}

.timer {
    font-size: 4rem;
    font-weight: 700;
    color: #667eea;
    min-width: 120px;
    text-align: right;
}

.timer.warning {
    color: #ef4444;
    animation: pulse 0.5s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Scores Display */
.scores-container {
    margin-bottom: 20px;
}

.scores-display {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.score-badge {
    background: white;
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.score-badge.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* Words Grid */
.words-container {
    background: white;
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.words-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.word-btn {
    padding: 32px 24px;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    color: #333;
}

.word-btn:hover:not(:disabled) {
    background: #e5e7eb;
    transform: scale(1.02);
}

.word-btn.selected {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border-color: #10b981;
    transform: scale(0.98);
}

.word-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Game Footer */
.game-footer {
    background: white;
    border-radius: 20px;
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.round-score {
    font-size: 1.5rem;
    font-weight: 700;
    color: #667eea;
}

.game-footer .primary-btn {
    width: auto;
    margin: 0;
}

/* Round End Screen */
.big-score {
    font-size: 5rem;
    font-weight: 700;
    color: #667eea;
    margin: 20px 0;
}

.score-text {
    font-size: 1.3rem;
    color: #666;
    margin-bottom: 30px;
}

.standings {
    background: #f9fafb;
    border-radius: 16px;
    padding: 24px;
    margin: 30px 0;
    text-align: left;
}

.standings h3 {
    font-weight: 700;
    color: #333;
    margin-bottom: 16px;
}

.standing-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: white;
    border-radius: 10px;
    margin-bottom: 8px;
}

.standing-row.winner {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 2px solid #fbbf24;
}

.standing-team {
    font-weight: 600;
    font-size: 1.1rem;
}

.standing-score {
    font-size: 1.5rem;
    font-weight: 700;
    color: #667eea;
}

/* Game Over Screen */
.winner-card {
    background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
}

.trophy {
    font-size: 6rem;
    margin-bottom: 20px;
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.winner-card h2 {
    font-size: 3rem;
    color: #333;
    margin-bottom: 10px;
}

.winner-text {
    font-size: 2rem;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 30px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .card {
        padding: 24px;
    }

    .card h1 {
        font-size: 2rem;
    }

    .game-header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }

    .team-info h2 {
        font-size: 1.5rem;
    }

    .timer {
        font-size: 3rem;
        text-align: center;
    }

    .words-grid {
        grid-template-columns: 1fr;
    }

    .game-footer {
        flex-direction: column;
        gap: 16px;
    }

    .game-footer .primary-btn {
        width: 100%;
    }

    .big-score {
        font-size: 3.5rem;
    }

    .winner-text {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .button-group {
        grid-template-columns: 1fr;
    }

    .trophy {
        font-size: 4rem;
    }
}