:root {
    --bg: #f4f8f1;
    --surface: #ffffff;
    --surface-soft: #edf5e9;
    --surface-warm: #fff8e8;
    --ink: #17332a;
    --muted: #6a7f76;
    --line: #dce8dd;
    --primary: #16845b;
    --primary-dark: #0f6848;
    --primary-soft: #dff4e8;
    --accent: #ffb84d;
    --accent-dark: #9b5f00;
    --danger: #e45555;
    --danger-soft: #fff0ef;
    --info: #3979d4;
    --shadow: 0 14px 36px rgba(31, 65, 49, .09);
    --shadow-soft: 0 5px 18px rgba(31, 65, 49, .07);
    --radius: 22px;
    --radius-sm: 15px;
    --nav-height: 72px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 12% -10%, rgba(255, 211, 128, .32), transparent 32rem),
        radial-gradient(circle at 100% 10%, rgba(86, 190, 135, .16), transparent 30rem),
        var(--bg);
    font-family: Inter, ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, -apple-system, sans-serif;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior-y: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

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

a {
    color: inherit;
    text-decoration: none;
}

.app-shell {
    min-height: 100vh;
    min-height: 100dvh;
    padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px));
}

.topbar {
    position: sticky;
    z-index: 40;
    top: 0;
    padding-top: env(safe-area-inset-top, 0px);
    border-bottom: 1px solid rgba(220, 232, 221, .84);
    background: rgba(244, 248, 241, .88);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 62px;
    max-width: 1120px;
    margin: auto;
    padding: 10px 16px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    font-size: 18px;
    font-weight: 900;
    letter-spacing: -.035em;
}

.brand-mark {
    display: grid;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 13px;
    color: #fff;
    background: var(--primary);
    box-shadow: 0 7px 18px rgba(22, 132, 91, .22);
}

.brand-mark svg {
    width: 23px;
    height: 23px;
}

.topbar-action {
    display: inline-grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 14px;
    color: var(--muted);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}

.page {
    width: min(100%, 760px);
    margin: 0 auto;
    padding: 18px 14px 28px;
}

.page-wide {
    width: min(100%, 1120px);
}

.page-heading {
    margin: 8px 2px 18px;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .12em;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1,
h2,
h3 {
    line-height: 1.15;
    letter-spacing: -.035em;
}

h1 {
    margin-bottom: 8px;
    font-size: clamp(28px, 8vw, 42px);
}

h2 {
    margin-bottom: 6px;
    font-size: 22px;
}

.subtle,
.helper {
    color: var(--muted);
}

.subtle {
    margin-bottom: 0;
    font-size: 14px;
}

.helper {
    margin: 7px 0 0;
    font-size: 12px;
}

.card {
    border: 1px solid rgba(220, 232, 221, .95);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .96);
    box-shadow: var(--shadow);
}

.card-pad {
    padding: 18px;
}

.card + .card,
.section + .section {
    margin-top: 14px;
}

.section-title {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 12px;
    margin: 24px 2px 10px;
}

.section-title h2 {
    margin: 0;
    font-size: 18px;
}

.section-title span {
    color: var(--muted);
    font-size: 12px;
}

