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

:root {
    --bg-dark: #1a1a2e;
    --bg-table: #0f3d0f;
    --bg-card: #fff;
    --text-light: #fff;
    --text-dark: #333;
    --accent: #c8a415;
    --red: #e63946;
    --green: #2ecc71;
    --blue: #3498db;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-dark);
    color: var(--text-light);
    min-height: 100vh;
    min-width: 900px;
    overflow-x: auto;
}

/* Screens */
.screen {
    display: none;
    min-height: 100vh;
}

.screen.active {
    display: block;
}

/* Auth Screen */
#auth-screen {
    display: none;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

#auth-screen.active {
    display: flex;
}

.auth-container {
    background: rgba(255, 255, 255, 0.1);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    min-width: 350px;
    backdrop-filter: blur(10px);
}

.auth-container h1 {
    font-size: 2.5rem;
    margin-bottom: 30px;
    color: var(--accent);
}

.tabs {
    display: flex;
    margin-bottom: 20px;
    border-radius: 10px;
    overflow: hidden;
}

.tab {
    flex: 1;
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s;
}

.tab.active {
    background: var(--accent);
    color: var(--text-dark);
}

.auth-form {
    display: none;
    flex-direction: column;
    gap: 15px;
}

.auth-form.active {
    display: flex;
}

.auth-form input {
    padding: 15px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.9);
}

.auth-form button {
    padding: 15px;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    background: var(--accent);
    color: var(--text-dark);
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.2s, box-shadow 0.2s;
}

.auth-form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(255, 215, 0, 0.4);
}

.error {
    color: var(--red);
    margin-top: 15px;
    font-size: 0.9rem;
}

/* Guest account */
.guest-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 18px 0 10px;
    color: rgba(255,255,255,0.35);
    font-size: 0.85rem;
}
.guest-divider::before,
.guest-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255,255,255,0.15);
}
.guest-play-btn {
    width: 100%;
    padding: 12px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    color: rgba(255,255,255,0.75);
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}
.guest-play-btn:hover {
    background: rgba(255,255,255,0.15);
}
.auth-disclaimer {
    margin-top: 18px;
    padding: 12px 14px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    font-size: 0.75rem;
    color: #fff;
    line-height: 1.5;
    text-align: left;
}
.guest-badge {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(200,164,21,0.2);
    border: 1px solid rgba(200,164,21,0.5);
    border-radius: 10px;
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    vertical-align: middle;
    margin-left: 6px;
}
.guest-badge-lg {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(200,164,21,0.2);
    border: 1px solid rgba(200,164,21,0.5);
    border-radius: 12px;
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-right: 10px;
}
.guest-account-banner {
    display: flex;
    align-items: center;
    background: rgba(200,164,21,0.08);
    border: 1px solid rgba(200,164,21,0.25);
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 22px;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.75);
    gap: 10px;
}
.guest-account-banner p {
    margin: 0;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background: rgba(0, 0, 0, 0.3);
}

header h1 {
    font-size: 1.5rem;
    color: var(--accent);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 20px;
    white-space: nowrap;
    flex-shrink: 0;
}

.lobby-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.lobby-center {
    flex: 1;
    min-width: 0;
    text-align: center;
}

.game-header-center {
    flex: 1;
    min-width: 0;
    text-align: center;
}

.lobby-center h1 {
    margin: 0;
}

.header-stats {
    display: flex;
    gap: 16px;
    justify-content: center;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 3px;
}

.header-stats span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.header-stat-members {
    color: var(--accent);
}

.header-stat-online {
    color: var(--green);
}

.lobby-left, .lobby-right {
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
    flex-shrink: 0;
}

#user-chips, #game-chips, #buy-chips-balance, #account-balance, #winners-balance {
    color: #ffd780;
    font-weight: bold;
    font-size: 0.9rem;
}

#logout-btn {
    padding: 6px 16px;
    background: #5a0000;
    border: 1px solid rgba(200,164,21,0.4);
    color: #ffd780;
    border-radius: 7px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.85rem;
    transition: opacity 0.2s;
}

#logout-btn:hover {
    opacity: 0.85;
}

