/* =====================================================================
 * poker.css — Styles for Texas Hold'em Poker
 * ===================================================================== */

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

:root {
    --felt: #276221;
    --felt-dark: #1a4217;
    --gold: #f39c12;
    --red: #e74c3c;
    --dark: #2c3e50;
    --card-w: 64px;
    --card-h: 90px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    min-height: 100vh;
    color: #fff;
}

/* ======================== SCREENS ======================== */
.screen { min-height: 100vh; display: flex; flex-direction: column; }
.screen.hidden { display: none !important; }

.overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.75);
    display: flex; align-items: center; justify-content: center;
    z-index: 200;
}
.overlay.hidden { display: none !important; }

/* ======================== SETTINGS ======================== */
.settings-container {
    max-width: 580px;
    margin: auto;
    padding: 40px;
    background: rgba(0,0,0,0.35);
    border-radius: 20px;
    text-align: center;
}
.settings-container h1 { font-size: 3rem; margin-bottom: 8px; text-shadow: 2px 2px 4px rgba(0,0,0,0.6); }
.settings-container h2 { font-size: 1.6rem; font-weight: normal; opacity: 0.85; margin-bottom: 30px; }

.setting-group { margin-bottom: 26px; text-align: left; }
.setting-group label { display: block; font-size: 1.3rem; margin-bottom: 10px; }

.player-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 1.2rem;
    border: 3px solid #fff;
    border-radius: 10px;
    background: rgba(255,255,255,0.9);
    color: #2c3e50;
    text-align: center;
}
.player-input:focus { outline: 4px solid var(--gold); outline-offset: 2px; }

