@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=Space+Grotesk:wght@500;600;700&display=swap');

:root {
    --bg-primary: #0c0e1a;
    --bg-secondary: #131629;
    --bg-card: #1a1d35;
    --bg-elevated: #222545;
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-default: rgba(255, 255, 255, 0.1);
    --border-hover: rgba(255, 255, 255, 0.18);
    --text-primary: #f0f0f5;
    --text-secondary: #9ca3b8;
    --text-muted: #6b7280;
    --accent-red: #ef4444;
    --accent-red-glow: rgba(239, 68, 68, 0.25);
    --accent-gold: #f59e0b;
    --accent-gold-glow: rgba(245, 158, 11, 0.25);
    --accent-green: #10b981;
    --accent-green-glow: rgba(16, 185, 129, 0.2);
    --accent-blue: #3b82f6;
    --accent-blue-glow: rgba(59, 130, 246, 0.2);
    --accent-purple: #8b5cf6;
    --accent-purple-glow: rgba(139, 92, 246, 0.2);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.4);
    --shadow-glow: 0 0 30px rgba(239, 68, 68, 0.15);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    padding: 40px 0 24px;
    position: relative;
}

header h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 3.5em;
    font-weight: 900;
    background: linear-gradient(135deg, #ef4444 0%, #f59e0b 50%, #ef4444 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 6px;
    animation: shimmer 3s ease infinite;
    filter: drop-shadow(0 4px 20px rgba(239, 68, 68, 0.3));
}

@keyframes shimmer {
    0%, 100% { background-position: 0% center; }
    50% { background-position: 200% center; }
}

header p {
    color: var(--text-muted);
    margin-top: 8px;
    font-size: 1em;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.auth-section {
    max-width: 420px;
    margin: 40px auto;
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: 40px;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.auth-section h2 {
    text-align: center;
    margin-bottom: 28px;
    color: var(--accent-red);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.6em;
    font-weight: 700;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-size: 0.85em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 13px 18px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.95em;
    outline: none;
    transition: all 0.25s ease;
}

.form-group input:focus, .form-group select:focus {
    border-color: var(--accent-red);
    box-shadow: 0 0 0 3px var(--accent-red-glow);
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
    letter-spacing: 0.3px;
}

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

.btn-primary {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #fff;
    width: 100%;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 25px rgba(239, 68, 68, 0.45);
    transform: translateY(-1px);
}

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

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    box-shadow: 0 6px 25px rgba(16, 185, 129, 0.45);
    transform: translateY(-1px);
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.btn-warning:hover {
    box-shadow: 0 6px 25px rgba(245, 158, 11, 0.45);
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    box-shadow: 0 6px 25px rgba(239, 68, 68, 0.45);
    transform: translateY(-1px);
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.82em;
}

.auth-toggle {
    text-align: center;
    margin-top: 20px;
    color: var(--text-muted);
    font-size: 0.9em;
}

.auth-toggle a {
    color: var(--accent-red);
    cursor: pointer;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.auth-toggle a:hover {
    color: #f87171;
    text-decoration: underline;
}

.error-msg {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 18px;
    text-align: center;
    font-size: 0.88em;
    color: #fca5a5;
    display: none;
}

.lobby-section {
    display: none;
}

.lobby-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 18px 24px;
}

.lobby-header .user-info {
    color: var(--text-secondary);
    font-size: 0.95em;
}

.lobby-header .user-info strong {
    color: var(--accent-gold);
    font-weight: 700;
}

.lobby-header > div:last-child {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.create-room {
    display: flex;
    gap: 10px;
    margin-bottom: 28px;
    flex-wrap: wrap;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
}

.create-room input {
    flex: 1;
    min-width: 180px;
    padding: 12px 16px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.9em;
    outline: none;
    transition: all 0.25s ease;
}

.create-room input:focus {
    border-color: var(--accent-red);
    box-shadow: 0 0 0 3px var(--accent-red-glow);
}

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

.create-room select {
    padding: 12px 16px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.9em;
    outline: none;
    cursor: pointer;
}

.create-room select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.create-room input[type="number"] {
    padding: 12px 16px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.9em;
    outline: none;
}

.create-room input[type="number"]:focus {
    border-color: var(--accent-red);
    box-shadow: 0 0 0 3px var(--accent-red-glow);
}

.rooms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.room-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 22px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.room-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-red), var(--accent-gold));
    opacity: 0;
    transition: opacity 0.3s;
}

