/* Hand History Recorder Styles */

/* Override main element grid for hand history page */
main.hh-main {
    display: block !important;
}

.nav-gif-btn {
    min-width: 64px;
    height: 44px;
    padding: 0;

    /* CRITICAL: remove pill background entirely */
    background-color: transparent !important;
    background-image: url('../assets/hand_history/hand_history_btn.gif');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;

    border: none;
    box-shadow: none;
    border-radius: 0;

    display: flex;
    align-items: center;
    justify-content: center;
}

/* Prevent hover from reintroducing background */
.nav-gif-btn:hover,
.nav-gif-btn:focus,
.nav-gif-btn:active {
    background-color: transparent !important;
}

/* Mobile: slightly larger for touch */
@media (max-width: 768px) {
    .nav-gif-btn {
        min-width: 72px;
        height: 48px;
    }
}

/* Make it visually balanced with text pills */
.nav-gif-btn.nav-pill {
    padding: 0;
}

/* Hover / active feedback */
.nav-gif-btn:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

.nav-gif-btn:active {
    transform: scale(0.96);
}

/* Mobile: make it BIGGER so it is obvious */
@media (max-width: 768px) {
    .nav-gif-btn {
        min-width: 64px;
        height: 48px;
        background-size: 36px 36px;
    }
}


/* Two-column page layout for hand history */
.hh-page-layout {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important; /* 50% / 50% split */
    gap: 24px;
    align-items: start;
    width: 100%;
}

.hh-left-column {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0; /* Prevent grid blowout */
}

.hh-left-column > .panel {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
}

.hh-right-column {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    min-width: 0; /* Prevent grid blowout */
}

/* Mobile: stack vertically */
@media (max-width: 1024px) {
    .hh-page-layout {
        grid-template-columns: 1fr !important;
    }
}

/* Main Sections */
.hh-recorder-section {
    margin-top: 0;
    padding: 32px 32px 16px 32px;
    background: rgba(7, 10, 20, 0.6);
    border: 1px solid var(--border);
    border-radius: 16px;
    text-align: center;
    display: none;
    transition: opacity 0.3s ease;
    min-height: 500px;
    position: relative;
}

.hh-recorder-section.active {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

.hh-recorder-header {
    margin-bottom: 32px;
}

.hh-recorder-header h3 {
    font-size: 28px;
    margin-bottom: 16px;
    color: #fff;
}

.hh-config-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border-left: 3px solid rgba(80, 150, 255, 0.5);
}

.hh-summary-item {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
}

.hh-summary-item strong {
    color: #fff;
    margin-right: 4px;
}

.hh-summary-item span {
    color: rgba(121, 164, 255, 0.9);
}

/* Table Container */
.hh-table-container {
    position: relative;
    margin: 0 auto;
    max-width: 900px;
    width: 100%;
}

/* Felt/Table */
#hh-felt {
    position: relative;
    width: 100%;
    height: 500px;
    margin: 0 auto;
    background: radial-gradient(ellipse at center, #1a6b3e 0%, #0d4f2f 50%, #073d24 100%);
    border-radius: 50% / 40%;
    box-shadow:
        inset 0 0 100px rgba(0, 0, 0, 0.3),
        inset 0 0 20px rgba(0, 0, 0, 0.2),
        0 10px 30px rgba(0, 0, 0, 0.5);
    transform: perspective(1000px) rotateX(12deg);
    transform-origin: center bottom;
    overflow: visible;
}

#hh-felt::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50% / 40%;
    background-image:
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 2px,
            rgba(0, 0, 0, 0.03) 2px,
            rgba(0, 0, 0, 0.03) 4px
        ),
        repeating-linear-gradient(
            -45deg,
            transparent,
            transparent 2px,
            rgba(0, 0, 0, 0.03) 2px,
            rgba(0, 0, 0, 0.03) 4px
        );
    opacity: 0.5;
    pointer-events: none;
}

/* Seat Chips */
#hh-felt .seat-chip {
    position: absolute;
    border-radius: 10px;
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, .12);
    background: rgba(6, 10, 20, .85);
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    min-width: 72px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-align: center;
    z-index: 5;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
    /* Will be overridden by inline transform with translate */
}

.seat-chip-label {
    font-size: 11px;
    font-weight: 600;
}

.seat-chip-stack {
    font-size: 10px;
    color: rgba(255, 193, 7, 1);
    font-weight: 600;
}

#hh-felt .seat-chip:hover {
    border-color: rgba(121, 164, 255, 0.5);
    background: rgba(6, 10, 20, 0.95);
    /* Preserve the translate from inline styles when hovering */
}

#hh-felt .seat-chip.hero {
    border: 2px solid rgba(80, 150, 255, 0.8);
    background: rgba(20, 40, 100, 0.95);
    box-shadow: 0 0 12px rgba(80, 150, 255, 0.4);
    font-weight: 700;
}

#hh-felt .seat-chip.hero::after {
    content: 'YOU';
    position: absolute;
    bottom: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    font-weight: 800;
    color: rgba(80, 150, 255, 0.9);
    letter-spacing: 1px;
    text-shadow: 0 0 4px rgba(80, 150, 255, 0.5);
}

#hh-felt .seat-chip.villain {
    border-color: rgba(255, 80, 80, 0.6);
    background: rgba(80, 20, 20, 0.9);
}

#hh-felt .seat-chip.active-turn {
    border-color: rgba(255, 193, 7, 1);
    border-width: 3px;
    background: rgba(40, 35, 15, 0.95);
    box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.5), 0 0 20px rgba(255, 193, 7, 0.8);
    animation: pulse-seat 1.5s ease-in-out infinite;
    transform: translate(-50%, -50%) scale(1.1);
    z-index: 10;
}

#hh-felt .seat-chip.active-turn.hero {
    border-color: rgba(255, 193, 7, 1);
    background: rgba(40, 35, 15, 0.95);
    box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.5), 0 0 20px rgba(255, 193, 7, 0.8);
}

#hh-felt .seat-chip.active-turn.villain {
    border-color: rgba(255, 100, 80, 1);
    box-shadow: 0 0 0 2px rgba(255, 100, 80, 0.4), 0 0 12px rgba(255, 100, 80, 0.6);
}

#hh-felt .seat-chip.inactive-turn {
    opacity: 0.5;
}

@keyframes pulse-seat {
    0%, 100% {
        box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.5), 0 0 20px rgba(255, 193, 7, 0.8);
    }
    50% {
        box-shadow: 0 0 0 5px rgba(255, 193, 7, 0.7), 0 0 30px rgba(255, 193, 7, 1);
    }
}

/* Pot Display */
.pot-display-hh {
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.65);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 18px;
    font-weight: 700;
    color: #ffd700;
    z-index: 11;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.action-control-panel.active ~ .pot-display-hh,
#action-panel.active ~ * .pot-display-hh {
    opacity: 0.6;
    transform: translate(-50%, -50%) scale(0.95);
}

/* Community Cards */
.community-cards {
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    gap: 12px;
    z-index: 10;
}

.community-cards .flop-group {
    display: flex;
    gap: 8px;
    margin-right: 6px;
}

