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

:root {
    --bg-primary: #0d1329;
    --bg-secondary: #1a2140;
    --bg-card: #252b4a;
    --accent-red: #e53935;
    --accent-red-dark: #c62828;
    --onboarding-accent: var(--accent-red);
    --onboarding-accent-dark: var(--accent-red-dark);
    --onboarding-shadow: rgba(229, 57, 53, 0.3);
    --onboarding-shadow-hover: rgba(229, 57, 53, 0.4);
    --accent-purple: #7c4dff;
    --accent-purple-dark: #651fff;
    --text-primary: #ffffff;
    --text-secondary: #8892b0;
    --text-placeholder: #5a6380;
    --success: #4ade80;
    --error: #f87171;
    --warning: #fbbf24;
    --settings-accent: var(--accent-red);
    --settings-accent-dark: var(--accent-red-dark);
}

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;
    min-height: var(--app-height, 100dvh);
    color: var(--text-primary);
    overflow-x: hidden;
}

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

.screen {
    display: none;
    flex-direction: column;
    min-height: 100vh;
    min-height: var(--app-height, 100dvh);
    padding: 40px 24px;
    padding-top: calc(40px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    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: calc(40px + env(safe-area-inset-top, 0px));
    left: 24px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    z-index: 10;
}

/* Taboo animated onboarding */
.taboo-onboarding {
    padding-top: 16px;
}

.taboo-onboarding .onboarding-slides {
    align-items: stretch;
    padding-top: 0;
}

.taboo-onboarding .onboarding-slide {
    width: 100%;
    max-width: 360px;
    padding: 4px 4px 0;
    animation: none;
}

.taboo-onboarding .onboarding-slide.active.slide-in-left,
.taboo-onboarding .onboarding-slide.active.slide-in-right {
    animation: none;
}

.taboo-remotion-stage {
    position: relative;
    width: min(100%, 320px);
    height: 268px;
    margin: 0 auto 10px;
    overflow: hidden;
    border-radius: 28px;
    background:
        linear-gradient(155deg, rgba(48, 57, 102, 0.96), rgba(18, 24, 50, 0.96)),
        repeating-linear-gradient(135deg, rgba(255,255,255,0.06) 0 1px, transparent 1px 18px);
    box-shadow:
        inset 0 0 0 1px rgba(255,255,255,0.08),
        0 22px 46px rgba(0,0,0,0.28);
    isolation: isolate;
}

.taboo-remotion-stage::before {
    content: '';
    position: absolute;
    inset: 18px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 22px;
    pointer-events: none;
}

.taboo-remotion-stage > div,
.taboo-remotion-fill {
    width: 100%;
    height: 100%;
}

.taboo-motion-layer {
    position: absolute;
    inset: 0;
}

.taboo-motion-asset {
    position: absolute;
    display: block;
    height: auto;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    transform-origin: center;
    will-change: transform, opacity;
    filter: drop-shadow(0 14px 18px rgba(0,0,0,0.28));
}

.taboo-motion-asset-timer,
.taboo-motion-asset-score,
.taboo-motion-asset-answer {
    filter: drop-shadow(0 10px 14px rgba(0,0,0,0.22));
}

.taboo-scene-caption {
    width: min(100%, 320px);
    min-height: 28px;
    margin: 0 auto 12px;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(229, 57, 53, 0.14);
    color: #ffb4b0;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0;
}

.taboo-onboarding .slide-title {
    font-size: 22px;
    line-height: 1.16;
    max-width: 340px;
    margin-bottom: 10px;
}

.taboo-onboarding .slide-text {
    max-width: 340px;
    min-height: 50px;
    line-height: 1.45;
}

@media (max-width: 380px) {
    .taboo-remotion-stage {
        width: min(100%, 294px);
        height: 247px;
    }

    .taboo-scene-caption {
        width: min(100%, 294px);
        font-size: 11px;
    }
}

@media (max-height: 700px) {
    .taboo-onboarding {
        padding-top: 6px;
    }

    .taboo-remotion-stage {
        width: min(100%, 284px);
        height: 239px;
        margin-bottom: 8px;
    }

    .taboo-scene-caption {
        width: min(100%, 284px);
        min-height: 24px;
        margin-bottom: 8px;
        padding: 6px 10px;
        font-size: 11px;
    }

    .taboo-onboarding .slide-title {
        font-size: 20px;
        margin-bottom: 8px;
    }

    .taboo-onboarding .slide-text {
        min-height: 46px;
    }
}

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

/* 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-red);
    background: transparent;
    color: var(--accent-red);
    font-size: 24px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (hover: hover) {
    .score-btn:hover {
        background: var(--accent-red);
        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-red) 0%, var(--accent-red-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(229, 57, 53, 0.3);
}

@media (hover: hover) {
    .btn-play:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 25px rgba(229, 57, 53, 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-red) 0%, var(--accent-red-dark) 100%);
    padding: 40px;
    border-radius: 24px;
    text-align: center;
    margin: 40px 0;
    box-shadow: 0 8px 32px rgba(229, 57, 53, 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;
    margin-bottom: 10px;
}

.turn-hint.secondary {
    color: var(--accent-red);
    font-weight: 600;
}

/* Game Screen */
#game-screen {
    padding-top: calc(40px + env(safe-area-inset-top, 0px));
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-left: 48px;
}

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

