:root {
    --primary: #d4af37; /* Gold */
    --primary-glow: rgba(212, 175, 55, 0.4);
    --secondary: #c0c0c0; /* Silver */
    --accent: #8b0000; /* Deep Red */
    --felt-green: radial-gradient(circle, #0a3d24 0%, #051a10 100%);
    --bg-dark: #050505;
    --text-light: #f5f5f5;
    --text-dim: #a0a0a0;
    --glass: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --shadow-premium: 0 10px 30px rgba(0, 0, 0, 0.5);
    --font-main: 'Outfit', sans-serif;
    --font-serif: 'Playfair Display', serif;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-dark);
    color: var(--text-light);
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

#app {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.screen.active {
    opacity: 1;
    visibility: visible;
}

/* Glass Panel Styling */
.glass-panel {
    background: var(--glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: var(--shadow-premium);
}

/* Auth Screen */
#auth-screen {
    background: linear-gradient(rgba(0,0,0,0.7), rgba(0,0,0,0.7)), url('https://images.unsplash.com/photo-1596838132731-dd960a80401b?auto=format&fit=crop&q=80&w=2070') center/cover;
    justify-content: center;
    align-items: center;
}

.auth-container {
    padding: 2.5rem;
    width: 450px;
    text-align: center;
    animation: slideUp 0.8s ease-out;
}

.auth-mode {
    display: none;
}

.auth-mode.active {
    display: block;
}

.toggle-text {
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-dim);
}

.toggle-text a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.toggle-text a:hover {
    text-decoration: underline;
}

.logo {
    width: 120px;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 0 10px var(--primary-glow));
}

.brand-name {
    font-family: var(--font-serif);
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
    letter-spacing: 2px;
}

.tagline {
    font-weight: 300;
    color: var(--text-dim);
    margin-bottom: 2rem;
}

.input-group {
    margin-bottom: 1.5rem;
}

input {
    width: 100%;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

input:focus {
    border-color: var(--primary);
}

.btn-primary {
    width: 100%;
    padding: 1rem;
    background: var(--primary);
    color: black;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--primary-glow);
}

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

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.5rem 0;
    color: var(--text-dim);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--glass-border);
}

.divider:not(:empty)::before {
    margin-right: 1rem;
}

.divider:not(:empty)::after {
    margin-left: 1rem;
}

.social-login {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.btn-social {
    flex: 1;
    padding: 0.8rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s;
}

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

.cave-info {
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-dim);
}

.edgy-footer {
    margin-top: 2rem;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.2);
    text-transform: uppercase;
}

.table-footer {
    position: absolute;
    bottom: 10px;
    width: 100%;
    text-align: center;
    margin-top: 0;
}

.highlight {
    color: var(--primary);
    font-weight: 600;
}

/* Game Screen */
#game-screen {
    background: var(--bg-dark);
}

header {
    height: 80px;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.mini-logo {
    height: 40px;
}

.header-title {
    font-family: var(--font-serif);
    color: var(--primary);
    font-size: 1.5rem;
    font-weight: 700;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.balance-container {
    background: rgba(255,255,255,0.05);
    padding: 0.5rem 1.2rem;
    border-radius: 50px;
    border: 1px solid var(--primary);
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.balance-container .label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--primary);
}

.balance-container .value {
    font-size: 1.5rem;
    font-weight: 700;
}

.balance-container .currency {
    font-size: 0.8rem;
    color: var(--primary);
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    transition: color 0.3s;
}

.btn-icon:hover {
    color: var(--accent);
}

/* Casino Table */
.casino-table {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    position: relative;
    background: radial-gradient(circle at center, #1a1a1a 0%, #050505 100%);
    overflow: hidden;
}

.table-felt {
    flex: 1;
    min-height: 0; /* Important for flex-shrink */
    background: var(--felt-green);
    border-radius: 500px 500px 100px 100px;
    border: 10px solid #3d2b1f; /* Wood border */
    box-shadow: inset 0 0 100px rgba(0,0,0,0.8), 0 20px 50px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
    padding: 1rem;
    position: relative;
    margin-bottom: 1rem;
}

.area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    position: relative;
}

.label {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 3px;
    color: rgba(255,255,255,0.3);
    text-transform: uppercase;
}

.hand-container {
    display: flex;
    gap: -30px; /* Overlap effect */
    min-height: 160px;
    justify-content: center;
}

.score-badge {
    background: var(--primary);
    color: black;
    padding: 0.2rem 0.8rem;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.9rem;
}

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

#game-status {
    font-family: var(--font-serif);
    font-size: 2rem;
    color: var(--primary);
    text-shadow: 0 0 10px rgba(0,0,0,0.5);
}

/* Cards */
.card {
    width: 110px;
    height: 160px;
    background: white;
    border-radius: 8px;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    margin-right: -70px; /* Overlap */
    transition: transform 0.3s, margin-right 0.3s;
    animation: dealCard 0.5s ease-out;
}

.card:last-child {
    margin-right: 0;
}

.card.back {
    background: linear-gradient(135deg, #8b0000 0%, #4a0000 100%);
    border: 4px solid #f5f5f5;
}

.card.back::after {
    content: 'C';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-serif);
    font-size: 3rem;
    color: var(--primary);
    opacity: 0.5;
}

.card-inner {
    padding: 0.5rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.card.red { color: #d63031; }
.card.black { color: #2d3436; }

.card-top { display: flex; flex-direction: column; align-items: flex-start; line-height: 1; }
.card-suit { font-size: 1.5rem; }
.card-value { font-size: 1.2rem; font-weight: 700; }

.card-center { font-size: 3rem; align-self: center; }

.card-bottom { display: flex; flex-direction: column; align-items: flex-end; transform: rotate(180deg); line-height: 1; }

/* Controls Panel */
.controls-panel {
    height: 120px;
    padding: 0 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 3rem;
    transition: opacity 0.3s;
}

.control-group.hidden {
    display: none;
}

.bet-input-wrapper {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.chip-selector {
    display: flex;
    gap: 0.8rem;
}

.chip {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 4px dashed white;
    background: var(--accent);
    color: white;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.8rem;
}

.chip[data-value="50"] { background: #0984e3; }
.chip[data-value="100"] { background: #6c5ce7; }

.chip:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255,255,255,0.3);
}

.current-bet-display {
    font-size: 1.5rem;
    font-weight: 700;
    min-width: 100px;
}

.btn-secondary {
    padding: 1rem 2.5rem;
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
}

.btn-secondary:hover {
    background: var(--primary);
    color: black;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 100;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    padding: 3rem;
    text-align: center;
    width: 400px;
}

#modal-title {
    font-family: var(--font-serif);
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

#modal-message {
    font-size: 1.2rem;
    color: var(--text-dim);
    margin-bottom: 2rem;
}

/* Animations */
@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes dealCard {
    from { opacity: 0; transform: translateY(-100px) rotate(-20deg); }
    to { opacity: 1; transform: translateY(0) rotate(0); }
}

@media (max-width: 800px) {
    .table-felt {
        border-radius: 50px;
    }
    .auth-container {
        width: 90%;
    }
    .controls-panel {
        flex-direction: column;
        height: auto;
        padding: 1rem;
    }
}