.back-btn {
    padding: 8px 16px;
    background: transparent;
    border: 2px solid var(--text-light);
    color: var(--text-light);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.back-btn:hover {
    background: var(--text-light);
    color: var(--text-dark);
}

.buy-chips-nav-btn {
    padding: 6px 16px;
    background: #0b3a0e;
    border: 1px solid rgba(200,164,21,0.4);
    color: #ffd780;
    border-radius: 7px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.85rem;
    transition: opacity 0.2s;
}

.buy-chips-nav-btn:hover {
    opacity: 0.85;
}

.account-nav-btn {
    padding: 6px 16px;
    background: #0b3a0e;
    border: 1px solid rgba(200, 164, 21, 0.4);
    color: #ffd780;
    border-radius: 7px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.85rem;
    transition: opacity 0.2s;
}

.account-nav-btn:hover {
    opacity: 0.85;
}

/* Buy Chips Screen */
#buy-chips-screen {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.buy-chips-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 80px);
    padding: 20px;
    gap: 0;
}

.buy-chips-form {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px 40px 40px;
    border-radius: 20px;
    width: 100%;
    max-width: 500px;
    text-align: center;
}

.buy-chips-form h2 {
    margin-bottom: 30px;
    color: var(--accent);
}

.cash-input-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 40px;
}

.cash-input-group label {
    font-size: 1.1rem;
    color: var(--text-light);
}

.cash-input-group input {
    padding: 15px;
    border: none;
    border-radius: 10px;
    font-size: 1.2rem;
    text-align: center;
    background: rgba(255, 255, 255, 0.9);
}

.cash-input-group .buy-btn {
    padding: 15px 30px;
    font-size: 1.1rem;
    background: #0b3a0e;
    color: #ffd780;
    border: 1px solid rgba(200,164,21,0.5);
}

.quick-buy {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 30px;
}

.quick-buy h3 {
    margin-bottom: 20px;
    color: var(--text-light);
}

.quick-buy-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.quick-buy-btn {
    padding: 20px;
    font-size: 1.2rem;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    background: var(--accent);
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.3s;
}

.quick-buy-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(255, 215, 0, 0.4);
}

/* Account Screen */
#account-screen {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.account-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 80px);
    padding: 20px;
    gap: 0;
}

.account-form {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px 40px 40px;
    border-radius: 20px;
    width: 100%;
    max-width: 500px;
    text-align: center;
}

.account-form h2 {
    margin-bottom: 30px;
    color: var(--accent);
}

.account-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.account-fields label {
    text-align: left;
    color: var(--text-light);
    font-weight: bold;
    margin-top: 5px;
}

.account-fields input {
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.9);
}

.account-fields .buy-btn {
    margin-top: 15px;
    padding: 15px 30px;
    font-size: 1.1rem;
    background: #0b3a0e;
    color: #ffd780;
    border: 1px solid rgba(200,164,21,0.6);
}

.score-reset-section {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid rgba(255,255,255,0.12);
}

.score-reset-label {
    font-size: 0.82rem;
    color: rgba(255,255,255,0.45);
    margin: 0 0 10px;
}

.score-reset-btns {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.score-reset-btn {
    padding: 8px 16px;
    background: rgba(220,50,50,0.12);
    color: #f88;
    border: 1px solid rgba(220,50,50,0.35);
    border-radius: 8px;
    font-size: 0.82rem;
    cursor: pointer;
}

.score-reset-btn:hover {
    background: rgba(220,50,50,0.25);
}

/* Lobby */
.lobby-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px 30px 30px;
    max-width: 900px;
    margin: 0 auto;
    min-height: calc(100vh - 80px);
}

.lobby-action-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.last-room-section {
    flex: 1;
}

.last-room-btn {
    width: 100%;
    background: #1a2a6c;
    color: #ffd780;
    padding: 10px 16px;
    font-size: 0.95rem;
    border-radius: 10px;
}

.last-room-btn:hover {
    background: #243a8c;
}

/* Create Table panel */
.create-table-panel {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 16px 20px;
}

.create-table-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    margin-bottom: 14px;
}

.create-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 120px;
}

.create-field label {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.7);
}

.create-field input,
.create-field select {
    padding: 8px 10px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-dark);
}

.create-field .solo-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    cursor: pointer;
    padding-top: 22px;
}

.create-table-actions {
    display: flex;
    gap: 10px;
}

.game-list-section {
    display: flex;
    flex-direction: column;
}

.game-list-section h2 {
    margin-bottom: 20px;
    color: var(--accent);
    text-align: center;
}

