:root {
    --bg: #071613;
    --bg-2: #102522;
    --table: #116147;
    --table-deep: #07382b;
    --table-bright: #1d7d5d;
    --panel: rgba(13, 30, 27, 0.78);
    --panel-strong: rgba(8, 24, 22, 0.92);
    --panel-light: #f6f1e7;
    --line: rgba(255, 255, 255, 0.18);
    --line-strong: rgba(255, 255, 255, 0.32);
    --gold: #e7bc5b;
    --gold-2: #b7832b;
    --red: #c43d3a;
    --ink: #12201f;
    --muted: rgba(255, 255, 255, 0.68);
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.34);
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

html {
    width: 100%;
    min-height: 100%;
    background: var(--bg);
}

body {
    margin: 0;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    background:
        linear-gradient(120deg, rgba(231, 188, 91, 0.08), transparent 34%),
        linear-gradient(180deg, #0d1d1a 0%, #071613 100%);
    color: #fff;
    font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
    letter-spacing: 0;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
}

.screen {
    display: none;
    width: 100vw;
    min-height: 100vh;
    min-height: 100dvh;
}

.screen.active {
    display: block;
}

.lobby-shell,
.room-shell {
    width: min(1120px, calc(100vw - 32px));
    min-height: 100vh;
    margin: 0 auto;
}

.lobby-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(340px, 420px);
    align-items: center;
    gap: 28px;
    padding: 28px 0;
}

.brand-panel {
    min-height: 560px;
    display: grid;
    align-content: end;
    padding: 44px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background:
        linear-gradient(180deg, transparent 0%, rgba(4, 16, 14, 0.78) 68%),
        radial-gradient(circle at 70% 24%, rgba(231, 188, 91, 0.22), transparent 28%),
        linear-gradient(135deg, #164b3a, #09201b 66%);
    box-shadow: var(--shadow);
}

.brand-kicker {
    width: fit-content;
    padding: 6px 10px;
    border: 1px solid rgba(231, 188, 91, 0.48);
    border-radius: 999px;
    color: #ffdf8c;
    font-size: 0.84rem;
}

.brand-panel h1 {
    margin: 16px 0 12px;
    font-size: clamp(3.2rem, 9vw, 6.6rem);
    line-height: 0.96;
    letter-spacing: 0;
}

.brand-panel p {
    width: min(620px, 100%);
    margin: 0;
    color: rgba(255, 255, 255, 0.78);
    font-size: 1.04rem;
    line-height: 1.72;
}

.brand-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 28px;
}

.brand-stats span {
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff5d5;
    font-size: 0.9rem;
}

.lobby-card,
.room-shell {
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: var(--radius);
    background: rgba(246, 241, 231, 0.96);
    color: var(--ink);
    box-shadow: var(--shadow);
}

.lobby-card {
    padding: 24px;
}

.field {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}

.field label,
.room-list-header,
.label {
    color: #65736e;
    font-size: 0.9rem;
}

.field input {
    width: 100%;
    height: 46px;
    padding: 0 13px;
    border: 1px solid #d8d2c6;
    border-radius: 6px;
    outline: none;
    background: #fffdf8;
    color: var(--ink);
}

.field input:focus {
    border-color: #b7832b;
    box-shadow: 0 0 0 3px rgba(183, 131, 43, 0.18);
}

.lobby-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.lobby-actions .ghost {
    grid-column: 1 / -1;
}

.btn {
    min-height: 42px;
    padding: 0 15px;
    border: 1px solid transparent;
    border-radius: 6px;
    font-weight: 800;
    color: var(--ink);
    background: #ece6da;
    transition: transform 120ms ease, border-color 120ms ease, filter 120ms ease;
}

.btn:hover {
    filter: brightness(1.02);
}

.btn:active {
    transform: translateY(1px);
}

.btn.primary {
    color: #fff;
    background: linear-gradient(180deg, #c94d3f, #8f2c2a);
}

.btn.secondary {
    color: #17342d;
    border-color: #cfc7b8;
    background: #fffaf0;
}

.btn.warning {
    color: #211506;
    background: linear-gradient(180deg, #f4ce77, #c58a2d);
}

.btn.ghost {
    color: #fff2cf;
    border-color: rgba(255, 255, 255, 0.24);
    background: rgba(255, 255, 255, 0.09);
}

.lobby-card .btn.ghost,
.room-shell .btn.ghost {
    color: var(--ink);
    border-color: #cfc7b8;
    background: #eee7db;
}

.btn.compact {
    min-height: 34px;
    padding: 0 11px;
}

.btn.wide {
    width: 100%;
}

.link-btn {
    border: 0;
    background: transparent;
    color: #9c352f;
    font-weight: 800;
}

.room-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 18px 0 8px;
}

.room-list {
    display: grid;
    gap: 8px;
    max-height: 190px;
    overflow: auto;
}

.room-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid #ddd5c8;
    border-radius: 6px;
    background: #fffdf8;
}

.room-item span {
    display: block;
    margin-top: 2px;
    color: #6b756f;
    font-size: 0.85rem;
}

.room-item button {
    min-height: 32px;
}

.room-shell {
    display: grid;
    align-content: center;
    gap: 20px;
    padding: 26px;
}

.room-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.room-topbar .label,
.room-topbar strong {
    display: block;
}

.room-topbar strong {
    margin-top: 4px;
    font-size: 2rem;
}

.seat-board {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.seat-card {
    min-height: 116px;
    display: grid;
    align-content: center;
    gap: 8px;
    padding: 14px;
    border: 1px solid #ddd5c8;
    border-radius: var(--radius);
    background: #fffdf8;
    color: var(--ink);
    text-align: center;
}

.seat-card.occupied {
    border-color: rgba(183, 131, 43, 0.8);
    background: #fff6df;
}

.seat-card.me {
    border-color: #b93d34;
    box-shadow: 0 0 0 3px rgba(185, 61, 52, 0.16);
}

.seat-role,
.seat-label {
    color: #6b756f;
    font-size: 0.84rem;
}

.room-note {
    margin: 0;
    color: #6b756f;
    text-align: center;
}

.table-shell {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 6px;
    padding: max(6px, env(safe-area-inset-top)) max(6px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
    overflow: hidden;
}

.game-hud {
    display: grid;
    grid-template-columns: repeat(6, minmax(92px, 1fr)) auto;
    gap: 8px;
    align-items: stretch;
}

.hud-item {
    min-height: 54px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(7, 19, 17, 0.72);
}

.hud-item span {
    display: block;
    margin-bottom: 3px;
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.76rem;
}

.hud-item strong {
    font-size: 1rem;
}

.trump-hud {
    border-color: rgba(231, 188, 91, 0.48);
    background: linear-gradient(180deg, rgba(62, 42, 14, 0.82), rgba(7, 19, 17, 0.78));
}

.trump-inline {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #fff3c4;
    white-space: nowrap;
}

.trump-inline.red,
.trump-hint .red {
    color: #ffb2a8;
}

.trump-inline.muted {
    color: rgba(255, 255, 255, 0.72);
}

.trump-suit {
    font-size: 1.08em;
    line-height: 1;
}

.game-hud > .btn {
    min-width: 86px;
    min-height: 54px;
}

.table-felt {
    position: relative;
    min-height: 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 18px;
    background:
        radial-gradient(ellipse at center, rgba(41, 155, 111, 0.95), transparent 42%),
        linear-gradient(120deg, rgba(255, 255, 255, 0.1), transparent 36%),
        linear-gradient(180deg, var(--table-bright), var(--table) 48%, var(--table-deep));
    box-shadow: inset 0 0 0 10px rgba(255, 255, 255, 0.06), var(--shadow);
}

.table-felt::before {
    content: "";
    position: absolute;
    inset: 16px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 14px;
    pointer-events: none;
}

.table-felt::after {
    content: "";
    position: absolute;
    left: clamp(170px, 18vw, 260px);
    right: clamp(170px, 18vw, 260px);
    top: clamp(120px, 22vh, 180px);
    bottom: clamp(160px, 25vh, 230px);
    border: 2px dashed rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    pointer-events: none;
}

.landscape-btn {
    position: absolute;
    z-index: 14;
    top: 12px;
    right: 12px;
    min-width: 62px;
    min-height: 38px;
    display: none;
    place-items: center;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(7, 19, 17, 0.76);
    color: #fff2cb;
    font-weight: 900;
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.28);
}

.landscape-btn.active {
    border-color: rgba(231, 188, 91, 0.86);
    background: rgba(151, 103, 15, 0.9);
}

.player-panel {
    position: absolute;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 154px;
    max-width: 210px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius);
    background: rgba(4, 24, 19, 0.78);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}

.player-panel > div:last-child {
    position: relative;
    min-width: 0;
}

.player-panel strong,
.player-panel span {
    display: block;
    overflow: hidden;
    max-width: 130px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-panel strong {
    font-size: 1rem;
}

.player-panel span {
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.84rem;
}

.team-role {
    display: inline-grid !important;
    place-items: center;
    width: max-content;
    max-width: none !important;
    margin-top: 2px;
    padding: 2px 6px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.72) !important;
    font-size: 0.7rem !important;
    font-weight: 900;
    line-height: 1.1;
}

.team-role.banker {
    border-color: rgba(231, 188, 91, 0.76);
    background: rgba(244, 206, 119, 0.2);
    color: #fff0bd !important;
}

.player-panel.active-turn {
    border-color: rgba(231, 188, 91, 0.9);
    box-shadow: 0 0 0 3px rgba(231, 188, 91, 0.22), 0 10px 30px rgba(0, 0, 0, 0.18);
}

.player-panel.banker {
    border-color: rgba(231, 188, 91, 0.72);
}

