:root {
    --night: #071512;
    --night-soft: #0b211c;
    --panel: rgba(15, 35, 30, 0.82);
    --panel-solid: #102b24;
    --line: rgba(236, 226, 196, 0.13);
    --line-strong: rgba(236, 226, 196, 0.25);
    --paper: #f8f4e9;
    --paper-soft: #e8e1d2;
    --muted: #9caea6;
    --gold: #e5bd6a;
    --gold-bright: #f0cf82;
    --felt: #0d5d49;
    --felt-dark: #073f32;
    --red: #d94d58;
    --green: #5ec998;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
    --radius: 22px;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
    margin: 0;
}

body {
    overflow-x: hidden;
    color: var(--paper);
    background:
        radial-gradient(circle at 50% -15%, rgba(43, 117, 87, 0.28), transparent 38rem),
        radial-gradient(circle at 0% 100%, rgba(229, 189, 106, 0.07), transparent 28rem),
        var(--night);
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.4;
}

button,
input {
    font: inherit;
}

button {
    border: 0;
}

button,
input {
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible {
    outline: 3px solid rgba(229, 189, 106, 0.45);
    outline-offset: 2px;
}

button:not(:disabled) {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
}

.hidden {
    display: none !important;
}

.screen {
    width: 100%;
    min-height: 100dvh;
}

.eyebrow {
    margin: 0;
    color: var(--gold);
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.brand-lockup {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--paper);
}

.brand-mark {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border: 1px solid rgba(229, 189, 106, 0.45);
    border-radius: 12px;
    color: var(--gold-bright);
    background: rgba(229, 189, 106, 0.09);
    font-family: Georgia, serif;
    font-size: 1.45rem;
    line-height: 1;
}

.brand-word {
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.19em;
}

/* Entry screen */
.login-screen {
    display: grid;
    place-items: center;
    padding: max(20px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
}

.login-card {
    position: relative;
    width: min(100%, 480px);
    overflow: hidden;
    padding: clamp(30px, 7vw, 58px);
    border: 1px solid var(--line);
    border-radius: 28px;
    background: linear-gradient(145deg, rgba(22, 54, 44, 0.96), rgba(8, 25, 21, 0.96));
    box-shadow: var(--shadow);
}

.login-card::before {
    position: absolute;
    top: -150px;
    right: -100px;
    width: 310px;
    height: 310px;
    border: 1px solid rgba(229, 189, 106, 0.12);
    border-radius: 50%;
    content: '';
    box-shadow: 0 0 0 28px rgba(229, 189, 106, 0.025), 0 0 0 58px rgba(229, 189, 106, 0.018);
}

.login-copy {
    position: relative;
    margin: clamp(48px, 9vw, 72px) 0 30px;
}

.login-copy h1 {
    margin: 8px 0 10px;
    color: var(--paper);
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: clamp(2.7rem, 9vw, 4.2rem);
    font-weight: 400;
    letter-spacing: -0.045em;
    line-height: 0.98;
}

.lobby-intro {
    max-width: 330px;
    margin: 0;
    color: var(--muted);
    font-size: 0.91rem;
}

.input-group {
    position: relative;
    z-index: 1;
}

.input-group label {
    display: block;
    margin: 0 0 8px 3px;
    color: var(--paper-soft);
    font-size: 0.75rem;
    font-weight: 700;
}

.name-entry {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 5px;
    border: 1px solid var(--line-strong);
    border-radius: 15px;
    background: rgba(3, 16, 13, 0.45);
    transition: border-color 180ms ease, box-shadow 180ms ease;
}

.name-entry:focus-within {
    border-color: rgba(229, 189, 106, 0.68);
    box-shadow: 0 0 0 4px rgba(229, 189, 106, 0.08);
}

#player-name {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    padding: 13px 12px;
    color: var(--paper);
    background: transparent;
    font-size: 0.95rem;
}

#player-name::placeholder {
    color: #81948b;
}

#enter-lobby-btn,
.primary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 48px;
    padding: 0 18px;
    border-radius: 11px;
    color: #14261e;
    background: var(--gold);
    font-weight: 800;
    transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

#enter-lobby-btn:hover:not(:disabled),
.primary-button:hover:not(:disabled) {
    background: var(--gold-bright);
    box-shadow: 0 8px 24px rgba(229, 189, 106, 0.2);
    transform: translateY(-1px);
}

#enter-lobby-btn span {
    font-size: 1.2rem;
    line-height: 0;
}

