/* ---------- Bố cục màn chơi: 3 cột ---------- */
.game-layout {
    --left-w: 260px; --right-w: 290px;
    flex: 1; min-height: 0; position: relative;
    display: grid; grid-template-columns: var(--left-w) minmax(0, 1fr) var(--right-w); gap: var(--sp-12);
    padding: var(--sp-10) var(--sp-12);
}
.game-layout.left-slim { --left-w: 40px; }
.game-layout.right-slim { --right-w: 40px; }
.rail { display: flex; flex-direction: column; gap: var(--sp-5); min-height: 0; overflow-y: auto; padding: var(--sp-2); margin: calc(-1 * var(--sp-2)); }
.rail-title { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); min-height: 28px; font: var(--fw-semibold) var(--fs-sm) var(--f-ui); color: var(--table-muted); padding: 0 var(--sp-2) var(--sp-1); }

/* ---------- Ẩn và hiện từng cột ---------- */
.rail-col { display: flex; flex-direction: column; gap: var(--sp-5); min-height: 0; min-width: 0; }
.rail-col.right { flex-direction: row; gap: var(--sp-4); }
.rail-col > .rail { flex: 1 1 auto; }
.rail-col.right > .rail { flex: 1 1 0; min-width: 0; }
.rail-col.slim > .rail { flex: 0 0 auto; }
.rail-col.right.slim { gap: 0; }
.rail-col.right.slim > .rail { flex: 0 0 0; min-width: 0; padding: 0; margin: 0; overflow: visible; }
.panel { display: flex; flex-direction: column; gap: var(--sp-3); min-height: 0; }
.panel-assets { flex-shrink: 0; }
.rail-hide {
    width: 28px; height: 28px; flex-shrink: 0; border: 0; border-radius: var(--r-sm); cursor: pointer;
    display: grid; place-items: center; background: color-mix(in srgb, var(--white) 7%, transparent); color: var(--table-muted);
}
.rail-hide:hover { background: color-mix(in srgb, var(--white) 14%, transparent); color: var(--table-text); }
.rail-hide svg { width: 16px; height: 16px; }
.rail-tabs { display: flex; flex-direction: column; gap: var(--sp-5); flex-shrink: 0; }
.rail-tabs:empty { display: none; }
.rail-tab {
    display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4);
    width: 100%; min-height: 40px; padding: 0 var(--sp-6); border: 0; border-radius: var(--r-sm); cursor: pointer;
    background: var(--plaster); color: var(--ink); box-shadow: var(--shadow-card);
    font: var(--fw-semibold) var(--fs-sm) var(--f-ui);
}
.rail-tab:hover, .rail-tab.on { background: var(--paper); }
.rail-tab:focus-visible, .rail-hide:focus-visible { outline: var(--ring-focus); outline-offset: 2px; }
.rail-col.left .rail-tab, .rail-col.right .rail-tab, .rail-col.slim .rail-tab { flex-direction: column; justify-content: flex-start; width: 40px; padding: var(--sp-8) 0; gap: var(--sp-5); }
.rail-col.left .rail-tab-name, .rail-col.right .rail-tab-name, .rail-col.slim .rail-tab-name { writing-mode: vertical-rl; }
.rail-dots { display: flex; gap: var(--sp-3); }
.rail-col.left .rail-dots { flex-direction: column; }
.rail-dot { width: 10px; height: 10px; border-radius: var(--r-round); background: var(--c); }
.rail-dot.active { box-shadow: 0 0 0 2px var(--plaster), 0 0 0 4px var(--gold); }
.rail-dot.out { opacity: .3; }
.drawer-scrim { display: none; position: fixed; inset: 0; z-index: 34; background: color-mix(in srgb, var(--black) 35%, transparent); }
.panel-tabs { display: none; }
@media (min-width: 901px) {
    .rail.players.is-hidden, .panel.is-hidden { display: none; }
}
/* No room for a panel beside the board, so a hidden panel opens over it. */
@media (min-width: 901px) and (max-width: 1023px) {
    .rail.players.is-hidden.drawer, .panel.is-hidden.drawer {
        display: flex; flex-direction: column; position: fixed; top: 68px; bottom: 8px; z-index: 35;
        width: min(320px, calc(100vw - 80px)); margin: 0; padding: var(--sp-6); overflow-y: auto;
        border-radius: var(--r-md); background: var(--table); box-shadow: var(--shadow-pop);
        animation: pop-in 180ms var(--ease-out);
    }
    .rail.players.drawer { left: 8px; }
    .panel.drawer { right: 8px; }
    .drawer-scrim { display: block; }
}

