/* RummyCircle player console — casino felt, ivory cards, warm mahogany */
:root {
    --felt-deep: #0d3d2a;
    --felt-mid: #145c3c;
    --felt-light: #1a734b;
    --rail: #4a2412;
    --rail-shine: #6b3a1e;
    --ivory: #f7f1e3;
    --ink: #1c1410;
    --gold: #d4a84b;
    --gold-soft: #e8c878;
    --crimson: #c4282d;
    --suit-red: #c4282d;
    --suit-black: #1a1a1a;
    --mist: rgba(247, 241, 227, 0.72);
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
    --font-display: "Fraunces", Georgia, serif;
    --font-ui: "Sora", system-ui, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    min-height: 100%;
    -webkit-text-size-adjust: 100%;
}

.player-body {
    font-family: var(--font-ui);
    color: var(--ivory);
    background: #07150f;
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
    overflow-x: hidden;
}

.player-ambient {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 80% 60% at 50% -10%, rgba(212, 168, 75, 0.18), transparent 55%),
        radial-gradient(ellipse 70% 50% at 80% 100%, rgba(20, 92, 60, 0.5), transparent 50%),
        linear-gradient(165deg, #0a1f16 0%, #07150f 40%, #0d281c 100%);
}

.player-ambient::after {
    content: "";
    position: absolute;
    inset: 0;
    opacity: 0.07;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.login-stage,
.lobby-main,
.felt-stage,
.lobby-topbar,
.table-topbar,
.chat-drawer {
    position: relative;
    z-index: 1;
}

.brand-mark {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2.4rem, 5vw, 3.6rem);
    letter-spacing: -0.03em;
    color: var(--gold-soft);
    margin: 0;
    line-height: 1;
}

.brand-mark.sm {
    font-size: 1.25rem;
}

.brand-headline {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 500;
    margin: 0.75rem 0 0.5rem;
    max-width: 14ch;
}

.brand-sub {
    color: var(--mist);
    max-width: 36ch;
    line-height: 1.55;
    margin: 0;
}

/* —— Login —— */
.page-login .login-stage {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 2rem;
    align-items: center;
    padding: clamp(1.5rem, 5vw, 4rem);
    max-width: 1100px;
    margin: 0 auto;
}

.login-brand {
    animation: rise-in 0.7s ease both;
}

.login-panel {
    background: linear-gradient(160deg, rgba(74, 36, 18, 0.55), rgba(26, 20, 14, 0.85));
    border: 1px solid rgba(232, 200, 120, 0.22);
    border-radius: 20px;
    padding: 1.75rem;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
    animation: rise-in 0.7s 0.12s ease both;
}

.auth-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.auth-tab {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--mist);
    font: inherit;
    font-weight: 600;
    padding: 0.65rem;
    border-radius: 10px;
    cursor: pointer;
}

.auth-tab.active {
    background: rgba(212, 168, 75, 0.18);
    color: var(--gold-soft);
}

.auth-form {
    display: grid;
    gap: 0.9rem;
}

.auth-form.hidden {
    display: none;
}

.auth-form label {
    display: grid;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: var(--mist);
}

.auth-form input {
    font: inherit;
    padding: 0.75rem 0.9rem;
    border-radius: 10px;
    border: 1px solid rgba(247, 241, 227, 0.15);
    background: rgba(7, 21, 15, 0.65);
    color: var(--ivory);
}

.auth-form input:focus {
    outline: 2px solid rgba(212, 168, 75, 0.45);
    border-color: transparent;
}

.btn-felt {
    margin-top: 0.35rem;
    border: none;
    border-radius: 999px;
    padding: 0.85rem 1.25rem;
    font: inherit;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 0.85rem;
    cursor: pointer;
    color: #1c1410;
    background: linear-gradient(135deg, #f0d78a, #d4a84b 55%, #b8892f);
    box-shadow: 0 8px 24px rgba(212, 168, 75, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-felt:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(212, 168, 75, 0.45);
}

.form-hint {
    margin: 0;
    font-size: 0.78rem;
    color: var(--mist);
    text-align: center;
}

.auth-error {
    margin: 0.85rem 0 0;
    color: #ffb4b4;
    font-size: 0.85rem;
}

/* —— Lobby —— */
.lobby-topbar,
.table-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem clamp(1rem, 4vw, 2.5rem);
    border-bottom: 1px solid rgba(232, 200, 120, 0.1);
    background: linear-gradient(180deg, rgba(7, 21, 15, 0.85), transparent);
    backdrop-filter: blur(8px);
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    text-decoration: none;
    color: inherit;
}

.brand-emblem {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-size: 1.35rem;
    color: #1c1410;
    background: linear-gradient(145deg, #f0d78a, #d4a84b 55%, #b8892f);
    box-shadow: 0 8px 22px rgba(212, 168, 75, 0.35);
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.brand-tagline {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--mist);
    font-weight: 600;
}

.player-chip {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    background: linear-gradient(135deg, rgba(26, 20, 14, 0.72), rgba(13, 61, 42, 0.35));
    border: 1px solid rgba(232, 200, 120, 0.22);
    border-radius: 18px;
    padding: 0.55rem 0.65rem 0.55rem 0.85rem;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}

.chip-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.chip-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 1rem;
    color: var(--gold-soft);
    background: rgba(212, 168, 75, 0.12);
    border: 1px solid rgba(212, 168, 75, 0.25);
}

.chip-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: #1c1410;
    background: linear-gradient(145deg, #f7f1e3, #e8c878);
    border: 2px solid rgba(232, 200, 120, 0.5);
}

.chip-label {
    margin: 0;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--mist);
}