.login-hint {
    margin: 13px 2px 0;
    color: #80978d;
    font-size: 0.7rem;
}

.waiting-room {
    position: relative;
    z-index: 1;
    margin-top: 42px;
    padding-top: 25px;
    border-top: 1px solid var(--line);
}

.waiting-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.waiting-heading h2 {
    margin: 6px 0 0;
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: 2.2rem;
    font-weight: 400;
    line-height: 1;
}

.live-pill,
.table-pill,
.round-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    width: fit-content;
    padding: 7px 10px;
    border: 1px solid rgba(94, 201, 152, 0.22);
    border-radius: 999px;
    color: #b8dbc9;
    background: rgba(94, 201, 152, 0.08);
    font-size: 0.68rem;
    font-weight: 700;
}

.live-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 3px rgba(94, 201, 152, 0.11);
}

.lobby-status {
    margin: 10px 0 26px;
    color: var(--muted);
    font-size: 0.77rem;
}

.section-label {
    margin: 0 0 10px;
    color: #7f998c;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

#connected-players-list {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

#connected-players-list li {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 43px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--paper);
    background: rgba(255, 255, 255, 0.035);
    font-size: 0.82rem;
    font-weight: 700;
}

#connected-players-list li small {
    margin-left: auto;
    color: var(--gold);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.waiting-player-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
}

.waiting-message {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    padding: 12px 13px;
    border: 1px dashed rgba(229, 189, 106, 0.25);
    border-radius: 12px;
    color: var(--muted);
    background: rgba(229, 189, 106, 0.045);
    font-size: 0.78rem;
}

.waiting-message p {
    margin: 0;
}

.waiting-spinner {
    width: 15px;
    height: 15px;
    flex: 0 0 auto;
    border: 2px solid rgba(229, 189, 106, 0.22);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 900ms linear infinite;
}

.quiet-button,
.exit-button {
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--muted);
    background: transparent;
    font-size: 0.75rem;
    font-weight: 700;
    transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.quiet-button {
    width: 100%;
    margin-top: 17px;
}

.quiet-button:hover,
.exit-button:hover {
    border-color: var(--line-strong);
    color: var(--paper);
    background: rgba(255, 255, 255, 0.05);
}

/* Game shell */
.game-screen {
    background:
        radial-gradient(circle at 50% 10%, rgba(24, 86, 66, 0.22), transparent 34rem),
        var(--night);
}

.game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 66px;
    padding: max(12px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) 12px max(18px, env(safe-area-inset-left));
    border-bottom: 1px solid var(--line);
    background: rgba(6, 20, 16, 0.76);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.compact-brand .brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    font-size: 1.15rem;
}

.compact-brand .brand-word {
    font-size: 0.72rem;
}

.game-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.table-pill {
    padding: 7px 11px;
    color: var(--paper-soft);
    border-color: var(--line);
    background: rgba(255, 255, 255, 0.035);
}

.exit-button {
    min-height: 34px;
    color: #cba4a4;
}

.game-content {
    display: flex;
    width: min(100%, 1220px);
    min-height: calc(100dvh - 66px);
    flex-direction: column;
    gap: 14px;
    margin: 0 auto;
    padding: 18px clamp(12px, 3vw, 36px) max(16px, env(safe-area-inset-bottom));
}

.game-info {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    align-items: center;
    gap: 10px;
}

.table-stat {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    min-width: 0;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: rgba(15, 35, 30, 0.65);
}