.avatar {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(180deg, #f6d982, #b77e23);
    color: #211506;
    font-weight: 900;
}

.opponent-top {
    top: 22px;
    left: 50%;
    transform: translateX(-50%);
}

.opponent-left {
    left: 24px;
    top: 46%;
    transform: translateY(-50%);
}

.opponent-right {
    right: 24px;
    top: 46%;
    transform: translateY(-50%);
}

.kitty-cards {
    position: absolute;
    z-index: 4;
    top: 124px;
    left: 50%;
    display: grid;
    justify-items: center;
    gap: 7px;
    transform: translateX(-50%);
}

.kitty-label {
    color: #fff0bd;
    font-size: 0.84rem;
    font-weight: 800;
}

.hole-cards {
    display: flex;
    gap: 7px;
}

.koupai-cards {
    position: absolute;
    z-index: 8;
    top: 18px;
    left: 18px;
    display: grid;
    max-width: 156px;
    padding: 8px;
    gap: 5px;
    border: 1px solid rgba(255, 226, 132, 0.52);
    border-radius: 8px;
    background: rgba(5, 30, 24, 0.86);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

.koupai-cards[hidden] {
    display: none;
}

.koupai-label {
    color: #ffe59a;
    font-size: 0.74rem;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.koupai-card-list {
    display: flex;
    gap: 3px;
}

.koupai-card-list .card.small {
    width: 28px;
    height: 40px;
    flex-basis: 28px;
    padding: 3px;
    border-radius: 5px;
}

.koupai-card-list .card.small .rank,
.koupai-card-list .card.small .suit {
    font-size: 0.66rem;
}

.card-back,
.card {
    width: 54px;
    height: 76px;
    border-radius: 7px;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.24);
}

.card-back {
    border: 2px solid rgba(255, 255, 255, 0.84);
    background:
        linear-gradient(45deg, rgba(255, 255, 255, 0.13) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.13) 50%, rgba(255, 255, 255, 0.13) 75%, transparent 75%),
        linear-gradient(135deg, #c83d3b, #81211f);
    background-size: 14px 14px, auto;
}

.center-play-area {
    position: absolute;
    z-index: 2;
    inset: 190px 190px 170px;
}

.center-message {
    position: absolute;
    top: 6px;
    left: 50%;
    z-index: 5;
    max-width: min(90vw, 520px);
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(4, 19, 16, 0.66);
    color: #fff2c2;
    font-weight: 800;
    text-align: center;
    transform: translateX(-50%);
}

.trump-hint {
    position: absolute;
    top: 46px;
    left: 50%;
    z-index: 4;
    display: inline-grid;
    grid-template-columns: auto auto auto;
    align-items: center;
    gap: 7px;
    max-width: min(92vw, 560px);
    padding: 6px 11px;
    border: 1px solid rgba(231, 188, 91, 0.36);
    border-radius: 999px;
    background: rgba(7, 22, 18, 0.68);
    color: rgba(255, 255, 255, 0.76);
    font-size: 0.82rem;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
    transform: translateX(-50%);
}

.trump-hint strong {
    color: #fff2bf;
    font-size: 0.98rem;
}

.trump-title,
.trump-sub {
    white-space: nowrap;
}

.liangzhu-display {
    position: absolute;
    bottom: 12px;
    max-width: 100%;
    color: rgba(255, 255, 255, 0.72);
    text-align: center;
}

.played-grid {
    position: absolute;
    top: 86px;
    left: 50%;
    width: min(560px, 50vw);
    height: 128px;
    transform: translateX(-50%);
}

.played-slot {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 112px;
    min-height: 64px;
    gap: 6px;
}

.played-slot .card {
    width: 46px;
    height: 64px;
    flex-basis: 46px;
    padding: 6px;
}

.played-slot .card .rank,
.played-slot .card .suit {
    font-size: 0.9rem;
}

.played-slot.top {
    top: 0;
    left: 50%;
    transform: translateX(-50%);
}

.played-slot.left {
    left: 0;
    top: 50%;
    transform: translateY(-50%);
}

.played-slot.right {
    right: 0;
    top: 50%;
    transform: translateY(-50%);
}

.played-slot.bottom {
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
}

.my-hand-area {
    position: absolute;
    z-index: 8;
    left: clamp(18px, 3vw, 44px);
    right: clamp(18px, 3vw, 44px);
    bottom: 16px;
    display: grid;
    grid-template-rows: auto auto;
    gap: 8px;
    padding: 12px 14px 14px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: var(--radius);
    background: rgba(5, 22, 18, 0.76);
    box-shadow: 0 -10px 34px rgba(0, 0, 0, 0.2);
}

.my-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 28px;
}

.my-info > div:first-child {
    display: flex;
    align-items: baseline;
    flex: 0 0 auto;
    gap: 8px;
    min-width: max-content;
}

.my-info strong,
.my-info span {
    display: inline-block;
}

.my-info span {
    color: rgba(255, 255, 255, 0.72);
}

.banker-badge {
    display: none !important;
    margin-left: auto !important;
    padding: 4px 8px;
    border-radius: 999px;
    background: #f4ce77;
    color: #211506 !important;
    font-weight: 900;
}

.banker-badge.visible {
    display: inline-flex !important;
}

.hand-prompt {
    display: none;
    flex: 1 1 auto;
    justify-content: center;
    min-width: 0;
    padding: 5px 9px;
    border: 1px solid rgba(244, 206, 119, 0.46);
    border-radius: 999px;
    background: rgba(244, 206, 119, 0.15);
    color: #fff0bd !important;
    font-size: 0.82rem;
    font-weight: 800;
    line-height: 1.2;
    text-align: center;
    white-space: normal;
}

.hand-prompt.visible {
    display: inline-flex;
}

.my-hand {
    --hand-card-w: 64px;
    --hand-card-h: 92px;
    --hand-card-pad: 8px;
    --hand-card-rank: 1.06rem;
    --hand-card-suit: 1.16rem;
    --hand-height: 106px;
    --selected-lift: 18px;
    position: relative;
    min-height: var(--hand-height);
    display: block;
    padding: 0;
    overflow: visible;
    touch-action: manipulation;
    contain: layout;
}

.my-hand .card {
    position: absolute;
    left: var(--card-x, 0);
    top: var(--card-y, var(--selected-lift));
    width: var(--hand-card-w);
    height: var(--hand-card-h);
    flex-basis: var(--hand-card-w);
    margin-left: 0;
    padding: var(--hand-card-pad);
    z-index: var(--card-index, 1);
}

.my-hand .card.selected {
    z-index: calc(var(--card-index, 1) + 200);
}

.card {
    position: relative;
    flex: 0 0 54px;
    display: block;
    margin-left: -20px;
    padding: 7px;
    border: 1px solid #d9dedb;
    border-radius: 7px;
    background:
        linear-gradient(145deg, #fff 0%, #f6f6f4 100%);
    color: #17232a;
    overflow: hidden;
    user-select: none;
    transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

.card:first-child {
    margin-left: 0;
}

.card.selectable:hover {
    transform: translateY(-8px);
}

.card.selected {
    transform: translateY(calc(-1 * var(--selected-lift, 18px)));
    border-color: #e7bc5b;
    box-shadow: 0 18px 30px rgba(0, 0, 0, 0.34);
}

.card.disabled {
    cursor: not-allowed;
    opacity: 0.42;
    filter: grayscale(0.35);
}

.card.disabled:hover {
    transform: none;
}

.card.red {
    color: var(--red);
}

.card .rank {
    position: relative;
    z-index: 2;
    max-width: 100%;
    font-size: 1.04rem;
    font-weight: 900;
    line-height: 0.95;
    letter-spacing: 0;
    white-space: nowrap;
    text-align: left;
}

.card .suit {
    position: relative;
    z-index: 2;
    font-size: 1.14rem;
    line-height: 0.95;
    letter-spacing: 0;
    text-align: left;
}

.card .corner {
    position: absolute;
    z-index: 3;
    top: 5px;
    left: 5px;
    display: grid;
    justify-items: center;
    gap: 2px;
    min-width: 18px;
    width: auto;
    pointer-events: none;
}

.card .corner .rank,
.card .corner .suit {
    display: block;
}

.my-hand .card .rank {
    font-size: var(--hand-card-rank);
}

.my-hand .card .suit {
    font-size: var(--hand-card-suit);
}

.my-hand .card.long-rank:not(.joker-card) .rank {
    font-size: max(0.68rem, calc(var(--hand-card-rank) * 0.86));
}

.card .pip {
    position: absolute;
    right: 7px;
    bottom: 7px;
    z-index: 1;
    color: currentColor;
    font-size: 1.9rem;
    font-weight: 900;
    line-height: 1;
    opacity: 0.94;
    pointer-events: none;
}

.my-hand .card .corner {
    top: var(--hand-card-pad);
    left: var(--hand-card-pad);
}

.my-hand .card .pip {
    right: var(--hand-card-pad);
    bottom: var(--hand-card-pad);
    font-size: clamp(1.35rem, calc(var(--hand-card-suit) * 2.12), 2.75rem);
}

.card.joker-card .corner {
    justify-items: center;
}

.card.joker-card .rank {
    writing-mode: vertical-rl;
    text-orientation: upright;
    font-size: max(0.78rem, calc(var(--hand-card-rank, 1rem) * 0.86));
    line-height: 0.88;
}

.card.joker-card .suit {
    font-size: max(0.78rem, calc(var(--hand-card-suit, 1rem) * 0.92));
}

.card.joker-card .pip {
    right: 9px;
    bottom: 9px;
    font-size: clamp(1.2rem, calc(var(--hand-card-suit, 1rem) * 1.65), 2.2rem);
}

.card.small {
    width: 42px;
    height: 58px;
    flex-basis: 42px;
    margin-left: -16px;
    padding: 5px;
}

.card.small .rank,
.card.small .suit {
    font-size: 0.82rem;
}

.card.small .corner {
    top: 4px;
    left: 4px;
    width: calc(100% - 8px);
}

.card.small .pip {
    right: 4px;
    bottom: 4px;
    font-size: 1.05rem;
}

.empty-zone {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.88rem;
}

.my-hand .empty-zone {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    text-align: center;
}

.action-dock {
    display: flex;
    justify-content: center;
    gap: 10px;
    min-height: 48px;
    padding: 2px 0 0;
}

.action-dock .btn {
    min-width: 106px;
}

.action-dock .btn[hidden],
.reconnect-btn[hidden] {
    display: none;
}

.reconnect-btn {
    justify-self: center;
    min-width: 124px;
}

.toast {
    position: fixed;
    z-index: 40;
    left: 50%;
    bottom: 92px;
    width: max-content;
    max-width: min(92vw, 560px);
    padding: 12px 16px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.82);
    color: #fff;
    transform: translateX(-50%);
    box-shadow: var(--shadow);
    text-align: center;
}

.modal {
    position: fixed;
    z-index: 50;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, 0.58);
}

.modal[hidden],
.toast[hidden] {
    display: none;
}

.modal-content {
    width: min(92vw, 420px);
    padding: 24px;
    border-radius: var(--radius);
    background: #fffaf0;
    color: var(--ink);
    box-shadow: var(--shadow);
}

.result-summary {
    display: grid;
    gap: 10px;
    margin: 16px 0 18px;
    text-align: left;
}

.result-summary div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 12px;
    border: 1px solid rgba(20, 54, 42, 0.14);
    border-radius: 8px;
    background: rgba(13, 70, 51, 0.06);
}

.result-summary span {
    color: rgba(35, 35, 35, 0.68);
    font-size: 0.88rem;
}

