:root {
    --primary-color: #3b82f6;
    --secondary-color: #64748b;
    --background-color: #0b1120;
    --card-background: #1e293b;
    --text-color: #f1f5f9;
    --accent-color: #fbbf24;
    --danger-color: #ef4444;
    --success-color: #22c55e;
}

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

body {
    background-color: var(--background-color);
    color: var(--text-color);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    line-height: 1.5;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

.container-fluid {
    width: 100%;
    padding: 0;
    margin: 0;
    max-width: 100%;
}

/* Header & Nav */
header {
    background-color: #0f172a;
    border-bottom: 1px solid #1e293b;
    padding: 0.5rem 0;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1900px;
    margin: 0 auto;
    width: 100%;
    padding: 0 20px;
}

nav ul {
    display: flex;
    gap: 1.5rem;
}

nav a {
    color: #94a3b8;
    transition: color 0.2s;
    font-weight: 500;
    font-size: 0.9rem;
}

nav a:hover {
    color: white;
}

.logo {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary-color);
    letter-spacing: -0.5px;
}

/* =========================================
   MAIN GAME LAYOUT
   ========================================= */
.play-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    height: calc(100vh - 70px);
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    background: #0f172a;
    position: relative;
    align-items: start;
    border-right: 1px solid #1e293b;
    border-left: 1px solid #1e293b;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

@media (max-width: 1024px) {
    .play-grid {
        grid-template-columns: 1fr;
        height: auto;
        overflow-y: auto;
    }
}

.back-icon {
    color: #64748b;
    cursor: pointer;
}

/* =========================================
   NOTE: Upstakes HEADER Styles
   ========================================= */
.game-header {
    background: #0f172a;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    border-bottom: 1px solid #1e293b;
    position: relative;
    height: 70px;
    z-index: 50;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    border-left: 1px solid #1e293b;
    border-right: 1px solid #1e293b;
    box-sizing: border-box;
}

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

.stage-title {
    color: #2dd4bf;
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
}

/* RIGHT: Timers & Progress */
.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.timer-badge {
    background: #1e293b;
    border: 1px solid #334155;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 140px;
    justify-content: center;
}

.timer-badge span {
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
}

.timer-badge.critical {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    color: #fca5a5;
    animation: pulse-red 1s infinite;
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

.header-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: transparent;
    z-index: 60;
}

.progress-fill {
    height: 100%;
    background: #2dd4bf;
    box-shadow: 0 0 15px rgba(45, 212, 191, 0.6);
    transition: width 1s linear, background-color 0.3s, box-shadow 0.3s;
}

.progress-fill.critical {
    background: #ef4444;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.8);
}

/* --- LEFT COLUMN: TABLE + CONTROLS --- */
.table-area-wrapper {
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: calc(100vh - 85px);
    background: radial-gradient(circle at center, #1e293b 0%, #020617 100%);
    border-right: 1px solid #1e293b;
}

.table-area {
    flex: 0 0 55vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 20px 20px;
}

.poker-table-container {
    width: 60%;
    max-width: 850px;
    aspect-ratio: 2.15/1;
    position: relative;
}

.poker-table {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: radial-gradient(ellipse at center, #065f46 0%, #064e3b 100%);
    border: 18px solid #111827;
    border-radius: 9999px;
    box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.8), 0 30px 60px rgba(0, 0, 0, 0.5);
}

.community-cards {
    position: absolute;
    top: 48%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    gap: 8px;
    z-index: 5;
}

.pot-display {
    position: absolute;
    top: 28%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.9);
    color: #fbbf24;
    padding: 5px 14px;
    border-radius: 99px;
    font-size: 0.95rem;
    font-weight: 700;
    border: 1px solid rgba(251, 191, 36, 0.2);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.seat {
    position: absolute;
    width: 70px;
    height: 70px;
    background: #1e293b;
    border: 3px solid #334155;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 20;
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.4);
}

.seat.hero {
    border-color: #3b82f6;
    box-shadow: 0 0 25px rgba(59, 130, 246, 0.3);
    z-index: 25;
}

.seat-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #cbd5e1;
}

.seat-stack {
    font-size: 0.75rem;
    font-weight: 700;
    color: #fbbf24;
}

.seat-0 {
    bottom: -45px;
    left: 50%;
    transform: translateX(-50%);
}

.seat-1 {
    bottom: 8%;
    left: -25px;
}

.seat-2 {
    top: 8%;
    left: -25px;
}

.seat-3 {
    top: -45px;
    left: 50%;
    transform: translateX(-50%);
}

.seat-4 {
    top: 8%;
    right: -25px;
}

.seat-5 {
    bottom: 8%;
    right: -25px;
}

