/* ===================== Design tokens ===================== */
:root {
    --bg: #090d18;
    --panel: rgba(255, 255, 255, 0.05);
    --panel-2: rgba(255, 255, 255, 0.08);
    --line: rgba(255, 255, 255, 0.09);
    --text: #e9eef7;
    --muted: #8d98ad;
    --gold: #f6c453;
    --gold-2: #e8a72c;
    --red: #ef4444;
    --green: #22c55e;
    --blue: #60a5fa;
    --radius: 14px;
    --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
    --font:
        ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
        "Helvetica Neue", sans-serif;
    --display: ui-rounded, "SF Pro Rounded", "Nunito", var(--font);
}
/* Board theme — dark (default) */
body {
    --tile: #182035;
    --tile-hover: #1f2943;
    --ink: #e4e9f3;
    --ink-2: #8f9bb3;
    --grid: #070a13;
    --felt: #0f1729;
    --felt-glow: rgba(96, 165, 250, 0.1);
    --watermark: rgba(255, 255, 255, 0.035);
    --deck-line: rgba(255, 255, 255, 0.13);
    --deck-ink: rgba(255, 255, 255, 0.28);
    --card-bg: #182035;
    --card-ink: #e4e9f3;
    --card-muted: #94a0b8;
    --card-line: rgba(255, 255, 255, 0.09);
    --card-btn: rgba(255, 255, 255, 0.07);
    --card-btn-h: rgba(255, 255, 255, 0.13);
    --feed-bg: rgba(255, 255, 255, 0.045);
    --feed-ink: #aeb8cc;
    --deed-bg: #182035;
    --deed-ink: #e4e9f3;
    --deed-line: rgba(255, 255, 255, 0.12);
    --deed-hl: rgba(246, 196, 83, 0.14);
    --band-line: rgba(0, 0, 0, 0.5);
    --mort-bg: rgba(4, 7, 14, 0.62);
    --c-chance: #fb923c;
    --c-chest: #60a5fa;
    --c-go: #f87171;
    --c-rail: #cbd5e1;
}
body.board-light {
    --tile: #fbf8ef;
    --tile-hover: #fffdf5;
    --ink: #1b2a22;
    --ink-2: #4a5a50;
    --grid: #213128;
    --felt: #cfe5d3;
    --felt-glow: rgba(255, 255, 255, 0.55);
    --watermark: rgba(220, 38, 38, 0.11);
    --deck-line: rgba(0, 0, 0, 0.25);
    --deck-ink: rgba(0, 0, 0, 0.35);
    --card-bg: #ffffff;
    --card-ink: #1b2a22;
    --card-muted: #5b6770;
    --card-line: #e5e7eb;
    --card-btn: #f1f3f5;
    --card-btn-h: #e5e8eb;
    --feed-bg: rgba(255, 255, 255, 0.6);
    --feed-ink: #2f3e35;
    --deed-bg: #fffef9;
    --deed-ink: #1b2a22;
    --deed-line: #ced4da;
    --deed-hl: #fff3bf;
    --band-line: rgba(0, 0, 0, 0.35);
    --mort-bg: rgba(40, 40, 40, 0.45);
    --c-chance: #e8590c;
    --c-chest: #1c7ed6;
    --c-go: #dc2626;
    --c-rail: #1f2937;
}
* {
    box-sizing: border-box;
}
html,
body {
    margin: 0;
    min-height: 100%;
}
body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    background-image:
        radial-gradient(
            1100px 700px at 10% -10%,
            rgba(76, 110, 245, 0.18),
            transparent 60%
        ),
        radial-gradient(
            900px 700px at 110% 110%,
            rgba(168, 85, 247, 0.14),
            transparent 60%
        );
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
}
::selection {
    background: rgba(246, 196, 83, 0.35);
}
a {
    color: var(--gold);
}
h1,
h2,
h3,
h4 {
    font-family: var(--display);
    margin: 0;
    letter-spacing: -0.01em;
}
.muted {
    color: var(--muted);
}
.small {
    font-size: 12px;
}
.hidden {
    display: none !important;
}
.icon {
    width: 1.15em;
    height: 1.15em;
    flex: none;
    vertical-align: -0.2em;
}
.loading {
    color: var(--muted);
    text-align: center;
    margin-top: 35vh;
    font-size: 18px;
}
.loading::before {
    content: "";
    display: block;
    width: 34px;
    height: 34px;
    margin: 0 auto 14px;
    border-radius: 50%;
    border: 3px solid var(--line);
    border-top-color: var(--gold);
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===================== Controls ===================== */
button {
    font: inherit;
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
    padding: 9px 15px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--panel-2);
    transition:
        transform 0.08s,
        background 0.15s,
        border-color 0.15s,
        box-shadow 0.15s,
        opacity 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    white-space: nowrap;
}
button:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.13);
    border-color: rgba(255, 255, 255, 0.18);
}
button:active:not(:disabled) {
    transform: translateY(1px) scale(0.98);
}
button:disabled {
    opacity: 0.38;
    cursor: not-allowed;
}
button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}
button.primary {
    color: #1d1400;
    border: none;
    background: linear-gradient(180deg, #ffd56e, var(--gold-2));
    box-shadow:
        0 6px 20px rgba(246, 196, 83, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
button.primary:hover:not(:disabled) {
    background: linear-gradient(180deg, #ffe08c, #f0b23c);
}
button.big {
    font-size: 17px;
    padding: 13px 26px;
    border-radius: 12px;
}
button.danger {
    color: #fecaca;
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.35);
}
button.danger:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.22);
}
button.ghost {
    background: transparent;
    border-color: transparent;
    color: var(--muted);
}
button.ghost:hover:not(:disabled) {
    color: var(--text);
    background: var(--panel);
}
button.sm {
    padding: 5px 10px;
    font-size: 12px;
    border-radius: 8px;
    gap: 5px;
}
button.icon-btn {
    padding: 0;
    width: 34px;
    height: 34px;
}
.kbd {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border: 1px solid currentColor;
    border-radius: 5px;
    padding: 1px 5px;
    opacity: 0.55;
}

input,
select {
    font: inherit;
    color: var(--text);
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: rgba(0, 0, 0, 0.25);
    transition: border-color 0.15s;
}
input:focus {
    border-color: rgba(246, 196, 83, 0.6);
}
input::placeholder {
    color: #66718a;
}
input[type="number"] {
    font-variant-numeric: tabular-nums;
}
.field {
    display: block;
    margin: 16px 0 0;
}
.field > span {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 7px;
}

.switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 0;
    border-top: 1px solid var(--line);
    cursor: pointer;
}
.switch:first-child {
    border-top: none;
}
.switch .txt b {
    display: block;
    font-size: 14px;
}
.switch .txt small {
    color: var(--muted);
}
.switch input {
    appearance: none;
    -webkit-appearance: none;
    width: 44px;
    height: 26px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.15);
    position: relative;
    flex: none;
    cursor: pointer;
    transition: background 0.2s;
    padding: 0;
    border: none;
}
.switch input::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}
.switch input:checked {
    background: var(--green);
}
.switch input:checked::after {
    transform: translateX(18px);
}

