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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #111827;
    color: #e5e7eb;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    touch-action: manipulation;
}

/* App Layout */
#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

#hhh-header {
    height: 40px;
    background-color: #1f2937;
    border-bottom: 1px solid #374151;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
}

#header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

#header-brand {
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
}

.beta-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    background-color: #eab308;
    color: #1f2937;
    font-size: 10px;
    font-weight: 700;
    border-radius: 4px;
    vertical-align: middle;
    letter-spacing: 0.5px;
}

#header-sep {
    color: #4b5563;
    font-size: 16px;
}

#header-mode-label {
    font-size: 14px;
    font-weight: 600;
    color: #9ca3af;
}

#header-buttons {
    display: flex;
    gap: 8px;
}

#btn-gear,
#btn-fullscreen,
#btn-new-hand {
    background: none;
    border: none;
    font-size: 24px;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#btn-gear:hover,
#btn-fullscreen:hover,
#btn-new-hand:hover {
    color: #e5e7eb;
}

#btn-fullscreen {
    font-size: 20px;
}

/* Screen Management */
.screen {
    display: none;
    flex: 1;
    flex-direction: column;
    overflow: hidden;
}

.screen.active {
    display: flex;
}

/* Board Entry Screen */
#screen-board {
    padding: 20px;
    align-items: center;
    justify-content: space-evenly;
}

#board-slots {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.board-slot {
    width: 56px;
    height: 78px;
    border-radius: 6px;
    background-color: #374151;
    border: 2px solid #4b5563;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: bold;
    transition: all 0.2s;
}

.board-slot.active {
    border-color: #eab308;
    box-shadow: 0 0 12px rgba(234, 179, 8, 0.5);
}

.board-slot.filled {
    background-color: #faf8f0;
    color: #1f2937;
}

.board-slot.skipped {
    background-color: #374151;
    border: 2px dashed #6b7280;
    color: #6b7280;
}

.board-slot.unknown-suit {
    background-color: #faf8f0;
    color: #6b7280;
}

.board-slot.unknown-rank {
    background-color: #faf8f0;
    color: #6b7280;
}

.slot-content {
    line-height: 1;
}

#rank-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.rank-btn {
    width: 44px;
    height: 44px;
    background-color: #1f2937;
    border: 2px solid #374151;
    border-radius: 6px;
    color: #e5e7eb;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.rank-btn:hover {
    background-color: #374151;
}

.rank-btn.selected {
    background-color: #eab308;
    border-color: #eab308;
    color: #1f2937;
}

.rank-btn.rank-unknown {
    background-color: #4b5563;
    color: #e5e7eb;
}

#suit-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.suit-btn {
    width: 44px;
    height: 44px;
    border: 2px solid #374151;
    border-radius: 6px;
    font-size: 28px;
    cursor: pointer;
    transition: all 0.2s;
}

.suit-btn[data-suit="S"] {
    background-color: #334155;
    color: #e2e8f0;
}

.suit-btn[data-suit="H"] {
    background-color: #991b1b;
    color: #fca5a5;
}

.suit-btn[data-suit="D"] {
    background-color: #dc2626;
    color: #fecaca;
}

.suit-btn[data-suit="C"] {
    background-color: #14532d;
    color: #86efac;
}

.suit-btn.suit-unknown {
    background-color: #4b5563;
    color: #e5e7eb;
    font-size: 20px;
    font-weight: bold;
}

.suit-btn:hover {
    transform: scale(1.05);
}

.skip-btn {
    width: 44px;
    height: 44px;
    background-color: #4b5563;
    border: 2px solid #6b7280;
    border-radius: 6px;
    color: #e5e7eb;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.skip-btn:hover {
    background-color: #6b7280;
}

#board-hint {
    font-size: 14px;
    color: #9ca3af;
    text-align: center;
}

/* ============================================================
   TABLE ACTION SCREEN
   ============================================================ */

#screen-table {
    padding: 0;
}

/* Table Phase Management */
.table-phase {
    display: none;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.table-phase.active {
    display: flex;
}

/* ============================================================
   STREET PROGRESS
   ============================================================ */

#street-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    flex-shrink: 0;
}