.hero {
    position: relative;
    overflow: hidden;
    padding: 24px 20px;
    color: #fff;
    border: 0;
    background: linear-gradient(140deg, #16845b, #0d6748 68%, #07513b);
    box-shadow: 0 18px 38px rgba(16, 99, 69, .22);
}

.hero::after {
    position: absolute;
    width: 190px;
    height: 190px;
    content: "";
    right: -76px;
    bottom: -96px;
    border: 28px solid rgba(255, 255, 255, .09);
    border-radius: 50%;
}

.hero .subtle {
    color: rgba(255, 255, 255, .76);
}

.hero-label {
    margin-bottom: 8px;
    color: rgba(255, 255, 255, .75);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.hero-value {
    position: relative;
    z-index: 1;
    margin: 0;
    font-size: clamp(36px, 12vw, 58px);
    font-weight: 950;
    line-height: 1;
    letter-spacing: -.06em;
}

.hero-value small {
    margin-left: 5px;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0;
}

.hero-row {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
}

.hero-badge {
    flex: 0 0 auto;
    padding: 8px 11px;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 12px;
    background: rgba(255, 255, 255, .12);
    font-size: 12px;
    font-weight: 800;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.stat {
    min-width: 0;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}

.stat-label {
    overflow: hidden;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.stat-value {
    overflow: hidden;
    margin: 0;
    font-size: 22px;
    font-weight: 950;
    letter-spacing: -.04em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stat-accent {
    background: var(--surface-warm);
    border-color: #f3dfb5;
}

.notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 14px;
    padding: 13px 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    color: var(--ink);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    font-size: 13px;
}

.notice-success {
    border-color: #bce4cb;
    background: #edfbf2;
}

.notice-error {
    border-color: #f3c3c0;
    background: var(--danger-soft);
}

.notice-info {
    border-color: #c9dcf6;
    background: #f0f6ff;
}

.field {
    display: block;
}

.field + .field {
    margin-top: 14px;
}

.field label,
.label {
    display: block;
    margin: 0 0 7px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 850;
}

input,
select,
textarea {
    width: 100%;
    min-height: 50px;
    padding: 12px 14px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    outline: none;
    color: var(--ink);
    background: #fbfdfb;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(22, 132, 91, .11);
}

input:disabled,
select:disabled,
textarea:disabled {
    cursor: not-allowed;
    opacity: .55;
}

.btn {
    display: inline-flex;
    min-height: 48px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 16px;
    border: 0;
    border-radius: 15px;
    cursor: pointer;
    color: #fff;
    background: var(--primary);
    box-shadow: 0 8px 18px rgba(22, 132, 91, .18);
    font-weight: 900;
    text-align: center;
    transition: transform .12s ease, opacity .18s ease, background .18s ease;
}

.btn:active {
    transform: scale(.98);
}

.btn:disabled {
    cursor: not-allowed;
    opacity: .45;
    box-shadow: none;
}

.btn-block {
    width: 100%;
}

.btn-secondary {
    color: var(--primary-dark);
    background: var(--primary-soft);
    box-shadow: none;
}

.btn-neutral {
    color: var(--ink);
    background: #edf1ee;
    box-shadow: none;
}

.btn-accent {
    color: #4b2b00;
    background: var(--accent);
    box-shadow: 0 8px 18px rgba(255, 184, 77, .22);
}

.btn-danger {
    color: #a32d2d;
    background: #ffe2df;
    box-shadow: none;
}

.btn-sm {
    min-height: 40px;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 13px;
}

.button-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}

.form-row {
    display: grid;
    gap: 10px;
}

.pill {
    display: inline-flex;
    min-height: 27px;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    border-radius: 999px;
    color: var(--primary-dark);
    background: var(--primary-soft);
    font-size: 11px;
    font-weight: 850;
}

.pill-warm {
    color: var(--accent-dark);
    background: #fff0ca;
}

.pill-muted {
    color: var(--muted);
    background: #edf1ee;
}

.pill-danger {
    color: #a53232;
    background: #ffe5e2;
}

.turn-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 12px 0;
    padding: 12px 14px;
    border: 1px solid #f0d497;
    border-radius: 16px;
    background: #fff8e6;
    box-shadow: var(--shadow-soft);
}

.turn-banner strong {
    display: block;
    font-size: 14px;
}

.turn-banner span {
    color: var(--muted);
    font-size: 12px;
}

.action-dock {
    position: sticky;
    z-index: 30;
    bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px) + 8px);
    margin: 12px 0 18px;
    padding: 13px;
    border: 1px solid rgba(205, 224, 209, .92);
    border-radius: 22px;
    background: rgba(255, 255, 255, .95);
    box-shadow: 0 16px 38px rgba(33, 70, 52, .18);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.action-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}

.action-metric {
    padding: 9px 11px;
    border-radius: 13px;
    background: var(--surface-soft);
}

.action-metric span {
    display: block;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

.action-metric strong {
    display: block;
    overflow: hidden;
    margin-top: 2px;
    font-size: 19px;
    letter-spacing: -.03em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.raise-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    margin-top: 8px;
}

.raise-row input {
    min-width: 0;
}

.player-list,
.activity-list,
.transaction-list {
    display: grid;
    gap: 9px;
}

.player-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: var(--surface);
}

.player-item.is-turn {
    border-color: #ebcb83;
    background: #fff9ea;
    box-shadow: 0 6px 18px rgba(143, 96, 8, .08);
}

.player-item.is-folded,
.player-item.is-left {
    opacity: .58;
}

.player-avatar {
    display: grid;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 15px;
    color: var(--primary-dark);
    background: var(--primary-soft);
    font-size: 16px;
    font-weight: 950;
    text-transform: uppercase;
}

.player-main {
    min-width: 0;
    flex: 1;
}

.player-name {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 900;
}