.game-list-container {
    flex: 1;
    overflow-y: auto;
    min-height: 450px;
    max-height: calc(100vh - 180px);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.25);
}

.game-list-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.game-list-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

.game-list-table th {
    background: rgba(0, 0, 0, 0.6);
    color: var(--accent);
    padding: 12px 16px;
    text-align: left;
    font-weight: bold;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.game-list-table td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-light);
}

.game-list-table tbody tr {
    cursor: pointer;
    transition: background 0.2s;
}

.game-list-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.08);
}

.game-list-table tbody tr.not-joinable {
    opacity: 0.5;
    cursor: not-allowed;
}

.type-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: bold;
}

.type-badge.poker {
    background: rgba(142, 68, 173, 0.3);
    color: #c39bd3;
}

.type-badge.blackjack {
    background: rgba(46, 204, 113, 0.2);
    color: #82e0aa;
}

.type-badge.solo {
    background: rgba(230, 126, 34, 0.3);
    color: #f0c27f;
}

.type-badge.reserved {
    background: rgba(231, 76, 60, 0.25);
    color: #f1948a;
    padding: 3px 6px;
}

.join-request-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    margin-bottom: 4px;
}

.join-request-name {
    flex: 1;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.85);
}

.solo-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    margin-top: 4px;
}

.solo-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.status-open {
    color: var(--green);
    font-weight: bold;
}

.status-in-progress {
    color: var(--red);
    font-size: 0.85rem;
}

.status-joinable {
    color: var(--green);
    font-size: 0.85rem;
}


/* Game Table */
.game-table {
    background: radial-gradient(ellipse at center, #097510 0%, #0f3d0f 70%);
    min-height: calc(100vh - 200px);
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.game-info {
    display: flex;
    gap: 20px;
    align-items: center;
}

#game-dealer-name {
    font-size: 1.2rem;
    color: var(--accent);
}

#game-phase {
    padding: 5px 15px;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.2);
    font-size: 0.9rem;
}

.player-name-badge {
    padding: 8px 16px;
    border-radius: 20px;
    background: var(--accent);
    color: var(--text-dark);
    font-weight: bold;
    font-size: 1rem;
}