.result-summary strong {
    font-size: 1.05rem;
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.option-modal {
    width: min(94vw, 560px);
    max-height: min(86vh, 680px);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 14px;
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.modal-head h2 {
    margin: 0;
}

.option-list {
    display: grid;
    gap: 10px;
    overflow: auto;
    padding-right: 2px;
}

.option-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 68px;
    padding: 10px 12px;
    border: 1px solid #d8d0c2;
    border-radius: 8px;
    background: #fffdf8;
    color: var(--ink);
    text-align: left;
}

.option-card:hover {
    border-color: rgba(183, 131, 43, 0.78);
    background: #fff8e8;
}

.option-suit {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #efe7d7;
    color: #17232a;
    font-size: 1.35rem;
    font-weight: 900;
}

.option-suit.red {
    color: var(--red);
}

.option-main {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.option-title {
    font-weight: 900;
}

.option-subtitle {
    color: #68756f;
    font-size: 0.86rem;
}

.option-preview {
    display: flex;
    justify-content: flex-end;
    min-width: 112px;
}

.option-preview .card.small {
    width: 36px;
    height: 50px;
    flex-basis: 36px;
    margin-left: -12px;
    padding: 4px;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.16);
}

.option-preview .card.small:first-child {
    margin-left: 0;
}

@media (min-width: 1180px) {
    .played-grid {
        width: 540px;
        height: 150px;
    }
}

@media (max-width: 980px) {
    .table-shell {
        min-height: 100vh;
    }

    .game-hud {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .game-hud > .btn {
        min-height: 44px;
    }

    .center-play-area {
        inset: 230px 24px 255px;
    }

    .played-grid {
        width: 100%;
        height: 162px;
        top: 98px;
    }

    .played-slot {
        min-width: 96px;
        min-height: 62px;
    }

    .opponent-left {
        left: 18px;
        top: 236px;
        transform: none;
    }

    .opponent-right {
        right: 18px;
        top: 236px;
        transform: none;
    }
}

@media (max-width: 860px) {
    .lobby-shell {
        grid-template-columns: 1fr;
        padding: 16px 0 24px;
    }

    .brand-panel {
        min-height: 320px;
        padding: 28px;
    }

    .brand-panel h1 {
        font-size: clamp(2.8rem, 16vw, 4.8rem);
    }

    .seat-board {
        grid-template-columns: 1fr 1fr;
    }

    .landscape-btn {
        display: grid;
    }

    .table-shell {
        height: 100vh;
        height: 100dvh;
        min-height: 100vh;
        min-height: 100dvh;
        grid-template-rows: auto minmax(0, 1fr) auto;
        gap: 6px;
        padding: 6px;
        overflow: hidden;
    }

    .game-hud {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 5px;
    }

    .hud-item {
        min-height: 34px;
        padding: 5px 7px;
    }

    .hud-item span {
        margin-bottom: 1px;
        font-size: 0.62rem;
    }

    .hud-item strong {
        font-size: 0.82rem;
    }

    .trump-inline {
        gap: 3px;
    }

    .game-hud > .btn {
        min-height: 34px;
        padding: 0 10px;
    }

    .table-felt {
        min-height: 0;
        height: 100%;
        border-radius: 12px;
        box-shadow: inset 0 0 0 7px rgba(255, 255, 255, 0.06), var(--shadow);
    }

    .table-felt::after {
        left: 31%;
        right: 31%;
        top: 38%;
        bottom: 26%;
    }

    .trump-hint {
        top: 30px;
        grid-template-columns: auto auto;
        gap: 4px 7px;
        padding: 5px 8px;
        font-size: 0.72rem;
    }

    .trump-hint .trump-sub {
        grid-column: 1 / -1;
        justify-self: center;
    }

    .player-panel {
        min-width: 106px;
        padding: 6px 8px;
        gap: 7px;
    }

    .player-panel .team-role {
        position: absolute;
        right: 0;
        bottom: -16px;
        margin-top: 0;
        padding: 2px 6px;
        background: rgba(5, 23, 19, 0.82);
    }

    .player-panel strong,
    .player-panel span {
        max-width: 74px;
    }

    .player-panel strong {
        font-size: 0.9rem;
    }

    .player-panel span {
        font-size: 0.74rem;
    }

    .avatar {
        width: 28px;
        height: 28px;
        flex-basis: 28px;
        font-size: 0.82rem;
    }

    .opponent-top {
        top: 8px;
    }

    .opponent-left {
        left: 14px;
        top: 39%;
    }

    .opponent-right {
        right: 14px;
        top: 39%;
    }

    .kitty-cards {
        top: 58px;
        gap: 4px;
    }

    .koupai-cards {
        top: 10px;
        left: 10px;
        max-width: 122px;
        padding: 6px;
        gap: 4px;
    }

    .koupai-label {
        font-size: 0.64rem;
    }

    .koupai-card-list .card.small {
        width: 24px;
        height: 34px;
        flex-basis: 24px;
        padding: 2px;
    }

    .koupai-card-list .card.small .rank,
    .koupai-card-list .card.small .suit {
        font-size: 0.58rem;
    }

    .kitty-label {
        font-size: 0.74rem;
    }

    .hole-cards {
        gap: 4px;
    }

    .card-back {
        width: 36px;
        height: 50px;
        border-radius: 6px;
    }

    .center-play-area {
        inset: 162px 18px 186px;
    }

    .center-message {
        top: 0;
        max-width: 88vw;
        padding: 6px 10px;
        font-size: 0.82rem;
    }

    .trump-hint {
        top: 30px;
        grid-template-columns: auto auto;
        gap: 4px 7px;
        padding: 5px 8px;
        font-size: 0.72rem;
    }

    .trump-hint .trump-sub {
        grid-column: 1 / -1;
        justify-self: center;
    }

    .played-grid {
        width: min(330px, 86vw);
        height: 86px;
        top: 100px;
    }

    .played-slot {
        min-width: 64px;
        min-height: 42px;
    }

    .played-slot .card {
        width: 30px;
        height: 42px;
        flex-basis: 30px;
        padding: 4px;
    }

    .played-slot .card .rank,
    .played-slot .card .suit {
        font-size: 0.68rem;
    }

    .played-slot .empty-zone {
        font-size: 0.72rem;
    }

    .liangzhu-display {
        bottom: -2px;
        width: 100%;
        font-size: 0.78rem;
        line-height: 1.4;
    }

    .my-hand-area {
        left: 10px;
        right: 10px;
        bottom: 8px;
        gap: 4px;
        padding: 7px 8px;
        min-height: 162px;
    }

    .my-info {
        min-height: 24px;
    }

    .my-info span {
        font-size: 0.82rem;
    }

    .action-dock {
        flex-wrap: wrap;
        min-height: 36px;
        gap: 8px;
    }

    .action-dock .btn {
        min-width: 90px;
        min-height: 34px;
        padding: 7px 12px;
        font-size: 0.9rem;
    }

    .toast {
        bottom: 54px;
    }
}

body.landscape-mode {
    overflow: hidden;
}

body.landscape-mode .table-shell {
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
    min-height: 100dvh;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 6px;
    padding: 6px 8px;
    overflow: hidden;
}

body.landscape-mode .game-hud {
    grid-template-columns: repeat(6, minmax(58px, 1fr)) auto;
    gap: 5px;
}

body.landscape-mode .hud-item {
    min-height: 34px;
    padding: 5px 8px;
}

body.landscape-mode .hud-item span {
    margin-bottom: 1px;
    font-size: 0.64rem;
}

body.landscape-mode .hud-item strong {
    font-size: 0.82rem;
}

body.landscape-mode .trump-inline {
    gap: 3px;
}

body.landscape-mode .game-hud > .btn {
    min-height: 34px;
}

body.landscape-mode .table-felt {
    min-height: 0;
    height: 100%;
    border-radius: 12px;
    box-shadow: inset 0 0 0 7px rgba(255, 255, 255, 0.06), var(--shadow);
}

body.landscape-mode .table-felt::before {
    inset: 10px;
}

body.landscape-mode .table-felt::after {
    left: 28%;
    right: 28%;
    top: 40px;
    bottom: 128px;
}

body.landscape-mode .landscape-btn {
    top: 8px;
    right: 8px;
    min-width: 54px;
    min-height: 32px;
    padding: 6px 9px;
    font-size: 0.82rem;
}

body.landscape-mode .player-panel {
    min-width: 106px;
    padding: 6px 8px;
    gap: 7px;
}

body.landscape-mode .player-panel strong,
body.landscape-mode .player-panel span {
    max-width: 76px;
}

body.landscape-mode .avatar {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
    font-size: 0.82rem;
}

body.landscape-mode .player-panel span {
    font-size: 0.74rem;
}

body.landscape-mode .opponent-top {
    top: 8px;
}

body.landscape-mode .opponent-left {
    left: 16px;
    top: 56%;
}

body.landscape-mode .opponent-right {
    right: 16px;
    top: 56%;
}

body.landscape-mode .kitty-cards {
    top: 46px;
    gap: 4px;
}

body.landscape-mode .koupai-cards {
    top: 10px;
    left: 10px;
    max-width: 122px;
    padding: 6px;
    gap: 4px;
}

body.landscape-mode .koupai-label {
    font-size: 0.64rem;
}

body.landscape-mode .koupai-card-list .card.small {
    width: 24px;
    height: 34px;
    flex-basis: 24px;
    padding: 2px;
}

body.landscape-mode .koupai-card-list .card.small .rank,
body.landscape-mode .koupai-card-list .card.small .suit {
    font-size: 0.58rem;
}

body.landscape-mode .kitty-label {
    font-size: 0.74rem;
}

body.landscape-mode .hole-cards {
    gap: 4px;
}

body.landscape-mode .card-back {
    width: 38px;
    height: 54px;
    border-radius: 6px;
}

body.landscape-mode .center-play-area {
    inset: 104px 150px 158px;
}

body.landscape-mode .center-message {
    top: -10px;
    padding: 6px 10px;
    font-size: 0.82rem;
}

body.landscape-mode .trump-hint {
    top: 26px;
    grid-template-columns: auto auto auto;
    gap: 5px;
    padding: 4px 8px;
    font-size: 0.7rem;
}

body.landscape-mode .trump-hint strong {
    font-size: 0.82rem;
}

body.landscape-mode .played-grid {
    height: 98px;
    top: 76px;
}

body.landscape-mode .played-slot {
    min-width: 82px;
    min-height: 50px;
}

body.landscape-mode .liangzhu-display {
    bottom: -4px;
    font-size: 0.78rem;
}

body.landscape-mode .my-hand-area {
    left: clamp(72px, 11vw, 128px);
    right: clamp(72px, 11vw, 128px);
    bottom: 8px;
    min-height: 132px;
    gap: 4px;
    padding: 7px 8px;
}

body.landscape-mode .my-info {
    min-height: 24px;
}

body.landscape-mode .my-info span {
    font-size: 0.82rem;
}

body.landscape-mode .banker-badge {
    padding: 3px 7px;
}

body.landscape-mode .my-hand {
    --hand-card-w: 50px;
    --hand-card-h: 68px;
    --hand-card-pad: 5px;
    --hand-card-rank: 0.9rem;
    --hand-card-suit: 0.94rem;
    --selected-lift: 10px;
    min-height: var(--hand-height, 88px);
}

body.landscape-mode .action-dock {
    gap: 8px;
    min-height: 36px;
    padding: 1px 0 0;
    flex-wrap: nowrap;
}

body.landscape-mode .action-dock .btn {
    min-width: 90px;
    min-height: 36px;
    padding: 8px 13px;
    font-size: 0.9rem;
}

body.landscape-mode .toast {
    bottom: 54px;
}

@media (max-width: 620px) {
    body.landscape-mode {
        overflow: hidden;
    }

    body.landscape-mode .table-shell {
        width: 100vw;
        max-width: none;
        height: 100vh;
        height: 100dvh;
        min-height: 100vh;
        min-height: 100dvh;
        transform: none;
        grid-template-rows: auto minmax(0, 1fr) auto;
        padding: 5px;
    }

    body.landscape-mode .game-hud {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    body.landscape-mode .hud-item:nth-child(n + 4):not(:last-child) {
        display: none;
    }

    body.landscape-mode .table-felt::after {
        left: 24%;
        right: 24%;
        top: 74px;
        bottom: 132px;
    }

    body.landscape-mode .opponent-top {
        top: 8px;
    }

    body.landscape-mode .opponent-left,
    body.landscape-mode .opponent-right {
        top: 43%;
    }

    body.landscape-mode .center-play-area {
        inset: 110px 112px 142px;
    }

    body.landscape-mode .my-hand-area {
        left: 8px;
        right: 8px;
        min-height: 170px;
    }

    body.landscape-mode .action-dock {
        flex-wrap: wrap;
    }

    body.landscape-mode .action-dock .btn {
        min-width: 82px;
        min-height: 34px;
        padding: 7px 10px;
        font-size: 0.84rem;
    }
}

@media (orientation: landscape) and (max-height: 520px) {
    body,
    body.landscape-mode {
        overflow: hidden;
    }

    body.landscape-mode .table-shell,
    .table-shell {
        height: 100dvh;
        min-height: 100dvh;
        grid-template-rows: auto minmax(0, 1fr) auto;
        gap: 3px;
        padding: max(3px, env(safe-area-inset-top)) 5px max(3px, env(safe-area-inset-bottom));
    }

    body.landscape-mode .game-hud,
    .game-hud {
        grid-template-columns: repeat(5, minmax(0, 1fr)) auto;
        gap: 3px;
    }

    body.landscape-mode .hud-item,
    .hud-item {
        min-height: 28px;
        padding: 3px 6px;
        border-radius: 7px;
    }

    body.landscape-mode .hud-item span,
    .hud-item span {
        margin-bottom: 0;
        font-size: 0.56rem;
        line-height: 1.05;
    }

    body.landscape-mode .hud-item strong,
    .hud-item strong {
        font-size: 0.72rem;
        line-height: 1.08;
    }

    body.landscape-mode .hud-item:nth-child(1),
    body.landscape-mode .hud-item:nth-child(6),
    .hud-item:nth-child(1),
    .hud-item:nth-child(6) {
        display: none;
    }

    body.landscape-mode .game-hud > .btn,
    .game-hud > .btn {
        min-width: 52px;
        min-height: 28px;
        padding: 0 8px;
        font-size: 0.76rem;
    }

    body.landscape-mode .table-felt,
    .table-felt {
        border-radius: 10px;
        box-shadow: inset 0 0 0 5px rgba(255, 255, 255, 0.06), var(--shadow);
    }

    body.landscape-mode .table-felt::before,
    .table-felt::before {
        inset: 7px;
    }

    body.landscape-mode .table-felt::after,
    .table-felt::after {
        left: 18%;
        right: 18%;
        top: 62px;
        bottom: 96px;
        border-width: 1px;
    }

    body.landscape-mode .landscape-btn,
    .landscape-btn {
        top: 6px;
        right: 6px;
        min-width: 48px;
        min-height: 28px;
        padding: 4px 7px;
        font-size: 0.74rem;
    }

    body.landscape-mode .player-panel,
    .player-panel {
        min-width: 92px;
        max-width: 120px;
        gap: 5px;
        padding: 4px 6px;
        border-radius: 8px;
    }

    body.landscape-mode .player-panel strong,
    body.landscape-mode .player-panel span,
    .player-panel strong,
    .player-panel span {
        max-width: 66px;
    }

    body.landscape-mode .player-panel strong,
    .player-panel strong {
        font-size: 0.78rem;
    }

    body.landscape-mode .player-panel span,
    .player-panel span {
        font-size: 0.64rem;
    }

    body.landscape-mode .team-role,
    .team-role {
        padding: 1px 5px;
        font-size: 0.58rem !important;
    }

    body.landscape-mode .player-panel .team-role,
    .player-panel .team-role {
        position: static;
        margin-top: 1px;
    }

    body.landscape-mode .avatar,
    .avatar {
        width: 23px;
        height: 23px;
        flex-basis: 23px;
        font-size: 0.7rem;
    }

    body.landscape-mode .opponent-top,
    .opponent-top {
        top: 6px;
    }

    body.landscape-mode .opponent-left,
    .opponent-left {
        left: 8px;
        top: 43%;
    }

    body.landscape-mode .opponent-right,
    .opponent-right {
        right: 8px;
        top: 43%;
    }

    body.landscape-mode .kitty-cards,
    .kitty-cards {
        top: 38px;
        gap: 2px;
    }

    body.landscape-mode .kitty-cards:not(.has-visible-cards),
    .kitty-cards:not(.has-visible-cards) {
        display: none;
    }

    body.landscape-mode .kitty-label,
    .kitty-label {
        font-size: 0.64rem;
        line-height: 1;
    }

    body.landscape-mode .hole-cards,
    .hole-cards {
        gap: 3px;
    }

    body.landscape-mode .card-back,
    .card-back,
    body.landscape-mode .card.small,
    .card.small {
        width: 30px;
        height: 42px;
        flex-basis: 30px;
        padding: 3px;
        border-radius: 5px;
    }

    body.landscape-mode .card.small .rank,
    body.landscape-mode .card.small .suit,
    .card.small .rank,
    .card.small .suit {
        font-size: 0.68rem;
    }

    body.landscape-mode .center-play-area,
    .center-play-area {
        inset: 104px 118px 96px;
    }

    body.landscape-mode .center-message,
    .center-message {
        top: -28px;
        max-width: min(78vw, 360px);
        padding: 4px 9px;
        font-size: 0.7rem;
        line-height: 1.15;
    }

    body.landscape-mode .trump-hint,
    .trump-hint {
        top: 4px;
        max-width: min(78vw, 380px);
        grid-template-columns: auto auto;
        gap: 2px 5px;
        padding: 3px 7px;
        font-size: 0.58rem;
        line-height: 1.08;
    }

    body.landscape-mode .trump-hint strong,
    .trump-hint strong {
        font-size: 0.66rem;
    }

    body.landscape-mode .trump-hint .trump-sub,
    .trump-hint .trump-sub {
        grid-column: 1 / -1;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        justify-self: center;
    }

    body.landscape-mode .played-grid,
    .played-grid {
        display: none;
    }

    body.landscape-mode .played-slot,
    .played-slot {
        min-width: 42px;
        min-height: 40px;
        gap: 3px;
    }

    body.landscape-mode .played-slot .card,
    .played-slot .card {
        width: 28px;
        height: 40px;
        flex-basis: 28px;
        padding: 4px;
    }

    body.landscape-mode .played-slot .card .rank,
    body.landscape-mode .played-slot .card .suit,
    .played-slot .card .rank,
    .played-slot .card .suit {
        font-size: 0.62rem;
    }

    body.landscape-mode .played-slot.top {
        top: 0;
        left: 50%;
    }

    body.landscape-mode .played-slot.left,
    .played-slot.left {
        left: 16%;
        top: 0;
        transform: none;
    }

    body.landscape-mode .played-slot.right,
    .played-slot.right {
        right: 16%;
        top: 0;
        transform: none;
    }

    body.landscape-mode .played-slot.bottom {
        bottom: auto;
        top: 0;
        left: 84%;
    }

    body.landscape-mode .liangzhu-display,
    .liangzhu-display {
        display: none;
    }

    body.landscape-mode .my-hand-area,
    .my-hand-area {
        left: clamp(64px, 11vw, 108px);
        right: clamp(64px, 11vw, 108px);
        bottom: 4px;
        min-height: 116px;
        gap: 2px;
        padding: 4px 6px 5px;
        border-radius: 8px;
    }

    body.landscape-mode .my-info,
    .my-info {
        min-height: 18px;
        gap: 5px;
    }

    body.landscape-mode .my-info strong,
    .my-info strong {
        font-size: 0.78rem;
    }

    body.landscape-mode .my-info span,
    .my-info span {
        font-size: 0.66rem;
    }

    body.landscape-mode .hand-prompt,
    .hand-prompt {
        padding: 2px 6px;
        font-size: 0.6rem;
        line-height: 1.1;
    }

    body.landscape-mode .banker-badge,
    .banker-badge {
        padding: 2px 6px;
        font-size: 0.66rem;
    }

    body.landscape-mode .my-hand,
    .my-hand {
        --hand-card-w: 40px;
        --hand-card-h: 56px;
        --hand-card-pad: 4px;
        --hand-card-rank: 0.76rem;
        --hand-card-suit: 0.8rem;
        --selected-lift: 7px;
        min-height: var(--hand-height, 62px);
    }

    body.landscape-mode .action-dock,
    .action-dock {
        min-height: 28px;
        gap: 5px;
        padding: 0;
        flex-wrap: nowrap;
        overflow: hidden;
    }

    body.landscape-mode .action-dock .btn,
    .action-dock .btn {
        min-width: 64px;
        min-height: 28px;
        padding: 4px 7px;
        font-size: 0.72rem;
        border-radius: 5px;
    }

    body.landscape-mode .toast,
    .toast {
        bottom: 34px;
        padding: 8px 11px;
        font-size: 0.78rem;
    }
}

@media (orientation: landscape) and (max-height: 390px) {
    body.landscape-mode .game-hud,
    .game-hud {
        grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
    }

    body.landscape-mode .hud-item:nth-child(1),
    body.landscape-mode .hud-item:nth-child(5),
    body.landscape-mode .hud-item:nth-child(6),
    .hud-item:nth-child(1),
    .hud-item:nth-child(5),
    .hud-item:nth-child(6) {
        display: none;
    }

    body.landscape-mode .center-play-area,
    .center-play-area {
        inset: 72px 104px 98px;
    }

    body.landscape-mode .kitty-cards,
    .kitty-cards {
        top: 34px;
    }

    body.landscape-mode .opponent-left,
    body.landscape-mode .opponent-right,
    .opponent-left,
    .opponent-right {
        top: 43%;
    }

    body.landscape-mode .played-grid,
    .played-grid {
        top: 66px;
        height: 38px;
    }

    body.landscape-mode .center-message,
    .center-message {
        display: none;
    }

    body.landscape-mode .trump-hint,
    .trump-hint {
        top: 0;
    }

    body.landscape-mode .played-slot,
    .played-slot {
        min-height: 36px;
    }

    body.landscape-mode .played-slot .card,
    .played-slot .card {
        width: 26px;
        height: 36px;
        flex-basis: 26px;
        padding: 3px;
    }

    body.landscape-mode .my-hand-area,
    .my-hand-area {
        min-height: 72px;
    }

    body.landscape-mode .my-hand,
    .my-hand {
        --hand-card-w: 36px;
        --hand-card-h: 50px;
        --hand-card-rank: 0.72rem;
        --hand-card-suit: 0.76rem;
        min-height: var(--hand-height, 56px);
    }
}

@media (orientation: landscape) and (max-height: 520px) and (max-width: 700px) {
    body.landscape-mode .opponent-left,
    body.landscape-mode .opponent-right,
    .opponent-left,
    .opponent-right {
        display: none;
    }

    body.landscape-mode .center-play-area,
    .center-play-area {
        left: 84px;
        right: 84px;
    }

    body.landscape-mode .my-hand-area,
    .my-hand-area {
        left: 8px;
        right: 8px;
    }
}

@media (orientation: portrait) and (max-width: 860px), (max-width: 520px) and (min-height: 560px) {
    body,
    body.landscape-mode {
        min-height: 100dvh;
        overflow: hidden;
    }

    body.landscape-mode .table-shell,
    .table-shell {
        height: 100dvh;
        min-height: 100dvh;
        grid-template-rows: auto minmax(0, 1fr) auto;
        gap: 5px;
        overflow: hidden;
    }

    body.landscape-mode .table-felt,
    .table-felt {
        height: 100%;
        min-height: 0;
        display: grid;
        grid-template-areas:
            "top top top"
            "left center right"
            "hand hand hand";
        grid-template-columns: minmax(82px, 0.72fr) minmax(0, 1.7fr) minmax(82px, 0.72fr);
        grid-template-rows: auto auto auto;
        align-items: center;
        gap: 8px 8px;
        padding: 10px 12px 10px;
        overflow: hidden;
    }

    body.landscape-mode .table-felt::before,
    body.landscape-mode .table-felt::after,
    .table-felt::before,
    .table-felt::after {
        display: none;
    }

    body.landscape-mode .landscape-btn,
    .landscape-btn {
        top: 14px;
        right: 14px;
        min-width: 64px;
        min-height: 42px;
    }

    body.landscape-mode .opponent,
    .opponent {
        position: relative;
        z-index: 2;
        transform: none;
    }

    body.landscape-mode .opponent-top,
    .opponent-top {
        grid-area: top;
        justify-self: center;
        top: auto;
        left: auto;
    }

    body.landscape-mode .opponent-left,
    .opponent-left {
        grid-area: left;
        justify-self: start;
        left: auto;
        top: auto;
    }

    body.landscape-mode .opponent-right,
    .opponent-right {
        grid-area: right;
        justify-self: end;
        right: auto;
        top: auto;
    }

    body.landscape-mode .player-panel,
    .player-panel {
        min-width: 0;
        width: 100%;
        max-width: 150px;
        padding: 7px 8px;
        gap: 7px;
    }

    body.landscape-mode .opponent-top.player-panel,
    .opponent-top.player-panel {
        width: auto;
        min-width: 150px;
    }

    body.landscape-mode .player-panel strong,
    body.landscape-mode .player-panel span,
    .player-panel strong,
    .player-panel span {
        max-width: 86px;
    }

    body.landscape-mode .player-panel .team-role,
    .player-panel .team-role {
        position: static;
        margin-top: 3px;
        padding: 2px 6px;
    }

    body.landscape-mode .kitty-cards,
    .kitty-cards {
        display: none;
    }

    body.landscape-mode .kitty-cards.has-visible-cards,
    .kitty-cards.has-visible-cards {
        position: relative;
        grid-area: top;
        top: auto;
        left: auto;
        z-index: 1;
        display: grid;
        justify-self: center;
        align-self: end;
        margin-top: 78px;
        transform: none;
    }

    body.landscape-mode .center-play-area,
    .center-play-area {
        position: relative;
        grid-area: center;
        z-index: 1;
        inset: auto;
        min-height: 172px;
        display: grid;
        grid-template-rows: auto auto minmax(82px, auto);
        align-content: start;
        justify-items: center;
        gap: 8px;
        padding-top: 4px;
    }

    body.landscape-mode .center-message,
    body.landscape-mode .trump-hint,
    body.landscape-mode .played-grid,
    .center-message,
    .trump-hint,
    .played-grid {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
    }

    body.landscape-mode .center-message,
    .center-message {
        max-width: min(74vw, 280px);
        padding: 6px 10px;
        font-size: 0.8rem;
        line-height: 1.2;
    }

    body.landscape-mode .trump-hint,
    .trump-hint {
        max-width: min(76vw, 300px);
        grid-template-columns: auto auto;
        font-size: 0.7rem;
    }

    body.landscape-mode .trump-hint .trump-sub,
    .trump-hint .trump-sub {
        grid-column: 1 / -1;
        justify-self: center;
    }

    body.landscape-mode .played-grid,
    .played-grid {
        width: min(250px, 100%);
        height: 84px;
        margin-top: 0;
    }

    body.landscape-mode .played-slot,
    .played-slot {
        min-width: 52px;
        min-height: 38px;
    }

    body.landscape-mode .played-slot.top,
    .played-slot.top {
        top: 0;
        left: 50%;
        transform: translateX(-50%);
    }

    body.landscape-mode .played-slot.left,
    .played-slot.left {
        left: 0;
        top: 50%;
        transform: translateY(-50%);
    }

    body.landscape-mode .played-slot.right,
    .played-slot.right {
        right: 0;
        top: 50%;
        transform: translateY(-50%);
    }

    body.landscape-mode .played-slot.bottom,
    .played-slot.bottom {
        bottom: 0;
        top: auto;
        left: 50%;
        transform: translateX(-50%);
    }

    body.landscape-mode .played-slot .card,
    .played-slot .card {
        width: 28px;
        height: 40px;
        flex-basis: 28px;
        padding: 3px;
    }

    body.landscape-mode .played-slot .card .rank,
    body.landscape-mode .played-slot .card .suit,
    .played-slot .card .rank,
    .played-slot .card .suit {
        font-size: 0.62rem;
    }

    body.landscape-mode .my-hand-area,
    .my-hand-area {
        position: relative;
        grid-area: hand;
        z-index: 2;
        left: auto;
        right: auto;
        bottom: auto;
        min-height: 0;
        margin-top: 0;
        padding: 7px 10px 9px;
    }

    body.landscape-mode .my-hand,
    .my-hand {
        --hand-card-w: 46px;
        --hand-card-h: 64px;
        --hand-card-pad: 5px;
        --hand-card-rank: 0.86rem;
        --hand-card-suit: 0.9rem;
        min-height: var(--hand-height, 136px);
    }

    body.landscape-mode .action-dock,
    .action-dock {
        position: relative;
        bottom: auto;
        z-index: 20;
        flex-wrap: nowrap;
        min-height: 40px;
        padding: 5px 6px;
        background: rgba(4, 17, 14, 0.96);
    }

    body.landscape-mode .action-dock .btn,
    .action-dock .btn {
        min-width: 104px;
        min-height: 36px;
        font-size: 0.9rem;
    }
}

@media (orientation: portrait) and (max-width: 430px) and (max-height: 720px), (max-width: 430px) and (min-height: 560px) and (max-height: 720px) {
    body.landscape-mode .table-shell,
    .table-shell {
        gap: 4px;
        padding: 5px;
    }

    body.landscape-mode .game-hud,
    .game-hud {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 4px;
    }

    body.landscape-mode .hud-item,
    .hud-item {
        min-height: 34px;
        padding: 5px 8px;
    }

    body.landscape-mode .game-hud > .btn,
    .game-hud > .btn {
        min-height: 34px;
    }

    body.landscape-mode .table-felt,
    .table-felt {
        gap: 8px 6px;
        padding: 10px 10px 10px;
    }

    body.landscape-mode .opponent-top.player-panel,
    .opponent-top.player-panel {
        min-width: 142px;
    }

    body.landscape-mode .player-panel,
    .player-panel {
        padding: 6px 7px;
    }

    body.landscape-mode .center-play-area,
    .center-play-area {
        min-height: 198px;
        gap: 6px;
    }

    body.landscape-mode .center-message,
    .center-message {
        padding: 5px 9px;
        font-size: 0.76rem;
    }

    body.landscape-mode .trump-hint,
    .trump-hint {
        padding: 5px 8px;
        font-size: 0.66rem;
    }

    body.landscape-mode .played-grid,
    .played-grid {
        height: 104px;
    }

    body.landscape-mode .my-hand-area,
    .my-hand-area {
        padding: 7px 8px 8px;
    }

    body.landscape-mode .my-info,
    .my-info {
        min-height: 22px;
    }

    body.landscape-mode .my-hand,
    .my-hand {
        min-height: var(--hand-height, 126px);
    }

    body.landscape-mode .action-dock,
    .action-dock {
        min-height: 42px;
        padding: 5px 6px;
    }

    body.landscape-mode .action-dock .btn,
    .action-dock .btn {
        min-width: 96px;
        min-height: 36px;
        padding: 6px 10px;
        font-size: 0.84rem;
    }
}

/* Web UI 2.1: closer landscape miniprogram table polish. */
#game .game-hud {
    top: clamp(14px, 2.55vh, 26px);
    grid-template-columns: repeat(4, clamp(80px, 6.1vw, 118px)) clamp(64px, 5vw, 90px);
}

#game .game-hud .hud-item,
#game .game-hud > .btn {
    height: clamp(48px, 6.8vh, 70px);
    min-height: clamp(48px, 6.8vh, 70px);
    padding: clamp(5px, 0.65vh, 8px) clamp(6px, 0.65vw, 10px);
}

#game .game-hud .hud-item span {
    font-size: clamp(11px, 1vw, 18px);
    line-height: 1.05;
}