.seg {
    display: flex;
    gap: 4px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 4px;
    flex-wrap: wrap;
}
.seg button {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px 6px;
    border-radius: 8px;
    color: var(--muted);
}
.seg button.on {
    background: var(--gold);
    color: #1d1400;
    box-shadow: 0 2px 10px rgba(246, 196, 83, 0.3);
}
.cash-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
}
.cash-row .seg {
    flex: 1;
    flex-wrap: nowrap;
}
.cash-row .seg button {
    min-width: 0;
    padding-left: 6px;
    padding-right: 6px;
}
.cash-row .cash-input {
    width: 130px;
    flex: none;
    position: relative;
}
.cash-row .cash-input span {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-weight: 700;
}
.cash-row .cash-input input {
    padding-left: 28px;
    height: 100%;
}

.glass {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: var(--shadow);
}
.chip-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 3px 8px;
    border-radius: 99px;
    background: var(--panel-2);
    color: var(--muted);
}
.chip-tag .icon {
    width: 12px;
    height: 12px;
    vertical-align: 0;
}
.chip-tag.gold {
    background: rgba(246, 196, 83, 0.14);
    color: var(--gold);
}
.chip-tag.red {
    background: rgba(239, 68, 68, 0.14);
    color: #fca5a5;
}
.chip-tag.green {
    background: rgba(34, 197, 94, 0.14);
    color: #86efac;
}
.chip-tag.blue {
    background: rgba(96, 165, 250, 0.14);
    color: #93c5fd;
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    flex: none;
    display: grid;
    place-items: center;
    font-weight: 800;
    color: #fff;
    font-size: 16px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    box-shadow:
        inset 0 -3px 0 rgba(0, 0, 0, 0.2),
        0 0 0 2px rgba(255, 255, 255, 0.12);
    position: relative;
}
.avatar .icon {
    width: 58%;
    height: 58%;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35));
}
.avatar.lg {
    width: 56px;
    height: 56px;
    font-size: 24px;
}
.avatar.sm {
    width: 26px;
    height: 26px;
    font-size: 12px;
}
.avatar .status {
    position: absolute;
    right: -1px;
    bottom: -1px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    border: 2px solid #141a2a;
    background: var(--green);
}
.avatar .status.off {
    background: #6b7280;
}

/* ===================== Home ===================== */
.home {
    max-width: 1060px;
    margin: 0 auto;
    padding: 48px 20px 60px;
}
.hero {
    text-align: center;
    margin-bottom: 38px;
}
.logo {
    display: inline-block;
    font-family: var(--display);
    font-weight: 900;
    font-size: clamp(40px, 7vw, 68px);
    letter-spacing: 0.12em;
    color: #fff;
    background: linear-gradient(180deg, #5f44e4, #391ccc);
    padding: 6px 34px 8px;
    border-radius: 10px;
    border: 4px solid #fff;
    box-shadow: 0 18px 50px rgba(239, 68, 68, 0.3);
    transform: rotate(-2deg);
}
.hero p {
    color: var(--muted);
    margin: 18px 0 0;
    font-size: 17px;
}
.home-grid {
    display: grid;
    grid-template-columns: 1.35fr 1fr;
    gap: 22px;
    align-items: start;
}
@media (max-width: 860px) {
    .home-grid {
        grid-template-columns: 1fr;
    }
}
.card {
    padding: 26px;
}
.card h2 {
    font-size: 22px;
    margin-bottom: 4px;
}
.card .sub {
    color: var(--muted);
    margin: 0 0 6px;
    font-size: 14px;
}
.maps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
@media (max-width: 560px) {
    .maps {
        grid-template-columns: 1fr;
    }
}
.map-card {
    text-align: left;
    display: block;
    padding: 12px;
    border-radius: 12px;
    border: 2px solid var(--line);
    background: rgba(0, 0, 0, 0.2);
    white-space: normal;
}
.map-card.on {
    border-color: var(--gold);
    background: rgba(246, 196, 83, 0.07);
    box-shadow: 0 0 0 4px rgba(246, 196, 83, 0.1);
}
.map-card .strip {
    display: flex;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}
.map-card .strip span {
    flex: 1;
}
.map-card b {
    display: block;
    font-size: 15px;
}
.beta-badge {
    display: inline-block;
    margin-left: 7px;
    padding: 2px 6px;
    border-radius: 99px;
    background: rgba(244, 63, 94, 0.16);
    color: #fb7185;
    font-size: 9px;
    font-weight: 900;
    line-height: 1.2;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    vertical-align: 2px;
}
.map-card small {
    display: block;
    color: var(--muted);
    font-weight: 500;
    margin-top: 3px;
    line-height: 1.35;
}
.rules {
    padding: 4px 16px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--line);
}
.cta {
    width: 100%;
    margin-top: 22px;
}
.side-stack {
    display: flex;
    flex-direction: column;
    gap: 22px;
}
.join-row {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}
.recent {
    list-style: none;
    padding: 0;
    margin: 12px 0 0;
}
.recent li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.2);
    margin-top: 6px;
}
.recent li .grow {
    flex: 1;
    min-width: 0;
}
.recent li b {
    display: block;
    font-size: 14px;
}
.recent li small {
    color: var(--muted);
    font-family: ui-monospace, monospace;
    font-size: 11px;
}
.feature-list {
    list-style: none;
    padding: 0;
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 14px;
}
.feature-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 7px 0;
}
.feature-list .icon {
    width: 30px;
    height: 30px;
    padding: 6px;
    border-radius: 9px;
    background: rgba(246, 196, 83, 0.1);
    color: var(--gold);
}

.center-card {
    max-width: 460px;
    margin: 12vh auto;
}
.center-card .info {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 12px 0;
}

/* ===================== Lobby ===================== */
.lobby-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 22px;
    max-width: 1100px;
    margin: 0 auto;
    padding: 40px 20px;
}
.lobby-wrap.no-chat {
    grid-template-columns: minmax(0, 1fr);
    max-width: 820px;
}
@media (max-width: 900px) {
    .lobby-wrap {
        grid-template-columns: 1fr;
    }
}
.lobby-head {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.lobby-head h2 {
    font-size: 26px;
    flex: 1;
}
.progress {
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 99px;
    overflow: hidden;
    margin: 16px 0 6px;
}
.progress > div {
    height: 100%;
    background: linear-gradient(90deg, var(--gold), #ffe08c);
    border-radius: 99px;
    transition: width 0.4s;
}
.share {
    display: flex;
    gap: 8px;
    margin-top: 18px;
}
.share input {
    font-family: ui-monospace, monospace;
    font-size: 13px;
}
.seats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 12px;
    margin-top: 20px;
}
.seat {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid var(--line);
    position: relative;
    min-height: 76px;
}
.seat.me {
    border-color: rgba(246, 196, 83, 0.5);
}
.seat .who {
    min-width: 0;
    flex: 1;
}
.seat .who b {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.seat .tags {
    display: flex;
    gap: 4px;
    margin-top: 4px;
    flex-wrap: wrap;
}
.seat .x {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 26px;
    height: 26px;
    padding: 0;
    border-radius: 50%;
}
.seat.empty {
    border-style: dashed;
    justify-content: center;
    color: var(--muted);
    background: transparent;
    flex-direction: column;
    gap: 8px;
}
.seat.empty .pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--muted);
    animation: breathe 2.4s ease-in-out infinite;
}
@keyframes breathe {
    50% {
        opacity: 0.25;
    }
}
@keyframes pop {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
}
.palette {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}
.palette button {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    padding: 0;
    border: 3px solid transparent;
}
.palette button.on {
    border-color: #fff;
    box-shadow: 0 0 0 2px var(--gold);
}
.palette button:disabled {
    opacity: 0.22;
}
.host-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 18px;
}
.rule-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}
.section-title {
    font-size: 12px;
    font-weight: 800;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 24px 0 0;
}

