/* ========================================
   BILGI YARIŞMASI - Premium CSS Design System
   ======================================== */

/* ---- CSS Variables ---- */
:root {
    /* Primary Colors - Vibrant Neon Palette */
    --primary-purple: #8B5CF6;
    --primary-blue: #3B82F6;
    --primary-cyan: #06B6D4;
    --primary-green: #10B981;
    --primary-yellow: #F59E0B;
    --primary-orange: #F97316;
    --primary-pink: #EC4899;
    --primary-red: #EF4444;

    /* Option Button Colors */
    --opt-red: #EF4444;
    --opt-blue: #3B82F6;
    --opt-yellow: #F59E0B;
    --opt-green: #10B981;

    /* Background Gradients */
    --bg-gradient: linear-gradient(135deg, #1a0a2e 0%, #16213e 25%, #0f3d3e 50%, #2d1b4e 75%, #1a1a3e 100%);
    --bg-game: linear-gradient(180deg, #1a1a2e 0%, #0d253d 50%, #16213e 100%);

    /* Glass Effect */
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.15);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);

    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);

    /* Accent */
    --accent-glow: 0 0 30px rgba(139, 92, 246, 0.5);

    /* Timing */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* ---- Reset & Base ---- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-gradient);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* Animated Background - Colorful & Mixed */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 10% 90%, rgba(139, 92, 246, 0.25) 0%, transparent 40%),
        radial-gradient(circle at 90% 10%, rgba(6, 182, 212, 0.3) 0%, transparent 45%),
        radial-gradient(circle at 50% 50%, rgba(236, 72, 153, 0.2) 0%, transparent 50%),
        radial-gradient(circle at 30% 20%, rgba(16, 185, 129, 0.2) 0%, transparent 35%),
        radial-gradient(circle at 70% 80%, rgba(249, 115, 22, 0.2) 0%, transparent 40%),
        radial-gradient(circle at 85% 50%, rgba(244, 63, 94, 0.15) 0%, transparent 35%),
        radial-gradient(circle at 15% 40%, rgba(59, 130, 246, 0.2) 0%, transparent 40%);
    pointer-events: none;
    z-index: -1;
    animation: bgPulse 8s ease-in-out infinite alternate;
}

@keyframes bgPulse {
    0% {
        opacity: 0.6;
        filter: hue-rotate(0deg);
    }

    100% {
        opacity: 1;
        filter: hue-rotate(15deg);
    }
}

/* ---- Typography ---- */
h1 {
    font-size: clamp(2rem, 8vw, 4rem);
    font-weight: 900;
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
    margin-bottom: 1rem;
    text-shadow: 0 0 40px rgba(139, 92, 246, 0.3);
}

h2 {
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 0.75rem;
}

h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-secondary);
}

p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* ---- App Container ---- */
#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    position: relative;
}

/* ---- Screens ---- */
.screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.95);
    transition: all var(--transition-normal);
    pointer-events: none;
}

.screen.active {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
    pointer-events: all;
}

/* ---- Glass Card ---- */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: var(--glass-shadow);
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 700;
    font-family: inherit;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(rgba(255, 255, 255, 0.2), transparent);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.btn:hover::before {
    opacity: 1;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-blue));
    color: white;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(139, 92, 246, 0.5);
}

.btn-secondary {
    background: var(--glass-bg);
    color: white;
    border: 2px solid var(--glass-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-start {
    background: linear-gradient(135deg, var(--primary-green), var(--primary-cyan));
    color: white;
    font-size: 1.4rem;
    padding: 1.25rem 3rem;
    box-shadow: 0 4px 25px rgba(16, 185, 129, 0.4);
}

.btn-start:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 35px rgba(16, 185, 129, 0.5);
}

.btn-icon {
    width: 50px;
    height: 50px;
    padding: 0;
    border-radius: 50%;
}

/* ---- Input Fields ---- */
.input-field {
    width: 100%;
    max-width: 320px;
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    font-family: inherit;
    font-weight: 500;
    color: white;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid var(--glass-border);
    border-radius: 16px;
    outline: none;
    transition: all var(--transition-fast);
    text-align: center;
}

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

.input-field:focus {
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.2);
}