.kick-bot-btn,
.kick-reserved-btn {
    margin-left: auto;
    background: rgba(180, 0, 0, 0.7);
    border: none;
    color: #fff;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    font-size: 10px;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.kick-bot-btn:hover,
.kick-reserved-btn:hover {
    background: rgba(220, 0, 0, 0.9);
}

/* Hand Sections */
.hand-section {
    text-align: center;
}

/* Player section: flex column so we can reorder elements per game type */
.player-section {
    display: flex;
    flex-direction: column;
}

/* BJ: cards first, then title, then controls */
.game-table:not(.poker-mode) #player-cards      { order: 1; }
.game-table:not(.poker-mode) #player-hand-title { order: 2; }
.game-table:not(.poker-mode) .player-below-row  { order: 3; }

/* Poker: title first, then cards, then controls (default order 0 for title) */
.game-table.poker-mode #player-hand-title { order: 0; }
.game-table.poker-mode #player-cards      { order: 1; }
.game-table.poker-mode .player-below-row  { order: 2; }

.bj-table-info {
    font-size: 0.85rem;
    color: var(--accent);
    letter-spacing: 1px;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.hand-section h3 {
    margin-top: 12px;
    margin-bottom: 8px;
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.hand-section h3.bust {
    color: var(--red);
}

.cards {
    display: flex;
    justify-content: center;
    gap: 10px;
    min-height: 140px;
    flex-wrap: wrap;
}

/* Playing Cards */
.card {
    width: 90px;
    height: 130px;
    background: var(--bg-card);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 8px;
    font-size: 1.4rem;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    position: relative;
    transition: transform 0.3s;
}

.card:hover {
    transform: translateY(-5px);
}

.card.red {
    color: var(--red);
}

.card.black {
    color: #333;
}

.card .top {
    text-align: left;
}

.card .center {
    font-size: 2.5rem;
    text-align: center;
}

.card .bottom {
    text-align: right;
    transform: rotate(180deg);
}

.card.face-down {
    background: linear-gradient(135deg, #1a1a2e 25%, #16213e 25%, #16213e 50%, #1a1a2e 50%, #1a1a2e 75%, #16213e 75%);
    background-size: 20px 20px;
    color: transparent;
}

.card.face-down::after {
    content: "♠♥♦♣";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    color: var(--accent);
    opacity: 0.5;
}

.card.selectable {
    cursor: pointer;
}

.card.selectable:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.3);
}

.card.selected {
    opacity: 0.4;
    filter: grayscale(100%);
    border: 3px solid var(--accent);
}

.card.selected:hover {
    opacity: 0.5;
}

.hand-desc {
    color: var(--accent);
    font-weight: bold;
    font-size: 0.9rem;
    margin-top: 5px;
}

.other-player .hand-desc {
    font-size: 0.8rem;
    margin: 5px 0;
}

.total {
    margin-top: 10px;
    font-size: 1.5rem;
    font-weight: bold;
}

.total.bust {
    color: var(--red);
}

.bet-display {
    margin-top: 10px;
    color: var(--accent);
    font-size: 1.1rem;
}

.bet-display.round-bet {
    color: #f0ad4e;
}

.bet-display.folded-label {
    color: var(--red);
}

.bet-display.check-label {
    color: rgba(255, 255, 255, 0.6);
}

.bluff-smiley {
    font-size: 1.2em;
    margin-top: 2px;
}

/* Fixed-height controls panel — prevents cards shifting when buttons change */
.controls-panel {
    min-height: 110px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Controls */
.controls {
    text-align: center;
    padding: 10px 0;
}

/* Discard count shown below player's cards */
.discard-count-below {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-top: 4px;
}

.hidden {
    display: none !important;
}

.controls h3 {
    margin-bottom: 15px;
}

.bet-input {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.betting-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.bet-adjust {
    width: 50px;
    height: 40px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-light);
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s;
}

.bet-adjust:hover {
    background: rgba(255, 255, 255, 0.3);
}

#bet-amount {
    width: 100px;
    height: 55px;
    text-align: center;
    font-size: 1.6rem;
    border: none;
    border-radius: 10px;
    background: var(--accent);
    color: var(--text-dark);
    font-weight: bold;
}

.action-btn {
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin: 5px;
}

.action-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.bet-btn {
    background: var(--accent);
    color: var(--text-dark);
}

.hit-btn {
    background: #0b3a0e;
    color: #ffd780;
}

.stand-btn {
    background: #8b0000;
    color: #ffd780;
}

.double-btn {
    background: #1a2a6c;
    color: #ffd780;
}

/* Poker betting actions row */
.poker-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.poker-actions .action-btn {
    flex: 1 1 auto;
    min-width: 50px;
    padding: 15px 20px;
    white-space: nowrap;
}

.poker-actions #raise-amount {
    width: 80px;
    padding: 15px 8px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    background: var(--accent);
    color: var(--text-dark);
    box-sizing: border-box;
}

.fold-btn {
    background: #8b0000;
    color: #ffd780;
}

.check-btn {
    background: #0b3a0e;
    color: #ffd780;
}

.call-btn {
    background: #0b3a0e;
    color: #ffd780;
}

.raise-btn {
    background: #1a2a6c;
    color: #ffd780;
}

.sidebar-add-bots {
    padding: 4px 8px;
    text-align: center;
}

.forum-link-bar {
    text-align: center;
    padding: 24px 0 16px;
}

.forum-link-btn {
    display: inline-block;
    background: #1a2a4a;
    color: #ffd780;
    border: 1px solid rgba(200,164,21,0.4);
    border-radius: 7px;
    padding: 10px 28px;
    font-size: 0.9rem;
    font-weight: bold;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.2s;
}

.forum-link-btn:hover {
    opacity: 0.85;
    color: #ffd780;
    text-decoration: none;
}

/* Uniform top-row nav buttons for Lobby action row */
.lobby-top-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 20px;
    font-size: 0.9rem;
    font-weight: bold;
    background: #1a2a4a;
    color: #ffd780;
    border: 1px solid rgba(200,164,21,0.4);
    border-radius: 7px;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: opacity 0.2s;
    margin: 0;
}
.lobby-top-btn:hover {
    opacity: 0.85;
    color: #ffd780;
    text-decoration: none;
    transform: none;
    box-shadow: none;
}

/* Navigation button bar above centered forms (Buy Chips, Account) */
.nav-btn-bar {
    width: 100%;
    max-width: 500px;
    display: flex;
    gap: 10px;
    padding-bottom: 4px;
}

