/* ===== RESET & BASE ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0a12;
    --bg-secondary: #12121f;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.08);
    --glass: rgba(255, 255, 255, 0.06);
    --glass-border: rgba(255, 255, 255, 0.1);
    --primary: #7c5cfc;
    --primary-glow: rgba(124, 92, 252, 0.3);
    --secondary: #00d2d3;
    --secondary-glow: rgba(0, 210, 211, 0.3);
    --accent: #ff6b81;
    --accent-glow: rgba(255, 107, 129, 0.3);
    --yellow: #feca57;
    --green: #55efc4;
    --text: #f0f0f0;
    --text-muted: #8892b0;
    --text-dim: #5a6380;
    --radius: 16px;
    --radius-sm: 10px;
    --radius-lg: 24px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
    --max-width: 1200px;
}

html {
    scroll-behavior: smooth;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

button {
    cursor: pointer;
    font-family: var(--font);
    border: none;
    outline: none;
}

input, textarea {
    font-family: var(--font);
    outline: none;
    border: none;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

/* ===== BACKGROUND EFFECTS ===== */
.bg-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bg-glow::before {
    content: '';
    position: absolute;
    top: -200px;
    left: -200px;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
    animation: floatGlow 12s ease-in-out infinite;
}

.bg-glow::after {
    content: '';
    position: absolute;
    bottom: -200px;
    right: -200px;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--secondary-glow) 0%, transparent 70%);
    animation: floatGlow 15s ease-in-out infinite reverse;
}

@keyframes floatGlow {
    0%, 100% { transform: translate(0, 0); }
    33% { transform: translate(100px, 50px); }
    66% { transform: translate(-50px, 100px); }
}

/* ===== NAVBAR ===== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(10, 10, 18, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    transition: var(--transition);
}

.nav-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.nav-logo .logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.nav-logo span {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
}

.nav-links a {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: var(--transition);
    position: relative;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text);
    background: var(--bg-card);
}

.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background: var(--primary);
    border-radius: 1px;
}

/* Mobile Menu Toggle */
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    padding: 8px;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: var(--transition);
}

.nav-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.active span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ===== MOBILE NAV ===== */
@media (max-width: 768px) {
    .navbar {
        overflow: visible;
    }

    .nav-toggle {
        display: flex;
    }

    .nav-links {
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        z-index: 9999;
        background: rgba(10, 10, 18, 0.98);
        padding: 20px;
        gap: 16px;
        border-bottom: 1px solid var(--glass-border);
        list-style: none;
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        transition: max-height 0.35s ease, opacity 0.25s ease, padding 0.35s ease;
        padding-top: 0;
        padding-bottom: 0;
    }

    .nav-links.open {
        display: flex;
        max-height: 300px;
        opacity: 1;
        padding-top: 20px;
        padding-bottom: 20px;
    }

    .nav-links a {
        width: 100%;
        padding: 14px 16px;
        font-size: 1rem;
    }
}

/* ===== MAIN CONTENT ===== */
.main-content {
    position: relative;
    z-index: 1;
    padding-top: 64px;
}

/* ===== HERO SECTION ===== */
.hero {
    min-height: calc(100vh - 64px);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 20px;
}

.hero-content {
    max-width: 700px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    font-size: 0.85rem;
    color: var(--secondary);
    margin-bottom: 28px;
    animation: fadeInUp 0.6s ease;
}

.hero-badge .pulse {
    width: 8px;
    height: 8px;
    background: var(--secondary);
    border-radius: 50%;
    animation: pulse 2s ease infinite;
}

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

.hero h1 {
    font-size: clamp(2.2rem, 6vw, 3.8rem);
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 20px;
    letter-spacing: -1px;
    animation: fadeInUp 0.6s ease 0.1s both;
}

.hero h1 .gradient-text {
    background: linear-gradient(135deg, var(--primary), var(--accent), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    color: var(--text-muted);
    margin-bottom: 40px;
    max-width: 540px;
    margin-left: auto;
    margin-right: auto;
    animation: fadeInUp 0.6s ease 0.2s both;
}

.hero-buttons {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
    animation: fadeInUp 0.6s ease 0.3s both;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #9b6dff);
    color: #fff;
    box-shadow: 0 4px 20px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--primary-glow);
}