/* ---- Mode Selection ---- */
.mode-selection {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.mode-buttons {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.mode-card {
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
    width: 200px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.mode-card:hover {
    transform: translateY(-8px);
    border-color: var(--primary-purple);
    box-shadow: var(--accent-glow);
}

.mode-card .icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.mode-card h3 {
    color: white;
    margin-bottom: 0.5rem;
}

/* ---- Lobby Screen ---- */
.lobby-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    width: 100%;
    max-width: 800px;
}

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

.room-code {
    display: inline-block;
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: 8px;
    color: var(--primary-cyan);
    background: var(--glass-bg);
    padding: 0.5rem 2rem;
    border-radius: 16px;
    border: 2px solid var(--primary-cyan);
    animation: codeGlow 2s ease-in-out infinite alternate;
}

@keyframes codeGlow {
    from {
        box-shadow: 0 0 20px rgba(6, 182, 212, 0.3);
    }

    to {
        box-shadow: 0 0 40px rgba(6, 182, 212, 0.6);
    }
}

.lobby-content {
    display: flex;
    gap: 3rem;
    align-items: flex-start;
    flex-wrap: wrap;
    justify-content: center;
}

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

#qrcode {
    background: white;
    padding: 1rem;
    border-radius: 16px;
    display: inline-block;
}

#qrcode img,
#qrcode canvas {
    display: block;
    border-radius: 8px;
}

.join-instructions {
    text-align: center;
    margin-top: 1rem;
}

.join-url {
    display: inline-block;
    background: var(--glass-bg);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    color: var(--primary-purple);
    margin-top: 0.5rem;
}

/* Player List */
.players-section {
    flex: 1;
    min-width: 250px;
}

.player-count {
    text-align: center;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.player-count span {
    color: var(--primary-cyan);
    font-weight: 700;
    font-size: 1.5rem;
}

.player-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    max-height: 300px;
    overflow-y: auto;
    padding: 0.5rem;
}

.player-chip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--glass-bg);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    border: 1px solid var(--glass-border);
    animation: playerJoin 0.3s ease;
}

@keyframes playerJoin {
    from {
        transform: scale(0) rotate(-10deg);
        opacity: 0;
    }

    to {
        transform: scale(1) rotate(0);
        opacity: 1;
    }
}

.player-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-pink));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

/* ---- Game Screen (Host) ---- */
.game-container {
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Timer Bar */
.timer-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    z-index: 100;
}

.timer-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-green), var(--primary-cyan), var(--primary-purple));
    transition: width 1s linear;
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.5);
}

.timer-fill.warning {
    background: linear-gradient(90deg, var(--primary-yellow), var(--primary-orange));
}

.timer-fill.danger {
    background: linear-gradient(90deg, var(--primary-orange), var(--primary-red));
    animation: timerPulse 0.5s ease infinite;
}

@keyframes timerPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

/* Question Display */
.question-section {
    text-align: center;
    animation: questionIn 0.5s ease;
}

@keyframes questionIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

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

.question-number {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-pink));
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.question-text {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 700;
    margin-bottom: 1.5rem;
    line-height: 1.4;
}

.question-image {
    max-width: 400px;
    max-height: 250px;
    border-radius: 16px;
    margin: 1rem auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    object-fit: contain;
}

/* Options Grid */
.options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

.option-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    border-radius: 16px;
    font-size: 1.25rem;
    font-weight: 600;
    color: white;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-fast);
    animation: optionIn 0.4s ease backwards;
}