/* ===================== Chat / log ===================== */
.tabs {
    display: flex;
    gap: 4px;
    padding: 6px;
    border-bottom: 1px solid var(--line);
}
.tabs button {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--muted);
    padding: 8px;
    font-size: 13px;
}
.tabs button.on {
    background: var(--panel-2);
    color: var(--text);
}
.badge {
    background: var(--red);
    color: #fff;
    font-size: 10px;
    border-radius: 99px;
    padding: 1px 6px;
    min-width: 18px;
}
.chat {
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.chat-msgs,
.log-msgs {
    flex: 1;
    overflow-y: auto;
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.45;
    min-height: 120px;
}
.chat-msgs .m {
    margin: 4px 0;
    word-wrap: break-word;
}
.chat-msgs .m b {
    margin-right: 6px;
}
.chat-msgs .empty,
.log-msgs .empty {
    color: var(--muted);
    text-align: center;
    margin-top: 30px;
    font-size: 13px;
}
.chat-form {
    display: flex;
    gap: 6px;
    padding: 10px;
    border-top: 1px solid var(--line);
}
.log-line {
    display: flex;
    gap: 9px;
    align-items: flex-start;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: #c2cadb;
}
.log-line .icon {
    color: var(--muted);
    margin-top: 2px;
    width: 14px;
    height: 14px;
}
.log-line:first-child {
    color: var(--text);
}
.log-line:first-child .icon {
    color: var(--gold);
}
.lobby-chat {
    display: flex;
    flex-direction: column;
    height: min(70vh, 620px);
    overflow: hidden;
}
.lobby-chat h3 {
    padding: 16px 16px 0;
    font-size: 15px;
    display: flex;
    gap: 8px;
    align-items: center;
}
.lobby-chat .chat {
    flex: 1;
    min-height: 0;
}

/* ===================== Game layout ===================== */
.game {
    display: flex;
    gap: 18px;
    padding: 14px;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
}
.board-wrap {
    flex: none;
    position: relative;
}
.side {
    width: 360px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: calc(100vh - 28px);
    position: sticky;
    top: 14px;
}
.side-head {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 8px 8px 12px;
}
.side-head .brand {
    font-family: var(--display);
    font-weight: 900;
    letter-spacing: 0.1em;
    font-size: 12px;
    background: var(--red);
    color: #fff;
    padding: 3px 7px;
    border-radius: 5px;
    margin-right: 6px;
}
.side-head .title {
    flex: 1;
    font-weight: 700;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.players {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    flex: none;
    max-height: 48vh;
}
.feed-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 180px;
    overflow: hidden;
}
.feed-panel > .chat,
.feed-panel > .log-msgs {
    flex: 1;
    min-height: 0;
}
@media (max-width: 1180px) {
    .game {
        flex-direction: column;
        align-items: center;
    }
    .side {
        width: min(100%, 760px);
        height: auto;
        position: static;
    }
    .players {
        max-height: none;
    }
    .feed-panel {
        height: 380px;
    }
}

.pcard {
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid transparent;
    position: relative;
    transition:
        background 0.3s,
        border-color 0.3s;
}
.pcard.current {
    border-color: rgba(246, 196, 83, 0.45);
    background: rgba(246, 196, 83, 0.06);
}
.pcard.bankrupt {
    opacity: 0.4;
    filter: grayscale(0.8);
}
.pcard .row1 {
    display: flex;
    align-items: center;
    gap: 10px;
}
.pcard .nm {
    flex: 1;
    min-width: 0;
}
.pcard .nm b {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
}
.pcard .nm .tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 3px;
}
.pcard .cash {
    font-family: var(--display);
    font-weight: 800;
    font-size: 18px;
    font-variant-numeric: tabular-nums;
    position: relative;
}
.pcard .turn-ind {
    position: absolute;
    left: -1px;
    top: 12px;
    bottom: 12px;
    width: 3px;
    border-radius: 3px;
    background: var(--gold);
}
.pcard .trade-btn {
    opacity: 0;
    transition: opacity 0.15s;
}
.pcard:hover .trade-btn {
    opacity: 1;
}
.sets {
    display: flex;
    gap: 3px;
    margin-top: 8px;
    flex-wrap: wrap;
}
.sets:empty {
    display: none;
}
.sets .grp {
    display: flex;
    gap: 1px;
    padding: 2px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
}
.sets .grp.full {
    background: rgba(246, 196, 83, 0.22);
    box-shadow: 0 0 0 1px rgba(246, 196, 83, 0.55);
}
.sets .pip {
    width: 9px;
    height: 13px;
    border-radius: 2px;
    cursor: pointer;
    transition: transform 0.1s;
}
.sets .pip:hover {
    transform: scale(1.25);
}
.sets .pip.m {
    opacity: 0.35;
    background-image: repeating-linear-gradient(
        45deg,
        transparent 0 2px,
        rgba(0, 0, 0, 0.5) 2px 4px
    ) !important;
}
.sets .pip.h {
    box-shadow: inset 0 -3px 0 rgba(255, 255, 255, 0.8);
}
.float {
    position: absolute;
    right: 0;
    top: -4px;
    font-size: 14px;
    font-weight: 800;
    pointer-events: none;
    animation: floatUp 1.8s ease-out forwards;
    white-space: nowrap;
}
.float.up {
    color: #4ade80;
}
.float.down {
    color: #f87171;
}
@keyframes floatUp {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-28px);
    }
}
.trades-panel {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.trade-item {
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.2);
    font-size: 13px;
    border: 1px solid var(--line);
}
.trade-item.incoming {
    border-color: rgba(96, 165, 250, 0.45);
    background: rgba(96, 165, 250, 0.06);
}
.trade-item .head {
    display: flex;
    align-items: center;
    gap: 8px;
}
.trade-item .head .icon {
    color: var(--blue);
}
.trade-item .sides {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 8px;
    align-items: center;
    margin: 8px 0;
}
.trade-item .sides > div {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 6px 8px;
    min-height: 34px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    align-items: flex-start;
}
.trade-item .arrow {
    color: var(--muted);
}
.trade-item .actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    align-items: center;
}