/* ---------- Thẻ người chơi ---------- */
.player-card { display: grid; grid-template-columns: auto 1fr; column-gap: var(--sp-6); row-gap: var(--sp-4); padding: var(--sp-6) var(--sp-8); align-items: center; }
.player-card.active { box-shadow: var(--ring-gold), var(--shadow-card); }
.player-card.away { opacity: .75; }
.player-card.bankrupt { opacity: .5; }
.player-card .nm { font: var(--fw-semibold) var(--fs-md) var(--f-ui); color: var(--ink-2); display: flex; gap: var(--sp-3); align-items: center; min-width: 0; }
.player-card .p-meta { min-width: 0; }
.p-state-icon { display: contents; }
.player-card .nm span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-card .cash { font: var(--fw-heavy) var(--fs-2xl)/1.15 var(--f-display); font-variant-numeric: tabular-nums; display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); transform-origin: left center; }
.cash-full { white-space: nowrap; }
.player-card .cash.bump-plus { animation: cash-bump-plus 850ms var(--ease-out); }
.player-card .cash.bump-minus { animation: cash-bump-minus 850ms var(--ease-out); }
@keyframes cash-bump-plus { 0% { transform: scale(1); color: inherit; } 25% { transform: scale(1.06); color: var(--good); } 100% { transform: scale(1); color: inherit; } }
@keyframes cash-bump-minus { 0% { transform: scale(1); color: inherit; } 25% { transform: scale(1.06); color: var(--son); } 100% { transform: scale(1); color: inherit; } }
.cash-short { display: none; }
.cash-delta { font: var(--fw-heavy) var(--fs-sm) var(--f-ui); white-space: nowrap; padding: var(--sp-1) var(--sp-3); border-radius: var(--r-pill); animation: delta-pop 1800ms var(--ease-out) forwards; }
.cash-delta.plus { color: var(--good); background: var(--good-bg); }
.cash-delta.minus { color: var(--son); background: var(--son-bg); }
@keyframes delta-pop { 0% { opacity: 0; transform: translateY(6px) scale(.9); } 15% { opacity: 1; transform: translateY(0) scale(1.04); } 25%, 80% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-2px); } }
.p-state { grid-column: 1 / -1; display: flex; align-items: center; gap: var(--sp-3); font: var(--fw-regular) var(--fs-sm) var(--f-ui); color: var(--warn); }
.p-state svg { width: 14px; height: 14px; flex-shrink: 0; }
.player-card.away .p-state, .player-card.bankrupt .p-state { color: var(--ink-3); }
.player-slot { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.jail-tickets { display: flex; flex-wrap: wrap; gap: var(--sp-3); padding: 0 var(--sp-4); }

/* ---------- Tài sản ---------- */
.portfolio { padding: var(--sp-2) var(--sp-8); }
.pf-row { padding: var(--sp-4) 0; border-top: 1px solid var(--plaster-2); }
.pf-row:first-child { border-top: 0; }
.pf-head { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto auto 24px; gap: var(--sp-4); align-items: center; min-height: 32px; cursor: pointer; }
.pf-sw { width: 10px; height: 10px; border-radius: var(--r-xs); background: var(--c); }
.pf-name { font: var(--fw-semibold) var(--fs-md) var(--f-ui); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-count { font: var(--fw-semibold) var(--fs-sm) var(--f-ui); color: var(--ink-3); }
.pf-chev { width: 24px; height: 24px; padding: 0; border: 0; border-radius: var(--r-xs); background: none; color: var(--ink-3); cursor: pointer; display: grid; place-items: center; }
.pf-chev:hover { background: var(--plaster-2); color: var(--ink); }
.pf-chev i { width: 7px; height: 7px; border-right: 1.8px solid currentColor; border-bottom: 1.8px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform 160ms var(--ease-out); }
.pf-row.open .pf-chev i { transform: translateY(2px) rotate(-135deg); }
.pf-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: var(--sp-3); margin-top: var(--sp-4); animation: phase-enter 200ms var(--ease-out); }
.pf-card { display: flex; flex-direction: column; min-height: 76px; padding: 0; overflow: hidden; text-align: left; border: 1px solid var(--plaster-edge); border-radius: var(--r-sm); background: var(--paper); cursor: pointer; font: inherit; }
.pf-card:hover { border-color: var(--ink-3); }
.pf-band { min-height: 12px; padding: 1px var(--sp-2); flex-shrink: 0; background: var(--c); display: flex; align-items: center; justify-content: flex-end; gap: 2px; }
.pf-bldg { width: 13px; height: 13px; display: block; flex-shrink: 0; filter: drop-shadow(0 1px 1px color-mix(in srgb, var(--black) 40%, transparent)); }
.pf-bldg.hotel { width: 16px; height: 13px; }
.pf-bldg svg { width: 100%; height: 100%; display: block; }
.pf-card b { padding: var(--sp-3) var(--sp-4) 0; font: var(--fw-semibold) var(--fs-sm)/1.3 var(--f-ui); color: var(--ink); overflow-wrap: anywhere; }
.pf-card span { margin-top: auto; padding: var(--sp-2) var(--sp-4) var(--sp-4); font: var(--fw-semibold) var(--fs-sm) var(--f-ui); color: var(--ink-2); }
/* A tile that the player does not own keeps its place, so the player sees what is missing. */
.pf-card:not(.mine) { background: transparent; border-style: dashed; }
.pf-card:not(.mine) .pf-band { opacity: .25; }
.pf-card:not(.mine) b, .pf-card:not(.mine) span { color: var(--ink-3); font-weight: var(--fw-regular); }
.pf-hint { font: var(--fw-regular) var(--fs-sm) var(--f-ui); color: var(--ink-3); }
.empty { padding: var(--sp-8) var(--sp-8); font: var(--fw-regular) var(--fs-md) var(--f-ui); color: var(--ink-3); }

/* ---------- Bản tin ---------- */
.feed { padding: var(--sp-2) var(--sp-8); display: flex; flex-direction: column; min-height: 0; }
.feed-list { overflow-y: auto; min-height: 0; }
.ev { display: grid; grid-template-columns: 1fr; padding: var(--sp-1) 0; font: var(--fw-regular) var(--fs-md)/1.38 var(--f-ui); color: var(--ink-2); }
.ev-turn { padding: var(--sp-2) 0; }
.ev-turn + .ev-turn { margin-top: var(--sp-5); }
.ev-who { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-1); font: var(--fw-semibold) var(--fs-md)/1.38 var(--f-ui); color: var(--uc, var(--ink)); }
.ev-who i { width: 8px; height: 8px; border-radius: var(--r-round); flex-shrink: 0; background: var(--uc, var(--ink)); }
.ev-who ~ .ev { padding-left: 14px; }
.ev.collapsed span { overflow-wrap: anywhere; }
.ev.new { color: var(--ink); animation: phase-enter 200ms var(--ease-out); }
.feed .more-row { padding: var(--sp-4) 0 var(--sp-6); border-top: 1px solid var(--plaster-2); }

