:root {
    /* Color Palette */
    --bg-dark: #0a0b10;
    --surface-dark: #161822;
    --surface-light: #242736;
    --surface-highlight: #31354a;

    --text-primary: #ffffff;
    --text-secondary: #9499ab;
    --text-muted: #5e6378;

    --accent-primary: #0077ff;
    --accent-glow: rgba(0, 119, 255, 0.4);
    --accent-adult: #0077ff;
    --accent-adult-glow: rgba(0, 119, 255, 0.4);
    --accent-firstdate: #e07a5f;
    --accent-date: #e63946;
    --accent-office: #457b9d;
    --accent-girls: #ff006e;
    --accent-boys: #3a86ff;

    --border-radius-sm: 12px;
    --border-radius-md: 16px;
    --border-radius-lg: 24px;

    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --transition-bounce: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Player Colors - vibrant palette */
    --p1: #ef476f;
    --p2: #ffd166;
    --p3: #06d6a0;
    --p4: #118ab2;
    --p5: #073b4c;
    --p6: #7209b7;
    --p7: #f15bb5;
    --p8: #00f5d4;
    --p9: #fca311;
    --p10: #4361ee;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
    overscroll-behavior-y: none;
    height: 100vh;
    height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    width: 100%;
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--surface-highlight);
    border-radius: 10px;
}

/* App Container (Mobile bounds on desktop) */
#app {
    width: 100%;
    max-width: 480px;
    height: 100%;
    position: relative;
    background: var(--bg-dark);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
    overflow: hidden;
}

/* Screen Transitions */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 32px 24px 48px;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(0.98);
    transition: opacity var(--transition-normal), transform var(--transition-normal);
    z-index: 1;
}

.screen > * {
    flex-shrink: 0;
}

.screen.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
    z-index: 2;
}

.screen.hidden {
    display: none !important;
}

.hidden {
    display: none !important;
}

/* Typography elements */
h1,
h2,
h3,
h4,
h5 {
    font-weight: 800;
    line-height: 1.2;
}

p {
    line-height: 1.5;
}

.text-center {
    text-align: center;
}

.header {
    margin-bottom: 24px;
}

.header h2 {
    font-size: 28px;
    margin-bottom: 4px;
}

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

/* Buttons */
.btn {
    width: 100%;
    padding: 18px 24px;
    border: none;
    border-radius: var(--border-radius-md);
    font-size: 18px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
    outline: none;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.btn:active {
    transform: scale(0.96);
}

.btn:disabled {
    opacity: 0.4;
    pointer-events: none;
    filter: grayscale(100%);
}

.btn.primary {
    background: var(--accent-primary);
    color: #fff;
    box-shadow: 0 6px 20px var(--accent-glow);
}

.btn.primary.glow:active {
    box-shadow: 0 0 30px var(--accent-glow);
}

.btn.secondary {
    background: var(--surface-dark);
    color: var(--text-primary);
    border: 2px solid var(--surface-light);
}

.btn.secondary:active {
    background: var(--surface-light);
}

.button-group {
    display: flex;
    gap: 12px;
    margin-top: auto;
    padding-top: 24px;
    position: relative;
    z-index: 10;
    background: linear-gradient(to top, var(--bg-dark) 80%, transparent);
}

.sticky-bottom {
    margin-top: auto;
}

/* Specific Screen: Start */
.logo-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.logo {
    font-size: 56px;
    letter-spacing: -2px;
    font-weight: 900;
}

.accent {
    color: var(--accent-primary);
}

.subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    margin-top: 12px;
    text-align: center;
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0px var(--accent-glow);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(247, 37, 133, 0);
    }

    100% {
        box-shadow: 0 0 0 0px rgba(247, 37, 133, 0);
    }
}

/* Specific Screen: Setup */
.player-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    overflow-y: auto;
    padding-bottom: 24px;
    margin-top: 12px;
}

.scrollable-area {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 24px;
}

.player-input-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface-dark);
    padding: 12px;
    border-radius: var(--border-radius-md);
    border: 2px solid transparent;
    transition: border-color var(--transition-fast);
    animation: slideIn 0.3s ease;
}

.player-input-row:focus-within {
    border-color: var(--surface-highlight);
}

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

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.color-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

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

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

.btn-remove {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 0 8px;
}

.btn-remove:active {
    color: #ff4d4f;
}


/* Specific Screen: Settings */
.settings-group {
    margin-bottom: 32px;
}