.stat-label {
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.table-stat strong {
    color: var(--gold-bright);
    font-size: 1rem;
}

.round-pill {
    justify-self: end;
    border-color: var(--line);
    color: var(--muted);
    background: rgba(255, 255, 255, 0.035);
}

.table-container {
    display: flex;
    width: 100%;
    justify-content: center;
}

.table-rim {
    width: min(100%, 1060px);
    aspect-ratio: 1.68;
    padding: 10px;
    border: 1px solid rgba(229, 189, 106, 0.35);
    border-radius: 50% / 46%;
    background: linear-gradient(145deg, #61482d, #2d2117 52%, #6b4d2c);
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.35), inset 0 0 0 2px rgba(255, 255, 255, 0.08);
}

.poker-table {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border: 1px solid rgba(134, 226, 182, 0.36);
    border-radius: 50% / 46%;
    background:
        radial-gradient(ellipse at 50% 42%, rgba(60, 159, 116, 0.32), transparent 46%),
        radial-gradient(ellipse at 50% 110%, rgba(1, 35, 27, 0.65), transparent 59%),
        var(--felt);
    box-shadow: inset 0 0 60px rgba(0, 30, 22, 0.54), inset 0 0 0 8px rgba(0, 44, 33, 0.2);
}

.poker-table::before {
    position: absolute;
    inset: 11px;
    border: 1px solid rgba(229, 189, 106, 0.18);
    border-radius: inherit;
    content: '';
    pointer-events: none;
}

.table-sheen {
    position: absolute;
    inset: 0;
    opacity: 0.1;
    background-image: radial-gradient(rgba(255, 255, 255, 0.55) 0.6px, transparent 0.7px);
    background-size: 8px 8px;
    mix-blend-mode: soft-light;
    pointer-events: none;
}

.table-logo {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 7px;
    color: rgba(230, 246, 235, 0.2);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.poker-table:has(.community-cards:empty) .table-logo {
    opacity: 0;
}

.table-logo span {
    font-family: Georgia, serif;
    font-size: clamp(1.6rem, 4vw, 2.6rem);
}

.table-logo small {
    font-size: 0.56rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.community-zone {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 4;
    display: flex;
    width: min(75%, 540px);
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.community-label {
    color: rgba(235, 246, 238, 0.46);
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.2em;
}

.community-cards {
    display: flex;
    min-height: 74px;
    justify-content: center;
    gap: clamp(5px, 1vw, 10px);
}

.community-cards:empty::after {
    color: rgba(235, 246, 238, 0.22);
    content: 'Waiting for cards';
    font-size: 0.68rem;
    font-weight: 700;
}

#players-container {
    position: absolute;
    z-index: 10;
    inset: 0;
    pointer-events: none;
}

#opponents-rail {
    position: absolute;
    top: clamp(15px, 5%, 38px);
    right: clamp(18px, 5%, 54px);
    left: clamp(18px, 5%, 54px);
    display: flex;
    max-height: 40%;
    align-items: flex-start;
    justify-content: center;
    gap: 8px;
    overflow: auto;
    padding: 0 4px 4px;
    pointer-events: auto;
    scrollbar-width: thin;
}

#local-player-seat {
    position: absolute;
    bottom: clamp(12px, 5%, 32px);
    left: 50%;
    transform: translateX(-50%);
    pointer-events: auto;
}

.player {
    position: relative;
    display: grid;
    width: min(150px, 100%);
    min-width: 112px;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: 'identity chips' 'backs status';
    align-items: center;
    gap: 6px 9px;
    padding: 9px 10px;
    border: 1px solid rgba(228, 245, 235, 0.16);
    border-radius: 14px;
    color: var(--paper);
    background: rgba(5, 22, 17, 0.91);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.24);
    transition: border-color 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

.player.current-player {
    width: min(218px, calc(100vw - 48px));
    border-color: rgba(229, 189, 106, 0.7);
    background: rgba(10, 31, 24, 0.96);
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.3), 0 0 0 3px rgba(229, 189, 106, 0.08);
}

.player.active {
    border-color: var(--gold-bright);
    box-shadow: 0 0 0 3px rgba(229, 189, 106, 0.14), 0 12px 30px rgba(0, 0, 0, 0.35);
}

.player.active::after {
    position: absolute;
    top: -5px;
    right: 11px;
    width: 8px;
    height: 8px;
    border: 2px solid #0d5d49;
    border-radius: 50%;
    background: var(--gold-bright);
    content: '';
}

.player.folded,
.player.queued {
    opacity: 0.55;
}

.player.queued {
    border-style: dashed;
}

.player.all-in {
    border-color: rgba(217, 77, 88, 0.72);
}

.player-identity {
    display: flex;
    min-width: 0;
    grid-area: identity;
    align-items: center;
    gap: 7px;
}

.player-avatar {
    display: grid;
    width: 25px;
    height: 25px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid rgba(229, 189, 106, 0.4);
    border-radius: 8px;
    color: var(--gold-bright);
    background: rgba(229, 189, 106, 0.1);
    font-size: 0.57rem;
    font-weight: 800;
}