/* ---------- Bàn cờ ---------- */
.board-col { display: grid; grid-template-rows: auto minmax(0, 1fr); gap: var(--sp-4); justify-items: center; align-items: center; min-height: 0; min-width: 0; position: relative; }
.board-cam { position: relative; display: grid; place-items: center; width: 100%; height: 100%; min-height: 0; }
.board-wrap {
    position: relative;
    width: min(100%, calc(100vh - 152px));
    height: auto;
    max-width: 100%;
    max-height: 100%;
    aspect-ratio: 1 / 1;
    align-self: center;
    justify-self: center;
    container-type: inline-size;
    perspective: 1800px;
}
.board {
    position: absolute; inset: 0;
    display: grid;
    grid-template-columns: 1.45fr repeat(9, 1fr) 1.45fr;
    grid-template-rows: 1.45fr repeat(9, 1fr) 1.45fr;
    padding: 1.2cqw;
    background: var(--plaster-edge);
    border-radius: 2.2cqw;
    box-shadow: 0 2px 0 var(--board-hi) inset, 0 -6px 0 var(--board-lo) inset, 0 40px 80px -30px color-mix(in srgb, var(--black) 75%, transparent), 0 12px 24px color-mix(in srgb, var(--black) 35%, transparent);
    transform: rotateX(16deg);
    transform-origin: 50% 60%;
}
.tile {
    position: relative; margin: 0.2cqw;
    background: var(--plaster); border-radius: 0.6cqw;
    display: flex; flex-direction: column; overflow: hidden;
    box-shadow: 0 1px 0 color-mix(in srgb, var(--white) 70%, transparent) inset, 0 1px 2px color-mix(in srgb, var(--black) 12%, transparent);
    cursor: pointer; border: 0; padding: 0; color: inherit; text-align: center;
    transition: box-shadow 150ms var(--ease-out), background-color 300ms;
}
.tile:hover { box-shadow: 0 0 0 2px var(--ochre), 0 1px 2px color-mix(in srgb, var(--black) 12%, transparent); }
.tile .plate { background: var(--c); flex: 0 0 26%; display: flex; align-items: center; justify-content: center; gap: 0.25cqw; position: relative; }
.tile .plate::after { content: ""; position: absolute; inset: 0.25cqw; border: 1px solid color-mix(in srgb, var(--white) 45%, transparent); border-radius: 0.35cqw; }
.tile .body { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0.2cqw 0.4cqw; gap: 0.15cqw; }
.tile .name { font: var(--fw-bold) var(--fs-board-md)/1.18 var(--f-ui); color: var(--ink); text-wrap: balance; }
.tile .price { font: var(--fw-semibold) var(--fs-board-sm) var(--f-ui); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.tile .icon { width: 3.2cqw; height: 3.2cqw; color: var(--ink-2); flex-shrink: 0; }
.tile .icon svg { width: 100%; height: 100%; }
.tile.corner { background: var(--plaster-2); }
.tile.corner .icon { width: 4.2cqw; height: 4.2cqw; }
.tile.corner .name { font-size: var(--fs-board-lg); }
.tile .visit { font: var(--fw-regular) var(--fs-board-xs)/1.1 var(--f-ui); color: var(--ink-3); }

/* Ô góc 10: Vào Tù / Thăm Tù chia 2 vùng rõ rệt */
.tile.jail-tile { overflow: hidden; }
.jail-layout {
    position: relative; width: 100%; height: 100%;
    display: grid; grid-template-columns: 28% 1fr; grid-template-rows: 1fr 32%;
    background: color-mix(in srgb, var(--paper) 68%, var(--plaster));
}
.jail-cell {
    grid-column: 2; grid-row: 1;
    margin: 0.2cqw 0.2cqw 0 0; border-radius: 0.45cqw;
    background: linear-gradient(145deg, color-mix(in srgb, var(--ochre) 26%, var(--plaster)), color-mix(in srgb, var(--son) 16%, var(--plaster-2)));
    border: 0.18cqw solid var(--ink-2);
    box-shadow: inset 0 0.2cqw 0.5cqw color-mix(in srgb, var(--black) 22%, transparent);
    display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
    padding: 0.25cqw 0.2cqw 0.2cqw; gap: 0.1cqw; position: relative; overflow: hidden;
}
.jail-cell-title {
    position: relative; z-index: 1;
    font: var(--fw-heavy) var(--fs-board-xs)/1.05 var(--f-display);
    color: var(--son-deep); text-transform: uppercase; letter-spacing: 0.02em;
}
.jail-cell-icon { width: 3.4cqw; height: 3.4cqw; flex-shrink: 0; opacity: .92; }
.jail-cell-icon svg { width: 100%; height: 100%; display: block; }
.jail-visit-side {
    grid-column: 1; grid-row: 1 / 3;
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
    padding-top: 1.1cqw;
}
.jail-visit-icon { width: 2.1cqw; height: 2.1cqw; }
.jail-visit-icon svg { width: 100%; height: 100%; display: block; }
.jail-visit-bottom {
    grid-column: 1 / 3; grid-row: 2;
    display: flex; align-items: center; justify-content: center;
    padding: 0 0.4cqw;
    border-top: 0.14cqw dashed color-mix(in srgb, var(--ink) 22%, transparent);
    background: color-mix(in srgb, var(--paper) 75%, var(--plaster));
}
.jail-visit-label { font: var(--fw-bold) var(--fs-board-sm)/1.1 var(--f-ui); color: var(--ink); }

.tile.top { flex-direction: column-reverse; }
.tile.left, .tile.right { flex-direction: row; }
.tile.left { flex-direction: row-reverse; }
.tile.left .plate, .tile.right .plate { flex: 0 0 22%; flex-direction: column; }
.tile.owned { background: color-mix(in srgb, var(--owner) 16%, var(--plaster)); }
.tile .flag {
    position: absolute; top: 0.4cqw; right: 0.4cqw; z-index: 1;
    width: 2cqw; height: 2cqw; border-radius: var(--r-round);
    background: var(--owner); color: var(--white); display: grid; place-items: center;
    font: var(--fw-bold) var(--fs-board-xs) var(--f-display); box-shadow: 0 0 0 0.25cqw var(--plaster);
}
.tile.top .flag { top: auto; bottom: 0.4cqw; }
.tile.left .flag { right: auto; left: 0.4cqw; }
.tile .flag.pop { animation: stamp 300ms var(--ease-out); }
.tile.mortgaged::before {
    content: attr(data-mortgaged); position: absolute; inset: 0; z-index: 2; display: grid; place-items: center;
    font: var(--fw-bold) var(--fs-board-xs) var(--f-ui); color: var(--son);
    background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--plaster) 88%, transparent) 0 6px, color-mix(in srgb, var(--plaster-2) 88%, transparent) 6px 12px);
}
.house {
    position: relative; z-index: 1; flex-shrink: 0;
    width: 1.75cqw; height: 1.75cqw;
    filter: drop-shadow(0 0.22cqw 0.22cqw color-mix(in srgb, var(--black) 45%, transparent));
}
.hotel {
    position: relative; z-index: 1; flex-shrink: 0;
    width: 2.65cqw; height: 2.1cqw;
    filter: drop-shadow(0 0.26cqw 0.28cqw color-mix(in srgb, var(--black) 48%, transparent));
}
.house svg, .hotel svg { width: 100%; height: 100%; display: block; }
.plate .pop { animation: house-drop 300ms var(--ease-out); }
.tile.landing { z-index: 3; box-shadow: 0 0 0 0.4cqw var(--gold), 0 0 3cqw color-mix(in srgb, var(--gold) 70%, transparent); }
.tile.trail { box-shadow: inset 0 0 0 0.25cqw color-mix(in srgb, var(--gold) 60%, transparent); }
.tile.house-highlight { z-index: 3; animation: house-glow 1100ms var(--ease-out) forwards; }
.tile.selected { box-shadow: 0 0 0 0.35cqw var(--ink); }