.timer-display {
    background: var(--bg-card);
    padding: 8px 20px;
    border-radius: 20px;
}

.timer-text {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

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

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

/* Taboo Card */
.taboo-card {
    background: linear-gradient(180deg, #fff9c4 0%, #fff59d 100%);
    border-radius: 20px;
    padding: 24px;
    margin: 10px 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.main-word {
    font-size: 32px;
    font-weight: 800;
    text-align: center;
    color: #1a237e;
    text-transform: uppercase;
    padding: 16px;
    letter-spacing: 2px;
}

.taboo-divider {
    display: flex;
    align-items: center;
    margin: 16px 0;
}

.taboo-divider::before,
.taboo-divider::after {
    content: '';
    flex: 1;
    height: 2px;
    background: var(--accent-red);
}

.taboo-label {
    background: var(--accent-red);
    color: white;
    padding: 6px 16px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 2px;
    margin: 0 12px;
}

.taboo-words {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.taboo-word {
    font-size: 18px;
    font-weight: 600;
    color: var(--accent-red-dark);
    text-align: center;
    padding: 8px;
    text-transform: uppercase;
}

/* Round Score */
.round-score {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin: 20px 0;
}

.round-score-item {
    text-align: center;
}

.round-score-value {
    display: block;
    font-size: 36px;
    font-weight: 700;
}

.round-score-item.correct .round-score-value {
    color: var(--success);
}

.round-score-item.wrong .round-score-value {
    color: var(--error);
}

.round-score-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
}

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

.btn-taboo, .btn-correct {
    flex: 1;
    padding: 16px 8px;
    border-radius: 16px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

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

@media (hover: hover) {
    .btn-taboo:hover, .btn-correct:hover {
        transform: scale(1.02);
    }
}

.btn-taboo:active, .btn-correct:active {
    transform: scale(0.98);
}

/* Result Screen */
.result-summary {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 24px;
    text-align: center;
    margin-bottom: 20px;
}

.result-team-name {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent-red);
    margin-bottom: 8px;
}

.result-points {
    font-size: 36px;
    font-weight: 800;
    color: var(--success);
}

.result-points.negative {
    color: var(--error);
}

.round-words-list {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 20px;
}

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

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

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

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

.round-word-text {
    font-size: 16px;
}

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

/* 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(229, 57, 53, 0.2) 0%, rgba(229, 57, 53, 0.1) 100%);
    border: 1px solid var(--accent-red);
}

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

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

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

/* ===== Pause Button & Overlay ===== */
.btn-pause {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-secondary);
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

@media (hover: hover) {
    .btn-pause:hover {
        background: rgba(255, 255, 255, 0.2);
        color: var(--text-primary);
    }
}

#game-screen {
    position: relative;
}

.pause-overlay {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(13, 19, 41, 0.95);
    z-index: 50;
    align-items: center;
    justify-content: center;
}

.pause-overlay.active {
    display: flex;
    cursor: pointer;
}

.pause-overlay-text {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-secondary);
}

.btn-correct:disabled,
.btn-taboo:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .app {
        max-width: 100%;
    }

    .screen {
        padding: 20px 12px;
        padding-top: calc(20px + env(safe-area-inset-top, 0px));
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }

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

    .taboo-onboarding {
        padding-top: 20px;
    }

    .taboo-remotion-stage {
        height: 248px;
        margin-bottom: 16px;
        border-radius: 22px;
    }

    .taboo-remotion-stage::before {
        inset: 14px;
        border-radius: 18px;
    }

    .taboo-onboarding .slide-title {
        font-size: 20px;
        margin-bottom: 10px;
    }

    .taboo-onboarding .slide-text {
        min-height: 68px;
        max-width: 300px;
    }

    .btn-play {
        padding: 16px;
        font-size: 16px;
    }

    .taboo-card {
        padding: 16px 12px;
    }

    .main-word {
        font-size: 24px;
        padding: 12px;
        letter-spacing: 1px;
    }

    .taboo-label {
        padding: 4px 12px;
        font-size: 10px;
    }

    .taboo-words {
        gap: 6px;
    }

    .taboo-word {
        font-size: 14px;
        padding: 6px;
    }

    .round-score {
        gap: 30px;
        margin: 16px 0;
    }

    .round-score-value {
        font-size: 28px;
    }

    .round-score-label {
        font-size: 11px;
    }

    .game-buttons {
        gap: 10px;
        padding: 16px 0;
    }

    .btn-taboo, .btn-correct {
        padding: 12px 6px;
        font-size: 12px;
    }

    .result-summary {
        border-radius: 16px;
        padding: 16px;
        margin-bottom: 16px;
    }

    .result-team-name {
        font-size: 18px;
        margin-bottom: 6px;
    }

    .result-points {
        font-size: 28px;
    }

    .round-words-list {
        max-height: 150px;
        margin-bottom: 16px;
    }

    .round-word-item {
        padding: 8px 12px;
        margin-bottom: 6px;
    }

    .round-word-text {
        font-size: 14px;
    }

    .round-word-status {
        font-size: 14px;
    }

    .scoreboard {
        border-radius: 16px;
        padding: 16px;
        margin: 16px 0;
    }

    .scoreboard-title {
        font-size: 16px;
        margin-bottom: 12px;
    }

    .scoreboard-list {
        gap: 10px;
    }

    .score-item {
        padding: 10px 12px;
    }

    .score-team-name {
        font-size: 14px;
    }

    .score-points {
        font-size: 18px;
    }

    .winner-icon {
        font-size: 60px;
        margin: 12px 0;
    }

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

    .final-score-item {
        padding: 12px;
        margin-bottom: 10px;
    }

    .final-position {
        width: 36px;
        height: 36px;
        font-size: 13px;
        margin-right: 12px;
    }

    .final-team-name {
        font-size: 16px;
    }

    .final-score {
        font-size: 18px;
    }
}

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

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

    .taboo-card {
        padding: 16px;
    }

    .main-word {
        font-size: 26px;
        padding: 12px;
    }

    .taboo-word {
        font-size: 16px;
        padding: 6px;
    }

    .game-buttons {
        padding: 10px 0;
    }
}