/* ===================== Board ===================== */
.board {
    --size: min(calc(100vh - 28px), calc(100vw - 420px));
    --cell: calc(var(--size) / var(--units, 12.2));
    width: var(--size);
    height: var(--size);
    min-width: 600px;
    min-height: 600px;
    display: grid;
    grid-template-columns: 1.6fr repeat(9, 1fr) 1.6fr;
    grid-template-rows: 1.6fr repeat(9, 1fr) 1.6fr;
    gap: 1px;
    background: var(--grid);
    border: 2px solid var(--grid);
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.06);
    color: var(--ink);
    user-select: none;
}
@media (max-width: 1180px) {
    .board {
        --size: min(96vw, 900px);
        min-width: 0;
        min-height: 0;
    }
}
@media (max-width: 640px) {
    .board {
        --size: 96vw;
    }
}
.board.mega {
    --mega-neutral-band: #303a50;
    display: block;
    overflow: visible;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}
.board.mega::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    clip-path: var(--outer-clip);
    background: var(--grid);
    filter: drop-shadow(0 24px 45px rgba(0, 0, 0, 0.55));
}
.board.mega .tile {
    position: absolute;
    background: transparent;
    pointer-events: none;
}
.board.mega .mega-bg {
    position: absolute;
    inset: 0;
    background: var(--tile);
    pointer-events: auto;
}
.board.mega .tile:hover .mega-bg {
    filter: brightness(1.12);
}
.board.mega .tile.hl {
    box-shadow: none;
}
.board.mega .tile.hl .mega-bg {
    filter: drop-shadow(0 0 5px var(--gold));
}
.board.mega .mega-band,
.board.mega .mega-owner {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.board.mega .mega-content {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}
.board.mega .mega-box {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
}
.board.mega .mega-name {
    padding: 1%;
    color: var(--ink);
    font-size: clamp(7px, calc(var(--cell) * 0.155), 15px);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.015em;
    text-transform: uppercase;
    white-space: normal;
    overflow-wrap: normal;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
}
.board.mega .mega-name.long {
    font-size: clamp(7px, calc(var(--cell) * 0.14), 14px);
}
.board.mega .mega-name.xlong {
    font-size: clamp(6.5px, calc(var(--cell) * 0.13), 13px);
}
.board.mega .mega-name.go-text {
    color: var(--c-go);
    font-family: var(--display);
    font-size: calc(var(--cell) * 0.32);
    letter-spacing: 0.02em;
}
.board.mega .mega-price {
    color: var(--ink);
    font-size: clamp(7px, calc(var(--cell) * 0.14), 14px);
    font-weight: 750;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    white-space: nowrap;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
}
.board.mega .mega-icon {
    margin: 0;
    overflow: visible;
    line-height: 0;
}
.board.mega .mega-icon .icon {
    width: 88%;
    height: 88%;
}
.board.mega .mega-buildings {
    gap: 4%;
    overflow: visible;
}
.board.mega .mega-buildings .house {
    width: 14%;
    flex: none;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.55));
}
.board.mega .mega-buildings .hotel {
    width: 38%;
    height: 80%;
    flex: none;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.55));
}
.board.mega .mega-mortgage {
    border: 1px solid rgba(254, 202, 202, 0.65);
    border-radius: 3px;
    background: rgba(153, 27, 27, 0.94);
    color: #fff;
    font-size: clamp(5.5px, calc(var(--cell) * 0.105), 10px);
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0.035em;
    white-space: nowrap;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
}
.board.mega .center {
    position: absolute;
    background-image:
        radial-gradient(
            circle at 25% 20%,
            rgba(56, 189, 248, 0.16),
            transparent 50%
        ),
        radial-gradient(
            circle at 80% 80%,
            rgba(192, 132, 252, 0.16),
            transparent 55%
        );
    box-shadow: inset 0 0 80px rgba(2, 6, 23, 0.22);
}
.board.mega .center-logo {
    color: rgba(56, 189, 248, 0.09);
    text-shadow: 0 0 30px rgba(192, 132, 252, 0.12);
}
.board.mega .center-stack {
    z-index: 1;
}
.board.mega .deck {
    display: none;
}
body.board-light .board.mega {
    --mega-neutral-band: #ded8ca;
}
body.board-light .board.mega .mega-name,
body.board-light .board.mega .mega-price {
    text-shadow: none;
}
.board.space {
    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.65),
        0 0 45px rgba(168, 85, 247, 0.16);
}
.board.space .center {
    background-color: #080d20;
    background-image:
        radial-gradient(
            circle at 15% 20%,
            rgba(255, 255, 255, 0.45) 0 1px,
            transparent 1.5px
        ),
        radial-gradient(
            circle at 75% 35%,
            rgba(255, 255, 255, 0.3) 0 1px,
            transparent 1.5px
        ),
        radial-gradient(
            circle at 45% 80%,
            rgba(255, 255, 255, 0.3) 0 1px,
            transparent 1.5px
        ),
        radial-gradient(
            circle at 50% 45%,
            rgba(88, 28, 135, 0.3),
            transparent 65%
        );
    background-size:
        83px 83px,
        127px 127px,
        169px 169px,
        auto;
}
.board.space .center-logo {
    color: rgba(168, 85, 247, 0.12);
}
.board.mega .tile.airport .mega-bg {
    background-image: linear-gradient(
        145deg,
        rgba(2, 132, 199, 0.14),
        transparent
    );
}
.board.mega .tile.boost .mega-bg {
    background-image: linear-gradient(
        145deg,
        rgba(168, 85, 247, 0.18),
        transparent
    );
}
.board.mega .tile.bonus .mega-bg {
    background-image: linear-gradient(
        145deg,
        rgba(246, 196, 83, 0.15),
        transparent
    );
}
@media (max-width: 640px) {
    .board-wrap {
        max-width: 100%;
        overflow-x: auto;
    }
    .board.mega {
        --size: 700px;
        min-width: 700px;
        min-height: 700px;
    }
    .board.mega .center-logo {
        font-size: calc(var(--cell) * 0.65);
    }
    .board.mega .center-stack {
        gap: 4px;
        padding: 7px;
    }
    .board.mega .feed {
        display: none;
    }
    .board.mega .center.detailed-action .dice,
    .board.mega .center.detailed-action .turn-banner,
    .board.mega .center.detailed-action .tool-row {
        display: none;
    }
    .board.mega .dice {
        gap: calc(var(--cell) * 0.3);
        padding: 0;
    }
    .board.mega .die3d {
        --d: calc(var(--cell) * 0.7);
    }
    .board.mega .turn-banner {
        gap: 6px;
        padding: 3px 10px 3px 3px;
        font-size: 12px;
    }
    .board.mega .action-card {
        width: min(96%, calc(var(--cell) * 7.2));
        gap: 6px;
        padding: 8px;
        border-radius: 12px;
    }
    .board.mega .action-card .msg {
        font-size: 11px;
    }
    .board.mega .action-card h3 {
        font-size: 14px;
    }
    .board.mega .action-card button {
        padding: 7px 10px;
        font-size: 12px;
    }
    .board.mega .offer {
        gap: 6px;
    }
    .board.mega .offer .mini {
        width: 42%;
        min-width: 72px;
        font-size: 9px;
    }
    .board.mega .offer .txt {
        font-size: 11px;
    }
    .board.mega .offer .txt .price {
        font-size: 18px;
    }
    .board.mega .debt-box {
        padding: 7px;
        font-size: 11px;
    }
    .board.mega .tool-row {
        width: 100%;
        gap: 4px;
        flex-wrap: nowrap;
    }
    .board.mega .tool-row button {
        gap: 4px;
        padding: 5px 7px;
        font-size: 10px;
    }
    .board.mega .tool-row button .icon {
        width: 11px;
        height: 11px;
    }
}
.tile {
    background: var(--tile);
    position: relative;
    cursor: pointer;
    container-type: size;
    overflow: hidden;
    transition: background 0.15s;
}
.tile .inner {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 100cqw;
    height: 100cqh;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    line-height: 1.08;
}
.tile.left .inner,
.tile.right .inner {
    width: 100cqh;
    height: 100cqw;
}
.tile.left .inner {
    transform: translate(-50%, -50%) rotate(90deg);
}
.tile.right .inner {
    transform: translate(-50%, -50%) rotate(-90deg);
}
.tile.top .inner {
    flex-direction: column-reverse;
}
.tile.top .band {
    border-bottom: none;
    border-top: 1px solid var(--band-line);
}
.tile.top .nm {
    padding: 0 5% 4%;
}
.tile.top .pr {
    margin-top: 0;
    margin-bottom: auto;
    padding: 14% 0 0;
}
.tile.top .ic {
    margin: 0 0 6%;
}
.tile.top .owner {
    top: 0;
    bottom: auto;
}
.tile:hover {
    background: var(--tile-hover);
}
.tile.hl {
    box-shadow: inset 0 0 0 3px var(--gold);
    z-index: 2;
}
.tile .band {
    width: 100%;
    height: 23%;
    flex: none;
    border-bottom: 1px solid var(--band-line);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4%;
}
.tile .nm {
    font-weight: 800;
    font-size: calc(var(--cell) * 0.135);
    padding: 4% 5% 0;
    text-transform: uppercase;
    letter-spacing: 0.01em;
    overflow-wrap: break-word;
}
.tile .nm.long {
    font-size: calc(var(--cell) * 0.112);
}
.tile .nm.xlong {
    font-size: calc(var(--cell) * 0.098);
    letter-spacing: -0.02em;
}
.tile .pr {
    font-size: calc(var(--cell) * 0.13);
    margin-top: auto;
    padding-bottom: 14%;
    font-weight: 600;
    color: var(--ink-2);
}
.tile .ic {
    margin-top: 7%;
    line-height: 0;
    color: var(--ink);
}
.tile .ic .icon {
    width: calc(var(--cell) * 0.38);
    height: calc(var(--cell) * 0.38);
}
.tile .ic.rail {
    color: var(--c-rail);
}
.tile .ic.airport {
    color: #38bdf8;
}
.tile .ic.bonus {
    color: #f6c453;
}
.tile .ic.boost {
    color: #c084fc;
}
.tile .ic.util-a {
    color: #eab308;
}
.tile .ic.util-b {
    color: #38bdf8;
}
.tile .ic.tax {
    color: #22c55e;
}
.tile .ic.lux {
    color: #c084fc;
}
.tile .ic.chance {
    color: var(--c-chance);
}
.tile .ic.chance .icon {
    width: calc(var(--cell) * 0.46);
    height: calc(var(--cell) * 0.46);
}
.tile .ic.chest {
    color: var(--c-chest);
}
.tile .ic.fortune {
    color: #a855f7;
}
.tile .ic.venture {
    color: #22c55e;
}
.house {
    width: 15%;
    aspect-ratio: 1;
    background: #16a34a;
    clip-path: polygon(50% 0, 100% 45%, 100% 100%, 0 100%, 0 45%);
    box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.2);
}
.hotel {
    width: 38%;
    height: 55%;
    background: #dc2626;
    clip-path: polygon(15% 0, 85% 0, 100% 30%, 100% 100%, 0 100%, 0 30%);
}
.owner {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 9%;
}
.tile .mort {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: var(--mort-bg);
}
.tile .mort span {
    transform: rotate(-30deg);
    color: #fff;
    font-weight: 900;
    font-size: calc(var(--cell) * 0.12);
    letter-spacing: 0.08em;
    background: rgba(185, 28, 28, 0.9);
    padding: 2px 5px;
    border-radius: 3px;
    text-transform: uppercase;
}
/* corners */
.tile.corner .inner {
    justify-content: center;
    gap: 4%;
}
.tile.corner .ic {
    margin: 0;
}
.tile.corner .ic .icon {
    width: calc(var(--cell) * 0.58);
    height: calc(var(--cell) * 0.58);
}
.tile.corner .nm {
    font-size: calc(var(--cell) * 0.16);
    padding: 0 6%;
}
.tile.corner .pr {
    margin: 0;
    padding: 0;
    font-size: calc(var(--cell) * 0.13);
}
.tile.free_parking .ic {
    color: #ef4444;
}
.tile.teleport .ic,
.tile .ic.teleport {
    color: #38bdf8;
}
.tile.reverse .ic,
.tile .ic.reverse {
    color: #f472b6;
}
.tile.go .go-word {
    font-family: var(--display);
    font-weight: 900;
    color: var(--c-go);
    font-size: calc(var(--cell) * 0.62);
    line-height: 0.9;
    letter-spacing: 0.02em;
}
.tile.go .ic {
    color: var(--c-go);
}