.board-center {
    grid-column: 2 / 11; grid-row: 2 / 11; margin: 0.2cqw;
    position: relative; border-radius: 1.2cqw; overflow: hidden;
    background: var(--felt); box-shadow: var(--shadow-well);
}
.board-center-art,
.board-center svg { position: absolute; inset: 0; width: 100%; height: 100%; }

/* 2 chồng thẻ úp Cơ hội & Khí vận trang trí ở 2 góc trong sân bàn */
.center-deck {
    position: absolute; z-index: 1; pointer-events: none;
    width: 17.5%; aspect-ratio: 1.5 / 1;
}
.center-deck.chance { top: 3.8%; left: 3.8%; transform: rotate(-9deg); }
.center-deck.chest { bottom: 3.8%; right: 3.8%; transform: rotate(-7deg); }
button.center-deck { pointer-events: auto; padding: 0; border: 0; background: none; cursor: pointer; font: inherit; transition: filter 120ms var(--ease-out); }
button.center-deck:hover { filter: brightness(1.06); }
button.center-deck:focus-visible { outline: var(--ring-focus); outline-offset: 2px; border-radius: 0.9cqw; }
.center-deck-stack {
    position: absolute; inset: 0; border-radius: 0.9cqw;
    background: var(--plaster-shade); border: 0.16cqw solid color-mix(in srgb, var(--ink) 20%, transparent);
    transform: translate(0.45cqw, 0.45cqw);
    box-shadow: 0.35cqw 0.35cqw 0 color-mix(in srgb, var(--ink) 12%, transparent), 0 0.6cqw 1.2cqw color-mix(in srgb, var(--black) 22%, transparent);
}
.center-deck-card {
    position: relative; width: 100%; height: 100%; border-radius: 0.9cqw;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.2cqw;
    padding: 0.6cqw; border: 0.24cqw solid var(--paper);
    box-shadow: 0 0.4cqw 0.9cqw color-mix(in srgb, var(--black) 22%, transparent);
}
.center-deck.chance .center-deck-card {
    background: linear-gradient(135deg, var(--gold-light), var(--ochre));
    color: var(--ink-warm);
}
.center-deck.chest .center-deck-card {
    background: linear-gradient(135deg, var(--son-light), var(--son));
    color: var(--gold-pale);
}
.center-deck .deck-emblem { font: var(--fw-heavy) var(--fs-board-xl)/1 var(--f-display); }
.center-deck .deck-label { font: var(--fw-bold) var(--fs-board-xs)/1.1 var(--f-ui); letter-spacing: 0.01em; text-align: center; }

.token-layer { position: absolute; inset: 1.2cqw; pointer-events: none; }
.token {
    position: absolute; width: 4.4cqw; aspect-ratio: 1; z-index: 5;
    transform: translate(-50%, -50%);
    transition: left var(--token-step-ms, 240ms) var(--ease-out), top var(--token-step-ms, 240ms) var(--ease-out);
    filter: drop-shadow(0 0.75cqw 0.55cqw color-mix(in srgb, var(--black) 42%, transparent));
}
.token .disc {
    width: 100%; height: 100%; border-radius: var(--r-round); color: var(--white); display: grid; place-items: center;
    background: radial-gradient(circle at 32% 24%, color-mix(in srgb, var(--c) 38%, var(--white)), var(--c) 60%, color-mix(in srgb, var(--c) 62%, var(--black)));
    border: 0.3cqw solid var(--white);
    box-shadow: 0 -0.35cqw 0 color-mix(in srgb, var(--black) 32%, transparent) inset, 0 0.2cqw 0 color-mix(in srgb, var(--white) 55%, transparent) inset;
}
.token .disc svg {
    width: 82%; height: 82%;
    transform: translateY(-6%);
    filter: drop-shadow(0 0.25cqw 0.2cqw color-mix(in srgb, var(--black) 36%, transparent));
}
.token.hopping .disc { animation: hop var(--token-step-ms, 240ms) var(--ease-out) infinite; }
.token.active::after {
    content: ""; position: absolute; left: 50%; top: 100%; width: 140%; height: 40%;
    transform: translate(-50%, -30%); border-radius: var(--r-round);
    border: 0.25cqw solid var(--gold); box-shadow: 0 0 1.4cqw var(--gold);
}
.float-pill {
    position: absolute; z-index: 6; transform: translate(-50%, -100%);
    white-space: nowrap; padding: 0.5cqw 1.4cqw; border-radius: var(--r-pill);
    background: var(--white); font: var(--fw-bold) var(--fs-board-lg) var(--f-ui); box-shadow: var(--shadow-card);
    animation: float-up 1600ms var(--ease-out) forwards;
}
.float-pill.plus { color: var(--good); } .float-pill.minus { color: var(--son); }