.dealer-btn {
    position: absolute;
    width: 24px;
    height: 24px;
    background: white;
    color: black;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    top: -8px;
    right: -8px;
    z-index: 25;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.seat-0 .dealer-btn {
    top: 50%;
    right: -28px;
    transform: translateY(-50%);
}

.hole-cards {
    position: absolute;
    top: -85px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 3px;
    z-index: 30;
}

.card-visual {
    width: 44px;
    height: 62px;
    background: white;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    font-family: 'Inter', sans-serif;
}

.card-visual.red {
    color: #dc2626;
}

.card-visual.black {
    color: #0f172a;
}

.card-rank,
.card-suit {
    font-size: 1.3rem;
    font-weight: 800;
    line-height: 1;
}

.card-suit {
    margin-top: -2px;
}

/* --- CONTROLS AREA --- */
.bottom-controls {
    background: #0f172a;
    border-top: 1px solid #1e293b;
    padding: 2rem 3rem;
    z-index: 40;
}

.narrative-container {
    margin-bottom: 2rem;
    text-align: center;
    color: #e2e8f0;
    font-size: 1.1rem;
    line-height: 1.6;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;

    /* FIX JUMPING: Reserve space for 2 lines */
    min-height: 4.5rem;
}

.inline-card {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: white;
    color: black;
    padding: 0 4px;
    border-radius: 3px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    margin: 0 2px;
    font-size: 0.9em;
    height: 1.4em;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.inline-card.red {
    color: #dc2626;
}

.inline-card.black {
    color: #0f172a;
}

.options-grid {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    width: 100%;
}

.game-btn {
    display: inline-block;
    padding: 14px 24px;
    background: transparent;
    border: 2px solid #334155;
    color: #cbd5e1;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    position: relative;
    overflow: hidden;
    flex: 1;
}

.game-btn:hover {
    border-color: #64748b;
    background: rgba(100, 116, 139, 0.1);
    color: white;
}

.game-btn.selected {
    background: rgba(45, 212, 191, 0.1);
    border-color: #2dd4bf;
    color: #2dd4bf;
    box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.2), 0 0 12px rgba(45, 212, 191, 0.3);
}

.controls-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 3rem;
    padding-right: 2rem;
}

.confirm-btn {
    background: #2dd4bf;
    color: #0f172a;
    border: none;
    padding: 1rem 3rem;
    border-radius: 99px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-block;
    opacity: 0.5;
    pointer-events: none;
}

.confirm-btn.active {
    opacity: 1;
    pointer-events: auto;
    box-shadow: 0 0 20px rgba(45, 212, 191, 0.4);
}

.confirm-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(45, 212, 191, 0.6);
}

/* --- RIGHT SIDEBAR --- */
.sidebar {
    background: #0f172a;
    border-left: 1px solid #1e293b;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sidebar-header {
    background: #1e293b;
    padding: 1.5rem;
    border-bottom: 1px solid #334155;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    font-weight: 700;
}

.timer-display {
    background: #0f172a;
    color: #fbbf24;
    padding: 4px 12px;
    border-radius: 100px;
    font-family: monospace;
    border: 1px solid #334155;
}

.info-panel {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.stacks-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

.stacks-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 2rem;
}

.stack-chip {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 6px;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: #94a3b8;
    transition: all 0.2s;
}

.stack-chip.hero {
    background: rgba(59, 130, 246, 0.1);
    border-color: #3b82f6;
    color: #e2e8f0;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}

.stack-chip .pos {
    font-weight: 700;
    text-transform: uppercase;
}

.stack-chip.hero .amt,
.stack-chip.hero .pos {
    color: #3b82f6;
    font-weight: 700;
}

.hand-history {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    color: #94a3b8;
    line-height: 1.6;
}

.hh-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    padding: 4px 0;
}

.hh-badge {
    background: #1e293b;
    color: #94a3b8;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    min-width: 35px;
    text-align: center;
    border: 1px solid #334155;
}

.hh-badge.hero {
    color: #2dd4bf;
    border-color: rgba(45, 212, 191, 0.3);
    background: rgba(45, 212, 191, 0.1);
}

.hh-action-text {
    color: #cbd5e1;
    font-size: 0.85rem;
}

.hh-action-arrow {
    color: #64748b;
    margin: 0 6px;
    font-size: 0.8rem;
}

.hh-street-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    padding-bottom: 4px;
    border-bottom: 1px solid #1e293b;
}

.hh-street-label {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    color: #e2e8f0;
    letter-spacing: 0.05em;
}

.hh-street-cards {
    display: flex;
}

.hh-street-cards .inline-card {
    height: 1.6em;
    margin-left: 4px;
}

/* Modal and Break Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal-overlay[style*="display: flex"] {
    display: flex !important;
}

.modal-box {
    background: #1e293b;
    padding: 2.5rem;
    border-radius: 16px;
    border: 1px solid #334155;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
    animation: popIn 0.2s ease forwards;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin-bottom: 1rem;
}

.modal-desc {
    color: #94a3b8;
    margin-bottom: 2rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.btn-secondary {
    background: transparent;
    border: 1px solid #475569;
    color: #cbd5e1;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

.btn-secondary:hover {
    border-color: #94a3b8;
    color: white;
}

.btn-danger {
    background: #ef4444;
    border: none;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

.btn-danger:hover {
    background: #dc2626;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes popIn {
    from {
        transform: scale(0.95);
    }

    to {
        transform: scale(1);
    }
}

.play-grid {
    transition: filter 0.3s ease;
}

.play-grid.blurred {
    filter: blur(8px);
    pointer-events: none;
    user-select: none;
}

.break-timer-large {
    font-size: 3rem;
    font-weight: 800;
    color: #2dd4bf;
    margin: 1rem 0;
    font-family: 'Inter', monospace;
}

/* --- Auth / Card Styles (Restored) --- */
.card {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-size: 0.95rem;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Form Inputs */
input[type="email"],
input[type="password"],
input[type="text"] {
    width: 100%;
    padding: 0.75rem;
    border-radius: 6px;
    border: 1px solid #334155;
    background: #0f172a;
    color: white;
    font-size: 1rem;
    transition: all 0.2s;
}

input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: #94a3b8;
    font-size: 0.9rem;
    font-weight: 500;
}