:root {
  --ink: #eef2ef;
  --muted: #9fb0a7;
  --glass: rgba(16, 22, 19, 0.72);
  --glass-2: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.1);
  --accent: #e0312f;
  --accent-2: #b71c1c;
  --gold: #f5c84c;
  --ok: #2fa35f;
  --radius: 14px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --card: "Jost", "Futura", "Century Gothic", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--ui); color: var(--ink); background: #0e1613; overflow-x: hidden; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: .88rem; }
.mt { margin-top: 1.2em; }
.row { display: flex; gap: .5em; align-items: center; }
h1, h2, h3 { margin: 0 0 .55em; font-family: var(--card); letter-spacing: .01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.08rem; font-weight: 700; }
h3 { font-size: .95rem; margin-top: 1.1em; font-weight: 600; color: var(--muted); }
.ico { width: 1.1em; height: 1.1em; vertical-align: -0.18em; flex-shrink: 0; }

#scene { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; z-index: 0; touch-action: none; }
.screen { position: relative; z-index: 1; }

.loading { position: fixed; inset: 0; z-index: 90; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: #0e1613; color: var(--muted); transition: opacity .5s; }
.loading.done { opacity: 0; pointer-events: none; }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid rgba(255,255,255,.15); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- controls ---------- */
input, select {
  font: inherit; padding: .62em .8em; border-radius: 10px; border: 1px solid var(--line);
  background: rgba(0, 0, 0, .28); color: var(--ink); width: 100%; min-width: 0; outline: none;
}
input:focus, select:focus { border-color: rgba(255,255,255,.35); }
input[type=checkbox] { width: auto; accent-color: var(--accent); }
label { display: block; margin-bottom: .8em; font-size: .85rem; color: var(--muted); }
label input, label select { margin-top: .3em; }
label.check { display: flex; gap: .5em; align-items: center; color: var(--ink); }

.btn {
  font: inherit; font-weight: 600; font-size: .92rem; cursor: pointer; border-radius: 10px; border: 1px solid var(--line);
  padding: .6em 1.05em; background: var(--glass-2); color: var(--ink); white-space: nowrap; display: inline-flex; align-items: center; gap: .45em; justify-content: center;
  transition: transform .08s, background .15s, filter .15s, box-shadow .15s;
}
.btn:hover:not(:disabled) { background: rgba(255,255,255,.12); }
.btn:active:not(:disabled) { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .42; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, #f0453f, var(--accent-2)); border-color: rgba(255,255,255,.18); box-shadow: 0 6px 18px rgba(224, 49, 47, .35), inset 0 1px 0 rgba(255,255,255,.25); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); background: linear-gradient(180deg, #f0453f, var(--accent-2)); }
.btn.ok { background: linear-gradient(180deg, #3cbf73, #1f8a4c); border-color: transparent; box-shadow: 0 6px 18px rgba(47, 163, 95, .3); }
.btn.gold { background: linear-gradient(180deg, #ffd96b, #d9a521); color: #2a1d00; border-color: transparent; }
.btn.danger { background: #7d1d1d; border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.small { padding: .38em .7em; font-size: .82rem; border-radius: 8px; }
.btn.big { padding: .78em 1.6em; font-size: 1.05rem; border-radius: 12px; }
.btn.wide { width: 100%; }

.glass { background: var(--glass); backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel { padding: 1.2em 1.3em; }
.code { font-family: ui-monospace, Consolas, monospace; font-weight: 700; letter-spacing: .14em; background: rgba(255,255,255,.08); padding: .1em .45em; border-radius: 6px; }
.code-input { text-transform: uppercase; letter-spacing: .25em; font-family: ui-monospace, Consolas, monospace; }
.badge { background: var(--accent); color: #fff; border-radius: 99px; padding: 0 .45em; font-size: .72rem; margin-left: .2em; }

/* ---------- toasts ---------- */
#toast-area { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 6px; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast { background: rgba(30, 36, 33, .95); color: #fff; padding: .65em 1em; border-radius: 10px; box-shadow: var(--shadow); animation: fadein .2s; border: 1px solid var(--line); }
.toast.error { background: rgba(140, 24, 24, .95); }
@keyframes fadein { from { opacity: 0; transform: translateY(-6px); } }

/* ---------- home ---------- */
#screen-home { padding: 4vh 16px 40px; max-width: 1060px; margin: 0 auto; }
.hero { text-align: center; margin: 2vh 0 4vh; }
.logo {
  display: inline-block; background: linear-gradient(180deg, #ea3a37, #c41f1d); color: #fff; font-family: var(--card); font-weight: 900; letter-spacing: .1em;
  padding: .12em .6em; border: 5px solid #fff; outline: 3px solid #111; transform: rotate(-3deg); font-size: clamp(2.2rem, 7vw, 4rem);
  box-shadow: 0 20px 50px rgba(0,0,0,.5); text-shadow: 0 3px 0 #111, 2px 0 0 #111, -2px 0 0 #111, 0 -2px 0 #111;
}
.logo-img { display: block; width: min(620px, 88vw); height: auto; margin: 0 auto; filter: drop-shadow(0 18px 34px rgba(0,0,0,.6)); }
.sub { color: #e7efe9; opacity: .85; margin-top: 1.1em; font-weight: 500; text-shadow: 0 2px 8px #000; }
.home-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 16px; }
.list { display: flex; flex-direction: column; gap: 6px; }
.list-item { display: flex; justify-content: space-between; align-items: center; gap: .6em; padding: .6em .75em; background: rgba(255,255,255,.05); border: 1px solid var(--line); border-radius: 10px; }
.list-item .meta { font-size: .8rem; color: var(--muted); margin-top: .15em; }
.empty { color: var(--muted); font-size: .88rem; font-style: italic; }

/* ---------- lobby ---------- */
#screen-lobby { padding: 4vh 16px; }
.lobby-wrap { max-width: 1100px; margin: 0 auto; display: grid; grid-template-columns: 1fr 330px; gap: 16px; }
@media (max-width: 860px) { .lobby-wrap { grid-template-columns: 1fr; } }

.lobby-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1em; }
.lobby-players { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; margin: 1.1em 0; }
.lp { display: flex; align-items: center; gap: .7em; padding: .55em .7em; border-radius: 12px; background: rgba(255,255,255,.05); border: 1px solid var(--line); border-left: 5px solid; min-height: 64px; }
.lp img { width: 48px; height: 48px; }
.lp .nm { font-weight: 700; display: flex; align-items: center; gap: .35em; }
.lp .nm .ico { color: var(--gold); }
.lp .st { font-size: .78rem; color: var(--muted); }
.lp .st.ready { color: #6ee59c; font-weight: 700; }
.lp.empty-seat { border-left-color: transparent; opacity: .45; justify-content: center; }
.lp.empty-seat.can-add { opacity: 1; flex-direction: column; gap: .35em; border-style: dashed; }
.lp.empty-seat.can-add .muted { opacity: .6; }
.token-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.tpick { border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,.04); cursor: pointer; padding: .3em .2em .45em; color: var(--ink); font: inherit; font-size: .75rem; display: flex; flex-direction: column; align-items: center; gap: .1em; transition: transform .15s, background .15s; }
.tpick img { width: 72px; height: 72px; transition: transform .25s; }
.tpick:hover:not(:disabled) { background: rgba(255,255,255,.1); }
.tpick:hover:not(:disabled) img { transform: translateY(-4px) rotate(-6deg); }
.tpick.sel { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold) inset, 0 0 22px rgba(245, 200, 76, .25); }
.tpick:disabled { opacity: .25; cursor: not-allowed; }
.color-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255,255,255,.15); cursor: pointer; }
.swatch.sel { border-color: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,.25); }
.swatch:disabled { opacity: .2; cursor: not-allowed; }
.lobby-actions { display: flex; gap: .7em; align-items: center; margin-top: 1.3em; flex-wrap: wrap; }
.lobby-chat { display: flex; flex-direction: column; min-height: 380px; max-height: 76vh; }

/* ---------- chat & log ---------- */
.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 5px; font-size: .88rem; padding: .3em 0; min-height: 100px; }
.chat-log .msg b { margin-right: .35em; }
.chat-form { display: flex; gap: 6px; margin-top: 6px; }
.game-log { font-size: .82rem; display: flex; flex-direction: column; gap: 4px; color: #d6e0da; }
.game-log div { padding: 3px 0; border-bottom: 1px solid rgba(255,255,255,.05); }

/* ---------- game HUD (desktop) ---------- */
#screen-game { position: fixed; inset: 0; pointer-events: none; }
#screen-game > * { pointer-events: auto; }
#screen-game .hand { pointer-events: none; }
.hud-top { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; justify-content: space-between; align-items: center; padding: .45em .6em .45em 1em; pointer-events: none; background: transparent; border: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
.hud-top > * { pointer-events: auto; }
.hud-title { background: var(--glass); backdrop-filter: blur(14px); padding: .5em .9em; border-radius: 12px; border: 1px solid var(--line); }
.hud-btns { display: flex; gap: 6px; background: var(--glass); backdrop-filter: blur(14px); padding: .35em; border-radius: 12px; border: 1px solid var(--line); }
.menu { position: absolute; top: 64px; right: 12px; padding: .6em; display: flex; flex-direction: column; gap: 6px; z-index: 5; }
.menu .btn { justify-content: flex-start; }

.hud-players { position: absolute; top: 72px; left: 12px; width: 250px; display: flex; flex-direction: column; gap: 8px; max-height: calc(100vh - 260px); overflow-y: auto; overflow-x: hidden; padding: 0 6px 4px 0; }
.pl { position: relative; display: grid; grid-template-columns: 52px 1fr; gap: 0 .6em; align-items: center; padding: .45em .7em .5em .45em; border-radius: 14px; background: var(--glass); backdrop-filter: blur(14px); border: 1px solid var(--line); overflow: hidden; transition: box-shadow .3s, transform .3s; }
.pl::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c); }
.pl.turn { box-shadow: 0 0 0 2px var(--gold), 0 0 28px rgba(245, 200, 76, .28); transform: translateX(4px); }
.pl.bankrupt { opacity: .4; filter: grayscale(1); }
.pl img { width: 52px; height: 52px; grid-row: span 2; }
.pl .top { display: flex; justify-content: space-between; align-items: baseline; gap: .4em; }
.pl .nm { font-weight: 700; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl .cash { font-family: var(--card); font-weight: 700; font-size: 1.15rem; font-variant-numeric: tabular-nums; color: #fff; }
.pl .tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.tag { font-size: .66rem; padding: .12em .45em; border-radius: 5px; background: rgba(255,255,255,.1); font-weight: 700; color: var(--muted); display: inline-flex; align-items: center; gap: .25em; letter-spacing: .03em; }
.tag.jail { background: #c96a12; color: #fff; }
.tag.off { background: #555; color: #fff; }
.tag.you { background: var(--accent); color: #fff; }
.tag.card { background: #2a6fc0; color: #fff; }
.pl .chips { grid-column: 1 / 3; display: flex; flex-wrap: wrap; gap: 3px; margin-top: 6px; }
.chip { width: 11px; height: 15px; border-radius: 2px; border: 1px solid rgba(0,0,0,.5); cursor: pointer; box-shadow: inset 0 1px 0 rgba(255,255,255,.35); }
.chip.m { opacity: .3; }
/* The Bank: building supply and unsold deeds */
.bank-panel { position: relative; padding: .55em .7em .65em; border-radius: 14px; background: var(--glass); backdrop-filter: blur(14px); border: 1px solid rgba(216,178,90,.35); cursor: pointer; display: flex; flex-direction: column; gap: .45em; transition: border-color .2s; }
.bank-panel::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; border-radius: 14px 0 0 14px; background: #d8b25a; }
.bank-panel:hover { border-color: rgba(216,178,90,.7); }
.bank-panel:hover .pl-view { opacity: 1; color: var(--ink); }
.bk-head { display: flex; align-items: center; gap: .5em; }
.bk-head .nm { font-weight: 800; letter-spacing: .06em; text-transform: uppercase; font-size: .82rem; color: #e9cf8d; }
.bank-panel .pl-view { top: 8px; bottom: auto; }
.bk-ico { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: rgba(216,178,90,.16); color: #e9cf8d; flex-shrink: 0; }
.bk-ico .ico { width: 16px; height: 16px; }
.bk-ico.big { width: 84px; height: 84px; border-radius: 20px; }
.bk-ico.big .ico { width: 44px; height: 44px; }
.pf-tab .bk-ico { width: 34px; height: 34px; }
.bk-row { display: flex; align-items: center; gap: .5em; font-size: .8rem; }
.bk-lbl { display: inline-flex; align-items: center; gap: .35em; color: var(--muted); font-weight: 600; }
.bk-n { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--muted); }
.bk-n b { font-family: var(--card); font-size: 1.05rem; color: #fff; }
.bk-warn { font-size: .6rem; font-weight: 800; letter-spacing: .06em; padding: .1em .4em; border-radius: 4px; background: #c96a12; color: #fff; }
.bk-stock.out .bk-warn { background: var(--accent); }
.bk-stock.out .bk-n b { color: #ff8a80; }
.bk-pips { display: grid; gap: 2px; margin-top: 3px; }
.bk-pips.house { grid-template-columns: repeat(16, 1fr); }
.bk-pips.hotel { grid-template-columns: repeat(12, 1fr); }
.bk-pips i { height: 7px; border-radius: 2px 2px 1px 1px; background: rgba(255,255,255,.07); transition: background .4s; }
.bk-pips.house i.on { background: #2fb552; box-shadow: inset 0 1px 0 rgba(255,255,255,.35); clip-path: polygon(0 35%, 50% 0, 100% 35%, 100% 100%, 0 100%); height: 9px; }
.bk-pips.hotel i.on { background: #e0262f; box-shadow: inset 0 1px 0 rgba(255,255,255,.35); height: 9px; }
.bk-pips.house i:not(.on) { clip-path: polygon(0 35%, 50% 0, 100% 35%, 100% 100%, 0 100%); height: 9px; }
.bk-pips.hotel i:not(.on) { height: 9px; }
.bk-deeds { display: flex; flex-wrap: wrap; gap: 6px 8px; }
.bk-grp { display: inline-flex; gap: 3px; }
.chip.big { width: 13px; height: 18px; }
.bk-none { font-size: .78rem; color: var(--muted); }
.bk-supply { display: grid; grid-template-columns: 1fr 1fr; gap: 1em; padding: .7em 1em; margin: .7em 0 0; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,.03); }
.bk-supply .bk-row { font-size: .9rem; }
.bk-supply .bk-pips i { height: 14px !important; }

.hud-side { position: absolute; top: 72px; right: 12px; width: 300px; bottom: 12px; display: flex; flex-direction: column; padding: .5em; }
.tabs { display: flex; gap: 4px; padding-bottom: .4em; border-bottom: 1px solid var(--line); }
.tab { flex: 1; font: inherit; font-weight: 600; font-size: .83rem; padding: .45em; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.tab.active { background: rgba(255,255,255,.1); color: var(--ink); }
.tab-body { flex: 1; overflow-y: auto; padding: .5em .3em; display: flex; flex-direction: column; min-height: 0; }

.trades { display: flex; flex-direction: column; gap: 8px; }
.trade { background: rgba(255,255,255,.05); border: 1px solid var(--line); border-radius: 12px; padding: .65em .8em; font-size: .85rem; }
.trade.in { border-color: rgba(87, 160, 255, .6); }
.trade .cols { display: grid; grid-template-columns: 1fr 1fr; gap: .6em; margin: .5em 0; }
.trade ul { margin: 0; padding-left: 1em; }
.trade.other { background: rgba(255,255,255,.025); border-style: dashed; }
.trade.other b { display: flex; align-items: center; gap: .4em; }
.trade-btns { display: flex; gap: 6px; justify-content: flex-end; }
.trade-wait { font-size: .78rem; text-align: right; font-style: italic; }
.sw { display: inline-block; width: .8em; height: .8em; border-radius: 2px; vertical-align: -1px; border: 1px solid #0006; margin-right: .2em; }

.action-dock {
  position: absolute; left: 50%; transform: translateX(-50%); top: 12px; width: min(600px, calc(100vw - 660px)); min-width: 340px; z-index: 3;
  padding: .85em 1.1em; display: flex; flex-direction: column; gap: .65em; align-items: center; text-align: center; transition: opacity .2s;
}
.action-dock.busy { opacity: .55; pointer-events: none; }

/* ---------- money & deed effects ---------- */
#fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 45; overflow: hidden; }
.fx-note {
  position: absolute; width: 46px; height: 24px; margin: -12px 0 0 -23px; border-radius: 3px; display: grid; place-items: center;
  font: 800 11px/1 var(--card); color: #2b2b2b; border: 1px solid rgba(0,0,0,.35);
  box-shadow: 0 4px 10px rgba(0,0,0,.45), inset 0 0 0 2px rgba(255,255,255,.45), inset 0 0 0 3px rgba(0,0,0,.12);
}
.fx-note.n500 { background: #f0a560; } .fx-note.n100 { background: #f2dfa2; } .fx-note.n50 { background: #c8a8e6; }
.fx-note.n20 { background: #a6d99e; } .fx-note.n10 { background: #f4ee9e; } .fx-note.n5 { background: #f3b5c6; } .fx-note.n1 { background: #ffffff; }
.fx-delta { position: absolute; font: 800 20px/1 var(--card); white-space: nowrap; text-shadow: 0 2px 8px rgba(0,0,0,.85), 0 0 2px rgba(0,0,0,.9); }
.fx-delta.gain { color: #7dffa4; }
.fx-delta.loss { color: #ff8f86; }
.fx-deed { position: absolute; width: 74px; margin: -56px 0 0 -37px; filter: drop-shadow(0 12px 18px rgba(0,0,0,.6)); }
.pl.flash-gain { animation: flashGain .9s ease-out; }
.pl.flash-loss { animation: flashLoss .9s ease-out; }
@keyframes flashGain { 0% { box-shadow: 0 0 0 2px #7dffa4, 0 0 26px rgba(125,255,164,.55); } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes flashLoss { 0% { box-shadow: 0 0 0 2px #ff8f86, 0 0 26px rgba(255,143,134,.5); } 100% { box-shadow: 0 0 0 0 transparent; } }
.hand-card.arriving .hand-inner { opacity: 0; }
.hand-card.arrived .hand-inner { animation: handArrive .9s ease-out; }
@keyframes handArrive { 0% { filter: drop-shadow(0 0 0 #ffd34d) brightness(1.4); } 40% { filter: drop-shadow(0 0 18px #ffd34d) brightness(1.15); } 100% { filter: drop-shadow(0 10px 14px rgba(0,0,0,.45)); } }

/* ---------- "you landed on" panel ---------- */
.btn.xl { padding: .85em 1.2em; font-size: 1.12rem; border-radius: 14px; }
.land-panel { position: fixed; left: calc(50% - 29px); top: 52%; transform: translate(-50%, -50%); z-index: 20; pointer-events: none; }
.land-box {
  pointer-events: auto; width: min(380px, 92vw); display: flex; flex-direction: column; align-items: center; gap: .7em;
  padding: 1em 1.3em 1.2em; border-radius: 22px; background: rgba(12, 18, 15, .8); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line); box-shadow: 0 30px 90px rgba(0,0,0,.65); animation: landin .5s cubic-bezier(.2,.8,.3,1.15);
}
.land-panel.busy .land-box { opacity: .5; pointer-events: none; }
@keyframes landin { from { opacity: 0; transform: translateY(50px) scale(.88); } }
.land-kicker { text-transform: uppercase; letter-spacing: .16em; font-size: .72rem; font-weight: 700; color: var(--muted); }
.land-deed { width: min(230px, 30vh); cursor: zoom-in; transform: rotate(-1.5deg); filter: drop-shadow(0 18px 26px rgba(0,0,0,.6)); transition: transform .25s cubic-bezier(.2,.8,.3,1.3); }
.land-deed:hover { transform: rotate(0) scale(1.03); }
.land-note { display: flex; align-items: center; gap: .35em; color: var(--gold); font-weight: 600; font-size: .88rem; }
.land-money { display: flex; gap: 1.2em; font-size: .86rem; color: var(--muted); flex-wrap: wrap; justify-content: center; }
.land-money b { color: var(--ink); font-family: var(--card); font-size: 1.05rem; }
.land-btns { display: flex; gap: .6em; width: 100%; }
.land-btns .btn { flex: 1 1 0; min-width: 0; }
@media (max-width: 480px) { .land-btns .btn.xl { font-size: 1rem; padding: .8em .6em; } }
.land-short { margin: 0; font-size: .82rem; color: #ffb4a8; text-align: center; }
@media (max-width: 980px) { .land-panel { left: 50%; top: 50%; } }
.action-dock .status { font-weight: 600; font-size: 1rem; display: flex; align-items: center; gap: .45em; justify-content: center; flex-wrap: wrap; }
.action-dock .btns { display: flex; flex-wrap: wrap; gap: .5em; justify-content: center; }
.action-dock .sub { font-size: .85rem; color: var(--muted); margin: 0; text-shadow: none; }
.action-dock .big-num { font-family: var(--card); font-size: 2rem; font-weight: 800; line-height: 1; }
.action-dock .timer { font-variant-numeric: tabular-nums; color: var(--gold); font-weight: 800; }
.action-dock input { width: 6.5em; padding: .45em .6em; }
.auction { display: grid; grid-template-columns: 120px 1fr; gap: 1em; align-items: center; text-align: left; width: 100%; }
.auction .deed { width: 120px; }
.auction .bidrow { display: flex; flex-wrap: wrap; gap: .35em; align-items: center; margin-top: .4em; }
/* raise-funds panel (shown in the dock while you owe more than you hold) */
.raise { width: 100%; display: flex; flex-direction: column; gap: .6em; text-align: left; }
.rf-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.rf-stats div { background: rgba(255,255,255,.05); border: 1px solid var(--line); border-radius: 10px; padding: .4em .6em; display: flex; flex-direction: column; gap: .1em; }
.rf-stats span { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.rf-stats b { font-family: var(--card); font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.rf-stats .short b { color: #ff8f80; }
.rf-bar { height: 8px; border-radius: 99px; background: rgba(255,255,255,.08); overflow: hidden; }
.rf-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--gold), #3cbf73); transition: width .4s cubic-bezier(.2,.8,.3,1); }
.rf-list { display: flex; flex-direction: column; gap: 6px; max-height: min(46vh, 420px); overflow-y: auto; padding-right: 4px; }
.rf-group { background: rgba(255,255,255,.04); border: 1px solid var(--line); border-left: 4px solid var(--gc); border-radius: 10px; padding: .35em .55em .4em .6em; }
.rf-head { display: flex; justify-content: space-between; align-items: center; gap: .5em; font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; min-height: 1.9em; }
.rf-head .btn { text-transform: none; letter-spacing: 0; }
.rf-note { font-size: .74rem; color: var(--muted); margin: -.1em 0 .3em; }
.rf-row { display: flex; align-items: center; gap: .5em; padding: .25em 0; min-height: 2.6em; border-top: 1px solid rgba(255,255,255,.05); font-size: .88rem; }
.rf-name { font: inherit; color: var(--ink); background: none; border: 0; padding: 0; cursor: pointer; text-align: left; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rf-name:hover { text-decoration: underline; }
.rf-bld { display: inline-flex; align-items: center; gap: .25em; font-size: .78rem; color: var(--muted); }
.rf-acts { display: flex; gap: 4px; flex-shrink: 0; }
.rf-acts .btn b, .rf-head .btn b { font-variant-numeric: tabular-nums; }
.raise .btns { justify-content: flex-end; }
@media (max-width: 560px) { .rf-stats { grid-template-columns: repeat(2, 1fr); } .rf-row { flex-wrap: wrap; } }
.who { display: inline-flex; align-items: center; gap: .3em; font-weight: 700; }
.who img { width: 26px; height: 26px; }

/* ---------- hand of title deeds ---------- */
.hand { position: absolute; left: 270px; right: 320px; bottom: 0; width: auto; height: 160px; display: flex; justify-content: center; align-items: flex-end; perspective: 900px; }
/* .hand-card is a fixed hit area over the visible part of the card and never moves; the inner
   card does the lifting. (If the hovered element itself moved, it would slide out from under
   the cursor, lose hover, drop back, and flicker.) */
.hand-card { position: relative; width: 136px; height: 106px; flex-shrink: 0; margin: 0 var(--m, -16px); pointer-events: auto; cursor: pointer; }
.hand-card:hover { z-index: 20; }
.hand-inner { position: absolute; left: 0; right: 0; bottom: -100px; transform-origin: 50% 140%;
  transform: perspective(900px) translateY(var(--y)) rotate(var(--r)) rotateX(22deg);
  transition: transform .28s cubic-bezier(.2,.8,.3,1.2), filter .2s; filter: drop-shadow(0 10px 14px rgba(0,0,0,.45)); }
.hand-card:hover .hand-inner { transform: perspective(900px) translateY(-170px) rotate(0) rotateX(0) scale(1.4); filter: drop-shadow(0 22px 28px rgba(0,0,0,.6)); }
.hand-gap { width: 26px; flex-shrink: 0; }
.hand-badge { position: absolute; top: -9px; left: 50%; transform: translateX(-50%); display: flex; gap: 2px; z-index: 2; }
.hb-house { width: 11px; height: 11px; background: #1f9a3e; border: 1px solid #0b4a1a; clip-path: polygon(50% 0, 100% 40%, 100% 100%, 0 100%, 0 40%); }
.hb-hotel { width: 22px; height: 13px; background: #d0141f; border: 1px solid #5b0000; clip-path: polygon(50% 0, 100% 35%, 100% 100%, 0 100%, 0 35%); }

/* ---------- title deed card ---------- */
.deed { container-type: inline-size; aspect-ratio: 0.66; position: relative; font-family: var(--card); color: #161616; perspective: 1400px; }
.deed-flip { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .7s cubic-bezier(.3,.7,.3,1); }
.deed.flipped .deed-flip { transform: rotateY(180deg); }
.deed-face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 3.5cqw; background: #fbfaf4;
  box-shadow: inset 0 0 0 2.8cqw #fbfaf4, inset 0 0 0 3.4cqw #1a1a1a, 0 1px 2px rgba(0,0,0,.35);
  padding: 6.5cqw 6.5cqw 5cqw; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden;
  background-image: radial-gradient(ellipse at 30% 20%, rgba(255,255,255,.9), rgba(240,237,226,.6));
}
.deed-back { transform: rotateY(180deg); justify-content: center; align-items: center; gap: 5cqw; text-align: center; }
.deed-title { border: 0.7cqw solid #1a1a1a; text-align: center; padding: 3cqw 2cqw 3.5cqw; }
.deed-title small { display: block; font-size: 5cqw; font-weight: 600; letter-spacing: .06em; }
.deed-title b { display: block; font-size: 8.6cqw; font-weight: 700; text-transform: uppercase; line-height: 1.04; margin-top: 1cqw; }
.deed-rent { text-align: center; font-weight: 700; font-size: 7.6cqw; }
.deed-rows { padding: 0 3cqw; }
.deed-rows div { display: flex; justify-content: space-between; font-size: 6.4cqw; line-height: 1.32; }
.deed-rows.spaced div { font-size: 5.6cqw; line-height: 1.7; }
.deed-mort { text-align: center; font-weight: 700; font-size: 6.6cqw; }
.deed-cost { text-align: center; font-size: 6cqw; line-height: 1.22; }
.deed-note { text-align: center; font-size: 3.7cqw; line-height: 1.25; padding: 0 2cqw; }
.deed-art { display: flex; justify-content: center; }
.deed-art .art { width: 46cqw; height: auto; }
.deed-name { text-align: center; font-weight: 700; font-size: 8cqw; text-transform: uppercase; line-height: 1.05; }
.deed-para { text-align: center; font-size: 5.8cqw; line-height: 1.3; padding: 0 2cqw; }
.deed-back-name { font-weight: 700; font-size: 8cqw; text-transform: uppercase; border-bottom: 1.4cqw solid; padding-bottom: 2cqw; }
.deed-back-m { font-weight: 800; font-size: 11cqw; color: #c8102e; letter-spacing: .04em; }
.deed-back-for { font-size: 7cqw; font-weight: 600; }
.jailcard .deed-face { justify-content: center; gap: 5cqw; text-align: center; }
.jailcard.chance .deed-face { background: #f8a54b; box-shadow: inset 0 0 0 2.8cqw #f8a54b, inset 0 0 0 3.4cqw #1a1a1a; }
.jailcard.chest .deed-face { background: #7cc4ef; box-shadow: inset 0 0 0 2.8cqw #7cc4ef, inset 0 0 0 3.4cqw #1a1a1a; }
.jc-head { font-weight: 800; font-size: 8cqw; }
.jc-art .art { width: 40cqw; height: auto; }
.jc-text { font-weight: 800; font-size: 9cqw; line-height: 1.05; }

/* ---------- Chance / Community Chest card ---------- */
.luck-overlay { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(0,0,0,.25); cursor: pointer; animation: fadein .2s; }
.luck { container-type: inline-size; width: min(480px, 88vw); aspect-ratio: 1.62; perspective: 1500px; font-family: var(--card); color: #161616; }
.luck-flip { position: absolute; inset: 0; transform-style: preserve-3d; transform: rotateY(180deg) translateY(30%) scale(.6); transition: transform .9s cubic-bezier(.25,.8,.3,1.1); }
.luck.reveal .luck-flip { transform: rotateY(0) rotateZ(-2deg); }
.luck-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 3cqw; padding: 4cqw 5cqw; box-shadow: 0 30px 60px rgba(0,0,0,.55); display: flex; flex-direction: column; }
.luck.chance .luck-face { background: #f7a046; }
.luck.chest .luck-face { background: #7cc4ef; }
.luck-front { box-shadow: inset 0 0 0 1.8cqw transparent, inset 0 0 0 2.2cqw #1a1a1a, 0 30px 60px rgba(0,0,0,.55) !important; }
.luck-head { text-align: center; font-weight: 800; font-size: 6.4cqw; letter-spacing: .08em; padding-top: 1cqw; }
.luck.chest .luck-head, .luck.chest .luck-back-title { color: #0c2d63; }
.luck-body { flex: 1; display: flex; align-items: center; gap: 4cqw; padding: 0 2cqw; }
.luck-art .art { width: 20cqw; height: auto; display: block; }
.luck-text { flex: 1; text-align: center; font-size: 5.4cqw; font-weight: 600; line-height: 1.25; }
.luck-back { transform: rotateY(180deg); align-items: center; justify-content: center; gap: 2cqw; }
.luck-back-art .art { width: 26cqw; height: auto; }
.luck-back-title { font-weight: 900; font-size: 8cqw; text-align: center; line-height: 1; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(4, 8, 6, .55); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fadein .15s; }
.modal-box { padding: 1.3em; width: min(480px, 100%); max-height: 92vh; overflow-y: auto; }
.modal-box.wide { width: min(800px, 100%); }
.modal-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; margin-top: 1.1em; }
.deed-view { display: grid; grid-template-columns: 250px 1fr; gap: 1.3em; align-items: start; }
@media (max-width: 560px) { .deed-view { grid-template-columns: 1fr; justify-items: center; } }
.deed-view .deed { width: 250px; animation: deedin .4s cubic-bezier(.2,.8,.3,1.2); }
@keyframes deedin { from { transform: translateY(30px) rotateX(30deg) scale(.85); opacity: 0; } }
.deed-info { display: flex; flex-direction: column; gap: .55em; font-size: .92rem; }
.deed-info .kv { display: flex; justify-content: space-between; gap: 1em; padding-bottom: .4em; border-bottom: 1px solid var(--line); }
.deed-info .kv span:first-child { color: var(--muted); }
.deed-actions { display: flex; flex-direction: column; gap: 6px; margin-top: .6em; }

.modal-box.xwide { width: min(1180px, 100%); padding: 1.2em 1.4em; }
.felt { background: radial-gradient(120% 90% at 50% 0%, #22603f, #0f3324); }

/* MORTGAGED stamp over a face-up deed */
.stamp { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 2; }
.stamp span { transform: rotate(-30deg); border: 1cqw solid #c8102e; color: #c8102e; font-family: var(--card); font-weight: 800; font-size: 11cqw; letter-spacing: .04em; padding: .5cqw 3cqw; border-radius: 2cqw; background: rgba(255,255,255,.78); }

/* ---------- trade composer ---------- */
.trade-composer { display: flex; flex-direction: column; gap: 1em; }
.tc-head { display: flex; justify-content: space-between; align-items: center; gap: 1em; flex-wrap: wrap; }
.tc-head h2 { margin: 0; display: flex; align-items: center; gap: .4em; font-size: 1.3rem; }
.tc-partners, .pf-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.partner, .pf-tab {
  display: flex; align-items: center; gap: .45em; padding: .25em .8em .25em .25em; border-radius: 999px; border: 1px solid var(--line);
  background: rgba(255,255,255,.04); color: var(--ink); font: inherit; cursor: pointer; transition: background .15s, box-shadow .15s;
}
.partner img, .pf-tab img { width: 34px; height: 34px; }
.partner span { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.partner small { color: var(--muted); font-size: .74rem; }
.partner:hover, .pf-tab:hover { background: rgba(255,255,255,.09); }
.partner.sel, .pf-tab.sel { border-color: var(--c); background: color-mix(in srgb, var(--c) 20%, transparent); box-shadow: 0 0 0 1px var(--c) inset, 0 0 20px color-mix(in srgb, var(--c) 35%, transparent); }
.pf-tab { font-weight: 600; font-size: .88rem; }
.pf-tab.out { opacity: .45; }
.tc-body { display: grid; grid-template-columns: 1fr auto 1fr; gap: .8em; align-items: stretch; }
.tc-swap { display: grid; place-items: center; color: var(--gold); }
.tc-swap .ico { width: 26px; height: 26px; padding: 8px; box-sizing: content-box; border-radius: 50%; background: rgba(245,200,76,.12); border: 1px solid rgba(245,200,76,.4); }
.ts { border: 1px solid rgba(255,255,255,.1); border-radius: 16px; display: flex; flex-direction: column; min-width: 0; overflow: hidden;
  background: radial-gradient(120% 90% at 50% 0%, #22603f, #0f3324); box-shadow: inset 0 2px 30px rgba(0,0,0,.45); }
.ts-head { display: flex; align-items: center; gap: .6em; padding: .6em .9em; background: rgba(0,0,0,.25); border-bottom: 1px solid rgba(255,255,255,.08); }
.ts-head img { width: 46px; height: 46px; }
.ts-head .muted { color: #b9cdc2; font-size: .8rem; }
.ts-cards { display: flex; flex-wrap: wrap; gap: 18px 14px; padding: 22px 16px 20px; min-height: 230px; max-height: 48vh; overflow-y: auto; align-content: flex-start; }
.ts-group { display: flex; }
.ts-group .pick + .pick { margin-left: -42px; }
.ts-cards .empty { color: #b9cdc2; margin: auto; }
.pick { position: relative; width: 108px; flex-shrink: 0; cursor: pointer; transition: transform .2s cubic-bezier(.2,.8,.3,1.3), filter .2s; filter: drop-shadow(0 6px 8px rgba(0,0,0,.45)); }
.pick:hover { transform: translateY(-10px) rotate(-2deg) scale(1.05); z-index: 3; }
.pick.sel { transform: translateY(-16px); z-index: 2; filter: drop-shadow(0 12px 20px rgba(245,200,76,.4)); }
.pick.sel:hover { transform: translateY(-18px) rotate(-2deg) scale(1.05); }
.pick.sel .deed-face { outline: 3px solid var(--gold); outline-offset: 2px; }
.pick-check { position: absolute; top: -9px; right: -9px; width: 26px; height: 26px; border-radius: 50%; background: var(--gold); color: #2a1d00; display: grid; place-items: center;
  transform: scale(0); transition: transform .2s cubic-bezier(.2,.8,.3,1.6); z-index: 4; box-shadow: 0 2px 8px rgba(0,0,0,.5); }
.pick-check .ico { width: 15px; height: 15px; stroke-width: 3.2; }
.pick.sel .pick-check { transform: scale(1); }
.pick.blocked { cursor: not-allowed; filter: grayscale(.85) brightness(.65); }
.pick.blocked:hover { transform: none; }
.pick-lock { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); background: rgba(15,15,15,.9); color: #fff; font-size: .66rem; font-weight: 600;
  padding: .25em .6em; border-radius: 99px; white-space: nowrap; display: flex; gap: .3em; align-items: center; z-index: 3; }
.pick .hand-badge { top: -7px; }
.ts-cash { display: grid; grid-template-columns: auto 1fr auto; gap: .8em; align-items: center; padding: .65em .9em; background: rgba(0,0,0,.25); border-top: 1px solid rgba(255,255,255,.08); }
.ts-cash-label { display: flex; gap: .35em; align-items: center; font-weight: 700; color: var(--gold); }
.ts-cash input[type=range] { accent-color: var(--gold); padding: 0; background: none; border: 0; }
.ts-cash-input { display: flex; align-items: center; gap: .25em; font-weight: 700; color: var(--gold); }
.ts-cash-input input { width: 6.2em; padding: .35em .55em; }
.tc-foot { display: flex; justify-content: space-between; align-items: center; gap: 1em; flex-wrap: wrap; padding: .75em 1em; border-radius: 14px; background: rgba(255,255,255,.04); border: 1px solid var(--line); }
.tc-summary { display: flex; align-items: center; gap: .3em .9em; flex-wrap: wrap; font-size: .92rem; flex: 1; }
.tc-arrow { color: var(--gold); display: flex; }
.tc-value { font-size: .76rem; flex-basis: 100%; }
.tc-btns { display: flex; gap: 6px; }
.tc-note { margin: 0; font-size: .76rem; }

/* ---------- small cards in the offers list ---------- */
.trade .cols > div { min-width: 0; }
.mini-row { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; margin-top: 4px; }
.mini { width: 44px; cursor: pointer; transition: transform .15s; filter: drop-shadow(0 3px 4px rgba(0,0,0,.45)); }
.mini:hover { transform: translateY(-3px) scale(1.08); }
.mini .hand-badge { display: none; }
.cash-chip { display: inline-flex; align-items: center; gap: .3em; padding: .22em .6em; border-radius: 99px; background: rgba(245,200,76,.14); color: var(--gold); font-weight: 700; font-size: .8rem; border: 1px solid rgba(245,200,76,.35); }
.cash-chip .ico { width: .95em; height: .95em; }

/* ---------- player portfolio ---------- */
.portfolio { display: flex; flex-direction: column; gap: 1em; }
.pf-head { display: flex; align-items: center; gap: 1em; padding: .7em 1em; border-radius: 16px; border: 1px solid var(--line);
  background: linear-gradient(90deg, color-mix(in srgb, var(--c) 30%, transparent), transparent 70%), rgba(255,255,255,.03); }
.pf-token { width: 84px; height: 84px; }
.pf-id { flex: 1; min-width: 0; }
.pf-id h2 { margin: 0 0 .25em; font-size: 1.45rem; }
.pf-stats { display: flex; gap: .4em 1.2em; flex-wrap: wrap; color: var(--muted); font-size: .88rem; align-items: center; }
.pf-stats b { color: var(--ink); font-family: var(--card); font-size: 1.12rem; }
.pf-sets { display: flex; flex-wrap: wrap; gap: 24px 20px; padding: 22px; border-radius: 16px; min-height: 280px; align-items: flex-start;
  background: radial-gradient(120% 90% at 50% 0%, #22603f, #0f3324); border: 1px solid rgba(255,255,255,.08); box-shadow: inset 0 2px 34px rgba(0,0,0,.5); }
.pf-set { width: 132px; }
.pf-set-head { display: flex; align-items: center; gap: .4em; font-size: .78rem; font-weight: 700; margin-bottom: 9px; color: #e9f2ec; }
.pf-sw { width: 12px; height: 12px; border-radius: 3px; background: var(--gc); box-shadow: 0 0 0 1px rgba(0,0,0,.4); flex-shrink: 0; }
.pf-count { margin-left: auto; font-size: .66rem; padding: .12em .5em; border-radius: 99px; background: rgba(0,0,0,.35); color: #b9cdc2; white-space: nowrap; }
.pf-count.full { background: var(--gold); color: #2a1d00; }
.pf-stack { display: flex; flex-direction: column; }
.pf-card { position: relative; width: 132px; cursor: pointer; transition: transform .22s cubic-bezier(.2,.8,.3,1.2); filter: drop-shadow(0 6px 10px rgba(0,0,0,.5)); }
.pf-card + .pf-card { margin-top: -156px; }
.pf-card:hover { transform: translateY(-14px) rotate(-1.5deg) scale(1.03); z-index: 5; }
.pf-empty { color: #cfe0d6; margin: auto; }

/* player panel: click to view cards */
.pl { cursor: pointer; }
.pl:hover { border-color: rgba(255,255,255,.25); }
.pl-view { position: absolute; right: 8px; bottom: 6px; color: var(--muted); opacity: .45; transition: opacity .15s; }
.pl:hover .pl-view { opacity: 1; color: var(--ink); }

@media (max-width: 760px) {
  .tc-body { grid-template-columns: 1fr; }
  .tc-swap .ico { transform: rotate(90deg); }
  .pick { width: 92px; }
  .ts-group .pick + .pick { margin-left: -34px; }
  .pf-set, .pf-card { width: 112px; }
  .pf-card + .pf-card { margin-top: -130px; }
}
.winner { text-align: center; }
.winner img { width: 140px; height: 140px; }

.tooltip { position: fixed; z-index: 30; width: 150px; pointer-events: none; transform: translate(18px, -50%); filter: drop-shadow(0 16px 24px rgba(0,0,0,.55)); }
.tooltip.left { transform: translate(calc(-100% - 18px), -50%); }
.tooltip .owner-line { margin-top: 6px; font-size: .75rem; background: var(--glass); border-radius: 8px; padding: .3em .5em; text-align: center; border: 1px solid var(--line); }

/* ---------- phones & tablets: the board fills the screen and the HUD floats around it ---------- */
.m-nav, .m-backdrop { display: none; }
button, .btn, .hand-card, .pl, .bank-panel { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
@media (hover: none) { .tooltip { display: none !important; } }
@media (pointer: coarse) { input, select, textarea { font-size: 16px; } } /* stops iOS zooming into fields */
@keyframes navPulse { 0% { box-shadow: 0 0 0 2px var(--gold), 0 0 24px rgba(245,200,76,.6); } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (max-width: 980px), (max-height: 520px) {
  body.in-game { overflow: hidden; overscroll-behavior: none; position: fixed; inset: 0; }
  #scene { width: 100vw; height: 100vh; height: 100dvh; }
  #screen-game { position: fixed; inset: 0; padding: 0; pointer-events: none; }
  #screen-game > * { pointer-events: auto; }
  .hud-top { position: fixed; top: calc(env(safe-area-inset-top) + 6px); left: calc(env(safe-area-inset-left) + 8px); right: calc(env(safe-area-inset-right) + 8px); padding: 0; z-index: 6; gap: 8px; }
  .hud-title { padding: .4em .7em; font-size: .85rem; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .hud-btns { flex-shrink: 0; }
  .hud-btns .btn.small { padding: .5em .6em; }
  .menu { position: fixed; top: calc(env(safe-area-inset-top) + 54px); right: 8px; z-index: 13; }
  .menu .btn { padding: .7em .9em; }

  /* players (and the Bank) as a strip under the top bar */
  .hud-players { position: fixed; top: calc(env(safe-area-inset-top) + 52px); left: 0; right: 0; width: auto; max-height: none; flex-direction: row; align-items: stretch; gap: 6px; overflow-x: auto; overflow-y: hidden; padding: 4px calc(env(safe-area-inset-right) + 8px) 6px calc(env(safe-area-inset-left) + 8px); scrollbar-width: none; z-index: 5; }
  .hud-players::-webkit-scrollbar { display: none; }
  .pl { flex: 0 0 auto; width: 148px; grid-template-columns: 30px 1fr; gap: 0 .45em; padding: .35em .55em .4em .5em; border-radius: 12px; }
  .pl img { width: 30px; height: 30px; }
  .pl .nm { font-size: .78rem; }
  .pl .cash { font-size: .95rem; }
  .pl .tags { margin-top: 1px; gap: 3px; }
  .pl .tags:empty { display: none; }
  .pl .tag { font-size: .56rem; padding: .08em .35em; }
  .pl .chips { margin-top: 3px; gap: 2px; }
  .pl .chip { width: 7px; height: 10px; }
  .pl-view { display: none; }
  .pl.turn { transform: none; box-shadow: 0 0 0 2px var(--gold), 0 0 16px rgba(245, 200, 76, .3); }
  .bank-panel { flex: 0 0 auto; width: 132px; padding: .35em .55em .35em .7em; gap: 1px; justify-content: center; }
  .bank-panel .bk-head, .bank-panel .bk-pips, .bank-panel .bk-deeds, .bank-panel .bk-none { display: none; }
  .bank-panel .bk-row { font-size: .68rem; gap: .3em; }
  .bank-panel .bk-n b { font-size: .82rem; }
  .bank-panel .bk-warn { font-size: .5rem; padding: 0 .3em; }

  /* the action bar sits just above the bottom tabs */
  .action-dock { position: fixed; top: auto; left: calc(env(safe-area-inset-left) + 8px); right: calc(env(safe-area-inset-right) + 8px); bottom: calc(env(safe-area-inset-bottom) + 66px); transform: none; width: auto; min-width: 0; padding: .6em .8em; gap: .5em; max-height: 48dvh; overflow-y: auto; z-index: 4; }
  .action-dock .status { font-size: .92rem; }
  .action-dock, .m-nav { max-width: 600px; margin: 0 auto; }
  .action-dock .btn { min-height: 42px; }
  .land-panel { left: 50%; top: 50%; }
  .land-box { max-height: calc(100dvh - 24px); overflow-y: auto; }
  .land-deed { width: min(210px, 28dvh); }

  /* bottom tabs */
  .m-nav { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: calc(env(safe-area-inset-left) + 8px); right: calc(env(safe-area-inset-right) + 8px); bottom: calc(env(safe-area-inset-bottom) + 8px); height: 52px; z-index: 12; padding: 4px; gap: 4px; border-radius: 16px; background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--line); }
  .m-tab { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font: 600 .68rem var(--ui); color: var(--muted); background: transparent; border: 0; border-radius: 12px; cursor: pointer; }
  .m-tab .ico { width: 19px; height: 19px; }
  .m-tab.active { background: rgba(255,255,255,.1); color: var(--ink); }
  .m-tab .badge { position: absolute; top: 2px; left: calc(50% + 6px); margin: 0; font-size: .62rem; min-width: 1.5em; text-align: center; }
  .m-tab[data-sheet="cards"] .badge { background: rgba(255,255,255,.18); }
  .m-tab.pulse { animation: navPulse .9s ease-out; }

  /* sheets slide up from the bottom tabs */
  #screen-game > .m-backdrop { display: block; position: fixed; inset: 0; z-index: 10; background: rgba(0,0,0,.45); opacity: 0; pointer-events: none; transition: opacity .2s; }
  body[data-sheet="cards"] #screen-game > .m-backdrop, body[data-sheet="log"] #screen-game > .m-backdrop, body[data-sheet="chat"] #screen-game > .m-backdrop, body[data-sheet="trades"] #screen-game > .m-backdrop { opacity: 1; pointer-events: auto; }
  .hud-side, #screen-game .hand { position: fixed; left: 0; right: 0; top: auto; bottom: 0; width: auto; height: min(70dvh, 600px); z-index: 11; padding: 12px calc(env(safe-area-inset-right) + 12px) calc(env(safe-area-inset-bottom) + 70px) calc(env(safe-area-inset-left) + 12px); border-radius: 20px 20px 0 0; transform: translateY(105%); visibility: hidden; transition: transform .28s cubic-bezier(.2,.8,.3,1), visibility 0s .28s; }
  body[data-sheet="log"] .hud-side, body[data-sheet="chat"] .hud-side, body[data-sheet="trades"] .hud-side, body[data-sheet="cards"] #screen-game .hand { transform: none; visibility: visible; transition: transform .28s cubic-bezier(.2,.8,.3,1); }
  .hud-side .tabs { display: none; }
  .hud-side .chat-form input { font-size: 16px; } /* stops iOS zooming into the field */
  #screen-game .hand { background: var(--glass); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid var(--line); display: grid; grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); align-content: start; justify-content: stretch; align-items: start; gap: 14px 10px; overflow-y: auto; perspective: none; pointer-events: auto; }
  .hand-card { width: auto; height: auto; margin: 0; }
  .hand-inner { position: static; transform: none !important; filter: drop-shadow(0 6px 10px rgba(0,0,0,.4)) !important; }
  .hand-card:hover .hand-inner { transform: none !important; }
  .hand-gap { display: none; }
  #screen-game .hand:empty::before { content: "You don't own any properties yet."; grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 2em 0; }

  /* dialogs become bottom sheets */
  .modal { padding: 0; place-items: end stretch; }
  .modal-box, .modal-box.wide, .modal-box.xwide { width: 100%; max-height: 94dvh; border-radius: 20px 20px 0 0; padding: 1em calc(env(safe-area-inset-right) + 1em) calc(env(safe-area-inset-bottom) + 1em) calc(env(safe-area-inset-left) + 1em); }
  .tooltip { display: none !important; }
  .pf-head { flex-wrap: wrap; gap: .4em .8em; padding: .6em .8em; }
  .pf-token, .pf-head .bk-ico.big { width: 54px; height: 54px; }
  .pf-head .bk-ico.big .ico { width: 30px; height: 30px; }
  .pf-id h2 { font-size: 1.15rem; }
  .pf-stats { gap: .2em .9em; font-size: .8rem; }
  .pf-stats b { font-size: .98rem; }
  .pf-head > .btn { flex: 1 1 100%; }
  .pf-tab { padding: .3em .6em; font-size: .8rem; }
  .pf-tab img, .pf-tab .bk-ico { width: 26px; height: 26px; }
  .bk-supply { grid-template-columns: 1fr; gap: .6em; }
  .tc-foot { position: sticky; bottom: calc(-1em - env(safe-area-inset-bottom)); z-index: 2; background: rgba(16, 22, 19, .96); backdrop-filter: blur(10px); margin: 0 -.3em; }
  .tc-btns { flex: 1 1 100%; }
  .tc-btns .btn { flex: 1; min-height: 44px; }
}
@media (max-width: 420px) {
  #btn-trade { font-size: 0; gap: 0; }
  #btn-trade .ico { font-size: .9rem; }
  .hud-title .code { display: none; }
}
/* landscape phones: players down the left, sheets from the right */
@media (max-height: 520px) and (orientation: landscape) {
  .hud-players { top: calc(env(safe-area-inset-top) + 50px); bottom: 8px; right: auto; width: calc(env(safe-area-inset-left) + 166px); flex-direction: column; overflow-x: hidden; overflow-y: auto; padding: 0 6px 6px calc(env(safe-area-inset-left) + 8px); }
  .pl, .bank-panel { width: 100%; }
  .action-dock { left: calc(env(safe-area-inset-left) + 178px); right: calc(env(safe-area-inset-right) + 8px); bottom: 8px; max-width: 460px; margin: 0 auto; max-height: calc(100dvh - 70px); }
  .m-nav { top: calc(env(safe-area-inset-top) + 50px); bottom: auto; left: auto; width: 64px; height: auto; grid-template-columns: 1fr; grid-auto-rows: 52px; }
  .hud-side, #screen-game .hand { left: auto; top: 0; height: auto; width: min(440px, 62vw); border-radius: 20px 0 0 20px; padding: 12px calc(env(safe-area-inset-right) + 82px) 12px 12px; transform: translateX(105%); }
  .modal-box, .modal-box.wide, .modal-box.xwide { max-height: 100dvh; border-radius: 16px 16px 0 0; }
  .land-deed { width: min(150px, 34dvh); }
  .action-dock { padding: .4em .7em; gap: .3em .8em; flex-direction: row; flex-wrap: wrap; justify-content: center; }
  .action-dock .status { font-size: .85rem; }
  .action-dock .btn { min-height: 38px; }
}

/* phones: empty seats shrink to small slots so your piece picker isn't pushed off screen */
@media (max-width: 560px) {
  .lobby-players { grid-template-columns: 1fr 1fr; }
  .lp { min-height: 52px; padding: .45em .55em; gap: .5em; }
  .lp img { width: 38px; height: 38px; }
  .lp.empty-seat:not(.can-add) { min-height: 34px; font-size: .8rem; }
  .lp.empty-seat.can-add { grid-column: 1 / -1; }
  .lobby-actions { flex-wrap: wrap; }
  .lobby-actions .btn { flex: 1; min-height: 44px; }
}

/* ---------- roll button: hold to charge ---------- */
.btn[data-do="roll"] { position: relative; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.btn[data-do="roll"]::after { content: ""; position: absolute; left: 0; bottom: 0; height: 5px; width: calc(var(--pow, 0) * 100%); background: linear-gradient(90deg, #ffd34d, #fff6cf); box-shadow: 0 0 12px #ffd34d; border-radius: 0 3px 3px 0; }
.btn[data-do="roll"].charging { animation: rollShake .07s infinite alternate; box-shadow: 0 0 calc(10px + var(--pow, 0) * 24px) rgba(255, 211, 77, calc(.25 + var(--pow, 0) * .5)); }
@keyframes rollShake { from { transform: translate(calc(var(--pow, 0) * -2px), 0) rotate(calc(var(--pow, 0) * -1.2deg)); } to { transform: translate(calc(var(--pow, 0) * 2px), -1px) rotate(calc(var(--pow, 0) * 1.2deg)); } }
.roll-hint { font-size: .74rem; color: var(--muted); }

/* ---------- camera: view cube (top-right of the board) and recenter prompt ---------- */
.view-nav { position: absolute; top: 74px; right: 338px; display: flex; align-items: flex-start; gap: 6px; z-index: 3; }
.vc-wrap { width: 64px; height: 64px; perspective: 260px; }
.vc { position: relative; width: 64px; height: 64px; transform-style: preserve-3d; }
.vc-face { position: absolute; inset: 0; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.28); border-radius: 6px; background: rgba(28, 38, 33, .82); color: #dfe7e2; font: 700 9.5px/1 var(--ui); letter-spacing: .06em; cursor: pointer; backface-visibility: hidden; padding: 0; transition: background .15s, color .15s; }
.vc-face:hover { background: rgba(245, 200, 76, .9); color: #1b1b1b; }
.vc-face.front { transform: translateZ(32px); }
.vc-face.back { transform: rotateY(180deg) translateZ(32px); }
.vc-face.right { transform: rotateY(90deg) translateZ(32px); }
.vc-face.left { transform: rotateY(-90deg) translateZ(32px); }
.vc-face.top { transform: rotateX(90deg) translateZ(32px); background: rgba(40, 92, 60, .9); }
.vc-face.top:hover { background: rgba(245, 200, 76, .9); }
.vc-face.bottom { transform: rotateX(-90deg) translateZ(32px); cursor: default; }
.vn-home { width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--line); background: var(--glass); color: var(--ink); display: grid; place-items: center; cursor: pointer; backdrop-filter: blur(10px); padding: 0; }
.vn-home:hover { background: rgba(245, 200, 76, .9); color: #1b1b1b; }
kbd { font: 700 .72rem/1 var(--ui); padding: .15em .45em; border-radius: 4px; border: 1px solid rgba(255,255,255,.3); border-bottom-width: 2px; background: rgba(255,255,255,.08); color: var(--ink); }
#btn-view.attn, .vn-home.attn { box-shadow: 0 0 0 1px var(--gold) inset; color: var(--gold); }
@media (max-width: 980px), (max-height: 520px) {
  .view-nav { display: none; }
}

/* ---------- rolling for the first turn ---------- */
.order-list { display: flex; flex-direction: column; gap: 5px; width: 100%; max-width: 360px; }
.or-row { display: grid; grid-template-columns: 28px 1fr auto 28px; align-items: center; gap: .55em; padding: .3em .6em .3em .35em; border-radius: 10px; background: rgba(255,255,255,.05); border-left: 3px solid var(--c); text-align: left; font-size: .88rem; }
.or-row img { width: 28px; height: 28px; }
.or-row.out { opacity: .45; }
.or-row.done { background: rgba(255,255,255,.09); }
.or-nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.or-dice { display: inline-flex; gap: 4px; }
.or-total { font-family: var(--card); font-size: 1.1rem; text-align: right; }
.or-wait { grid-column: 3 / 5; color: var(--muted); font-size: .78rem; font-style: italic; text-align: right; }
.mini-die { display: inline-grid; grid-template-columns: repeat(3, 1fr); gap: 1px; width: 20px; height: 20px; padding: 3px; border-radius: 4px; background: #f6f1e6; box-shadow: inset 0 -1px 0 rgba(0,0,0,.25); }
.mini-die i { border-radius: 50%; }
.mini-die i.on { background: #1d1d1d; }
.tag.roll { background: rgba(245, 200, 76, .2); color: var(--gold); }
