/* ── K-Life Casino Poker ───────────────────────────────────────────────── */

#poker-overlay {
    z-index: 10040;
    align-items: stretch;
    justify-content: center;
    padding: 8px;
    background: rgba(4, 8, 16, 0.78);
    backdrop-filter: blur(10px);
}
#poker-overlay.show { display: flex; overflow: hidden !important; }
.poker-exit-layer { position:absolute; z-index:220; inset:0; display:none; place-items:center; padding:18px; background:rgba(5,3,8,.82); backdrop-filter:blur(12px); }
.poker-exit-layer.show { display:grid; animation:poker-exit-backdrop-in 200ms ease both; }
.poker-exit-dialog { width:min(470px,100%); padding:clamp(22px,4vw,32px); border:1px solid rgba(248,113,113,.42); border-radius:24px; background:radial-gradient(circle at 88% 0,rgba(239,68,68,.18),transparent 34%),#160d14; box-shadow:0 30px 90px rgba(0,0,0,.7); text-align:center; animation:poker-exit-dialog-in 420ms cubic-bezier(.16,1,.3,1) both; }
.poker-exit-dialog__mark { width:48px; height:48px; display:grid; place-items:center; margin:0 auto 14px; border-radius:50%; background:rgba(239,68,68,.16); border:1px solid rgba(248,113,113,.48); color:#fca5a5; font-size:1.35rem; font-weight:950; }
.poker-exit-dialog h3 { margin:0; color:#fff; font-size:clamp(1.18rem,4vw,1.6rem); }
.poker-exit-dialog p { margin:10px 0 0; color:#b9a9b2; line-height:1.55; }
.poker-exit-dialog > strong { display:block; margin:16px 0 0; padding:11px 13px; border-radius:13px; background:rgba(239,68,68,.1); color:#fecaca; font-size:.82rem; }
.poker-exit-dialog__actions { display:grid; grid-template-columns:1fr 1.2fr; gap:9px; margin-top:20px; }
.poker-exit-dialog__actions button { min-height:47px; border-radius:13px; font:inherit; font-size:.78rem; font-weight:900; cursor:pointer; }
.poker-exit-stay { border:1px solid rgba(255,255,255,.14); background:rgba(255,255,255,.055); color:#e5e7eb; }
.poker-exit-confirm { border:0; background:linear-gradient(135deg,#ef4444,#b91c1c); color:#fff; }
@keyframes poker-exit-backdrop-in { from { opacity:0; } }
@keyframes poker-exit-dialog-in { from { opacity:0; transform:translateY(22px) scale(.94); filter:blur(7px); } }
@media (max-width:520px) { .poker-exit-layer { padding:0; align-items:end; }.poker-exit-dialog { width:100%; border-radius:24px 24px 0 0; padding-bottom:max(24px,env(safe-area-inset-bottom)); }.poker-exit-dialog__actions { grid-template-columns:1fr; } }
@media (prefers-reduced-motion:reduce) { .poker-exit-layer,.poker-exit-dialog { animation:none !important; } }

.poker-panel {
    width: min(960px, 100%);
    height: min(96dvh, 900px);
    max-height: min(96dvh, 900px);
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px 12px;
    border-radius: 20px;
    overflow: hidden;
    background:
        radial-gradient(ellipse 80% 50% at 50% 0%, rgba(16, 185, 129, 0.12), transparent 55%),
        linear-gradient(165deg, rgba(12, 22, 36, 0.97), rgba(8, 14, 24, 0.98));
    border: 1px solid rgba(251, 191, 36, 0.2);
    box-shadow:
        0 24px 60px rgba(0, 0, 0, 0.55),
        0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    animation: poker-panel-in 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes poker-panel-in {
    from { opacity: 0; transform: translateY(16px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.poker-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.poker-header__title {
    flex: 1;
    min-width: 0;
}
.poker-header__title h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
    color: #fef3c7;
    letter-spacing: 0.02em;
}
.poker-header__title p {
    margin: 2px 0 0;
    font-size: 0.72rem;
    color: #94a3b8;
}
.poker-header__chip {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: contain;
    filter: drop-shadow(0 3px 7px rgba(0, 0, 0, 0.45));
}

.poker-howto {
    margin: 0;
    font-size: 0.7rem;
    color: #86efac;
    opacity: 0.92;
    line-height: 1.35;
    flex-shrink: 0;
}
.poker-message-lane {
    min-height: 0;
    max-height: 0;
    overflow: hidden;
    flex-shrink: 0;
    padding: 0 12px;
    border-radius: 10px;
    color: #dbeafe;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1.3;
    text-align: center;
    opacity: 0;
    transform: translateY(-4px);
    transition: max-height .22s ease, padding .22s ease, opacity .18s ease, transform .22s ease;
}
.poker-message-lane.is-visible {
    max-height: 54px;
    padding: 7px 12px;
    opacity: 1;
    transform: none;
    border: 1px solid rgba(255,255,255,.1);
    background: rgba(15, 23, 42, .92);
}
.poker-message-lane.is-success { color: #fef3c7; border-color: rgba(251,191,36,.36); background: linear-gradient(90deg, rgba(6,78,59,.94), rgba(30,41,59,.94)); }

/* Table */
.poker-table-wrap {
    position: relative;
    flex: 1;
    min-height: 320px;
    border-radius: 18px;
    overflow: hidden;
    border: 2px solid rgba(16, 185, 129, 0.28);
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.35);
    container-type: size;
}
#poker-table-root {
    width: 100%;
    height: 100%;
}
.poker-felt {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 100%;
    background:
        radial-gradient(ellipse 70% 55% at 50% 48%, rgba(34, 120, 70, 0.25), transparent 70%),
        url('../assets/poker/table_felt.jpg?v=2') center / cover no-repeat,
        #0b3d2e;
}
.poker-felt__glow {
    pointer-events: none;
    position: absolute;
    inset: 8%;
    border-radius: 50%;
    border: 2px solid rgba(251, 191, 36, 0.14);
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.28);
}

/* Seats — 4 positions */
.poker-seat {
    position: absolute;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-width: 124px;
    transition: transform 0.25s ease, filter 0.25s ease, opacity 0.3s ease;
}
.poker-seat--0 { bottom: 1.5%; left: 50%; transform: translateX(-50%); } /* you */
.poker-seat--1 { left: 2%; top: 31%; align-items: flex-start; }          /* bot left */
.poker-seat--2 { top: 1.5%; left: 50%; transform: translateX(-50%); }   /* bot top */
.poker-seat--3 { right: 2%; top: 31%; align-items: flex-end; }           /* bot right */

.poker-seat.is-folded { opacity: 0.4; filter: grayscale(0.55); }
.poker-seat.is-turn { z-index: 5; }
.poker-seat.is-turn .poker-seat__meta {
    box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.9), 0 0 20px rgba(251, 191, 36, 0.4);
    animation: poker-turn-pulse 1.2s ease-in-out infinite;
}
.poker-seat.is-winner .poker-seat__meta {
    box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.95), 0 0 22px rgba(52, 211, 153, 0.45);
}
.poker-seat.is-winner .poker-seat__cards {
    animation: poker-winner-bounce 0.55s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}
@keyframes poker-turn-pulse {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.15); }
}
@keyframes poker-winner-bounce {
    0% { transform: scale(0.92); }
    55% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

.poker-seat__meta {
    position: relative;
    z-index: 6;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px 5px 5px;
    border-radius: 999px;
    background: rgba(8, 12, 20, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    max-width: 160px;
}
.poker-seat.is-you .poker-seat__meta {
    border-color: rgba(251, 191, 36, 0.35);
    background: rgba(30, 22, 8, 0.82);
}
.poker-seat__avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #132638;
    border: 1px solid rgba(255, 255, 255, 0.12);
    flex-shrink: 0;
}
.poker-seat__avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.poker-seat__stack, .poker-seat__bet, .poker-pot__val { display: flex; align-items: center; justify-content: center; gap: 4px; }
.poker-seat__stack img, .poker-seat__bet img, .poker-pot__val img { width: 14px; height: 14px; object-fit: contain; }
.poker-seat__info { min-width: 0; }
.poker-seat__name {
    font-size: 0.72rem;
    font-weight: 800;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
}
.poker-seat.is-you .poker-seat__name { color: #fde68a; }
.poker-seat__stack {
    font-size: 0.65rem;
    font-weight: 700;
    color: #fbbf24;
    font-variant-numeric: tabular-nums;
}
.poker-dealer-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #f8fafc;
    color: #0f172a;
    font-size: 0.55rem;
    font-weight: 900;
    vertical-align: middle;
    margin-left: 3px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.poker-seat__cards {
    position: relative;
    z-index: 2;
    display: flex;
    gap: 5px;
    justify-content: center;
    min-height: 74px;
}
.poker-seat--1 .poker-seat__cards,
.poker-seat--3 .poker-seat__cards {
    transform: none;
}

.poker-seat__status-row {
    position: relative;
    z-index: 8;
    min-height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}
.poker-seat--1 .poker-seat__status-row { justify-content: flex-start; }
.poker-seat--3 .poker-seat__status-row { justify-content: flex-end; }
.poker-seat__bet {
    position: relative;
    z-index: 1;
    min-height: 18px;
    font-size: 0.68rem;
    font-weight: 800;
    color: #fde68a;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.poker-seat__bet.is-on {
    opacity: 1;
    transform: translateY(0);
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(251, 191, 36, 0.3);
}
.poker-seat__action {
    position: relative;
    min-width: 46px;
    max-width: 104px;
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(241, 245, 249, 0.96);
    color: #162033;
    font-size: 0.58rem;
    line-height: 1.15;
    font-weight: 900;
    text-align: center;
    box-shadow: 0 5px 14px rgba(0,0,0,.28);
    opacity: 0;
    transform: scale(.92);
    pointer-events: none;
    transition: opacity .18s ease, transform .22s cubic-bezier(.22,1,.36,1);
    z-index: 2;
    isolation: isolate;
}
.poker-seat__action.is-visible { opacity: 1; transform: scale(1); }
.poker-seat__action span { position: relative; z-index: 2; }
.poker-seat__action::after { display: none; }

/* Center */
.poker-center {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 4;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: min(92%, 440px);
}
.poker-deck-stack {
    position: absolute;
    left: -56px;
    top: 10px;
    width: 48px;
    height: 68px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.45));
}
.poker-deck-card {
    position: absolute;
    inset: 0;
    border-radius: 7px;
    background:
        url('../assets/poker/card_back.jpg?v=2') center / cover no-repeat,
        #0f3d2e;
    border: 1px solid rgba(251, 191, 36, 0.4);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
.poker-deck-card:nth-child(1) { transform: translate(0, 0) rotate(-5deg); }
.poker-deck-card:nth-child(2) { transform: translate(1px, -1px) rotate(-2deg); }
.poker-deck-card:nth-child(3) { transform: translate(2px, -2px) rotate(1deg); }
.poker-deck-card--top {
    transform: translate(3px, -3px) rotate(0deg) !important;
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.5);
    animation: poker-deck-idle 2.4s ease-in-out infinite;
}
@keyframes poker-deck-idle {
    0%, 100% { transform: translate(3px, -3px) rotate(0deg); }
    50% { transform: translate(3px, -5px) rotate(1deg); }
}

.poker-pot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 16px;
    border-radius: 14px;
    background: rgba(8, 12, 20, 0.75);
    border: 1px solid rgba(251, 191, 36, 0.3);
    backdrop-filter: blur(6px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}
.poker-pot__ico {
    width: 34px;
    height: 34px;
    object-fit: contain;
    filter: drop-shadow(0 3px 5px rgba(0,0,0,.38));
}
.poker-pot__label {
    font-size: 0.58rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.poker-pot__val {
    font-size: 0.98rem;
    font-weight: 900;
    color: #fde68a;
    font-variant-numeric: tabular-nums;
}

.poker-board {
    display: flex;
    gap: 6px;
    justify-content: center;
    min-height: 78px;
    padding: 6px 10px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.22);
    border: 1px dashed rgba(255, 255, 255, 0.12);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.2);
}
.poker-phase-tag {
    font-size: 0.7rem;
    font-weight: 800;
    color: #a7f3d0;
    letter-spacing: 0.05em;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.55);
    padding: 2px 10px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(167, 243, 208, 0.15);
}

/* Cards */
.poker-card-slot {
    width: 54px;
    height: 76px;
    position: relative;
    perspective: 700px;
}
.poker-card-slot.is-empty {
    border-radius: 8px;
    border: 1.5px dashed rgba(255, 255, 255, 0.14);
    background: rgba(0, 0, 0, 0.14);
}
.poker-card {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.42);
}
.poker-card__inner {
    width: 100%;
    height: 100%;
    border-radius: inherit;
    position: relative;
    overflow: hidden;
}
.poker-card--face .poker-card__inner {
    background:
        radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.9), transparent 45%),
        linear-gradient(160deg, #fffefb 0%, #f7f1e4 50%, #ebe3d2 100%);
    border: 1.5px solid rgba(40, 28, 12, 0.2);
}
.poker-card--face.is-red { color: #dc2626; }
.poker-card--face.is-black { color: #0f172a; }
.poker-card__corner {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
    font-weight: 900;
    font-family: 'Outfit', 'Nunito', system-ui, sans-serif;
}
.poker-card__corner--tl { top: 4px; left: 5px; }
.poker-card__corner--br { bottom: 4px; right: 5px; transform: rotate(180deg); }
.poker-card__rank { font-size: 0.78rem; letter-spacing: -0.02em; }
.poker-card__suit { font-size: 0.68rem; margin-top: 1px; }
.poker-card__pip {
    position: absolute;
    left: 50%;
    top: 52%;
    transform: translate(-50%, -50%);
    font-size: 1.45rem;
    opacity: 0.95;
    filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.4));
}
.poker-card__shine {
    pointer-events: none;
    position: absolute;
    inset: 0;
    background: linear-gradient(125deg, rgba(255, 255, 255, 0.55) 0%, transparent 40%, transparent 100%);
    opacity: 0.5;
}
.poker-card--back .poker-card__inner {
    border: 1.5px solid rgba(251, 191, 36, 0.45);
}
.poker-card__back-art {
    position: absolute;
    inset: 0;
    background:
        url('../assets/poker/card_back.jpg?v=2') center / cover no-repeat,
        linear-gradient(145deg, #065f46, #064e3b);
}

/* Deal / flip animations */
.poker-card-slot.is-just-dealt .poker-card--face {
    animation: poker-flip-in 0.38s cubic-bezier(0.34, 1.35, 0.64, 1) both;
}
@keyframes poker-flip-in {
    0% { transform: rotateY(92deg) scale(0.88); opacity: 0.35; }
    60% { transform: rotateY(-8deg) scale(1.04); opacity: 1; }
    100% { transform: rotateY(0) scale(1); opacity: 1; }
}
.poker-card-slot.is-showdown-reveal {
    animation: poker-showdown-card-reveal .58s cubic-bezier(.22, 1, .36, 1) var(--showdown-delay, 0ms) both;
    transform-style: preserve-3d;
}
@keyframes poker-showdown-card-reveal {
    0% { opacity: .35; transform: translateY(-8px) rotateY(90deg) scale(.88); }
    58% { opacity: 1; transform: translateY(1px) rotateY(-7deg) scale(1.06); }
    100% { opacity: 1; transform: translateY(0) rotateY(0) scale(1); }
}
.poker-felt.is-showdown .poker-seat:not(.is-folded) { z-index: 12; }
.poker-felt.is-showdown .poker-seat__cards { gap: 4px; }
.poker-felt.is-showdown .poker-seat__action { opacity: 0; }

/* Readable showdown sheet: table cards stay visible, while every contender is
   repeated at a consistent size that works on narrow screens. */
.poker-showdown-layer {
    position: absolute;
    inset: 0;
    z-index: 70;
    display: grid;
    place-items: center;
    padding: 12px;
    background: rgba(2, 10, 8, 0.68);
    backdrop-filter: blur(5px);
    animation: poker-showdown-layer-in 0.28s ease both;
}
.poker-showdown-sheet {
    width: min(760px, 100%);
    max-height: 100%;
    overflow: auto;
    padding: 16px;
    border-radius: 18px;
    background: linear-gradient(155deg, rgba(15, 28, 38, 0.98), rgba(5, 18, 18, 0.98));
    border: 1px solid rgba(251, 191, 36, 0.42);
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.58), inset 0 1px rgba(255, 255, 255, 0.06);
    animation: poker-showdown-sheet-in 0.42s cubic-bezier(.22, 1, .36, 1) both;
}
.poker-showdown-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}
.poker-showdown-header span {
    color: #6ee7b7;
    font-size: 0.62rem;
    font-weight: 900;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}