.chip-value {
    margin: 0.1rem 0 0;
    font-weight: 700;
    font-size: 0.95rem;
}

.chip-divider {
    width: 1px;
    height: 2.25rem;
    background: rgba(247, 241, 227, 0.12);
}

.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid rgba(247, 241, 227, 0.2);
    background: rgba(255, 255, 255, 0.04);
    color: var(--ivory);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.5rem 0.9rem;
    border-radius: 999px;
    cursor: pointer;
    text-decoration: none;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.btn-ghost:hover {
    border-color: rgba(196, 40, 45, 0.45);
    color: #ffb4b4;
    background: rgba(196, 40, 45, 0.08);
}

.lobby-main {
    padding: 1.25rem clamp(1rem, 4vw, 2.5rem) 3.5rem;
    max-width: 1280px;
    margin: 0 auto;
}

.lobby-hero {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 1.5rem;
    align-items: stretch;
    margin-bottom: 1.5rem;
    animation: rise-in 0.6s ease both;
}

.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0 0 0.65rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--gold-soft);
}

.hero-copy h1 {
    font-family: var(--font-display);
    font-size: clamp(2rem, 4vw, 2.75rem);
    line-height: 1.12;
    margin: 0 0 0.75rem;
    letter-spacing: -0.02em;
}

.hero-lead {
    margin: 0;
    color: var(--mist);
    max-width: 42ch;
    line-height: 1.6;
    font-size: 0.95rem;
}

.hero-stats {
    display: grid;
    gap: 0.75rem;
}

.stat-tile {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 1rem 1.1rem;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(26, 20, 14, 0.55), rgba(20, 92, 60, 0.25));
    border: 1px solid rgba(232, 200, 120, 0.15);
    box-shadow: var(--shadow);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 1.15rem;
    color: var(--gold-soft);
    background: rgba(212, 168, 75, 0.14);
}

.stat-icon.accent { color: #7ee8b0; background: rgba(46, 204, 113, 0.12); }
.stat-icon.warm { color: #ffb86c; background: rgba(255, 184, 108, 0.12); }

.stat-value {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.1;
}

.stat-label {
    margin: 0.15rem 0 0;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--mist);
}

.lobby-tip {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.9rem 1.1rem;
    margin-bottom: 1.5rem;
    border-radius: 14px;
    background: linear-gradient(90deg, rgba(212, 168, 75, 0.12), rgba(20, 92, 60, 0.2));
    border: 1px solid rgba(212, 168, 75, 0.22);
    animation: rise-in 0.6s 0.08s ease both;
}

.tip-icon {
    font-size: 1.15rem;
    color: var(--gold-soft);
    margin-top: 0.1rem;
}

.lobby-tip p {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.55;
    color: var(--mist);
}

.lobby-tip strong { color: var(--ivory); }

.lobby-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    animation: rise-in 0.6s 0.12s ease both;
}

.toolbar-label {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--mist);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.toolbar-label i { color: var(--gold-soft); }

.table-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid rgba(247, 241, 227, 0.14);
    background: rgba(7, 21, 15, 0.45);
    color: var(--mist);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.5rem 0.95rem;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.22s ease;
}

.filter-pill i { font-size: 0.85rem; opacity: 0.85; }

.filter-pill:hover {
    border-color: rgba(212, 168, 75, 0.35);
    color: var(--ivory);
}

.filter-pill.active {
    background: linear-gradient(135deg, rgba(212, 168, 75, 0.28), rgba(212, 168, 75, 0.12));
    border-color: rgba(212, 168, 75, 0.55);
    color: var(--gold-soft);
    box-shadow: 0 4px 16px rgba(212, 168, 75, 0.15);
}

.lobby-section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    animation: rise-in 0.6s 0.16s ease both;
}

.lobby-section-head h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 500;
    margin: 0;
}

.lobby-section-head h2 i {
    font-size: 1rem;
    color: var(--crimson);
}

.tables-count {
    margin: 0;
    font-size: 0.8rem;
    color: var(--mist);
}

.tables-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.15rem;
}

.table-card {
    position: relative;
    overflow: hidden;
    border-radius: 20px;
    border: 1px solid rgba(232, 200, 120, 0.16);
    background:
        radial-gradient(ellipse 80% 60% at 100% 0%, rgba(212, 168, 75, 0.14), transparent 50%),
        linear-gradient(165deg, rgba(20, 92, 60, 0.5), rgba(7, 21, 15, 0.92));
    padding: 0;
    box-shadow: var(--shadow);
    transition: transform 0.28s cubic-bezier(0.25, 0.8, 0.25, 1), border-color 0.28s, box-shadow 0.28s;
    animation: rise-in 0.5s ease both;
}

