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

:root {
    /*--background: hsl(0, 0%, 98%);*/
    --background: linear-gradient(135deg, hsl(174 100% 36%), hsl(180 95% 25%));
    -foreground: hsl(180, 50%, 10%);
    --card: hsl(0, 0%, 100%);
    --primary: hsl(174, 100%, 36%);
    --primary-dark: hsl(180, 95%, 25%);
    --primary-foreground: hsl(0, 0%, 100%);
    --success: hsl(145, 65%, 50%);
    --warning: hsl(35, 95%, 60%);
    --destructive: hsl(0, 75%, 55%);
    --muted: hsl(180, 15%, 95%);
    --muted-foreground: hsl(180, 10%, 45%);
    --border: hsl(180, 15%, 90%);
    --radius: 1rem;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--background);
    color: var(--foreground);
    min-height: 100vh;
}

.screen {
    display: none;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.screen.active {
    display: flex;
}

.game-bg {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 2rem;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 4px 20px -2px rgba(0, 150, 136, 0.15);
}

.header {
    text-align: center;
    margin-bottom: 2rem;
}

.icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.icon.trophy {
    font-size: 4rem;
}

.icon.bounce {
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

h1 {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--muted-foreground);
}

.setup-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

label {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--foreground);
}

.button-group {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.button-group.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.btn-option {
    padding: 0.75rem;
    border: 2px solid var(--border);
    background: white;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.btn-option:hover {
    border-color: var(--primary);
    background: hsl(174, 100%, 98%);
}

.btn-option.active {
    background: var(--primary);
    color: var(--primary-foreground);
    border-color: var(--primary);
}

.team-name-input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.team-name-input:focus {
    outline: none;
    border-color: var(--primary);
}

.btn-primary {
    width: 100%;
    padding: 1rem;
    background: var(--primary);
    color: var(--primary-foreground);
    border: none;
    border-radius: 0.5rem;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px -2px rgba(0, 150, 136, 0.3);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px -2px rgba(0, 150, 136, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Game Screen */
.game-container {
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.game-header {
    text-align: center;
    color: var(--primary-foreground);
}

.game-header h2 {
    font-size: 1.5rem;
    margin: 0.5rem 0;
}

.round-info, .score-info {
    font-size: 0.875rem;
    opacity: 0.9;
}

.timer-container {
    margin-bottom: 1rem;
}

.timer-display {
    text-align: center;
    margin-bottom: 0.5rem;
}

.timer-display span {
    font-size: 3rem;
    font-weight: bold;
    color: var(--primary-foreground);
}

.timer-display span.warning {
    color: var(--destructive);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary-foreground);
    transition: width 1s linear;
}

.progress-fill.success {
    background: var(--success);
}

.word-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 3rem 2rem;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px -2px rgba(0, 150, 136, 0.15);
}

.word-card h1 {
    font-size: 3rem;
    text-align: center;
}

.word-progress {
    margin-bottom: 1rem;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    color: var(--primary-foreground);
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

.game-controls {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.control-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.btn-success {
    width: 100%;
    padding: 1rem;
    background: var(--success);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px -2px rgba(52, 168, 83, 0.3);
    transition: all 0.2s;
}

.btn-success:hover {
    background: hsl(145, 65%, 45%);
    transform: translateY(-2px);
}

.btn-outline {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    color: var(--foreground);
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.7);
}

.btn-danger {
    padding: 1rem;
    background: var(--destructive);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px -2px rgba(220, 38, 38, 0.3);
    transition: all 0.2s;
}

.btn-danger:hover {
    background: hsl(0, 75%, 50%);
}

/* Results Screen */
.result-text {
    font-size: 1.125rem;
    margin-top: 1rem;
}

.highlight {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--success);
}

.scoreboard {
    margin: 2rem 0;
}

.scoreboard h2 {
    text-align: center;
    color: var(--primary);
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.team-score {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: var(--muted);
    border-radius: 0.5rem;
}

.team-score.winner {
    background: rgba(255, 193, 7, 0.1);
    border: 2px solid var(--warning);
    transform: scale(1.05);
}

.team-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.rank {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--muted-foreground);
}

.team-score.winner .rank {
    color: var(--warning);
}

.team-name {
    font-weight: 600;
    font-size: 1.125rem;
}

.score {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary);
}

.round-info {
    text-align: center;
    font-size: 0.875rem;
    color: var(--primary-foreground);
    margin: 1rem 0;
}

/* End Screen */
.winner-text {
    font-size: 1.5rem;
    font-weight: bold;
    margin-top: 1rem;
}

.winner-score {
    font-size: 1.125rem;
    color: var(--muted-foreground);
    margin-top: 0.5rem;
}

/* Confetti */
.confetti {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 50;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    width: 12px;
    height: 12px;
    top: -20px;
    animation: fall 3s linear infinite;
}

@keyframes fall {
    to {
        transform: translateY(100vh) rotate(360deg);
    }
}

/* Responsive */
@media (max-width: 640px) {
    .card {
        padding: 1.5rem;
    }

    .word-card h1 {
        font-size: 2rem;
    }

    .timer-display span {
        font-size: 2.5rem;
    }
}

@media (min-width: 768px) {
    .word-card h1 {
        font-size: 4rem;
    }
}