@font-face {
    font-family: 'PrintChar21';
    src: url('./pr/PrintChar21.ttf') format('truetype');
}

@font-face {
    font-family: 'PRNumber3';
    src: url('./pr/PRNumber3.ttf') format('truetype');
}

body, html {
    min-height: 100%;
    margin: 0;
    padding: 0;
    background:
        radial-gradient(circle at top, rgba(30, 122, 78, 0.5), transparent 35%),
        linear-gradient(180deg, #03110d 0%, #041d16 55%, #020907 100%);
    font-size: 9px;
    color: #d9f6ef;
    font-family: 'PrintChar21', monospace;
}

body {
    overflow-x: hidden;
    overflow-y: auto;
}

button,
input {
    font: inherit;
}

.table-shell {
    width: min(100%, 1380px);
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
    margin: 0 auto;
}

.table {
    width: min(100%, 1220px);
    min-height: 760px;
    border-radius: 28px;
    padding: 24px;
    box-sizing: border-box;
    background:
        linear-gradient(135deg, rgba(7, 58, 39, 0.95), rgba(3, 34, 23, 0.98)),
        #072d20;
    border: 2px solid rgba(202, 168, 91, 0.85);
    box-shadow:
        0 24px 60px rgba(0, 0, 0, 0.5),
        inset 0 0 0 2px rgba(255, 255, 255, 0.04);
    display: grid;
    grid-template-rows: auto auto 1fr;
    gap: 16px;
}

.topbar,
.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.seat-heading {
    display: flex;
    align-items: center;
    gap: 12px;
}

.kicker,
.label,
.chip-display span {
    margin: 0 0 6px;
    color: #b4d7cd;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin: 0;
}

h1 {
    font-size: clamp(3rem, 4vw, 4.6rem);
    color: #fff2c5;
}

.chip-display,
.seat,
.controls,
.control-panel {
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.chip-display {
    padding: 14px 18px 12px;
    min-width: 180px;
    text-align: right;
}

.chip-display strong {
    font-family: 'PRNumber3', monospace;
    font-size: 3.8rem;
    color: #ffe79b;
}

.control-panel {
    padding: 14px 18px 16px;
    display: grid;
    gap: 12px;
}

.status-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.status-message {
    font-size: 1.5rem;
    line-height: 1.1;
    color: #f4f0df;
    max-width: 780px;
}

.status-copy {
    display: grid;
    gap: 7px;
}

.bet-controls {
    display: grid;
    gap: 8px;
    justify-items: end;
}

.bet-controls label {
    color: #fff2c5;
    text-transform: uppercase;
    letter-spacing: 0.18em;
}

.bet-controls input {
    width: 140px;
    padding: 8px 10px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(4, 18, 13, 0.85);
    color: #fff4ca;
    font-size: 1.6rem;
    text-align: right;
}

.board {
    display: grid;
    gap: 14px;
}

.seat {
    padding: 16px;
}

.dealer-seat {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.025)),
        rgba(255, 255, 255, 0.04);
}

.last-result-message {
    min-height: 2.6rem;
    max-width: 820px;
    padding: 7px 11px 6px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(4, 18, 13, 0.55);
    color: #b4d7cd;
    font-size: 1.35rem;
    line-height: 1.15;
}

.human-result.win {
    color: #ffe79b;
}

.human-result.loss {
    color: #ff8d98;
}

.human-result.push {
    color: #d9f6ef;
}

.npc-results {
    color: #b4d7cd;
}

.players-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.player-seat {
    padding: 18px;
    border-color: rgba(245, 211, 109, 0.55);
    background:
        linear-gradient(180deg, rgba(245, 211, 109, 0.06), rgba(255, 255, 255, 0.02)),
        rgba(255, 255, 255, 0.04);
}

.npc-seat {
    padding: 14px;
}

.seat-info-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    color: #d1e7da;
    font-size: 1.25rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.info-spacer {
    margin-left: auto;
}

.seat-name {
    color: #fff8dd;
    font-size: 1.8rem;
    letter-spacing: 0.04em;
    text-transform: none;
}

.seat-note {
    color: #b8dbc8;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1;
}

.inline-note {
    color: #9bd3bc;
}

.seat-info-row strong {
    font-family: 'PRNumber3', monospace;
    font-size: 1.8rem;
    color: #ffe79b;
    letter-spacing: normal;
    text-transform: none;
}

.player-info-row {
    color: #f3e9c7;
}

.player-info-row strong:last-child {
    color: #89ffd1;
}