.table-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.04) 50%, transparent 70%);
    transform: translateX(-120%);
    transition: transform 0.6s ease;
    pointer-events: none;
}

.table-card:hover {
    transform: translateY(-6px);
    border-color: rgba(232, 200, 120, 0.42);
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(212, 168, 75, 0.1);
}

.table-card:hover::before {
    transform: translateX(120%);
}

.table-card.tier-practice {
    border-color: rgba(126, 232, 176, 0.25);
}

.table-card.tier-cash {
    border-color: rgba(212, 168, 75, 0.28);
}

.table-card.tier-vip {
    border-color: rgba(255, 184, 108, 0.35);
    background:
        radial-gradient(ellipse 70% 50% at 100% 0%, rgba(255, 184, 108, 0.18), transparent 55%),
        linear-gradient(165deg, rgba(74, 36, 18, 0.55), rgba(7, 21, 15, 0.95));
}

.table-card-inner {
    padding: 1.25rem 1.25rem 1.1rem;
}

.table-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.table-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    background: rgba(212, 168, 75, 0.15);
    color: var(--gold-soft);
    border: 1px solid rgba(212, 168, 75, 0.25);
}

.table-type-badge i { font-size: 0.75rem; }

.table-tier-badge {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.3rem 0.55rem;
    border-radius: 8px;
}

.tier-practice .table-tier-badge {
    background: rgba(46, 204, 113, 0.15);
    color: #7ee8b0;
}

.tier-cash .table-tier-badge {
    background: rgba(212, 168, 75, 0.15);
    color: var(--gold-soft);
}

.tier-vip .table-tier-badge {
    background: rgba(255, 184, 108, 0.15);
    color: #ffb86c;
}

.table-card-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-size: 1.4rem;
    margin-bottom: 0.75rem;
    color: var(--gold-soft);
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(232, 200, 120, 0.15);
}

.table-card h3 {
    font-family: var(--font-display);
    font-size: 1.2rem;
    margin: 0 0 0.85rem;
    line-height: 1.3;
    padding-right: 0.5rem;
}

.table-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
    margin-bottom: 1rem;
}

.stat-cell {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.6rem 0.7rem;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(247, 241, 227, 0.06);
}

.stat-cell i {
    font-size: 1rem;
    color: var(--gold-soft);
    opacity: 0.9;
}

.stat-cell span {
    display: block;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--mist);
}

.stat-cell strong {
    display: block;
    color: var(--ivory);
    font-size: 0.95rem;
    margin-top: 0.1rem;
}

.seat-dots {
    display: flex;
    gap: 0.3rem;
    margin-bottom: 1rem;
}

.seat-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(247, 241, 227, 0.15);
    border: 1px solid rgba(247, 241, 227, 0.2);
}