/* tokens */
.token-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 5;
}
.token {
    position: absolute;
    width: calc(var(--cell) * 0.36);
    height: calc(var(--cell) * 0.36);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    border: 2px solid #fff;
    box-shadow:
        0 3px 8px rgba(0, 0, 0, 0.5),
        inset 0 -3px 0 rgba(0, 0, 0, 0.2);
    transition:
        left 0.14s ease-out,
        top 0.14s ease-out;
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 900;
    font-size: calc(var(--cell) * 0.18);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
.token .icon {
    width: 62%;
    height: 62%;
}
.board.mega .token {
    width: calc(var(--cell) * 0.2);
    height: calc(var(--cell) * 0.2);
    border-width: 1px;
    font-size: calc(var(--cell) * 0.1);
}
.token.active {
    z-index: 2;
    box-shadow:
        0 0 0 3px rgba(246, 196, 83, 0.9),
        0 6px 14px rgba(0, 0, 0, 0.5);
    animation: bob 2.2s ease-in-out infinite;
}
.board.mega .token.active {
    box-shadow:
        0 0 0 2px rgba(246, 196, 83, 0.9),
        0 3px 8px rgba(0, 0, 0, 0.5);
    animation: none;
}
.travel-fx {
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
}
.travel-beam {
    position: absolute;
    height: max(2px, calc(var(--cell) * 0.06));
    transform-origin: 0 50%;
    background: linear-gradient(90deg, transparent, #38bdf8 15%, #e0f2fe 50%, #38bdf8 85%, transparent);
    box-shadow: 0 0 10px #38bdf8;
    animation: travelBeam 0.85s ease-in-out both;
}
.travel-portal {
    position: absolute;
    width: calc(var(--cell) * 0.9);
    aspect-ratio: 1;
    border: max(2px, calc(var(--cell) * 0.035)) solid #67e8f9;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(224, 242, 254, 0.75), rgba(56, 189, 248, 0.28) 38%, rgba(56, 189, 248, 0.05) 62%, transparent 65%);
    box-shadow: 0 0 18px #38bdf8, inset 0 0 12px #38bdf8;
    animation: portalOpen 0.8s ease-in-out both;
}
.board.space .travel-beam {
    background: linear-gradient(90deg, transparent, #a855f7 15%, #f5f3ff 50%, #22d3ee 85%, transparent);
    box-shadow: 0 0 10px #a855f7;
}
.board.space .travel-portal {
    border-color: #c084fc;
    background: radial-gradient(circle, rgba(245, 243, 255, 0.8), rgba(168, 85, 247, 0.3) 38%, rgba(34, 211, 238, 0.06) 62%, transparent 65%);
    box-shadow: 0 0 18px #a855f7, inset 0 0 12px #22d3ee;
}
.board .token.teleport-out {
    z-index: 7;
    animation: teleportOut 0.3s ease-in forwards;
}
.board .token.teleport-in {
    z-index: 7;
    animation: teleportIn 0.38s cubic-bezier(0.2, 0.9, 0.25, 1.25) both;
}
@keyframes travelBeam {
    0%, 100% { opacity: 0; filter: blur(2px); }
    35%, 65% { opacity: 0.9; filter: blur(0); }
}
@keyframes portalOpen {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.25) rotate(0deg); }
    35% { opacity: 1; transform: translate(-50%, -50%) scale(1.15) rotate(120deg); }
    75% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(240deg); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1.35) rotate(330deg); }
}
@keyframes teleportOut {
    0% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0deg); filter: blur(0); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.08) rotate(180deg); filter: blur(3px); }
}
@keyframes teleportIn {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.08) rotate(-180deg); filter: blur(3px); }
    70% { opacity: 1; transform: translate(-50%, -50%) scale(1.25) rotate(0deg); filter: blur(0); }
    100% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0deg); filter: blur(0); }
}
@keyframes bob {
    50% {
        transform: translate(-50%, -62%);
    }
}