/* Winners Box */
.winners-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 32px 20px;
}

.winners-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}

@media (max-width: 640px) {
    .winners-grid {
        grid-template-columns: 1fr;
    }
}

.winners-table-wrap {
    background: rgba(255, 255, 255, 0.07);
    border-radius: 12px;
    padding: 24px;
}

.winners-table-wrap h2 {
    color: #c8a415;
    font-size: 1.2rem;
    margin: 0 0 16px 0;
    text-align: center;
}

.winners-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.winners-table th {
    color: #aaa;
    font-weight: 600;
    padding: 6px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    text-align: left;
}

.winners-table th:first-child { width: 28px; }

.winners-table td {
    padding: 8px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    color: #eee;
}

.winners-table tr:last-child td { border-bottom: none; }

.winners-table .rank-1 td { color: #ffd700; font-weight: bold; }
.winners-table .rank-2 td { color: #c0c0c0; }
.winners-table .rank-3 td { color: #cd7f32; }

.winners-table td.profit { color: #4caf50; font-weight: bold; }
.winners-table td.profit-neg { color: #f44336; font-weight: bold; }

.sidebar-add-bots-btn {
    background: #1a2a4a;
    color: #ffd780;
    border: 1px solid rgba(200,164,21,0.4);
    border-radius: 7px;
    padding: 6px 14px;
    font-size: 0.82rem;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
}

.begin-btn {
    background: rgba(200,164,21,0.15);
    color: #ffd780;
    border: 1px solid rgba(200,164,21,0.4);
}

/* Result Display */
#result-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#result-message {
    font-size: 1.2rem;
    font-weight: bold;
    padding: 8px 20px;
    border-radius: 8px;
    display: inline-block;
}

#result-message.win,
#result-message.blackjack {
    color: #ffd780;
    background: #0b3a0e;
}

#result-message.lose,
#result-message.fold {
    color: #ffd780;
    background: #5a0000;
}

#result-message.push,
#result-message.tie {
    color: #ffd780;
    background: #1a2a6c;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Other Players (in sidebar) */
.other-players {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
}

.other-player {
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 10px;
    text-align: center;
}

.other-player.current-turn {
    border: 2px solid var(--accent);
}

.other-player .name {
    font-weight: bold;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
}

.other-player .mini-cards {
    display: flex;
    justify-content: center;
    gap: 5px;
}

.mini-card {
    width: 30px;
    height: 42px;
    background: var(--bg-card);
    border-radius: 4px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dark);
}

.mini-card.red {
    color: var(--red);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 80px;
    right: 24px;
    transform: translateY(100px);
    background: #6b4226;
    color: #ffd700;
    padding: 15px 30px;
    border-radius: 10px;
    transition: transform 0.3s;
    z-index: 1000;
    font-weight: bold;
    max-width: 320px;
    text-align: right;
}

.toast.show {
    transform: translateY(0);
}

.toast.error {
    background: #8b0000;
    color: #ffd780;
}

.toast.success {
    background: #6b4226;
    color: #ffd700;
}

/* Game layout: content + sidebar */
.game-layout {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 20px;
    width: 100%;
}

.game-chat-col {
    flex: 0 0 280px;
    min-width: 0;
    height: calc(100vh - 180px);
    display: flex;
    flex-direction: column;
}

.game-content {
    flex: 1;
    min-width: 280px;
    text-align: center;
}

.game-sidebar {
    flex: 0 0 240px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-self: flex-start;
}

.pot-info-line {
    display: flex;
    justify-content: center;
    gap: 30px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 1rem;
}

.pot-info-line strong {
    color: var(--accent);
}

.timeout-warning {
    color: #f0ad4e;
    font-weight: bold;
    text-align: center;
    padding: 4px 0;
    font-size: 0.9rem;
}

/* Game Control Panel */
.game-control-panel {
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    overflow: hidden;
    margin: 4px 8px;
    text-align: left;
}

/* Vote row (timeout and max-raises) */
.vote-row {
    padding: 6px 10px;
    background: rgba(107, 66, 38, 0.4);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.vote-text {
    font-size: 0.8rem;
    color: #ffd780;
    text-align: center;
}

.vote-btns {
    display: flex;
    gap: 6px;
    justify-content: center;
}

.timeout-vote-btn {
    padding: 5px 14px !important;
    font-size: 0.8rem !important;
    margin: 0 !important;
}

/* Settings row (timeout and max-raises) */
.settings-row {
    padding: 5px 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.current-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    flex: 1;
}

.timeout-change-btn {
    font-size: 0.75rem;
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.7);
    border-radius: 4px;
    cursor: pointer;
}

.timeout-change-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.input-row {
    display: flex;
    align-items: center;
    gap: 4px;
    width: 100%;
}

.input-row input {
    width: 70px;
    padding: 4px 6px;
    border: none;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    font-size: 0.85rem;
}

.timeout-ok-btn, .timeout-cancel-btn {
    padding: 4px 8px;
    font-size: 0.8rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.timeout-ok-btn {
    background: var(--accent);
    color: #333;
}

.timeout-cancel-btn {
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.7);
}

/* Countdown Timer */
.countdown-timer {
    text-align: center;
    padding: 6px 12px;
    font-weight: bold;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.8);
    width: 100%;
}

