:root {
  --bg: #12101c;
  --panel: #1d1a30;
  --panel-2: #26223f;
  --line: #34305a;
  --text: #f4f2ff;
  --muted: #a39fc4;
  --primary: #7b5cff;
  --primary-d: #5536e0;
  --green: #22c55e;
  --green-d: #15803d;
  --danger: #ef4444;
  --danger-d: #a61b1b;
  --light: #f4f2ff;
  --light-d: #bdb6ea;
  --gold: #fbbf24;
  --board: #cde6d3;
  --sq: #fbfaf2;
  --ink: #17181c;
  --r: 16px;
  --font: 'Vazirmatn', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(123, 92, 255, .25), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(34, 197, 94, .12), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.center-text { text-align: center; }
.num { font-variant-numeric: tabular-nums; unicode-bidi: isolate; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: center; }

/* ---------- buttons: chunky, game-like ---------- */
.btn {
  --b: var(--panel-2); --bd: #110f1f;
  border: 0; cursor: pointer; border-radius: 14px;
  padding: 10px 18px; font-weight: 700; font-size: 15px;
  background: var(--b); color: var(--text);
  box-shadow: 0 4px 0 var(--bd);
  transition: transform .08s, box-shadow .08s, filter .15s;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { filter: brightness(1.08); }
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--bd); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.big { width: 100%; padding: 15px 20px; font-size: 17px; border-radius: 16px; }
.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 10px; box-shadow: 0 3px 0 var(--bd); }
.btn-primary { --b: var(--primary); --bd: var(--primary-d); color: #fff; }
.btn-green { --b: var(--green); --bd: var(--green-d); color: #fff; }
.btn-danger { --b: var(--danger); --bd: var(--danger-d); color: #fff; }
.btn-light { --b: var(--light); --bd: var(--light-d); color: #221b4a; }
.btn-ghost { --b: transparent; --bd: transparent; color: var(--muted); box-shadow: none; }
.btn-ghost:hover { color: var(--text); }
.icon-btn { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 15px; padding: 4px 8px; border-radius: 8px; }
.icon-btn:hover { background: var(--panel-2); color: var(--text); }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
}

/* ---------- home ---------- */
.screen { min-height: 100dvh; }
#home, #lobby {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 32px 16px; gap: 24px;
}
.hero { text-align: center; }
.hero h1 { font-size: clamp(40px, 9vw, 64px); font-weight: 900; margin: 8px 0 0; letter-spacing: -1px; }
.hero p { margin: 4px 0 0; }
.logo-badge {
  width: 84px; height: 84px; margin: 0 auto; display: grid; place-items: center; font-size: 46px;
  background: linear-gradient(145deg, #8f73ff, #5536e0); border-radius: 26px;
  box-shadow: 0 6px 0 #3b22a8, 0 20px 50px rgba(123, 92, 255, .45);
  transform: rotate(-6deg);
}
.home-card, .lobby-card { width: min(420px, 100%); display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: 14px; color: var(--muted); }
.field input, .set-row input[type=number], .set-row select, .chat input, .modal input[type=number], .modal select {
  background: var(--bg); border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px;
  font-size: 16px; outline: none; transition: border-color .15s; width: 100%;
}
.field input:focus, .set-row input:focus, .chat input:focus, .modal input:focus, .modal select:focus { border-color: var(--primary); }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 6px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.pin { display: flex; gap: 10px; justify-content: center; }
.pin input, .pin span {
  width: 64px; height: 76px; text-align: center; font-size: 32px; font-weight: 700;
  background: var(--bg); border: 2px solid var(--line); border-radius: 14px; outline: none;
  transition: border-color .15s, transform .15s;
}
.pin input:focus { border-color: var(--primary); transform: translateY(-2px); }
.pin-show span { display: grid; place-items: center; background: var(--panel-2); border-color: var(--primary); color: #fff; }
.err { color: #ff8a8a; text-align: center; min-height: 1.2em; margin: 0; font-size: 14px; }

/* ---------- lobby ---------- */
.lobby-head { display: flex; justify-content: space-between; align-items: baseline; margin-top: 8px; }
.lobby-head h3, .settings h3 { margin: 0; font-size: 16px; }
.lobby-players { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.lobby-players li { display: flex; align-items: center; gap: 10px; background: var(--panel-2); padding: 8px 10px; border-radius: 12px; }
.lobby-players .nm { flex: 1; font-weight: 700; }
.badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--gold); color: #3b2a00; }
.badge.soft { background: var(--line); color: var(--text); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #555; flex: none; }
.dot.on { background: var(--green); box-shadow: 0 0 0 3px rgba(34, 197, 94, .2); }
.settings { display: flex; flex-direction: column; gap: 8px; background: var(--bg); border-radius: 16px; padding: 14px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; }
.set-row input[type=number], .set-row select { width: 110px; max-width: 60%; padding: 8px 10px; font-size: 15px; }
.set-row.check input { width: 20px; height: 20px; accent-color: var(--primary); }
.settings.readonly input, .settings.readonly select { pointer-events: none; opacity: .75; }

/* ---------- token ---------- */
.tok {
  --c: #888;
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  background: var(--c); color: #fff; font-size: 12px; font-weight: 900;
  display: grid; place-items: center;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .25), 0 0 0 2px rgba(255, 255, 255, .85);
}
.tok.big { width: 42px; height: 42px; font-size: 18px; }

/* ---------- game: full-screen app shell (no page scroll) ---------- */
html:has(#game:not(.hidden)), html:has(#game:not(.hidden)) body { overflow: hidden; overscroll-behavior: none; height: 100%; }
body { -webkit-tap-highlight-color: transparent; }
#game {
  position: fixed; inset: 0; height: 100dvh; overflow: hidden;
  display: grid; gap: 6px;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  grid-template-areas: "top" "pl" "board" "act";
  padding: max(6px, env(safe-area-inset-top)) max(6px, env(safe-area-inset-right)) 0 max(6px, env(safe-area-inset-left));
  user-select: none; -webkit-user-select: none;
}
.topbar { grid-area: top; display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 40px; }
.tb-code { font-size: 12px; color: var(--muted); white-space: nowrap; }
.tb-code b { color: var(--text); font-size: 15px; letter-spacing: 2px; }
.tb-money { font-size: 20px; font-weight: 900; }
.tb-money.neg { color: #ff8a8a; }
.tb-btns { display: flex; gap: 4px; }
.ib {
  position: relative; width: 40px; height: 40px; border-radius: 12px; border: 0; cursor: pointer;
  background: var(--panel-2); color: var(--text); font-size: 18px; display: grid; place-items: center;
  box-shadow: 0 3px 0 #110f1f;
}
.ib:active { transform: translateY(2px); box-shadow: 0 1px 0 #110f1f; }
.ib.on { background: var(--primary); box-shadow: 0 3px 0 var(--primary-d); }
.tab-dot { position: absolute; top: 4px; inset-inline-end: 4px; width: 9px; height: 9px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 2px var(--bg); }

/* players: horizontal strip (portrait) / column (landscape) */
.pstrip { grid-area: pl; display: flex; gap: 6px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; padding: 2px 0; }
.pstrip::-webkit-scrollbar { display: none; }
.pl {
  flex: none; display: flex; align-items: center; gap: 8px; padding: 5px 10px 5px 6px; border-radius: 14px; cursor: pointer;
  background: var(--panel); border: 2px solid var(--line); min-width: 0; transition: background .15s, border-color .15s;
}
.pl .tok { width: 30px; height: 30px; font-size: 14px; }
.pl.cur { border-color: var(--pc, var(--primary)); background: color-mix(in srgb, var(--pc, var(--primary)) 22%, var(--panel)); }
.pl.out { opacity: .45; }
.pl-info { min-width: 0; }
.pl-name { font-weight: 700; font-size: 13px; display: flex; gap: 4px; align-items: center; max-width: 110px; }
.pl-name span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-sub { font-size: 11px; color: var(--muted); white-space: nowrap; }
.pl-money { font-weight: 900; font-size: 13px; border-radius: 6px; padding: 0 4px; }
.pl-money.neg { color: #ff8a8a; }
.pl .badge { font-size: 9px; padding: 1px 5px; }

/* board area: largest square that fits */
.board-wrap {
  grid-area: board; position: relative; min-height: 0; min-width: 0; container-type: size;
  display: grid; place-items: center; overflow: hidden; touch-action: manipulation;
}
.board-wrap.zoomed { overflow: auto; place-items: start; touch-action: pan-x pan-y; scrollbar-width: none; }
.board-wrap.zoomed::-webkit-scrollbar { display: none; }

.action-bar {
  grid-area: act; margin: 0 -6px; z-index: 20;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: rgba(29, 26, 48, .96); border-top: 1px solid var(--line); border-radius: 20px 20px 0 0;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, .35); display: flex; justify-content: center;
}
.action-bar .c-act { width: min(100%, 480px); font-size: 15px; }
.action-bar .note { color: var(--muted); }
.action-bar .buy-card { width: 100%; display: flex; align-items: stretch; }
.action-bar .bc-h { flex: 1; display: flex; align-items: center; justify-content: center; }
.action-bar .bc-b { display: flex; align-items: center; }
.action-bar .row { width: 100%; flex-wrap: nowrap; }
.action-bar .row .btn { flex: 1; padding-inline: 10px; }
.action-bar:has(.c-act:empty) { display: none; }

@media (orientation: landscape) and (min-width: 560px) {
  #game {
    grid-template-columns: minmax(0, 1fr) clamp(240px, 32vw, 380px);
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas: "board top" "board pl" "board act";
    column-gap: 10px;
    padding-bottom: max(6px, env(safe-area-inset-bottom));
  }
  .pstrip { flex-direction: column; overflow-x: hidden; overflow-y: auto; align-content: stretch; }
  .pl { width: 100%; }
  .tb-code { display: none; }
  .topbar { flex-wrap: wrap; }
  .tb-btns { gap: 3px; }
  .ib { width: 36px; height: 36px; font-size: 16px; }
  .pl-info { flex: 1; }
  .pl-name { max-width: none; }
  .action-bar { margin: 0; border-radius: 18px; border: 1px solid var(--line); padding: 10px; }
  .action-bar .c-act { width: 100%; }
}

/* drawers: assets / trades / chat */
.drawer {
  position: fixed; z-index: 40; top: 0; bottom: 0; inset-inline-start: 0;
  width: min(420px, 92vw); background: var(--bg); border-inline-end: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 10px;
  padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom));
  transform: translateX(105%); transition: transform .28s cubic-bezier(.2, .9, .3, 1);
  box-shadow: 0 0 60px rgba(0, 0, 0, .5);
}
.drawer.open { transform: none; }
.drawer-bg { position: fixed; inset: 0; z-index: 39; background: rgba(8, 6, 16, .55); }
.drawer-body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.side[data-tab=mine] [data-panel]:not([data-panel=mine]),
.side[data-tab=log] [data-panel]:not([data-panel=log]) { display: none; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; }
.panel-title { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.tabs { display: flex; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 4px; }
.tabs button {
  flex: 1; border: 0; background: none; border-radius: 10px; padding: 10px 4px; cursor: pointer;
  font-weight: 700; font-size: 14px; color: var(--muted); position: relative;
}
.tabs button.on { background: var(--primary); color: #fff; box-shadow: 0 3px 0 var(--primary-d); }
.tabs .tab-x { flex: none; width: 44px; font-size: 16px; }
.log-panel { flex: 1; display: flex; flex-direction: column; min-height: 0; }

/* ---------- board ---------- */
.board {
  container-type: inline-size;
  width: min(100cqw, 100cqh);
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: 2fr repeat(9, 1fr) 2fr;
  grid-template-rows: 2fr repeat(9, 1fr) 2fr;
  gap: 1px;
  padding: 1px;
  background: var(--ink);
  border-radius: 10px;
  box-shadow: 0 0 0 4px #2a2542, 0 20px 60px rgba(0, 0, 0, .5);
  color: var(--ink);
  flex: none;
}
.board-wrap.zoomed .board { width: calc(min(100cqw, 100cqh) * var(--zoom, 1.9)); margin: 6px; }

.sq { position: relative; background: var(--sq); display: flex; overflow: hidden; cursor: default; --owner: transparent; }
.sq.buyable { cursor: pointer; }
.sq.bottom { flex-direction: column; }
.sq.top { flex-direction: column-reverse; }
.sq.left { flex-direction: row-reverse; }
.sq.right { flex-direction: row; }
.sq .bar { flex: none; display: flex; align-items: center; justify-content: center; gap: 1px; }
.sq.bottom .bar, .sq.top .bar { height: 20%; }
.sq.left .bar, .sq.right .bar { width: 20%; flex-direction: column; }
.sq .body {
  flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 1px; gap: .4cqw; direction: rtl;
}
/* top/bottom squares are narrow and deep: run the text along the depth so names get room */
.sq.bottom .body, .sq.top .body { writing-mode: vertical-rl; transform: rotate(180deg); }
.sq .nm { font-size: max(8.5px, 2.5cqw); font-weight: 800; line-height: 1.1; overflow-wrap: anywhere; }
.sq .pr { font-size: max(6.5px, 1.75cqw); font-weight: 600; opacity: .7; }
.sq .ic { font-size: 3.2cqw; line-height: 1; }
.sq.bottom .ic, .sq.top .ic { writing-mode: horizontal-tb; transform: rotate(180deg); }
.sq.corner .body { writing-mode: horizontal-tb; transform: none; }
.sq.corner .ic { font-size: 6cqw; transform: none; }
.sq.corner .nm { font-size: max(8px, 2.3cqw); }
.sq.t-go { background: #fde7e7; }
.sq.t-gotojail { background: #e8e6ff; }
.sq.t-chance .ic { color: #e2572b; }
.sq.owned { background: color-mix(in srgb, var(--owner) 16%, var(--sq)); }
.sq.owned::after { content: ''; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 0 max(2px, .5cqw) var(--owner); }
.sq.mort .body { opacity: .4; }
.sq.mort::before {
  content: 'رهن'; position: absolute; z-index: 1; inset: auto 0 0 0; text-align: center;
  font-size: max(6px, 1.4cqw); font-weight: 900; color: #fff; background: rgba(20, 20, 30, .7);
}
.sq.hl { animation: land 1.2s ease-out; }
@keyframes land { 0% { filter: brightness(1.35); box-shadow: inset 0 0 0 .9cqw #fbbf24; } }
.house, .hotel { display: block; border-radius: 1px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .4); }
.house { width: 1.6cqw; height: 1.6cqw; background: #22c55e; }
.hotel { width: 3cqw; height: 1.8cqw; background: #e11d48; }

/* tokens: big and readable, current player lifted with a halo */
.toks {
  position: absolute; inset: 0; display: flex; flex-wrap: wrap; align-content: center; justify-content: center;
  pointer-events: none; padding: 1px; z-index: 2;
}
.toks .tok {
  /* a side square is ~7.7cqw wide: tokens must stay smaller than that or they get clipped */
  width: 4.6cqw; height: 4.6cqw; min-width: 12px; min-height: 12px; font-size: max(7px, 2.3cqw);
  box-shadow: inset 0 -.4cqw 0 rgba(0, 0, 0, .25), 0 0 0 max(1px, .35cqw) #fff, 0 .4cqw 1cqw rgba(0, 0, 0, .55);
}
.toks .tok + .tok { margin-inline-start: -2.2cqw; }
.sq.corner .toks .tok + .tok { margin-inline-start: -1.5cqw; }
.toks .tok.cur {
  position: relative; z-index: 3; width: 5.4cqw; height: 5.4cqw; min-width: 14px; min-height: 14px; font-size: max(8px, 2.7cqw);
  box-shadow: inset 0 -.4cqw 0 rgba(0, 0, 0, .25), 0 0 0 max(1px, .4cqw) #fff, 0 0 0 max(2px, .8cqw) var(--c), 0 .6cqw 1.4cqw rgba(0, 0, 0, .6);
  animation: bob 1s ease-in-out infinite;
}
.toks .tok.hop { animation: hop .16s ease-out; }
.toks .tok.jailed { outline: 2px dashed #111; outline-offset: 1px; }
@keyframes bob { 50% { transform: translateY(-10%); } }
@keyframes hop { 50% { transform: translateY(-45%) scale(1.15); } }

/* ---------- board center ---------- */
.center {
  grid-area: 2 / 2 / 11 / 11;
  background: radial-gradient(circle at 50% 40%, rgba(255, 255, 255, .55), transparent 65%), var(--board);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2cqw; padding: 3cqw; direction: rtl; text-align: center; overflow: hidden;
  font-size: clamp(11px, 2.6cqw, 17px);
}
.brand {
  font-weight: 900; font-size: 6cqw; color: #fff;
  background: #d62828; padding: .4cqw 3cqw; border-radius: 1.5cqw;
  transform: rotate(-8deg); box-shadow: 0 .8cqw 0 #8f1414;
}
.center.has-card .brand { display: none; }
.turn { display: flex; align-items: center; gap: 8px; font-weight: 800; }
.turn .tok { width: max(22px, 5cqw); height: max(22px, 5cqw); font-size: max(11px, 2.4cqw); }

/* 3D dice */
.dice { display: flex; gap: 5cqw; perspective: 60cqw; padding: 2cqw; border-radius: 3cqw; position: relative; }
.dice.can { cursor: pointer; background: rgba(123, 92, 255, .14); box-shadow: 0 0 0 .5cqw rgba(123, 92, 255, .55); animation: pulse 1.4s ease-in-out infinite; }
.dice.can::after {
  content: 'بزن تا تاس بریزی'; position: absolute; inset: auto 0 -3.6cqw; font-size: max(10px, 2.2cqw); font-weight: 800; color: var(--primary-d);
}
@keyframes pulse { 50% { box-shadow: 0 0 0 1.4cqw rgba(123, 92, 255, 0); } }
.die3 { --s: max(38px, 12cqw); width: var(--s); height: var(--s); position: relative; transform-style: preserve-3d; transition: transform 1s cubic-bezier(.15, .75, .25, 1.02); }
.die3.throw { animation: toss 1s cubic-bezier(.3, .7, .4, 1); }
@keyframes toss { 40% { translate: 0 -40%; } 70% { translate: 0 4%; } }
.face {
  position: absolute; inset: 0; background: #fff; border-radius: 18%;
  display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 14%;
  box-shadow: inset 0 0 0 1px #ddd, inset 0 -.8cqw 1.4cqw rgba(0, 0, 0, .12);
  backface-visibility: hidden;
}
.face i { width: 74%; height: 74%; place-self: center; border-radius: 50%; background: #1a1a1a; visibility: hidden; }
.face i.on { visibility: visible; }
.face.f1 i.on { background: #d62828; width: 90%; height: 90%; }
.f1 { transform: translateZ(calc(var(--s) / 2)); }
.f6 { transform: rotateY(180deg) translateZ(calc(var(--s) / 2)); }
.f2 { transform: rotateY(90deg) translateZ(calc(var(--s) / 2)); }
.f5 { transform: rotateY(-90deg) translateZ(calc(var(--s) / 2)); }
.f3 { transform: rotateX(90deg) translateZ(calc(var(--s) / 2)); }
.f4 { transform: rotateX(-90deg) translateZ(calc(var(--s) / 2)); }
.roll-sum {
  font-weight: 900; font-size: max(14px, 4cqw); min-height: 1.2em; color: var(--ink); opacity: 0; transition: opacity .2s;
}
.roll-sum.show { opacity: 1; animation: pop .3s cubic-bezier(.2, 1.4, .4, 1); }
.roll-sum .dbl { color: #d62828; }

.c-act { display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(100%, 360px); }
.c-act .btn { font-size: 1em; }
.c-act .btn.big { font-size: 1.1em; }
.note { font-size: .95em; color: #273028; font-weight: 500; }
.warn { background: #fee2e2; color: #991b1b; border-radius: 10px; padding: 6px 12px; font-weight: 700; font-size: .9em; }
.game-card {
  background: #fff; border-radius: 12px; padding: 10px 14px; width: min(100%, 300px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18); border-top: 6px solid var(--g, #e2572b);
  animation: pop .35s cubic-bezier(.2, 1.4, .4, 1);
}
.game-card small { display: block; font-weight: 900; color: var(--g, #e2572b); margin-bottom: 2px; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
.winner { font-size: 1.6em; font-weight: 900; }
.buy-card { background: #fff; border-radius: 12px; overflow: hidden; width: min(100%, 240px); box-shadow: 0 6px 18px rgba(0, 0, 0, .18); cursor: pointer; animation: pop .3s cubic-bezier(.2, 1.4, .4, 1); }
.bc-h { background: var(--g); color: #fff; padding: 8px; font-weight: 900; font-size: 1.15em; text-shadow: 0 1px 2px rgba(0, 0, 0, .4); }
.bc-h.light { color: #111; text-shadow: none; }
.bc-b { padding: 6px 10px; font-size: .9em; color: #333; }
.bc-b u { color: var(--primary-d); }

/* mini deed card */
.deed { background: #fff; color: var(--ink); border-radius: 10px; overflow: hidden; width: min(100%, 260px); box-shadow: 0 6px 18px rgba(0, 0, 0, .18); }
.deed-h { background: var(--g); color: #fff; padding: 8px; font-weight: 900; text-shadow: 0 1px 2px rgba(0, 0, 0, .4); }
.deed-h.light { color: #111; text-shadow: none; }
.deed-b { padding: 6px 12px 10px; font-size: .9em; }
.deed table { width: 100%; border-collapse: collapse; }
.deed td { padding: 2px 0; }
.deed td:last-child { text-align: left; font-weight: 700; }
.deed hr { border: 0; border-top: 1px solid #e5e5e5; margin: 6px 0; }

/* ---------- side panels ---------- */
.flash-up { animation: flashUp 1s; }
.flash-down { animation: flashDown 1s; }
@keyframes flashUp { 0%, 40% { background: rgba(34, 197, 94, .45); } }
@keyframes flashDown { 0%, 40% { background: rgba(239, 68, 68, .45); } }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  --g: #999; border: 0; cursor: pointer; font-size: 12px; font-weight: 700;
  padding: 5px 10px 5px 8px; border-radius: 8px; background: var(--panel-2);
  border-inline-start: 5px solid var(--g); display: inline-flex; gap: 4px; align-items: center;
}
.chip:hover { background: var(--line); }
.chip.mort { opacity: .5; text-decoration: line-through; }
.empty { color: var(--muted); font-size: 13px; }

.trade { background: var(--panel-2); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.trade + .trade { margin-top: 8px; }
.trade-h { font-weight: 700; font-size: 14px; }
.trade-b { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-size: 13px; }
.trade-b small { color: var(--muted); display: block; margin-bottom: 4px; }

.log { flex: 1; min-height: 200px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; font-size: 13px; padding-inline-end: 4px; }
.log .e { color: var(--muted); line-height: 1.5; }
.log .e.chat { color: var(--text); background: var(--panel-2); padding: 4px 8px; border-radius: 8px; }
.log .e.chat b { color: var(--c); }
.chat { display: flex; gap: 8px; margin-top: 10px; }
.chat input { padding: 8px 12px; font-size: 14px; }

/* ---------- modal: bottom sheet on mobile ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50; background: rgba(8, 6, 16, .65); backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center; animation: fade .15s;
}
@keyframes fade { from { opacity: 0; } }
.modal-card {
  width: 100%; max-height: 88dvh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-bottom: 0; border-radius: 24px 24px 0 0;
  padding: 12px 18px calc(20px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 14px; animation: sheet .28s cubic-bezier(.2, .9, .3, 1);
}
.modal-card::before { content: ''; width: 40px; height: 5px; border-radius: 9px; background: var(--line); align-self: center; flex: none; }
@keyframes sheet { from { transform: translateY(100%); } }
@media (min-width: 640px) {
  .modal { align-items: center; padding: 16px; }
  .modal-card { width: min(460px, 100%); border-radius: 22px; border-bottom: 1px solid var(--line); padding: 20px; max-height: calc(100dvh - 32px); animation: pop .25s cubic-bezier(.2, 1.3, .4, 1); }
  .modal-card::before { display: none; }
}
.modal-card h3 { margin: 0; font-size: 20px; }
.modal-card h4 { margin: 0 0 8px; font-size: 14px; color: var(--muted); }
.m-head { display: flex; align-items: center; gap: 12px; }
.m-head h3 { flex: 1; }
.modal .deed { width: 100%; }
.host-box { background: var(--bg); border: 1px dashed var(--gold); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.inline-form { display: flex; gap: 8px; }
.kv-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.kv { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.kv b { color: var(--text); }
.kv .tok { width: 22px; height: 22px; font-size: 11px; }
.money-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.inline-form input, .inline-form select { flex: 1; padding: 8px 12px !important; }
.trade-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tcol { background: var(--bg); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.tcol label.pick { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.tcol label.pick input { accent-color: var(--primary); }
.tcol label.pick.disabled { opacity: .4; cursor: not-allowed; }
.tcol .sw { width: 10px; height: 10px; border-radius: 3px; background: var(--g); flex: none; }
.tcol .money-in { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.tcol .money-in input { padding: 6px 10px; font-size: 14px; }
.auc-bid { font-size: 18px; font-weight: 700; text-align: center; }
.auc-timer { text-align: center; font-size: 13px; color: var(--muted); }
.auc-timer b { color: var(--gold); font-size: 18px; }
@media (max-width: 480px) {
  .trade-cols { grid-template-columns: 1fr; }
  .pin input, .pin span { width: 56px; height: 66px; font-size: 28px; }
}

/* ---------- toasts / conn ---------- */
.toasts { position: fixed; top: calc(env(safe-area-inset-top) + 56px); left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: calc(100% - 32px); }
.toast {
  background: #fff; color: var(--ink); padding: 10px 16px; border-radius: 12px; font-weight: 700; font-size: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35); animation: pop .25s; max-width: 420px; text-align: center;
}
.toast.err { background: #fee2e2; color: #991b1b; }
.conn { position: fixed; top: 0; inset-inline: 0; z-index: 200; background: var(--danger); color: #fff; text-align: center; padding: 6px; font-weight: 700; font-size: 14px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}

/* ---------- sound ---------- */
.snd-fab { position: fixed; top: calc(env(safe-area-inset-top) + 12px); inset-inline-end: 12px; z-index: 40; }
.ib.muted { opacity: .6; }
.snd-rows { display: flex; flex-direction: column; gap: 14px; }
.snd-row { display: grid; grid-template-columns: 24px 1fr 44px; align-items: center; gap: 10px; font-size: 14px; }
.snd-row .lbl { grid-column: 1 / -1; display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; margin-bottom: -8px; }
.snd-row .val { text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.snd-row input[type=range] { width: 100%; accent-color: var(--primary); height: 28px; cursor: pointer; }
.snd-row.off { opacity: .45; }
.snd-mute { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--bg); border-radius: 14px; padding: 12px 14px; font-weight: 700; }
.switch { position: relative; width: 50px; height: 30px; border-radius: 99px; border: 0; cursor: pointer; background: var(--line); transition: background .15s; flex: none; }
.switch::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .18s cubic-bezier(.3, 1.4, .5, 1); }
.switch.on { background: var(--green); }
.switch.on::after { transform: translateX(-20px); }
[dir=ltr] .switch.on::after { transform: translateX(20px); }