#game .game-hud .hud-item strong {
    margin-top: clamp(1px, 0.28vh, 4px);
    font-size: clamp(20px, 1.8vw, 28px);
    line-height: 1;
}

#game .game-hud > .btn {
    font-size: clamp(13px, 1.05vw, 18px);
}

#game .landscape-btn {
    font-size: 0;
}

#game .landscape-btn span {
    display: none;
}

#game .center-message {
    top: clamp(118px, 24.6vh, 236px);
    max-width: 66vw;
    white-space: nowrap;
    font-size: clamp(18px, 1.88vw, 36px);
    line-height: 1.08;
    text-shadow: 0 2px 5px rgba(0,0,0,0.34);
}

#game .player-panel.banker::before {
    content: none;
}

#game .player-panel .team-role {
    top: clamp(-18px, -2.15vh, -10px);
    left: clamp(-5px, -0.25vw, -2px);
    right: auto;
    height: clamp(20px, 2.9vh, 28px);
    min-width: clamp(54px, 4.4vw, 86px);
    padding: 0 clamp(5px, 0.55vw, 10px);
    border-radius: 2px;
    background: linear-gradient(180deg, #f47d55, #e9543d);
    color: transparent !important;
    font-size: 0 !important;
    line-height: 1;
    box-shadow: 0 1px 2px rgba(0,0,0,0.24);
}