.btn-secondary {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--text);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    transform: translateY(-2px);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent), #ff8e9e);
    color: #fff;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--accent-glow);
}

.btn-teal {
    background: linear-gradient(135deg, var(--secondary), #26d9d9);
    color: #0a0a12;
    font-weight: 700;
    box-shadow: 0 4px 20px var(--secondary-glow);
}

.btn-teal:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--secondary-glow);
}

.btn-lg {
    padding: 16px 36px;
    font-size: 1.1rem;
    border-radius: var(--radius-lg);
}

.btn-sm {
    padding: 10px 20px;
    font-size: 0.85rem;
}

.btn-full {
    width: 100%;
    justify-content: center;
}

.btn-icon {
    width: 48px;
    height: 48px;
    padding: 0;
    justify-content: center;
    border-radius: 12px;
}

.btn:active {
    transform: translateY(0) scale(0.98);
}

/* ===== SECTION ===== */
.section {
    padding: 80px 20px;
    max-width: var(--max-width);
    margin: 0 auto;
}

.section-header {
    text-align: center;
    margin-bottom: 50px;
}

.section-header h2 {
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    font-weight: 800;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.section-header p {
    color: var(--text-muted);
    font-size: 1.05rem;
    max-width: 500px;
    margin: 0 auto;
}

/* ===== CARDS ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 32px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, 0.15);
}

.card-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 20px;
}

.card-icon.purple { background: rgba(124, 92, 252, 0.15); }
.card-icon.teal { background: rgba(0, 210, 211, 0.15); }
.card-icon.pink { background: rgba(255, 107, 129, 0.15); }
.card-icon.yellow { background: rgba(254, 202, 87, 0.15); }
.card-icon.green { background: rgba(85, 239, 196, 0.15); }

.card h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.card p {
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.6;
}

/* ===== GRID LAYOUTS ===== */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

@media (max-width: 768px) {
    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
    }
}

/* ===== HOW IT WORKS ===== */
.steps {
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 600px;
    margin: 0 auto;
}

.step {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    transition: var(--transition);
}

.step:hover {
    background: var(--bg-card-hover);
}

.step-number {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    font-size: 1.1rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

.step h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.step p {
    font-size: 0.88rem;
    color: var(--text-muted);
}

/* ===== GAME CARDS ===== */
.game-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition);
    cursor: pointer;
}

.game-card:hover {
    transform: translateY(-6px);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: var(--shadow);
}

.game-card-preview {
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    position: relative;
    overflow: hidden;
}

.game-card-preview.circle-bg {
    background: linear-gradient(135deg, rgba(124, 92, 252, 0.1), rgba(255, 107, 129, 0.1));
}

.game-card-preview.wheel-bg {
    background: linear-gradient(135deg, rgba(254, 202, 87, 0.1), rgba(255, 107, 129, 0.1));
}

.game-card-preview.race-bg {
    background: linear-gradient(135deg, rgba(0, 210, 211, 0.1), rgba(85, 239, 196, 0.1));
}

.game-card-body {
    padding: 24px;
}

.game-card-body h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.game-card-body p {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-bottom: 16px;
}

.game-tag {
    display: inline-block;
    padding: 4px 12px;
    background: var(--glass);
    border-radius: 50px;
    font-size: 0.75rem;
    color: var(--secondary);
    border: 1px solid rgba(0, 210, 211, 0.2);
}

/* ===== SETUP PAGE ===== */
.setup-page {
    min-height: calc(100vh - 64px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 20px 40px;
}

.setup-container {
    width: 100%;
    max-width: 560px;
}

.setup-container h1 {
    font-size: clamp(1.6rem, 4vw, 2.2rem);
    font-weight: 800;
    margin-bottom: 8px;
    text-align: center;
}

.setup-container > p {
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 36px;
}

.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.input-field {
    width: 100%;
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 1rem;
    transition: var(--transition);
}

.input-field:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

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

/* Contestant List */
.contestant-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

.contestant-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    animation: slideIn 0.3s ease;
}

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