@media (max-height: 600px) {
    .taboo-remotion-stage {
        height: 188px;
        margin-bottom: 10px;
    }

    .taboo-onboarding .slide-title {
        font-size: 18px;
        margin-bottom: 8px;
    }

    .taboo-onboarding .slide-text {
        min-height: 48px;
    }

    .taboo-onboarding .onboarding-dots {
        margin-bottom: 14px;
    }

    .taboo-words {
        gap: 4px;
    }

    .taboo-word {
        font-size: 14px;
        padding: 4px;
    }

    .round-score {
        margin: 10px 0;
    }

    .round-score-value {
        font-size: 28px;
    }
}

/* Tablet and larger */
@media (min-width: 768px) {
    .app {
        max-width: 100%;
    }

    .screen {
        padding: 50px 40px;
    }

    .title {
        font-size: 32px;
        margin-bottom: 40px;
    }

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

    .main-word {
        font-size: 40px;
        padding: 24px;
    }

    .taboo-words {
        gap: 12px;
    }

    .taboo-word {
        font-size: 22px;
        padding: 12px;
    }

    .round-score-value {
        font-size: 48px;
    }

    .btn-taboo, .btn-correct {
        padding: 20px 12px;
        font-size: 16px;
    }

    .winner-name {
        font-size: 40px;
    }
}