.community-cards .turn-card {
    margin-right: 6px;
}

.community-card-slot {
    width: 60px;
    height: 84px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.3);
}

.community-card-slot .card {
    width: 100%;
    height: 100%;
    background: white;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    border: none;
}

.community-card-slot .card.red {
    color: #d32f2f;
}

.community-card-slot .card.black {
    color: #212121;
}

.table-action-buttons {
    position: absolute;
    top: 58%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    gap: 12px;
    z-index: 11;
}

.record-hand-btn {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
    transition: all 0.2s ease;
}

.record-hand-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(76, 175, 80, 0.6);
}

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

/* Action Control Panel */
.action-control-panel {
    position: relative;
    margin: 8px auto 0 auto;
    max-width: 900px;
    width: 100%;
    background: rgba(15, 20, 30, 0.96);
    border: 1px solid rgba(121, 164, 255, 0.25);
    border-radius: 12px;
    padding: 0;
    z-index: 20;
    display: none;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.7);
    overflow: hidden;
    transform-origin: center bottom;
}

.action-control-panel.active {
    display: block;
}

.action-control-panel.hero-mode {
    border-color: rgba(80, 150, 255, 0.4);
    box-shadow: 0 4px 16px rgba(80, 150, 255, 0.2);
}

.action-control-panel.hero-mode .action-panel-header {
    background: linear-gradient(135deg, rgba(30, 80, 180, 0.25), rgba(40, 90, 160, 0.2));
    border-bottom-color: rgba(80, 150, 255, 0.25);
}

.action-control-panel.villain-mode {
    border-color: rgba(255, 100, 80, 0.4);
    box-shadow: 0 4px 16px rgba(255, 100, 80, 0.2);
}

.action-control-panel.villain-mode .action-panel-header {
    background: linear-gradient(135deg, rgba(180, 40, 30, 0.25), rgba(160, 50, 35, 0.2));
    border-bottom-color: rgba(255, 100, 80, 0.25);
}

.action-panel-header {
    background: rgba(20, 30, 50, 0.7);
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.action-on-label {
    display: none;
}

.action-position-row {
    display: none;
}

.position-pill {
    display: none;
}

.hero-mode .position-pill {
    display: none;
}

.villain-mode .position-pill {
    display: none;
}

.player-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.player-role-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.player-role-badge.hero {
    background: rgba(80, 150, 255, 0.25);
    color: #5096ff;
    border: 1px solid rgba(80, 150, 255, 0.4);
}

.player-role-badge.villain {
    background: rgba(255, 100, 80, 0.25);
    color: #ff6450;
    border: 1px solid rgba(255, 100, 80, 0.4);
}

.player-name {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
}

.facing-amount-line {
    font-size: 16px;
    color: #ffd700;
    font-weight: 700;
    white-space: nowrap;
    text-align: right;
    flex: 1;
}

.facing-amount-line .label {
    color: rgba(255, 255, 255, 0.6);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 4px;
}

.action-microcopy {
    display: none;
}

.hero-mode .action-microcopy {
    display: none;
}

.villain-mode .action-microcopy {
    display: none;
}

/* Action Buttons */
.action-panel-body {
    padding: 12px 16px;
}

.action-buttons {
    display: flex;
    gap: 10px;
    justify-content: stretch;
    margin-bottom: 0;
}

.action-btn {
    flex: 1 1 0;     /* critical: allow true shrink, basis 0 so all buttons share space evenly */
    min-width: 0;    /* critical: overrides flex item default min-width:auto (content-based minimum) */

    padding: 14px 18px;
    border: 2px solid;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    background: rgba(0, 0, 0, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);

    /* keep text usable on narrow widths */
    white-space: normal;
    word-break: break-word;
    line-height: 1.1;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.action-btn:active {
    transform: translateY(0);
}

.action-btn:focus {
    outline: 2px solid rgba(121, 164, 255, 0.5);
    outline-offset: 2px;
}

.action-btn.fold {
    border-color: rgba(200, 50, 50, 0.6);
    color: #c83232;
    background: rgba(200, 50, 50, 0.08);
}

.action-btn.fold:hover {
    background: rgba(200, 50, 50, 0.18);
    border-color: rgba(200, 50, 50, 0.8);
    box-shadow: 0 4px 12px rgba(200, 50, 50, 0.4);
}

.action-btn.call {
    border-color: rgba(80, 150, 255, 0.7);
    background: rgba(80, 150, 255, 0.85);
    color: #fff;
    font-weight: 800;
}

.action-btn.call:hover {
    background: rgba(80, 150, 255, 0.95);
    border-color: rgba(80, 150, 255, 0.9);
    box-shadow: 0 4px 12px rgba(80, 150, 255, 0.5);
}

.action-btn.raise {
    border-color: rgba(255, 193, 7, 0.7);
    background: rgba(255, 193, 7, 0.15);
    color: #ffc107;
    font-weight: 800;
}

.action-btn.raise:hover {
    background: rgba(255, 193, 7, 0.25);
    border-color: rgba(255, 193, 7, 0.9);
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.4);
}

/* Raise Drawer */
.raise-drawer {
    display: none;
    margin-top: 12px;
    padding: 14px;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 8px;
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.raise-drawer.active {
    display: block;
}

.raise-size-display {
    text-align: center;
    margin-bottom: 12px;
}

.raise-amount-bb {
    font-size: 32px;
    font-weight: 700;
    color: #ffc107;
    letter-spacing: 1px;
}

.raise-amount-usd {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 4px;
}

.raise-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
}

.raise-step-btn {
    width: 36px;
    height: 36px;
    border: 2px solid rgba(255, 193, 7, 0.5);
    background: rgba(0, 0, 0, 0.3);
    color: #ffc107;
    border-radius: 6px;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.raise-step-btn:hover {
    background: rgba(255, 193, 7, 0.2);
    border-color: rgba(255, 193, 7, 0.8);
    transform: translateY(-1px);
}

.raise-step-btn:active {
    transform: scale(0.95);
}

.raise-input-wrapper {
    position: relative;
}

.raise-size-input {
    width: 120px;
    padding: 10px 12px;
    border: 2px solid rgba(255, 193, 7, 0.5);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.5);
    color: #ffc107;
    font-size: 18px;
    font-weight: 700;
    text-align: center;
}

.raise-size-input:focus {
    outline: none;
    border-color: rgba(255, 193, 7, 0.8);
    box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.2);
}

.raise-presets {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 12px;
}

.preset-btn {
    padding: 8px 14px;
    border: 1.5px solid rgba(255, 193, 7, 0.4);
    background: rgba(0, 0, 0, 0.3);
    color: #ffc107;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.preset-btn:hover {
    background: rgba(255, 193, 7, 0.2);
    border-color: rgba(255, 193, 7, 0.7);
    transform: translateY(-1px);
}

.preset-btn:active {
    transform: scale(0.95);
}

.confirm-raise-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #ffc107, #ff9800);
    color: rgba(0, 0, 0, 0.9);
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 6px rgba(255, 193, 7, 0.3);
}