.contestant-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.contestant-item .name {
    flex: 1;
    font-weight: 600;
    font-size: 0.95rem;
}

.contestant-item .remove-btn {
    background: none;
    color: var(--text-dim);
    font-size: 1.2rem;
    padding: 4px 8px;
    border-radius: 6px;
    transition: var(--transition);
}

.contestant-item .remove-btn:hover {
    color: var(--accent);
    background: rgba(255, 107, 129, 0.1);
}

.add-row {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
}

.add-row .input-field {
    flex: 1;
}

.contestant-count {
    text-align: center;
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-bottom: 20px;
}

/* ===== GAME PAGE ===== */
.game-page {
    min-height: 100vh;
    padding-top: 64px;
}

.game-header {
    text-align: center;
    padding: 30px 20px 20px;
}

.game-header h1 {
    font-size: clamp(1.4rem, 3vw, 1.8rem);
    font-weight: 800;
    margin-bottom: 8px;
}

.game-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.game-arena {
    display: flex;
    justify-content: center;
    padding: 10px 20px 20px;
}

.game-canvas-wrapper {
    position: relative;
    width: 100%;
    max-width: 600px;
    aspect-ratio: 1;
}

.game-canvas-wrapper canvas {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
    display: block;
}

/* Scoreboard */
.scoreboard {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 20px 40px;
}

.scoreboard h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 14px;
    text-align: center;
}

.score-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.score-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.score-item.winner {
    border-color: var(--yellow);
    background: rgba(254, 202, 87, 0.08);
}

.score-item .rank {
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--text-dim);
    min-width: 28px;
}

.score-item.winner .rank {
    color: var(--yellow);
}

.score-item .score-color {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.score-item .score-name {
    flex: 1;
    font-weight: 600;
    font-size: 0.95rem;
}

.score-item .score-value {
    font-weight: 700;
    color: var(--secondary);
}

/* ===== WHEEL SPECIFIC ===== */
.wheel-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding: 20px;
}

.wheel-wrapper {
    position: relative;
    width: min(80vw, 420px);
    height: min(80vw, 420px);
}

.wheel-wrapper canvas {
    width: 100%;
    height: 100%;
}

.wheel-pointer {
    position: absolute;
    top: -16px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 16px solid transparent;
    border-right: 16px solid transparent;
    border-top: 32px solid var(--yellow);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    z-index: 5;
}

.spin-btn-wrapper {
    display: flex;
    justify-content: center;
}

/* ===== RACE SPECIFIC ===== */
.race-container {
    max-width: 700px;
    margin: 0 auto;
    padding: 20px;
}

.race-track {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 30px;
}

.race-lane {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    position: relative;
    overflow: hidden;
}

.race-lane-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    position: relative;
    z-index: 2;
}

.race-lane-info .lane-color {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.race-lane-info .lane-name {
    font-weight: 700;
    font-size: 0.9rem;
}

.race-lane-info .lane-percent {
    margin-left: auto;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--secondary);
}

.race-bar-bg {
    height: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
    overflow: hidden;
    position: relative;
    z-index: 2;
}

.race-bar {
    height: 100%;
    border-radius: 5px;
    transition: width 0.1s linear;
    width: 0%;
}

/* ===== RESULTS PAGE ===== */
.results-page {
    min-height: calc(100vh - 64px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 20px 40px;
}

.results-container {
    text-align: center;
    max-width: 500px;
    width: 100%;
}

.trophy-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    animation: bounce 1s ease infinite;
}

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

.results-container h1 {
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    font-weight: 800;
    margin-bottom: 8px;
}

.winner-name {
    font-size: clamp(2rem, 6vw, 3rem);
    font-weight: 900;
    background: linear-gradient(135deg, var(--yellow), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
}

.results-details {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 36px;
}

.results-ranking {
    margin-bottom: 36px;
}

.results-ranking h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 14px;
}

.confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

/* ===== FOOTER ===== */
.footer {
    border-top: 1px solid var(--glass-border);
    padding: 30px 20px;
    text-align: center;
    color: var(--text-dim);
    font-size: 0.8rem;
}

/* ===== 404 PAGE ===== */
.page-404 {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
}

.page-404 h1 {
    font-size: clamp(5rem, 15vw, 10rem);
    font-weight: 900;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    margin-bottom: 16px;
}

.page-404 p {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 30px;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.fade-in {
    animation: fadeIn 0.5s ease;
}

.fade-in-up {
    animation: fadeInUp 0.5s ease;
}

/* ===== GAME SELECT PAGE ===== */
.game-select-page {
    padding: 100px 20px 40px;
    max-width: var(--max-width);
    margin: 0 auto;
}

.game-select-page .contestants-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 40px;
}

.contestant-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
}

.contestant-chip .chip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* ===== UTILITY ===== */
.text-center { text-align: center; }
.mb-20 { margin-bottom: 20px; }
.mb-30 { margin-bottom: 30px; }
.mt-20 { margin-top: 20px; }
.mt-40 { margin-top: 40px; }

/* ===== GAME CONTROLS ===== */
.game-controls {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 10px 20px 20px;
}

/* ===== SCORE PICKER (up/down stepper) ===== */
.score-picker {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 16px;
}

.score-picker-label {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text);
}

.score-stepper {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.score-stepper-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 1.3rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}

.score-stepper-btn:hover {
    background: var(--primary);
    color: #fff;
}

.score-stepper-btn:active {
    transform: scale(0.92);
}

.score-stepper-btn:disabled {
    opacity: 0.3;
    pointer-events: none;
}

.score-stepper-value {
    min-width: 48px;
    text-align: center;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--primary);
    padding: 0 4px;
    border-left: 1px solid var(--glass-border);
    border-right: 1px solid var(--glass-border);
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(124, 92, 252, 0.08);
}

/* ===== LOADING OVERLAY ===== */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.4s ease;
}

.loading-overlay.hide {
    opacity: 0;
    pointer-events: none;
}

.loader {
    width: 40px;
    height: 40px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== GAME OVER MODAL ===== */
.game-over-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5000;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.game-over-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 40px 32px;
    text-align: center;
    max-width: 420px;
    width: 100%;
    animation: scaleIn 0.4s ease;
}

.game-over-modal h2 {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.game-over-modal .modal-winner {
    font-size: 2rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--yellow), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
}

.game-over-modal .modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ===== INLINE CONTESTANT PICKER ===== */
.picker-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 28px;
    max-width: 600px;
    margin: 0 auto 30px;
}
.picker-panel h2 { text-align: center; font-size: 1.3rem; margin-bottom: 6px; }
.picker-desc { text-align: center; color: var(--text-muted); font-size: 0.9rem; margin-bottom: 18px; }

