/* =====================================================
   BINGO ONLINE - Design System
   ===================================================== */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&display=swap');

/* ── CSS Variables ─────────────────────────────────── */
:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.7);
    --bg-glass: rgba(255, 255, 255, 0.05);
    --border-glass: rgba(255, 255, 255, 0.1);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-gold: #f59e0b;
    --accent-gold-glow: rgba(245, 158, 11, 0.3);
    --accent-purple: #8b5cf6;
    --accent-purple-glow: rgba(139, 92, 246, 0.3);
    --accent-green: #10b981;
    --accent-green-glow: rgba(16, 185, 129, 0.3);
    --accent-red: #ef4444;
    --accent-blue: #3b82f6;
    --accent-pink: #ec4899;
    --gradient-main: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-gold: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --gradient-danger: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    --shadow-glow-purple: 0 0 30px rgba(139, 92, 246, 0.2);
    --shadow-glow-gold: 0 0 30px rgba(245, 158, 11, 0.2);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & Base ──────────────────────────────────── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* ── Animated Background ───────────────────────────── */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.bg-animation .orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: orbFloat 20s infinite ease-in-out;
}

.bg-animation .orb:nth-child(1) {
    width: 400px;
    height: 400px;
    background: var(--accent-purple);
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.bg-animation .orb:nth-child(2) {
    width: 300px;
    height: 300px;
    background: var(--accent-gold);
    top: 50%;
    right: -80px;
    animation-delay: -7s;
}

.bg-animation .orb:nth-child(3) {
    width: 350px;
    height: 350px;
    background: var(--accent-green);
    bottom: -100px;
    left: 30%;
    animation-delay: -14s;
}

@keyframes orbFloat {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    25% {
        transform: translate(50px, -30px) scale(1.1);
    }

    50% {
        transform: translate(-30px, 50px) scale(0.9);
    }

    75% {
        transform: translate(40px, 20px) scale(1.05);
    }
}

/* ── Glass Card ────────────────────────────────────── */
.glass-card {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: var(--shadow-lg), var(--shadow-glow-purple);
}

/* ── Typography ────────────────────────────────────── */
h1,
h2,
h3,
h4 {
    font-weight: 700;
    line-height: 1.2;
}

.title-glow {
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── Buttons ───────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent);
    opacity: 0;
    transition: var(--transition);
}

.btn:hover::before {
    opacity: 1;
}

.btn-primary {
    background: var(--gradient-main);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.btn-gold {
    background: var(--gradient-gold);
    color: #1a1a2e;
    box-shadow: 0 4px 15px var(--accent-gold-glow);
}

.btn-gold:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--accent-gold-glow);
}

.btn-success {
    background: var(--gradient-success);
    color: white;
    box-shadow: 0 4px 15px var(--accent-green-glow);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--accent-green-glow);
}

.btn-danger {
    background: var(--gradient-danger);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-2px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-glass);
}

.btn-ghost:hover {
    background: var(--bg-glass);
    color: var(--text-primary);
}

.btn-lg {
    padding: 16px 36px;
    font-size: 1.1rem;
    border-radius: var(--radius-lg);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* ── Forms ─────────────────────────────────────────── */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    transition: var(--transition);
    outline: none;
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px var(--accent-purple-glow);
}

/* ── Auth Page ─────────────────────────────────────── */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.auth-card {
    width: 100%;
    max-width: 440px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo h1 {
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: -1px;
}

.auth-logo .logo-icon {
    font-size: 4rem;
    display: block;
    margin-bottom: 12px;
    animation: logoBounce 2s infinite ease-in-out;
}

@keyframes logoBounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

.auth-logo p {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-top: 8px;
}

.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 28px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    padding: 4px;
}

.auth-tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.auth-tab.active {
    background: var(--gradient-main);
    color: white;
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.9rem;
    display: none;
}

.alert-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.alert-success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

/* ── Lobby ─────────────────────────────────────────── */
.lobby-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 24px;
    position: relative;
    z-index: 1;
}

.lobby-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.lobby-header h1 {
    font-size: 2rem;
}

