* {
    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;
    --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;
}

/* Add Player Button */
.btn-add-player {
    background: transparent;
    border: 2px solid var(--accent-pink);
    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-player:hover {
    background: var(--accent-pink);
    transform: scale(1.02);
}

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

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

.player-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); }
}

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

.player-icon.filled {
    background: var(--accent-pink);
}

.player-icon.empty {
    background: var(--bg-secondary);
    border: 1px solid var(--text-secondary);
}

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

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

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

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

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

/* Toggle */
.toggle-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    gap: 12px;
}

.toggle {
    position: relative;
    width: 52px;
    height: 28px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-card);
    border-radius: 28px;
    transition: 0.3s;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle input:checked + .toggle-slider {
    background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-pink) 100%);
}

.toggle input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

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

/* Play Button */
.btn-play {
    width: 100%;
    background: linear-gradient(135deg, var(--accent-pink) 0%, var(--accent-pink-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, 59, 111, 0.3);
}

.btn-play:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(255, 59, 111, 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;
}

/* 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;
}

/* Words Screen */
.subtitle {
    text-align: center;
    color: var(--accent-pink);
    font-size: 18px;
    margin-bottom: 30px;
}

.words-input-container {
    flex: 1;
    overflow-y: auto;
}

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

.word-input-item {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border-radius: 16px;
    padding: 16px;
}

.word-number {
    width: 32px;
    height: 32px;
    background: var(--bg-secondary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 16px;
    font-size: 14px;
    color: var(--text-secondary);
}

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

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

/* Ready Screen */
.explaining-player {
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    color: var(--accent-pink);
    margin: 10px 0;
}

.guessing-player {
    text-align: center;
    color: var(--text-secondary);
    font-size: 16px;
}

/* Game Screen */
#game-screen {
    align-items: center;
    justify-content: center;
    gap: 40px;
}

.timer-container {
    position: relative;
    width: 150px;
    height: 150px;
}

.timer-svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.timer-bg {
    fill: none;
    stroke: var(--bg-card);
    stroke-width: 8;
}

.timer-progress {
    fill: none;
    stroke: url(#timer-gradient);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear;
}

.timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    font-weight: 700;
}

.word-card {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-secondary) 100%);
    padding: 40px 60px;
    border-radius: 24px;
    text-align: center;
    min-width: 280px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

#current-word {
    font-size: 28px;
    font-weight: 600;
}

.game-buttons {
    display: flex;
    gap: 40px;
}

.btn-wrong, .btn-correct {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: none;
    font-size: 36px;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

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

.btn-wrong:hover, .btn-correct:hover {
    transform: scale(1.1);
}

.btn-wrong:active, .btn-correct:active {
    transform: scale(0.95);
}

/* Round Results */
.round-stats {
    display: flex;
    justify-content: center;
    gap: 60px;
    margin: 30px 0;
}

.stat {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 48px;
    font-weight: 700;
    color: var(--accent-pink);
}

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

.guessed-words {
    flex: 1;
    overflow-y: auto;
    margin: 20px 0;
}

.guessed-word-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-card);
    border-radius: 12px;
    margin-bottom: 8px;
}

.guessed-word-item.correct {
    border-left: 3px solid var(--success);
}

.guessed-word-item.skipped {
    border-left: 3px solid var(--error);
}

.word-status {
    font-size: 18px;
}

/* Final Results */
.final-results {
    flex: 1;
    overflow-y: auto;
}

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

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

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

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

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

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

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

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

/* Gradient for timer */
svg defs {
    position: absolute;
}

/* 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-pink);
    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-pink) 0%, var(--accent-pink-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, 59, 111, 0.3);
}

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

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

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

    .timer-container {
        width: 120px;
        height: 120px;
    }

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

    .word-card {
        padding: 30px 40px;
    }

    #current-word {
        font-size: 24px;
    }
}