.picker-mode-toggle {
    display: flex; gap: 0; margin-bottom: 16px; background: var(--bg-card);
    border: 1px solid var(--glass-border); border-radius: var(--radius-sm); overflow: hidden;
}
.picker-mode-btn {
    flex: 1; padding: 11px 14px; background: none; color: var(--text-muted);
    font-size: 0.88rem; font-weight: 600; transition: var(--transition); cursor: pointer;
    border: none; border-right: 1px solid var(--glass-border);
}
.picker-mode-btn:last-child { border-right: none; }
.picker-mode-btn.active { background: var(--primary); color: #fff; }

.picker-list { margin-top: 16px; display: flex; flex-direction: column; gap: 6px; }
.picker-count { text-align: center; font-size: 0.85rem; color: var(--text-muted); margin-top: 10px; margin-bottom: 14px; }

.picker-panel .contestant-item { padding: 10px 14px; }
.picker-panel .flag-display { font-size: 1.4rem; flex-shrink: 0; }
.picker-panel .flag-display-ico { width: 28px; height: 28px; object-fit: contain; flex-shrink: 0; border-radius: 4px; }

/* Flag picker overlay (modal) */
.flag-picker-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.7);
    z-index: 5000; display: flex; align-items: center; justify-content: center;
    padding: 20px; animation: fadeIn 0.2s ease;
}
.flag-picker-modal {
    background: var(--bg-secondary); border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg); padding: 28px; max-width: 520px; width: 100%;
    max-height: 80vh; display: flex; flex-direction: column; animation: scaleIn 0.3s ease;
}
.flag-picker-modal h3 { font-size: 1.2rem; font-weight: 700; margin-bottom: 12px; text-align: center; }
.flag-search {
    width: 100%; padding: 10px 14px; background: var(--bg-card);
    border: 1px solid var(--glass-border); border-radius: var(--radius-sm);
    color: var(--text); font-size: 0.95rem; margin-bottom: 14px; outline: none;
}
.flag-search::placeholder { color: var(--text-dim); }
.flag-search:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.flag-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 8px; overflow-y: auto; max-height: 50vh; padding-right: 4px;
}
.flag-option {
    display: flex; align-items: center; gap: 8px; padding: 10px 12px;
    background: var(--bg-card); border: 2px solid transparent;
    border-radius: var(--radius-sm); cursor: pointer; transition: var(--transition);
    font-size: 0.85rem; font-weight: 600; color: var(--text);
}
.flag-option:hover { background: var(--bg-card-hover); border-color: var(--glass-border); }
.flag-option .flag-emoji { font-size: 1.6rem; }
.flag-option .flag-ico-img { width: 32px; height: 32px; object-fit: contain; border-radius: 4px; }
.flag-picker-close { margin-top: 14px; text-align: center; }

/* ===== FULLSCREEN GAME MODE ===== */
body.fullscreen-active {
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Hide all site chrome */
body.fullscreen-active .navbar,
body.fullscreen-active .game-header,
body.fullscreen-active .footer,
body.fullscreen-active .bg-glow,
body.fullscreen-active #pickerContainer {
    display: none !important;
}

/* Strip parent wrapper */
body.fullscreen-active .main-content.game-page {
    padding: 0 !important;
    margin: 0 !important;
    min-height: 0 !important;
}

/* Game area covers the entire viewport */
body.fullscreen-active #gameArea {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    z-index: 9000;
    background: var(--bg-primary);
    display: flex !important;
    flex-direction: column;
    overflow: hidden;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    max-width: none !important;
    max-height: none !important;
}

/* Hide game controls (start buttons, round picker) */
body.fullscreen-active .game-controls {
    display: none !important;
}

/* --- Canvas games (Çember / Lavabo) --- */
body.fullscreen-active .game-arena {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    min-height: 0;
    overflow: hidden;
}

body.fullscreen-active .game-canvas-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.fullscreen-active .game-canvas-wrapper canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: transparent;
    border-radius: 0;
}

body.fullscreen-active .sink-canvas-wrap {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.fullscreen-active .sink-canvas-wrap canvas {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: contain !important;
    background: transparent !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    border: none !important;
}

/* --- Wheel game --- */
body.fullscreen-active .wheel-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px;
    min-height: 0;
    gap: 14px;
    overflow: hidden;
}

body.fullscreen-active .wheel-wrapper {
    width: min(85vw, calc(100vh - 160px));
    height: min(85vw, calc(100vh - 160px));
}

body.fullscreen-active .wheel-wrapper canvas {
    width: 100%;
    height: 100%;
}

/* --- Race game --- */
body.fullscreen-active .race-container {
    flex: 1;
    max-width: none !important;
    width: 100%;
    padding: 20px 40px;
    overflow-y: auto;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

body.fullscreen-active .race-track {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    gap: 10px;
}

body.fullscreen-active .race-lane {
    padding: 14px 24px;
}

body.fullscreen-active .race-lane-info .lane-name {
    font-size: 1.05rem;
}

body.fullscreen-active .race-bar-bg {
    height: 14px;
    border-radius: 7px;
}

body.fullscreen-active .race-bar {
    border-radius: 7px;
}

body.fullscreen-active #countdown {
    font-size: 4rem !important;
    min-height: 80px !important;
}