.seat-dot.filled {
    background: linear-gradient(145deg, #f0d78a, #d4a84b);
    border-color: transparent;
    box-shadow: 0 0 8px rgba(212, 168, 75, 0.4);
}

.btn-join {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
    border-radius: 12px;
    padding: 0.8rem 1rem;
    font: inherit;
    font-weight: 700;
    font-size: 0.88rem;
    letter-spacing: 0.03em;
    cursor: pointer;
    color: #0d3d2a;
    background: linear-gradient(135deg, #fff8e7, #e8c878 45%, #d4a84b);
    box-shadow: 0 6px 20px rgba(212, 168, 75, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-join:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(212, 168, 75, 0.45);
}

.btn-join i { font-size: 1rem; }

.tables-loading,
.tables-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    padding: 3.5rem 1rem;
    color: var(--mist);
    text-align: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid rgba(212, 168, 75, 0.15);
    border-top-color: var(--gold);
    animation: spin 0.8s linear infinite;
}

.tables-empty i {
    font-size: 2.5rem;
    color: rgba(212, 168, 75, 0.4);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 900px) {
    .lobby-hero {
        grid-template-columns: 1fr;
    }

    .hero-stats {
        grid-template-columns: repeat(3, 1fr);
    }

    .stat-tile {
        flex-direction: column;
        text-align: center;
        padding: 0.85rem 0.65rem;
    }

    .stat-icon { margin: 0 auto; }

    .stat-value { font-size: 1.1rem; }
}

@media (max-width: 720px) {
    .lobby-topbar {
        flex-direction: column;
        align-items: stretch;
        padding: 0.75rem 1rem;
        padding-top: max(0.75rem, env(safe-area-inset-top));
        gap: 0.65rem;
    }

    .player-chip {
        flex-wrap: wrap;
        justify-content: space-between;
    }

    .chip-divider { display: none; }

    .hero-stats {
        grid-template-columns: 1fr;
    }

    .lobby-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .tables-grid {
        grid-template-columns: 1fr;
    }

    .btn-ghost span { display: none; }

    .lobby-main {
        padding: 1rem;
        padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
    }

    .table-card {
        padding: 1rem;
    }

    .table-card .btn-join,
    .table-card a.btn-join,
    .btn-join {
        min-height: 44px;
        width: 100%;
        justify-content: center;
    }

    .filter-pills {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.25rem;
    }

    .filter-pill {
        flex-shrink: 0;
        min-height: 40px;
    }
}

/* —— Game table —— */
.page-table {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.table-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.status-pill {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: rgba(212, 168, 75, 0.15);
    border: 1px solid rgba(212, 168, 75, 0.35);
    color: var(--gold-soft);
}

.timer-ring {
    display: inline-grid;
    place-items: center;
    width: 2.55rem;
    height: 2.55rem;
    border-radius: 50%;
    border: 3px solid var(--gold);
    font-weight: 700;
    font-size: 0.85rem;
    margin-left: 0.75rem;
    background: rgba(7, 21, 15, 0.65);
    animation: pulse-timer 1s ease infinite;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.timer-ring.urgent {
    border-color: #ff6b6b;
    color: #ffb4b4;
    animation: pulse-timer-urgent 0.6s ease infinite;
}

.felt-stage {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0 1rem 1rem;
    gap: 0.65rem;
}

.turn-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    padding: 0.55rem 1rem;
    border-radius: 14px;
    background: linear-gradient(90deg, rgba(212, 168, 75, 0.18), rgba(26, 115, 75, 0.35), rgba(212, 168, 75, 0.18));
    border: 1px solid rgba(232, 200, 120, 0.4);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    animation: banner-in 0.35s ease both;
}

.turn-banner[hidden] { display: none !important; }

.turn-banner strong {
    font-family: var(--font-display);
    font-size: 1.05rem;
    color: var(--gold-soft);
}

.turn-banner em {
    font-style: normal;
    font-size: 0.8rem;
    color: var(--mist);
}

.turn-banner-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--gold);
    box-shadow: 0 0 12px rgba(212, 168, 75, 0.8);
    animation: pulse-dot 1s ease infinite;
}

.felt-rail {
    flex: 1;
    border-radius: 28px;
    padding: 14px;
    background: linear-gradient(145deg, var(--rail-shine), var(--rail) 40%, #2e150a);
    box-shadow: inset 0 2px 0 rgba(255, 220, 160, 0.15), var(--shadow);
    min-height: 340px;
}

.felt-oval {
    position: relative;
    height: 100%;
    min-height: 320px;
    border-radius: 48% / 42%;
    background:
        radial-gradient(ellipse at 50% 38%, #1f8a58 0%, var(--felt-mid) 42%, var(--felt-deep) 78%),
        repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0, 0, 0, 0.03) 2px, rgba(0, 0, 0, 0.03) 4px);
    box-shadow: inset 0 0 70px rgba(0, 0, 0, 0.4);
    display: grid;
    place-items: center;
    overflow: hidden;
    transition: box-shadow 0.35s ease;
}

.felt-oval.my-turn-glow {
    box-shadow:
        inset 0 0 70px rgba(0, 0, 0, 0.35),
        inset 0 0 0 2px rgba(212, 168, 75, 0.35),
        0 0 40px rgba(212, 168, 75, 0.18);
}

.felt-oval.dealing::before {
    content: "";
    position: absolute;
    inset: 18%;
    border-radius: 50%;
    border: 2px solid rgba(232, 200, 120, 0.45);
    animation: deal-ring 0.7s ease-out both;
    pointer-events: none;
    z-index: 1;
}

.fly-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 20;
    overflow: hidden;
}

.fly-card {
    position: absolute;
    transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.32s ease;
    z-index: 30;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45) !important;
}

.opponents {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
}

.opponent-seat {
    position: absolute;
    transform: translate(-50%, -50%);
    text-align: center;
    min-width: 86px;
    pointer-events: auto;
    transition: transform 0.25s ease;
}

.opponent-seat.active {
    z-index: 4;
}

.opponent-seat.active .avatar {
    box-shadow: 0 0 0 3px var(--gold), 0 0 22px rgba(212, 168, 75, 0.55);
    animation: seat-pulse 1.4s ease infinite;
}