.option-card:nth-child(1) {
    background: linear-gradient(135deg, var(--opt-red), #dc2626);
    animation-delay: 0.1s;
}

.option-card:nth-child(2) {
    background: linear-gradient(135deg, var(--opt-blue), #2563eb);
    animation-delay: 0.2s;
}

.option-card:nth-child(3) {
    background: linear-gradient(135deg, var(--opt-yellow), #d97706);
    animation-delay: 0.3s;
}

.option-card:nth-child(4) {
    background: linear-gradient(135deg, var(--opt-green), #059669);
    animation-delay: 0.4s;
}

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

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

.option-shape {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    flex-shrink: 0;
}

.option-text {
    flex: 1;
}

.option-card.correct {
    animation: correctPulse 0.5s ease;
    box-shadow: 0 0 40px rgba(16, 185, 129, 0.6);
}

@keyframes correctPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }
}

.option-card.incorrect {
    opacity: 0.5;
    filter: grayscale(0.5);
}

/* True/False Options */
.options-truefalse {
    display: flex;
    gap: 2rem;
    justify-content: center;
}

.tf-option {
    width: 200px;
    height: 200px;
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tf-option.true {
    background: linear-gradient(135deg, var(--primary-green), #059669);
}

.tf-option.false {
    background: linear-gradient(135deg, var(--primary-red), #dc2626);
}

.tf-option span {
    font-size: 1.2rem;
    margin-top: 0.5rem;
}

/* Game Stats */
.game-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.stat-item {
    background: var(--glass-bg);
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-cyan);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ---- Leaderboard ---- */
.leaderboard-container {
    width: 100%;
    max-width: 600px;
}

.leaderboard-title {
    text-align: center;
    margin-bottom: 2rem;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.leaderboard-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--glass-bg);
    padding: 1rem 1.5rem;
    border-radius: 16px;
    animation: rowIn 0.3s ease backwards;
}

.leaderboard-row:nth-child(1) {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 215, 0, 0.1));
    border: 2px solid rgba(255, 215, 0, 0.5);
}

.leaderboard-row:nth-child(2) {
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.2), rgba(192, 192, 192, 0.1));
    border: 2px solid rgba(192, 192, 192, 0.5);
}

.leaderboard-row:nth-child(3) {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.2), rgba(205, 127, 50, 0.1));
    border: 2px solid rgba(205, 127, 50, 0.5);
}

@keyframes rowIn {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

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

.rank {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--glass-bg);
    border-radius: 50%;
    font-weight: 900;
    font-size: 1.1rem;
}

.leaderboard-row:nth-child(1) .rank {
    color: gold;
}

.leaderboard-row:nth-child(2) .rank {
    color: silver;
}

.leaderboard-row:nth-child(3) .rank {
    color: #cd7f32;
}

.player-name {
    flex: 1;
    font-weight: 600;
    font-size: 1.1rem;
}

.player-score {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--primary-green);
}

/* ---- Client/Player Screens ---- */
.client-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem;
    width: 100%;
    max-width: 400px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

/* Answer Buttons (Client) */
.answer-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    width: 100%;
    height: 60vh;
    max-height: 500px;
}

.answer-btn {
    border: none;
    border-radius: 16px;
    font-size: 3rem;
    color: white;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.answer-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(rgba(255, 255, 255, 0.15), transparent);
}

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

.answer-btn.red {
    background: linear-gradient(135deg, var(--opt-red), #dc2626);
}

.answer-btn.blue {
    background: linear-gradient(135deg, var(--opt-blue), #2563eb);
}

.answer-btn.yellow {
    background: linear-gradient(135deg, var(--opt-yellow), #d97706);
}

.answer-btn.green {
    background: linear-gradient(135deg, var(--opt-green), #059669);
}

.answer-btn.selected {
    animation: selected 0.3s ease;
    box-shadow: inset 0 0 0 4px white;
}

@keyframes selected {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(0.95);
    }

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

.answer-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* True/False Buttons (Client) */
.tf-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    width: 100%;
    height: 40vh;
}

.tf-btn {
    border: none;
    border-radius: 16px;
    font-size: 4rem;
    color: white;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all var(--transition-fast);
}

.tf-btn span {
    font-size: 1rem;
    font-weight: 600;
}

.tf-btn.true {
    background: linear-gradient(135deg, var(--primary-green), #059669);
}

.tf-btn.false {
    background: linear-gradient(135deg, var(--primary-red), #dc2626);
}

/* Feedback Screen */
.feedback-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    text-align: center;
}

.feedback-icon {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
}

.feedback-icon.correct {
    background: linear-gradient(135deg, var(--primary-green), #059669);
    animation: correctBounce 0.5s ease;
}

.feedback-icon.incorrect {
    background: linear-gradient(135deg, var(--primary-red), #dc2626);
    animation: shake 0.5s ease;
}

@keyframes correctBounce {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-10px);
    }

    75% {
        transform: translateX(10px);
    }
}

.points-earned {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-green);
}

/* Waiting Screen */
.waiting-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.loader {
    width: 60px;
    height: 60px;
    border: 4px solid var(--glass-border);
    border-top-color: var(--primary-purple);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ---- Winner Screen ---- */
.winner-container {
    text-align: center;
}

.trophy {
    font-size: 6rem;
    animation: trophyBounce 1s ease infinite;
}

@keyframes trophyBounce {

    0%,
    100% {
        transform: translateY(0) rotate(-5deg);
    }

    50% {
        transform: translateY(-20px) rotate(5deg);
    }
}

.winner-name {
    font-size: 3rem;
    font-weight: 900;
    background: linear-gradient(135deg, gold, #fcd34d);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 1rem 0;
}

/* Confetti Animation */
.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    top: -10px;
    animation: confettiFall 3s linear forwards;
    border-radius: 2px;
    z-index: 9999;
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Final Leaderboard (Top 5) */
.final-leaderboard {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    max-width: 500px;
    margin: 2rem auto;
}

.final-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--glass-bg);
    padding: 1rem 1.5rem;
    border-radius: 16px;
    animation: finalRowIn 0.5s ease backwards;
    border: 1px solid var(--glass-border);
}

.final-row.winner-row {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.3), rgba(255, 215, 0, 0.1));
    border: 2px solid gold;
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.4);
    transform: scale(1.05);
}