/* Mobile cam overlays (ẩn trên desktop) */
.mini, .recenter, .board-news { display: none; }
.mini-tile { cursor: pointer; }
.mini-mark { pointer-events: none; }

/* ---------- Sân khấu giữa bàn (không nghiêng, chữ luôn sắc nét) ---------- */
.stage {
    position: absolute; inset: 15% 14% 13%; z-index: 10;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-8);
    pointer-events: none;
}
.stage > * { pointer-events: auto; }
.turn-pill {
    display: flex; align-items: center; gap: var(--sp-5); padding: var(--sp-2) var(--sp-8) var(--sp-2) var(--sp-2); border-radius: var(--r-pill);
    background: var(--ink); color: var(--plaster); box-shadow: var(--shadow-card);
    font: var(--fw-semibold) var(--fs-md) var(--f-ui);
}
.turn-pill .t { font-weight: var(--fw-bold); color: var(--gold); font-variant-numeric: tabular-nums; }
.turn-pill .t.urgent { color: var(--son-bright); }
.stage-toast { max-width: 92%; text-align: center; }
.dice { display: flex; gap: var(--sp-8); transition: opacity 180ms, filter 180ms; }
.dice.idle { opacity: .45; filter: saturate(.6); }
.die-scene { --die-half: 26px; width: 52px; height: 52px; perspective: 340px; }
/* --rest comes from the rolled value. The settle animation ends on it, so the result does not jump. */
.die-cube {
    width: 100%; height: 100%; position: relative;
    transform-style: preserve-3d;
    transform: var(--rest);
}
.die-cube.rolling-l { animation: tumble-l 780ms linear infinite; }
.die-cube.rolling-r { animation: tumble-r 820ms linear infinite; }
.die-cube.settling-l { animation: die-settle-l var(--settle-ms, 320ms) var(--ease-out) both; }
.die-cube.settling-r { animation: die-settle-r var(--settle-ms, 320ms) var(--ease-out) both; }
.die-face {
    position: absolute; inset: 0; border-radius: var(--r-sm); padding: var(--sp-4);
    background: linear-gradient(145deg, var(--white), var(--die-face));
    border: 1px solid color-mix(in srgb, var(--khaki) 45%, transparent);
    box-shadow: 0 -3px 0 var(--plaster-shade) inset, 0 4px 10px color-mix(in srgb, var(--black) 18%, transparent);
    display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr);
    backface-visibility: hidden;
}
.die-face i { width: 9px; height: 9px; border-radius: var(--r-round); background: var(--ink); place-self: center; }
.die-face.red i { background: var(--son); }
.die-cube.doubles .die-face { box-shadow: 0 0 0 2px var(--gold), 0 -3px 0 var(--plaster-shade) inset; }

.waiting { display: flex; align-items: center; gap: var(--sp-5); padding: var(--sp-5) var(--sp-8); border-radius: var(--r-pill); background: color-mix(in srgb, var(--ink) 82%, transparent); color: var(--plaster); font: var(--fw-regular) var(--fs-md) var(--f-ui); }
.waiting b { font-weight: var(--fw-bold); }
.action-stack { display: flex; flex-direction: column; align-items: center; gap: var(--sp-4); width: min(420px, 100%); }
.action-stack.is-placeholder { visibility: hidden; }
.action-stack .row { display: flex; gap: var(--sp-4); width: 100%; }
.action-stack .row > * { flex: 1; }
.action-stack.debt-actions { width: 100%; }
/* The main action takes 2/3 of the row and the trade button takes 1/3; when buildable, 3 buttons share the dock. */
.action-pair { display: flex; gap: var(--sp-3); width: 100%; }
.action-pair .action-main { flex: 2 1 0; min-width: 0; padding: 0 var(--sp-8); white-space: nowrap; }
.action-pair .action-build { flex: 1.15 1 0; min-width: 0; padding: 0 var(--sp-5); white-space: nowrap; }
.action-pair .action-side { flex: 1 1 0; min-width: 0; padding: 0 var(--sp-8); white-space: nowrap; }
.action-pair.three-btns .action-main { flex: 1.35 1 0; padding: 0 var(--sp-4); font-size: var(--fs-lg); }
.action-pair.three-btns .action-build,
.action-pair.three-btns .action-side { flex: 1 1 0; padding: 0 var(--sp-4); font-size: var(--fs-lg); }
.action-bldg-icon { width: 20px; height: 20px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
.action-bldg-icon svg { width: 100%; height: 100%; display: block; }
.build-picker-row { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--sp-2); width: 100%; animation: phase-enter 160ms var(--ease-out); }
.build-pick-chip { gap: var(--sp-2); }
.build-pick-dot { width: 8px; height: 8px; border-radius: var(--r-round); flex-shrink: 0; background: var(--c); }
.build-pick-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.build-pick-chip b { color: var(--warn); font-weight: var(--fw-bold); }
.jail-row .bail-btn { flex: 1; white-space: nowrap; }
.bail-btn .amt { color: var(--son); }