.npc-info-row {
    color: #c8ddd3;
}

.score {
    font-family: 'PRNumber3', monospace;
    font-size: 2.2rem;
    color: #89ffd1;
    line-height: 1;
}

.edge-score {
    margin-left: auto;
}

.hand {
    min-height: 110px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-start;
    padding-top: 12px;
}

.split-hand {
    margin-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.hidden-hand {
    display: none;
}

.hand.compact {
    min-height: 80px;
    gap: 8px;
    flex-wrap: nowrap;
    overflow: hidden;
}

.card {
    width: 84px;
    height: 118px;
    border-radius: 14px;
    padding: 10px;
    box-sizing: border-box;
    background: linear-gradient(180deg, #fffef8, #eadfc8);
    color: #161616;
    border: 2px solid rgba(0, 0, 0, 0.15);
    display: grid;
    grid-template-rows: auto 1fr auto;
    box-shadow: 0 8px 14px rgba(0, 0, 0, 0.18);
}

.hand.compact .card {
    width: 60px;
    height: 86px;
    padding: 6px;
    border-radius: 12px;
    margin-right: -18px;
}

.hand.compact .card:last-child {
    margin-right: 0;
}

.card.red {
    color: #a5182b;
}

.card.hidden {
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent),
        repeating-linear-gradient(
            45deg,
            #123724,
            #123724 8px,
            #28563c 8px,
            #28563c 16px
        );
    color: #eefdee;
}

.card-corner,
.card-suit {
    font-size: 1.6rem;
}

.card-rank-center {
    display: grid;
    place-items: center;
    font-size: 3.2rem;
}

.hand.compact .card-corner,
.hand.compact .card-suit {
    font-size: 1.1rem;
}

.hand.compact .card-rank-center {
    font-size: 2rem;
}

.controls {
    padding: 0;
    justify-content: center;
    flex-wrap: wrap;
    border: 0;
    background: transparent;
}

.controls button {
    min-width: 140px;
    padding: 10px 14px 8px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    color: #f5f0db;
    font-size: 1.5rem;
    cursor: pointer;
    transition: transform 120ms ease, background 120ms ease, opacity 120ms ease;
}

.controls button:hover:enabled {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.12);
}

.controls button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.controls .primary {
    background: linear-gradient(180deg, #f5d36d, #c69a2e);
    color: #232010;
    border-color: rgba(0, 0, 0, 0.22);
}

.controls .primary.auto-running {
    background: linear-gradient(180deg, #9f2636, #5f1422);
    color: #fff4df;
    border-color: rgba(255, 225, 165, 0.45);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.08),
        0 0 14px rgba(217, 55, 77, 0.2);
}

.controls button.playable-action {
    border-color: rgba(255, 224, 132, 0.72);
    box-shadow:
        0 0 0 1px rgba(255, 224, 132, 0.18),
        0 0 14px rgba(255, 210, 92, 0.22);
    animation: action-pulse 1.35s ease-in-out infinite;
}

.controls button.playable-action:not(.primary) {
    background:
        linear-gradient(180deg, rgba(137, 255, 209, 0.16), rgba(255, 255, 255, 0.07)),
        rgba(255, 255, 255, 0.06);
    color: #fff8dd;
}

.controls .ghost {
    background: rgba(105, 19, 32, 0.3);
}

@keyframes action-pulse {
    0%,
    100% {
        box-shadow:
            0 0 0 1px rgba(255, 224, 132, 0.16),
            0 0 12px rgba(255, 210, 92, 0.18);
        transform: translateY(0);
    }

    50% {
        box-shadow:
            0 0 0 1px rgba(255, 224, 132, 0.38),
            0 0 20px rgba(255, 210, 92, 0.36);
        transform: translateY(-1px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .controls button.playable-action {
        animation: none;
    }
}

@media (max-width: 820px) {
    .table-shell {
        padding: 12px;
    }

    .table {
        padding: 18px;
        min-height: auto;
    }

    .topbar,
    .status-panel {
        align-items: flex-start;
        flex-direction: column;
    }

    .players-grid {
        grid-template-columns: 1fr;
    }

    .chip-display,
    .bet-controls {
        width: 100%;
        text-align: left;
        justify-items: start;
    }

    .status-message {
        font-size: 1.6rem;
    }

    .controls button {
        width: 100%;
    }

    .card {
        width: 76px;
        height: 106px;
    }

    .card-rank-center {
        font-size: 2.8rem;
    }

    .hand.compact .card {
        width: 56px;
        height: 80px;
        margin-right: -12px;
    }
}