.avatar {
    width: 50px;
    height: 50px;
    margin: 0 auto 0.3rem;
    border-radius: 50%;
    background: linear-gradient(145deg, #6b3a1e, #2e150a);
    border: 2px solid rgba(232, 200, 120, 0.45);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.mini-hand {
    display: flex;
    justify-content: center;
    gap: 2px;
    margin-bottom: 0.2rem;
    min-height: 14px;
}

.mini-hand i {
    display: block;
    width: 10px;
    height: 14px;
    border-radius: 2px;
    background:
        linear-gradient(135deg, rgba(212, 168, 75, 0.35), transparent 45%),
        repeating-linear-gradient(45deg, #1a3d2e 0 3px, #0f2a1f 3px 6px);
    border: 1px solid rgba(232, 200, 120, 0.35);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.opponent-name {
    font-size: 0.72rem;
    font-weight: 600;
    margin: 0;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.55);
}

.opponent-cards {
    font-size: 0.65rem;
    color: var(--mist);
    margin: 0.1rem 0 0;
}

.center-piles {
    display: flex;
    align-items: flex-end;
    gap: clamp(1rem, 4vw, 2.5rem);
    z-index: 3;
}

.pile-stack,
.joker-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
}

.pile-stack {
    position: relative;
    cursor: default;
    transition: transform 0.18s ease;
}

.pile-stack.can-draw,
.pile-stack.can-drop {
    cursor: pointer;
}

.pile-stack.can-draw:hover,
.pile-stack.can-drop:hover,
.finish-slot.can-finish:hover {
    transform: translateY(-4px);
}

.pile-stack.can-draw::after,
.pile-stack.can-drop.drop-ready::after,
.finish-slot.drop-ready::after {
    content: "";
    position: absolute;
    inset: -8px -6px 22px;
    border-radius: 12px;
    border: 1px dashed rgba(232, 200, 120, 0.55);
    pointer-events: none;
    animation: pulse-dot 1.4s ease infinite;
}

.finish-slot {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    cursor: default;
    transition: transform 0.18s ease, filter 0.18s ease;
}

.finish-slot.can-finish { cursor: pointer; }

.finish-slot.ready .finish-pad,
.finish-slot.drop-hover .finish-pad {
    border-color: #3ecf8e;
    background: rgba(46, 180, 110, 0.28);
    box-shadow: 0 0 18px rgba(62, 207, 142, 0.35);
}

.finish-pad {
    width: 64px;
    height: 90px;
    border-radius: 10px;
    border: 2px dashed rgba(247, 241, 227, 0.35);
    background: rgba(0, 0, 0, 0.22);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    color: var(--ivory);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-align: center;
    line-height: 1.15;
}

.finish-pad em {
    font-style: normal;
    color: var(--gold-soft);
    font-size: 0.72rem;
}

.opponent-seat.dropped {
    opacity: 0.55;
    filter: grayscale(0.85);
}

.opponent-seat.dropped .avatar {
    box-shadow: none;
}

.drop-tag {
    position: absolute;
    top: 34px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30, 30, 30, 0.88);
    color: #fff;
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.18rem 0.4rem;
    border-radius: 4px;
    z-index: 3;
    white-space: nowrap;
}

.hand-strip {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-end;
    justify-content: center;
    gap: 1.1rem;
    overflow-x: auto;
    overflow-y: visible;
    padding: 0.85rem 0.4rem 0.35rem;
    min-height: 148px;
    scrollbar-width: thin;
}

.hand-empty {
    margin: 2rem auto;
    color: var(--mist);
    font-size: 0.85rem;
}

.hand-group {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.45rem 0.25rem;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid transparent;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.hand-group.meld {
    background: rgba(212, 168, 75, 0.06);
}

.hand-group.drop-hover {
    border-color: rgba(232, 200, 120, 0.55);
    background: rgba(212, 168, 75, 0.14);
}

.hand-group .ungroup {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: none;
    background: var(--crimson);
    color: white;
    font-size: 0.7rem;
    cursor: pointer;
    z-index: 5;
}

.group-cards {
    display: flex;
    align-items: flex-end;
}

.group-cards .playing-card.in-group {
    width: 62px;
    height: 88px;
    margin-left: -28px;
    flex-shrink: 0;
}

.group-cards .playing-card.in-group:first-child {
    margin-left: 0;
}

.group-cards .playing-card.in-group.selected {
    transform: translateY(-18px);
    z-index: 40 !important;
}

.group-cards .playing-card.in-group:hover {
    transform: translateY(-10px);
    z-index: 35 !important;
}

.group-cards .playing-card.in-group.selected:hover {
    transform: translateY(-18px);
}

.meld-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.22rem 0.55rem;
    border-radius: 999px;
    white-space: nowrap;
}

.meld-badge.ok {
    background: #1f9d5a;
    color: #fff;
    box-shadow: 0 4px 10px rgba(31, 157, 90, 0.35);
}

.meld-badge.bad {
    background: rgba(196, 40, 45, 0.85);
    color: #fff;
}

.meld-badge.loose {
    background: rgba(247, 241, 227, 0.12);
    color: var(--mist);
    font-weight: 600;
}

.meld-badge .check {
    font-size: 0.72rem;
}

.self-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.55rem;
    padding-top: 0.55rem;
    border-top: 1px solid rgba(232, 200, 120, 0.12);
}

.self-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 700;
    background: linear-gradient(145deg, #6b3a1e, #2e150a);
    border: 2px solid rgba(232, 200, 120, 0.45);
    flex-shrink: 0;
}

.self-meta {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 90px;
}

.self-meta strong {
    font-size: 0.82rem;
}

.self-meta span {
    font-size: 0.75rem;
    color: var(--gold-soft);
    font-weight: 600;
}

.self-bar .hand-hint {
    flex: 1;
    margin: 0;
    text-align: right;
}

.pile-stack.pulse-draw {
    animation: pile-nudge 0.28s ease;
}