/* ---------- Màn hình hẹp & Mobile camera ---------- */
@media (max-width: 1180px) {
    .game-layout { --left-w: 220px; --right-w: 250px; gap: var(--sp-8); padding: var(--sp-8); }
}
@media (max-width: 900px) {
    .game-layout { display: flex; flex-direction: column; padding: var(--sp-4) var(--sp-5) var(--sp-8); gap: var(--sp-5); }
    /* Below 901 px the panels sit under the board, so they have no slim tabs and no title row. */
    .rail-col { display: contents; }
    .rail-col > .rail { flex: 0 0 auto; }
    .rail-tabs, .rail-hide, .drawer-scrim, .rail-title { display: none; }

    /* Tablet in portrait: the board on top, then the tab row, then the chosen panel. */
    .board-col { order: 1; }
    .panel-tabs {
        order: 2; display: flex; gap: var(--sp-2); padding: var(--sp-2);
        border-radius: var(--r-md); background: color-mix(in srgb, var(--black) 22%, transparent);
    }
    .panel-tab {
        flex: 1 1 0; min-width: 0; min-height: 44px; padding: 0 var(--sp-5);
        display: flex; align-items: center; justify-content: center; gap: var(--sp-4);
        border: 0; border-radius: var(--r-sm); background: transparent; cursor: pointer;
        color: var(--table-muted); font: var(--fw-semibold) var(--fs-md) var(--f-ui);
    }
    .panel-tab.on { background: var(--plaster); color: var(--ink); box-shadow: var(--shadow-card); }
    .panel-tab:focus-visible { outline: var(--ring-focus); outline-offset: 2px; }
    .panel-tab-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .panel-tab-marks { display: inline-flex; align-items: center; gap: var(--sp-3); }
    .panel-tab .rail-dots { gap: var(--sp-2); }
    .panel-tab .rail-dot { width: 7px; height: 7px; }
    .panel-tab .rail-dot.active { box-shadow: 0 0 0 1.5px var(--table-deep), 0 0 0 3px var(--gold); }
    .rail.players, .rail.side-rail { order: 3; }
    .rail.side-rail { overflow: visible; padding: 0; margin: 0; }
    .rail.players:not(.tab-on), .panel:not(.tab-on) { display: none; }

    .rail.players {
        display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-3);
        overflow: visible; padding: 0; margin: 0;
    }
    .player-card {
        display: flex; flex-direction: column; align-items: center; gap: var(--sp-2);
        padding: var(--sp-4) var(--sp-2) var(--sp-3); text-align: center; min-width: 0;
    }
    .player-card .timer-ring svg.ring { inset: -4px; width: calc(100% + 8px); height: calc(100% + 8px); }
    .player-card .p-meta { width: 100%; }
    .player-card .nm { justify-content: center; font-size: var(--fs-xs); }
    .player-card .nm .name-tag { display: none; }
    .player-card .cash { justify-content: center; font-size: var(--fs-md); }
    .cash-full { display: none; }
    .cash-short { display: inline; }
    .player-card .p-state { font-size: var(--fs-xs); justify-content: center; }
    .player-card .p-state-txt { display: none; }
    .jail-tickets { justify-content: center; padding: 0; gap: var(--sp-2); }
    .ticket.mini .tag { display: none; }
    .ticket.mini .main { padding: var(--sp-1) var(--sp-3); }

    /* The whole board fills the width. A short screen (a phone in landscape) keeps it at 420 px or more and scrolls. */
    .board-col { display: block; }
    .board-cam { height: auto; }
    .board-wrap { width: min(100%, max(calc(100dvh - 72px), 420px)); max-height: none; }
}

/* ---------- Phone ---------- */
@media (max-width: 600px) {
    :root { --tabbar-h: calc(62px + env(safe-area-inset-bottom)); }
    /* The fixed action bar and tab bar cover the bottom of the page, so the page ends above them. */
    .game-layout { padding-bottom: calc(var(--tabbar-h) + 128px); }

    .panel-tabs {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 38;
        padding: var(--sp-3) var(--sp-4) calc(6px + env(safe-area-inset-bottom)); border-radius: 0;
        background: var(--table-deep); box-shadow: 0 -6px 16px color-mix(in srgb, var(--black) 30%, transparent);
    }
    .panel-tab { flex-direction: column; gap: var(--sp-2); min-height: 50px; padding: 0 var(--sp-2); font-size: var(--fs-sm); }

    /* A tab opens its panel as a sheet over the board. */
    .rail.players.tab-on, .panel.tab-on { display: none; }
    .game-layout .rail.players.drawer, .game-layout .panel.drawer {
        position: fixed; left: 0; right: 0; bottom: var(--tabbar-h); z-index: 36;
        max-height: calc(100dvh - 56px - var(--tabbar-h) - 12px); overflow-y: auto;
        margin: 0; padding: var(--sp-5) var(--sp-5) var(--sp-8); border-radius: var(--r-lg) var(--r-lg) 0 0;
        background: var(--table); box-shadow: var(--shadow-pop);
        animation: phase-enter 200ms var(--ease-out);
    }
    .game-layout .rail.players.drawer { display: grid; align-content: start; }
    .game-layout .panel.drawer { display: flex; }
    .drawer::before {
        content: ""; grid-column: 1 / -1; justify-self: center; align-self: center; flex-shrink: 0;
        width: 40px; height: 4px; margin-bottom: var(--sp-2); border-radius: var(--r-xs); background: color-mix(in srgb, var(--white) 30%, transparent);
    }
    .drawer-scrim { display: block; z-index: 35; }

    /* The action buttons stay in a fixed bar above the tab bar. */
    .stage > .action-stack {
        position: fixed; left: 0; right: 0; bottom: var(--tabbar-h); z-index: 30;
        width: auto; padding: var(--sp-5) var(--sp-5) var(--sp-4);
        background: var(--table-deep); border-top: 1px solid color-mix(in srgb, var(--white) 8%, transparent);
    }
    .action-pair.three-btns { gap: var(--sp-2); }
    .action-pair.three-btns .action-main,
    .action-pair.three-btns .action-build,
    .action-pair.three-btns .action-side { padding: 0 var(--sp-3); font-size: var(--fs-md); }
    .action-pair.three-btns .action-bldg-icon { width: 16px; height: 16px; }

    /* Camera bám quân */
    .board-col { display: flex; flex-direction: column; align-items: stretch; gap: var(--sp-5); }
    .board-cam {
        display: block; position: relative;
        width: 100%; height: min(calc(100vw - 20px), 52vh);
        overflow: hidden; border-radius: var(--r-md);
        background: color-mix(in srgb, var(--black) 20%, transparent);
        box-shadow: var(--shadow-well);
    }
    /* 240 % of the window keeps the tile names readable, and the camera clamp keeps the window inside the board. */
    .board-wrap {
        position: absolute; left: 50%; top: 50%;
        width: 240%; height: auto; max-width: none; max-height: none; aspect-ratio: 1;
        perspective: none;
        transform: translate(calc(-1 * var(--cam-cx, 50%)), calc(-1 * var(--cam-cy, 50%)));
        transition: transform 280ms var(--ease-out);
    }
    .board { position: absolute; inset: 0; transform: none; }
    .board { --fs-board-md: 1.75cqw; --fs-board-sm: 1.45cqw; }

    .mini {
        display: block; position: absolute; left: 10px; top: 10px; z-index: 6;
        width: 104px; height: 104px; border-radius: var(--r-sm); overflow: hidden;
        background: var(--plaster-edge); border: 2px solid var(--white);
        box-shadow: var(--shadow-card);
    }
    .mini svg { width: 100%; height: 100%; display: block; }
    .recenter { display: inline-flex; position: absolute; right: 10px; top: 10px; z-index: 6; }
    .board-news {
        display: flex; position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 6;
        max-width: calc(100% - 24px); white-space: nowrap; pointer-events: none;
    }

    /* Bottom sheet cho sân khấu */
    .stage {
        position: static; inset: auto; z-index: 10;
        width: 100%; max-width: 100%;
        background: var(--paper); border-radius: var(--r-lg); padding: var(--sp-8);
        box-shadow: var(--shadow-pop);
    }
    .turn-pill { max-width: 100%; flex-wrap: wrap; justify-content: center; }
    .waiting { max-width: 100%; text-align: center; justify-content: center; }
    .die-scene { --die-half: 21px; width: 42px; height: 42px; }
    .die-face i { width: 7px; height: 7px; }
}