.room-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.room-card:hover::before {
    opacity: 1;
}

.room-card h3 {
    color: var(--accent-gold);
    margin-bottom: 10px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.15em;
}

.room-card .room-info {
    color: var(--text-muted);
    font-size: 0.88em;
    margin-bottom: 6px;
}

.room-card .room-info strong {
    color: var(--text-secondary);
}

.room-card .room-status {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 0.75em;
    font-weight: 700;
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.room-status.waiting {
    background: var(--accent-green-glow);
    color: var(--accent-green);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.room-status.playing {
    background: var(--accent-gold-glow);
    color: var(--accent-gold);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.no-rooms {
    text-align: center;
    color: var(--text-muted);
    padding: 60px 20px;
    grid-column: 1 / -1;
    font-size: 1em;
}

.game-container {
    display: none;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 18px 24px;
}

.game-header h2 {
    color: var(--accent-gold);
    font-family: 'Space Grotesk', sans-serif;
}

.game-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.game-settings-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.game-setting-compact {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 8px 14px;
}

.game-setting-compact label {
    font-weight: 600;
    color: var(--accent-gold);
    font-size: 0.82em;
    white-space: nowrap;
}

.card-settings {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 20px;
}

.card-settings-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.card-settings-inner label {
    font-weight: 600;
    color: var(--accent-gold);
    font-size: 0.9em;
}

.bet-input-group {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-default);
    border-radius: 6px;
    overflow: hidden;
}

.bet-input-group.compact {
    border-radius: 6px;
}

.bet-currency {
    padding: 8px 10px;
    background: var(--bg-elevated);
    color: var(--accent-gold);
    font-weight: 700;
    font-size: 0.95em;
    border-right: 1px solid var(--border-default);
}

.bet-input-group input {
    width: 90px;
    padding: 8px 10px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.95em;
    outline: none;
}

.bet-status-label {
    color: var(--text-secondary);
    font-size: 0.82em;
    font-weight: 500;
}

.btn-xs {
    padding: 7px 14px;
    font-size: 0.8em;
}

.card-count-selector {
    display: flex;
    align-items: center;
    gap: 0;
}

.card-count-selector.compact .card-count-btn {
    width: 30px;
    height: 30px;
    font-size: 1em;
}

.card-count-selector.compact span {
    width: 36px;
    height: 30px;
    font-size: 1em;
}

.card-count-btn {
    width: 38px;
    height: 38px;
    border: 1px solid var(--border-default);
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-size: 1.2em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-count-btn:first-child {
    border-radius: 6px 0 0 6px;
}

.card-count-btn:last-child {
    border-radius: 0 6px 6px 0;
}

.card-count-btn:hover {
    background: var(--accent-red-glow);
    border-color: var(--accent-red);
}

.card-count-selector span {
    width: 48px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-default);
    border-bottom: 1px solid var(--border-default);
    font-size: 1.2em;
    font-weight: 700;
}

.card-count-label {
    color: var(--text-muted);
    font-size: 0.82em;
}

.card-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
}

.card-tab {
    padding: 8px 20px;
    border: 1px solid var(--border-default);
    border-bottom: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    background: var(--bg-elevated);
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.88em;
}

.card-tab.active {
    background: var(--accent-red-glow);
    border-color: var(--accent-red);
    color: var(--accent-red);
}

.card-tab:hover:not(.active) {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
}

.cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.bingo-board {
    max-width: 520px;
    margin: 0 auto;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    width: 100%;
}

.bingo-board-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.card-label {
    color: var(--text-secondary);
    font-size: 0.88em;
    font-weight: 600;
}

.card-actions {
    display: flex;
    gap: 6px;
}

.change-card-btn, .save-card-btn {
    padding: 4px 12px !important;
    font-size: 0.75em !important;
}

.mark-count {
    color: var(--accent-gold);
    font-size: 0.82em;
    font-weight: 600;
}

.game-type-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
}