.pile-stack.drop-hover,
.finish-slot.drop-hover {
    transform: translateY(-6px) scale(1.04);
    filter: drop-shadow(0 0 12px rgba(212, 168, 75, 0.55));
}

.pile-stack-visual {
    position: relative;
    width: 64px;
    height: 90px;
}

.pile-stack-visual .card-back {
    position: absolute;
    inset: 0;
}

.pile-stack-visual .depth-1 { transform: translate(3px, -3px); opacity: 0.9; }
.pile-stack-visual .depth-2 { transform: translate(6px, -6px); opacity: 0.75; }

.joker-slot { cursor: default; }

.pile-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(247, 241, 227, 0.78);
}

.pile-label em {
    font-style: normal;
    color: var(--gold-soft);
    font-weight: 700;
}

.card-slot,
.playing-card,
.card-back {
    width: 64px;
    height: 90px;
    border-radius: 8px;
}

.card-slot.empty {
    border: 2px dashed rgba(247, 241, 227, 0.25);
    background: rgba(0, 0, 0, 0.15);
}

.card-back {
    background:
        linear-gradient(135deg, rgba(212, 168, 75, 0.28), transparent 40%),
        repeating-linear-gradient(45deg, #1a3d2e 0 6px, #0f2a1f 6px 12px);
    border: 2px solid rgba(232, 200, 120, 0.4);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
}

.playing-card {
    position: relative;
    background: linear-gradient(180deg, #fffdf8, var(--ivory));
    color: var(--ink);
    border: 1px solid rgba(28, 20, 16, 0.12);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
    padding: 0.35rem 0.4rem;
    font-family: var(--font-display);
    user-select: none;
    -webkit-user-drag: element;
    transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.2s ease, filter 0.2s ease;
    cursor: grab;
    will-change: transform;
}

.playing-card:active { cursor: grabbing; }

.playing-card.red { color: var(--suit-red); }
.playing-card.black { color: var(--suit-black); }
.playing-card.joker {
    color: #5a3d12;
    background: linear-gradient(180deg, #fff8e7, #f0d78a);
}

.playing-card .rank {
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1;
}

.playing-card .suit {
    font-size: 1.35rem;
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
}

.playing-card .corner-br {
    position: absolute;
    right: 0.35rem;
    bottom: 0.3rem;
    transform: rotate(180deg);
    font-weight: 700;
    font-size: 0.95rem;
}

.playing-card.selected {
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.4), 0 0 0 2px var(--gold);
    filter: brightness(1.05);
}

.playing-card.dragging {
    opacity: 0.45;
}

.playing-card.drop-before::before,
.playing-card.drop-after::after {
    content: "";
    position: absolute;
    top: 8%;
    bottom: 8%;
    width: 3px;
    border-radius: 3px;
    background: var(--gold);
    z-index: 5;
}

.playing-card.drop-before::before { left: -4px; }
.playing-card.drop-after::after { right: -4px; }

.playing-card.wild-mark::after {
    content: "JOKER";
    position: absolute;
    top: 3px;
    right: 3px;
    font-size: 0.45rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    background: var(--gold);
    color: #1c1410;
    border-radius: 3px;
    padding: 1px 3px;
}

.playing-card.table-card {
    cursor: default;
    -webkit-user-drag: none;
}

.queue-banner {
    position: absolute;
    bottom: 12%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0.65rem;
    background: rgba(7, 21, 15, 0.72);
    border: 1px solid rgba(232, 200, 120, 0.3);
    border-radius: 999px;
    padding: 0.65rem 1.1rem;
    z-index: 3;
}

.queue-banner.hidden { display: none; }

.queue-banner p {
    margin: 0;
    font-size: 0.85rem;
    white-space: nowrap;
}

.pulse-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--gold);
    animation: pulse-dot 1.2s ease infinite;
}

.hand-dock {
    background: linear-gradient(180deg, rgba(26, 20, 14, 0.45), rgba(7, 21, 15, 0.92));
    border: 1px solid rgba(232, 200, 120, 0.15);
    border-radius: 22px;
    padding: 0.85rem 1rem 1rem;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.hand-dock.my-turn {
    border-color: rgba(232, 200, 120, 0.45);
    box-shadow: 0 -8px 28px rgba(212, 168, 75, 0.12);
}

.hand-dock.is-dragging .hand-hint {
    color: var(--gold-soft);
}

.hand-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 0.55rem;
    justify-content: center;
}

.btn-action {
    border: 1px solid rgba(247, 241, 227, 0.2);
    background: rgba(255, 255, 255, 0.04);
    color: var(--ivory);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.5rem 0.9rem;
    border-radius: 999px;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
}