.feed-tabs { padding: var(--sp-3) var(--sp-4) 0; }
.chat-box { display: flex; flex-direction: column; gap: var(--sp-4); padding: var(--sp-4) var(--sp-6) var(--sp-6); }
.chat-list { display: flex; flex-direction: column-reverse; gap: var(--sp-3); max-height: 172px; overflow-y: auto; }
.chat-msg { display: flex; align-items: baseline; gap: var(--sp-3); font: var(--fw-regular) var(--fs-sm)/1.4 var(--f-ui); word-break: break-word; }
.chat-msg.me { font-weight: var(--fw-regular); }
.chat-dot { width: 7px; height: 7px; border-radius: var(--r-round); flex-shrink: 0; transform: translateY(-1px); background: var(--c); }
.chat-who { font-weight: var(--fw-semibold); color: var(--ink); white-space: nowrap; }
.chat-txt { color: var(--ink); }
.chat-form { display: flex; gap: var(--sp-4); }
.chat-entry { flex: 1; min-width: 0; }
.chat-send { flex-shrink: 0; }

/* ---------- Game-over sheet ---------- */
.gameover-sheet {
    width: min(560px, 100%); max-height: calc(100dvh - 40px);
    display: flex; flex-direction: column;
}
.gameover-fact { margin-top: var(--sp-2); font: var(--fw-semibold) var(--fs-md)/1.4 var(--f-ui); color: var(--ink); }
.gameover-body { flex: 1; min-height: 0; gap: var(--sp-6); padding: var(--sp-8) var(--sp-10) var(--sp-6); overflow-y: auto; }
.go-podium { display: flex; align-items: flex-end; justify-content: center; gap: var(--sp-5); }
.go-pod {
    flex: 0 1 140px; min-width: 0;
    display: flex; flex-direction: column; align-items: center; gap: var(--sp-2);
    padding: var(--sp-5) var(--sp-4) 0; border-radius: var(--r-md) var(--r-md) 0 0; background: var(--plaster); text-align: center;
}
.go-pod-1 { background: var(--warn-bg); box-shadow: 0 0 0 2px var(--ochre); }
.go-pod-name {
    max-width: 100%; font: var(--fw-bold) var(--fs-sm)/1.25 var(--f-ui); color: var(--ink);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}