.lobby-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    color: white;
    text-transform: uppercase;
    flex-shrink: 0;
}

.create-room-section {
    margin-bottom: 32px;
}

.create-room-form {
    display: flex;
    gap: 12px;
    align-items: stretch;
}

.create-room-form .form-control {
    flex: 1;
}

.rooms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.room-card {
    padding: 24px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.room-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-main);
    opacity: 0;
    transition: var(--transition);
}

.room-card:hover::after {
    opacity: 1;
}

.room-card .room-name {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.room-card .room-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.room-card .room-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-waiting {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-gold);
}

.status-playing {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
}

.room-card .room-host {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state .empty-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* ── Game Room Layout ──────────────────────────────── */
.game-container {
    display: grid;
    grid-template-columns: 1fr 340px;
    grid-template-rows: auto 1fr;
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.game-topbar {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.game-topbar .room-title {
    font-size: 1.3rem;
    font-weight: 700;
}

.game-topbar .topbar-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.game-main {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.game-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ── Drawn Numbers Display ─────────────────────────── */
.drawn-section {
    padding: 20px;
}

.drawn-section h3 {
    font-size: 1rem;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.current-ball {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
}

.ball {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.ball::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 12px;
    width: 12px;
    height: 8px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    transform: rotate(-30deg);
}

.ball-B {
    background: var(--gradient-danger);
}

.ball-I {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.ball-N {
    background: var(--gradient-success);
}

.ball-G {
    background: var(--gradient-main);
}

.ball-O {
    background: linear-gradient(135deg, #ec4899, #be185d);
}

.ball.ball-large {
    width: 90px;
    height: 90px;
    font-size: 2rem;
}

.ball-letter {
    font-size: 0.7em;
    opacity: 0.8;
    margin-right: 2px;
}

.ball-pop {
    animation: ballPop 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes ballPop {
    0% {
        transform: scale(0);
    }

    60% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

.drawn-numbers-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.drawn-mini-ball {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    opacity: 0.85;
}

/* ── Bingo Card ────────────────────────────────────── */
.bingo-card-section {
    padding: 20px;
}

.bingo-card {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    max-width: 400px;
    margin: 0 auto;
}

.bingo-header {
    padding: 10px;
    text-align: center;
    font-size: 1.4rem;
    font-weight: 800;
    border-radius: var(--radius-sm);
    color: white;
}

.bingo-header-B {
    background: var(--accent-red);
}

.bingo-header-I {
    background: var(--accent-gold);
}

.bingo-header-N {
    background: var(--accent-green);
}

.bingo-header-G {
    background: var(--accent-purple);
}

.bingo-header-O {
    background: var(--accent-pink);
}

.bingo-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-glass);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    user-select: none;
}

.bingo-cell:hover:not(.marked):not(.free) {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--accent-purple);
}

.bingo-cell.drawable {
    border-color: var(--accent-gold);
    box-shadow: 0 0 8px var(--accent-gold-glow);
    animation: cellGlow 1.5s infinite ease-in-out;
}

@keyframes cellGlow {

    0%,
    100% {
        box-shadow: 0 0 8px var(--accent-gold-glow);
    }

    50% {
        box-shadow: 0 0 16px var(--accent-gold-glow);
    }
}

.bingo-cell.marked {
    background: var(--gradient-main);
    color: white;
    border-color: transparent;
    transform: scale(0.95);
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

.bingo-cell.marked::after {
    content: '✓';
    position: absolute;
    top: 2px;
    right: 4px;
    font-size: 0.6rem;
    opacity: 0.7;
}

.bingo-cell.free {
    background: var(--gradient-gold);
    color: #1a1a2e;
    border-color: transparent;
    font-size: 0.7rem;
    font-weight: 800;
    cursor: default;
}

.mark-animation {
    animation: markPop 0.3s ease;
}

@keyframes markPop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }

    100% {
        transform: scale(0.95);
    }
}

/* ── Bingo Button ──────────────────────────────────── */
.bingo-btn-container {
    margin-top: 16px;
    text-align: center;
}

.btn-bingo {
    padding: 16px 48px;
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: 4px;
    background: var(--gradient-gold);
    color: #1a1a2e;
    border: none;
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    font-family: 'Outfit', sans-serif;
}

.btn-bingo:hover {
    transform: scale(1.05);
    box-shadow: 0 0 40px var(--accent-gold-glow);
}

.btn-bingo:active {
    transform: scale(0.98);
}

.btn-bingo.pulse {
    animation: bingoPulse 1s infinite;
}

@keyframes bingoPulse {

    0%,
    100% {
        box-shadow: 0 0 20px var(--accent-gold-glow);
    }

    50% {
        box-shadow: 0 0 40px var(--accent-gold-glow), 0 0 60px rgba(245, 158, 11, 0.1);
    }
}

/* ── Players List ──────────────────────────────────── */
.players-section {
    padding: 16px;
}

.players-section h3 {
    font-size: 0.95rem;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.players-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.player-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.03);
    font-size: 0.9rem;
}

.player-item .host-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: var(--radius-full);
    background: var(--gradient-gold);
    color: #1a1a2e;
    font-weight: 700;
}

/* ── Chat ──────────────────────────────────────────── */
.chat-section {
    padding: 0;
    display: flex;
    flex-direction: column;
    height: 400px;
    overflow: hidden;
}

.chat-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header h3 {
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border-glass);
    border-radius: 2px;
}

.chat-msg {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    animation: msgSlide 0.3s ease;
}

@keyframes msgSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-msg .msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    margin-top: 2px;
}

.chat-msg .msg-body {
    flex: 1;
    min-width: 0;
}

.chat-msg .msg-nick {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-purple);
}

