:root {
    --ink: #2b1708;
    --cream: #fff2c3;
    --paper: #fffaf0;
    --wood: #8a4d21;
    --wood-dark: #482411;
    --gold: #f4c15b;
    --gold-deep: #b46d18;
    --red: #c7372f;
    --blue: #225aa8;
    --green: #1f7a56;
    --shadow: rgba(30, 14, 5, .34);
}

* {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    min-height: 100vh;
    overflow: hidden;
    color: var(--cream);
    background: #12372d url("/static/i/bg.png") center / cover no-repeat fixed;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
input {
    font: inherit;
}

button {
    min-height: 36px;
    border: 0;
    border-radius: 8px;
    color: var(--cream);
    background: linear-gradient(#bf6b2b, #763815);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.28), 0 4px 10px var(--shadow);
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: .48;
    filter: grayscale(.35);
}

input {
    min-height: 34px;
    min-width: 0;
    border: 1px solid rgba(102, 54, 20, .38);
    border-radius: 8px;
    padding: 0 10px;
    color: #3a1f0d;
    background: rgba(255, 248, 225, .96);
    outline: none;
    box-shadow: inset 0 2px 4px rgba(71, 34, 12, .12);
}

input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 2px rgba(244, 193, 91, .28), inset 0 2px 4px rgba(71, 34, 12, .12);
}

.orientation-guard {
    display: none;
}

.room-page {
    position: relative;
    width: 100vw;
    height: 100vh;
    min-height: 100vh;
    overflow: hidden;
}

.room-page::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 50% 48%, rgba(255, 232, 145, .08), transparent 35%),
        linear-gradient(to bottom, rgba(10, 37, 34, .1), rgba(20, 10, 4, .36));
    z-index: 0;
}

.room-header {
    position: absolute;
    top: 8px;
    left: 10px;
    right: 10px;
    z-index: 8;
    min-height: 54px;
    display: grid;
    grid-template-columns: minmax(150px, 220px) minmax(250px, 1fr) auto;
    gap: 8px;
    align-items: center;
    padding: 7px 10px;
    border: 1px solid rgba(255, 224, 137, .48);
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(120, 57, 20, .94), rgba(66, 28, 11, .94)),
        #6a3517;
    box-shadow: 0 8px 22px rgba(24, 10, 4, .36), inset 0 1px 0 rgba(255,255,255,.18);
}

.brand-title {
    color: #ffe7a3;
    font-size: 21px;
    font-weight: 900;
    line-height: 1.05;
    text-shadow: 0 2px 0 #57250d, 0 0 10px rgba(255, 210, 86, .2);
}

.brand-subtitle {
    margin-top: 3px;
    color: rgba(255, 245, 214, .82);
    font-size: 12px;
}

.room-meta {
    display: grid;
    grid-template-columns: repeat(3, minmax(72px, 1fr));
    gap: 7px;
}

.room-meta > div {
    min-height: 38px;
    padding: 4px 8px;
    border: 1px solid rgba(255, 225, 142, .4);
    border-radius: 8px;
    color: #fff5cc;
    background: rgba(37, 16, 6, .28);
}

.meta-label {
    display: block;
    color: rgba(255, 232, 178, .72);
    font-size: 11px;
}

.room-meta strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 15px;
}

.room-actions {
    display: grid;
    grid-template-columns: 86px repeat(3, auto);
    gap: 6px;
    align-items: center;
}

.room-actions button,
.auth-fields button,
.chat-form button,
.settlement-actions button,
button.primary {
    padding: 0 12px;
    color: #4a2309;
    font-weight: 800;
    background: linear-gradient(#ffe18a, #d98725);
    text-shadow: 0 1px 0 rgba(255,255,255,.3);
}

#dismissRoomBtn {
    color: #ffe9d0;
    background: linear-gradient(#9a4b36, #5e2418);
}

.auth-panel {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 12;
    width: min(520px, calc(100vw - 28px));
    transform: translate(-50%, -50%);
    padding: 18px;
    border: 1px solid rgba(255, 224, 137, .62);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(108, 50, 18, .98), rgba(54, 25, 11, .98));
    box-shadow: 0 20px 50px rgba(18, 6, 2, .44), inset 0 1px 0 rgba(255,255,255,.15);
}