.poker-showdown-header h3 { margin: 2px 0 3px; color: #fef3c7; font-size: 1.1rem; }
.poker-showdown-header p { margin: 0; color: #a7b6c7; font-size: 0.7rem; line-height: 1.35; }
.poker-showdown-close {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font: 700 1.25rem/1 inherit;
    cursor: pointer;
}
.poker-showdown-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.poker-showdown-row {
    position: relative;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 11px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid rgba(255, 255, 255, 0.09);
}
.poker-showdown-row.is-winner {
    border-color: rgba(251, 191, 36, 0.7);
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.15), rgba(16, 185, 129, 0.09));
}
.poker-showdown-player { min-width: 0; display: flex; align-items: center; gap: 8px; }
.poker-showdown-player > div:last-child { min-width: 0; display: flex; flex-direction: column; }
.poker-showdown-player strong { overflow: hidden; color: #f8fafc; font-size: 0.76rem; text-overflow: ellipsis; white-space: nowrap; }
.poker-showdown-player span { color: #86efac; font-size: 0.64rem; }
.poker-showdown-avatar { width: 34px; height: 34px; flex: 0 0 34px; overflow: hidden; border-radius: 50%; border: 1px solid rgba(255,255,255,.15); }
.poker-showdown-avatar img { width: 100%; height: 100%; object-fit: cover; }
.poker-showdown-explanation {
    min-height: 30px;
    color: #cbd5e1;
    font-size: 0.64rem;
    line-height: 1.35;
}
.poker-showdown-card-groups {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    align-items: end;
}
.poker-showdown-card-group { min-width: 0; }
.poker-showdown-card-group > span {
    display: block;
    margin-bottom: 4px;
    color: #94a3b8;
    font-size: 0.52rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.poker-showdown-cards { display: flex; gap: 4px; }
.poker-showdown-cards--hole .poker-card-slot { width: 38px; height: 54px; }
.poker-showdown-cards--best { gap: 3px; }
.poker-showdown-cards--best .poker-card-slot { width: 29px; height: 42px; }
.poker-showdown-cards--best .poker-card__corner--br { display: none; }
.poker-showdown-cards--best .poker-card__pip { font-size: 1rem; }
.poker-showdown-cards--best .poker-card__rank { font-size: .62rem; }
.poker-showdown-cards--best .poker-card__suit { font-size: .52rem; }
.poker-showdown-winner {
    position: absolute;
    right: 8px;
    top: 8px;
    color: #fbbf24;
    font-size: 0.52rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.poker-showdown-continue {
    display: block;
    margin: 12px auto 0;
    padding: 8px 18px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(145deg, #fbbf24, #d97706);
    color: #1c1917;
    font: 900 .72rem/1 inherit;
    cursor: pointer;
    box-shadow: 0 3px 0 rgba(0,0,0,.28);
}
@keyframes poker-showdown-layer-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes poker-showdown-sheet-in { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }

.poker-flyer {
    position: absolute;
    z-index: 50;
    width: 54px;
    height: 76px;
    left: 0;
    top: 0;
    pointer-events: none;
    animation: poker-fly 0.38s cubic-bezier(0.22, 0.9, 0.28, 1) forwards;
}
.poker-flyer__card {
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5);
}
@keyframes poker-fly {
    0% {
        transform: translate(var(--x0), var(--y0)) scale(0.82) rotate(-14deg);
        opacity: 0.75;
    }
    55% { opacity: 1; }
    100% {
        transform: translate(var(--x1), var(--y1)) scale(1) rotate(0deg);
        opacity: 1;
    }
}
.poker-flyer.will-flip .poker-card--back {
    animation: poker-card-spin 0.38s ease both;
}
@keyframes poker-card-spin {
    0% { transform: rotateY(0) scale(1); }
    45% { transform: rotateY(90deg) scale(0.95); }
    100% { transform: rotateY(180deg) scale(1); }
}

#poker-fly-layer {
    position: absolute;
    inset: 0;
    z-index: 40;
    pointer-events: none;
    overflow: hidden;
}

/* Actions + log */
.poker-footer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}
.poker-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    min-height: 44px;
    align-items: center;
}
.poker-actions:empty { display: none; min-height: 0; }
.poker-actions-hint {
    font-size: 0.8rem;
    font-weight: 700;
    color: #94a3b8;
    animation: poker-hint-pulse 1.4s ease-in-out infinite;
}
@keyframes poker-hint-pulse {
    0%, 100% { opacity: 0.65; }
    50% { opacity: 1; }
}
.poker-btn {
    border: none;
    border-radius: 12px;
    min-height: 40px;
    padding: 0.58rem 1rem;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.15s ease, opacity 0.15s, filter 0.15s;
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.28);
}
.poker-btn:hover:not(:disabled) { filter: brightness(1.06); }
.poker-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25); }
.poker-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.poker-btn--primary {
    background: linear-gradient(145deg, #fbbf24, #d97706);
    color: #1c1917;
}
.poker-btn--danger {
    background: linear-gradient(145deg, #f87171, #b91c1c);
    color: #fff;
}
.poker-btn--ghost {
    background: linear-gradient(145deg, #334155, #1e293b);
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.poker-btn--allin {
    background: linear-gradient(145deg, #a78bfa, #6d28d9);
    color: #fff;
}

.poker-log {
    max-height: 68px;
    overflow-y: auto;
    padding: 6px 10px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.68rem;
    color: #cbd5e1;
}
.poker-log__line {
    padding: 2px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.poker-log__line:first-child {
    color: #fde68a;
    font-weight: 700;
}

/* Game Center poker card accent */
.gamecenter-card--poker {
    border-color: rgba(16, 185, 129, 0.4) !important;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.16), rgba(5, 150, 105, 0.08)) !important;
}
.gamecenter-card--poker:hover {
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.22) !important;
}
.gamecenter-card-icon--poker {
    background: rgba(16, 185, 129, 0.22) !important;
}
.gamecenter-card-icon--poker > img { width: 92%; height: 92%; }
.gamecenter-card-badge--new {
    color: #6ee7b7 !important;
    background: rgba(16, 185, 129, 0.22) !important;
    border-color: rgba(52, 211, 153, 0.4) !important;
}

/* Mobile */
@media (max-width: 640px) {
    #poker-overlay { padding: 0; }
    .poker-panel { width: 100%; height: 100dvh; padding: max(7px, var(--klife-pad-top)) 8px max(7px, var(--klife-pad-bottom)); border-radius: 0; max-height: none; gap: 5px; }
    .poker-header { gap: 7px; }
    .poker-header__chip { width: 34px; height: 34px; }
    .poker-header__title h2 { font-size: .94rem; }
    .poker-header__title p { font-size: .62rem; }
    .poker-howto { font-size: .62rem; }
    .poker-message-lane.is-visible { padding: 5px 8px; font-size: .64rem; }
    .poker-table-wrap { min-height: 0; }
    .poker-felt { min-height: 100%; }
    .poker-card-slot { width: 44px; height: 62px; }
    .poker-flyer { width: 44px; height: 62px; }
    .poker-seat { min-width: 84px; gap: 2px; }
    .poker-seat__name { font-size: 0.65rem; max-width: 72px; }
    .poker-seat__meta { padding: 4px 8px 4px 4px; }
    .poker-seat__avatar { width: 28px; height: 28px; }
    .poker-seat__status-row { min-height: 18px; gap: 3px; }
    .poker-seat__action { min-width: 0; max-width: 78px; padding: 2px 6px; font-size: .52rem; }
    .poker-seat__bet { min-height: 16px; font-size: .56rem; }
    .poker-seat__bet.is-on { padding: 1px 5px; }
    .poker-deck-stack { left: -42px; width: 38px; height: 54px; }
    .poker-center { width: 94%; top: 49%; gap: 5px; }
    .poker-pot { padding: 4px 12px; }
    .poker-pot__ico { width: 27px; height: 27px; }
    .poker-pot__val { font-size: .86rem; }
    .poker-board { gap: 4px; padding: 4px; }
    .poker-board .poker-card-slot { width: 40px; height: 58px; }
    .poker-btn { padding: 0.5rem 0.72rem; font-size: 0.72rem; }
    .poker-seat--0 { bottom: 1%; }
    .poker-seat--1 { left: 5px; top: 27%; }
    .poker-seat--3 { right: 5px; top: 27%; }
    .poker-seat--2 { top: 1%; }
    .poker-seat--1 .poker-seat__cards, .poker-seat--3 .poker-seat__cards { gap: 2px; }
    .poker-seat--1 .poker-card-slot, .poker-seat--3 .poker-card-slot { width: 31px; height: 44px; }
    .poker-seat__cards { min-height: 44px; }
    .poker-felt.is-showdown .poker-seat--0 .poker-card-slot,
    .poker-felt.is-showdown .poker-seat--2 .poker-card-slot { width: 39px; height: 56px; }
    .poker-felt.is-showdown .poker-seat--1 .poker-card-slot,
    .poker-felt.is-showdown .poker-seat--3 .poker-card-slot { width: 30px; height: 43px; }
    .poker-showdown-layer { padding: 7px; align-items: end; }
    .poker-showdown-sheet {
        width: 100%;
        height: 100%;
        max-height: none;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        padding: 11px;
        border-radius: 14px;
        background: linear-gradient(155deg, #0f1c26, #051212);
    }
    .poker-showdown-grid { min-height: 0; overflow-y: auto; grid-template-columns: 1fr; gap: 7px; }
    .poker-showdown-row { padding: 8px; }
    .poker-showdown-card-groups { grid-template-columns: 76px minmax(0, 1fr); gap: 7px; }
    .poker-showdown-cards--hole .poker-card-slot { width: 34px; height: 48px; }
    .poker-showdown-cards--best .poker-card-slot { width: 27px; height: 39px; }
    .poker-showdown-header { margin-bottom: 9px; }
    .poker-showdown-header h3 { font-size: 0.96rem; }
    .poker-showdown-continue { flex: 0 0 auto; min-height: 40px; margin-top: 8px; }
    .poker-log { max-height: 52px; }
}

/* Portrait gameplay keeps the felt dominant and guarantees a single,
   thumb-sized action row even on short phones. */
@media (max-width: 640px) and (orientation: portrait) {
    .poker-footer { gap: 0; }
    .poker-actions {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 5px;
        width: 100%;
        min-height: 44px;
    }
    .poker-actions-hint { grid-column: 1 / -1; text-align: center; }
    .poker-btn {
        width: 100%;
        min-width: 0;
        min-height: 42px;
        padding: .42rem .18rem;
        font-size: clamp(.6rem, 2.75vw, .72rem);
        line-height: 1.08;
    }
    #poker-btn-deal {
        grid-column: 1 / -1;
        width: min(100%, 260px);
        justify-self: center;
    }
    .poker-log { display: none; }
}

@media (max-width: 360px) {
    .poker-panel { padding-left: 5px; padding-right: 5px; }
    .poker-header__title p { display: none; }
    .poker-howto { font-size: .58rem; }
    .poker-seat { min-width: 76px; }
    .poker-seat__meta { padding: 3px 6px 3px 3px; }
    .poker-seat__avatar { width: 25px; height: 25px; }
    .poker-seat__name { max-width: 58px; font-size: .58rem; }
    .poker-seat__stack { font-size: .55rem; }
    .poker-seat--1 .poker-card-slot, .poker-seat--3 .poker-card-slot { width: 27px; height: 39px; }
    .poker-board { gap: 2px; padding: 3px; }
    .poker-board .poker-card-slot { width: 34px; height: 49px; }
    .poker-card__corner--tl { top: 3px; left: 3px; }
    .poker-card__corner--br { bottom: 3px; right: 3px; }
    .poker-card__rank { font-size: .68rem; }
    .poker-card__suit { font-size: .58rem; }
    .poker-card__pip { font-size: 1.18rem; }
    .poker-actions { gap: 3px; }
    .poker-btn { padding: .38rem .12rem; font-size: .61rem; }
    .poker-showdown-layer { padding: 4px; background: rgba(2, 10, 8, .9); backdrop-filter: blur(9px); }
    .poker-showdown-sheet { padding: 9px; }
    .poker-showdown-header { gap: 8px; margin-bottom: 6px; }
    .poker-showdown-header p { font-size: .62rem; }
    .poker-showdown-close { width: 30px; height: 30px; flex-basis: 30px; }
    .poker-showdown-card-groups { grid-template-columns: 68px minmax(0, 1fr); gap: 5px; }
    .poker-showdown-cards--hole .poker-card-slot { width: 31px; height: 44px; }
    .poker-showdown-cards--best { gap: 2px; }
    .poker-showdown-cards--best .poker-card-slot { width: 24px; height: 35px; }
}

@media (max-width: 340px) and (orientation: portrait) {
    .poker-panel { gap: 3px; }
    .poker-center { width: 92%; top: 48%; }
    .poker-board .poker-card-slot { width: 31px; height: 45px; }
    .poker-seat--1 .poker-card-slot,
    .poker-seat--3 .poker-card-slot { width: 25px; height: 36px; }
    .poker-seat--1 { left: 3px; }
    .poker-seat--3 { right: 3px; }
}

@media (max-height: 680px) {
    .poker-panel { gap: 4px; padding-top: 5px; padding-bottom: 5px; }
    .poker-header__chip { width: 30px; height: 30px; }
    .poker-header__title p { display: none; }
    .poker-howto { display: none; }
    .poker-table-wrap { min-height: 0; }
    .poker-message-lane.is-visible { padding-top: 4px; padding-bottom: 4px; }
    .poker-seat__avatar { width: 24px; height: 24px; }
    .poker-seat__meta { padding: 3px 7px 3px 3px; }
    .poker-seat__cards { min-height: 38px; }
    .poker-card-slot { width: 36px; height: 51px; }
    .poker-board .poker-card-slot { width: 34px; height: 49px; }
    .poker-seat--1 .poker-card-slot, .poker-seat--3 .poker-card-slot { width: 26px; height: 37px; }
    .poker-center { gap: 3px; }
    .poker-pot__ico { display: none; }
    .poker-pot { padding: 3px 10px; }
    .poker-actions { gap: 4px; }
    .poker-btn { padding: .38rem .12rem; }
    .poker-log { max-height: 34px; }
    .poker-showdown-sheet { max-height: 90%; }
}

@media (max-width: 640px) and (max-height: 680px) and (orientation: portrait) {
    .poker-header__title h2 { font-size: .88rem; }
    .poker-table-wrap { border-radius: 14px; }
    .poker-seat--1,
    .poker-seat--3 { top: 25%; }
    .poker-seat--0 { bottom: .5%; }
    .poker-seat--2 { top: .5%; }
    .poker-center { top: 48%; }
    .poker-phase-tag { padding: 2px 8px; font-size: .58rem; }
    .poker-showdown-sheet { max-height: none; }
}

@media (max-height: 680px) and (min-width: 641px) {
    .poker-panel { width: min(1100px, 100%); }
    .poker-log { display: none; }
    .poker-footer { gap: 0; }
    .poker-seat { min-width: 112px; gap: 2px; }
    .poker-seat--2 { top: 2%; left: 2%; align-items: flex-start; transform: none; }
    .poker-seat--1 { top: auto; bottom: 2%; left: 2%; align-items: flex-start; }
    .poker-seat--3 { top: 2%; right: 2%; align-items: flex-end; }
    .poker-seat--0 { right: 2%; bottom: 2%; left: auto; align-items: flex-end; transform: none; }
    .poker-seat--0 .poker-seat__cards { order: 3; }
    .poker-seat--0 .poker-seat__status-row { order: 2; }
    .poker-seat--0 .poker-seat__meta { order: 1; }
    .poker-seat__cards { min-height: 36px; gap: 3px; }
    .poker-seat .poker-card-slot { width: 27px; height: 39px; }
    .poker-center {
        top: 50%;
        width: min(58%, 540px);
        flex-direction: row;
        justify-content: center;
        gap: 5px;
    }
    .poker-deck-stack { display: none; }
    .poker-pot { flex: 0 0 auto; min-width: 66px; }
    .poker-board { flex: 0 0 auto; min-height: 0; }
    .poker-board .poker-card-slot { width: 31px; height: 44px; }
    .poker-phase-tag { flex: 0 0 auto; padding: 2px 7px; font-size: .58rem; }
    .poker-showdown-layer { align-items: center; }
    .poker-showdown-sheet { width: min(760px, 94%); }
}

@media (prefers-reduced-motion: reduce) {
    .poker-flyer,
    .poker-card-slot.is-just-dealt .poker-card--face,
    .poker-card-slot.is-showdown-reveal,
    .poker-seat.is-turn .poker-seat__meta,
    .poker-panel,
    .poker-deck-card--top,
    .poker-seat.is-winner .poker-seat__cards {
        animation: none !important;
    }
    .poker-showdown-layer,
    .poker-showdown-sheet { animation: none !important; }
}