.btn-action:hover:not(:disabled) { transform: translateY(-1px); }
.btn-action:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-action.primary {
    background: linear-gradient(135deg, #f0d78a, #d4a84b);
    color: #1c1410;
    border-color: transparent;
}

.btn-action.accent {
    background: rgba(26, 115, 75, 0.55);
    border-color: rgba(232, 200, 120, 0.35);
}

.btn-action.danger {
    border-color: rgba(196, 40, 45, 0.55);
    color: #ffb4b4;
}

.meld-rack {
    display: none;
}

.my-hand.fan-hand {
    display: none;
}

.hand-hint {
    margin: 0.45rem 0 0;
    text-align: center;
    font-size: 0.78rem;
    color: var(--mist);
}

.chat-drawer {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    width: min(280px, calc(100vw - 2rem));
    background: rgba(7, 21, 15, 0.92);
    border: 1px solid rgba(232, 200, 120, 0.2);
    border-radius: 14px;
    padding: 0.65rem;
    z-index: 5;
    display: none;
}

.page-table .chat-drawer {
    display: block;
}

.chat-drawer-head {
    display: none;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.35rem;
}

.chat-drawer-head strong {
    font-size: 0.8rem;
    color: var(--gold-soft);
}

.chat-close {
    border: none;
    background: transparent;
    color: var(--ivory);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.2rem 0.45rem;
}

.btn-chat-toggle {
    display: none;
    border: 1px solid rgba(232, 200, 120, 0.35);
    background: rgba(255, 255, 255, 0.06);
    color: var(--ivory);
    font: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.4rem 0.7rem;
    border-radius: 999px;
    cursor: pointer;
    flex-shrink: 0;
}

.chat-log {
    height: 110px;
    overflow-y: auto;
    font-size: 0.75rem;
    color: var(--mist);
    margin-bottom: 0.4rem;
}

.chat-form {
    display: flex;
    gap: 0.35rem;
}

.chat-form input {
    flex: 1;
    border-radius: 8px;
    border: 1px solid rgba(247, 241, 227, 0.15);
    background: rgba(0, 0, 0, 0.25);
    color: var(--ivory);
    padding: 0.4rem 0.55rem;
    font: inherit;
    font-size: 0.8rem;
}

.chat-form button {
    border: none;
    border-radius: 8px;
    background: var(--gold);
    color: #1c1410;
    font-weight: 700;
    font-size: 0.75rem;
    padding: 0 0.7rem;
    cursor: pointer;
}

.toast-host {
    position: fixed;
    top: max(1rem, env(safe-area-inset-top));
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    display: grid;
    gap: 0.5rem;
    width: min(92vw, 420px);
    padding: 0 0.5rem;
}

.toast {
    background: rgba(26, 20, 14, 0.95);
    border: 1px solid rgba(232, 200, 120, 0.35);
    color: var(--ivory);
    padding: 0.7rem 1rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    animation: rise-in 0.3s ease both;
    font-size: 0.85rem;
}

.toast.error {
    border-color: rgba(196, 40, 45, 0.55);
    color: #ffd0d0;
}

@keyframes rise-in {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes banner-in {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse-dot {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.35); opacity: 0.55; }
}

@keyframes pulse-timer {
    0%, 100% { box-shadow: 0 0 0 0 rgba(212, 168, 75, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(212, 168, 75, 0); }
}

@keyframes pulse-timer-urgent {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.45); }
    50% { box-shadow: 0 0 0 8px rgba(255, 107, 107, 0); }
}

@keyframes seat-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04); }
}

@keyframes deal-ring {
    from { opacity: 0.9; transform: scale(0.7); }
    to { opacity: 0; transform: scale(1.25); }
}

@keyframes pile-nudge {
    0% { transform: scale(1); }
    40% { transform: scale(1.06) translateY(-3px); }
    100% { transform: scale(1); }
}

