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

:root {
    --bg-primary: #0d1329;
    --bg-secondary: #1a2140;
    --bg-card: #252b4a;
    --accent-pink: #ff3b6f;
    --accent-pink-dark: #cc2f59;
    --accent-blue: #4a6cf7;
    --accent-orange: #ff9500;
    --accent-orange-dark: #e68600;
    --text-primary: #ffffff;
    --text-secondary: #8892b0;
    --text-placeholder: #5a6380;
    --success: #4ade80;
    --error: #f87171;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(180deg, var(--bg-primary) 0%, #0a0f1f 100%);
    min-height: 100vh;
    color: var(--text-primary);
    overflow-x: hidden;
}

.app {
    max-width: 430px;
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
}

.screen {
    display: none;
    flex-direction: column;
    min-height: 100vh;
    padding: 40px 24px;
    animation: fadeIn 0.3s ease;
}

.screen.active {
    display: flex;
}

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

.title {
    font-size: 28px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 30px;
}

/* Back Button */
.btn-back {
    position: absolute;
    top: 40px;
    left: 24px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
}

/* Onboarding Screen */
.onboarding-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: center;
    align-items: center;
    padding-top: 40px;
}

.onboarding-slides {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    position: relative;
}

.onboarding-slide {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px;
    animation: fadeIn 0.4s ease;
}

.onboarding-slide.active {
    display: flex;
}

.slide-icon {
    font-size: 80px;
    margin-bottom: 30px;
}

.slide-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.slide-text {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 300px;
}

.onboarding-dots {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--bg-card);
    cursor: pointer;
    transition: all 0.3s ease;
}

.dot.active {
    background: var(--accent-orange);
    width: 30px;
    border-radius: 5px;
}

.onboarding-buttons {
    display: flex;
    gap: 16px;
    width: 100%;
    max-width: 320px;
}

.btn-skip {
    flex: 1;
    background: transparent;
    border: 2px solid var(--text-secondary);
    color: var(--text-secondary);
    padding: 16px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-skip:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
}

.btn-next-slide {
    flex: 1.5;
    background: linear-gradient(135deg, var(--accent-orange) 0%, var(--accent-orange-dark) 100%);
    border: none;
    color: white;
    padding: 16px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(255, 149, 0, 0.3);
}

.btn-next-slide:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(255, 149, 0, 0.4);
}

/* Add Team Button */
.btn-add-team {
    background: transparent;
    border: 2px solid var(--accent-orange);
    color: var(--text-primary);
    padding: 16px 40px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin: 0 auto 30px;
    display: block;
    transition: all 0.3s ease;
}

.btn-add-team:hover {
    background: var(--accent-orange);
    transform: scale(1.02);
}

.btn-add-team:active {
    transform: scale(0.98);
}

/* Teams List */
.teams-list {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 20px;
}

.team-item {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

.team-color {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 16px;
    font-size: 20px;
}

.team-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 18px;
    outline: none;
}

.team-input::placeholder {
    color: var(--text-placeholder);
}

.team-remove {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    transition: color 0.2s;
}

.team-remove:hover {
    color: var(--accent-pink);
}

/* Settings Row */
.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 0 10px;
}

.settings-label {
    color: var(--text-secondary);
    font-size: 16px;
}

.score-selector {
    display: flex;
    align-items: center;
    gap: 16px;
}

.score-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--accent-orange);
    background: transparent;
    color: var(--accent-orange);
    font-size: 24px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.score-btn:hover {
    background: var(--accent-orange);
    color: white;
}

.score-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    min-width: 40px;
    text-align: center;
}

/* Bottom Section */
.bottom-section {
    padding: 20px 0;
    margin-top: auto;
}

/* Play Button */
.btn-play {
    width: 100%;
    background: linear-gradient(135deg, var(--accent-orange) 0%, var(--accent-orange-dark) 100%);
    border: none;
    color: white;
    padding: 18px;
    border-radius: 30px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(255, 149, 0, 0.3);
}

.btn-play:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(255, 149, 0, 0.4);
}

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

.btn-play:disabled {
    background: var(--bg-card);
    box-shadow: none;
    cursor: not-allowed;
}

.play-icon {
    font-size: 20px;
}

/* Turn Screen */
.team-turn-card {
    background: linear-gradient(135deg, var(--accent-orange) 0%, var(--accent-orange-dark) 100%);
    padding: 40px;
    border-radius: 24px;
    text-align: center;
    margin: 40px 0;
    box-shadow: 0 8px 32px rgba(255, 149, 0, 0.3);
}