.chat-msg .msg-text {
    font-size: 0.88rem;
    color: var(--text-primary);
    word-break: break-word;
    line-height: 1.4;
}

.chat-msg .msg-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-left: 6px;
}

.chat-msg.system-msg {
    justify-content: center;
    padding: 4px 0;
}

.chat-msg.system-msg .msg-text {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
}

.chat-input-area {
    padding: 10px 12px;
    border-top: 1px solid var(--border-glass);
    display: flex;
    gap: 8px;
    align-items: center;
    position: relative;
}

.chat-input-area .form-control {
    flex: 1;
    padding: 10px 12px;
    font-size: 0.88rem;
}

.emoji-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    border-radius: 50%;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.emoji-btn:hover {
    background: var(--bg-glass);
    color: var(--text-primary);
}

.chat-send-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--gradient-main);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.chat-send-btn:hover {
    transform: scale(1.1);
}

/* ── Emoji Picker ──────────────────────────────────── */
.emoji-picker {
    position: absolute;
    bottom: 60px;
    left: 10px;
    right: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 12px;
    display: none;
    box-shadow: var(--shadow-lg);
    z-index: 100;
}

.emoji-picker.open {
    display: block;
    animation: fadeIn 0.2s ease;
}

.emoji-picker-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    max-height: 200px;
    overflow-y: auto;
}

.emoji-picker-grid::-webkit-scrollbar {
    width: 4px;
}

.emoji-picker-grid::-webkit-scrollbar-thumb {
    background: var(--border-glass);
    border-radius: 2px;
}

.emoji-item {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.emoji-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.2);
}

/* ── Winner Overlay ────────────────────────────────── */
.winner-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    display: none;
}

.winner-overlay.show {
    display: flex;
    animation: fadeIn 0.5s ease;
}

.winner-card {
    text-align: center;
    padding: 48px 64px;
    max-width: 500px;
}

.winner-card .trophy {
    font-size: 5rem;
    margin-bottom: 16px;
    animation: trophyBounce 1s infinite ease-in-out;
}

@keyframes trophyBounce {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    25% {
        transform: translateY(-10px) rotate(-5deg);
    }

    75% {
        transform: translateY(-10px) rotate(5deg);
    }
}

.winner-card h2 {
    font-size: 2.5rem;
    margin-bottom: 8px;
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.winner-card .winner-name {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 24px;
}

/* ── Confetti ──────────────────────────────────────── */
.confetti-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 999;
    overflow: hidden;
}