.settings-group h3 {
    font-size: 16px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.option-card {
    background: var(--surface-dark);
    border: 2px solid var(--surface-light);
    border-radius: var(--border-radius-md);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.badge-new {
    position: absolute;
    top: -6px;
    right: -6px;
    background: linear-gradient(135deg, #f72585, #7209b7);
    color: white;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    padding: 4px 8px;
    border-radius: 12px;
    letter-spacing: 1px;
    box-shadow: 0 4px 12px rgba(247, 37, 133, 0.4);
    z-index: 2;
    border: 2px solid var(--bg-dark);
}

.option-card .emoji {
    font-size: 32px;
    width: 48px;
    text-align: center;
}

.option-card h4 {
    font-size: 18px;
    margin-bottom: 4px;
}

.option-card p {
    font-size: 14px;
    color: var(--text-secondary);
}

.option-card.active {
    border-color: var(--accent-primary);
    background: rgba(247, 37, 133, 0.1);
}

.option-card.adult.active {
    border-color: var(--accent-adult);
    background: rgba(114, 9, 183, 0.1);
}

.option-card[data-value="firstdate"].active { border-color: var(--accent-firstdate); background: rgba(224, 122, 95, 0.1); }
.option-card[data-value="date"].active { border-color: var(--accent-date); background: rgba(230, 57, 70, 0.1); }
.option-card[data-value="office"].active { border-color: var(--accent-office); background: rgba(69, 123, 157, 0.1); }
.option-card[data-value="girls"].active { border-color: var(--accent-girls); background: rgba(255, 0, 110, 0.1); }
.option-card[data-value="boys"].active { border-color: var(--accent-boys); background: rgba(58, 134, 255, 0.1); }

.option-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(100%);
}

.options-row {
    display: flex;
    gap: 12px;
}

.option-pill {
    flex: 1;
    background: var(--surface-dark);
    border: 2px solid var(--surface-light);
    border-radius: var(--border-radius-md);
    padding: 16px 0;
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.option-pill.active {
    border-color: var(--accent-primary);
    background: rgba(247, 37, 133, 0.1);
    color: var(--accent-primary);
}

/* Specific Screen: Pass Phone */
.center-all {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.icon-pulse {
    font-size: 64px;
    margin-bottom: 24px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }

    100% {
        transform: translateY(0px);
    }
}

.dynamic-name {
    font-size: 40px;
    margin: 8px 0 24px;
    padding: 4px 16px;
    border-radius: 8px;
}

.instruction {
    font-size: 18px;
    color: var(--text-secondary);
    max-width: 80%;
}

/* Specific Screen: Voting */
.voting-header {
    margin-bottom: 24px;
}

.progress-bar-container {
    width: 100%;
    height: 6px;
    background: var(--surface-light);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-bar {
    height: 100%;
    background: var(--accent-primary);
    width: 0%;
    transition: width 0.4s ease;
}

.round-counter {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
}

.question {
    font-size: 28px;
    line-height: 1.3;
}

.turn-indicator {
    background: var(--surface-dark);
    padding: 12px 16px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 24px;
    text-align: center;
    border-left: 4px solid var(--accent-primary);
}

.highlight-small {
    font-weight: 700;
}

.voting-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-content: start;
}

.vote-card {
    background: var(--surface-dark);
    border: 2px solid var(--surface-light);
    border-radius: var(--border-radius-md);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    transition: transform var(--transition-fast), background var(--transition-fast);
}

.vote-card:active {
    transform: scale(0.95);
    background: var(--surface-light);
}

.vote-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    font-weight: 800;
    color: #fff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.vote-name {
    font-size: 16px;
    font-weight: 700;
    text-align: center;
    word-break: break-word;
}

/* Specific Screen: Reveal */
.overline {
    color: var(--text-secondary);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 12px;
    font-weight: 600;
}

.question-small {
    font-size: 22px;
    color: var(--text-primary);
    line-height: 1.4;
}

.winners-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 24px;
    margin: 32px 0;
}

.winner-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    animation: popIn var(--transition-bounce);
}

@keyframes popIn {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    70% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.winner-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 40px;
    font-weight: 800;
    color: #fff;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    position: relative;
}

.winner-crown {
    position: absolute;
    top: -20px;
    font-size: 32px;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.5));
}

.winner-info {
    text-align: center;
}

.winner-name {
    font-size: 24px;
    font-weight: 800;
}

.winner-votes {
    font-size: 16px;
    color: var(--accent-primary);
    font-weight: 700;
    margin-top: 4px;
}

.challenge-box {
    background: linear-gradient(135deg, rgba(255,255,255,0.05), rgba(255,255,255,0.01));
    border: 2px dashed var(--accent-primary);
    border-radius: var(--border-radius-md);
    padding: 20px;
    margin: 10px 0 30px;
    display: flex;
    align-items: center;
    gap: 16px;
    animation: popIn var(--transition-bounce);
    animation-delay: 0.3s;
    animation-fill-mode: both;
}

.challenge-icon {
    font-size: 36px;
}

.challenge-content h4 {
    color: var(--accent-primary);
    margin-bottom: 4px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.challenge-content p {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
}

.reveal-divider {
    text-align: center;
    font-size: 14px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
    position: relative;
}

.reveal-divider::before,
.reveal-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 25%;
    height: 1px;
    background: var(--surface-light);
}

.reveal-divider::before {
    left: 0;
}

.reveal-divider::after {
    right: 0;
}

.vote-breakdown {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.breakdown-row {
    display: flex;
    justify-content: space-between;
    background: var(--surface-dark);
    padding: 12px 16px;
    border-radius: var(--border-radius-sm);
    font-size: 15px;
}

.breakdown-voter {
    color: var(--text-secondary);
}

.breakdown-target {
    font-weight: 700;
}

/* Specific Screen: Final */
.leaderboard {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
}

.leaderboard-row {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--surface-dark);
    padding: 16px;
    border-radius: var(--border-radius-md);
    position: relative;
    overflow: hidden;
    animation: slideUp 0.5s ease backwards;
}

.leaderboard-row:nth-child(1) {
    animation-delay: 0.1s;
    border: 2px solid #ffd700;
}

.leaderboard-row:nth-child(2) {
    animation-delay: 0.2s;
    border: 2px solid #c0c0c0;
}

.leaderboard-row:nth-child(3) {
    animation-delay: 0.3s;
    border: 2px solid #cd7f32;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.rank-badge {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 8px;
}

.medal {
    font-size: 24px;
    width: 32px;
    text-align: center;
}

.stat-group {
    margin-left: auto;
    text-align: right;
}

.stat-value {
    font-size: 20px;
    font-weight: 800;
}

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