#game .player-panel .team-role::before {
    content: "闲  对手";
    color: #fff4c8;
    font-size: clamp(11px, 0.92vw, 18px);
    font-weight: 900;
    white-space: nowrap;
}

#game .opponent-left.banker .team-role::before,
#game .opponent-right.banker .team-role::before {
    content: "庄  对手";
}

#game .opponent-top .team-role {
    left: 0;
    right: 0;
    top: clamp(-16px, -2vh, -9px);
    min-width: 100%;
    background: linear-gradient(180deg, #3f96f3, #1f67c5);
}

#game .opponent-top .team-role::before {
    content: "闲  队友";
    color: #fff;
}

#game .opponent-top.banker .team-role::before {
    content: "庄  队友";
}

@media (max-height: 560px) and (orientation: landscape) {
    #game .game-hud {
        top: 10px;
        grid-template-columns: repeat(4, clamp(54px, 9vw, 84px)) clamp(52px, 7vw, 68px);
    }

    #game .game-hud .hud-item,
    #game .game-hud > .btn {
        height: clamp(32px, 8.2vh, 42px);
        min-height: clamp(32px, 8.2vh, 42px);
        padding: 3px 5px;
    }

    #game .game-hud .hud-item span {
        font-size: clamp(8px, 1.8vw, 11px);
    }

    #game .game-hud .hud-item strong {
        font-size: clamp(13px, 2.7vw, 18px);
    }

    #game .center-message {
        top: 27vh;
        max-width: 70vw;
        font-size: clamp(16px, 3vw, 24px);
    }

    #game .player-panel .team-role::before {
        font-size: clamp(9px, 1.9vw, 13px);
    }
}