.player-name {
    min-width: 0;
    overflow: hidden;
    color: var(--paper);
    font-size: 0.72rem;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-chips {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    grid-area: chips;
    color: var(--gold-bright);
    font-size: 0.67rem;
    font-weight: 800;
}

.player-card-backs {
    display: flex;
    height: 20px;
    grid-area: backs;
    align-items: flex-end;
}

.mini-card-back {
    display: block;
    width: 15px;
    height: 21px;
    border: 1px solid rgba(248, 244, 233, 0.55);
    border-radius: 3px;
    background: repeating-linear-gradient(45deg, #173c4a 0 2px, #275f68 2px 4px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
}

.mini-card-back + .mini-card-back {
    margin-left: -6px;
    transform: translateY(-2px) rotate(8deg);
}

.player-status {
    justify-self: end;
    grid-area: status;
    color: #a7c6b7;
    font-size: 0.52rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.player.queued .player-status {
    color: var(--gold);
}

.dealer-button,
.blind-indicator {
    position: absolute;
    top: -9px;
    display: grid;
    width: 22px;
    height: 22px;
    place-items: center;
    border: 2px solid #0d5d49;
    border-radius: 50%;
    color: #10261d;
    font-size: 0.48rem;
    font-weight: 900;
}

.dealer-button {
    right: -6px;
    background: var(--gold-bright);
}

.blind-indicator {
    left: -6px;
}

.small-blind {
    background: #8bc9d4;
}

.big-blind {
    background: #ed8d7c;
}

/* Cards */
.card {
    position: relative;
    width: clamp(48px, 6.2vw, 76px);
    aspect-ratio: 0.69;
    flex: 0 0 auto;
    overflow: hidden;
    border: 1px solid rgba(35, 48, 39, 0.22);
    border-radius: 10px;
    color: var(--card-ink, #1e2823);
    background: linear-gradient(145deg, #fffdf7 0%, #f5eee1 100%);
    box-shadow: 0 9px 17px rgba(0, 0, 0, 0.22), 0 1px 0 rgba(255, 255, 255, 0.8) inset;
    font-family: Georgia, 'Times New Roman', serif;
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.card::before {
    position: absolute;
    inset: 4px;
    border: 1px solid rgba(34, 48, 39, 0.12);
    border-radius: 7px;
    content: '';
    pointer-events: none;
}

.card:hover {
    z-index: 2;
    box-shadow: 0 13px 22px rgba(0, 0, 0, 0.26);
    transform: translateY(-3px);
}

.card.red {
    --card-ink: #c73d4a;
}

.card.black {
    --card-ink: #1f3129;
}

.card-corner {
    position: absolute;
    top: 8px;
    left: 9px;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 0.9;
}

.card-corner .value {
    font-size: clamp(0.95rem, 2vw, 1.25rem);
    font-weight: 700;
}

.card-corner .suit {
    margin-top: 3px;
    font-size: clamp(0.65rem, 1.4vw, 0.82rem);
}

.bottom-corner {
    top: auto;
    right: 9px;
    bottom: 8px;
    left: auto;
    transform: rotate(180deg);
}

.center-suit {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 1;
    color: var(--card-ink);
    font-size: clamp(1.7rem, 3.8vw, 2.8rem);
    transform: translate(-50%, -50%);
}

.player-cards {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.player-cards .card {
    width: clamp(62px, 7vw, 83px);
}

/* Chips */
.chip-stack {
    position: relative;
    display: inline-block;
    width: 30px;
    height: 24px;
    flex: 0 0 auto;
}

.chip-stack i {
    position: absolute;
    display: block;
    width: 22px;
    height: 22px;
    border: 2px dashed rgba(255, 248, 219, 0.9);
    border-radius: 50%;
    background: repeating-conic-gradient(#d94d58 0 12deg, #f3d27f 12deg 24deg);
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.35);
}

.chip-stack i:nth-child(1) { left: 0; top: 0; }
.chip-stack i:nth-child(2) { left: 4px; top: -3px; background: repeating-conic-gradient(#3c9e7c 0 12deg, #eac66f 12deg 24deg); }
.chip-stack i:nth-child(3) { left: 8px; top: -6px; background: repeating-conic-gradient(#356a9c 0 12deg, #f5d88d 12deg 24deg); }

.chip-stack-tiny {
    width: 23px;
    height: 17px;
    transform: scale(0.72);
    transform-origin: right center;
}

.chip-stack-tiny i {
    width: 17px;
    height: 17px;
    border-width: 1px;
}

.chip-stack-tiny i:nth-child(2) { left: 3px; top: -2px; }
.chip-stack-tiny i:nth-child(3) { left: 6px; top: -4px; }

.chip-stack-small {
    width: 34px;
    height: 27px;
}

.chips-display {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--gold-bright);
}

.stack-copy {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.stack-copy small {
    color: var(--muted);
    font-size: 0.57rem;
    font-weight: 800;
    letter-spacing: 0.14em;
}

.stack-copy strong {
    font-size: 0.96rem;
}

/* Player controls */
.game-message {
    min-height: 19px;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 700;
    text-align: center;
}

.player-controls {
    display: grid;
    grid-template-columns: minmax(190px, 0.62fr) minmax(0, 1.38fr);
    gap: 22px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(145deg, rgba(18, 48, 38, 0.93), rgba(9, 27, 22, 0.93));
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.22);
}

.player-info {
    display: flex;
    min-width: 0;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
    padding: 0 8px;
    border-right: 1px solid var(--line);
}

.hand-heading,
.action-heading {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hand-rule {
    height: 1px;
    flex: 1;
    background: var(--line);
}

.action-heading {
    justify-content: space-between;
    margin-bottom: 8px;
}

.action-hint {
    color: var(--muted);
    font-size: 0.68rem;
}

.actions-container {
    min-width: 0;
}

.player-controls.waiting-turn .actions-container {
    opacity: 0.58;
}

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

.action-btn {
    min-height: 43px;
    padding: 0 10px;
    border: 1px solid transparent;
    border-radius: 11px;
    color: var(--paper);
    font-size: 0.75rem;
    font-weight: 800;
    transition: filter 160ms ease, transform 160ms ease, opacity 160ms ease;
}

.action-btn:hover:not(:disabled) {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.action-fold { background: rgba(176, 56, 69, 0.88); }
.action-check { background: rgba(45, 124, 97, 0.9); }
.action-call { background: rgba(52, 121, 151, 0.9); }
.action-all-in,
.action-raise { color: #17271e; background: var(--gold); }

.action-btn:disabled {
    opacity: 0.35;
    filter: grayscale(0.4);
}

.bet-container {
    margin-top: 10px;
}

.bet-input-container {
    display: grid;
    grid-template-columns: auto minmax(80px, 1fr) auto;
    align-items: center;
    gap: 8px;
}

.bet-input-container label {
    color: var(--paper-soft);
    font-size: 0.72rem;
    font-weight: 700;
}

.bet-field {
    display: flex;
    min-width: 0;
    align-items: center;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.18);
}

#bet-input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    padding: 10px 10px;
    color: var(--paper);
    background: transparent;
    font-size: 0.78rem;
    font-weight: 800;
    text-align: right;
}

#bet-input::-webkit-inner-spin-button,
#bet-input::-webkit-outer-spin-button {
    margin: 0;
    appearance: none;
}

.bet-unit {
    padding-right: 9px;
    color: var(--muted);
    font-size: 0.62rem;
}

.action-raise {
    min-height: 40px;
    padding: 0 14px;
}

.bet-range {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    color: var(--muted);
    font-size: 0.61rem;
}

/* Result screen and transient messages */
.game-over-screen {
    display: grid;
    place-items: center;
    padding: 22px;
}

.game-over-container {
    width: min(100%, 540px);
    padding: 42px 28px;
    border: 1px solid var(--line);
    border-radius: 26px;
    background: linear-gradient(145deg, rgba(22, 54, 44, 0.96), rgba(8, 25, 21, 0.96));
    box-shadow: var(--shadow);
    text-align: center;
}

.result-mark {
    display: grid;
    width: 58px;
    height: 58px;
    margin: 0 auto 20px;
    place-items: center;
    border: 1px solid rgba(229, 189, 106, 0.4);
    border-radius: 18px;
    color: var(--gold-bright);
    background: rgba(229, 189, 106, 0.1);
    font-family: Georgia, serif;
    font-size: 2rem;
}

.game-over-container h2 {
    margin: 6px 0 20px;
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: 2.7rem;
    font-weight: 400;
}

#game-result {
    margin-bottom: 25px;
    color: var(--paper-soft);
    font-size: 0.86rem;
}

#game-result p {
    margin: 7px 0;
}

#game-result strong {
    color: var(--gold-bright);
}

#game-result ul {
    margin: 12px 0 0;
    padding: 12px 0 0;
    border-top: 1px solid var(--line);
    list-style: none;
    text-align: left;
}

.message-popup,
.error-popup {
    position: fixed;
    top: max(16px, env(safe-area-inset-top));
    left: 50%;
    z-index: 1000;
    width: min(calc(100% - 28px), 420px);
    padding: 12px 16px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    color: var(--paper);
    background: rgba(9, 28, 22, 0.97);
    box-shadow: var(--shadow);
    opacity: 0;
    text-align: center;
    transform: translate(-50%, -18px);
    transition: opacity 180ms ease, transform 180ms ease;
    pointer-events: none;
}

.error-popup {
    border-color: rgba(217, 77, 88, 0.55);
    color: #ffdfe0;
    background: rgba(91, 27, 36, 0.96);
}

.message-popup.visible,
.error-popup.visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive table and controls */
@media (max-width: 760px) {
    .game-header {
        min-height: 58px;
    }

    .game-content {
        min-height: calc(100dvh - 59px);
        gap: 10px;
        padding-top: 12px;
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }

    .game-info {
        grid-template-columns: 1fr 1fr;
        gap: 7px;
    }

    .round-pill {
        grid-column: 1 / -1;
        justify-self: stretch;
        justify-content: center;
    }

    .table-rim {
        height: clamp(245px, 35dvh, 350px);
        aspect-ratio: auto;
        padding: 7px;
        border-radius: 38% / 43%;
    }

    .poker-table {
        border-radius: 35% / 42%;
    }

    .community-zone {
        width: 86%;
        gap: 5px;
    }

    .community-label {
        font-size: 0.5rem;
    }

    .community-cards {
        min-height: 56px;
    }

    .community-cards .card {
        width: clamp(39px, 12vw, 60px);
        border-radius: 7px;
    }

    #opponents-rail {
        top: 12px;
        right: 12px;
        left: 12px;
        max-height: 37%;
        gap: 6px;
    }

    .player {
        min-width: 96px;
        padding: 7px 8px;
        border-radius: 11px;
        gap: 4px 6px;
    }

    .player.current-player {
        width: min(210px, calc(100vw - 42px));
    }

    .player-name {
        font-size: 0.65rem;
    }

    .player-chips {
        font-size: 0.59rem;
    }

    .player-avatar {
        width: 22px;
        height: 22px;
        border-radius: 7px;
        font-size: 0.5rem;
    }

    .player-status {
        font-size: 0.46rem;
    }

    .player-controls {
        grid-template-columns: 1fr;
        gap: 14px;
        padding: 14px;
        border-radius: 18px;
    }

    .player-info {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 8px 14px;
        padding: 0 0 12px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .hand-heading {
        grid-column: 1 / -1;
    }

    .player-cards {
        justify-content: flex-start;
    }

    .player-cards .card {
        width: clamp(56px, 16vw, 72px);
    }

    .chips-display {
        justify-self: end;
    }

    .action-buttons {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 430px) {
    .login-card {
        padding: 26px 20px;
        border-radius: 22px;
    }

    .login-copy {
        margin-top: 42px;
    }

    .login-copy h1 {
        font-size: 3rem;
    }

    .game-header {
        padding-right: 12px;
        padding-left: 12px;
    }

    .brand-word {
        letter-spacing: 0.12em;
    }

    .table-pill {
        padding: 6px 8px;
        font-size: 0.6rem;
    }

    .exit-button {
        padding: 0 9px;
        font-size: 0.68rem;
    }

    .table-stat {
        padding: 9px 11px;
    }

    .stat-label {
        font-size: 0.59rem;
    }

    .table-stat strong {
        font-size: 0.86rem;
    }

    .table-rim {
        height: clamp(225px, 31dvh, 285px);
    }

    #opponents-rail {
        right: 7px;
        left: 7px;
        padding-right: 0;
        padding-left: 0;
    }

    .player {
        min-width: 88px;
        padding: 6px;
    }

    .player.current-player {
        width: min(190px, calc(100vw - 34px));
    }

    .player-card-backs {
        display: none;
    }

    .community-cards .card {
        width: 37px;
    }

    .card-corner {
        top: 6px;
        left: 6px;
    }

    .bottom-corner {
        right: 6px;
        bottom: 6px;
    }

    .player-cards .card {
        width: 54px;
    }

    .bet-input-container {
        grid-template-columns: 1fr 1fr;
    }

    .bet-input-container label {
        grid-column: 1 / -1;
    }

    .bet-field,
    .action-raise {
        min-height: 40px;
    }

    .action-raise {
        padding: 0 9px;
    }
}

@media (max-width: 760px) and (max-height: 680px) {
    .game-content {
        gap: 7px;
        padding-top: 8px;
    }

    .table-rim {
        height: 210px;
    }

    .player-controls {
        padding: 10px 12px;
    }

    .action-btn {
        min-height: 37px;
    }
}
