/* ============ THEMES ============ */
:root {
  --font: 'Outfit', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --radius: 14px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
[data-theme='dark'] {
  --bg: #0f1020; --bg2: #171932; --panel: #1d2040; --panel2: #252957; --line: #2f3468;
  --text: #eef0ff; --muted: #9aa0d0; --primary: #7c5cff; --primary2: #9b82ff; --accent: #22d3a6;
  --danger: #ff5c7a; --warn: #ffb547; --tile: #20244a; --tile-text: #e6e8ff; --board: #14163a;
  --board-center: radial-gradient(circle at 50% 40%, #2a2f6b 0%, #171a3d 70%);
  --shadow: 0 10px 30px rgba(0, 0, 0, .35); --glow: 0 0 0 2px rgba(124, 92, 255, .5), 0 0 24px rgba(124, 92, 255, .35);
}
[data-theme='classic'] {
  --bg: #c9e3cf; --bg2: #b7d8bf; --panel: #fffdf6; --panel2: #f3efe1; --line: #d8d1bb;
  --text: #1d1d1d; --muted: #6b6656; --primary: #c8102e; --primary2: #e0323f; --accent: #1b8a3a;
  --danger: #c8102e; --warn: #d98b00; --tile: #fbf6e6; --tile-text: #1d1d1d; --board: #cfe8d3;
  --board-center: radial-gradient(circle at 50% 40%, #e3f2e5 0%, #c3e0c8 75%);
  --shadow: 0 8px 22px rgba(40, 40, 0, .18); --glow: 0 0 0 2px rgba(200, 16, 46, .45), 0 0 18px rgba(200, 16, 46, .25);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); background: var(--bg); color: var(--text); overflow: hidden; min-width: 1180px;
  transition: background .4s var(--ease), color .4s;
}
#bg-fx { position: fixed; inset: 0; z-index: -1; background:
  radial-gradient(600px 400px at 10% 10%, color-mix(in srgb, var(--primary) 25%, transparent), transparent),
  radial-gradient(500px 400px at 90% 90%, color-mix(in srgb, var(--accent) 18%, transparent), transparent); }
button, input, select { font-family: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.center { text-align: center; }
.mt { margin-top: 18px; } .mt-s { margin-top: 8px; }
.row { display: flex; align-items: center; } .row.gap { gap: 8px; } .row.between { justify-content: space-between; } .grow { flex: 1; }
h1, h3, h4 { margin: 0 0 10px; } h3 { font-size: 17px; font-weight: 700; } h4 { font-size: 14px; color: var(--muted); font-weight: 600; }

/* ============ BUTTONS / INPUTS ============ */
.btn {
  border: 0; border-radius: 10px; padding: 9px 16px; font-weight: 700; font-size: 14px; cursor: pointer; color: var(--text);
  background: var(--panel2); transition: transform .12s var(--ease), filter .15s, box-shadow .2s; white-space: nowrap;
}
.btn:hover { filter: brightness(1.12); transform: translateY(-1px); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; filter: none; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary2)); color: #fff; box-shadow: 0 6px 18px color-mix(in srgb, var(--primary) 40%, transparent); }
.btn-secondary { background: var(--panel2); border: 1px solid var(--line); }
.btn-ghost { background: transparent; border: 1px solid var(--line); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--accent); color: #fff; }
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn-lg { padding: 13px 20px; font-size: 15px; }
.btn-xl { padding: 16px; font-size: 18px; width: 100%; border-radius: 14px; }
input[type=text], input:not([type]), input[type=number] {
  background: var(--bg2); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 10px 12px; font-size: 14px; width: 100%; outline: none;
}
input:focus { border-color: var(--primary); box-shadow: var(--glow); }
.field { display: block; margin-bottom: 14px; } .field > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.code-input { text-transform: uppercase; letter-spacing: 4px; font-weight: 800; text-align: center; font-size: 18px !important; }
.toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; user-select: none; }
.toggle input { display: none; }
.toggle span { width: 40px; height: 22px; border-radius: 99px; background: var(--line); position: relative; transition: .2s; flex: none; }
.toggle span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .2s var(--ease); }
.toggle input:checked + span { background: var(--accent); }
.toggle input:checked + span::after { left: 21px; }
.toggle.disabled { opacity: .6; pointer-events: none; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 18px 0 12px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.badge { background: var(--danger); color: #fff; font-size: 10px; border-radius: 99px; padding: 1px 6px; margin-left: 4px; }

/* ============ HOME ============ */
.screen { position: fixed; inset: 0; }
.home-wrap { max-width: 1000px; margin: 0 auto; padding: 50px 20px; height: 100%; overflow: auto; }
.logo { text-align: center; margin-bottom: 30px; }
.logo h1 { font-size: 64px; font-weight: 900; letter-spacing: -2px; }
.logo h1 em, .brand em { font-style: normal; background: linear-gradient(135deg, var(--primary), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo .tag { color: var(--muted); margin: 0; font-size: 18px; }
.logo-dice { font-size: 54px; display: flex; justify-content: center; gap: 10px; }
.logo-dice span { display: inline-block; animation: bob 2.4s ease-in-out infinite; }
.logo-dice span:nth-child(2) { animation-delay: -1.2s; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-8deg); } 50% { transform: translateY(-10px) rotate(8deg); } }
.home-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 20px; }
.home-foot { text-align: center; margin-top: 20px; }
.avatar-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.avatar-pick button { width: 40px; height: 40px; font-size: 22px; border-radius: 10px; border: 2px solid transparent; background: var(--bg2); cursor: pointer; transition: .15s; }
.avatar-pick.small button { width: 34px; height: 34px; font-size: 18px; }
.avatar-pick button:hover { transform: scale(1.1); }
.avatar-pick button.sel { border-color: var(--primary); box-shadow: var(--glow); }
.avatar-pick button.taken { opacity: .25; pointer-events: none; }
.invite-callout { background: color-mix(in srgb, var(--accent) 15%, transparent); border: 1px solid var(--accent); border-radius: 12px; padding: 14px; margin-bottom: 14px; display: grid; gap: 8px; }
.room-list { display: grid; gap: 8px; max-height: 360px; overflow: auto; }
.room-item { display: flex; align-items: center; gap: 10px; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.room-item .name { font-weight: 700; } .room-item .meta { font-size: 12px; color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 30px 0; }

/* ============ LOBBY ============ */
.topbar { height: 60px; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--panel) 80%, transparent); backdrop-filter: blur(8px); }
.brand { font-weight: 900; font-size: 20px; } .brand.small { font-size: 18px; margin-bottom: 12px; }
.room-title { font-weight: 700; color: var(--muted); }
.lobby-grid { display: grid; grid-template-columns: 1fr 1.1fr 1fr; gap: 18px; padding: 18px; height: calc(100% - 60px); }
.lobby-grid > .panel { overflow: auto; }
.lobby-players { display: grid; gap: 6px; }
.lp { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--bg2); border-left: 4px solid var(--c); animation: slideIn .35s var(--ease); }
.lp .av { font-size: 22px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--c) 30%, transparent); }
.lp .nm { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lp .tagx { font-size: 10px; padding: 2px 6px; border-radius: 6px; background: var(--panel2); color: var(--muted); font-weight: 700; }
.lp .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); } .lp .dot.off { background: var(--danger); }
.lp .kick { opacity: .7; }
.lp.empty-slot { border-left-color: var(--line); color: var(--muted); font-style: italic; animation: none; }
@keyframes slideIn { from { opacity: 0; transform: translateX(-12px); } }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.swatches button { width: 26px; height: 26px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; transition: .15s; }
.swatches button.sel { border-color: var(--text); transform: scale(1.15); }
.swatches button.taken { opacity: .2; pointer-events: none; }
.invite-box { display: grid; gap: 8px; }
.code-big { font-size: 40px; font-weight: 900; letter-spacing: 10px; text-align: center; padding: 6px; border-radius: 12px; background: var(--bg2); border: 1px dashed var(--line); }
.map-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.map-card { background: var(--bg2); border: 2px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; text-align: center; transition: .2s var(--ease); }
.map-card:hover { transform: translateY(-2px); }
.map-card.sel { border-color: var(--primary); box-shadow: var(--glow); }
.map-card .mini { width: 70px; height: 70px; margin: 0 auto 8px; display: grid; gap: 1px; padding: 2px; background: var(--line); border-radius: 6px; }
.map-card .mini i { background: var(--tile); border-radius: 1px; }
.map-card .mini i.c { background: var(--primary); }
.map-card b { display: block; } .map-card small { color: var(--muted); }
.map-card.locked { cursor: default; }
.rules { display: grid; gap: 7px; }
.rule { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; }
.rule .desc { font-size: 11px; color: var(--muted); }
.rule select { background: var(--bg2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 6px; }
.rule select:disabled { opacity: .7; }

/* ============ CHAT ============ */
.chat { display: flex; flex-direction: column; min-height: 0; height: 100%; }
.chat-log { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 4px; font-size: 13px; padding: 4px 2px; min-height: 120px; }
.lobby-chat { height: 220px; }
.chat-log .m b { margin-right: 4px; } .chat-log .sys { color: var(--muted); font-style: italic; font-size: 12px; }
.chat-form { display: flex; gap: 6px; margin-top: 6px; } .chat-form input { padding: 8px 10px; }

/* ============ GAME LAYOUT ============ */
#game { display: grid; grid-template-columns: 290px 1fr 320px; }
.side { padding: 14px; display: flex; flex-direction: column; gap: 12px; min-height: 0; background: color-mix(in srgb, var(--panel) 55%, transparent); border-color: var(--line); }
.side.left { border-right: 1px solid var(--line); } .side.right { border-left: 1px solid var(--line); }
.board-area { display: grid; place-items: center; padding: 12px; min-width: 0; min-height: 0; }
.players { flex: 1; overflow: auto; display: grid; align-content: start; gap: 8px; }
.pc { position: relative; padding: 10px 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); border-left: 5px solid var(--c); transition: .3s var(--ease); }
.pc.turn { box-shadow: 0 0 0 2px var(--c), 0 0 22px color-mix(in srgb, var(--c) 55%, transparent); transform: translateX(4px); }
.pc.bankrupt { opacity: .4; filter: grayscale(1); }
.pc .top { display: flex; align-items: center; gap: 8px; }
.pc .av { font-size: 20px; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 30%, transparent); flex: none; }
.pc .nm { font-weight: 700; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.pc .money { font-weight: 800; font-variant-numeric: tabular-nums; font-size: 16px; }
.pc .money.neg { color: var(--danger); }
.pc .sub { display: flex; gap: 6px; align-items: center; margin-top: 6px; font-size: 11px; color: var(--muted); flex-wrap: wrap; }
.pc .chip { background: var(--bg2); border-radius: 6px; padding: 1px 6px; }
.pc .chip.warn { background: color-mix(in srgb, var(--warn) 25%, transparent); color: var(--warn); }
.pc .chip.bad { background: color-mix(in srgb, var(--danger) 25%, transparent); color: var(--danger); }
.pc .acts { display: flex; gap: 4px; margin-top: 6px; }
.pc .sets { display: flex; gap: 2px; flex-wrap: wrap; margin-top: 6px; }
.pc .sets i { width: 10px; height: 14px; border-radius: 2px; opacity: .25; }
.pc .sets i.own { opacity: 1; }
.float { position: absolute; right: 12px; top: 6px; font-weight: 900; pointer-events: none; animation: floatUp 1.6s var(--ease) forwards; font-size: 15px; z-index: 5; text-shadow: 0 1px 4px rgba(0,0,0,.4); }
.float.plus { color: var(--accent); } .float.minus { color: var(--danger); }
@keyframes floatUp { 0% { opacity: 0; transform: translateY(8px) scale(.8); } 15% { opacity: 1; transform: translateY(0) scale(1.1); } 100% { opacity: 0; transform: translateY(-34px); } }
.emote-pop { position: absolute; left: 50%; top: -10px; font-size: 28px; animation: emote 1.8s var(--ease) forwards; pointer-events: none; z-index: 10; }
@keyframes emote { 0% { transform: translate(-50%, 10px) scale(.3); opacity: 0; } 20% { transform: translate(-50%, -14px) scale(1.3); opacity: 1; } 100% { transform: translate(-50%, -50px) scale(1); opacity: 0; } }
.side-actions { display: grid; gap: 8px; }
.host-controls { display: flex; gap: 6px; }
.host-controls .btn { flex: 1; }
.tabs { display: flex; gap: 4px; }
.tab { flex: 1; background: transparent; border: 0; color: var(--muted); font-weight: 700; padding: 8px; border-bottom: 2px solid var(--line); cursor: pointer; }
.tab.active { color: var(--text); border-color: var(--primary); }
.tab-body { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.log { overflow: auto; font-size: 12.5px; display: flex; flex-direction: column; gap: 3px; height: 100%; }
.log div { padding: 4px 6px; border-radius: 6px; animation: fadeIn .4s; }
.log div:nth-child(odd) { background: color-mix(in srgb, var(--panel2) 50%, transparent); }
@keyframes fadeIn { from { opacity: 0; } }
.emotes { display: flex; justify-content: space-between; }
.emotes button { font-size: 20px; background: var(--panel2); border: 0; border-radius: 8px; width: 34px; height: 34px; cursor: pointer; transition: .15s; }
.emotes button:hover { transform: scale(1.2) rotate(-8deg); }
.trades { display: grid; gap: 8px; max-height: 40%; overflow: auto; }
.trade-card { background: var(--panel); border: 1px solid var(--warn); border-radius: 12px; padding: 10px; font-size: 12px; animation: pop .35s var(--ease); }
.trade-card .h { font-weight: 700; margin-bottom: 6px; font-size: 13px; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }

/* ============ BOARD ============ */
.board {
  --n: 9; --corner: 1.55fr;
  position: relative; aspect-ratio: 1; height: min(calc(100vh - 24px), calc(100vw - 640px)); max-height: 100%;
  display: grid; grid-template-columns: var(--corner) repeat(var(--n), 1fr) var(--corner); grid-template-rows: var(--corner) repeat(var(--n), 1fr) var(--corner);
  gap: 2px; padding: 2px; background: var(--line); border-radius: 18px; box-shadow: var(--shadow), 0 0 0 6px var(--board); user-select: none;
}
.tile {
  position: relative; background: var(--tile); color: var(--tile-text); display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; overflow: hidden; cursor: pointer; transition: transform .15s, box-shadow .2s, filter .2s; font-size: var(--fs, 10px); line-height: 1.1; padding: 2px;
}
.tile:hover { z-index: 3; transform: scale(1.08); box-shadow: 0 6px 18px rgba(0,0,0,.4); }
.tile .band { position: absolute; background: var(--g); }
.tile.s0 .band { top: 0; left: 0; right: 0; height: 22%; }
.tile.s1 .band { right: 0; top: 0; bottom: 0; width: 22%; }
.tile.s2 .band { bottom: 0; left: 0; right: 0; height: 22%; }
.tile.s3 .band { left: 0; top: 0; bottom: 0; width: 22%; }
.tile.s0 { padding-top: 24%; } .tile.s2 { padding-bottom: 24%; } .tile.s1 { padding-right: 24%; } .tile.s3 { padding-left: 24%; }
.tile .nm { font-weight: 700; word-break: break-word; }
.tile .pr { font-size: .9em; opacity: .75; margin-top: 2px; font-weight: 600; }
.tile .ic { font-size: 1.8em; line-height: 1; }
.tile .fl { font-size: 1.15em; line-height: 1; }
.tile.owned::after { content: ''; position: absolute; inset: 0; border: 3px solid var(--oc); pointer-events: none; }
.tile.owned .pr { color: var(--oc); opacity: 1; font-weight: 800; }
.tile.mortgaged { filter: grayscale(.9) brightness(.7); }
.tile.mortgaged .nm::before { content: '🔒 '; }
.tile .houses { position: absolute; display: flex; gap: 1px; justify-content: center; z-index: 2; }
.tile.s0 .houses { top: 2px; left: 0; right: 0; } .tile.s2 .houses { bottom: 2px; left: 0; right: 0; }
.tile.s1 .houses { right: 2px; top: 0; bottom: 0; flex-direction: column; align-items: center; } .tile.s3 .houses { left: 2px; top: 0; bottom: 0; flex-direction: column; align-items: center; }
.houses i { width: 7px; height: 7px; background: #2ecc71; border: 1px solid #0b5; border-radius: 1px; animation: popIn .4s var(--ease); }
.houses i.hotel { width: 14px; background: #e74c3c; border-color: #a00; }
@keyframes popIn { from { transform: scale(0); } 60% { transform: scale(1.5); } }
.tile.corner { font-size: calc(var(--fs, 10px) * 1.15); }
.tile.corner .ic { font-size: 2.6em; }
.tile.flash { animation: flash 1s var(--ease); }
@keyframes flash { 0%, 100% { box-shadow: none; } 30% { box-shadow: inset 0 0 0 4px var(--accent), 0 0 30px var(--accent); transform: scale(1.12); z-index: 4; } }
.tile.hl { box-shadow: inset 0 0 0 3px var(--primary); }
.board-center {
  grid-column: 2 / span var(--n); grid-row: 2 / span var(--n); background: var(--board-center); position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 20px; overflow: hidden;
}
.center-logo { font-size: clamp(22px, 3.6vw, 44px); font-weight: 900; letter-spacing: -1px; opacity: .18; position: absolute; top: 10%; transform: rotate(-8deg); white-space: nowrap; pointer-events: none; }
.status-line { font-size: 15px; font-weight: 600; text-align: center; min-height: 22px; }
.status-line b { color: var(--c, var(--text)); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; min-height: 48px; }
.actions .btn { padding: 12px 20px; font-size: 15px; animation: pop .3s var(--ease); }
.timer { width: 220px; height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.timer i { display: block; height: 100%; background: var(--accent); transition: width .25s linear; }
.timer i.low { background: var(--danger); }
.pot { font-size: 13px; color: var(--muted); }
.paused-banner { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.55); color: #fff; font-size: 34px; font-weight: 900; z-index: 20; backdrop-filter: blur(3px); }
.debt-banner { background: color-mix(in srgb, var(--danger) 18%, transparent); border: 1px solid var(--danger); padding: 10px 14px; border-radius: 12px; font-size: 13px; text-align: center; }

/* dice */
.dice { display: flex; gap: 22px; perspective: 600px; height: 64px; align-items: center; }
.die { width: 54px; height: 54px; position: relative; transform-style: preserve-3d; transition: transform 1s cubic-bezier(.15, .9, .25, 1.05); }
.die .f { position: absolute; inset: 0; background: #fff; border-radius: 10px; border: 1px solid #ddd; display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 7px; box-shadow: inset 0 0 10px rgba(0,0,0,.15); }
.die .f i { width: 10px; height: 10px; border-radius: 50%; background: #222; place-self: center; }
.die .f1 { transform: rotateY(0) translateZ(27px); } .die .f6 { transform: rotateY(180deg) translateZ(27px); }
.die .f2 { transform: rotateY(90deg) translateZ(27px); } .die .f5 { transform: rotateY(-90deg) translateZ(27px); }
.die .f3 { transform: rotateX(90deg) translateZ(27px); } .die .f4 { transform: rotateX(-90deg) translateZ(27px); }
.dice.rolling .die { animation: shake .25s infinite; }
@keyframes shake { 50% { translate: 0 -6px; } }

/* tokens */
.token-layer { position: absolute; inset: 0; pointer-events: none; z-index: 6; }
.token {
  position: absolute; width: var(--ts, 26px); height: var(--ts, 26px); margin: calc(var(--ts, 26px) / -2) 0 0 calc(var(--ts, 26px) / -2); border-radius: 50%;
  background: var(--c); border: 2px solid #fff; display: grid; place-items: center; font-size: calc(var(--ts, 26px) * .6);
  box-shadow: 0 4px 10px rgba(0,0,0,.45); transition: left .16s var(--ease), top .16s var(--ease), transform .2s;
}
.token.hop { animation: hop .16s ease-out; }
@keyframes hop { 50% { transform: translateY(-12px) scale(1.15); } }
.token.cur { z-index: 2; animation: pulse 1.4s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--c) 70%, transparent), 0 4px 10px rgba(0,0,0,.45); } 50% { box-shadow: 0 0 0 8px transparent, 0 4px 10px rgba(0,0,0,.45); } }
.token.teleport { transition: none; animation: tele .5s var(--ease); }
@keyframes tele { from { transform: scale(0) rotate(-180deg); } }
.token.jailed::after { content: ''; position: absolute; inset: -3px; border-radius: 50%; background: repeating-linear-gradient(90deg, transparent 0 4px, #333 4px 6px); opacity: .8; }

/* card popup */
.card-pop { position: absolute; z-index: 15; width: 260px; perspective: 800px; left: 50%; top: 30%; pointer-events: none; transform: translate(-50%, -50%); }
.card-pop .inner { position: relative; height: 160px; transform-style: preserve-3d; animation: flip .7s var(--ease) forwards; }
.card-pop .face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 14px; display: grid; place-items: center; padding: 18px; text-align: center; box-shadow: var(--shadow); }
.card-pop .back { background: linear-gradient(135deg, var(--primary), var(--primary2)); color: #fff; font-size: 28px; font-weight: 900; }
.card-pop .front { background: #fff8e1; color: #222; transform: rotateY(180deg); font-weight: 600; font-size: 15px; }
.card-pop .front.chance { background: #ffe0b2; } .card-pop .front .t { font-size: 12px; text-transform: uppercase; letter-spacing: 2px; color: #a15c00; margin-bottom: 6px; font-weight: 800; }
@keyframes flip { 0% { transform: rotateY(0) scale(.6) translateY(80px); } 40% { transform: rotateY(0) scale(1); } 100% { transform: rotateY(180deg); } }
.card-pop.out { animation: fadeOut .4s forwards; }
@keyframes fadeOut { to { opacity: 0; transform: translate(-50%, -60%); } }

/* ============ MODALS ============ */
.modal-bg { position: fixed; inset: 0; background: rgba(5, 6, 20, .6); display: grid; place-items: center; z-index: 50; backdrop-filter: blur(4px); animation: fadeIn .2s; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 22px; min-width: 360px; max-width: 90vw; max-height: 90vh; overflow: auto; box-shadow: var(--shadow); animation: pop .3s var(--ease); position: relative; }
.modal .x { position: absolute; right: 12px; top: 10px; background: none; border: 0; color: var(--muted); font-size: 22px; cursor: pointer; }
.deed { width: 300px; }
.deed .hd { background: var(--g); color: #fff; padding: 14px; border-radius: 10px; text-align: center; margin-bottom: 12px; text-shadow: 0 1px 3px rgba(0,0,0,.4); }
.deed .hd small { display: block; opacity: .9; font-weight: 600; } .deed .hd b { font-size: 20px; }
.deed table { width: 100%; font-size: 13px; border-collapse: collapse; }
.deed td { padding: 4px 2px; } .deed td:last-child { text-align: right; font-weight: 700; }
.deed tr.cur td { color: var(--accent); }
.deed .own { margin: 10px 0; font-size: 13px; text-align: center; }
.deed .acts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 12px; }
.trade-modal { width: 760px; }
.trade-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.trade-col { background: var(--bg2); border-radius: 12px; padding: 12px; }
.trade-col h4 { color: var(--text); }
.prop-list { display: grid; gap: 4px; max-height: 260px; overflow: auto; margin: 8px 0; }
.prop-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; background: var(--panel); cursor: pointer; font-size: 13px; border: 2px solid transparent; }
.prop-item.sel { border-color: var(--primary); }
.prop-item.dis { opacity: .4; pointer-events: none; }
.prop-item i { width: 12px; height: 12px; border-radius: 3px; background: var(--g); flex: none; }
.prop-item span { flex: 1; } .prop-item small { color: var(--muted); }
.auction { width: 360px; text-align: center; }
.auction .bid { font-size: 42px; font-weight: 900; margin: 6px 0; }
.auction .bidder { color: var(--muted); min-height: 20px; }
.auction .bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 12px 0; }
.auction .bar i { display: block; height: 100%; background: var(--warn); transition: width .25s linear; }
.auction .bids { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gameover { width: 680px; text-align: center; }
.gameover .trophy { font-size: 70px; animation: bob 2s infinite; }
.gameover h2 { font-size: 34px; margin: 6px 0 16px; }
.rank { display: grid; gap: 6px; margin: 12px 0; text-align: left; }
.rank div { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-radius: 10px; background: var(--bg2); border-left: 4px solid var(--c); }
.rank b { flex: 1; }
.chart { width: 100%; height: 200px; background: var(--bg2); border-radius: 12px; }
.stats-table { width: 100%; font-size: 13px; border-collapse: collapse; margin-top: 12px; }
.stats-table th, .stats-table td { padding: 6px; border-bottom: 1px solid var(--line); text-align: right; }
.stats-table th:first-child, .stats-table td:first-child { text-align: left; }

/* toasts */
#toasts { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 100; }
.toast { background: var(--panel); border: 1px solid var(--line); padding: 10px 18px; border-radius: 12px; box-shadow: var(--shadow); font-weight: 600; animation: pop .3s var(--ease); font-size: 14px; }
.toast.error { border-color: var(--danger); } .toast.ok { border-color: var(--accent); }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 200; }
::-webkit-scrollbar { width: 8px; height: 8px; } ::-webkit-scrollbar-thumb { background: var(--line); border-radius: 9px; }