.confirm-raise-btn:hover {
    background: linear-gradient(135deg, #ff9800, #f57c00);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.5);
}

.confirm-raise-btn:active {
    transform: translateY(0);
}

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

.raise-hint {
    text-align: center;
    font-size: 9px;
    color: rgba(255, 255, 255, 0.3);
    margin-top: 6px;
}

.raise-error {
    text-align: center;
    font-size: 11px;
    color: #ff6b6b;
    margin-top: 6px;
    font-weight: 600;
}

/* Bet Chips */
.seat-bets {
    display: flex;
    flex-direction: column-reverse;
    gap: 6px;
    align-items: center;
    justify-content: flex-end;
    pointer-events: none;
    z-index: 500;
    position: relative;
}

.seat-bets .seat-chip-denom {
    width: 34px;
    height: 18px;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5), inset 0 -2px 3px rgba(0,0,0,0.3);
    margin-bottom: -14px;
    border: 1px solid rgba(255,255,255,0.06);
    position: relative;
}

.seat-bets .seat-chip-denom::before,
.seat-bets .seat-chip-denom::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 8px;
    height: 2px;
    background: rgba(255,255,255,0.9);
    transform: translateY(-50%);
    border-radius: 1px;
}

.seat-bets .seat-chip-denom::before { left: 6%; }
.seat-bets .seat-chip-denom::after { right: 6%; }
.seat-bets .chip-denom-1 { background: linear-gradient(180deg,#ffffff,#e8e8e8); }
.seat-bets .chip-denom-5 { background: linear-gradient(180deg,#e84343,#c33a3a); }
.seat-bets .chip-denom-25 { background: linear-gradient(180deg,#34c57b,#1a9a52); }
.seat-bets .chip-denom-100 { background: linear-gradient(180deg,#222,#000); }

.seat-bet-tooltip {
    position: absolute;
    display: block;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    padding: 2px 6px;
    background: rgba(0, 0, 0, 0.85);
    border-radius: 3px;
    color: #64B4FF;
    font-size: 10px;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
    min-width: 24px;
    z-index: 600;
}

/* Center pot pile */
.center-pot-pile {
    position: absolute;
    left: 50%;
    top: calc(50% + 30px);
    transform: translate(-50%, -50%);
    display: flex;
    flex-wrap: wrap;
    width: 100px;
    height: 70px;
    align-items: center;
    justify-content: center;
    gap: 0px;
    z-index: 500;
    pointer-events: none;
}

.center-pot-pile .seat-chip-denom {
    margin-bottom: 0;
    position: relative;
    animation: chipFall 0.4s ease-out forwards;
    flex-shrink: 0;
    width: 34px;
    height: 18px;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5), inset 0 -2px 3px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.06);
}

.center-pot-pile .seat-chip-denom::before,
.center-pot-pile .seat-chip-denom::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 8px;
    height: 2px;
    background: rgba(255,255,255,0.9);
    transform: translateY(-50%);
    border-radius: 1px;
}

.center-pot-pile .seat-chip-denom::before { left: 6%; }
.center-pot-pile .seat-chip-denom::after { right: 6%; }

/* Center pile chip colors */
.center-pot-pile .chip-denom-1 { background: linear-gradient(180deg,#ffffff,#e8e8e8); }
.center-pot-pile .chip-denom-5 { background: linear-gradient(180deg,#e84343,#c33a3a); }
.center-pot-pile .chip-denom-25 { background: linear-gradient(180deg,#34c57b,#1a9a52); }
.center-pot-pile .chip-denom-100 { background: linear-gradient(180deg,#222,#000); }

@keyframes chipFall {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.7) rotate(0deg);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Stack Editing */
.stack-edit-tooltip {
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 10px;
    background: rgba(255, 193, 7, 0.98);
    border-radius: 6px;
    color: #1a1a1a;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    z-index: 1000;
    display: none;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

.stack-editor {
    position: absolute;
    top: -80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 20, 20, 0.98);
    border: 2px solid rgba(255, 193, 7, 0.8);
    border-radius: 8px;
    padding: 8px;
    z-index: 800;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
    min-width: 100px;
}

.stack-editor-value {
    text-align: center;
    color: #ffd700;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 8px;
    padding: 4px;
    background: rgba(255, 215, 0, 0.1);
    border-radius: 4px;
}

.stack-editor-controls {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.stack-btn {
    width: 36px;
    height: 36px;
    background: linear-gradient(180deg, rgba(255, 193, 7, 0.3), rgba(255, 193, 7, 0.15));
    border: 1px solid rgba(255, 193, 7, 0.5);
    border-radius: 6px;
    color: #ffd700;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

.stack-btn:hover {
    background: linear-gradient(180deg, rgba(255, 193, 7, 0.5), rgba(255, 193, 7, 0.3));
    border-color: rgba(255, 193, 7, 0.8);
    transform: scale(1.05);
}

.stack-btn:active {
    background: linear-gradient(180deg, rgba(255, 193, 7, 0.6), rgba(255, 193, 7, 0.4));
    transform: scale(0.95);
}

/* Hero Hole Cards */
.hero-hole-cards {
    position: absolute;
    display: none;
    gap: 3px;
    z-index: 15;
}

.hero-hole-cards .card {
    width: 30px;  /* Slightly wider for better card proportions */
    height: 42px; /* 1.4:1 ratio like real cards */
    background: white;
    border-radius: 3px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
    border: 1px solid #ddd;
    position: relative;
    padding: 2px;
}

/* Top-left corner rank & suit */
.hero-hole-cards .card::before {
    content: attr(data-card);
    position: absolute;
    top: 2px;
    left: 3px;
    font-size: 8px;
    line-height: 1;
    font-weight: 700;
}

/* Bottom-right corner rank & suit (upside down) */
.hero-hole-cards .card::after {
    content: attr(data-card);
    position: absolute;
    bottom: 2px;
    right: 3px;
    font-size: 8px;
    line-height: 1;
    font-weight: 700;
    transform: rotate(180deg);
}

/* Center large suit symbol */
.hero-hole-cards .card {
    font-size: 20px; /* Large center suit */
}

.hero-hole-cards .card.red,
.hero-hole-cards .card.red::before,
.hero-hole-cards .card.red::after {
    color: #d32f2f;
}

.hero-hole-cards .card.black,
.hero-hole-cards .card.black::before,
.hero-hole-cards .card.black::after {
    color: #212121;
}

/* Card Selector Modal */
.card-selector-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.card-selector-modal.active {
    display: flex;
}

.card-selector-content {
    background: linear-gradient(135deg, rgba(15, 20, 35, 0.98), rgba(7, 10, 20, 0.98));
    border-radius: 16px;
    padding: 32px;
    max-width: 950px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid rgba(121, 164, 255, 0.3);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.card-selector-content h4 {
    font-size: 24px;
    margin-bottom: 8px;
    color: #fff;
    text-align: center;
}

.selector-hint {
    text-align: center;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 24px;
}

.card-selector-section {
    margin-top: 48px;
    padding: 24px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    display: none;
}

.card-wheel {
    display: grid;
    grid-template-columns: repeat(13, 1fr);
    gap: 6px;
    margin-bottom: 24px;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.card-wheel .mini-card {
    aspect-ratio: 5 / 7;
    background: white;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s, opacity 0.1s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.card-wheel .mini-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

.card-wheel .mini-card.selected {
    transform: translateY(-6px) scale(1.05);
    box-shadow: 0 6px 16px rgba(80, 150, 255, 0.6);
    border: 2px solid rgba(80, 150, 255, 0.9);
}

.card-wheel .mini-card.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.card-wheel .mini-card.red {
    color: #d32f2f;
}

.card-wheel .mini-card.black {
    color: #212121;
}

.selected-cards-display {
    display: flex;
    justify-content: center;
    gap: 24px;
}

.selected-card-slot {
    width: 80px;
    height: 112px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    position: relative;
}

.selected-card-slot .card {
    position: absolute;
    inset: 0;
    border: none;
    background: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

.selected-card-slot .card.red {
    color: #d32f2f;
}

.selected-card-slot .card.black {
    color: #212121;
}

/* Placeholder */
.hh-placeholder {
    padding: 64px 32px;
    background: radial-gradient(circle at center, rgba(107, 196, 154, 0.05) 0%, transparent 70%);
    border: 2px dashed var(--border);
    border-radius: 12px;
}

.hh-placeholder h3 {
    margin: 0 0 16px;
    font-size: 24px;
    color: var(--ink);
}

.hh-placeholder p {
    margin: 0 0 24px;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.6;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.villain-name-input {
    margin-top: 16px;
}

.villain-name-input input {
    width: 100%;
    max-width: 300px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--ink);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
}

.villain-name-input input:focus {
    outline: none;
    border-color: var(--accent2);
    box-shadow: 0 0 0 3px rgba(107, 196, 154, 0.1);
}

.config-complete-banner {
    padding: 16px 24px;
    background: linear-gradient(135deg, rgba(107, 196, 154, 0.15) 0%, rgba(107, 196, 154, 0.05) 100%);
    border: 1px solid var(--accent2);
    border-radius: 12px;
    margin-bottom: 24px;
    display: none;
}

.config-complete-banner.show {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.config-complete-banner h4 {
    margin: 0 0 8px;
    color: var(--accent2);
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.config-complete-banner p {
    margin: 0;
    color: var(--ink);
    font-size: 14px;
    line-height: 1.5;
}

/* Villain Modal Grid */
.villain-modal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
}

.hh-role-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border-radius: 12px;
    background: rgba(7, 10, 20, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.12);
    cursor: pointer;
    transition: transform 0.08s, border-color 0.12s, box-shadow 0.12s;
}

.hh-role-box:hover {
    transform: translateY(-1px);
    border-color: rgba(121, 164, 255, 0.7);
    box-shadow: 0 0 12px rgba(121, 164, 255, 0.2);
}

.hh-role-box.hero {
    border-color: rgba(80, 150, 255, 0.3);
}

.hh-role-box.hero:hover {
    border-color: rgba(80, 150, 255, 0.9);
    box-shadow: 0 0 18px rgba(80, 150, 255, 0.3);
}

.hh-role-pic {
    width: 100%;
    aspect-ratio: 3 / 4;
    border-radius: 10px;
    overflow: hidden;
    background: #0b0f1a;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hh-role-pic img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.hh-role-pic.add-new {
    font-size: 48px;
    color: var(--accent2);
    cursor: pointer;
    font-weight: 300;
}

.hh-role-name {
    font-size: 12px;
    color: var(--ink);
    text-align: center;
    font-weight: 600;
}

.hh-role-desc {
    font-size: 11px;
    color: var(--muted);
    text-align: center;
}

.gif-option {
    width: 80px;
    height: 80px;
    border: 2px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.gif-option img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gif-option:hover {
    border-color: var(--accent2);
    transform: scale(1.05);
}

.gif-option.selected {
    border-color: var(--accent2);
    border-width: 3px;
    box-shadow: 0 0 0 3px rgba(107, 196, 154, 0.2);
}

.gif-option.selected::after {
    content: '✓';
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background: var(--accent2);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

/* Responsive Design */
@media (max-width: 768px) {
    #hh-felt {
        height: 400px;
    }

    .community-card-slot {
        width: 50px;
        height: 70px;
    }

    .hero-hole-cards .card {
        width: 40px;
        height: 56px;
        font-size: 18px;
    }

    .card-wheel {
        grid-template-columns: repeat(13, 1fr);
        gap: 4px;
    }

    .card-wheel .mini-card {
        font-size: 12px;
    }

    .card-selector-content {
        padding: 20px;
    }

    #hh-felt .seat-chip {
        transform-origin: center;
        font-size: 10px;
        min-width: 60px;
        padding: 5px 8px;
    }

    #hh-felt .seat-gif {
        width: 14px;
        height: 14px;
    }

    .seat-bets .seat-chip-denom {
        width: 18px;
        height: 10px;
        margin-bottom: -8px;
    }

    .seat-bet-tooltip {
        font-size: 9px;
        padding: 1px 4px;
    }
}

@media (max-width: 390px) {
    #hh-felt .seat-chip {
        font-size: 9px;
        min-width: 50px;
        padding: 4px 6px;
    }

    #hh-felt .seat-gif {
        width: 12px;
        height: 12px;
    }

    .community-card-slot {
        width: 45px;
        height: 63px;
    }
}

@media (min-width: 769px) {
    .hh-table-container {
        max-width: 1000px;
    }

    #hh-felt {
        height: 550px;
    }
}

@media (min-width: 1440px) {
    .hh-table-container {
        max-width: 1100px;
    }

    #hh-felt {
        height: 600px;
    }
}

/* Villain Showdown Modal */
.villain-showdown-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.villain-showdown-content {
    background: linear-gradient(135deg, rgba(15, 20, 35, 0.98), rgba(7, 10, 20, 0.98));
    border-radius: 16px;
    padding: 32px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid rgba(255, 100, 80, 0.4);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.villain-showdown-header {
    text-align: center;
    margin-bottom: 24px;
}

.villain-showdown-header h3 {
    font-size: 24px;
    margin-bottom: 8px;
    color: #fff;
}

.villain-showdown-hint {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    margin: 0;
}

.villain-showdown-selection {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 24px;
}

.showdown-card-slot {
    width: 80px;
    height: 112px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    position: relative;
}

.showdown-card-slot .card {
    position: absolute;
    inset: 0;
    border: none;
    background: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

.showdown-card-slot .card.red {
    color: #d32f2f;
}

.showdown-card-slot .card.black {
    color: #212121;
}

.villain-card-wheel {
    display: grid;
    grid-template-columns: repeat(13, 1fr);
    gap: 6px;
    margin-bottom: 24px;
    max-width: 850px;
    margin-left: auto;
    margin-right: auto;
}

.villain-card-wheel .mini-card {
    aspect-ratio: 5 / 7;
    background: white;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s, opacity 0.1s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.villain-card-wheel .mini-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

.villain-card-wheel .mini-card.selected {
    transform: translateY(-6px) scale(1.05);
    box-shadow: 0 6px 16px rgba(255, 100, 80, 0.6);
    border: 2px solid rgba(255, 100, 80, 0.9);
}

.villain-card-wheel .mini-card.red {
    color: #d32f2f;
}

.villain-card-wheel .mini-card.black {
    color: #212121;
}

.villain-showdown-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.villain-btn {
    padding: 12px 32px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.villain-btn-primary {
    background: linear-gradient(135deg, #ff6450, #ff4430);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 100, 80, 0.3);
}

.villain-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #ff7460, #ff5540);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 100, 80, 0.5);
}

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

.villain-btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.villain-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.action-log-entry.showdown {
    border-left-color: rgba(156, 39, 176, 0.6);
    color: rgba(186, 104, 200, 0.95);
    background: rgba(156, 39, 176, 0.1);
    font-weight: 600;
}

.action-entry.showdown {
    color: rgba(186, 104, 200, 0.9);
    font-weight: 600;
}

/* Street Indicator */
.street-indicator {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(121, 164, 255, 0.4);
    border-radius: 6px;
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 700;
    color: #79a4ff;
    text-transform: uppercase;
    letter-spacing: 1px;
    z-index: 15;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Action History Mini Box (top left of recorder) */
.action-history-mini {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 160px;
    height: 70px;
    background: rgba(10, 15, 25, 0.92);
    border: 1px solid rgba(121, 164, 255, 0.25);
    border-radius: 8px;
    overflow: hidden;
    z-index: 20;
    cursor: pointer;
    transition: all 0.2s ease;
    display: none;
}

.action-history-mini.active {
    display: block;
}

.action-history-mini:hover {
    border-color: rgba(121, 164, 255, 0.5);
    background: rgba(15, 20, 35, 0.95);
}

.action-history-mini::after {
    content: 'Click to expand';
    position: absolute;
    bottom: 2px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 8px;
    color: rgba(121, 164, 255, 0.6);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.action-history-mini:hover::after {
    opacity: 1;
}

.action-history-mini-content {
    padding: 6px 8px;
    overflow: hidden;
    height: 100%;
    font-size: 10px;
    line-height: 1.4;
}

.action-history-mini-content .action-entry {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 2px 0;
    color: rgba(255, 255, 255, 0.8);
}

.action-history-mini-content .action-entry.street-marker {
    color: rgba(121, 164, 255, 0.9);
    font-weight: 600;
}

.action-history-mini-content .action-entry.hero-intro {
    color: rgba(255, 193, 7, 0.9);
    font-weight: 600;
}

.action-history-mini-content .action-entry.winner {
    color: rgba(50, 205, 50, 0.9);
    font-weight: 700;
}

/* Expanded Action Log Panel */
.action-log-expanded {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 360px;
    height: 270px;
    background: rgba(10, 15, 25, 0.96);
    border: 1px solid rgba(121, 164, 255, 0.35);
    border-radius: 10px;
    overflow: hidden;
    z-index: 100;
    display: none;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.action-log-expanded.active {
    display: flex;
}

.action-log-header {
    padding: 10px 14px;
    background: rgba(20, 30, 50, 0.7);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.action-log-title {
    font-size: 13px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.action-log-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease;
}

.action-log-close:hover {
    color: rgba(255, 255, 255, 0.9);
}

.action-log-body {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.action-log-entry {
    padding: 6px 8px;
    margin-bottom: 4px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    font-size: 11px;
    line-height: 1.4;
    border-left: 3px solid transparent;
}

.action-log-entry.fold {
    border-left-color: rgba(200, 50, 50, 0.6);
    color: rgba(200, 50, 50, 0.9);
}

.action-log-entry.call {
    border-left-color: rgba(80, 150, 255, 0.6);
    color: rgba(80, 150, 255, 0.9);
}

.action-log-entry.raise {
    border-left-color: rgba(255, 193, 7, 0.6);
    color: rgba(255, 193, 7, 0.9);
}

.action-log-entry.street-marker {
    border-left-color: rgba(121, 164, 255, 0.6);
    color: rgba(121, 164, 255, 0.95);
    background: rgba(121, 164, 255, 0.1);
    font-weight: 600;
}

.action-log-entry.hero-intro {
    border-left-color: rgba(255, 193, 7, 0.6);
    color: rgba(255, 193, 7, 0.95);
    background: rgba(255, 193, 7, 0.1);
    font-weight: 600;
}

.action-log-entry.winner {
    border-left-color: rgba(50, 205, 50, 0.6);
    color: rgba(50, 205, 50, 0.95);
    background: rgba(50, 205, 50, 0.1);
    font-weight: 700;
}

.action-log-entry .seat {
    font-weight: 700;
    margin-right: 4px;
}

.action-log-entry .amount {
    font-weight: 700;
}

/* Undo Button */
.undo-btn {
    position: fixed;
    bottom: 28vh;
    right: 20px;
    width: 48px;
    height: 48px;
    background: rgba(15, 20, 30, 0.96);
    border: 1px solid rgba(121, 164, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 30;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.undo-btn:hover {
    background: rgba(20, 30, 50, 1);
    border-color: rgba(121, 164, 255, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.6);
}

.undo-btn:active {
    transform: translateY(0);
}

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

.undo-btn:disabled:hover {
    transform: none;
    border-color: rgba(121, 164, 255, 0.3);
}

.undo-btn svg {
    width: 24px;
    height: 24px;
    fill: rgba(121, 164, 255, 0.9);
}

/* Keyboard Shortcuts Hint */
.keyboard-shortcuts {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 20, 30, 0.9);
    border: 1px solid rgba(121, 164, 255, 0.2);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    z-index: 25;
    display: none;
    white-space: nowrap;
}

.keyboard-shortcuts.show {
    display: block;
}

.keyboard-shortcuts kbd {
    display: inline-block;
    padding: 2px 6px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(121, 164, 255, 0.3);
    border-radius: 3px;
    font-family: monospace;
    font-size: 10px;
    font-weight: 700;
    color: #79a4ff;
    margin: 0 2px;
}

/* Mobile Responsive Updates */
@media (max-width: 768px) {
    .action-log {
        right: 10px;
        left: 10px;
        width: auto;
        top: auto;
        bottom: 28vh;
        max-height: 40vh;
    }

    .undo-btn {
        bottom: calc(28vh + 10px);
        right: 10px;
        width: 44px;
        height: 44px;
    }

    .keyboard-shortcuts {
        display: none !important;
    }

    .action-control-panel {
        max-height: 30vh;
    }
}

@media (max-width: 390px) {
    .action-log {
        max-height: 35vh;
    }

    .action-control-panel {
        max-height: 35vh;
    }
}

/* Save Hand Modal */
.save-hand-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    padding: 20px;
}

.save-hand-content {
    background: linear-gradient(135deg, rgba(15, 20, 35, 0.98), rgba(7, 10, 20, 0.98));
    border-radius: 16px;
    padding: 32px;
    max-width: 500px;
    width: 100%;
    border: 1px solid rgba(76, 175, 80, 0.4);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.save-hand-header {
    text-align: center;
    margin-bottom: 24px;
}

.save-hand-header h3 {
    font-size: 24px;
    margin-bottom: 8px;
    color: #fff;
}

.save-hand-header p {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    margin: 0;
}

.save-hand-summary {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.summary-row:last-child {
    border-bottom: none;
}

.summary-label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 600;
}

.summary-value {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 700;
}

.save-hand-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.save-hand-btn {
    padding: 12px 32px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.save-hand-btn.primary {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.save-hand-btn.primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #5CBF60, #4db052);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(76, 175, 80, 0.5);
}

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

.save-hand-btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.save-hand-btn.secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

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

.save-status {
    margin-top: 16px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    min-height: 20px;
}

/* Hand History Viewer Modal */
.hand-viewer-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10002;
    padding: 20px;
}

.hand-viewer-content {
    background: linear-gradient(135deg, rgba(15, 20, 35, 0.98), rgba(7, 10, 20, 0.98));
    border-radius: 16px;
    max-width: 1200px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(121, 164, 255, 0.3);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    overflow: hidden;
}

.hand-viewer-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hand-viewer-header h2 {
    margin: 0;
    font-size: 24px;
    color: #fff;
}

.hand-viewer-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 32px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.hand-viewer-close:hover {
    color: rgba(255, 255, 255, 0.9);
}

.hand-viewer-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* Villain List View */
.villain-list-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.villain-card {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 16px;
    cursor: default;
    transition: all 0.2s ease;
}

.villain-card:hover {
    border-color: rgba(121, 164, 255, 0.5);
    background: rgba(0, 0, 0, 0.6);
    transform: translateY(-2px);
}

.villain-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.villain-card-header h4 {
    margin: 0;
    font-size: 18px;
    color: #fff;
}

.hand-count {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
}

.villain-card-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}

.stat-value.won {
    color: #4CAF50;
}

.stat-value.lost {
    color: #ff6b6b;
}

/* Hand List View */
.hand-list-view {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.hand-list-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.hand-list-header h3 {
    flex: 1;
    margin: 0;
    font-size: 20px;
    color: #fff;
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sort-controls label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
}

.sort-controls select {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    font-size: 13px;
}

.back-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.9);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.hand-list-body {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.hand-card {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.hand-result {
    font-size: 13px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 4px;
}

.hand-result.won {
    background: rgba(76, 175, 80, 0.2);
    color: #4CAF50;
}

.hand-result.lost {
    background: rgba(255, 107, 107, 0.2);
    color: #ff6b6b;
}

.hand-date {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

.hand-card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hand-info-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

.info-label {
    color: rgba(255, 255, 255, 0.6);
}

.info-value {
    color: #fff;
    font-weight: 600;
}

.hero-cards {
    display: flex;
    gap: 4px;
}

.card-mini {
    display: inline-block;
    padding: 2px 4px;
    background: white;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 700;
}

.card-mini.red {
    color: #d32f2f;
}

.card-mini.black {
    color: #212121;
}

.view-hand-btn {
    background: linear-gradient(135deg, #5096ff, #4080ff);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.view-hand-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(80, 150, 255, 0.5);
}

/* Hand Replay View */
.hand-replay-view {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.hand-replay-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.hand-replay-header h3 {
    flex: 1;
    margin: 0;
    font-size: 20px;
    color: #fff;
}

.hand-replay-body {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.replay-summary {
    text-align: center;
}

.replay-result {
    font-size: 24px;
    font-weight: 700;
    padding: 16px 24px;
    border-radius: 12px;
    display: inline-block;
}

.replay-result.won {
    background: rgba(76, 175, 80, 0.2);
    color: #4CAF50;
    border: 2px solid rgba(76, 175, 80, 0.5);
}

.replay-result.lost {
    background: rgba(255, 107, 107, 0.2);
    color: #ff6b6b;
    border: 2px solid rgba(255, 107, 107, 0.5);
}

.replay-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

.replay-info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.replay-info-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.replay-info-value {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
}

.replay-cards-section {
    display: grid;
    grid-template-columns: 1fr 1fr 2fr;
    gap: 24px;
}

.replay-cards-group h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.replay-card {
    width: 60px;
    height: 84px;
    background: white;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

.replay-card.red {
    color: #d32f2f;
}

.replay-card.black {
    color: #212121;
}

.replay-board-display {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.board-street {
    display: flex;
    align-items: center;
    gap: 12px;
}

.street-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    min-width: 50px;
    font-weight: 600;
}

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

.no-cards {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.3);
}

.replay-actions-section h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.replay-actions-log {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 16px;
    max-height: 400px;
    overflow-y: auto;
}

.replay-action {
    padding: 8px 12px;
    margin-bottom: 6px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.4;
    border-left: 3px solid transparent;
}

.replay-action.fold {
    border-left-color: rgba(200, 50, 50, 0.6);
    color: rgba(200, 50, 50, 0.9);
}

.replay-action.call,
.replay-action.check {
    border-left-color: rgba(80, 150, 255, 0.6);
    color: rgba(80, 150, 255, 0.9);
}

.replay-action.raise,
.replay-action[class*="-bet"] {
    border-left-color: rgba(255, 193, 7, 0.6);
    color: rgba(255, 193, 7, 0.9);
}

.replay-action.street-marker {
    border-left-color: rgba(121, 164, 255, 0.6);
    color: rgba(121, 164, 255, 0.95);
    background: rgba(121, 164, 255, 0.1);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 12px;
}

.replay-action strong {
    font-weight: 700;
}

/* Loading and Empty States */
.loading-spinner {
    text-align: center;
    padding: 40px;
    font-size: 16px;
    color: rgba(255, 255, 255, 0.6);
}

.error-message {
    text-align: center;
    padding: 40px;
    color: #ff6b6b;
}

.empty-state {
    text-align: center;
    padding: 60px 40px;
}

.empty-state p {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.6);
    margin: 8px 0;
}

.empty-hint {
    font-size: 14px !important;
    color: rgba(255, 255, 255, 0.4) !important;
}

/* Scrollbar Styling */
.hand-viewer-body::-webkit-scrollbar,
.replay-actions-log::-webkit-scrollbar {
    width: 8px;
}

.hand-viewer-body::-webkit-scrollbar-track,
.replay-actions-log::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.hand-viewer-body::-webkit-scrollbar-thumb,
.replay-actions-log::-webkit-scrollbar-thumb {
    background: rgba(121, 164, 255, 0.3);
    border-radius: 4px;
}

.hand-viewer-body::-webkit-scrollbar-thumb:hover,
.replay-actions-log::-webkit-scrollbar-thumb:hover {
    background: rgba(121, 164, 255, 0.5);
}

/* Responsive Design */
@media (max-width: 768px) {
    .hand-viewer-content {
        max-height: 95vh;
    }

    .villain-list-view {
        grid-template-columns: 1fr;
    }

    .hand-list-body {
        grid-template-columns: 1fr;
    }

    .replay-cards-section {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .replay-info-grid {
        grid-template-columns: 1fr;
    }

    .table-action-buttons {
        flex-direction: column;
        gap: 8px;
    }

    .record-hand-btn, .view-history-btn {
        padding: 10px 20px;
        font-size: 14px;
    }

    /* Mobile toast adjustments */
    .toast-message {
        max-width: 90%;
        font-size: 13px;
        padding: 10px 16px;
    }

    /* Mobile config indicator adjustments */
    .config-ready-indicator {
        flex-direction: column;
        text-align: center;
        padding: 12px;
    }

    .config-ready-indicator .indicator-text {
        font-size: 13px;
    }

    .quick-record-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Toast Notification System */
.toast-message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: rgba(15, 20, 30, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    z-index: 10003;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    max-width: 500px;
    text-align: center;
}

.toast-message.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-message.toast-success {
    border-left: 4px solid #4CAF50;
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.15), rgba(15, 20, 30, 0.98));
}

.toast-message.toast-error {
    border-left: 4px solid #ff6b6b;
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.15), rgba(15, 20, 30, 0.98));
}

.toast-message.toast-info {
    border-left: 4px solid #79a4ff;
    background: linear-gradient(135deg, rgba(121, 164, 255, 0.15), rgba(15, 20, 30, 0.98));
}

.toast-message.toast-warning {
    border-left: 4px solid #ffc107;
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.15), rgba(15, 20, 30, 0.98));
}

/* Configuration panel highlight animation */
#config-panel {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Next hand ready indicator */
.config-ready-indicator {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(107, 196, 154, 0.15), rgba(107, 196, 154, 0.05));
    border: 1px solid var(--accent2);
    border-radius: 8px;
    margin-bottom: 16px;
    animation: pulseGlow 2s ease-in-out infinite;
}

.config-ready-indicator.show {
    display: flex;
}

.config-ready-indicator .indicator-icon {
    font-size: 20px;
}

.config-ready-indicator .indicator-text {
    flex: 1;
    font-size: 14px;
    color: var(--accent2);
    font-weight: 600;
}

.quick-record-btn {
    background: linear-gradient(135deg, var(--accent2), #5eb897);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(107, 196, 154, 0.3);
}

.quick-record-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(107, 196, 154, 0.5);
}

.quick-record-btn:active {
    transform: translateY(0);
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(107, 196, 154, 0.3);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(107, 196, 154, 0.1);
    }
}

/* Your Villains and New Villain boxes */
.hh-role-box.your-villains,
.hh-role-box.new-villain {
    border-color: rgba(107, 196, 154, 0.3);
}

.hh-role-box.your-villains:hover,
.hh-role-box.new-villain:hover {
    border-color: rgba(107, 196, 154, 0.7);
    box-shadow: 0 0 12px rgba(107, 196, 154, 0.2);
}

/* Back arrow button in modals */
.back-arrow-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    margin-right: 12px;
    transition: color 0.2s;
    line-height: 1;
}

.back-arrow-btn:hover {
    color: rgba(255, 255, 255, 1);
}

.villain-modal-header {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.villain-modal-header span {
    font-size: 18px;
    font-weight: 700;
    color: var(--ink);
}

/* Delete villain button */
.delete-villain-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: rgba(255, 80, 80, 0.9);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 10;
}

.hh-role-box:hover .delete-villain-btn {
    opacity: 1;
}

.delete-villain-btn:hover {
    background: rgba(255, 40, 40, 1);
    transform: scale(1.1);
}

.hh-role-box {
    position: relative;
}

.back-action-btn {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.back-action-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(80, 150, 255, 0.5);
    transform: translateX(-2px);
}

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

.action-panel-header {
    position: relative;
}

/* Active turn - yellow glow */
#hh-felt .seat-chip.active-turn {
    border-color: rgba(255, 193, 7, 1);
    border-width: 3px;
    background: rgba(40, 35, 15, 0.95);
    box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.5), 0 0 20px rgba(255, 193, 7, 0.8);
    animation: pulse-seat 1.5s ease-in-out infinite;
    transform: translate(-50%, -50%) scale(1.1);
    z-index: 10;
}

/* Still in hand - clear design, no glow */
#hh-felt .seat-chip.in-hand {
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(6, 10, 20, 0.95);
    color: rgba(255, 255, 255, 0.95);
}

#hh-felt .seat-chip.in-hand .seat-chip-label {
    color: rgba(255, 255, 255, 0.95);
}

#hh-felt .seat-chip.in-hand .seat-chip-stack {
    color: rgba(255, 193, 7, 1);
}

/* Inactive turn - faded (folded players) */
#hh-felt .seat-chip.inactive-turn {
    opacity: 0.5;
}

/* Mobile Responsive Updates */
@media (max-width: 768px) {
    /* Action Panel Mobile Adjustments (CONTAINED in recorder panel) */
    .action-control-panel {
        max-height: none; /* Allow full height */
        position: relative; /* was: fixed */
        bottom: auto;
        left: auto;
        right: auto;
        margin: 10px 0 0;
        border-radius: 16px;
        max-width: 100%;
        width: 100%;
    }

    .action-panel-header {
        padding: 8px 12px;
    }

    .player-role-badge {
        font-size: 10px;
        padding: 2px 6px;
    }

    .player-name {
        font-size: 12px;
    }

    .facing-amount-line {
        font-size: 14px;
    }

    .facing-amount-line .label {
        font-size: 11px;
    }

    .action-panel-body {
        padding: 10px 12px;
    }

    /* Action Buttons Mobile */
    .action-buttons {
        gap: 8px;
    }

    .action-btn {
        padding: 12px 14px;
        font-size: 14px;
    }

    /* Raise Drawer Mobile */
    .raise-drawer {
        padding: 12px;
        margin-top: 10px;
    }

    .raise-amount-bb {
        font-size: 26px;
    }

    .raise-amount-usd {
        font-size: 12px;
    }

    .raise-controls {
        gap: 8px;
        margin-bottom: 8px;
    }

    .raise-step-btn {
        width: 32px;
        height: 32px;
        font-size: 18px;
    }

    .raise-size-input {
        width: 100px;
        padding: 8px 10px;
        font-size: 16px;
    }

    /* Raise Presets Mobile - Make them wrap and smaller */
    .raise-presets {
        flex-wrap: wrap;
        gap: 6px;
        margin-bottom: 10px;
    }

    .preset-btn {
        padding: 6px 10px;
        font-size: 12px;
        min-width: 52px;
        flex: 0 0 auto;
    }

    /* Confirm Raise Button Mobile */
    .confirm-raise-btn {
        padding: 10px;
        font-size: 13px;
    }

    .raise-hint {
        font-size: 8px;
        margin-top: 4px;
    }

    .raise-error {
        font-size: 10px;
        margin-top: 4px;
    }

    /* Recorder section no longer needs bottom padding for a fixed action panel */
    .hh-recorder-section {
        padding-bottom: 0;
    }

    /* Keep existing mobile tweaks, but remove the "above fixed panel" assumptions */
    .action-log {
        right: 10px;
        left: 10px;
        width: auto;
        top: auto;
        bottom: 10px;
        max-height: 40vh;
    }

    .undo-btn {
        right: 10px;
        bottom: 10px;
        width: 44px;
        height: 44px;
    }

    .keyboard-shortcuts {
        display: none !important;
    }
}

/* Extra small mobile devices */
@media (max-width: 390px) {
    .action-control-panel {
        font-size: 13px;
    }

    .action-btn {
        padding: 10px 12px;
        font-size: 13px;
    }

    .raise-amount-bb {
        font-size: 22px;
    }

    .raise-step-btn {
        width: 28px;
        height: 28px;
        font-size: 16px;
    }

    .raise-size-input {
        width: 85px;
        padding: 7px 8px;
        font-size: 15px;
    }

    .preset-btn {
        padding: 5px 8px;
        font-size: 11px;
        min-width: 48px;
    }

    .confirm-raise-btn {
        padding: 9px;
        font-size: 12px;
    }

    .action-log {
        max-height: 35vh;
    }
}

/* Landscape mobile optimization */
@media (max-width: 768px) and (orientation: landscape) {
    .action-control-panel {
        max-height: 85vh;
        overflow-y: auto;
    }

    .raise-drawer {
        padding: 8px;
    }

    .raise-amount-bb {
        font-size: 20px;
    }

    .raise-presets {
        margin-bottom: 6px;
    }

    .confirm-raise-btn {
        padding: 8px;
        font-size: 12px;
    }
}


@media (max-width: 768px) {
    .back-action-btn {
        top: 4px;  /* 12px + 5px */
        left: 17px; /* 12px + 5px */
    }
}

/* Villain Profile Modal */
.villain-profile-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 10005; /* Must be above .hand-viewer-modal (10002) */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.villain-profile-content {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.villain-profile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--panel);
    z-index: 10;
}

.villain-profile-header h2 {
    margin: 0;
    color: var(--ink);
    font-size: 22px;
    font-weight: 700;
}

.profile-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    color: var(--muted);
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.profile-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--ink);
}

.villain-profile-body {
    padding: 24px;
}

/* Stats Grid */
.villain-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 32px;
}

.stat-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
}

.stat-label {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    font-weight: 600;
}

.stat-value {
    font-size: 24px;
    color: var(--ink);
    font-weight: 700;
}

.stat-value.won {
    color: #6bc49a;
}

.stat-value.lost {
    color: #ff6b6b;
}

/* Leaks Section */
.leaks-section {
    margin-bottom: 24px;
}

.section-title {
    font-size: 18px;
    color: var(--ink);
    margin: 0 0 16px 0;
    font-weight: 700;
}

.leak-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent2);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    transition: all 0.2s;
}

.leak-card:hover {
    background: rgba(255, 255, 255, 0.04);
    transform: translateX(4px);
}

.leak-card.leak-medium {
    border-left-color: #ffa726;
}

.leak-card.leak-low {
    border-left-color: #5096ff;
}

.leak-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.leak-emoji {
    font-size: 28px;
}

.leak-header h4 {
    margin: 0;
    color: var(--ink);
    font-size: 16px;
    font-weight: 700;
    flex: 1;
}

.leak-badge {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent2);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.leak-description {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
    margin: 0 0 12px 0;
}

.leak-recommendation {
    background: rgba(107, 196, 154, 0.1);
    border: 1px solid rgba(107, 196, 154, 0.2);
    border-radius: 8px;
    padding: 12px;
    font-size: 13px;
    color: var(--ink);
    line-height: 1.5;
}

.leak-recommendation strong {
    color: var(--accent2);
}

/* No Leaks Found */
.no-leaks-found {
    text-align: center;
    padding: 48px 24px;
}

.no-leaks-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.no-leaks-found h3 {
    color: var(--ink);
    margin: 0 0 12px 0;
    font-size: 20px;
}

.no-leaks-found p {
    color: var(--muted);
    margin: 8px 0;
    font-size: 14px;
}

/* Insufficient Data Notice */
.insufficient-data-notice {
    text-align: center;
    padding: 48px 24px;
}

.notice-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.insufficient-data-notice h3 {
    color: var(--ink);
    margin: 0 0 16px 0;
    font-size: 20px;
}

.insufficient-data-notice p {
    color: var(--muted);
    margin: 12px 0;
    font-size: 14px;
    line-height: 1.6;
}

.data-status {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    margin: 16px 0;
}

.help-text {
    font-size: 13px;
    font-style: italic;
    color: var(--accent2);
}

/* Leak Detection Info */
.leak-detection-info {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-top: 24px;
}

.leak-detection-info p {
    margin: 0 0 12px 0;
    color: var(--ink);
    font-size: 14px;
    font-weight: 600;
}

.leak-detection-info ul {
    margin: 0;
    padding-left: 20px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.8;
}

.leak-detection-info li {
    margin-bottom: 4px;
}

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

/* Villain Card Actions - Add to hand-history.css */

.villain-card {
    cursor: default; /* Remove pointer since we have buttons now */
}

.villain-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.view-hands-btn,
.analyze-leaks-btn {
    flex: 1;
    padding: 10px 12px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.view-hands-btn {
    background: rgba(80, 150, 255, 0.15);
    color: #5096ff;
    border: 1px solid rgba(80, 150, 255, 0.3);
}

.view-hands-btn:hover {
    background: rgba(80, 150, 255, 0.25);
    border-color: rgba(80, 150, 255, 0.5);
    transform: translateY(-1px);
}

.analyze-leaks-btn {
    background: rgba(107, 196, 154, 0.15);
    color: #6bc49a;
    border: 1px solid rgba(107, 196, 154, 0.3);
}

.analyze-leaks-btn:hover {
    background: rgba(107, 196, 154, 0.25);
    border-color: rgba(107, 196, 154, 0.5);
    transform: translateY(-1px);
}

/* Keep pills elongated; scroll instead of squishing on narrow screens */
.nav-pills-wrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 6px; /* room for iOS scroll bar */
}

/* Optional: hide scrollbar (keeps scroll behavior) */
.nav-pills-wrap::-webkit-scrollbar { height: 0; }

.nav-pills {
  display: flex;
  flex-wrap: nowrap;          /* never wrap into multiple lines */
  gap: 12px;
  width: max-content;         /* allows the row to be wider than the viewport */
  min-width: 100%;            /* but still fills when it can */
  align-items: center;
}

.nav-pill {
  flex: 0 0 auto;             /* critical: do not shrink */
  white-space: nowrap;        /* keep text to one line */
  min-width: max-content;     /* keep “Solution Library” elongated */
}
/* GIF pill: lock a stable box + render GIF without distortion */
.nav-pill.nav-gif-btn {
  flex: 0 0 auto;

  /* pick a stable pill footprint */
  height: 48px;
  width: 100px;
  min-width: 100px;

  padding: 0;
  box-sizing: border-box;
  overflow: hidden;          /* keeps the GIF inside rounded corners */

  display: inline-flex;
  align-items: center;
  justify-content: center;

  /* critical: avoid "smushed" background rendering */
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;  /* prevents distortion/cropping */
}