@media (orientation: landscape) and (max-height: 560px) {
    #game.screen.active .my-hand-area {
        left: 4vw !important;
        right: 4vw !important;
    }
}

@media (orientation: landscape) and (max-height: 390px) and (max-width: 700px) {
    #game.screen.active .my-hand-area {
        left: 2vw !important;
        right: 2vw !important;
    }
}

@media (orientation: landscape) and (max-height: 360px) {
    #game.screen.active .opponent-left,
    #game.screen.active .opponent-right {
        top: 29vh !important;
    }
}

/* Web UI 2.2: final small landscape fixes, appended after all UI 2.0 rules. */
@media (max-height: 560px) and (orientation: landscape) {
    #game .opponent-top {
        left: 61% !important;
        top: 10px !important;
    }

    #game .kitty-cards,
    #game .koupai-cards {
        left: clamp(122px, 13.8vw, 150px) !important;
        top: clamp(70px, 17vh, 92px) !important;
    }

    #game .trump-hint,
    #game .center-message {
        display: none !important;
    }

    #game .my-hand-area {
        left: 4vw !important;
        right: 4vw !important;
        bottom: 58px !important;
        min-height: 70px !important;
    }

    #game .my-info {
        height: 37px !important;
        bottom: 0 !important;
        padding-left: 13vw !important;
        padding-right: 31vw !important;
    }

    #game .action-dock {
        right: 11.5vw !important;
        bottom: 10px !important;
    }

    #game .action-dock .btn {
        min-height: 32px !important;
    }
}

@media (max-height: 560px) and (orientation: landscape) {
    #game .opponent-top {
        left: 61%;
        top: 10px;
    }

    #game .kitty-cards,
    #game .koupai-cards {
        left: clamp(122px, 13.8vw, 150px);
        top: clamp(70px, 17vh, 92px);
    }

    #game .trump-hint {
        display: none;
    }

    #game .my-hand-area {
        left: 4vw;
        right: 4vw;
        bottom: 58px;
        min-height: 70px;
    }

    #game .my-info {
        height: 37px;
        bottom: 0;
        padding-left: 13vw;
        padding-right: 31vw;
    }

    #game .action-dock {
        right: 11.5vw;
        bottom: 10px;
    }

    #game .action-dock .btn {
        min-height: 32px;
    }

    #game .center-message {
        display: none;
    }
}

/* Web UI 2.0: boardroom-upgrade minigame style ported to the H5 game screen. */
#game.screen.active {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background: #151515;
}

#game .table-shell {
    position: relative;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    display: block;
    padding: 0;
    overflow: hidden;
    background:
        linear-gradient(90deg, rgba(255,255,255,0.06) 1px, transparent 1px) 0 0 / clamp(38px, 4.3vw, 88px) 100%,
        radial-gradient(ellipse at 50% 10%, rgba(255, 218, 143, 0.32), transparent 26%),
        linear-gradient(90deg, #7c5238 0%, #b98655 31%, #dfb478 55%, #6a462f 100%);
    font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
}

#game .table-shell::before {
    content: "";
    position: absolute;
    z-index: 0;
    left: 2.1vw;
    right: 1.85vw;
    top: 3.4vh;
    bottom: 4.8vh;
    clip-path: polygon(4% 0, 93% 0, 100% 100%, 0 100%);
    background:
        linear-gradient(90deg, rgba(0,0,0,0.2), transparent 18%, transparent 82%, rgba(0,0,0,0.28)),
        #3a302a;
    box-shadow: 0 1.8vh 3.8vh rgba(0, 0, 0, 0.48);
}

#game .table-felt {
    position: absolute;
    inset: 0;
    z-index: 1;
    min-height: 0;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    isolation: isolate;
}

#game .table-felt::before {
    content: "";
    position: absolute;
    z-index: 0;
    left: 3.2vw;
    right: 5vw;
    top: 9.3vh;
    bottom: 10.1vh;
    clip-path: polygon(6.5% 0, 93% 0, 100% 100%, 0 100%);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.2), rgba(255,255,255,0.02) 38%, rgba(0,43,48,0.38)),
        repeating-linear-gradient(96deg, rgba(255,255,255,0.08) 0 1px, transparent 1px clamp(40px, 4.2vw, 86px)),
        #169485;
    border: clamp(2px, 0.46vw, 10px) solid #30413c;
    box-shadow: inset 0 0 0 clamp(1px, 0.18vw, 4px) rgba(14, 151, 130, 0.65);
}

#game .table-felt::after {
    content: "董事会升级";
    position: absolute;
    z-index: 1;
    left: 14.5vw;
    top: 50.8vh;
    color: rgba(5, 58, 61, 0.21);
    font-size: clamp(18px, 2.1vw, 44px);
    font-weight: 900;
    letter-spacing: 0;
    pointer-events: none;
}

#game .game-hud {
    position: absolute;
    z-index: 20;
    top: max(10px, 2.75vh);
    left: clamp(92px, 9.45vw, 194px);
    width: auto;
    display: grid;
    grid-template-columns: repeat(4, clamp(78px, 5.8vw, 118px)) clamp(64px, 5vw, 92px);
    gap: clamp(2px, 0.26vw, 5px);
    align-items: stretch;
}

#game .game-hud .hud-item:nth-child(1),
#game .game-hud .hud-item:nth-child(6) {
    display: none;
}

#game .game-hud .hud-item,
#game .game-hud > .btn {
    min-width: 0;
    min-height: clamp(42px, 8.9vh, 84px);
    height: clamp(42px, 8.9vh, 84px);
    padding: clamp(5px, 0.75vh, 9px) clamp(6px, 0.78vw, 12px);
    border: 1px solid rgba(255,255,255,0.16);
    border-radius: clamp(2px, 0.24vw, 5px);
    background: linear-gradient(180deg, rgba(32,43,54,0.94), rgba(16,30,38,0.92));
    box-shadow: 0 1px 0 rgba(255,255,255,0.08) inset;
    text-align: center;
}

#game .game-hud .hud-item span {
    margin: 0;
    color: #dff5ac;
    font-size: clamp(10px, 1.22vw, 24px);
    font-weight: 900;
    line-height: 1.08;
}

#game .game-hud .hud-item strong {
    display: block;
    margin-top: clamp(2px, 0.45vh, 7px);
    color: #fff;
    font-size: clamp(16px, 2.25vw, 32px);
    font-weight: 900;
    line-height: 1;
}

#game .game-hud .trump-hud strong,
#game .game-hud .hud-item:nth-child(5) strong {
    color: #f4d545;
}

#game .game-hud > .btn {
    color: #fff4c8;
    font-size: clamp(12px, 1.15vw, 22px);
}

#game .board-menu-btn {
    position: absolute;
    z-index: 22;
    left: clamp(42px, 4.4vw, 90px);
    top: max(10px, 2.75vh);
    width: clamp(48px, 4.2vw, 86px);
    height: clamp(48px, 9.1vh, 86px);
    display: grid;
    align-content: center;
    justify-items: center;
    gap: clamp(5px, 0.9vh, 8px);
    border: 0;
    border-radius: clamp(4px, 0.5vw, 7px);
    background: rgba(32,43,54,0.94);
    box-shadow: 0 1px 0 rgba(255,255,255,0.08) inset;
}

#game .board-menu-btn span {
    width: 44%;
    height: clamp(3px, 0.55vh, 7px);
    border-radius: 999px;
    background: #d9eef7;
}

#game .landscape-btn {
    position: absolute;
    z-index: 24;
    top: max(14px, 3vh);
    right: clamp(28px, 3.45vw, 70px);
    width: clamp(48px, 3.3vw, 68px);
    height: clamp(48px, 6.7vh, 68px);
    min-width: 0;
    min-height: 0;
    display: grid;
    place-items: center;
    padding: 0;
    border: clamp(3px, 0.32vw, 6px) solid rgba(255,255,255,0.78);
    border-radius: 50%;
    background: rgba(94, 71, 49, 0.5);
    color: #fff;
    font-size: clamp(10px, 0.8vw, 14px);
    font-weight: 900;
    box-shadow: none;
}

#game .landscape-btn::before {
    content: "";
    width: 28%;
    height: 28%;
    border: 2px solid rgba(255,255,255,0.94);
    border-radius: 50%;
}