.button-group { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.setting-btn {
    padding: 12px 20px; font-size: 1.1rem;
    border: 3px solid #fff; background: transparent; color: #fff;
    border-radius: 12px; cursor: pointer; transition: all 0.2s;
    min-width: 100px; min-height: 52px;
    display: inline-flex; align-items: center; justify-content: center;
}
.setting-btn:hover { background: rgba(255,255,255,0.2); transform: scale(1.05); }
.setting-btn:focus { outline: 4px solid var(--gold); outline-offset: 2px; }
.setting-btn.active { background: #fff; color: #2c3e50; font-weight: bold; }
.count-btn { min-width: 60px; }

.primary-btn {
    margin-top: 20px;
    padding: 18px 40px;
    font-size: 1.6rem;
    background: var(--red);
    color: #fff; border: none;
    border-radius: 14px;
    cursor: pointer; font-weight: bold;
    transition: all 0.2s;
    min-height: 65px;
    display: block; width: 100%;
    text-decoration: none;
    text-align: center;
    line-height: 1.3;
}
.primary-btn:hover { background: #c0392b; transform: scale(1.02); box-shadow: 0 5px 20px rgba(231,76,60,0.5); }
.primary-btn:focus { outline: 4px solid var(--gold); outline-offset: 3px; }
.secondary-btn { margin-top: 12px; background: rgba(255,255,255,0.15); border: 3px solid #fff; }
.secondary-btn:hover { background: rgba(255,255,255,0.3); }
.back-btn { display: block; text-align: center; }

.rules-summary {
    background: rgba(255,255,255,0.1); border-radius: 12px;
    padding: 18px 22px; margin: 20px 0; text-align: left;
}
.rules-summary h3 { font-size: 1.3rem; margin-bottom: 10px; }
.rules-summary ul { list-style: none; }
.rules-summary li { font-size: 1.05rem; padding: 5px 0; opacity: 0.9; }
.rules-summary li::before { content: '• '; color: #f39c12; font-weight: bold; }

.local-names-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.local-name-row { display: flex; align-items: center; gap: 10px; }
.local-name-row label { font-size: 1.1rem; min-width: 80px; opacity: 0.85; }
.local-name-row input { flex: 1; }

/* ======================== PASS SCREEN ======================== */
.pass-container {
    max-width: 480px;
    margin: auto;
    text-align: center;
    padding: 60px 40px;
}
.pass-icon { font-size: 5rem; margin-bottom: 20px; }
.pass-container h2 { font-size: 1.8rem; opacity: 0.8; margin-bottom: 8px; }
.pass-container h1 { font-size: 3rem; color: var(--gold); margin-bottom: 20px; }
.pass-container p  { font-size: 1.2rem; opacity: 0.75; margin-bottom: 30px; }

/* ======================== GAME HEADER ======================== */
.game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 18px;
    background: rgba(0,0,0,0.5);
    flex-shrink: 0;
    gap: 12px;
    flex-wrap: wrap;
}
.header-center { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.phase-label { font-size: 1.2rem; font-weight: bold; color: var(--gold); text-transform: uppercase; letter-spacing: 0.1em; }
.pot-label   { font-size: 1.1rem; }
.action-btn {
    padding: 10px 16px; font-size: 1rem;
    border: 2px solid rgba(255,255,255,0.5); background: rgba(255,255,255,0.1);
    color: #fff; border-radius: 10px; cursor: pointer; transition: background 0.2s;
    min-height: 44px; text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
}
.action-btn:hover { background: rgba(255,255,255,0.25); }
.action-btn:focus { outline: 4px solid var(--gold); outline-offset: 2px; }

.conn-status { font-size: 0.95rem; opacity: 0.9; }

/* ======================== TABLE ======================== */
.table-area {
    flex: 1;
    position: relative;
    background: radial-gradient(ellipse at center, var(--felt) 0%, var(--felt-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    overflow: hidden;
}

/* Felt texture border */
.table-area::before {
    content: '';
    position: absolute; inset: 8px;
    border: 6px solid rgba(0,0,0,0.4);
    border-radius: 50%;
    pointer-events: none;
}

/* Players arranged in a ring */
.players-ring {
    position: absolute; inset: 0;
    pointer-events: none;
}

.player-seat {
    position: absolute;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: all;
    width: 130px;
}

.player-seat .seat-name {
    font-size: 0.9rem;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
    margin: 0 auto 3px;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
}
.player-seat .seat-chips {
    font-size: 0.8rem;
    opacity: 0.85;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
}
.player-seat .seat-bet {
    font-size: 0.8rem;
    color: #f1c40f;
    min-height: 1.1em;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
}
.player-seat .seat-status {
    font-size: 0.75rem;
    min-height: 1em;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
}

/* Dealer button */
.dealer-badge {
    display: inline-block;
    background: #f1c40f;
    color: #2c3e50;
    font-weight: bold;
    font-size: 0.65rem;
    border-radius: 50%;
    width: 20px; height: 20px;
    line-height: 20px;
    margin-right: 4px;
    vertical-align: middle;
}

/* Blind badges */
.blind-badge {
    display: inline-block;
    font-size: 0.65rem;
    border-radius: 10px;
    padding: 1px 5px;
    margin-right: 3px;
    font-weight: bold;
}
.blind-badge.sb { background: #2980b9; color: #fff; }
.blind-badge.bb { background: #8e44ad; color: #fff; }

/* Active player highlight */
.player-seat.is-active .seat-name {
    color: var(--gold);
}
.player-seat.is-active::after {
    content: '';
    position: absolute;
    inset: -6px;
    border: 3px solid var(--gold);
    border-radius: 14px;
    animation: pulse-border 1s ease-in-out infinite;
    pointer-events: none;
}
@keyframes pulse-border {
    0%,100% { opacity: 1; }
    50%      { opacity: 0.4; }
}

.player-seat.is-folded { opacity: 0.45; }
.player-seat.is-allin .seat-status { color: #e74c3c; font-weight: bold; }
.player-seat.is-out    { opacity: 0.25; }

/* Mini face-down cards shown in player seat */
.seat-cards { display: flex; gap: 3px; justify-content: center; margin-top: 4px; }
.seat-card-back {
    width: 24px; height: 34px;
    border-radius: 4px;
    background: repeating-linear-gradient(45deg, #1a5276, #1a5276 4px, #2980b9 4px, #2980b9 8px);
    border: 1.5px solid rgba(255,255,255,0.4);
    flex-shrink: 0;
}
.seat-card-back.revealed {
    background: #fff;
    color: #c0392b;
    font-size: 0.55rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    font-weight: bold;
}

/* ======================== CENTER / COMMUNITY CARDS ======================== */
.table-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    z-index: 1;
}

.community-cards {
    display: flex;
    gap: 8px;
}

.side-pots {
    font-size: 0.85rem;
    opacity: 0.85;
    text-align: center;
    min-height: 1em;
}

/* ======================== CARD ======================== */
.card {
    width: var(--card-w);
    height: var(--card-h);
    border-radius: 8px;
    background: #fff;
    border: 2px solid rgba(0,0,0,0.25);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: #222;
    box-shadow: 0 3px 10px rgba(0,0,0,0.4);
    user-select: none;
    position: relative;
    flex-shrink: 0;
    transition: transform 0.15s;
}
.card .card-rank {
    font-size: 1.2rem;
    line-height: 1;
}
.card .card-suit {
    font-size: 1.6rem;
    line-height: 1;
}
.card.red { color: #c0392b; }
.card.black { color: #1a1a1a; }

.card.card-back {
    background: repeating-linear-gradient(45deg, #1a5276, #1a5276 6px, #2980b9 6px, #2980b9 12px);
    border: 2px solid rgba(255,255,255,0.3);
}

.card.card-empty {
    background: rgba(0,0,0,0.15);
    border: 2px dashed rgba(255,255,255,0.2);
}

/* Highlight best hand cards */
.card.best { box-shadow: 0 0 12px 4px #f39c12, 0 3px 10px rgba(0,0,0,0.4); }

/* ======================== MY HAND ======================== */
.my-hand-area {
    background: rgba(0,0,0,0.45);
    padding: 12px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.my-hand-header {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}
.my-hand-name  { font-size: 1.1rem; font-weight: bold; }
.my-hand-chips { font-size: 1rem; color: #f1c40f; }
.hand-label    { font-size: 0.95rem; color: #2ecc71; font-style: italic; }

.my-cards { display: flex; gap: 14px; }

/* ======================== ACTION BAR ======================== */
.action-bar {
    background: rgba(0,0,0,0.6);
    padding: 12px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.action-bar.hidden { display: none !important; }
.action-info { font-size: 1rem; opacity: 0.85; }

.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.action-btn-big {
    padding: 14px 24px;
    font-size: 1.1rem;
    font-weight: bold;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.18s;
    min-height: 52px;
    min-width: 110px;
}
.action-btn-big:focus { outline: 4px solid var(--gold); outline-offset: 2px; }
.action-btn-big:disabled { opacity: 0.4; cursor: default; transform: none !important; }

.fold-btn    { background: #7f8c8d; color: #fff; }
.fold-btn:hover:not(:disabled) { background: #636e72; transform: scale(1.04); }

.check-btn   { background: #2980b9; color: #fff; }
.check-btn:hover:not(:disabled) { background: #1f618d; transform: scale(1.04); }

.call-btn    { background: #27ae60; color: #fff; }
.call-btn:hover:not(:disabled) { background: #1e8449; transform: scale(1.04); }

.raise-btn   { background: var(--red); color: #fff; }
.raise-btn:hover:not(:disabled) { background: #c0392b; transform: scale(1.04); }

.confirm-btn { background: var(--gold); color: #2c3e50; }
.confirm-btn:hover:not(:disabled) { background: #e67e22; transform: scale(1.04); }

.action-btn-small {
    padding: 8px 16px; font-size: 0.95rem;
    border: 2px solid rgba(255,255,255,0.5); background: rgba(255,255,255,0.1);
    color: #fff; border-radius: 10px; cursor: pointer;
}
.action-btn-small:hover { background: rgba(255,255,255,0.25); }

.raise-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}
.raise-controls.hidden { display: none !important; }

.raise-slider {
    width: 180px;
    accent-color: var(--red);
    cursor: pointer;
}
.raise-amount-display {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--gold);
    min-width: 60px;
    text-align: center;
}

.waiting-bar {
    background: rgba(0,0,0,0.55);
    padding: 14px 20px;
    text-align: center;
    font-size: 1.1rem;
    opacity: 0.8;
    font-style: italic;
}

/* ======================== SHOWDOWN ======================== */
.showdown-container {
    background: rgba(20,20,20,0.97);
    border: 3px solid var(--gold);
    border-radius: 20px;
    padding: 36px 40px;
    max-width: 560px;
    width: 90vw;
    text-align: center;
    max-height: 90vh;
    overflow-y: auto;
}
.showdown-container h2 { font-size: 2rem; color: var(--gold); margin-bottom: 20px; }

.showdown-results { display: flex; flex-direction: column; gap: 16px; margin-bottom: 24px; }

.showdown-player {
    background: rgba(255,255,255,0.07);
    border-radius: 12px;
    padding: 14px 18px;
    text-align: left;
}
.showdown-player.winner {
    border: 2px solid var(--gold);
    background: rgba(243,156,18,0.12);
}
.showdown-player-name { font-size: 1.2rem; font-weight: bold; margin-bottom: 6px; }
.showdown-player-hand { font-size: 0.95rem; opacity: 0.8; margin-bottom: 8px; }
.showdown-cards { display: flex; gap: 8px; flex-wrap: wrap; }
.showdown-cards .card { width: 52px; height: 72px; font-size: 0.8rem; }
.showdown-cards .card .card-rank { font-size: 0.9rem; }
.showdown-cards .card .card-suit { font-size: 1.1rem; }
.showdown-winner-badge {
    display: inline-block;
    background: var(--gold);
    color: #2c3e50;
    font-weight: bold;
    border-radius: 8px;
    padding: 2px 10px;
    font-size: 0.85rem;
    margin-left: 8px;
}
.showdown-gain { font-size: 0.9rem; color: #2ecc71; margin-top: 4px; }

/* ======================== LOG PANEL ======================== */
.log-panel {
    position: fixed;
    top: 0; right: 0;
    height: 100%;
    width: 260px;
    background: rgba(0,0,0,0.85);
    z-index: 150;
    display: flex;
    flex-direction: column;
    padding: 0;
    box-shadow: -4px 0 20px rgba(0,0,0,0.5);
}
.log-panel.hidden { display: none !important; }
.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    font-weight: bold;
    font-size: 1.1rem;
}
.log-close { background: none; border: none; color: #fff; font-size: 1.2rem; cursor: pointer; }
.log-list {
    flex: 1;
    overflow-y: auto;
    list-style: none;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.log-list li {
    font-size: 0.9rem;
    opacity: 0.85;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    padding-bottom: 5px;
}
.log-list li.log-win { color: #f1c40f; font-weight: bold; }

/* ======================== RESPONSIVE ======================== */
@media (max-width: 600px) {
    :root { --card-w: 52px; --card-h: 74px; }
    .player-seat { width: 100px; }
    .settings-container { padding: 24px 16px; }
    .action-btn-big { min-width: 80px; padding: 12px 14px; font-size: 1rem; }
    .showdown-container { padding: 24px 16px; }
}
