:root {
    --bg-gradient: radial-gradient(circle at 50% 10%, #0f172a 0%, #090d16 100%);
    --glass-bg: rgba(255, 255, 255, 0.04);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shine: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.02) 100%);
    --neon-gold: #f59e0b;
    --neon-green: #10b981;
    --neon-red: #ef4444;
    --neon-blue: #3b82f6;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --shadow-depth: 0 20px 40px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    --shadow-neu-inset: inset 4px 4px 8px #04060b, inset -4px -4px 8px #141c2d;
    --radius-capsule: 50px;
    --radius-card: 24px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body, html {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    background: var(--bg-gradient);
    color: var(--text-main);
    overflow: hidden;
}

.app-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.screen.active {
    display: flex;
    opacity: 1;
    pointer-events: auto;
}

/* Glass & Neo Components */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-depth);
    background-image: var(--glass-shine);
}

.btn-capsule {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 10px 24px;
    border-radius: var(--radius-capsule);
    cursor: pointer;
    font-weight: 600;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: all 0.2s ease;
}

.btn-capsule:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.4);
    border-color: rgba(255,255,255,0.3);
}

.btn-3d {
    border: none;
    border-radius: var(--radius-capsule);
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(0,0,0,0.4), inset 0 2px 3px rgba(255,255,255,0.4), inset 0 -3px 4px rgba(0,0,0,0.4);
    transition: transform 0.1s ease, filter 0.2s ease;
    background-image: linear-gradient(to bottom, rgba(255,255,255,0.15), rgba(0,0,0,0.2));
}

.btn-3d:active {
    transform: translateY(2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.4), inset 0 2px 2px rgba(0,0,0,0.4);
}

.primary-btn { background-color: var(--neon-blue); }
.success-btn { background-color: var(--neon-green); }
.danger-btn { background-color: var(--neon-red); }

/* AUTH SCREEN */
#auth-screen {
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 40px 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.logo-container {
    margin-bottom: 20px;
}

.glow-orb {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--neon-blue), var(--neon-green));
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.2rem;
    font-weight: 900;
    color: #fff;
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.6), inset 0 2px 4px rgba(255,255,255,0.6);
}

.auth-card h2 {
    font-size: 1.8rem;
    margin-bottom: 6px;
    letter-spacing: 1px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 25px;
}

.tab-switcher {
    display: flex;
    width: 100%;
    background: rgba(0,0,0,0.3);
    border-radius: var(--radius-capsule);
    padding: 4px;
    margin-bottom: 25px;
    box-shadow: var(--shadow-neu-inset);
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 10px;
    border-radius: var(--radius-capsule);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-btn.active {
    background: var(--glass-bg);
    color: var(--text-main);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    border: 1px solid var(--glass-border);
}

#auth-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-size: 0.85rem;
    color: var(--text-muted);
    padding-left: 12px;
}

.input-group input {
    width: 100%;
    padding: 14px 20px;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-capsule);
    color: var(--text-main);
    font-size: 1rem;
    box-shadow: var(--shadow-neu-inset);
    outline: none;
    transition: border-color 0.2s ease;
}

.input-group input:focus {
    border-color: var(--neon-blue);
}

.error-msg {
    color: var(--neon-red);
    font-size: 0.85rem;
    text-align: center;
    min-height: 20px;
}

/* GAME SCREEN */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(20px);
}

.user-info-capsule {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 6px 16px 6px 6px;
    border-radius: var(--radius-capsule);
}

.avatar-glow {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--neon-gold), #f97316);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 800;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.5);
}

.username-text {
    font-weight: 700;
    font-size: 0.95rem;
}

.chips-display {
    font-size: 0.85rem;
    color: var(--neon-gold);
    font-weight: 600;
}

.table-title {
    font-size: 1.5rem;
    letter-spacing: 2px;
    background: linear-gradient(to right, #fff, var(--text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* CASINO FELT */
.casino-table-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 20px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    overflow: hidden;
}

.casino-felt {
    flex: 1;
    background: radial-gradient(circle at center, #064e3b 0%, #022c22 100%);
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-radius: 32px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
    box-shadow: inset 0 0 50px rgba(0,0,0,0.8), 0 20px 40px rgba(0,0,0,0.5);
    position: relative;
    overflow-y: auto;
}

.felt-dealer-area {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0,0,0,0.25);
    padding: 10px 20px;
    border-radius: var(--radius-card);
    border: 1px solid rgba(255,255,255,0.08);
}

.dealer-badge {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
}

.dealer-score-box {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--neon-gold);
}

.table-center-divider {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
}

.pot-capsule {
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--neon-gold);
    padding: 8px 24px;
    border-radius: var(--radius-capsule);
    color: var(--neon-gold);
    font-weight: 700;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.2);
}

.game-status-shine {
    font-size: 1.1rem;
    font-weight: 700;
    text-align: center;
    background: linear-gradient(90deg, #fff, var(--neon-gold), #fff);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shineText 3s linear infinite;
}

@keyframes shineText {
    to { background-position: 200% center; }
}

.felt-players-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 15px;
    max-height: 280px;
    overflow-y: auto;
}

.player-seat-card {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-card);
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.player-seat-card.active-turn {
    border-color: var(--neon-gold);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.4);
}

.seat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    font-weight: 700;
}

.seat-cards-row {
    display: flex;
    gap: 6px;
    min-height: 60px;
    align-items: center;
    flex-wrap: wrap;
}

.seat-cards-row img {
    width: 40px;
    height: 58px;
    border-radius: 6px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.4);
    animation: cardDeal 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes cardDeal {
    0% { transform: translateY(-30px) scale(0.5); opacity: 0; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

.seat-footer {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* CONTROL PANEL */
.control-panel {
    padding: 15px 25px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: var(--radius-card);
}

.control-group {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.control-group.hidden {
    display: none;
}

.chip-selector {
    display: flex;
    gap: 8px;
}

.chip-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--glass-bg);
    border: 2px solid var(--neon-gold);
    color: var(--neon-gold);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    transition: transform 0.2s ease;
}

.chip-btn:hover {
    transform: scale(1.08);
    background: rgba(245, 158, 11, 0.15);
}

.chip-btn.clear-chip {
    border-color: var(--neon-red);
    color: var(--neon-red);
}

.current-bet-display {
    font-weight: 700;
    font-size: 1rem;
    color: var(--neon-gold);
    background: rgba(0,0,0,0.3);
    padding: 10px 20px;
    border-radius: var(--radius-capsule);
    border: 1px solid var(--glass-border);
}

/* MODAL */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    display: none;
    opacity: 0;
}

.modal-card {
    width: 90%;
    max-width: 500px;
    padding: 35px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.modal-card h2 {
    font-size: 1.5rem;
}

.modal-card ul {
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

.modal-card ul strong {
    color: var(--text-main);
}

/* Responsive */
@media (max-width: 768px) {
    .game-header {
        padding: 10px 15px;
    }
    .table-title {
        font-size: 1.2rem;
    }
    .casino-felt {
        padding: 10px;
    }
    .control-panel {
        padding: 10px;
    }
    .chip-btn {
        width: 38px;
        height: 38px;
        font-size: 0.75rem;
    }
}