/* center */
.center {
    grid-row: 2 / 11;
    grid-column: 2 / 11;
    background: var(--felt);
    position: relative;
    overflow: hidden;
    background-image: radial-gradient(
        circle at 50% 45%,
        var(--felt-glow),
        transparent 65%
    );
}
.center-logo {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) rotate(-40deg);
    font-family: var(--display);
    font-weight: 900;
    font-size: calc(var(--cell) * 1.15);
    letter-spacing: 0.08em;
    color: var(--watermark);
    white-space: nowrap;
    pointer-events: none;
    text-transform: uppercase;
}
.deck {
    position: absolute;
    width: calc(var(--cell) * 1.9);
    height: calc(var(--cell) * 1.15);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-family: var(--display);
    font-weight: 900;
    font-size: calc(var(--cell) * 0.17);
    border: 2px dashed var(--deck-line);
    color: var(--deck-ink);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.deck .icon {
    width: calc(var(--cell) * 0.32);
    height: calc(var(--cell) * 0.32);
}
.deck.chance {
    left: 9%;
    top: 9%;
    transform: rotate(-45deg) translate(-12%, 0);
    color: var(--c-chance);
    opacity: 0.55;
}
.deck.chest {
    right: 9%;
    bottom: 9%;
    transform: rotate(-45deg) translate(12%, 0);
    color: var(--c-chest);
    opacity: 0.55;
}
.deck.fortune {
    right: 9%;
    top: 9%;
    transform: rotate(45deg) translate(12%, 0);
    color: #a855f7;
    opacity: 0.55;
}
.deck.venture {
    left: 9%;
    bottom: 9%;
    transform: rotate(45deg) translate(-12%, 0);
    color: #22c55e;
    opacity: 0.55;
}
.center-stack {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: calc(var(--cell) * 0.18);
    padding: calc(var(--cell) * 0.4);
}

/* 3D dice */
.dice {
    display: flex;
    gap: calc(var(--cell) * 0.45);
    padding: calc(var(--cell) * 0.1) 0 calc(var(--cell) * 0.15);
}
.die3d {
    --d: calc(var(--cell) * 0.78);
    width: var(--d);
    height: var(--d);
    perspective: calc(var(--cell) * 8);
    position: relative;
}
.die3d .tilt {
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transform: rotateX(-22deg) rotateY(28deg);
}
.die3d .toss {
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
}
.die3d.rolling .toss {
    animation: toss 1.15s cubic-bezier(0.3, 0.6, 0.35, 1);
}
.die3d:nth-child(2).rolling .toss {
    animation-duration: 1.3s;
}
.die3d:nth-child(3).rolling .toss {
    animation-duration: 1.45s;
}
.die3d .cube {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 1.15s cubic-bezier(0.2, 0.75, 0.25, 1);
}
.die3d:nth-child(2) .cube {
    transition-duration: 1.3s;
}
.die3d:nth-child(3) .cube {
    transition-duration: 1.45s;
}
.die3d .face {
    position: absolute;
    inset: 0;
    border-radius: 17%;
    padding: 15%;
    display: grid;
    grid-template: repeat(3, 1fr) / repeat(3, 1fr);
    gap: 3%;
    background: radial-gradient(
        circle at 30% 25%,
        #ffffff,
        #eceae4 70%,
        #d9d5cc
    );
    box-shadow:
        inset 0 0 calc(var(--d) * 0.08) rgba(0, 0, 0, 0.18),
        inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}
.die3d .f1 {
    transform: translateZ(calc(var(--d) / 2));
}
.die3d .f6 {
    transform: rotateY(180deg) translateZ(calc(var(--d) / 2));
}
.die3d .f2 {
    transform: rotateY(90deg) translateZ(calc(var(--d) / 2));
}
.die3d .f5 {
    transform: rotateY(-90deg) translateZ(calc(var(--d) / 2));
}
.die3d .f3 {
    transform: rotateX(90deg) translateZ(calc(var(--d) / 2));
}
.die3d .f4 {
    transform: rotateX(-90deg) translateZ(calc(var(--d) / 2));
}
.die3d .core {
    position: absolute;
    inset: 3%;
    background: #e6e2da;
    transform-style: preserve-3d;
}
.die3d .core.a {
    transform: rotateY(90deg);
}
.die3d .core.b {
    transform: rotateX(90deg);
}
.die3d .face i {
    border-radius: 50%;
    visibility: hidden;
    background: radial-gradient(circle at 35% 30%, #4b5563, #0f172a 70%);
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.6);
}
.die3d .face i.on {
    visibility: visible;
}
.die3d.doubles .face i {
    background: radial-gradient(circle at 35% 30%, #f87171, #991b1b 70%);
}
.die3d .shadow {
    position: absolute;
    left: 4%;
    right: -14%;
    bottom: -26%;
    height: 26%;
    border-radius: 50%;
    background: radial-gradient(closest-side, rgba(0, 0, 0, 0.55), transparent);
    filter: blur(2px);
}
.die3d.rolling .shadow {
    animation: shadow 1.15s cubic-bezier(0.3, 0.6, 0.35, 1);
}
@keyframes toss {
    0% {
        transform: translate3d(-40%, 0, 0);
    }
    30% {
        transform: translate3d(-10%, -85%, calc(var(--d) * 0.6));
    }
    60% {
        transform: translate3d(5%, 0, 0);
    }
    75% {
        transform: translate3d(8%, -18%, 0);
    }
    88% {
        transform: translate3d(4%, 0, 0);
    }
    100% {
        transform: none;
    }
}
@keyframes shadow {
    30% {
        transform: scale(0.55);
        opacity: 0.4;
    }
    60% {
        transform: scale(1);
        opacity: 1;
    }
    75% {
        transform: scale(0.85);
    }
}

.turn-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--card-bg);
    color: var(--card-ink);
    padding: 6px 16px 6px 6px;
    border-radius: 99px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
    font-weight: 800;
    font-size: 15px;
    border: 1px solid var(--card-line);
}
.turn-banner > .icon {
    margin-left: 8px;
    color: var(--gold);
}
.turn-banner.mine {
    background: linear-gradient(180deg, #ffd56e, var(--gold-2));
    color: #1d1400;
    border-color: transparent;
    box-shadow: 0 6px 22px rgba(246, 196, 83, 0.3);
}
.action-card {
    background: var(--card-bg);
    color: var(--card-ink);
    border: 1px solid var(--card-line);
    border-radius: 16px;
    padding: 14px 16px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.3);
    width: min(92%, calc(var(--cell) * 6.4));
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
}
.action-card:empty {
    display: none;
}
.action-card .msg {
    font-size: 14px;
    color: var(--card-muted);
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}
.action-card .msg b {
    color: var(--card-ink);
}
.action-card .btns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}
.action-card button:not(.primary):not(.danger) {
    background: var(--card-btn);
    color: var(--card-ink);
    border-color: var(--card-line);
}
.action-card button:not(.primary):not(.danger):hover:not(:disabled) {
    background: var(--card-btn-h);
}
body.board-light .action-card button.danger {
    color: #b91c1c;
    background: #fef2f2;
    border-color: #fecaca;
}
.action-card h3 {
    font-size: 17px;
    display: flex;
    gap: 8px;
    align-items: center;
}
.offer {
    display: flex;
    align-items: stretch;
    gap: 12px;
    text-align: left;
    width: 100%;
}
.offer .mini {
    width: 38%;
    min-width: 110px;
    border: 2px solid var(--deed-line);
    border-radius: 8px;
    overflow: hidden;
    font-size: 11px;
    flex: none;
    background: var(--deed-bg);
}
.offer .mini .hd {
    padding: 6px;
    text-align: center;
    color: #fff;
    font-weight: 800;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
.offer .mini .hd small {
    display: block;
    font-size: 8px;
    letter-spacing: 0.1em;
    opacity: 0.9;
    text-transform: uppercase;
}
.offer .mini .bd {
    padding: 5px 7px;
}
.offer .mini .bd div {
    display: flex;
    justify-content: space-between;
}
.offer .txt {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    font-size: 14px;
}
.offer .txt .price {
    font-family: var(--display);
    font-size: 24px;
    font-weight: 900;
}
.debt-box {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.45);
    color: var(--card-ink);
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 13px;
    width: 100%;
    display: flex;
    gap: 10px;
    text-align: left;
}
.debt-box .icon {
    color: #f87171;
    width: 22px;
    height: 22px;
}
.auction-bid {
    font-family: var(--display);
    font-size: 30px;
    font-weight: 900;
    line-height: 1;
}
.auction-bar {
    width: 100%;
    height: 5px;
    border-radius: 9px;
    background: var(--card-btn);
    overflow: hidden;
}
.auction-bar > div {
    height: 100%;
    background: linear-gradient(90deg, #f59e0b, #ef4444);
    width: 100%;
    transition-property: width;
    transition-timing-function: linear;
}
.bidders {
    display: flex;
    gap: 4px;
    justify-content: center;
    flex-wrap: wrap;
}
.feed {
    width: min(92%, calc(var(--cell) * 6.4));
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.feed .log-line {
    font-size: 12px;
    color: var(--feed-ink);
    background: var(--feed-bg);
    padding: 4px 10px;
    border-radius: 8px;
    border: none;
}
.feed .log-line span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.feed .log-line:first-child {
    animation: slideIn 0.35s;
    color: var(--card-ink);
}
.feed .log-line:nth-child(2) {
    opacity: 0.7;
}
.feed .log-line:nth-child(3) {
    opacity: 0.45;
}
@keyframes slideIn {
    from {
        transform: translateY(-6px);
        opacity: 0;
    }
}
.tool-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}
.tool-row button {
    background: var(--card-btn);
    color: var(--card-ink);
    border-color: var(--card-line);
    font-size: 13px;
    padding: 7px 12px;
    backdrop-filter: blur(6px);
}
.tool-row button:hover:not(:disabled) {
    background: var(--card-btn-h);
}

/* drawn card */
.card-pop {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 8;
    width: calc(var(--cell) * 4.2);
    min-height: calc(var(--cell) * 2.4);
    border-radius: 14px;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 8px;
    padding: calc(var(--cell) * 0.25);
    color: #1b2a22;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
    animation: cardIn 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.2);
    cursor: pointer;
}
.card-pop.chance {
    background: linear-gradient(160deg, #fff4e6, #ffd8a8);
    border: 3px solid #f76707;
}
.card-pop.chest {
    background: linear-gradient(160deg, #e7f5ff, #a5d8ff);
    border: 3px solid #1c7ed6;
}
.card-pop.fortune {
    background: linear-gradient(160deg, #faf5ff, #e9d5ff);
    border: 3px solid #9333ea;
}
.card-pop.venture {
    background: linear-gradient(160deg, #f0fdf4, #bbf7d0);
    border: 3px solid #16a34a;
}
.card-pop .k {
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    opacity: 0.6;
}
.card-pop .t {
    font-family: var(--display);
    font-weight: 800;
    font-size: calc(var(--cell) * 0.24);
    line-height: 1.2;
}
.card-pop .icon {
    width: calc(var(--cell) * 0.55);
    height: calc(var(--cell) * 0.55);
}
.card-pop.chance .icon {
    color: #e8590c;
}
.card-pop.chest .icon {
    color: #1c7ed6;
}
.card-pop.fortune .icon {
    color: #9333ea;
}
.card-pop.venture .icon {
    color: #16a34a;
}
.card-pop.out {
    animation: cardOut 0.35s forwards;
}
@keyframes cardIn {
    from {
        transform: translate(-50%, -30%) rotateY(90deg) scale(0.6);
        opacity: 0;
    }
}
@keyframes cardOut {
    to {
        transform: translate(-50%, -70%) scale(0.8);
        opacity: 0;
    }
}

/* ===================== Modals ===================== */
.modal-bg {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 16, 0.66);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 16px;
    animation: fade 0.15s;
}
@keyframes fade {
    from {
        opacity: 0;
    }
}
.modal {
    background: #141b2c;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 24px;
    max-width: min(680px, 96vw);
    width: 100%;
    max-height: 92vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow);
    animation: pop 0.2s;
}
.modal.narrow {
    max-width: 390px;
}
.modal .close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
}
.modal h2 {
    font-size: 22px;
    margin-bottom: 14px;
    padding-right: 30px;
    display: flex;
    gap: 10px;
    align-items: center;
}
.modal .foot {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 20px;
    flex-wrap: wrap;
}

.deed {
    background: var(--deed-bg);
    color: var(--deed-ink);
    border-radius: 10px;
    padding: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    border: 1px solid var(--deed-line);
}
.modal-body > .deed,
.deed-modal {
    margin-top: 26px;
}
.deed .hd {
    border-radius: 6px;
    padding: 12px 10px;
    text-align: center;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
}
.deed .hd small {
    display: block;
    font-size: 10px;
    letter-spacing: 0.25em;
    font-weight: 700;
    opacity: 0.9;
    text-transform: uppercase;
}
.deed .hd b {
    display: block;
    font-family: var(--display);
    font-size: 20px;
    text-transform: uppercase;
    margin-top: 2px;
}
.deed .hd .icon {
    width: 34px;
    height: 34px;
    margin-bottom: 4px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
}
.deed table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0 4px;
    font-size: 14px;
}
.deed td {
    padding: 4px 6px;
}
.deed td:last-child {
    text-align: right;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.deed tr.cur td {
    background: var(--deed-hl);
}
.deed tr.cur td:first-child {
    border-radius: 6px 0 0 6px;
}
.deed tr.cur td:last-child {
    border-radius: 0 6px 6px 0;
}
.deed tr.sep td {
    border-top: 1px solid var(--deed-line);
    padding-top: 8px;
}
.deed .own {
    text-align: center;
    font-size: 13px;
    opacity: 0.8;
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.deed p {
    text-align: center;
    margin: 14px 6px 6px;
}
.deed-modal {
    display: grid;
    gap: 16px;
}
.deed-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.deed-actions button {
    width: 100%;
    justify-content: space-between;
}
.deed-actions button > span:first-child {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.mg-group {
    border: 1px solid var(--line);
    border-radius: 12px;
    margin-top: 10px;
    overflow: hidden;
}
.mg-group .gh {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.04);
    font-weight: 700;
    font-size: 13px;
}
.mg-group .gh .sw {
    width: 14px;
    height: 14px;
    border-radius: 4px;
}
.mg-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 13px;
}
.mg-row.not-mine {
    opacity: 0.4;
}
.mg-row .n {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mg-row .hs {
    display: flex;
    gap: 2px;
    width: 64px;
}
.mg-row .hs .house {
    width: 12px;
    height: 12px;
}
.mg-row .hs .hotel {
    width: 26px;
    height: 12px;
}

.flight-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
}
.flight-option {
    justify-content: flex-start;
    width: 100%;
}
.flight-option span {
    flex: 1;
    text-align: left;
}
.flight-option b {
    color: var(--gold);
}

.partner-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.partner-pills button {
    padding: 5px 12px 5px 5px;
    border-radius: 99px;
}
.partner-pills button.on {
    border-color: var(--gold);
    background: rgba(246, 196, 83, 0.12);
}
.trade-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 16px;
}
@media (max-width: 560px) {
    .trade-cols {
        grid-template-columns: 1fr;
    }
}
.trade-col {
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px;
}
.trade-col h4 {
    font-size: 13px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 10px;
}
.props-pick {
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-height: 34vh;
    overflow-y: auto;
}
.prop-opt {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-start;
    font-weight: 500;
    font-size: 13px;
    padding: 7px 10px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid transparent;
    width: 100%;
    white-space: normal;
    text-align: left;
}
.prop-opt .sw {
    width: 10px;
    height: 22px;
    border-radius: 3px;
    flex: none;
}
.prop-opt .pv {
    margin-left: auto;
    color: var(--muted);
    font-size: 12px;
}
.prop-opt .ck {
    color: var(--gold);
    visibility: hidden;
}
.prop-opt.sel {
    border-color: var(--gold);
    background: rgba(246, 196, 83, 0.1);
}
.prop-opt.sel .ck {
    visibility: visible;
}
.money-in {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-top: 10px;
}
.money-in > span {
    color: var(--muted);
    font-weight: 700;
    display: inline-flex;
}
.trade-sum {
    margin-top: 14px;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    font-size: 13px;
    color: var(--muted);
}
.trade-sum b {
    color: var(--text);
}