/* --- Scoreboard in fullscreen --- */
body.fullscreen-active .scoreboard {
    max-width: none !important;
    background: rgba(10, 10, 18, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--glass-border);
    padding: 8px 16px 10px;
    flex-shrink: 0;
    max-height: 28vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

body.fullscreen-active .scoreboard h2 {
    font-size: 0.85rem;
    margin-bottom: 6px;
}

body.fullscreen-active .score-list {
    gap: 4px;
}

body.fullscreen-active .score-item {
    padding: 5px 10px;
    gap: 8px;
}

body.fullscreen-active .score-item .score-name {
    font-size: 0.85rem;
}

/* --- Overlays z-index --- */
body.fullscreen-active .game-over-overlay {
    z-index: 9200;
}

body.fullscreen-active .confetti-canvas {
    z-index: 9300;
}

/* --- Fullscreen exit button (✕) --- */
.fs-exit-btn {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 9500;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.fs-exit-btn:hover {
    background: rgba(255, 50, 50, 0.6);
    transform: scale(1.1);
}

.fs-exit-btn:active {
    transform: scale(0.95);
}

/* --- Fullscreen expand (re-enter) button --- */
.fs-expand-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 8000;
    background: rgba(124, 92, 252, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    box-shadow: 0 4px 20px rgba(124, 92, 252, 0.4);
    animation: fsPulse 2s ease infinite;
}

body.fullscreen-active .fs-expand-btn {
    display: none !important;
}

.fs-expand-btn:hover {
    background: rgba(124, 92, 252, 1);
    transform: scale(1.12);
}

.fs-expand-btn:active {
    transform: scale(0.95);
}

@keyframes fsPulse {
    0%, 100% { box-shadow: 0 4px 20px rgba(124, 92, 252, 0.4); }
    50% { box-shadow: 0 4px 30px rgba(124, 92, 252, 0.7); }
}

/* --- Mobile fullscreen adjustments --- */
@media (max-width: 600px) {
    body.fullscreen-active .scoreboard {
        max-height: 25vh;
        padding: 6px 10px 8px;
    }

    body.fullscreen-active .score-item {
        padding: 4px 8px;
        gap: 6px;
    }

    body.fullscreen-active .score-item .score-name {
        font-size: 0.8rem;
    }

    body.fullscreen-active .score-item .score-value {
        font-size: 0.75rem;
    }

    .fs-exit-btn {
        top: 6px;
        right: 6px;
        width: 36px;
        height: 36px;
        font-size: 0.95rem;
    }

    body.fullscreen-active .wheel-wrapper {
        width: min(92vw, calc(100vh - 140px));
        height: min(92vw, calc(100vh - 140px));
    }

    body.fullscreen-active .race-container {
        padding: 10px 14px;
    }

    body.fullscreen-active .race-lane {
        padding: 10px 14px;
    }

    body.fullscreen-active .race-bar-bg {
        height: 10px;
    }

    body.fullscreen-active #countdown {
        font-size: 3rem !important;
        min-height: 50px !important;
    }
}

/* --- Landscape fullscreen --- */
@media (orientation: landscape) and (max-height: 500px) {
    body.fullscreen-active #gameArea {
        flex-direction: row;
    }

    body.fullscreen-active .game-arena,
    body.fullscreen-active .wheel-container,
    body.fullscreen-active .race-container {
        flex: 1;
        min-width: 0;
    }

    body.fullscreen-active .scoreboard {
        width: 200px;
        max-height: none;
        height: 100%;
        border-top: none;
        border-left: 1px solid var(--glass-border);
        flex-shrink: 0;
    }

    body.fullscreen-active .wheel-wrapper {
        width: min(85vh, 60vw);
        height: min(85vh, 60vw);
    }
}