.confetti {
    position: absolute;
    top: -10px;
    width: 10px;
    height: 10px;
    animation: confettiFall 3s linear forwards;
}

@keyframes confettiFall {
    to {
        top: 110vh;
        transform: rotate(720deg);
    }
}

/* ── Host Controls ─────────────────────────────────── */
.host-controls {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.host-controls h3 {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.draw-counter {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 4px;
}

/* ── Auto Draw ─────────────────────────────────────── */
.btn-auto {
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    color: white;
    border: none;
    font-weight: 600;
}

.btn-auto:hover {
    box-shadow: 0 4px 15px rgba(6, 182, 212, 0.4);
    transform: translateY(-1px);
}

.auto-draw-options {
    margin-top: 8px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glass);
    animation: fadeIn 0.2s ease;
}

.auto-draw-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.auto-draw-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.btn-interval {
    padding: 8px;
    border: 1px solid rgba(6, 182, 212, 0.3);
    background: rgba(6, 182, 212, 0.1);
    color: #22d3ee;
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.btn-interval:hover {
    background: rgba(6, 182, 212, 0.25);
    border-color: #22d3ee;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.3);
    transform: scale(1.05);
}

.auto-draw-active {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.3);
    border-radius: var(--radius-md);
    margin-top: 8px;
    animation: autoDrawPulse 2s ease-in-out infinite;
}

.auto-draw-active span {
    font-size: 0.85rem;
    font-weight: 600;
    color: #22d3ee;
}

@keyframes autoDrawPulse {

    0%,
    100% {
        border-color: rgba(6, 182, 212, 0.3);
    }

    50% {
        border-color: rgba(6, 182, 212, 0.7);
        box-shadow: 0 0 12px rgba(6, 182, 212, 0.2);
    }
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    border: none;
    font-weight: 600;
}

.btn-danger:hover {
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

/* ── Utilities ─────────────────────────────────────── */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

.mt-2 {
    margin-top: 8px;
}

.mt-4 {
    margin-top: 16px;
}

.mb-4 {
    margin-bottom: 16px;
}

.gap-2 {
    gap: 8px;
}

/* ── Loading Spinner ───────────────────────────────── */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-glass);
    border-top-color: var(--accent-purple);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Toast Notifications ───────────────────────────── */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    color: white;
    font-weight: 500;
    font-size: 0.9rem;
    animation: toastSlide 0.4s ease;
    box-shadow: var(--shadow-lg);
    max-width: 350px;
}