.player-name span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-meta {
    overflow: hidden;
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-money {
    flex: 0 0 auto;
    text-align: right;
}

.player-money strong {
    display: block;
    color: var(--primary-dark);
    font-size: 16px;
    letter-spacing: -.025em;
}

.player-money span {
    color: var(--muted);
    font-size: 10px;
}

details.disclosure {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}

details.disclosure + details.disclosure {
    margin-top: 10px;
}

details.disclosure summary {
    display: flex;
    min-height: 50px;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    cursor: pointer;
    list-style: none;
    font-size: 13px;
    font-weight: 900;
}

details.disclosure summary::-webkit-details-marker {
    display: none;
}

details.disclosure summary::after {
    content: "+";
    color: var(--muted);
    font-size: 20px;
}

details.disclosure[open] summary::after {
    content: "−";
}

.disclosure-body {
    padding: 0 12px 12px;
}

.activity-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 2px;
    border-top: 1px solid #edf1ee;
    font-size: 12px;
}

.activity-item:first-child {
    border-top: 0;
}

.activity-item time {
    flex: 0 0 auto;
    color: var(--muted);
}

.empty-state {
    padding: 26px 18px;
    border: 1px dashed #cad9cc;
    border-radius: 20px;
    color: var(--muted);
    background: rgba(255, 255, 255, .55);
    text-align: center;
}

.empty-icon {
    display: grid;
    width: 52px;
    height: 52px;
    margin: 0 auto 11px;
    place-items: center;
    border-radius: 18px;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 25px;
}

.transaction-item {
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}

.transaction-top,
.transaction-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.transaction-name {
    overflow: hidden;
    font-size: 14px;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.transaction-amount {
    flex: 0 0 auto;
    font-size: 18px;
    font-weight: 950;
}

.amount-up {
    color: var(--primary);
}

.amount-down {
    color: var(--danger);
}

.amount-flat {
    color: var(--muted);
}

.transaction-bottom {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #edf1ee;
    color: var(--muted);
    font-size: 11px;
}

.transaction-note {
    margin: 9px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.admin-player {
    padding: 16px;
}

.admin-player-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 13px;
}

.admin-player-head .player-money strong {
    font-size: 20px;
}

.admin-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 9px;
}

.admin-actions .btn {
    min-width: 0;
    padding-inline: 8px;
}

.admin-grid {
    display: grid;
    gap: 14px;
}

.bottom-nav {
    position: fixed;
    z-index: 50;
    right: 0;
    bottom: 0;
    left: 0;
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid rgba(214, 228, 217, .9);
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 -8px 30px rgba(31, 65, 49, .08);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.bottom-nav-inner {
    display: grid;
    max-width: 560px;
    margin: auto;
    grid-template-columns: repeat(4, 1fr);
}

.nav-item {
    display: flex;
    min-width: 0;
    min-height: 54px;
    align-items: center;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    border-radius: 14px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
}

.nav-icon {
    font-size: 20px;
    line-height: 1;
    filter: grayscale(1);
    opacity: .72;
}

.nav-item.is-active {
    color: var(--primary-dark);
    background: var(--primary-soft);
}

.nav-item.is-active .nav-icon {
    filter: none;
    opacity: 1;
}

.install-panel {
    position: fixed;
    z-index: 80;
    right: 12px;
    bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px) + 12px);
    left: 12px;
    display: none;
    max-width: 520px;
    margin: auto;
    padding: 16px;
    border: 1px solid #c8decf;
    border-radius: 22px;
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 20px 54px rgba(21, 52, 39, .2);
}

.install-panel.is-visible {
    display: block;
    animation: slide-up .24s ease-out;
}

.install-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.install-copy {
    min-width: 0;
    flex: 1;
}

.install-copy strong {
    display: block;
    margin-bottom: 3px;
}

.install-copy p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

.install-close {
    display: grid;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    place-items: center;
    border: 0;
    border-radius: 11px;
    color: var(--muted);
    background: #edf1ee;
    cursor: pointer;
}

.install-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 13px;
}

.home-page {
    display: flex;
    min-height: calc(100vh - var(--nav-height) - 90px);
    min-height: calc(100dvh - var(--nav-height) - 90px);
    align-items: center;
}

.home-layout {
    width: 100%;
    display: grid;
    gap: 14px;
}

