:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --primary-color: #6366f1;
    --accent-color: #f59e0b;
    /* Gold */
    --success-color: #10b981;
    --danger-color: #ef4444;
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --glass-border: 1px solid rgba(255, 255, 255, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --font-family: 'Outfit', sans-serif;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    background-image: radial-gradient(circle at 50% 0%, #1e1b4b 0%, #0f172a 70%);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    overflow-x: hidden;
}

.app-container {
    width: 100%;
    max-width: 480px;
    /* Mobile first constrained width */
    min-height: 100vh;
    background: transparent;
    position: relative;
    padding-bottom: 80px;
    /* Space for footer */
}

/* Screens */
.screen {
    padding: 20px;
}

.hidden {
    display: none !important;
}

/* Typography */
h1 {
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 2rem;
    background: linear-gradient(to right, #c084fc, #6366f1);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 2rem;
    background: linear-gradient(to right, #c084fc, #6366f1);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

#show-controls {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-top: 10px;
}

#show-controls .btn-show {
    flex: 0 0 auto;
    width: 60%;
    max-width: 300px;
}

/* Forms */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

input {
    background: rgba(255, 255, 255, 0.05);
    border: var(--glass-border);
    border-radius: 12px;
    padding: 15px;
    color: white;
    font-size: 1rem;
    outline: none;
    outline: none;
    transition: border-color 0.3s;
    /* Ensure input flexes in row */
    flex: 1;
    min-width: 0;
    /* Prevent overflow */
}

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

button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 15px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

button:active {
    transform: scale(0.98);
}

.divider {
    text-align: center;
    margin: 20px 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 15px;
    padding: 15px;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    border: var(--glass-border);
    box-shadow: var(--shadow-lg);
}

.lobby-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.btn-small {
    padding: 5px 10px;
    font-size: 0.8rem;
    background: rgba(255, 255, 255, 0.1);
}

.pot-container {
    margin: 15px 0;
}

.pot-container .label {
    font-size: 0.8rem;
    letter-spacing: 2px;
    color: var(--accent-color);
    font-weight: 700;
}

.pot-container .value {
    font-size: 2.8rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 0 20px rgba(245, 158, 11, 0.5);
}

.stake-info {
    font-size: 0.9rem;
    color: var(--text-muted);
}

#current-stake {
    color: var(--text-color);
    font-weight: 600;
}

/* Players List */
#players-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.player-card {
    background: var(--card-bg);
    border: var(--glass-border);
    padding: 12px 16px;
    border-radius: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
}

.player-card.active-turn {
    border-color: var(--success-color);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.2);
    background: rgba(16, 185, 129, 0.1);
}

.player-card.packed {
    opacity: 0.5;
    background: rgba(0, 0, 0, 0.3);
}

.player-card.winner {
    border-color: var(--accent-color);
    background: rgba(245, 158, 11, 0.2);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.4);
}


.player-info {
    display: flex;
    flex-direction: column;
}

.player-name {
    font-weight: 600;
    font-size: 1.1rem;
}

.player-balance {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.player-status {
    font-size: 0.8rem;
    padding: 4px 8px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    font-weight: 600;
}

.status-blind {
    color: #60a5fa;
}

.status-seen {
    color: #a78bfa;
}

.status-packed {
    color: #94a3b8;
}

/* Footer Actions */
footer {
    position: fixed;
    bottom: 0;
    width: 100%;
    max-width: 480px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    border-top: var(--glass-border);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    /* Center the fixed footer */
    left: 50%;
    transform: translateX(-50%);
}

.status-bar {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.row {
    display: flex;
    gap: 10px;
}

.btn-action {
    flex: 1;
    padding: 16px;
    font-size: 0.95rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 14px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-fold {
    background: #334155;
}

.btn-blind {
    background: #6366f1;
}

.btn-seen {
    background: #8b5cf6;
}

/* Purple */
.btn-raise {
    background: #f59e0b;
    color: #fff;
}

/* Gold */
.btn-show {
    background: #ec4899;
}

/* Pink */

/* FAB */
.fab {
    position: fixed;
    bottom: 180px;
    /* Moved up to clear the footer */
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: var(--shadow-lg);
    z-index: 100;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 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;
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: #1e293b;
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 350px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    border: var(--glass-border);
    max-height: 90vh;
    /* Ensure modal fits on screen */
    overflow-y: auto;
    /* Allow scrolling if content is tall */
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--text-muted);
}

/* Toast */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--success-color);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    z-index: 300;
    opacity: 0;
    transition: opacity 0.3s;
}

.toast.show {
    opacity: 1;
}

/* Winner Grid */
.winner-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* Round Table Visualization */
.table-preview {
    width: 250px;
    height: 250px;
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.2);
    /* Thin ring */
    border-radius: 50%;
    position: relative;
    margin: 20px auto;
    box-shadow: none;
}

.player-token {
    width: 44px;
    height: 44px;
    background: #e2e8f0;
    /* Light grey like reference */
    color: #0f172a;
    border-radius: 50%;
    position: absolute;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 1rem;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
    border: none;
    transform: translate(-50%, -50%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 5;
}

.player-token.dealer {
    background: #f59e0b;
    /* Keep gold for dealer/turn 1 */
    color: white;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.5);
    z-index: 10;
}

.player-token-name {
    position: absolute;
    bottom: -25px;
    font-size: 0.75rem;
    white-space: nowrap;
    color: var(--text-muted);
    background: transparent;
    padding: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

/* Winner Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(10px);
}

.winner-content {
    text-align: center;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.winner-content h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    background: linear-gradient(to right, #f59e0b, #fbbf24);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 30px rgba(245, 158, 11, 0.5);
}

.winner-content h2 {
    font-size: 2.5rem;
    color: white;
    margin-bottom: 10px;
}

.winner-content p {
    color: var(--text-muted);
    font-size: 1rem;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.winner-pot {
    font-size: 4rem;
    font-weight: 800;
    color: var(--success-color);
    text-shadow: 0 0 30px rgba(16, 185, 129, 0.5);
    margin-top: 10px;
}

.confetti {
    font-size: 5rem;
    margin-bottom: 20px;
    animation: bounce 1s infinite alternate;
}

@keyframes bounce {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(-20px);
    }
}