.game-type-badge span:first-child {
    background: var(--accent-gold-glow);
    color: var(--accent-gold);
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 0.82em;
    font-weight: 700;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.game-type-desc {
    color: var(--text-muted);
    font-size: 0.78em;
    font-style: italic;
}

.saved-badge {
    background: var(--accent-green-glow);
    color: var(--accent-green);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7em;
    font-weight: 700;
    vertical-align: middle;
}

.saved-label {
    color: var(--accent-green);
    font-size: 0.8em;
    font-weight: 600;
}

.bingo-header-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    margin-bottom: 4px;
}

.bingo-header-cell {
    text-align: center;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.6em;
    font-weight: 800;
    padding: 8px;
    border-radius: var(--radius-sm);
}

.bingo-header-cell:nth-child(1) { color: var(--accent-red); }
.bingo-header-cell:nth-child(2) { color: var(--accent-gold); }
.bingo-header-cell:nth-child(3) { color: var(--accent-green); }
.bingo-header-cell:nth-child(4) { color: var(--accent-purple); }
.bingo-header-cell:nth-child(5) { color: var(--accent-blue); }

.bingo-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
}

.bingo-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4em;
    font-weight: 700;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    border: 2px solid var(--border-subtle);
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.bingo-cell:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-hover);
}

.bingo-cell.marked {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border-color: #ef4444;
    transform: scale(0.95);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.3);
}

.bingo-cell.free {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border-color: #f59e0b;
    font-size: 0.7em;
    font-weight: 600;
}

.bingo-cell.callable {
    border-color: var(--accent-green);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
}

.drawn-section {
    margin-top: 20px;
}

.drawn-section h3 {
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-align: center;
    font-size: 0.95em;
    font-weight: 600;
}

.last-drawn {
    text-align: center;
    margin-bottom: 16px;
}

.last-drawn .big-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.5em;
    font-weight: 800;
    box-shadow: var(--shadow-md);
}