.auth-fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 88px;
    gap: 8px;
}

.room-layout,
.game-area,
.game-table {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 0;
    z-index: 1;
}

.table-surface {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background:
        radial-gradient(ellipse at 50% 58%, rgba(255, 222, 128, .22), transparent 32%),
        url("/static/i/bg.png") center / cover no-repeat;
}

.table-surface::after {
    content: "";
    position: absolute;
    inset: 70px 96px 78px;
    pointer-events: none;
    border: 1px solid rgba(151, 80, 26, .2);
    border-radius: 8px;
    box-shadow: inset 0 0 44px rgba(96, 47, 15, .12);
}

.seat {
    position: absolute;
    z-index: 7;
    width: 178px;
    min-height: 68px;
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    padding: 7px;
    border: 1px solid rgba(255, 222, 139, .48);
    border-radius: 8px;
    color: #fff1c7;
    background: linear-gradient(180deg, rgba(75, 32, 12, .9), rgba(28, 13, 8, .82));
    box-shadow: 0 8px 18px rgba(40, 16, 4, .28), inset 0 1px 0 rgba(255,255,255,.1);
}

.seat.is-current {
    border-color: #ffe38d;
    box-shadow: 0 0 0 2px rgba(244,193,91,.34), 0 0 24px rgba(255,214,83,.42);
}

.seat.empty {
    opacity: .78;
}

.seat-bottom {
    left: 50%;
    bottom: 132px;
    transform: translateX(-50%);
}

.table-waiting .seat-bottom {
    bottom: 22px;
}

.seat-top {
    left: 50%;
    top: 70px;
    transform: translateX(-50%);
}

.seat-left {
    left: 16px;
    top: 43%;
    transform: translateY(-50%);
}

.seat-right {
    right: 16px;
    top: 43%;
    transform: translateY(-50%);
}

.seat-avatar {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border: 2px solid #f5cf73;
    border-radius: 50%;
    color: #4a2109;
    background:
        radial-gradient(circle at 38% 30%, #fff7cf, #d28b36 62%, #7b3414);
    font-size: 22px;
    font-weight: 900;
    box-shadow: inset 0 2px 3px rgba(255,255,255,.35), 0 4px 8px rgba(0,0,0,.24);
}

.seat-name {
    min-width: 0;
    color: #fff5d6;
    font-size: 14px;
    font-weight: 900;
}

.seat-name span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.seat-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-top: 5px;
}