#game .landscape-btn span {
    position: absolute;
    bottom: -1.25em;
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    padding: 1px 5px;
    border-radius: 999px;
    background: rgba(20, 25, 29, 0.62);
    color: #fff7dc;
    line-height: 1.2;
}

#game .landscape-btn.active {
    border-color: rgba(255,231,166,0.96);
    background: rgba(151,103,15,0.68);
}

#game .connection-panel {
    position: absolute;
    z-index: 21;
    top: clamp(58px, 11.2vh, 106px);
    right: clamp(70px, 7.6vw, 155px);
    display: flex;
    align-items: center;
    gap: clamp(8px, 1.05vw, 18px);
    min-width: clamp(170px, 23vw, 470px);
    height: clamp(46px, 9.5vh, 90px);
    padding: 0 clamp(12px, 1.8vw, 36px);
    border-radius: clamp(3px, 0.45vw, 8px);
    background: rgba(26, 36, 43, 0.78);
    color: #eaf6f1;
    font-size: clamp(14px, 1.34vw, 26px);
    pointer-events: auto;
}

#game .connection-dot {
    width: clamp(7px, 0.8vw, 15px);
    height: clamp(7px, 0.8vw, 15px);
    border-radius: 2px;
    background: #25e331;
}

#game .connection-panel button {
    margin-left: auto;
    height: 55%;
    padding: 0 clamp(9px, 1.1vw, 20px);
    border: 1px solid rgba(255,255,255,0.82);
    border-radius: 5px;
    background: rgba(255,255,255,0.06);
    color: #fff;
    font-weight: 800;
}

#game .side-tools {
    position: absolute;
    z-index: 22;
    right: clamp(54px, 6.1vw, 126px);
    top: 46%;
    display: grid;
    gap: clamp(10px, 1.7vh, 20px);
}

#game .side-tools button {
    width: clamp(36px, 2.8vw, 58px);
    height: clamp(36px, 6vh, 58px);
    border: 0;
    border-radius: 50%;
    background: rgba(33,45,63,0.9);
    color: #ffd77a;
    font-size: clamp(15px, 1.3vw, 25px);
    font-weight: 900;
}

#game .player-panel {
    z-index: 12;
    width: clamp(72px, 5.86vw, 120px);
    height: clamp(104px, 18vh, 170px);
    min-width: 0;
    max-width: none;
    display: grid;
    grid-template-rows: 1fr auto auto;
    align-items: end;
    justify-items: center;
    gap: 0;
    padding: clamp(20px, 3vh, 30px) clamp(5px, 0.55vw, 9px) clamp(7px, 1.1vh, 12px);
    border: 0;
    border-radius: clamp(3px, 0.34vw, 5px);
    background: rgba(34,35,34,0.76);
    box-shadow: none;
}

#game .player-panel.banker {
    border: 0;
}

#game .player-panel.banker::before {
    content: "庄";
    position: absolute;
    left: clamp(-6px, -0.25vw, -2px);
    top: 0;
    width: clamp(30px, 2.1vw, 42px);
    height: clamp(24px, 3.4vh, 32px);
    display: grid;
    place-items: center;
    border-radius: 3px;
    background: #ee604a;
    color: #fff;
    font-size: clamp(14px, 1.18vw, 24px);
    font-weight: 900;
}

#game .player-panel .avatar {
    width: 88%;
    height: auto;
    aspect-ratio: 1 / 1;
    flex: none;
    border: clamp(2px, 0.2vw, 4px) solid rgba(255,255,255,0.74);
    border-radius: 3px;
    background:
        radial-gradient(circle at 50% 34%, #eff8ff 0 22%, transparent 23%),
        radial-gradient(ellipse at 50% 82%, rgba(18,49,71,0.64) 0 40%, transparent 41%),
        linear-gradient(135deg, #a8c8f0, #3b72a4);
    color: transparent;
}

#game .opponent-left .avatar {
    background:
        radial-gradient(circle at 50% 34%, #eaf3f6 0 22%, transparent 23%),
        radial-gradient(ellipse at 50% 82%, rgba(18,49,71,0.64) 0 40%, transparent 41%),
        linear-gradient(135deg, #526d8d, #20314f);
}

#game .opponent-right .avatar {
    background:
        radial-gradient(circle at 50% 34%, #f7fbff 0 22%, transparent 23%),
        radial-gradient(ellipse at 50% 82%, rgba(58,49,91,0.58) 0 40%, transparent 41%),
        linear-gradient(135deg, #f2e7dd, #af9ad4);
}

#game .player-panel > div:last-child {
    display: contents;
}

#game .player-panel strong,
#game .player-panel span {
    max-width: 100%;
    color: #fff;
    text-align: center;
    text-overflow: clip;
}

#game .player-panel strong {
    margin-top: clamp(2px, 0.8vh, 8px);
    color: #fff4c8;
    font-size: clamp(12px, 1.05vw, 22px);
    line-height: 1.05;
}

#game .player-panel span {
    font-size: clamp(12px, 1.15vw, 24px);
    font-weight: 900;
    line-height: 1.08;
}

#game .player-panel .team-role {
    position: absolute;
    top: 0;
    right: clamp(12px, 1.6vw, 36px);
    width: auto;
    margin: 0;
    padding: 0 clamp(5px, 0.52vw, 10px);
    height: clamp(24px, 3.4vh, 32px);
    border: 0;
    border-radius: 2px;
    background: #d96442;
    color: #fff4c8 !important;
    font-size: clamp(11px, 0.95vw, 20px) !important;
}

#game .opponent-top {
    left: 50%;
    top: clamp(8px, 2.3vh, 22px);
    transform: translateX(-50%);
}

#game .opponent-left {
    left: clamp(42px, 4.1vw, 84px);
    top: 22.2vh;
    transform: none;
}

#game .opponent-right {
    right: clamp(48px, 4.9vw, 100px);
    top: 22.2vh;
    transform: none;
}

#game .opponent-top.player-panel {
    width: clamp(82px, 6.45vw, 132px);
    background: rgba(22,55,72,0.86);
}

#game .opponent-top .team-role {
    left: 4%;
    right: 4%;
    background: #347adb;
    color: #fff !important;
}

#game .kitty-cards,
#game .koupai-cards {
    z-index: 10;
    top: clamp(76px, 15.8vh, 150px);
    left: clamp(110px, 10.85vw, 222px);
    max-width: clamp(150px, 17.5vw, 360px);
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    transform: none;
    justify-items: start;
}

#game .koupai-cards {
    display: grid;
    gap: clamp(2px, 0.5vh, 5px);
}

#game .koupai-cards[hidden] {
    display: none;
}

#game .kitty-label,
#game .koupai-label {
    color: #fff4c8;
    font-size: clamp(11px, 0.98vw, 20px);
    font-weight: 900;
    line-height: 1.1;
    text-shadow: 0 1px 2px rgba(0,0,0,0.36);
}

#game .hole-cards,
#game .koupai-card-list {
    gap: 0;
}

#game .center-play-area {
    z-index: 7;
    position: absolute;
    inset: 0;
}

#game .center-message {
    top: clamp(118px, 26.2vh, 248px);
    left: 50%;
    max-width: 42vw;
    padding: 0;
    border-radius: 0;
    background: transparent;
    color: #fff;
    font-size: clamp(20px, 2.25vw, 44px);
    font-weight: 900;
    line-height: 1.08;
    text-shadow: 0 2px 3px rgba(0,0,0,0.36);
}

#game .trump-hint {
    top: clamp(304px, 60.7vh, 574px);
    left: 50%;
    max-width: min(44vw, 668px);
    min-width: min(34vw, 420px);
    display: flex;
    justify-content: center;
    gap: clamp(5px, 0.6vw, 12px);
    padding: clamp(5px, 0.7vh, 8px) clamp(12px, 1.2vw, 18px);
    border: 0;
    border-radius: 999px;
    background: rgba(7,62,70,0.82);
    color: #fff4c8;
    font-size: clamp(10px, 0.98vw, 20px);
    line-height: 1.1;
}

#game .trump-hint .trump-title {
    display: none;
}

#game .trump-hint strong {
    color: #fff4c8;
    font-size: 1em;
}

#game .liangzhu-display {
    left: 50%;
    bottom: clamp(134px, 15vh, 156px);
    transform: translateX(-50%);
    color: rgba(255,255,255,0.66);
    font-size: clamp(10px, 0.92vw, 18px);
    white-space: nowrap;
}

#game .played-grid {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: none;
}

#game .played-slot {
    min-width: clamp(70px, 10vw, 160px);
    min-height: clamp(44px, 7.5vh, 76px);
    gap: 0;
}

#game .played-slot.top {
    top: 35.5vh;
    left: 50%;
    transform: translateX(-50%);
}

#game .played-slot.left {
    left: 29.8vw;
    top: 47.8vh;
    transform: translate(-50%, -50%);
}

#game .played-slot.right {
    right: auto;
    left: 70.2vw;
    top: 47.8vh;
    transform: translate(-50%, -50%);
}

#game .played-slot.bottom {
    left: 50%;
    bottom: auto;
    top: 52.1vh;
    transform: translateX(-50%);
}

#game .played-slot .card {
    width: clamp(28px, 2.55vw, 52px);
    height: clamp(42px, 8.1vh, 76px);
    flex-basis: clamp(28px, 2.55vw, 52px);
    margin-left: clamp(-9px, -0.65vw, -3px);
    padding: clamp(3px, 0.34vw, 6px);
}

#game .played-slot .card:first-child {
    margin-left: 0;
}

#game .played-slot .card .rank {
    font-size: clamp(11px, 1vw, 20px);
}

#game .played-slot .card .suit {
    font-size: clamp(12px, 1.1vw, 22px);
}

#game .played-slot .empty-zone {
    color: rgba(255,255,255,0.42);
    font-size: clamp(10px, 0.9vw, 18px);
}

#game .my-hand-area {
    z-index: 18;
    left: clamp(150px, 7.32vw, 150px);
    right: clamp(120px, 7.32vw, 150px);
    bottom: clamp(84px, 10.8vh, 102px);
    min-height: clamp(86px, 20.5vh, 194px);
    display: block;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

#game .my-hand {
    min-height: var(--hand-height, clamp(82px, 20vh, 194px));
}

#game .my-hand .card {
    border-color: #bdb8b0;
    border-radius: clamp(4px, 0.4vw, 8px);
    background: linear-gradient(180deg, #fbfaf7, #e3e0db);
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

#game .my-hand .card.selected {
    border-color: #f7c856;
    box-shadow: 0 0 0 clamp(1px, 0.18vw, 4px) #f7c856, 0 8px 18px rgba(0,0,0,0.28);
}

#game .card {
    color: #151515;
}

#game .card.red {
    color: #b6262c;
}

#game .card .corner {
    top: 7%;
    left: 18%;
    width: auto;
    justify-items: center;
}

#game .card .rank,
#game .card .suit {
    text-align: center;
    line-height: 1;
}