.big-number.B { background: linear-gradient(135deg, #ef4444, #dc2626); }
.big-number.I { background: linear-gradient(135deg, #f59e0b, #d97706); }
.big-number.N { background: linear-gradient(135deg, #10b981, #059669); }
.big-number.G { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.big-number.O { background: linear-gradient(135deg, #3b82f6, #2563eb); }

.drawn-numbers-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    max-height: 200px;
    overflow-y: auto;
    padding: 10px;
}

.drawn-ball {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72em;
    font-weight: 700;
    background: var(--bg-elevated);
    border: 2px solid var(--border-default);
}

.drawn-ball.B { border-color: var(--accent-red); color: var(--accent-red); }
.drawn-ball.I { border-color: var(--accent-gold); color: var(--accent-gold); }
.drawn-ball.N { border-color: var(--accent-green); color: var(--accent-green); }
.drawn-ball.G { border-color: var(--accent-purple); color: var(--accent-purple); }
.drawn-ball.O { border-color: var(--accent-blue); color: var(--accent-blue); }

.players-sidebar {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 18px;
    margin-top: 20px;
}

.players-sidebar h3 {
    color: var(--accent-gold);
    margin-bottom: 12px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1em;
}

.player-item {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9em;
}

.player-item .host-badge {
    background: var(--accent-gold);
    color: #000;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 0.7em;
    font-weight: 700;
    margin-left: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.game-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
}

.ball-animation-container {
    display: none;
    justify-content: center;
    align-items: center;
    padding: 20px 0;
    margin-bottom: 16px;
}

.ball-machine {
    position: relative;
    width: 200px;
    height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.ball-chute {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 50%, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.01) 60%, transparent 70%);
    border: 3px solid var(--border-default);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.ball-chute::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(from 0deg, transparent, rgba(255,255,255,0.08), transparent, rgba(255,255,255,0.04), transparent);
    animation: chuteGlow 2s linear infinite;
}

@keyframes chuteGlow {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.rolling-ball {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, rgba(239,68,68,0.8), #ef4444);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.6em;
    font-weight: 800;
    color: #fff;
    z-index: 2;
    position: relative;
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.5), inset 0 -4px 8px rgba(0, 0, 0, 0.3), inset 0 4px 8px rgba(255, 255, 255, 0.2);
    opacity: 0;
    transition: opacity 0.3s;
}

.rolling-ball::after {
    content: '';
    position: absolute;
    top: 12px;
    left: 20px;
    width: 20px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(-30deg);
}

.rolling-ball.rolling {
    opacity: 1;
    animation: ballSpin 1.5s cubic-bezier(0.2, 0, 0.3, 1) forwards;
}

.rolling-ball.reveal {
    opacity: 1;
    animation: ballReveal 0.6s ease forwards;
}

@keyframes ballSpin {
    0% { transform: scale(0.3) rotate(0deg); opacity: 0; }
    20% { opacity: 1; }
    30% { transform: scale(1.1) rotate(180deg) translateY(-10px); }
    50% { transform: scale(0.95) rotate(360deg) translateY(5px); }
    65% { transform: scale(1.05) rotate(540deg) translateY(-5px); }
    80% { transform: scale(0.98) rotate(660deg) translateY(2px); }
    100% { transform: scale(1) rotate(720deg) translateY(0); }
}

@keyframes ballReveal {
    0% { transform: scale(1) rotate(720deg); }
    40% { transform: scale(1.3) rotate(720deg); box-shadow: 0 0 40px rgba(239, 68, 68, 0.6), 0 6px 30px rgba(0, 0, 0, 0.5); }
    70% { transform: scale(0.95) rotate(720deg); }
    100% { transform: scale(1.1) rotate(720deg); box-shadow: 0 0 50px rgba(239, 68, 68, 0.5), 0 6px 30px rgba(0, 0, 0, 0.5); }
}

@keyframes bounceIn {
    0% { transform: scale(0); opacity: 0; }
    60% { transform: scale(1.05); opacity: 1; }
    100% { transform: scale(1); }
}

.winner-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(8px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.winner-overlay.active {
    display: flex;
}

.winner-content {
    text-align: center;
    animation: bounceIn 0.5s ease;
}

.winner-content h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 3.5em;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 16px;
}

.winner-content p {
    font-size: 1.3em;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 14px 24px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    font-weight: 600;
    font-size: 0.9em;
    z-index: 9999;
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: var(--shadow-md);
}

.notification.show {
    transform: translateX(0);
}

.notification.error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.game-status-bar {
    text-align: center;
    padding: 14px;
    border-radius: var(--radius-md);
    margin-bottom: 18px;
    font-weight: 600;
    font-size: 1em;
}

.game-status-bar.waiting {
    background: var(--accent-green-glow);
    color: var(--accent-green);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.game-status-bar.playing {
    background: var(--accent-gold-glow);
    color: var(--accent-gold);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.game-status-bar.finished {
    background: var(--accent-red-glow);
    color: var(--accent-red);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.balance-display {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 16px;
    background: var(--accent-green-glow);
    color: var(--accent-green);
    padding: 5px 16px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.88em;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.bet-badge {
    background: var(--accent-red-glow);
    color: var(--accent-red);
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 0.82em;
    font-weight: 700;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.wallet-content {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: 36px;
    max-width: 460px;
    width: 92%;
    text-align: center;
    animation: bounceIn 0.4s ease;
    box-shadow: var(--shadow-lg), 0 0 60px rgba(0,0,0,0.5);
    max-height: 90vh;
    overflow-y: auto;
}

.wallet-content h2 {
    color: var(--accent-gold);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.5em;
    margin-bottom: 8px;
}

.wallet-balance {
    font-size: 2em;
    font-weight: 800;
    color: var(--accent-green);
    margin-bottom: 24px;
    font-family: 'Space Grotesk', sans-serif;
}

.wallet-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.wallet-form input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.92em;
    text-align: center;
    outline: none;
    transition: all 0.25s ease;
}

.wallet-form input:focus {
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 3px var(--accent-gold-glow);
}

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

.wallet-btns {
    display: flex;
    gap: 10px;
}

.tx-history {
    margin-top: 16px;
    max-height: 220px;
    overflow-y: auto;
    text-align: left;
}

.tx-history h4 {
    color: var(--text-secondary);
    margin-bottom: 10px;
    text-align: center;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tx-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    margin-bottom: 6px;
    font-size: 0.88em;
    align-items: center;
}

.chat-sidebar {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 18px;
    margin-top: 16px;
    display: flex;
    flex-direction: column;
}

.chat-sidebar h3 {
    color: var(--accent-gold);
    margin-bottom: 10px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1em;
}

.chat-messages {
    height: 250px;
    overflow-y: auto;
    margin-bottom: 10px;
    padding: 10px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}

.chat-msg {
    margin-bottom: 8px;
    font-size: 0.85em;
    word-break: break-word;
    line-height: 1.5;
}

.chat-msg strong {
    color: var(--accent-gold);
}

.chat-input-row {
    display: flex;
    gap: 8px;
}

.chat-input-row input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.88em;
    outline: none;
    transition: all 0.25s ease;
}

.chat-input-row input:focus {
    border-color: var(--accent-red);
    box-shadow: 0 0 0 3px var(--accent-red-glow);
}

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

.wallet-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    padding: 3px;
    border: 1px solid var(--border-subtle);
}

.wallet-tab {
    flex: 1;
    padding: 10px 12px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.82em;
    cursor: pointer;
    transition: all 0.25s;
}

.wallet-tab.active {
    background: var(--accent-red);
    color: #fff;
    box-shadow: 0 2px 10px rgba(239, 68, 68, 0.3);
}

.wallet-tab:hover:not(.active) {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.04);
}

.wallet-tab-content {
    display: none;
}

.wallet-tab-content.active {
    display: block;
}

.gcash-info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(59, 130, 246, 0.04));
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 18px;
    text-align: center;
}

.gcash-info p {
    color: var(--text-secondary);
    font-size: 0.88em;
    margin-bottom: 4px;
}

.gcash-number {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.6em;
    font-weight: 800;
    color: var(--accent-blue);
    letter-spacing: 2px;
    margin: 6px 0;
}

.gcash-name-display {
    color: var(--text-secondary);
    font-size: 0.95em;
    font-weight: 600;
    margin-top: 2px;
}

.wallet-form input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.92em;
    text-align: center;
    outline: none;
    transition: all 0.25s ease;
}

.wallet-form input[type="text"]:focus {
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 3px var(--accent-gold-glow);
}

.wallet-form input[type="text"]::placeholder {
    color: var(--text-muted);
}

.my-requests {
    max-height: 180px;
    overflow-y: auto;
    margin-top: 8px;
}

.cashout-method-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 14px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    padding: 3px;
    border: 1px solid var(--border-subtle);
}

.cashout-method-tab {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.82em;
    cursor: pointer;
    transition: all 0.25s;
}

.cashout-method-tab.active {
    background: var(--accent-gold);
    color: #000;
    box-shadow: 0 2px 10px rgba(245, 158, 11, 0.3);
}

.cashout-method-tab:hover:not(.active) {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.04);
}

.admin-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 4px;
    border: 1px solid var(--border-subtle);
}

.admin-tab {
    flex: 1;
    padding: 14px 16px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.88em;
    cursor: pointer;
    transition: all 0.25s;
}

.admin-tab.active {
    background: linear-gradient(135deg, var(--accent-gold), #d97706);
    color: #000;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.admin-tab:hover:not(.active) {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.04);
}

.admin-tab-content {
    display: none;
}

.admin-tab-content.active {
    display: block;
}

.admin-request-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 18px 22px;
    margin-bottom: 10px;
    transition: all 0.25s;
}

.admin-request-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-sm);
}