.go-pod-worth { font: var(--fw-heavy) var(--fs-lg)/1.2 var(--f-display); color: var(--ink); }
.go-pod-step {
    align-self: stretch; margin: var(--sp-2) calc(-1 * var(--sp-4)) 0; height: 24px; border-radius: var(--r-sm) var(--r-sm) 0 0;
    display: grid; place-items: center;
    background: var(--plaster-2); font: var(--fw-heavy) var(--fs-lg) var(--f-display); color: var(--ink-2);
}
.go-pod-1 .go-pod-step { height: 46px; background: var(--ochre); color: var(--ink); }
.go-pod-2 .go-pod-step { height: 34px; }
.go-panel { display: flex; flex-direction: column; gap: var(--sp-4); }
.go-dot { width: 9px; height: 9px; border-radius: var(--r-round); flex-shrink: 0; background: var(--c); }
.go-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: var(--fw-semibold); color: var(--ink); }
.go-rank-list, .go-moment-list { list-style: none; display: flex; flex-direction: column; gap: var(--sp-2); }
.go-rank-row {
    display: grid; grid-template-columns: 26px 9px minmax(0, 7.5em) minmax(0, 1fr) auto; align-items: center; gap: var(--sp-4);
    padding: var(--sp-2) var(--sp-4); border-radius: var(--r-sm); background: color-mix(in srgb, var(--ink) 4%, transparent); font: var(--fw-regular) var(--fs-sm)/1.35 var(--f-ui);
}
.go-rank { font: var(--fw-heavy) var(--fs-md) var(--f-display); color: var(--ink-2); }
.go-rank-row.out .go-name { color: var(--ink-3); }
.go-worth { font: var(--fw-bold) var(--fs-md) var(--f-display); color: var(--ink); white-space: nowrap; }
/* Cash, land and houses. The red and the green stay for money lost and money gained. */
.worth-bar { display: flex; height: 10px; border-radius: var(--r-pill); overflow: hidden; background: color-mix(in srgb, var(--ink) 6%, transparent); }
.worth-bar i, .worth-legend i { display: block; height: 100%; }
.worth-bar .cash, .worth-legend .cash { background: var(--river); }
.worth-bar .land, .worth-legend .land { background: var(--ochre); }
.worth-bar .houses, .worth-legend .houses { background: var(--table); }
.worth-legend { display: flex; justify-content: flex-end; gap: var(--sp-6); font: var(--fw-regular) var(--fs-xs) var(--f-ui); color: var(--ink-3); }
.worth-legend span { display: inline-flex; align-items: center; gap: var(--sp-2); }
.worth-legend i { width: 10px; height: 10px; border-radius: var(--r-xs); }
.go-moment-row {
    display: grid; grid-template-columns: 9px minmax(0, 8em) 1fr; align-items: baseline; gap: var(--sp-4);
    padding: var(--sp-3) var(--sp-4); border-radius: var(--r-sm); background: color-mix(in srgb, var(--ink) 4%, transparent); font: var(--fw-regular) var(--fs-sm)/1.45 var(--f-ui);
}
.go-moment { color: var(--ink-2); }
.go-empty { padding: var(--sp-6) var(--sp-2); font: var(--fw-regular) var(--fs-md)/1.5 var(--f-ui); color: var(--ink-3); text-align: center; }
.go-ledger { display: flex; flex-direction: column; gap: var(--sp-2); }
.go-ledger-row {
    display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); gap: var(--sp-4); align-items: center;
    padding: var(--sp-2) var(--sp-4); border-radius: var(--r-xs); background: color-mix(in srgb, var(--ink) 4%, transparent); font: var(--fw-regular) var(--fs-sm)/1.35 var(--f-ui);
}
.go-ledger-row.head { background: none; color: var(--ink-3); font-weight: var(--fw-semibold); font-size: var(--fs-xs); }
.go-ledger-row .num { text-align: right; white-space: nowrap; }
.go-ledger-row .lost { color: var(--son); font-weight: var(--fw-bold); }
.go-ledger-row .gained { color: var(--good); font-weight: var(--fw-bold); }
.go-who { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.gameover-foot {
    display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: var(--sp-4);
    padding: var(--sp-6) var(--sp-10) var(--sp-8); border-top: 1px dashed color-mix(in srgb, var(--ink) 15%, transparent);
}
.gameover-review { margin-right: auto; }
.gameover-wait { font: var(--fw-regular) var(--fs-sm) var(--f-ui); color: var(--ink-3); }
.results-chip { color: var(--gold); font-weight: var(--fw-bold); }
@media (max-width: 600px) {
    .gameover-backdrop { padding: 0; }
    .gameover-sheet { width: 100%; height: 100dvh; max-height: none; border-radius: 0; }
    .gameover-body { padding: var(--sp-6); }
    .gameover-foot { padding: var(--sp-5) var(--sp-6) var(--sp-8); }
    .gameover-action { flex: 1 1 auto; }
    .gameover-review { margin-right: 0; }
    .gameover-wait { flex: 1 1 100%; text-align: center; }
    .go-rank-row { grid-template-columns: 24px 9px minmax(0, 6em) minmax(0, 1fr) auto; gap: var(--sp-3); }
    /* The three column names do not fit on one line at 360 px. */
    .go-ledger-row.head .num { white-space: normal; line-height: 1.25; align-self: end; }
    }

.round-divider {
    display: flex; align-items: center; gap: var(--sp-4);
    margin: var(--sp-4) 0 var(--sp-2); font: var(--fw-semibold) var(--fs-xs)/1.2 var(--f-ui);
    color: var(--ink-3); letter-spacing: .04em;
}
.round-divider::before, .round-divider::after {
    content: ""; flex: 1; height: 1px; background: color-mix(in srgb, var(--ink) 8%, transparent);
}

.ev-line { line-height: 1.5; }
.seg-user {
    font-weight: var(--fw-semibold); color: var(--uc, var(--ink));
    padding: 0 var(--sp-2); border-radius: var(--r-xs);
    background: color-mix(in srgb, var(--uc, var(--ink)) 10%, transparent);
}
.seg-dice {
    display: inline-block; min-width: 18px; text-align: center;
    padding: 0 var(--sp-2); border-radius: var(--r-xs);
    background: var(--ink); color: var(--gold); font-weight: var(--fw-semibold); font-size: var(--fs-xs);
}
.seg-tile {
    display: inline; font-weight: var(--fw-semibold); color: var(--ink);
    padding: var(--sp-1) var(--sp-2); border-radius: var(--r-xs);
    background: color-mix(in srgb, var(--tc, var(--khaki)) 14%, transparent);
    border-bottom: 1.5px solid var(--tc, var(--khaki));
}
.seg-money { font-weight: var(--fw-semibold); }
.seg-money.plus { color: var(--good); }
.seg-money.minus { color: var(--son); }
.seg-money.bid { color: var(--warn); }
.seg-hi { font-weight: var(--fw-semibold); color: var(--warn); }


/* ---------- Vòng chơi ---------- */
.round-chip { color: var(--table-text); font-weight: var(--fw-semibold); }
/* Light red on the dark header, so the warning text stays readable. */
.round-chip.late { color: color-mix(in srgb, var(--son) 45%, var(--white)); background: color-mix(in srgb, var(--son) 24%, transparent); }
.close-ledger-btn, .tb-item.close-ledger-btn { color: var(--white); background: var(--son); }
button.close-ledger-btn:hover { background: var(--son-deep); }