.welcome-art {
    min-height: 220px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.chip-stack {
    position: relative;
    width: 100px;
    height: 86px;
    margin: 8px 4px 0 auto;
}

.chip-stack i {
    position: absolute;
    display: block;
    width: 72px;
    height: 72px;
    border: 10px dashed rgba(255, 255, 255, .86);
    border-radius: 50%;
    background: #ef6868;
    box-shadow: 0 8px 18px rgba(0, 0, 0, .14);
}

.chip-stack i:nth-child(2) {
    right: 0;
    bottom: 0;
    background: #ffbc4e;
}

.desktop-only {
    display: none;
}

@keyframes slide-up {
    from { transform: translateY(18px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@media (min-width: 700px) {
    .page {
        padding: 28px 22px 42px;
    }

    .card-pad {
        padding: 22px;
    }

    .stat-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

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

    .form-row-action {
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: end;
    }

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

    .home-layout {
        grid-template-columns: 1.05fr .95fr;
        align-items: stretch;
    }

    .welcome-art {
        min-height: 390px;
    }

    .desktop-only {
        display: initial;
    }
}

@media (min-width: 980px) {
    .app-shell {
        padding-bottom: 34px;
    }

    .bottom-nav {
        position: sticky;
        top: calc(62px + env(safe-area-inset-top, 0px));
        bottom: auto;
        padding: 6px 16px;
        border-top: 0;
        border-bottom: 1px solid var(--line);
        box-shadow: none;
    }

    .bottom-nav-inner {
        max-width: 720px;
    }

    .nav-item {
        min-height: 46px;
        flex-direction: row;
        font-size: 12px;
    }

    .nav-icon {
        font-size: 17px;
    }

    .action-dock {
        bottom: 16px;
    }

    .install-panel {
        bottom: 22px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

/* Rooms and lobby */
.lobby-intro {
    display: flex;
    min-height: 230px;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 26px 20px;
}

.lobby-intro h1 {
    margin-bottom: 10px;
    font-size: clamp(36px, 9vw, 62px);
}

.lobby-chip-art {
    position: relative;
    width: 120px;
    height: 120px;
    flex: 0 0 auto;
}

.lobby-chip-art i {
    position: absolute;
    width: 76px;
    height: 76px;
    border: 9px dashed rgba(255, 255, 255, .9);
    border-radius: 50%;
    background: #ffb84d;
    box-shadow: 0 15px 35px rgba(37, 77, 57, .18);
}

.lobby-chip-art i:nth-child(1) { top: 0; left: 4px; background: #16845b; }
.lobby-chip-art i:nth-child(2) { right: 0; bottom: 2px; background: #ef6868; }
.lobby-chip-art i:nth-child(3) { bottom: 0; left: 0; width: 62px; height: 62px; background: #5a83df; }

.lobby-forms {
    display: grid;
    gap: 14px;
}

.create-room-card {
    background: linear-gradient(145deg, #fff, #f1f8ee);
}

.room-hero h1 {
    margin-bottom: 5px;
}

.room-code-badge {
    position: relative;
    z-index: 2;
    min-width: 100px;
    padding: 10px 13px;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 16px;
    color: #fff;
    background: rgba(255, 255, 255, .13);
    cursor: pointer;
}

.room-code-badge small,
.room-code-badge strong {
    display: block;
}

.room-code-badge small { font-size: 10px; opacity: .72; }
.room-code-badge strong { margin-top: 2px; font-size: 18px; letter-spacing: .08em; }

.room-list {
    display: grid;
    gap: 9px;
}

.room-list-item {
    display: flex;
    width: 100%;
    min-height: 66px;
    align-items: center;
    gap: 12px;
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 18px;
    color: var(--ink);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    cursor: pointer;
    text-align: left;
}

.room-list-icon {
    display: grid;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 14px;
    color: #fff;
    background: var(--primary);
    font-size: 20px;
}

.room-list-item strong,
.room-list-item small { display: block; }
.room-list-item strong { font-size: 14px; }
.room-list-item small { margin-top: 2px; color: var(--muted); font-size: 11px; letter-spacing: .08em; }

.toast {
    position: fixed;
    z-index: 120;
    right: 16px;
    bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px) + 14px);
    left: 16px;
    max-width: 360px;
    margin: auto;
    padding: 11px 14px;
    border-radius: 14px;
    color: #fff;
    background: rgba(23, 51, 42, .94);
    box-shadow: 0 12px 34px rgba(15, 40, 30, .25);
    font-size: 12px;
    font-weight: 800;
    text-align: center;
    transform: translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: .22s ease;
}

.toast.is-visible { transform: translateY(0); opacity: 1; }

/* Immersive poker table */
.game-body {
    overflow: hidden;
    color: #15392f;
    background: #eefcf7;
}

.game-screen {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 42%, rgba(99, 224, 177, .28), transparent 43%),
        radial-gradient(circle at 10% 8%, rgba(255, 208, 112, .25), transparent 30%),
        radial-gradient(circle at 92% 90%, rgba(90, 191, 255, .18), transparent 28%),
        linear-gradient(145deg, #fbfffb 0%, #e9faf2 52%, #dcf4ed 100%);
}

.game-screen::before {
    position: absolute;
    inset: 0;
    content: "";
    opacity: .58;
    background-image: linear-gradient(rgba(16,130,92,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(16,130,92,.035) 1px, transparent 1px);
    background-size: 32px 32px;
}

.game-hud {
    position: absolute;
    z-index: 50;
    top: env(safe-area-inset-top, 0px);
    right: 0;
    left: 0;
    display: flex;
    height: 58px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 7px max(14px, env(safe-area-inset-right, 0px)) 7px max(14px, env(safe-area-inset-left, 0px));
    color: #15392f;
    background: linear-gradient(to bottom, rgba(255, 255, 255, .94), rgba(255,255,255,.58) 70%, transparent);
}

.game-brand {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 900;
}

.game-brand .brand-mark { width: 34px; height: 34px; border-radius: 12px; }
.game-brand .brand-mark { background: linear-gradient(145deg, #26c786, #0b9665); box-shadow: 0 7px 18px rgba(11,150,101,.22); }
.game-brand .brand-mark svg { width: 20px; height: 20px; }
.game-brand > span:last-child { overflow: hidden; max-width: 160px; text-overflow: ellipsis; white-space: nowrap; }

.game-room-code {
    position: absolute;
    left: 50%;
    display: flex;
    align-items: center;
    gap: 7px;
    transform: translateX(-50%);
    color: #668077;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
}

.game-room-code button {
    padding: 5px 9px;
    border: 1px solid rgba(21,57,47,.11);
    border-radius: 9px;
    color: #116e50;
    background: rgba(255,255,255,.88);
    box-shadow: 0 4px 14px rgba(23,93,70,.08);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .1em;
    cursor: pointer;
}

.game-hud-actions { display: flex; align-items: center; gap: 7px; }
.game-icon-button { display: grid; width: 34px; height: 34px; padding:0; place-items: center; border: 1px solid rgba(21,57,47,.11); border-radius: 11px; color:#1d5a48; background: rgba(255,255,255,.82); box-shadow:0 4px 14px rgba(23,93,70,.08); cursor:pointer; }
.game-hud-actions form { margin:0; }

.live-dot {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-right: 3px;
    color: #58756b;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
}

.live-dot i { width: 7px; height: 7px; border-radius: 50%; background: #16b876; box-shadow: 0 0 0 4px rgba(22,184,118,.13); animation: live-pulse 1.8s infinite; }

.game-flash {
    position: absolute;
    z-index: 80;
    top: 60px;
    left: 50%;
    padding: 8px 13px;
    border: 1px solid rgba(105, 239, 163, .35);
    border-radius: 12px;
    color: #c9ffdf;
    background: rgba(14, 73, 49, .92);
    box-shadow: 0 10px 28px rgba(0,0,0,.22);
    font-size: 11px;
    font-weight: 800;
    transform: translateX(-50%);
    animation: flash-away .35s 3.2s forwards;
}

.game-flash.is-error { color: #ffd6d1; border-color: rgba(255,130,120,.35); background: rgba(94,34,31,.94); }

.poker-arena {
    position: relative;
    z-index: 2;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
}

.poker-table-wrap {
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(68vw, 900px);
    height: min(61vh, 500px);
    transform: translate(-50%, -48%);
}

.poker-rail,
.poker-table {
    position: absolute;
    inset: 0;
    border-radius: 50%;
}

.poker-rail {
    inset: -15px;
    background: linear-gradient(155deg, #fff0ae 0%, #e9a83b 26%, #ffd977 54%, #c98324 77%, #ffe9a2 100%);
    box-shadow: 0 24px 55px rgba(36,115,84,.20), 0 8px 22px rgba(147,94,16,.16), inset 0 3px 3px rgba(255,255,255,.7), inset 0 -5px 8px rgba(132,75,10,.28);
}

.poker-table {
    overflow: hidden;
    border: 8px solid #f8fff9;
    background: radial-gradient(ellipse at 50% 42%, #50dda9 0%, #24bb84 50%, #0d9167 100%);
    box-shadow: inset 0 0 68px rgba(2,94,64,.24), inset 0 2px 0 rgba(255,255,255,.5), 0 0 0 2px rgba(7,123,85,.1);
}

.felt-pattern { position: absolute; inset: 0; width: 100%; height: 100%; }

.table-center {
    position: absolute;
    top: 50%;
    left: 50%;
    display: flex;
    align-items: center;
    flex-direction: column;
    transform: translate(-50%, -50%);
}

.community-cards { display: flex; gap: 5px; height: 54px; align-items: center; }
.community-card { display: grid; width: 35px; height: 48px; place-items: center; border: 1px solid rgba(255,255,255,.42); border-radius: 7px; background: rgba(5,116,79,.25); box-shadow: inset 0 0 0 2px rgba(255,255,255,.08); transform: translateY(5px) rotate(var(--card-tilt, 0deg)); }
.community-card:nth-child(1) { --card-tilt: -3deg; }
.community-card:nth-child(2) { --card-tilt: -1deg; }
.community-card:nth-child(4) { --card-tilt: 1deg; }
.community-card:nth-child(5) { --card-tilt: 3deg; }
.community-card.is-revealed { color: #d83f4a; border-color: rgba(255,255,255,.7); background: linear-gradient(145deg,#fff,#e9f0eb); box-shadow: 0 6px 12px rgba(0,0,0,.18); transform: translateY(0) rotate(var(--card-tilt)); animation: deal-card .36s ease-out both; }
.community-card i { font-size: 20px; font-style: normal; }

.pot-display { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 7px 12px; border: 1px solid rgba(255,255,255,.7); border-radius: 14px; color:#15392f; background: rgba(255,255,255,.82); box-shadow: 0 8px 20px rgba(4,91,62,.14); backdrop-filter: blur(8px); }
.pot-display small, .pot-display strong { display: block; }
.pot-display small { color: #55776b; font-size: 8px; font-weight: 800; text-transform: uppercase; }
.pot-display strong { font-size: 19px; line-height: 1.1; letter-spacing: -.03em; }

.chip-pile { position: relative; width: 42px; height: 32px; }
.chip-pile i, .flying-chip { position: absolute; width: 27px; height: 27px; border: 5px dashed #fff; border-radius: 50%; background: #ffb84d; box-shadow: 0 4px 8px rgba(0,0,0,.22); }
.chip-pile i:nth-child(1) { left: 0; top: 3px; background:#ef6666; }
.chip-pile i:nth-child(2) { left: 13px; top: 0; background:#4b78d6; }
.chip-pile i:nth-child(3) { left: 8px; top: 7px; }

.phase-ribbon { margin-top: 7px; padding:3px 8px; border-radius:8px; color: #f2fff8; background:rgba(5,105,72,.42); font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }

.table-seat {
    position: absolute;
    z-index: 12;
    top: var(--seat-y);
    left: var(--seat-x);
    display: flex;
    min-width: 132px;
    align-items: center;
    gap: 7px;
    padding: 6px 9px 6px 6px;
    border: 1px solid rgba(18,101,75,.13);
    border-radius: 16px;
    color:#173d32;
    background: rgba(255,255,255,.94);
    box-shadow: 0 10px 24px rgba(18,92,68,.17), inset 0 1px 0 rgba(255,255,255,.8);
    transform: translate(-50%, -50%);
    transition: opacity .2s ease, box-shadow .2s ease, transform .2s ease;
}

.table-seat.is-me { border-color: rgba(230,157,34,.5); background: rgba(255,248,218,.97); }
.table-seat.is-turn { box-shadow: 0 0 0 3px rgba(255,184,77,.25), 0 0 30px rgba(245,170,44,.34), 0 10px 24px rgba(18,92,68,.14); transform: translate(-50%, -50%) scale(1.04); }
.table-seat.is-folded { opacity: .42; filter: grayscale(.65); }

.seat-avatar { position: relative; display: grid; width: 36px; height: 36px; flex: 0 0 auto; place-items: center; border-radius: 12px; color: #0b6848; background: linear-gradient(145deg,#e9fff1,#9eddb9); font-size: 14px; font-weight: 950; }
.is-me .seat-avatar { color:#714500; background:linear-gradient(145deg,#fff4d0,#ffbd52); }
.turn-ring { position:absolute; inset:-5px; border:2px solid #ffbd52; border-radius:15px; animation: turn-pulse 1.2s infinite; }

.seat-info { min-width:0; flex:1; }
.seat-name { overflow:hidden; max-width:84px; font-size:11px; font-weight:900; text-overflow:ellipsis; white-space:nowrap; }
.seat-name em { color:#ae6d00; font-size:8px; font-style:normal; text-transform:uppercase; }
.seat-stack { display:flex; align-items:center; gap:4px; margin-top:2px; color:#94600b; font-size:11px; font-weight:900; }
.mini-chip { width:9px; height:9px; border:2px dotted #fff; border-radius:50%; background:#ffb84d; }
.seat-bet { color:#688179; font-size:8px; }
.dealer-button { position:absolute; top:-8px; right:-7px; display:grid; width:20px; height:20px; place-items:center; border:2px solid #c9c9c9; border-radius:50%; color:#232d29; background:#fff; box-shadow:0 3px 7px rgba(0,0,0,.25); font-size:9px; font-weight:950; }
.seat-status { position:absolute; right:5px; bottom:-9px; padding:2px 6px; border-radius:7px; color:#fff; background:#d44b4b; font-size:7px; font-weight:900; text-transform:uppercase; }

.game-action-panel { position:absolute; z-index:35; right:max(14px,env(safe-area-inset-right,0px)); bottom:max(12px,env(safe-area-inset-bottom,0px)); width:min(330px,38vw); padding:10px; border:1px solid rgba(18,101,75,.12); border-radius:18px; color:#173d32; background:rgba(255,255,255,.94); box-shadow:0 18px 45px rgba(30,101,76,.18); backdrop-filter:blur(16px); }
.game-action-panel.is-your-turn { border-color:rgba(235,163,39,.5); box-shadow:0 0 0 3px rgba(255,184,77,.12),0 18px 45px rgba(30,101,76,.18); }
.waiting-panel { display:flex; align-items:center; gap:10px; min-height:44px; }
.waiting-panel strong,.waiting-panel small { display:block; }
.waiting-panel strong { font-size:12px; }
.waiting-panel small { margin-top:2px; color:#6a8279; font-size:9px; }
.waiting-orbit { width:29px; height:29px; flex:0 0 auto; border:2px solid rgba(17,111,79,.13); border-top-color:#18b978; border-radius:50%; animation:spin 1.2s linear infinite; }
.showdown-icon { display:grid; width:30px; height:30px; flex:0 0 auto; place-items:center; border-radius:10px; color:#663900; background:#ffc35e; }

.your-turn-title { display:flex; align-items:center; justify-content:space-between; margin:0 2px 7px; }
.your-turn-title span { color:#a96500; font-size:10px; font-weight:900; text-transform:uppercase; }
.your-turn-title small { color:#6a8279; font-size:9px; }
.game-actions-primary { display:grid; grid-template-columns:1fr 1fr; gap:7px; }
.game-action { width:100%; min-height:46px; padding:7px 9px; border:0; border-radius:12px; color:#fff; cursor:pointer; text-align:left; }
.game-action small,.game-action strong { display:block; }
.game-action small { opacity:.68; font-size:8px; }
.game-action strong { margin-top:1px; font-size:13px; }
.game-action.call { background:linear-gradient(145deg,#1aa970,#0c7b51); }
.game-action.fold { background:linear-gradient(145deg,#ef6c67,#c94a4a); }
.game-raise { display:grid; grid-template-columns:1fr auto; gap:7px; margin-top:7px; }
.game-raise > div { position:relative; }
.game-raise label { position:absolute; z-index:2; top:5px; left:10px; color:#789087; font-size:7px; font-weight:800; text-transform:uppercase; }
.game-raise input { min-height:43px; padding:15px 9px 4px; border-color:#d7e8e0; border-radius:11px; color:#173d32; background:#f4faf7; font-size:11px; }
.game-raise button { min-width:70px; border:0; border-radius:11px; color:#472900; background:#ffb84d; font-size:11px; font-weight:950; cursor:pointer; }
.game-raise button:disabled { opacity:.4; cursor:not-allowed; }

.game-log { position:absolute; z-index:30; bottom:max(12px,env(safe-area-inset-bottom,0px)); left:max(14px,env(safe-area-inset-left,0px)); width:180px; border:1px solid rgba(18,101,75,.11); border-radius:13px; color:#173d32; background:rgba(255,255,255,.91); box-shadow:0 10px 30px rgba(30,101,76,.14); backdrop-filter:blur(12px); }
.game-log summary { display:flex; align-items:center; justify-content:space-between; padding:8px 10px; cursor:pointer; list-style:none; font-size:9px; font-weight:900; text-transform:uppercase; }
.game-log summary::-webkit-details-marker{display:none}.game-log summary span{display:grid;min-width:20px;height:20px;place-items:center;border-radius:7px;background:#e5f5ed}
.game-log > div { max-height:145px; overflow:auto; padding:0 9px 7px; }
.game-log p { display:flex; justify-content:space-between; gap:7px; margin:0; padding:6px 1px; border-top:1px solid #e5efe9; font-size:8px; }
.game-log p span { color:#698179; text-align:right; }

.game-empty { position:absolute; z-index:20; top:50%; left:50%; display:flex; align-items:center; flex-direction:column; transform:translate(-50%,-50%); text-align:center; }
.game-empty strong,.game-empty span{display:block}.game-empty span{margin-top:5px;color:#6a8279;font-size:10px}

.chip-fx-layer { position:fixed; z-index:100; inset:0; overflow:hidden; pointer-events:none; }
.flying-chip { z-index:101; width:25px; height:25px; transform:translate(-50%,-50%); }
.chip-impact { position:absolute; width:50px; height:50px; border:2px solid #ffd47d; border-radius:50%; transform:translate(-50%,-50%) scale(.2); opacity:0; animation:chip-impact .48s ease-out; }

.rotate-gate { display:none; }

@keyframes live-pulse { 50% { opacity:.45; box-shadow:0 0 0 7px rgba(88,228,147,0); } }
@keyframes turn-pulse { 50% { opacity:.45; transform:scale(1.08); } }
@keyframes spin { to { transform:rotate(360deg); } }
@keyframes deal-card { from { opacity:0; transform:translateY(-18px) rotate(var(--card-tilt)); } }
@keyframes chip-impact { 25%{opacity:1} to{opacity:0;transform:translate(-50%,-50%) scale(1.5)} }
@keyframes flash-away { to { opacity:0; transform:translate(-50%,-12px); pointer-events:none; } }

@media (min-width: 760px) {
    .lobby-forms { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .room-list { grid-template-columns:repeat(2,minmax(0,1fr)); }
}

@media (max-width: 760px) and (orientation: portrait) {
    .game-body:not(.allow-portrait) .rotate-gate { position:fixed; z-index:200; inset:0; display:flex; align-items:center; flex-direction:column; justify-content:center; padding:28px; color:var(--ink); background:radial-gradient(circle at top,#fff5d8,#eef7eb 58%,#dfeee1); text-align:center; }
    .rotate-gate h2{margin:18px 0 7px;font-size:26px}.rotate-gate p{max-width:320px;margin:0 0 18px;color:var(--muted);font-size:13px}
    .rotate-phone{position:relative;width:72px;height:116px;border:5px solid var(--primary);border-radius:18px;animation:rotate-device 2.4s ease-in-out infinite}.rotate-phone span{position:absolute;bottom:7px;left:50%;width:8px;height:8px;border:2px solid var(--primary);border-radius:50%;transform:translateX(-50%)}
    .allow-portrait .poker-table-wrap{width:82vw;height:42vh}.allow-portrait .table-seat{min-width:105px}.allow-portrait .seat-avatar{width:30px;height:30px}.allow-portrait .game-action-panel{right:10px;left:10px;width:auto}.allow-portrait .game-log{display:none}
}

@keyframes rotate-device { 0%,25%{transform:rotate(0)} 60%,100%{transform:rotate(90deg)} }

@media (max-height: 440px) and (orientation: landscape) {
    .poker-table-wrap { width:min(62vw,680px); height:min(62vh,285px); transform:translate(-53%,-45%); }
    .poker-rail { inset:-10px; }
    .poker-table { border-width:6px; }
    .table-seat { min-width:108px; padding:4px 7px 4px 4px; border-radius:13px; }
    .seat-avatar { width:29px; height:29px; border-radius:9px; font-size:11px; }
    .seat-name,.seat-stack { font-size:9px; }
    .community-cards { height:39px; gap:3px; }
    .community-card { width:26px; height:36px; border-radius:5px; }
    .community-card i { font-size:15px; }
    .pot-display { margin-top:5px; padding:5px 9px; }
    .pot-display strong { font-size:15px; }
    .chip-pile { transform:scale(.78); transform-origin:left center; width:35px; }
    .phase-ribbon { margin-top:4px; font-size:7px; }
    .game-action-panel { width:min(285px,35vw); padding:8px; }
    .game-action { min-height:39px; padding:5px 7px; }
    .game-raise input { min-height:38px; }
    .game-log { width:150px; }
}

@media (display-mode: standalone), (display-mode: fullscreen) {
    .browser-only {
        display: none !important;
    }
}