.admin-request-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.admin-request-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.admin-settings {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 28px;
    max-width: 520px;
}

.admin-settings h3 {
    color: var(--accent-gold);
    font-family: 'Space Grotesk', sans-serif;
    margin-bottom: 14px;
    font-size: 1.1em;
}

.admin-settings .form-group {
    margin-bottom: 14px;
}

.admin-settings input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.92em;
    outline: none;
    transition: all 0.25s ease;
}

.admin-settings input:focus {
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 3px var(--accent-gold-glow);
}

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

@media (max-width: 1024px) {
    .container {
        padding: 12px;
    }

    .game-layout {
        grid-template-columns: 1fr;
    }

    .cards-container {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    header {
        padding: 20px 0 14px;
    }

    header h1 {
        font-size: 2.2em;
        letter-spacing: 4px;
    }

    header p {
        font-size: 0.82em;
    }

    .game-header {
        padding: 12px 14px;
        gap: 8px;
    }

    .game-header h2 {
        font-size: 1.1em;
    }

    .game-controls {
        gap: 6px;
    }

    .game-controls .btn-small {
        padding: 6px 10px;
        font-size: 0.75em;
    }

    .game-status-bar {
        padding: 10px;
        font-size: 0.88em;
        margin-bottom: 12px;
    }

    .game-settings-row {
        gap: 8px;
        margin-bottom: 12px;
    }

    .game-setting-compact {
        padding: 6px 10px;
        gap: 6px;
    }

    .cards-container {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .bingo-board {
        padding: 14px;
        max-width: 100%;
    }

    .bingo-header-cell {
        font-size: 1.4em;
        padding: 6px;
    }

    .bingo-cell {
        font-size: 1.2em;
    }

    .bingo-cell.free {
        font-size: 0.6em;
    }

    .bingo-grid {
        gap: 3px;
    }

    .bingo-header-row {
        gap: 3px;
    }

    .drawn-section h3 {
        font-size: 0.85em;
    }

    .drawn-ball {
        width: 32px;
        height: 32px;
        font-size: 0.65em;
    }

    .last-drawn .big-number {
        width: 65px;
        height: 65px;
        font-size: 1.2em;
    }

    .players-sidebar, .chat-sidebar {
        padding: 14px;
    }

    .chat-messages {
        height: 180px;
    }

    .lobby-header {
        flex-direction: column;
        text-align: center;
        padding: 14px;
    }

    .lobby-header > div:last-child {
        justify-content: center;
    }

    .create-room {
        flex-direction: column;
        padding: 14px;
    }

    .create-room input {
        min-width: unset;
    }

    .card-settings-inner {
        justify-content: center;
    }

    .wallet-content {
        padding: 24px 14px;
        width: 96%;
    }

    .admin-tabs {
        flex-wrap: wrap;
    }

    .admin-tab {
        font-size: 0.78em;
        padding: 10px 8px;
    }

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

    .game-type-badge {
        flex-wrap: wrap;
        gap: 6px;
    }

    .ball-machine {
        width: 150px;
        height: 150px;
    }

    .ball-chute {
        width: 120px;
        height: 120px;
    }

    .notification {
        top: 10px;
        right: 10px;
        left: 10px;
        text-align: center;
        font-size: 0.85em;
        padding: 10px 16px;
    }

    .winner-content h2 {
        font-size: 2.5em;
    }

    .winner-content p {
        font-size: 1.1em;
    }

    .balance-display {
        margin-left: 8px;
        font-size: 0.82em;
        padding: 4px 12px;
    }
}

@media (max-width: 400px) {
    .container {
        padding: 6px;
    }

    header h1 {
        font-size: 1.8em;
    }

    .bingo-cell {
        font-size: 1em;
        border-width: 1px;
    }

    .bingo-header-cell {
        font-size: 1.2em;
        padding: 4px;
    }

    .bingo-board {
        padding: 10px;
    }

    .game-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .drawn-numbers-list {
        max-height: 140px;
    }
}

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

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

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}