#game .card.long-rank .corner {
    left: 13%;
}

#game .card.long-rank .rank {
    writing-mode: vertical-rl;
    text-orientation: upright;
    letter-spacing: 0;
    line-height: 0.92;
}

#game .my-info {
    position: fixed;
    z-index: 17;
    left: clamp(88px, 4.3vw, 88px);
    right: clamp(120px, 5.85vw, 120px);
    bottom: 0;
    height: clamp(62px, 11vh, 104px);
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: clamp(16px, 2vw, 42px);
    padding: 0 clamp(70px, 6.4vw, 132px) 0 clamp(160px, 8.6vw, 176px);
    background: linear-gradient(180deg, rgba(12,76,86,0.92), rgba(7,48,61,0.95));
}

#game .my-info::before {
    content: "";
    position: absolute;
    left: 0;
    bottom: 8%;
    width: clamp(62px, 6vw, 122px);
    height: clamp(62px, 15vh, 142px);
    border: clamp(2px, 0.24vw, 4px) solid rgba(171,210,255,0.9);
    background:
        radial-gradient(circle at 50% 35%, #eff8ff 0 22%, transparent 23%),
        radial-gradient(ellipse at 50% 82%, rgba(18,49,71,0.58) 0 40%, transparent 41%),
        linear-gradient(135deg, #a5d0ff, #2d6eb8);
}

#game .my-info > div:first-child {
    gap: clamp(8px, 1vw, 18px);
    min-width: 0;
}

#game .my-info strong {
    color: #fff;
    font-size: clamp(18px, 1.7vw, 32px);
    font-weight: 900;
}

#game .my-info span {
    color: #fff;
    font-size: clamp(14px, 1.35vw, 28px);
    font-weight: 900;
}

#game .my-info .team-role,
#game .banker-badge {
    height: auto;
    padding: clamp(2px, 0.35vh, 5px) clamp(6px, 0.65vw, 12px);
    border: 1px solid rgba(255,226,130,0.8);
    border-radius: 999px;
    background: rgba(255,226,130,0.12);
    color: #fff4c8 !important;
    font-size: clamp(10px, 0.85vw, 16px) !important;
}

#game .hand-prompt {
    max-width: min(37vw, 720px);
    border: 0;
    background: transparent;
    color: rgba(255,255,255,0.66) !important;
    font-size: clamp(10px, 0.9vw, 20px);
    white-space: nowrap;
}

#game .action-dock {
    position: fixed;
    z-index: 40;
    right: clamp(170px, 16.6vw, 340px);
    bottom: clamp(28px, 3.1vh, 30px);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: clamp(10px, 1.2vw, 22px);
    min-height: 0;
    padding: 0;
    background: transparent;
}

#game .action-dock .btn {
    min-width: clamp(98px, 7.4vw, 150px);
    min-height: clamp(44px, 6.1vh, 58px);
    padding: 0 clamp(12px, 1.2vw, 20px);
    border-radius: clamp(4px, 0.4vw, 8px);
    font-size: clamp(14px, 1.25vw, 25px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.25);
}

#game .action-dock .btn.primary {
    background: #c73a34;
    border-color: #8d2822;
    color: #fff7dc;
}

#game .action-dock .btn.secondary,
#game .action-dock .btn.warning {
    background: rgba(255,251,239,0.94);
    border-color: #c9b26a;
    color: #163229;
}

#game .toast {
    z-index: 80;
    bottom: clamp(130px, 17vh, 170px);
    background: rgba(38,38,38,0.88);
    color: #fff;
    border-radius: clamp(6px, 0.8vw, 14px);
}

#game .modal {
    z-index: 90;
}

#game .card.small {
    width: clamp(28px, 2.1vw, 42px);
    height: clamp(42px, 6.6vh, 62px);
    flex-basis: clamp(28px, 2.1vw, 42px);
    margin-left: clamp(-10px, -0.55vw, -2px);
    padding: clamp(3px, 0.3vw, 5px);
}

#game .card.small .rank,
#game .card.small .suit {
    font-size: clamp(10px, 0.85vw, 16px);
}

@media (orientation: landscape) and (max-height: 560px) {
    #game .connection-panel {
        display: none;
    }

    #game .game-hud {
        top: 2.5vh;
        grid-template-columns: repeat(4, clamp(54px, 8.6vw, 90px)) clamp(52px, 7vw, 72px);
    }

    #game .game-hud .hud-item,
    #game .game-hud > .btn {
        height: clamp(34px, 8.9vh, 52px);
        min-height: clamp(34px, 8.9vh, 52px);
    }

    #game .game-hud .hud-item span {
        font-size: clamp(9px, 1.55vw, 14px);
    }

    #game .game-hud .hud-item strong {
        font-size: clamp(13px, 2.2vw, 22px);
    }

    #game .center-message {
        top: 28vh;
        font-size: clamp(18px, 3.4vw, 34px);
    }

    #game .trump-hint {
        top: 61vh;
        max-width: 56vw;
        min-width: 40vw;
        font-size: clamp(9px, 1.35vw, 14px);
    }

    #game .my-hand-area {
        left: 4vw;
        right: 4vw;
        bottom: 10.7vh;
        min-height: 20vh;
    }

    #game .my-info {
        height: 11vh;
        padding-left: 13vw;
        padding-right: 27vw;
    }

    #game .action-dock {
        right: 11.5vw;
        bottom: 3vh;
    }

    #game .action-dock .btn {
        min-width: clamp(70px, 12vw, 116px);
        min-height: clamp(34px, 7.3vh, 48px);
        font-size: clamp(12px, 2.2vw, 18px);
    }
}

@media (orientation: portrait) {
    #game .table-shell {
        overflow: auto;
        background:
            linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px) 0 0 / 46px 100%,
            linear-gradient(90deg, #7c5238, #c39161, #6a462f);
    }

    #game .table-felt::before {
        left: 3vw;
        right: 3vw;
        top: 17vh;
        bottom: 13vh;
        clip-path: none;
        border-radius: 18px;
    }

    #game .table-shell::before {
        left: 1vw;
        right: 1vw;
        top: 15vh;
        bottom: 11vh;
        clip-path: none;
        border-radius: 26px;
    }

    #game .game-hud {
        left: 8px;
        right: 8px;
        grid-template-columns: repeat(4, minmax(0, 1fr)) 64px;
    }

    #game .board-menu-btn {
        display: none;
    }

    #game .connection-panel {
        display: none;
    }

    #game .opponent-left {
        left: 5vw;
        top: 42vh;
    }

    #game .opponent-right {
        right: 5vw;
        top: 42vh;
    }

    #game .opponent-top {
        top: 18vh;
    }

    #game .my-hand-area {
        left: 6vw;
        right: 6vw;
        bottom: 14vh;
        min-height: 22vh;
    }

    #game .my-info {
        left: 4vw;
        right: 4vw;
        height: 10vh;
        padding-left: 24vw;
        padding-right: 4vw;
    }

    #game .action-dock {
        left: 4vw;
        right: 4vw;
        bottom: 2vh;
        justify-content: center;
        flex-wrap: nowrap;
    }

    #game .action-dock .btn {
        min-width: 96px;
        font-size: 14px;
    }
}

/* Web UI 2.1 final overrides: closer landscape miniprogram table polish. */
#game .game-hud {
    top: clamp(14px, 2.55vh, 26px);
    grid-template-columns: repeat(4, clamp(80px, 6.1vw, 118px)) clamp(64px, 5vw, 90px);
}

#game .game-hud .hud-item,
#game .game-hud > .btn {
    height: clamp(48px, 6.8vh, 70px);
    min-height: clamp(48px, 6.8vh, 70px);
    padding: clamp(5px, 0.65vh, 8px) clamp(6px, 0.65vw, 10px);
}

#game .game-hud .hud-item span {
    font-size: clamp(11px, 1vw, 18px);
    line-height: 1.05;
}

#game .game-hud .hud-item strong {
    margin-top: clamp(1px, 0.28vh, 4px);
    font-size: clamp(20px, 1.8vw, 28px);
    line-height: 1;
}

#game .game-hud > .btn {
    font-size: clamp(13px, 1.05vw, 18px);
}

#game .landscape-btn {
    font-size: 0;
}

#game .landscape-btn span {
    display: none;
}

#game .center-message {
    top: clamp(118px, 24.6vh, 236px);
    max-width: 66vw;
    white-space: nowrap;
    font-size: clamp(18px, 1.88vw, 36px);
    line-height: 1.08;
    text-shadow: 0 2px 5px rgba(0,0,0,0.34);
}

#game .player-panel.banker::before {
    content: none;
}

#game .player-panel .team-role {
    top: clamp(-18px, -2.15vh, -10px);
    left: clamp(-5px, -0.25vw, -2px);
    right: auto;
    height: clamp(20px, 2.9vh, 28px);
    min-width: clamp(54px, 4.4vw, 86px);
    padding: 0 clamp(5px, 0.55vw, 10px);
    border-radius: 2px;
    background: linear-gradient(180deg, #f47d55, #e9543d);
    color: transparent !important;
    font-size: 0 !important;
    line-height: 1;
    box-shadow: 0 1px 2px rgba(0,0,0,0.24);
}

#game .player-panel .team-role::before {
    content: "闲  对手";
    color: #fff4c8;
    font-size: clamp(11px, 0.92vw, 18px);
    font-weight: 900;
    white-space: nowrap;
}

#game .opponent-left.banker .team-role::before,
#game .opponent-right.banker .team-role::before {
    content: "庄  对手";
}

#game .opponent-top .team-role {
    left: 0;
    right: 0;
    top: clamp(-16px, -2vh, -9px);
    min-width: 100%;
    background: linear-gradient(180deg, #3f96f3, #1f67c5);
}

#game .opponent-top .team-role::before {
    content: "闲  队友";
    color: #fff;
}

#game .opponent-top.banker .team-role::before {
    content: "庄  队友";
}

@media (max-height: 560px) and (orientation: landscape) {
    #game .game-hud {
        top: 10px;
        grid-template-columns: repeat(4, clamp(54px, 9vw, 84px)) clamp(52px, 7vw, 68px);
    }

    #game .game-hud .hud-item,
    #game .game-hud > .btn {
        height: clamp(32px, 8.2vh, 42px);
        min-height: clamp(32px, 8.2vh, 42px);
        padding: 3px 5px;
    }

    #game .game-hud .hud-item span {
        font-size: clamp(8px, 1.8vw, 11px);
    }

    #game .game-hud .hud-item strong {
        font-size: clamp(13px, 2.7vw, 18px);
    }

    #game .center-message {
        top: 27vh;
        max-width: 70vw;
        font-size: clamp(16px, 3vw, 24px);
    }

    #game .player-panel .team-role::before {
        font-size: clamp(9px, 1.9vw, 13px);
    }
}