.street-indicator {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
}

.street-indicator.active {
    background-color: #eab308;
    color: #1f2937;
}

.street-indicator.completed {
    color: #22c55e;
}

.street-separator {
    color: #4b5563;
    font-size: 14px;
}

/* ============================================================
   POSITION GRID
   ============================================================ */

#position-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    padding: 8px 12px;
    flex: 1;
    align-content: center;
    overflow-y: auto;
}

.position-btn {
    width: 86px;
    min-height: 52px;
    background-color: #1f2937;
    border: 2px solid #374151;
    border-radius: 8px;
    padding: 6px 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.position-btn:hover {
    background-color: #293548;
}

.position-btn.selected {
    border-color: #eab308;
    box-shadow: 0 0 10px rgba(234, 179, 8, 0.4);
}

.position-btn.acted-fold {
    background-color: #991b1b;
    opacity: 0.5;
}

.position-btn.acted-prior {
    opacity: 0.5;
}

.position-btn.acted-check {
    background-color: #166534;
}

.position-btn.acted-call {
    background-color: #1e40af;
}

.position-btn.acted-bet {
    background-color: #9333ea;
}

.position-btn.acted-raise {
    background-color: #c2410c;
}

.position-btn.is-hero {
    border-left: 4px solid #eab308;
}

.position-btn.is-hero.selected {
    border-color: #eab308;
    border-left-width: 4px;
}

.pos-label {
    font-size: 13px;
    font-weight: 700;
    color: #eab308;
    line-height: 1.2;
}

.pos-action {
    font-size: 11px;
    color: #d1d5db;
    margin-top: 2px;
    line-height: 1.2;
}

/* ============================================================
   ACTION BAR
   ============================================================ */

#action-bar {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
    padding: 8px 12px;
    background-color: #1f2937;
    border-top: 1px solid #374151;
    flex-shrink: 0;
}

.action-btn {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover:not(.action-disabled) {
    transform: scale(1.05);
}

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

.action-btn.btn-fold {
    background-color: #991b1b;
    color: #fca5a5;
}

.action-btn.btn-fold:hover {
    background-color: #7f1d1d;
}

.action-btn.btn-check {
    background-color: #166534;
    color: #86efac;
}

.action-btn.btn-check:hover {
    background-color: #14532d;
}

.action-btn.btn-call {
    background-color: #1e40af;
    color: #93c5fd;
}

.action-btn.btn-call:hover {
    background-color: #1e3a8a;
}

.action-btn.btn-bet {
    background-color: #9333ea;
    color: #e9d5ff;
}

.action-btn.btn-bet:hover {
    background-color: #7e22ce;
}

.action-btn.btn-raise {
    background-color: #c2410c;
    color: #fdba74;
}

.action-btn.btn-raise:hover {
    background-color: #9a3412;
}

.action-btn.btn-hero {
    background-color: #eab308;
    color: #1f2937;
}

.action-btn.btn-hero:hover {
    background-color: #d97706;
}

.action-btn.btn-undo {
    background-color: #6b7280;
    color: #d1d5db;
}

.action-btn.btn-undo:hover {
    background-color: #4b5563;
}

.btn-advance {
    padding: 0 16px;
    height: 48px;
    background-color: #3b82f6;
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-advance:hover {
    background-color: #2563eb;
}

/* ============================================================
   INLINE AMOUNT INPUT
   ============================================================ */

#inline-amount {
    display: flex;
    gap: 8px;
    padding: 8px 12px;
    align-items: center;
    justify-content: center;
    background-color: #111827;
    border-top: 1px solid #374151;
    flex-shrink: 0;
}

#inline-amount-input {
    width: 140px;
    padding: 10px 12px;
    background-color: #374151;
    border: 1px solid #4b5563;
    border-radius: 6px;
    color: #e5e7eb;
    font-size: 16px;
}

#inline-amount-input:focus {
    outline: none;
    border-color: #eab308;
}

/* ============================================================
   HOLE CARD ENTRY
   ============================================================ */

#hole-card-entry {
    align-items: center;
    justify-content: space-evenly;
    padding: 12px;
}