.toast-success {
    background: linear-gradient(135deg, #10b981, #059669);
}

.toast-error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.toast-info {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

@keyframes toastSlide {
    from {
        opacity: 0;
        transform: translateX(100px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ── Responsive ────────────────────────────────────── */

/* Tablet */
@media (max-width: 900px) {
    .game-container {
        grid-template-columns: 1fr;
        padding: 10px;
        gap: 12px;
    }

    .game-topbar {
        grid-column: 1;
    }

    .game-sidebar {
        order: 3;
    }

    .chat-section {
        height: 250px;
    }

    .create-room-grid {
        grid-template-columns: 1fr 1fr !important;
    }

    .lobby-container {
        padding: 16px;
    }

    .rooms-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Mobile */
@media (max-width: 600px) {
    body {
        font-size: 14px;
    }

    .auth-card {
        padding: 24px 16px;
        margin: 10px;
    }

    .auth-logo h1 {
        font-size: 2rem;
    }

    /* ── Lobby ── */
    .lobby-container {
        padding: 10px;
    }

    .lobby-header {
        flex-direction: column;
        text-align: center;
        gap: 10px;
        padding: 14px;
    }

    .lobby-header h2 {
        font-size: 1.2rem;
    }

    .create-room-section {
        padding: 14px;
    }

    .create-room-grid {
        grid-template-columns: 1fr !important;
        gap: 10px;
    }

    .rooms-grid {
        grid-template-columns: 1fr;
    }

    .room-card {
        padding: 14px;
    }

    /* ── Game Topbar ── */
    .game-topbar {
        padding: 10px 14px;
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .topbar-actions {
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
    }

    .room-title {
        font-size: 1.1rem;
        text-align: center;
    }

    .countdown-timer {
        font-size: 0.8rem;
        padding: 4px 10px;
    }

    /* ── Game Container ── */
    .game-container {
        padding: 8px;
        gap: 10px;
    }

    .game-main {
        gap: 10px;
    }

    /* ── Drawn Numbers ── */
    .drawn-section {
        padding: 12px;
    }

    .drawn-section h3 {
        font-size: 0.9rem;
    }

    .current-ball .ball.ball-large {
        width: 60px;
        height: 60px;
        font-size: 1.4rem;
    }

    .drawn-numbers-grid {
        gap: 3px;
    }

    .drawn-numbers-grid .ball {
        width: 28px;
        height: 28px;
        font-size: 0.65rem;
    }

    /* ── Bingo Cards ── */
    .bingo-card-section {
        padding: 10px;
    }

    .bingo-card {
        gap: 3px;
    }

    .bingo-cell {
        font-size: 0.85rem;
        padding: 6px 2px;
        min-height: 32px;
    }

    .bingo-header {
        font-size: 0.95rem;
        padding: 6px;
    }

    .card-wrapper {
        padding: 8px;
    }

    .card-label {
        font-size: 0.75rem;
    }

    .btn-bingo {
        font-size: 1.1rem;
        padding: 12px 28px;
        letter-spacing: 2px;
    }

    /* ── Card Tabs ── */
    .card-tabs {
        padding: 3px;
        gap: 3px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .card-tab {
        padding: 6px 12px;
        font-size: 0.78rem;
    }

    /* ── Sidebar ── */
    .game-sidebar {
        gap: 10px;
    }

    .host-controls {
        padding: 12px;
        gap: 8px;
    }

    .host-controls h3 {
        font-size: 0.85rem;
    }

    .players-section {
        padding: 12px;
    }

    .players-section h3 {
        font-size: 0.85rem;
    }

    /* ── Auto Draw ── */
    .auto-draw-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 5px;
    }

    .btn-interval {
        padding: 6px;
        font-size: 0.8rem;
    }

    .auto-draw-active {
        padding: 8px 10px;
        font-size: 0.8rem;
    }

    /* ── Chat ── */
    .chat-section {
        height: 250px;
    }

    .chat-input-area {
        padding: 8px 10px;
    }

    /* ── Modal ── */
    .modal-overlay {
        padding: 12px;
    }

    .modal-card {
        max-width: 100% !important;
    }

    /* ── Toast ── */
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
    }

    .toast {
        max-width: 100%;
        font-size: 0.85rem;
        padding: 10px 14px;
    }

    /* ── Registration Badges ── */
    .reg-badge {
        font-size: 0.75rem;
        padding: 4px 10px;
    }

    /* ── Buttons ── */
    .btn {
        font-size: 0.85rem;
        padding: 10px 16px;
    }

    .btn-sm {
        font-size: 0.75rem;
        padding: 6px 10px;
    }

    /* ── Multi-Card Grid ── */
    .all-cards-container {
        grid-template-columns: 1fr;
    }

    /* ── Winner Overlay ── */
    .winner-card {
        padding: 32px 24px;
    }

    .winner-card .trophy {
        font-size: 3.5rem;
    }

    .winner-card h2 {
        font-size: 1.8rem;
    }
}

/* Extra small screens */
@media (max-width: 380px) {
    .bingo-cell {
        font-size: 0.75rem;
        padding: 4px 1px;
        min-height: 28px;
    }

    .bingo-header {
        font-size: 0.85rem;
        padding: 5px;
    }

    .drawn-numbers-grid .ball {
        width: 24px;
        height: 24px;
        font-size: 0.6rem;
    }

    .lobby-header h2 {
        font-size: 1rem;
    }

    .auth-logo h1 {
        font-size: 1.7rem;
    }
}

/* =====================================================
   V2: Scheduled Games, Multi-Card, Registrations
   ===================================================== */

/* ── Create Room Grid ──────────────────────────────── */
.create-room-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 12px;
    align-items: end;
}

@media (max-width: 900px) {
    .create-room-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* ── Room Schedule ─────────────────────────────────── */
.room-schedule {
    font-size: 0.88rem;
    color: var(--accent-gold);
    margin-bottom: 8px;
    font-weight: 500;
}

/* ── Registration Badges ───────────────────────────── */
.reg-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
}

.reg-badge.pending {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-gold);
}

.reg-badge.approved {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
}

.reg-badge.rejected {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

/* ── Registration Actions (host panel) ─────────────── */
.reg-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    width: 100%;
    margin-top: 4px;
}

/* ── Modal Overlay ─────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 900;
    padding: 20px;
}

.modal-card {
    width: 100%;
    animation: slideUp 0.3s ease;
}

/* ── Card Tabs (multi-card switching) ──────────────── */
.card-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 14px;
    background: rgba(255, 255, 255, 0.04);
    padding: 4px;
    border-radius: var(--radius-md);
    overflow-x: auto;
}

.card-tab {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    white-space: nowrap;
    flex-shrink: 0;
}

.card-tab.active {
    background: var(--gradient-main);
    color: white;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

.card-tab:hover:not(.active) {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.card-tab.has-drawable:not(.active) {
    animation: tabBlink 1s ease-in-out infinite;
    color: var(--accent-gold);
    border: 1px solid rgba(245, 158, 11, 0.4);
}

@keyframes tabBlink {

    0%,
    100% {
        background: rgba(245, 158, 11, 0.1);
        box-shadow: none;
    }

    50% {
        background: rgba(245, 158, 11, 0.25);
        box-shadow: 0 0 12px rgba(245, 158, 11, 0.3);
    }
}

/* ── Multi-Card Layout ─────────────────────────────── */
.all-cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.card-wrapper {
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
    transition: box-shadow 0.3s ease;
}

.card-label {
    text-align: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-purple);
    margin-bottom: 8px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.card-wrapper.card-highlight {
    box-shadow: 0 0 25px rgba(102, 126, 234, 0.5);
    border-color: rgba(102, 126, 234, 0.6);
    transition: box-shadow 0.3s ease-in, border-color 0.3s ease-in;
}

.card-wrapper:not(.card-highlight) {
    transition: box-shadow 0.6s ease-out, border-color 0.6s ease-out;
}

@media (max-width: 600px) {
    .all-cards-container {
        grid-template-columns: 1fr;
    }
}

/* ── Countdown Timer ───────────────────────────────── */
.countdown-timer {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: var(--radius-full);
    font-size: 0.9rem;
    color: var(--accent-gold);
    font-family: 'Outfit', monospace;
}

/* ── Datetime input styling ────────────────────────── */
input[type="datetime-local"] {
    color-scheme: dark;
}

select.form-control {
    appearance: auto;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
}

select.form-control option {
    background-color: #1e293b;
    color: #f1f5f9;
    padding: 8px 12px;
}

select.form-control option:hover,
select.form-control option:checked {
    background-color: #334155;
    color: #fff;
}

/* ── Ranking Leaderboard ───────────────────────────── */
.ranking-section {
    padding: 20px;
}

.ranking-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.ranking-item:nth-child(odd) {
    background: rgba(255, 255, 255, 0.02);
}

.ranking-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.ranking-item.ranking-top {
    background: rgba(245, 158, 11, 0.06);
}

.ranking-item.ranking-top:hover {
    background: rgba(245, 158, 11, 0.12);
}

.ranking-position {
    font-size: 1.3rem;
    width: 36px;
    text-align: center;
    flex-shrink: 0;
}

.rank-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 700;
}

.ranking-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.ranking-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ranking-name {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ranking-date {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.ranking-wins {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.ranking-count {
    font-size: 1.3rem;
    font-weight: 800;
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.ranking-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── Finished Room Cards ───────────────────────────── */
.room-finished {
    opacity: 0.75;
    border-color: rgba(255, 255, 255, 0.04);
}

.room-finished:hover {
    opacity: 0.9;
}

.status-finished {
    background: rgba(100, 116, 139, 0.15);
    color: #94a3b8;
}

.winner-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.25);
    color: var(--accent-gold);
    font-size: 0.88rem;
    font-weight: 500;
}