.team-turn-name {
    font-size: 32px;
    font-weight: 700;
    color: white;
}

.turn-hint {
    text-align: center;
    color: var(--text-secondary);
    font-size: 16px;
    line-height: 1.5;
}

/* Game Screen */
.game-header {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.team-indicator {
    background: var(--accent-orange);
    color: white;
    padding: 8px 24px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

.question-card {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-secondary) 100%);
    padding: 30px;
    border-radius: 24px;
    text-align: center;
    margin: 20px 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.question-prefix {
    display: block;
    font-size: 18px;
    color: var(--accent-orange);
    margin-bottom: 12px;
}

.question-text {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.4;
}

/* Timer */
.timer-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 30px 0;
}

.timer-balls {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.timer-ball {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-orange);
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 149, 0, 0.4);
}

.timer-ball.empty {
    background: var(--bg-card);
    box-shadow: none;
}

.timer-text {
    font-size: 72px;
    font-weight: 700;
    color: var(--accent-orange);
}

.timer-text.urgent {
    color: var(--error);
    animation: pulse 0.5s ease infinite;
}

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

/* Game Buttons */
.game-buttons {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

.btn-fail, .btn-success {
    flex: 1;
    padding: 18px;
    border-radius: 16px;
    border: none;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

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

.btn-fail:hover, .btn-success:hover {
    transform: scale(1.02);
}

.btn-fail:active, .btn-success:active {
    transform: scale(0.98);
}

/* Start Timer Section */
.start-timer-section {
    margin-top: auto;
    padding: 20px 0;
}

.btn-start-timer {
    width: 100%;
    background: linear-gradient(135deg, var(--accent-orange) 0%, var(--accent-orange-dark) 100%);
    border: none;
    color: white;
    padding: 20px;
    border-radius: 30px;
    font-size: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(255, 149, 0, 0.3);
}

.btn-start-timer:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(255, 149, 0, 0.4);
}

/* Result Screen */
.result-icon {
    font-size: 100px;
    text-align: center;
    margin: 20px 0;
}

.result-icon.success {
    color: var(--success);
}

.result-icon.fail {
    color: var(--error);
}

.result-title {
    font-size: 36px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 10px;
}

.result-title.success {
    color: var(--success);
}

.result-title.fail {
    color: var(--error);
}

.result-team {
    text-align: center;
    color: var(--text-secondary);
    font-size: 18px;
    margin-bottom: 30px;
}

/* Scoreboard */
.scoreboard {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 20px;
    margin: 20px 0;
}

.scoreboard-title {
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.scoreboard-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.score-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: 12px;
}

.score-item.leading {
    background: linear-gradient(135deg, rgba(255, 149, 0, 0.2) 0%, rgba(255, 149, 0, 0.1) 100%);
    border: 1px solid var(--accent-orange);
}

.score-team-name {
    font-size: 16px;
    font-weight: 600;
}

.score-points {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent-orange);
}

/* Final Screen */
.winner-icon {
    font-size: 100px;
    text-align: center;
    margin: 20px 0;
}

.winner-name {
    font-size: 32px;
    font-weight: 700;
    text-align: center;
    color: var(--accent-orange);
    margin-bottom: 30px;
}

.final-scores {
    flex: 1;
    overflow-y: auto;
}

.final-score-item {
    display: flex;
    align-items: center;
    padding: 16px;
    background: var(--bg-card);
    border-radius: 16px;
    margin-bottom: 12px;
}

.final-position {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin-right: 16px;
}

.final-position.gold {
    background: linear-gradient(135deg, #ffd700 0%, #ffb700 100%);
    color: #1a1a1a;
}

.final-position.silver {
    background: linear-gradient(135deg, #c0c0c0 0%, #a0a0a0 100%);
    color: #1a1a1a;
}

.final-position.bronze {
    background: linear-gradient(135deg, #cd7f32 0%, #a05a20 100%);
    color: #1a1a1a;
}

.final-position.other {
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.final-team-name {
    flex: 1;
    font-size: 18px;
}

.final-score {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent-orange);
}

/* Responsive */
@media (max-height: 700px) {
    .screen {
        padding: 20px;
    }

    .title {
        font-size: 24px;
        margin-bottom: 20px;
    }

    .slide-icon {
        font-size: 60px;
        margin-bottom: 20px;
    }

    .timer-ball {
        width: 32px;
        height: 32px;
    }

    .timer-text {
        font-size: 56px;
    }

    .question-card {
        padding: 20px;
    }

    .question-text {
        font-size: 20px;
    }
}