#hc-header {
    font-size: 16px;
    font-weight: 600;
    color: #eab308;
    text-align: center;
}

#hc-player-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.hc-player-btn.hc-entered {
    background-color: #14532d;
    border-color: #374151;
}

.hc-player-btn.hc-entered.selected {
    background-color: #1f2937;
    border-color: #eab308;
    box-shadow: 0 0 10px rgba(234, 179, 8, 0.4);
}

#hc-card-slots {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.hc-slot {
    width: 48px;
    height: 68px;
    border-radius: 6px;
    background-color: #374151;
    border: 2px solid #4b5563;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    transition: all 0.2s;
}

.hc-slot.active {
    border-color: #eab308;
    box-shadow: 0 0 10px rgba(234, 179, 8, 0.5);
}

.hc-slot.filled {
    background-color: #faf8f0;
    color: #1f2937;
}

.hc-slot.skipped {
    background-color: #374151;
    border: 2px dashed #6b7280;
    color: #6b7280;
}

.hc-slot.unknown-suit {
    background-color: #faf8f0;
    color: #6b7280;
}

#hc-rank-buttons {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
}

#hc-suit-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

#hc-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

#btn-hc-skip {
    padding: 10px 24px;
    background-color: #4b5563;
    border: none;
    border-radius: 6px;
    color: #e5e7eb;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

#btn-hc-skip:hover {
    background-color: #6b7280;
}

/* ============================================================
   MODALS
   ============================================================ */

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

.modal.open {
    display: flex;
}

.modal-content {
    background-color: #1f2937;
    border-radius: 12px;
    max-width: 400px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #374151;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid #374151;
    display: flex;
    justify-content: flex-end;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #d1d5db;
}

.form-group input[type="number"] {
    width: 100%;
    padding: 8px 12px;
    background-color: #374151;
    border: 1px solid #4b5563;
    border-radius: 6px;
    color: #e5e7eb;
    font-size: 14px;
}

.form-group input[type="number"]:focus {
    outline: none;
    border-color: #eab308;
}

.btn-primary {
    padding: 10px 24px;
    background-color: #eab308;
    border: none;
    border-radius: 6px;
    color: #1f2937;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    background-color: #d97706;
}

.btn-secondary {
    padding: 10px 24px;
    background-color: #4b5563;
    border: none;
    border-radius: 6px;
    color: #e5e7eb;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background-color: #6b7280;
}

/* ============================================================
   HAND HISTORY MODAL
   ============================================================ */

.modal-content-wide {
    max-width: 520px;
}

#hand-history-text {
    width: 100%;
    padding: 12px;
    background-color: #111827;
    border: 1px solid #4b5563;
    border-radius: 6px;
    color: #e5e7eb;
    font-family: 'SF Mono', 'Menlo', 'Monaco', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.5;
    resize: vertical;
}

#hand-history-text:focus {
    outline: none;
    border-color: #eab308;
}

/* ============================================================
   COMMUNITY CARDS (Table Action Mode)
   ============================================================ */

#community-cards {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 4px 12px;
    flex-shrink: 0;
    min-height: 44px;
}

.community-card {
    width: 40px;
    height: 56px;
    border-radius: 4px;
    background-color: #374151;
    border: 2px solid #4b5563;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.community-card:active {
    transform: scale(0.95);
}

.community-card.filled {
    background-color: #faf8f0;
    color: #1f2937;
}

.community-card.skipped {
    background-color: #374151;
    border: 2px dashed #6b7280;
    color: #6b7280;
}

.community-card.unknown-suit {
    background-color: #faf8f0;
    color: #6b7280;
}

.community-card.dimmed {
    opacity: 0.25;
    cursor: default;
    pointer-events: none;
}

.community-cards-preflop-hint {
    font-size: 11px;
    color: #4b5563;
    font-style: italic;
}

/* ============================================================
   CARD EDIT MODAL
   ============================================================ */

.modal-content-compact {
    max-width: 340px;
}

#card-edit-preview {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

#card-edit-ranks {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

#card-edit-suits {
    display: flex;
    gap: 10px;
    justify-content: center;
}
