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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #1a472a 0%, #2d5016 50%, #1a472a 100%);
    min-height: 100vh;
    color: white;
    overflow: hidden;
}

#app {
    width: 100vw;
    height: 100vh;
    position: relative;
}

/* Setup Screen */
.screen {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

h1 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.setup-container {
    max-width: 400px;
    margin: 0 auto;
    padding: 20px;
}

.setup-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
}

.setup-actions .btn {
    width: 100%;
    margin-top: 0;
}

.settings-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.input-group {
    display: flex;
    flex-direction: column;
}

.input-group label {
    margin-bottom: 5px;
    font-size: 0.85rem;
    opacity: 0.9;
}

.input-group input {
    padding: 10px 12px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.95);
    color: #333;
}

.recommended-text {
    font-size: 0.75rem;
    color: #4CAF50;
    margin-top: 4px;
    opacity: 0.9;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn:active:not(:disabled) {
    transform: scale(0.95);
}

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

.btn-primary {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #333;
    width: 100%;
    margin-top: 10px;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    width: 100%;
    margin-top: 10px;
}

.btn-danger {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
    color: white;
    width: 100%;
    margin-top: 0;
}

.btn-success {
    background: linear-gradient(135deg, #4CAF50 0%, #388E3C 100%);
    color: white;
    width: 100%;
    margin-top: 0px;
}

.btn-tiny {
    padding: 4px 8px;
    font-size: 0.75rem;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-tiny:hover {
    background: rgba(255, 255, 255, 0.3);
}

.btn-tiny.btn-decrease {
    background: rgba(244, 67, 54, 0.3);
    border-color: rgba(244, 67, 54, 0.5);
}

.btn-tiny.btn-decrease:hover {
    background: rgba(244, 67, 54, 0.5);
}

.btn-menu {
    padding: 10px 15px;
    font-size: 1.2rem;
    background: linear-gradient(135deg, #00bcd4 0%, #0097a7 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
}

/* Game Screen */
#game-screen {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Players grid - 2 rows of 3 */
.players-grid {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 10px;
    gap: 10px;
    align-items: center;
    justify-content: center;
}

.players-row {
    display: flex;
    justify-content: center;
    gap: 15px;
}

/* Player slots in grid */
.player-slot {
    position: relative;
    width: 250px;
    transform: none;
}

.player-card {
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    padding: 10px;
    text-align: center;
    width: 250px;
    height: 250px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    transition: transform 0.3s ease;
}

.rotate-btn {
    position: absolute;
    top: 11px;
    right: 5px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

.rotate-btn:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* Balance bar (HP style) */
.balance-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px 12px 0 0;
    overflow: hidden;
}

.balance-bar-fill {
    height: 100%;
    transition: width 0.3s ease, background 0.3s ease;
}

/* Color based on percentage */
.balance-bar-fill.high { background: #4CAF50; }      /* 75-100% - green */
.balance-bar-fill.medium { background: #FFC107; }    /* 40-74% - yellow/orange */
.balance-bar-fill.low { background: #FF5722; }       /* 15-39% - orange */
.balance-bar-fill.critical { background: #f44336; }  /* 0-14% - red */

/* Control Bars - Base styles */
.control-bar {
    background: rgba(0, 0, 0, 0.85);
    padding: 10px 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
    z-index: 10;
    width: 740px;
    max-width: 95vw;
    position: relative;
}

.top-bar {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%) rotate(180deg);
}

.bottom-bar {
    position: fixed;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
}

/* Left bar - rotated 90deg, positioned at left edge */
.left-bar {
    position: fixed;
    left: -329px;
    top: 50%;
    transform: translateY(-50%) rotate(90deg);
    width: 740px;
    max-width: calc(100vh - 20px);
}

/* Right bar - rotated -90deg, positioned at right edge */
.right-bar {
    position: fixed;
    right: -329px;
    top: 50%;
    transform: translateY(-50%) rotate(-90deg);
    width: 740px;
    max-width: calc(100vh - 20px);
}

.pot-display {
    display: flex;
    align-items: center;
    gap: 5px;
}

.pot-display .label {
    font-size: 0.7rem;
    opacity: 0.8;
    text-transform: uppercase;
}

.pot-display .pot-amount {
    font-size: 1.3rem;
    font-weight: bold;
    color: #FFD700;
}

.phase-display {
    background: rgba(255, 255, 255, 0.15);
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.blinds-display {
    display: flex;
    align-items: center;
    gap: 6px;
}

.blinds-display > span {
    font-size: 0.85rem;
}

.blinds-controls {
    display: flex;
    gap: 3px;
}

.action-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.action-buttons .btn {
    padding: 8px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    min-width: 90px;
    text-align: center;
}

.action-buttons .btn-primary,
.action-buttons .btn-secondary {
    width: auto;
    margin-top: 0;
}

/* Hand Rankings Cards */
.hand-rankings {
    list-style: none;
    padding-left: 0;
}

.hand-rankings li {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.hand-cards {
    font-size: 1.1rem;
    min-width: 80px;
}

/* Combinations Modal */
.combinations-modal {
    max-width: 400px;
}

.hand-ranking {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    gap: 15px;
}

.hand-name {
    font-weight: bold;
    min-width: 120px;
    color: #FFD700;
}

.hand-example {
    color: #ccc;
    font-family: monospace;
}

.menu-dropdown {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.95);
    border-radius: 8px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 130px;
    margin-bottom: 5px;
    z-index: 100;
}

.menu-dropdown button {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    padding: 10px 12px;
    text-align: left;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.85rem;
}

.menu-dropdown button:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Game Table - Center, smaller to fit control bars on all sides */
/* Player slots in grid (old ellipse positioning removed) */
.player-card.active {
    border-color: #FFD700;
    background: rgba(255, 215, 0, 0.2);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
}

.player-card.folded {
    opacity: 0.4;
}

.player-card.all-in {
    border-color: #9c27b0;
    background: rgba(156, 39, 176, 0.2);
}

.player-card.out {
    background: rgba(0, 0, 0, 0.2);
}

.player-card.out .btn-refill {
    background: green;
}

.player-card.out .player-balance {
    color: #f44336;
}

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

.player-card .player-balance {
    font-size: 1.2rem;
    color: #4CAF50;
    font-weight: bold;
}

.player-card .player-bet {
    font-size: 0.85rem;
    color: #FFD700;
}

.player-card .player-status {
    font-size: 0.75rem;
    text-transform: uppercase;
}

/* Badges container for D, SB, BB */
.badges-container {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-bottom: 6px;
}

.badge {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
}

.dealer-badge {
    background: #FFD700;
    color: #333;
}

.sb-badge {
    background: #4CAF50;
    color: white;
}

.bb-badge {
    background: #2196F3;
    color: white;
}

.player-card.empty-seat {
    background: rgba(255, 255, 255, 0.05);
    border: 2px dashed rgba(255, 255, 255, 0.3);
    padding: 15px 10px;
}

.player-card.empty-seat .seat-number {
    font-size: 1rem;
    opacity: 0.6;
    margin-bottom: 6px;
}

.player-card.empty-seat .seat-empty-text {
    font-size: 0.8rem;
    opacity: 0.4;
    font-style: italic;
}

.btn-join {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    padding: 8px 14px;
    font-size: 0.9rem;
    width: 100%;
}

.player-btn-row {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    width: 100%;
}

.player-btn-row .btn {
    flex: 1;
    padding: 6px 8px;
    font-size: 0.8rem;
}

.btn-leave {
    background: rgba(244, 67, 54, 0.8);
    color: white;
}

.btn-leave:hover {
    background: #f44336;
}

.btn-refill {
    background: rgba(76, 175, 80, 0.8);
    color: white;
}

.btn-refill:hover {
    background: #4CAF50;
}

.player-actions {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 8px;
    width: 100%;
}

.action-row {
    display: flex;
    gap: 5px;
    justify-content: center;
    width: 100%;
}

.action-row .btn {
    flex: 1;
    padding: 6px 8px;
    font-size: 0.75rem;
    min-width: 0;
}

.btn-action {
    flex: 1;
    padding: 8px 10px;
    font-size: 0.8rem;
    font-weight: 600;
    min-height: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
}

.call-amount {
    font-size: 0.9rem;
    font-weight: bold;
}

/* Raise section - colored block */
.raise-section {
    background: rgba(255, 193, 7, 0.15);
    border: 1px solid rgba(255, 193, 7, 0.4);
    border-radius: 6px;
    padding: 5px;
    display: flex;
    flex-direction: row;
    gap: 4px;
}

.raise-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.raise-btn-row {
    display: flex;
    gap: 4px;
}

.raise-input-row {
    display: flex;
}

.btn-plus, .btn-minus {
    padding: 5px 12px;
    background: rgba(255, 255, 255, 0.3);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.5);
    flex: 1;
    font-size: 1rem;
    font-weight: bold;
}

.btn-plus:hover, .btn-minus:hover {
    background: rgba(255, 255, 255, 0.5);
}

.raise-input {
    width: 100%;
    padding: 4px 6px;
    font-size: 0.85rem;
    border: none;
    border-radius: 4px;
    text-align: center;
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    font-weight: bold;
    box-sizing: border-box;
}

.btn-raise {
    width: 50%;
    font-size: 0.8rem;
    font-weight: 600;
}

.btn-full {
    width: 100%;
}

.btn-allin {
    background: linear-gradient(135deg, #9c27b0 0%, #7b1fa2 100%);
    color: white;
    width: 100%;
}

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

.modal-content {
    background: linear-gradient(135deg, #2d5016 0%, #1a472a 100%);
    padding: 25px;
    border-radius: 16px;
    max-width: 350px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    text-align: center;
    transform-origin: center center;
}

.modal-content h2 {
    margin-bottom: 15px;
}

.guide-content {
    max-width: 700px;
    text-align: left;
}

.guide-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.guide-section {
    margin-bottom: 15px;
}

.guide-section h3 {
    color: #FFD700;
    margin-bottom: 8px;
    font-size: 1rem;
}

.guide-section ul {
    padding-left: 20px;
}

.guide-section li {
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
}

.modal-buttons .btn {
    flex: 1;
}

.input-group input {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.95);
    color: #333;
}

.winner-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
    max-height: 250px;
    overflow-y: auto;
}

.winner-btn {
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.winner-btn:hover {
    background: rgba(255, 215, 0, 0.3);
    border-color: #FFD700;
}

.winner-btn.selected {
    background: rgba(255, 215, 0, 0.3);
    border-color: #FFD700;
}

/* Winner Modal - Two Columns */
.winner-modal-content {
    display: flex;
    gap: 20px;
    max-width: 700px;
    text-align: left;
}

.winner-left {
    flex: 1;
    min-width: 200px;
}

.winner-left h2 {
    font-size: 1rem;
    color: #FFD700;
    margin-bottom: 10px;
}

.winner-right {
    flex: 1;
    min-width: 200px;
}

.winner-right h2 {
    text-align: center;
    margin-bottom: 15px;
}

.winner-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
}

/* Responsive */
@media (max-width: 700px) {
    .table-surface {
        width: 60vw;
        height: 40vh;
    }

    .player-slot {
        width: 120px;
    }

    .player-card {
        width: 120px;
        height: 120px;
        padding: 6px;
    }

    .player-card .player-name {
        font-size: 0.85rem;
    }

    .player-card .player-balance {
        font-size: 1rem;
    }

    .player-card .player-bet {
        font-size: 0.7rem;
    }

    .badge {
        font-size: 0.6rem;
        padding: 2px 5px;
    }

    .action-row .btn {
        font-size: 0.6rem;
        padding: 3px 4px;
    }

    .raise-input {
        width: 30px;
        font-size: 0.6rem;
    }

    .control-bar {
        gap: 10px;
        padding: 8px 10px;
        font-size: 0.9rem;
    }

    .pot-display .pot-amount {
        font-size: 1.2rem;
    }

    .phase-display {
        padding: 5px 10px;
        font-size: 0.8rem;
    }

    .action-buttons .btn {
        padding: 8px 12px;
        min-width: 90px;
        font-size: 0.8rem;
    }
}