.final-row:nth-child(2) {
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.2), rgba(192, 192, 192, 0.1));
    border: 1px solid silver;
}

.final-row:nth-child(3) {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.2), rgba(205, 127, 50, 0.1));
    border: 1px solid #cd7f32;
}

@keyframes finalRowIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.9);
    }

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

.final-row.winner-row {
    animation: finalRowIn 0.5s ease backwards, winnerPulse 2s ease-in-out infinite;
}

@keyframes winnerPulse {

    0%,
    100% {
        box-shadow: 0 0 30px rgba(255, 215, 0, 0.4);
    }

    50% {
        box-shadow: 0 0 60px rgba(255, 215, 0, 0.7);
    }
}

.final-rank {
    font-size: 2rem;
    width: 50px;
    text-align: center;
}

.final-name {
    flex: 1;
    font-weight: 700;
    font-size: 1.3rem;
}

.confetti-icon {
    display: inline-block;
    animation: confettiShake 0.5s ease-in-out infinite;
}

@keyframes confettiShake {

    0%,
    100% {
        transform: rotate(-10deg);
    }

    50% {
        transform: rotate(10deg);
    }
}

.final-score {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary-green);
}

/* Option Letter for Mobile */
.option-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    font-size: 1.2rem;
    font-weight: 900;
    margin-right: 0.5rem;
    position: relative;
    z-index: 1;
}

.answer-btn {
    flex-direction: column;
    gap: 0.5rem;
}

/* ---- Page Title ---- */
.page-title {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.9), rgba(59, 130, 246, 0.9));
    padding: 1rem 2rem;
    text-align: center;
    font-size: 1.3rem;
    font-weight: 700;
    color: white;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.5px;
}

@media (max-width: 768px) {
    .page-title {
        font-size: 1rem;
        padding: 0.75rem 1rem;
    }
}

/* ---- Utilities ---- */
.hidden {
    display: none !important;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-content {
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.error-text {
    color: #EF4444;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

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

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 1.5rem;
}

.mt-4 {
    margin-top: 2rem;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1.5rem;
}

.mb-4 {
    margin-bottom: 2rem;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .lobby-content {
        flex-direction: column;
        align-items: center;
    }

    .options-grid {
        grid-template-columns: 1fr;
    }

    .option-card {
        padding: 1rem;
        font-size: 1rem;
    }

    .leaderboard-row {
        padding: 0.75rem 1rem;
    }
}

@media (max-width: 480px) {
    .room-code {
        font-size: 2rem;
        letter-spacing: 5px;
    }

    .mode-card {
        width: 150px;
        padding: 1.5rem;
    }

    .mode-card .icon {
        font-size: 2rem;
    }
}