.countdown-timer.urgent {
    color: #ff4444;
    animation: pulse 1s infinite;
}

.countdown-timer.warning {
    color: #f0ad4e;
}

#pot-winner {
    font-weight: bold;
}

.winner-label {
    color: white;
}

.winner-name {
    color: var(--accent);
}

.discard-count-label {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.75rem;
    margin-top: 5px;
}

.discarded-cards-section {
    margin-top: 6px;
}

.discard-label {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.65rem;
    margin-bottom: 3px;
}

.mini-card.discarded-card {
    opacity: 0.6;
}

.mini-cards.discarded {
    display: flex;
    flex-direction: row;
    gap: 4px;
}

.player-info-line {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 6px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
}

.chips-display {
    color: var(--accent);
}

.pending-replacement {
    color: var(--blue);
    font-size: 0.7rem;
    font-style: italic;
    margin-bottom: 4px;
}

.other-player.folded {
    opacity: 0.7;
}

.other-player.folded .mini-cards {
    opacity: 0.8;
}

/* Pending Join Screen */
.pending-join-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 60px 30px;
    text-align: center;
    color: var(--text-light);
}

.pending-join-screen h2 {
    color: var(--accent);
    font-size: 1.6rem;
}

.pending-join-screen p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
}

/* Row below player's hand: discarded cards + hand info side by side */
.player-below-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-top: 8px;
    min-height: 20px;
}

.player-discarded-cards {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.player-discarded-cards .discard-label {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.7rem;
}

.player-discarded-cards .mini-cards.discarded {
    gap: 6px;
}

.player-discarded-cards .mini-card.discarded-card {
    opacity: 0.5;
    width: 45px;
    height: 65px;
    font-size: 0.85rem;
    border-radius: 6px;
}

.player-hand-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

/* New card highlight (drawn after discard) */
.card.new-card {
    box-shadow: 0 0 12px 3px rgba(46, 204, 113, 0.6);
    border: 2px solid var(--green);
}

.mini-card.new-card {
    box-shadow: 0 0 6px 2px rgba(46, 204, 113, 0.5);
    border: 1px solid var(--green);
}

/* Legacy player-chat-row (kept for JS references) */

/* Header Buy & Exit Buttons */
.header-buy-btn,
.header-exit-btn,
.rules-btn {
    padding: 6px 16px;
    background: #0b3a0e;
    border: 1px solid rgba(200,164,21,0.4);
    color: #ffd780;
    border-radius: 7px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: bold;
    text-decoration: none;
    transition: opacity 0.2s;
}

.header-buy-btn:hover,
.header-exit-btn:hover,
.rules-btn:hover {
    opacity: 0.85;
}

#back-to-lobby,
#pending-exit-btn,
#access-pending-exit-btn {
    background: #5a0000;
}

/* Rules Modal */
.rules-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rules-modal-content {
    background: #12121e;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 28px 32px;
    max-width: 620px;
    width: 92%;
    max-height: 82vh;
    overflow-y: auto;
    position: relative;
    color: #d0d0d0;
}

.rules-close-btn {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    color: #a0a0a0;
    font-size: 1.1rem;
    cursor: pointer;
    line-height: 1;
}

.rules-close-btn:hover {
    color: #ffffff;
}

.rules-body h1 {
    font-size: 1.4rem;
    color: #e0d0ff;
    margin: 0 0 16px;
    letter-spacing: 1px;
}