/* —— Mobile / tablet —— */
@media (max-width: 900px) {
    .page-login .login-stage {
        grid-template-columns: 1fr;
        padding: 1.25rem 1rem 2rem;
        padding-top: max(1.25rem, env(safe-area-inset-top));
    }

    .brand-headline { max-width: none; }

    .auth-panel {
        width: 100%;
        max-width: none;
    }

    .page-table {
        min-height: 100dvh;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .table-topbar {
        padding: 0.55rem 0.75rem;
        padding-top: max(0.55rem, env(safe-area-inset-top));
        gap: 0.5rem;
        position: sticky;
        top: 0;
        z-index: 20;
        background: rgba(7, 21, 15, 0.92);
        backdrop-filter: blur(10px);
    }

    .table-topbar .brand-mark.sm {
        font-size: 1.05rem;
    }

    .table-topbar .btn-ghost span { display: none; }

    .table-meta {
        flex: 1;
        min-width: 0;
        gap: 0.4rem;
    }

    .status-pill {
        font-size: 0.65rem;
        padding: 0.25rem 0.5rem;
        white-space: nowrap;
    }

    .table-wallet {
        font-size: 0.78rem;
    }

    .timer-ring {
        width: 2.1rem;
        height: 2.1rem;
        font-size: 0.75rem;
        margin-left: 0.4rem;
    }

    .felt-stage {
        padding: 0 0.5rem 0.5rem;
        gap: 0.45rem;
    }

    .turn-banner {
        flex-wrap: wrap;
        gap: 0.25rem 0.5rem;
        text-align: center;
        padding: 0.45rem 0.7rem;
        border-radius: 12px;
    }

    .turn-banner strong { font-size: 0.95rem; }
    .turn-banner em { font-size: 0.72rem; width: 100%; }

    .felt-rail {
        border-radius: 18px;
        padding: 8px;
        min-height: 0;
        flex: 0 0 auto;
    }

    .felt-oval {
        border-radius: 22px;
        min-height: min(42vh, 280px);
        height: min(42vh, 280px);
    }

    .center-piles {
        gap: 0.55rem;
        transform: scale(0.92);
        transform-origin: center center;
    }

    .card-slot, .playing-card, .card-back {
        width: 48px;
        height: 68px;
        border-radius: 6px;
    }

    .pile-stack-visual {
        width: 48px;
        height: 68px;
    }

    .finish-pad {
        width: 48px;
        height: 68px;
        font-size: 0.55rem;
    }

    .pile-label {
        font-size: 0.58rem;
    }

    .opponent-seat {
        min-width: 64px;
        transform: translate(-50%, -50%) scale(0.9);
    }

    .avatar {
        width: 40px;
        height: 40px;
        font-size: 0.8rem;
    }

    .opponent-name { font-size: 0.65rem; }
    .opponent-cards { font-size: 0.58rem; }

    .queue-banner {
        max-width: 92%;
        padding: 0.5rem 0.75rem;
        bottom: 8%;
    }

    .queue-banner p {
        font-size: 0.72rem;
        white-space: normal;
        text-align: left;
    }

    .hand-dock {
        border-radius: 16px 16px 0 0;
        padding: 0.55rem 0.55rem calc(0.55rem + env(safe-area-inset-bottom));
        margin: 0 -0.5rem -0.5rem;
        position: sticky;
        bottom: 0;
        z-index: 15;
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.35);
    }

    .hand-strip {
        gap: 0.55rem;
        min-height: 118px;
        justify-content: flex-start;
        padding: 0.55rem 0.35rem;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
        overscroll-behavior-x: contain;
    }

    .hand-group {
        scroll-snap-align: start;
        flex-shrink: 0;
        padding: 0.25rem 0.3rem;
    }

    .group-cards .playing-card.in-group {
        width: 50px;
        height: 72px;
        margin-left: -22px;
        touch-action: manipulation;
        -webkit-user-drag: none;
        cursor: pointer;
    }

    .group-cards .playing-card.in-group.selected {
        transform: translateY(-14px);
    }

    .meld-badge {
        font-size: 0.6rem;
        padding: 0.18rem 0.45rem;
    }

    .hand-toolbar {
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 0.35rem;
        margin: 0.45rem 0 0;
        order: 3;
    }

    .btn-action {
        min-height: 44px;
        padding: 0.55rem 0.25rem;
        font-size: 0.68rem;
        border-radius: 12px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    .btn-action.accent,
    .btn-action.primary {
        font-weight: 700;
    }

    .self-bar {
        gap: 0.5rem;
        margin-top: 0.35rem;
        padding-top: 0.4rem;
        align-items: center;
    }

    .self-avatar {
        width: 36px;
        height: 36px;
        font-size: 0.85rem;
    }

    .self-meta { min-width: 0; }
    .self-meta strong { font-size: 0.75rem; }
    .self-meta span { font-size: 0.68rem; }

    .self-bar .hand-hint {
        flex: 1;
        text-align: left;
        font-size: 0.68rem;
        line-height: 1.25;
        min-width: 0;
    }

    .btn-chat-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 36px;
    }

    .page-table .chat-drawer {
        display: none;
        inset: auto 0 0 0;
        width: 100%;
        max-width: none;
        right: 0;
        bottom: 0;
        border-radius: 18px 18px 0 0;
        padding: 0.85rem 0.85rem calc(0.85rem + env(safe-area-inset-bottom));
        z-index: 40;
        box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.5);
    }

    .page-table .chat-drawer.open {
        display: block;
    }

    .chat-drawer-head {
        display: flex;
    }

    .chat-log {
        height: min(36vh, 220px);
    }

    .chat-form input {
        min-height: 44px;
        font-size: 16px; /* prevent iOS zoom */
    }

    .chat-form button {
        min-width: 64px;
        min-height: 44px;
    }

    .playing-card {
        touch-action: manipulation;
    }

    .pile-stack,
    .finish-slot {
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
}

@media (max-width: 420px) {
    .center-piles {
        gap: 0.35rem;
        transform: scale(0.84);
    }

    .group-cards .playing-card.in-group {
        width: 46px;
        height: 66px;
        margin-left: -20px;
    }

    .hand-strip { min-height: 108px; }

    .btn-action {
        font-size: 0.62rem;
        padding: 0.5rem 0.15rem;
    }

    .felt-oval {
        min-height: min(38vh, 240px);
        height: min(38vh, 240px);
    }
}

/* Landscape phones */
@media (max-height: 500px) and (orientation: landscape) {
    .felt-oval {
        min-height: 160px;
        height: 160px;
    }

    .hand-strip { min-height: 96px; }

    .hand-dock {
        padding-top: 0.35rem;
    }

    .turn-banner em { display: none; }

    .self-bar .hand-hint { display: none; }
}