.seat-chat-bubble {
    position: absolute;
    z-index: 8;
    max-width: min(220px, 42vw);
    max-height: 72px;
    min-width: 48px;
    overflow: hidden;
    padding: 8px 10px;
    border: 1px solid rgba(255, 225, 142, .72);
    border-radius: 8px;
    color: #3a1f0d;
    background: linear-gradient(#fff7d8, #ffd880);
    box-shadow: 0 8px 18px rgba(34, 13, 4, .28), inset 0 1px 0 rgba(255,255,255,.48);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.35;
    text-align: left;
    word-break: break-word;
    pointer-events: none;
    animation: seatChatBubble 3s ease-out forwards;
}

.seat-chat-bubble::after {
    content: "";
    position: absolute;
    width: 10px;
    height: 10px;
    background: #ffe29b;
    transform: rotate(45deg);
}

.seat-bottom .seat-chat-bubble {
    left: 50%;
    bottom: calc(100% + 10px);
    transform: translateX(-50%);
}

.seat-bottom .seat-chat-bubble::after {
    left: 50%;
    bottom: -5px;
    margin-left: -5px;
}

.seat-top .seat-chat-bubble {
    left: 50%;
    top: calc(100% + 10px);
    transform: translateX(-50%);
}

.seat-top .seat-chat-bubble::after {
    left: 50%;
    top: -5px;
    margin-left: -5px;
}

.seat-left .seat-chat-bubble {
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
}

.seat-left .seat-chat-bubble::after {
    left: -5px;
    top: 50%;
    margin-top: -5px;
}

.seat-right .seat-chat-bubble {
    right: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
}

.seat-right .seat-chat-bubble::after {
    right: -5px;
    top: 50%;
    margin-top: -5px;
}

@keyframes seatChatBubble {
    0% {
        opacity: 0;
    }
    8%, 82% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 19px;
    padding: 0 6px;
    border: 1px solid rgba(255, 232, 168, .25);
    border-radius: 8px;
    color: #fff1c2;
    background: rgba(43, 18, 7, .46);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.badge.warn {
    color: #4a2109;
    border-color: #ffe18a;
    background: linear-gradient(#ffe18a, #d98725);
}

.badge.good {
    color: #eaffdb;
    border-color: rgba(185, 244, 154, .45);
    background: rgba(23, 118, 64, .72);
}

.badge.score {
    border-color: rgba(255, 225, 142, .42);
    color: #ffe18a;
    background: rgba(89, 42, 12, .62);
}

.table-center {
    position: absolute;
    left: 50%;
    top: 45%;
    z-index: 2;
    width: min(620px, calc(100% - 380px));
    min-width: 340px;
    transform: translate(-50%, -50%);
    text-align: center;
}

.table-waiting .table-center {
    top: 50%;
}

.lobby-title {
    margin-bottom: 8px;
    color: #ffe18a;
    font-size: 28px;
    font-weight: 900;
    text-shadow: 0 3px 0 #61270e, 0 0 18px rgba(255,218,95,.24);
}

.table-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 8px 0;
}

.turn-notice {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    max-width: 100%;
    margin-bottom: 7px;
    padding: 0 12px;
    border: 1px solid rgba(255, 232, 168, .42);
    border-radius: 8px;
    color: #fff4cf;
    background: rgba(43, 18, 7, .5);
    box-shadow: 0 5px 14px rgba(47, 19, 4, .18), inset 0 1px 0 rgba(255,255,255,.08);
    font-size: 12px;
    font-weight: 800;
    text-align: center;
}

.turn-notice.active {
    color: #3f2107;
    border-color: rgba(255, 232, 142, .82);
    background: linear-gradient(#fff3ba, #dda247);
}

.turn-notice.hot {
    color: #fff7d2;
    border-color: rgba(255, 210, 114, .86);
    background: linear-gradient(#d74737, #8b1d18);
}

.turn-notice.muted {
    color: rgba(255, 242, 203, .76);
}

.draw-dock {
    display: grid;
    grid-template-columns: 86px minmax(0, 1fr);
    gap: 10px;
    align-items: stretch;
    margin: 0 auto 6px;
}

.deck-button {
    width: 76px;
    height: 96px;
    min-height: 96px;
    display: grid;
    place-items: center;
    padding: 8px 6px;
    border: 2px solid #f4c15b;
    color: #ffe9b5;
    background:
        linear-gradient(135deg, rgba(255,255,255,.12), transparent 35%),
        repeating-linear-gradient(45deg, #214c93, #214c93 8px, #15366f 8px, #15366f 16px);
}

.deck-button:not(:disabled) {
    box-shadow: 0 0 0 2px rgba(255, 225, 142, .24), 0 8px 18px rgba(28, 14, 4, .34), inset 0 1px 0 rgba(255,255,255,.28);
}

.deck-button span {
    display: block;
    font-size: 13px;
}

.deck-button strong {
    display: block;
    font-size: 28px;
    line-height: 1;
}

.deck-button em {
    color: rgba(255, 238, 185, .85);
    font-size: 11px;
    font-style: normal;
    font-weight: 800;
}

.bright-zone {
    margin: 0 auto;
    padding: 7px 9px 9px;
    border: 1px solid rgba(255, 224, 137, .34);
    border-radius: 8px;
    background: rgba(55, 25, 10, .42);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}

.zone-head {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    color: #fff0bf;
    font-size: 12px;
    font-weight: 800;
}

.zone-head strong {
    color: #ffe18a;
    font-size: 11px;
}

.last-action {
    min-height: 22px;
    color: #fff5d5;
    font-size: 13px;
    text-shadow: 0 1px 2px rgba(0,0,0,.45);
}

.scoreboard {
    width: min(280px, 100%);
    display: grid;
    gap: 4px;
    margin: 4px auto 0;
    padding: 7px 9px;
    border: 1px solid rgba(255, 224, 137, .3);
    border-radius: 8px;
    background: rgba(44, 18, 7, .42);
}

.scoreboard-title {
    color: rgba(255, 232, 178, .76);
    font-size: 11px;
    font-weight: 800;
}

.scoreboard-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    color: #fff5cc;
    font-size: 12px;
}

.scoreboard-row span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scoreboard-row strong {
    color: #ffe18a;
}

.hu-hint {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 12px;
    border: 1px solid rgba(255, 236, 173, .7);
    border-radius: 8px;
    color: #5b2307;
    background: linear-gradient(#fff0a5, #e19a2b);
    font-weight: 900;
    box-shadow: 0 5px 14px rgba(63, 28, 4, .26);
}

.hand-zone {
    position: absolute;
    left: 50%;
    right: auto;
    bottom: 12px;
    z-index: 5;
    width: min(680px, calc(100% - 30px));
    min-height: 132px;
    display: grid;
    gap: 7px;
    align-content: center;
    justify-items: center;
    transform: translateX(-50%);
    padding: 8px 10px;
    border: 1px solid rgba(255, 224, 137, .42);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(68, 30, 12, .74), rgba(26, 12, 7, .78));
    box-shadow: 0 10px 24px rgba(30, 10, 3, .32), inset 0 1px 0 rgba(255,255,255,.1);
}

.hand-cards,
.bright-cards {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

.bright-cards {
    flex-wrap: nowrap;
}

.hand-cards {
    min-height: 78px;
}

.discard-slot {
    width: 64px;
    height: 86px;
    display: grid;
    place-items: center;
    border-radius: 8px;
}

.discard-slot .card {
    width: 58px;
    height: 80px;
}

.discard-slot .card:not(:disabled) {
    border-color: #ffe18a;
    box-shadow: 0 0 0 2px rgba(255, 225, 142, .24), 0 6px 12px rgba(40, 18, 4, .28), inset 0 1px 0 rgba(255,255,255,.84);
}

.empty-slot {
    border: 1px dashed rgba(255, 226, 148, .35);
    color: rgba(255, 236, 191, .6);
    background: rgba(36, 15, 6, .28);
    font-size: 13px;
    font-weight: 900;
}

.card {
    position: relative;
    width: 58px;
    height: 80px;
    display: grid;
    grid-template-rows: 16px 1fr 16px;
    align-items: center;
    justify-items: center;
    padding: 4px;
    border: 1px solid #a8a8a8;
    border-radius: 8px;
    color: #151515;
    line-height: 1;
    background: linear-gradient(135deg, #ffffff, #ececec);
    box-shadow: 0 4px 8px rgba(40, 18, 4, .26), inset 0 1px 0 rgba(255,255,255,.84);
}

button.card {
    min-height: 80px;
}

.card::before {
    content: "";
    position: absolute;
    inset: 3px;
    pointer-events: none;
    border: 1px solid rgba(0,0,0,.08);
    border-radius: 6px;
}

.card.red {
    color: #b91f1f;
}

.card.laizi {
    color: #552c00;
    border-color: #d89d1f;
    background: linear-gradient(135deg, #fff7ce, #f4c15b);
}

.card.chance {
    color: #063b52;
    border-color: #35a8c7;
    background: linear-gradient(135deg, #f0fbff, #9fe7ff);
}

.card.selected {
    transform: translateY(-10px);
    outline: 3px solid #ffe18a;
    box-shadow: 0 0 22px rgba(255, 219, 83, .48), 0 7px 12px rgba(40, 18, 4, .3);
}

.card-rank {
    font-size: 24px;
    font-weight: 900;
}

.card-suit,
.card-small {
    font-size: 12px;
    font-weight: 800;
}

.game-controls {
    position: static;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 8px;
}

.game-controls button {
    min-width: 74px;
    min-height: 40px;
    padding: 0 12px;
    color: #fff4d2;
    font-size: 15px;
    font-weight: 900;
}

.action-hu {
    background: linear-gradient(#ff674c, #b41e1a);
}

.action-draw {
    background: linear-gradient(#55a8ff, #1c5dba);
}

.action-pass {
    background: linear-gradient(#8c9ca8, #40505f);
}

.action-discard {
    background: linear-gradient(#ffd978, #bd741b);
    color: #4b2108 !important;
}

.empty-state {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 18px;
    color: #fff1c5;
    font-size: 20px;
    font-weight: 900;
    text-align: center;
    background: url("/static/i/bg.png") center / cover no-repeat;
}

.room-side {
    position: absolute;
    inset: 0;
    z-index: 6;
    pointer-events: none;
}

.voice-panel,
.chat-panel {
    pointer-events: auto;
}

.voice-panel {
    position: absolute;
    z-index: 2;
    top: 74px;
    right: 14px;
    display: grid;
    justify-items: center;
    gap: 5px;
}

.mic-button {
    width: 48px;
    height: 48px;
    min-height: 48px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 2px solid rgba(255, 225, 142, .7);
    border-radius: 50%;
    color: #fff2be;
    background: linear-gradient(#7d3a19, #30140a);
}

.mic-button svg {
    width: 26px;
    height: 26px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2.3;
}

.voice-panel.is-active .mic-button {
    color: #3a2105;
    background: linear-gradient(#fff0a6, #d88c26);
}

.voice-panel.is-muted .mic-button {
    color: #ffe1d6;
    background: linear-gradient(#bd3c32, #632015);
}

.voice-panel.is-starting .mic-button {
    color: #fff7cf;
    background: linear-gradient(#b67322, #5a2a10);
    animation: micPulse 1s ease-in-out infinite;
}

.voice-panel.has-error .mic-button {
    color: #fff2ee;
    border-color: rgba(255, 186, 161, .85);
    background: linear-gradient(#b93a32, #50150f);
}

@keyframes micPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 219, 120, .35);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(255, 219, 120, 0);
    }
}

.voice-status {
    min-width: 56px;
    min-height: 20px;
    padding: 2px 7px;
    border-radius: 8px;
    color: #ffeec5;
    background: rgba(36, 15, 6, .55);
    font-size: 11px;
    text-align: center;
}

.voice-peers {
    display: none;
}

.chat-panel {
    position: absolute;
    left: 12px;
    bottom: 120px;
    width: 300px;
    max-width: calc(100vw - 24px);
    color: #fff3cf;
}

.chat-tab {
    display: inline-grid;
    grid-template-columns: auto auto;
    gap: 8px;
    align-items: center;
    min-height: 34px;
    padding: 0 10px;
    color: #4b230a;
    font-weight: 900;
    background: linear-gradient(#ffe390, #d98725);
}

.chat-tab strong {
    min-width: 22px;
    min-height: 22px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    color: #fff6d8;
    background: #b82923;
    font-size: 12px;
}

.chat-drawer {
    display: none;
    margin-top: 6px;
    overflow: hidden;
    border: 1px solid rgba(255, 224, 137, .45);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(74, 32, 12, .9), rgba(25, 12, 7, .9));
    box-shadow: 0 10px 26px rgba(28, 10, 3, .32), inset 0 1px 0 rgba(255,255,255,.08);
}

.chat-panel.is-open .chat-drawer {
    display: grid;
    grid-template-rows: minmax(0, 132px) auto;
}

.chat-messages {
    min-height: 0;
    overflow-y: auto;
    padding: 9px 10px 4px;
}

.chat-message {
    margin-bottom: 7px;
}

.chat-meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    color: rgba(255, 238, 195, .68);
    font-size: 11px;
}

.chat-meta strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-content {
    margin-top: 3px;
    padding: 5px 7px;
    border-radius: 8px;
    color: #3c1f0c;
    background: rgba(255, 244, 204, .92);
    font-size: 13px;
    line-height: 1.35;
    word-break: break-word;
}

.chat-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 56px;
    gap: 6px;
    padding: 8px;
    border-top: 1px solid rgba(255, 224, 137, .2);
}

.chat-form button {
    padding: 0;
}

.settlement-modal {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    z-index: 30;
    padding: 18px;
    background: rgba(20, 8, 3, .55);
}

.settlement-modal[hidden] {
    display: none;
}

.settlement-dialog {
    width: min(620px, 100%);
    max-height: min(680px, 92vh);
    overflow: hidden;
    border: 1px solid rgba(255, 224, 137, .58);
    border-radius: 8px;
    color: #ffecc0;
    background: linear-gradient(180deg, rgba(94, 42, 15, .98), rgba(42, 18, 8, .98));
    box-shadow: 0 18px 46px rgba(18, 6, 2, .36);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
}

.settlement-head,
.settlement-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px;
    border-bottom: 1px solid rgba(255, 224, 137, .22);
}

.settlement-actions {
    justify-content: flex-end;
    border-top: 1px solid rgba(255, 224, 137, .22);
    border-bottom: 0;
}

.settlement-head h2 {
    margin: 0;
    color: #ffe18a;
    font-size: 18px;
}

.settlement-body {
    overflow-y: auto;
    padding: 10px 12px;
}

.settlement-section-title {
    margin: 8px 0 4px;
    color: #ffe18a;
    font-size: 13px;
    font-weight: 900;
}

.settlement-row {
    display: grid;
    grid-template-columns: 1fr 64px 76px 88px 110px;
    gap: 8px;
    align-items: center;
    min-height: 40px;
    border-bottom: 1px solid rgba(255, 224, 137, .14);
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 22px;
    transform: translateX(-50%);
    z-index: 40;
    max-width: min(520px, calc(100vw - 32px));
    padding: 10px 14px;
    border: 1px solid rgba(255, 224, 137, .42);
    border-radius: 8px;
    color: #fff2bf;
    background: rgba(53, 23, 9, .94);
    box-shadow: 0 10px 28px rgba(20, 8, 3, .3);
}

@media (max-width: 980px) {
    .room-header {
        grid-template-columns: 150px 1fr auto;
    }

    .brand-title {
        font-size: 18px;
    }

    .room-actions {
        grid-template-columns: 76px repeat(3, auto);
    }

    .table-center {
        width: min(430px, calc(100% - 300px));
    }
}

@media (orientation: landscape) and (max-height: 520px) {
    .room-header {
        top: 6px;
        left: 8px;
        right: 8px;
        min-height: 48px;
        grid-template-columns: 132px minmax(210px, 1fr) auto;
        gap: 6px;
        padding: 5px 7px;
    }

    .brand-title {
        font-size: 16px;
    }

    .brand-subtitle,
    .meta-label {
        font-size: 10px;
    }

    .room-meta {
        gap: 5px;
    }

    .room-meta > div {
        min-height: 34px;
        padding: 3px 6px;
    }

    .room-meta strong {
        font-size: 13px;
    }

    .room-actions {
        grid-template-columns: 70px repeat(3, 44px);
        gap: 5px;
    }

    .room-actions button {
        min-height: 32px;
        padding: 0 4px;
        font-size: 12px;
    }

    .room-actions input {
        min-height: 32px;
        padding: 0 6px;
        font-size: 12px;
    }

    .auth-panel {
        padding: 12px;
    }

    .seat {
        width: 132px;
        min-height: 52px;
        grid-template-columns: 38px minmax(0, 1fr);
        gap: 6px;
        padding: 5px;
    }

    .seat-avatar {
        width: 36px;
        height: 36px;
        font-size: 17px;
    }

    .seat-name {
        font-size: 12px;
    }

    .seat-badges {
        gap: 2px;
        margin-top: 3px;
    }

    .badge {
        min-height: 17px;
        padding: 0 4px;
        font-size: 10px;
    }

    .seat-top {
        top: 60px;
    }

    .seat-bottom {
        bottom: 100px;
    }

    .table-waiting .seat-bottom {
        bottom: 12px;
    }

    .seat-left {
        left: 8px;
        top: 42%;
    }

    .seat-right {
        right: 8px;
        top: 42%;
    }

    .table-surface::after {
        inset: 58px 68px 64px;
    }

    .table-center {
        top: 43%;
        width: min(430px, calc(100% - 270px));
        min-width: 300px;
    }

    .table-waiting .table-center {
        top: 45%;
    }

    .lobby-title {
        font-size: 22px;
    }

    .table-waiting .lobby-title {
        display: none;
    }

    .table-waiting .last-action {
        min-height: 18px;
        font-size: 11px;
    }

    .table-waiting .scoreboard {
        width: min(260px, 100%);
        padding: 6px 8px;
    }

    .table-row {
        gap: 5px;
        margin: 5px 0;
    }

    .turn-notice {
        min-height: 24px;
        margin-bottom: 4px;
        padding: 0 8px;
        font-size: 11px;
    }

    .draw-dock {
        grid-template-columns: 60px minmax(0, 1fr);
        gap: 7px;
        margin-bottom: 4px;
    }

    .deck-button {
        width: 54px;
        height: 70px;
        min-height: 70px;
        padding: 5px;
    }

    .deck-button strong {
        font-size: 21px;
    }

    .bright-zone {
        padding: 5px 6px 6px;
    }

    .zone-head {
        margin-bottom: 4px;
        font-size: 11px;
    }

    .last-action {
        font-size: 11px;
    }

    .hu-hint {
        min-height: 27px;
        padding: 0 9px;
        font-size: 12px;
    }

    .hand-zone {
        bottom: 8px;
        width: min(560px, calc(100% - 18px));
        min-height: 110px;
        padding: 6px 8px;
        gap: 5px;
    }

    .hand-cards {
        min-height: 62px;
    }

    .hand-cards,
    .bright-cards {
        gap: 5px;
    }

    .card {
        width: 44px;
        height: 62px;
        grid-template-rows: 13px 1fr 13px;
        padding: 3px;
    }

    button.card {
        min-height: 62px;
    }

    .card.selected {
        transform: translateY(-8px);
        outline-width: 2px;
    }

    .discard-slot {
        width: 48px;
        height: 66px;
    }

    .discard-slot .card {
        width: 44px;
        height: 62px;
    }

    .card-rank {
        font-size: 19px;
    }

    .card-suit,
    .card-small {
        font-size: 10px;
    }

    .game-controls {
        gap: 6px;
    }

    .game-controls button {
        min-width: 56px;
        min-height: 34px;
        padding: 0 7px;
        font-size: 13px;
    }

    .voice-panel {
        top: 62px;
        right: 10px;
    }

    .mic-button {
        width: 40px;
        height: 40px;
        min-height: 40px;
    }

    .mic-button svg {
        width: 22px;
        height: 22px;
    }

    .voice-status {
        min-height: 18px;
        font-size: 10px;
    }

    .chat-panel {
        left: 8px;
        bottom: 96px;
        width: 236px;
    }

    .chat-tab {
        min-height: 30px;
        padding: 0 8px;
        font-size: 12px;
    }

    .chat-panel.is-open .chat-drawer {
        grid-template-rows: minmax(0, 94px) auto;
    }

    .chat-messages {
        padding: 7px 8px 3px;
    }

    .chat-content {
        padding: 4px 6px;
        font-size: 12px;
    }

    .chat-form {
        grid-template-columns: minmax(0, 1fr) 48px;
        gap: 5px;
        padding: 6px;
    }

    .chat-form input,
    .chat-form button {
        min-height: 30px;
        font-size: 12px;
    }

    .settlement-row {
        grid-template-columns: 1fr 54px 64px 64px;
    }

    .settlement-row .settlement-best {
        display: none;
    }
}

@media (max-width: 760px) and (orientation: landscape) {
    .room-header {
        grid-template-columns: 120px 1fr;
    }

    .room-actions {
        grid-column: 1 / -1;
        grid-template-columns: 86px repeat(3, 1fr);
    }

    .seat-left,
    .seat-right {
        top: 38%;
    }

    .table-center {
        top: 41%;
        width: min(420px, calc(100% - 250px));
        min-width: 300px;
    }

    .table-waiting .table-center {
        top: 45%;
    }

    .draw-dock {
        grid-template-columns: 56px minmax(0, 1fr);
        gap: 5px;
    }

    .game-controls button {
        min-width: 52px;
        padding: 0 6px;
    }

    .chat-panel {
        width: 216px;
    }
}

@media (orientation: portrait) and (max-width: 900px) {
    .orientation-guard {
        position: fixed;
        inset: 0;
        z-index: 100;
        display: grid;
        place-items: center;
        color: #fff1c4;
        background: #1d1309 url("/static/i/bg.png") center / cover no-repeat;
        text-align: center;
        font-size: 22px;
        font-weight: 900;
        text-shadow: 0 3px 0 #5a260d;
    }

    .orientation-guard::after {
        content: "把手机横过来后继续游戏";
        display: block;
        margin-top: 12px;
        color: rgba(255,245,214,.82);
        font-size: 14px;
        font-weight: 700;
    }
}