.winner {
    text-align: center;
}
.winner .trophy .icon {
    width: 76px;
    height: 76px;
    color: var(--gold);
    filter: drop-shadow(0 8px 24px rgba(246, 196, 83, 0.4));
    animation: pop 0.5s;
}
.winner h2 {
    font-size: 30px;
    padding: 0;
    margin: 6px 0 4px;
    justify-content: center;
}
.ranking {
    list-style: none;
    padding: 0;
    margin: 20px 0 0;
    text-align: left;
}
.ranking li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.2);
    margin-top: 6px;
}
.ranking li .pos {
    width: 22px;
    font-weight: 900;
    color: var(--muted);
}
.ranking li .grow {
    flex: 1;
}
.confetti {
    position: fixed;
    top: -12px;
    width: 9px;
    height: 14px;
    z-index: 100;
    pointer-events: none;
    animation: fall linear forwards;
}
@keyframes fall {
    to {
        transform: translateY(110vh) rotate(720deg);
    }
}

#toasts {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 200;
    pointer-events: none;
}
.toast {
    background: #1f2740;
    color: var(--text);
    border: 1px solid var(--line);
    padding: 10px 18px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    font-size: 14px;
    font-weight: 600;
    animation: toastIn 0.25s;
}
.toast.error {
    border-color: rgba(239, 68, 68, 0.5);
    background: #3a1620;
}
.toast.ok {
    border-color: rgba(34, 197, 94, 0.5);
    background: #14301f;
}
.toast.info {
    border-color: rgba(96, 165, 250, 0.5);
    background: #16233d;
}
@keyframes toastIn {
    from {
        transform: translateY(12px);
        opacity: 0;
    }
}

@media (max-width: 700px) {
    .tile .nm {
        font-size: max(5.5px, calc(var(--cell) * 0.135));
    }
    .tile .pr {
        font-size: max(5.5px, calc(var(--cell) * 0.13));
    }
    .feed,
    .deck,
    .center-logo {
        display: none;
    }
    .center-stack {
        gap: 6px;
        padding: 8px;
    }
    .action-card {
        padding: 10px;
        width: 96%;
    }
    .action-card button.big {
        font-size: 15px;
        padding: 10px 16px;
    }
    .game {
        padding: 6px;
    }
    .cash-row {
        flex-direction: column;
    }
    .cash-row .cash-input {
        width: 100%;
    }
}
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