.rules-body h2 {
    font-size: 1.05rem;
    color: #c8b8f0;
    margin: 20px 0 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 4px;
}

.rules-body h3 {
    font-size: 0.95rem;
    color: #b0a0e0;
    margin: 14px 0 6px;
}

.rules-body p {
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 6px 0;
}

.rules-body ul {
    margin: 6px 0 6px 20px;
    padding: 0;
}

.rules-body li {
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 3px 0;
}

.rules-body hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 16px 0;
}

.rules-body strong {
    color: #e8d8ff;
}

.rules-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 0.85rem;
}

.rules-body th {
    background: rgba(255, 255, 255, 0.08);
    color: #c8b8f0;
    padding: 6px 10px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.rules-body td {
    padding: 5px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

#close-table-btn {
    padding: 15px 40px;
    font-size: 1.2rem;
    border-radius: 10px;
}

/* Chat Panel */
.chat-panel {
    width: 100%;
    flex: 1;
    min-height: 0;
    background: rgba(0, 0, 0, 0.85);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.8rem;
}

.chat-msg {
    line-height: 1.3;
}

.chat-msg .chat-user {
    font-weight: bold;
    color: var(--accent);
}

.chat-msg.system {
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
    font-size: 0.75rem;
}

.chat-tools-row {
    display: flex;
    gap: 6px;
    padding: 4px 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-tool-btn {
    padding: 3px 10px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.6);
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
}

.chat-tool-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.9);
}

.chat-input-row {
    display: flex;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.chat-input-row input {
    flex: 1;
    padding: 8px 10px;
    border: none;
    background: transparent;
    color: var(--text-light);
    font-size: 0.85rem;
    outline: none;
}

.chat-input-row input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.chat-input-row button {
    padding: 8px 14px;
    border: none;
    background: var(--accent);
    color: var(--text-dark);
    font-weight: bold;
    font-size: 0.8rem;
    cursor: pointer;
    border-radius: 0 0 10px 0;
}

.chat-input-row button:hover {
    background: #e6c200;
}

/* Host Controls */
.host-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}


.refill-label {
    color: #ffd780;
    font-size: 0.9rem;
    white-space: nowrap;
}

.refill-input {
    width: 80px;
    padding: 8px 6px;
    font-size: 0.95rem;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    background: #0b3a0e;
    color: #ffd780;
    text-align: center;
}


/* Responsive */
@media (max-width: 600px) {
    .card {
        width: 70px;
        height: 100px;
        font-size: 1.1rem;
    }

    .card .center {
        font-size: 1.8rem;
    }

    .action-btn {
        padding: 12px 25px;
        font-size: 1rem;
    }

    .game-info {
        flex-direction: column;
        gap: 5px;
    }
}

/* ── Promotional Ticker ────────────────────────────────────────────── */
.promo-ticker {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 54px;
    background: rgba(8, 8, 24, 0.95);
    border-top: 1px solid rgba(200, 164, 21, 0.4);
    display: flex;
    align-items: center;
    z-index: 1100;
    overflow: hidden;
    gap: 0;
}

.promo-ticker.hidden {
    display: none;
}

.ticker-label {
    flex-shrink: 0;
    padding: 0 12px;
    color: var(--accent);
    font-size: 1.3rem;
    opacity: 0.7;
    border-right: 1px solid rgba(200, 164, 21, 0.25);
}

.ticker-track {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    position: relative;
}

.ticker-content {
    display: inline-block;
    color: var(--accent);
    font-size: 1.64rem;
    letter-spacing: 0.01em;
    white-space: nowrap;
    animation: ticker-scroll linear infinite;
    will-change: transform;
    cursor: default;
}

.ticker-content:hover {
    animation-play-state: paused;
}

/* Fixed-width gap between messages (≥ 40% viewport) so only one is on screen */
.ticker-sep {
    display: inline-block;
    min-width: 40vw;
    text-align: center;
    opacity: 0.45;
}

.ticker-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0 12px;
    line-height: 54px;
    transition: color 0.2s;
}

.ticker-close:hover {
    color: rgba(255, 255, 255, 0.7);
}

@keyframes ticker-scroll {
    0%   { transform: translateX(100vw); }
    100% { transform: translateX(-100%); }
}

/* Push page content up so ticker doesn't overlap */
body.ticker-visible {
    padding-bottom: 54px;
}
