:root {
  --S: 800px;
  --C: calc(var(--S) * 0.13);
  --E: calc((var(--S) - 16px - 2 * var(--C)) / 9); /* 16px = 10 khe 1px + viền 2×3px */
  --fs: calc(var(--S) * 0.0128);
  --bg: #0f3d2e;
  --bg2: #145a42;
  --board: #f4efdc;
  --ink: #1d2320;
  --muted: #6b746f;
  --red: #da251d;
  --gold: #ffcd00;
  --panel: #ffffff;
  --line: #2a2f2c;
  --primary: #da251d;
  --primary-ink: #fff;
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Be Vietnam Pro', system-ui, 'Segoe UI', Roboto, Arial, sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 30% 20%, var(--bg2), var(--bg) 70%);
  background-attachment: fixed;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.red { color: var(--red); }
.green { color: #2e7d32; }
.center { text-align: center; }

/* ---------- Buttons & inputs ---------- */
.btn {
  font: inherit; font-weight: 600; font-size: 14px;
  border: 0; border-radius: 10px; padding: 9px 14px; cursor: pointer;
  background: #eef1ef; color: var(--ink);
  box-shadow: 0 2px 0 rgba(0,0,0,.18);
  transition: transform .08s, filter .15s;
}
.btn:hover:not(:disabled) { filter: brightness(1.05); }
.btn:active:not(:disabled) { transform: translateY(1px); box-shadow: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--primary); color: var(--primary-ink); }
.btn.danger { background: #6d1b1b; color: #fff; }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 1.5px #c8cfcb; }
.btn.big { font-size: 16px; padding: 12px 20px; }
.btn.sm { font-size: 12.5px; padding: 6px 10px; }
.inp {
  font: inherit; font-size: 14px; padding: 8px 10px; border-radius: 8px;
  border: 1.5px solid #c8cfcb; background: #fff; color: var(--ink); min-width: 0;
}

/* ---------- Setup ---------- */
#setup { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px 12px; }
.setup-card {
  width: min(640px, 100%); background: var(--panel); border-radius: 18px; padding: 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.brand { text-align: center; margin-bottom: 8px; }
.brand-sub { font-weight: 800; letter-spacing: .3em; color: var(--muted); font-size: 13px; }
.brand-main {
  font-weight: 900; font-size: 46px; line-height: 1; color: var(--red);
  text-shadow: 3px 3px 0 var(--gold);
}
.brand-tag { color: var(--muted); font-size: 14px; margin-top: 8px; }
.setup-card h3 { margin: 20px 0 10px; font-size: 16px; }
.prow { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.prow .pname-in { flex: 1; }
.tokbtn {
  width: 42px; height: 42px; border-radius: 50%; border: 3px solid var(--pc); background: #fff;
  font-size: 22px; cursor: pointer; flex: none;
}
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.opts label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
.opts label.chk { flex-direction: row; align-items: center; grid-column: 1 / -1; font-weight: 500; }
.setup-btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.setup-btns .btn.big { flex: 1 1 200px; }

/* ---------- Game layout ---------- */
#game { display: flex; gap: 16px; padding: 12px; align-items: flex-start; justify-content: center; min-height: 100%; }
body.narrow #game { flex-direction: column; align-items: center; padding: 6px; gap: 10px; }
#side {
  width: 360px; max-height: calc(100vh - 24px); display: flex; flex-direction: column; gap: 8px;
  background: rgba(255,255,255,.96); border-radius: var(--radius); padding: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.3);
}
body.narrow #side { width: min(var(--S), 100%); max-height: none; }
.side-top { display: flex; justify-content: space-between; align-items: center; }
.side-title { font-weight: 800; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
#side { overflow-y: auto; }
#players { display: flex; flex-direction: column; gap: 6px; flex: none; }

/* Khung quản lý tài sản */
.apanel { border: 1px solid #e3e7e4; border-radius: 14px; padding: 12px; background: #fff; display: flex; flex-direction: column; gap: 8px; flex: none; }
.ap-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 800; font-size: 16px; }
.ap-badge {
  font-size: 12.5px; font-weight: 800; color: var(--pc); padding: 3px 10px; border-radius: 99px;
  background: color-mix(in srgb, var(--pc) 14%, white); max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ap-hint { font-size: 13px; color: var(--muted); line-height: 1.45; }
.pg { display: flex; flex-direction: column; gap: 4px; }
.pg-h { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; color: #4b5550; margin-top: 2px; }
.pg-dot { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.pg-n { margin-left: auto; font-size: 12px; color: #a3aca7; font-weight: 700; }
.pg-n.full { color: #2e7d32; }
.pr-row { display: flex; align-items: center; gap: 6px; background: #f4f6f5; border-radius: 10px; padding: 6px 8px; }
.pr-row.mort { background: #fbeeee; }
.pr-name { flex: 1; min-width: 0; font-weight: 700; font-size: 14px; cursor: pointer; display: flex; flex-direction: column; line-height: 1.2; }
.pr-name small { font-weight: 500; font-size: 11.5px; color: var(--muted); }
.pr-row.mort .pr-name small { color: #c62828; }
.pr-ctl { display: flex; align-items: center; gap: 4px; flex: none; }
.pr-h { min-width: 30px; text-align: center; font-size: 12.5px; font-weight: 800; color: #c77700; }
.ib {
  width: 30px; height: 30px; border-radius: 9px; border: 1.5px solid #dfe5e1; background: #fff; cursor: pointer;
  font: inherit; font-size: 16px; font-weight: 800; color: #2e7d32; display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.ib:hover:not(:disabled) { background: #eef7ef; }
.ib:disabled { opacity: .35; cursor: not-allowed; }
.ib.plus:not(:disabled) { background: #2e7d32; border-color: #2e7d32; color: #fff; }
.ib.lock { margin-left: 4px; font-size: 14px; color: #c77700; }
.ib.lock.on { background: #fdecea; border-color: #f2b8b5; }
.ap-trade { background: #2bb673; color: #fff; font-size: 15px; padding: 11px; border-radius: 12px; }
.ap-trade:disabled { background: #9fdcbd; opacity: 1; }
.pcard {
  border-radius: 10px; padding: 8px 10px; background: #f6f7f6; border-left: 5px solid var(--pc);
  transition: box-shadow .2s, background .2s;
}
.pcard.cur { background: #fff; box-shadow: 0 0 0 2px var(--pc), 0 4px 14px rgba(0,0,0,.12); }
.pcard.bk { opacity: .45; filter: grayscale(1); }
.ph { display: flex; align-items: center; gap: 6px; }
.ptok { font-size: 20px; }
.pname { font-weight: 800; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ptag { font-size: 11px; background: #e4e8e5; border-radius: 6px; padding: 1px 6px; color: var(--muted); }
.pmoney { font-weight: 900; font-variant-numeric: tabular-nums; }
.pmoney.up { animation: flashUp 1s; }
.pmoney.down { animation: flashDown 1s; }
@keyframes flashUp { 0% { color: #1b9e3e; transform: scale(1.2); } 100% { color: inherit; transform: none; } }
@keyframes flashDown { 0% { color: #d32f2f; transform: scale(1.2); } 100% { color: inherit; transform: none; } }
.pprops { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 6px; }
.chip {
  display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 14px; border-radius: 3px;
  font-size: 9px; color: #fff; font-weight: 800; cursor: pointer; vertical-align: middle; margin-right: 4px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.2);
}
.pprops .chip { margin-right: 0; }
.chip.mort { opacity: .35; }
.pstat { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
#log {
  flex: 1; min-height: 120px; max-height: 280px; overflow: auto; font-size: 12.5px; background: #f6f7f6;
  border-radius: 8px; padding: 6px 8px;
}
body.narrow #log { max-height: 220px; }
.log-item { padding: 3px 0; border-bottom: 1px dashed #dde2df; }
.log-item:first-child { font-weight: 700; }

/* ---------- Board ---------- */
#board {
  width: var(--S); height: var(--S);
  display: grid;
  grid-template-columns: var(--C) repeat(9, var(--E)) var(--C);
  grid-template-rows: var(--C) repeat(9, var(--E)) var(--C);
  background: var(--line); gap: 1px; border: 3px solid var(--line); border-radius: 6px;
  box-shadow: 0 18px 50px rgba(0,0,0,.45);
  font-size: var(--fs);
  user-select: none;
}
.tile {
  position: relative; background: var(--board); overflow: hidden; cursor: pointer;
  box-shadow: inset 0 0 0 0 var(--own);
  transition: box-shadow .25s;
}
.tile.owned { box-shadow: inset 0 0 0 calc(var(--S) * 0.0045) var(--own); }
.tile:hover { filter: brightness(1.04); }
.tile.hl { animation: hl 1.4s; }
@keyframes hl { 0%, 60% { background: #fff6b3; } 100% { background: var(--board); } }
.t-in { position: absolute; inset: 0; display: flex; }
.side-bottom .t-in { flex-direction: column; }
.side-top .t-in { flex-direction: column-reverse; }
.side-left .t-in { flex-direction: row-reverse; }
.side-right .t-in { flex-direction: row; }

.band { flex: none; display: flex; align-items: center; justify-content: center; border: 0 solid var(--line); }
.side-bottom .band { height: 20%; border-bottom-width: 1px; }
.side-top .band { height: 20%; border-top-width: 1px; }
.side-left .band { width: 20%; border-left-width: 1px; flex-direction: column; }
.side-right .band { width: 20%; border-right-width: 1px; flex-direction: column; }
.bld { font-size: calc(var(--fs) * 0.85); line-height: 1; letter-spacing: -2px; filter: drop-shadow(0 1px 0 rgba(0,0,0,.4)); }
.side-left .bld, .side-right .bld { writing-mode: vertical-rl; letter-spacing: -3px; }

/* Ảnh có khung cố định cho mọi ô (không phụ thuộc tên dài/ngắn); phần chữ lấp chỗ còn lại */
.txt { flex: 1; min-height: 0; min-width: 0; overflow: hidden; text-align: center; padding: 2px 2px 1px; display: flex; flex-direction: column; justify-content: center; }
.side-left .txt, .side-right .txt { padding: 1px 3px; }
.side-bottom .pic, .side-top .pic { flex: none !important; height: 44%; }
.side-left .pic, .side-right .pic { flex: none !important; width: 42%; }
.nm { font-weight: 800; line-height: 1.05; font-size: calc(var(--fs) * 0.92); text-transform: uppercase; }
.pr { font-weight: 800; color: var(--red); font-size: calc(var(--fs) * 0.9); margin-top: 1px; }
.pic {
  flex: 1; min-height: 0; min-width: 0; position: relative;
  background: linear-gradient(160deg, rgba(255,255,255,.0), rgba(0,0,0,.05));
  background-size: cover; background-position: center;
  display: flex; align-items: center; justify-content: center;
}
.pic .emo { font-size: calc(var(--E) * 0.36); line-height: 1; }
.pic.has-img .emo { display: none; }
.type-chance .pic .emo { font-size: calc(var(--E) * 0.55); color: var(--red); font-weight: 900; }
.type-chance .nm { color: #1565c0; }
.type-chest .nm { color: #2e7d32; }
.type-tax .pr { color: var(--ink); }
.mtag {
  display: none; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-28deg);
  background: rgba(183,28,28,.9); color: #fff; font-weight: 900; font-size: calc(var(--fs) * 0.7);
  padding: 1px 4px; border-radius: 3px; white-space: nowrap; z-index: 2;
}
.tile.mortgaged .t-in { filter: grayscale(.85) opacity(.65); }
.tile.mortgaged .mtag { display: block; }

.corner-in { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 4px; }
.c-icon { font-size: calc(var(--C) * 0.38); line-height: 1.1; }
.c-name { font-weight: 900; font-size: calc(var(--fs) * 1.2); text-transform: uppercase; }
.c-sub { font-size: calc(var(--fs) * 0.8); color: var(--muted); font-weight: 600; }
.type-go .c-name { color: var(--red); }
.type-gotojail .c-name { color: #1b5e20; }
.type-jail { background: linear-gradient(135deg, var(--board) 50%, #ffe0b2 50%); }

/* ---------- Tokens ---------- */
.tokens {
  position: absolute; inset: 0; display: flex; flex-wrap: wrap; align-content: center; justify-content: center;
  gap: 1px; pointer-events: none; z-index: 3; padding: 2px;
}
.tok {
  width: calc(var(--E) * 0.42); height: calc(var(--E) * 0.42); border-radius: 50%;
  background: #fff; border: calc(var(--S) * 0.003) solid var(--pc);
  display: flex; align-items: center; justify-content: center;
  font-size: calc(var(--E) * 0.24); box-shadow: 0 2px 4px rgba(0,0,0,.45);
  transition: transform .12s;
}
.tok.active { transform: scale(1.15); box-shadow: 0 0 0 2px #fff, 0 0 10px 2px var(--pc); z-index: 2; }
.tok.jailed { background: repeating-linear-gradient(90deg, #fff 0 4px, #cfd8dc 4px 6px); }

/* ---------- Center ---------- */
#center {
  grid-row: 2 / 11; grid-column: 2 / 11;
  background:
    radial-gradient(circle at 50% 38%, rgba(255,205,0,.18), transparent 55%),
    linear-gradient(160deg, #e8f3e2, #cfe6c7);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: calc(var(--S) * 0.014); position: relative; padding: 8px;
}
.logo { text-align: center; position: relative; transform: rotate(-4deg); }
.logo-sub { font-weight: 800; letter-spacing: .35em; font-size: calc(var(--S) * 0.016); color: #335a43; }
.logo-main {
  font-weight: 900; font-size: calc(var(--S) * 0.075); line-height: 1; color: #fff;
  background: var(--red); padding: calc(var(--S) * 0.01) calc(var(--S) * 0.035); border-radius: calc(var(--S) * 0.05);
  box-shadow: 0 calc(var(--S) * 0.007) 0 #8e130e, 0 10px 24px rgba(0,0,0,.25);
  text-shadow: 2px 2px 0 rgba(0,0,0,.2);
}
.logo-star {
  position: absolute; right: calc(var(--S) * -0.03); top: calc(var(--S) * -0.012);
  color: var(--gold); font-size: calc(var(--S) * 0.05); text-shadow: 0 2px 0 #a07d00; transform: rotate(12deg);
}
.turn-info {
  font-size: calc(var(--S) * 0.018); background: rgba(255,255,255,.85); padding: 4px 12px; border-radius: 99px;
  display: flex; align-items: center; gap: 6px; max-width: 95%; text-align: center;
}
.turn-info .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
/* ---------- Xúc xắc ---------- */
.dice-row { display: flex; gap: calc(var(--S) * 0.03); padding-top: calc(var(--S) * 0.01); }
.die {
  --d: calc(var(--S) * 0.088);
  width: var(--d); height: var(--d); border-radius: 22%;
  display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 10%;
  background: radial-gradient(circle at 30% 25%, #ffffff 0%, #f7f7f2 45%, #e3e3da 100%);
  box-shadow:
    inset 0 calc(var(--d) * -0.06) 0 rgba(0,0,0,.10),
    inset 0 calc(var(--d) * 0.04) 0 rgba(255,255,255,.9),
    0 0 0 1px rgba(0,0,0,.12),
    0 calc(var(--d) * 0.12) calc(var(--d) * 0.16) rgba(0,0,0,.28);
  will-change: transform;
}
.die i { display: block; margin: 9%; border-radius: 50%; }
.die i.on {
  background: radial-gradient(circle at 38% 32%, #4a4a4a 0%, #111 55%, #000 100%);
  box-shadow: inset 0 calc(var(--d) * 0.02) calc(var(--d) * 0.02) rgba(0,0,0,.6), 0 1px 0 rgba(255,255,255,.8);
}
/* Mặt 1 chấm: chấm đỏ to như xúc xắc truyền thống */
.die.face-1 i.on { margin: -8%; background: radial-gradient(circle at 38% 32%, #ff6b5e 0%, #d32f2f 55%, #8e0000 100%); }
.die.tumbling { animation: tumble var(--roll-dur, 700ms) cubic-bezier(.2,.6,.35,1) both; }
.die.tumbling:nth-child(2) { animation-name: tumble2; }
.die.tumbling i.on { filter: blur(.6px); }
.die.landed { animation: land .32s ease-out; }
@keyframes tumble {
  0%   { transform: translate(0, 0) rotate(0) scale(1); }
  25%  { transform: translate(calc(var(--d) * -.25), calc(var(--d) * -.75)) rotate(-200deg) scale(1.12); }
  50%  { transform: translate(calc(var(--d) * .1), calc(var(--d) * -.15)) rotate(-400deg) scale(1.02); }
  70%  { transform: translate(0, calc(var(--d) * -.35)) rotate(-560deg) scale(1.06); }
  100% { transform: translate(0, 0) rotate(-720deg) scale(1); }
}
@keyframes tumble2 {
  0%   { transform: translate(0, 0) rotate(0) scale(1); }
  25%  { transform: translate(calc(var(--d) * .25), calc(var(--d) * -.85)) rotate(220deg) scale(1.12); }
  50%  { transform: translate(calc(var(--d) * -.1), calc(var(--d) * -.1)) rotate(430deg) scale(1.02); }
  70%  { transform: translate(0, calc(var(--d) * -.3)) rotate(590deg) scale(1.06); }
  100% { transform: translate(0, 0) rotate(720deg) scale(1); }
}
@keyframes land {
  0% { transform: scale(1.18, .82); }
  45% { transform: scale(.94, 1.08); }
  100% { transform: scale(1); }
}
.dice-sum {
  min-height: 1.6em; font-weight: 900; font-size: calc(var(--S) * 0.018); color: #1d2320;
  background: rgba(255,255,255,.85); padding: 2px 12px; border-radius: 99px; opacity: 0; transform: scale(.8);
  transition: opacity .2s, transform .2s;
}
.dice-sum.show { opacity: 1; transform: scale(1); }
.dice-sum.dbl { background: #ffd600; color: #6d4c00; box-shadow: 0 0 0 2px #fff, 0 0 14px #ffd600; }
.controls .btn.big { font-size: calc(var(--S) * 0.022); min-width: calc(var(--S) * 0.3); }
.controls2 { display: flex; gap: 8px; }
.controls2 .btn { font-size: calc(var(--S) * 0.017); }
.decks { display: flex; gap: calc(var(--S) * 0.05); margin-top: calc(var(--S) * 0.01); }
.deck {
  width: calc(var(--S) * 0.2); height: calc(var(--S) * 0.11); font-size: calc(var(--S) * 0.0105);
  border: calc(var(--S) * 0.005) solid #fff; border-radius: 8px; overflow: hidden;
  box-shadow: 3px 3px 0 rgba(0,0,0,.15), 6px 6px 0 rgba(0,0,0,.08), 0 6px 14px rgba(0,0,0,.2);
}
.deck.chance { transform: rotate(-8deg); }
.deck.chest { transform: rotate(8deg); }

/* Mặt sau lá bài (theo mẫu bản giấy) */
.cback {
  width: 100%; height: 100%; position: relative; display: flex; align-items: center; justify-content: flex-start;
  padding-left: 9%; color: #fff; font-weight: 900; overflow: hidden;
}
.cback.chance { background: radial-gradient(circle at 80% 40%, #42a5f5, #1565c0 75%); }
.cback.chest { background: radial-gradient(circle at 80% 40%, #9ccc65, #43a047 75%); }
.cb-tag {
  position: absolute; left: 9%; top: 14%; font-size: 1em; background: #d32f2f; padding: .15em .6em; border-radius: 99px;
  letter-spacing: .06em; border: 1px solid #fff;
}
.cb-name { font-size: 2.6em; letter-spacing: .02em; text-shadow: 0 .12em 0 rgba(0,0,0,.25); margin-top: .5em; }
.cb-q { position: absolute; right: 7%; top: 50%; transform: translateY(-50%) rotate(10deg); font-size: 6em; line-height: 1; color: #ffd600; text-shadow: .05em .05em 0 #b8860b; }
.cback .chest-svg { position: absolute; right: 5%; top: 50%; transform: translateY(-45%); width: 34%; }
.chest-svg { display: block; }
.type-chest .pic .emo { width: 72%; display: flex; justify-content: center; }
.type-chest .pic .chest-svg { width: 100%; max-width: calc(var(--E) * 0.8); }
.side-left.type-chest .pic .chest-svg, .side-right.type-chest .pic .chest-svg { max-width: calc(var(--E) * 0.7); }
.type-chance .pic .emo { font-family: 'Be Vietnam Pro', Arial, sans-serif; text-shadow: .04em .05em 0 rgba(0,0,0,.25); }

/* ---------- Modal ---------- */
.modal-wrap {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center;
  z-index: 50; padding: 12px; animation: fade .15s;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: #fff; border-radius: 16px; padding: 18px; width: min(460px, 100%); max-height: calc(100vh - 24px); overflow: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.4); animation: pop .18s;
}
.modal.wide { width: min(760px, 100%); }
.modal.narrow-m { width: min(380px, 100%); }
@keyframes pop { from { transform: scale(.94); opacity: 0; } }
.modal h2 { margin: 0 0 12px; font-size: 19px; }
.m-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; justify-content: flex-end; }
.m-btns .btn { flex: 1 1 auto; }

/* Deed */
.deed { border: 2px solid var(--line); border-radius: 10px; overflow: hidden; }
.deed-h {
  color: #fff; text-align: center; padding: 12px 10px 16px; text-shadow: 0 1px 2px rgba(0,0,0,.35); position: relative;
  background: linear-gradient(170deg, color-mix(in srgb, var(--dc) 75%, white) 0 35%, var(--dc) 36%);
}
.deed-h::before { content: ''; position: absolute; left: 8px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,.9); box-shadow: 9px -3px 0 -2px rgba(255,255,255,.9); }
.deed-n { font-weight: 900; font-size: 20px; text-transform: uppercase; }
.deed-p { font-weight: 700; }
.deed-t td:first-child { font-weight: 800; font-size: 12.5px; color: #333; }
.deed-t td:first-child small { font-size: 10.5px; }
.deed-t tr.muted-row td { color: var(--muted); font-weight: 600; }
.hs {
  display: inline-block; width: 11px; height: 11px; margin-right: 1px; vertical-align: -1px; background: #1e88e5;
  clip-path: polygon(50% 0, 100% 48%, 84% 48%, 84% 100%, 16% 100%, 16% 48%, 0 48%);
}
.hs.ks { width: 15px; height: 14px; background: #e53935; }
.deed-pic {
  height: 150px; background-size: cover; background-position: center;
  display: flex; align-items: center; justify-content: center; font-size: 64px;
}
.deed-lm { font-size: 13px; padding: 6px 10px; background: #f6f7f6; border-bottom: 1px solid #e3e7e4; }
.deed-cr { font-size: 11px; color: var(--muted); padding: 3px 10px; background: #f6f7f6; border-bottom: 1px solid #e3e7e4; }
.deed-cr a { color: inherit; }
.deed-t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.deed-t td { padding: 3px 10px; }
.deed-t td:last-child { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.deed-t tr.on { background: #fff3c4; }
.deed-t tr.sep td { border-top: 1px solid #ccd3cf; padding-top: 6px; }
.deed-own { padding: 8px 10px; font-size: 13px; background: #fafbfa; border-top: 1px solid #e3e7e4; }

/* Cards */
/* Mặt trước lá bài: viền dày màu bộ bài, nền trắng bo góc (theo mẫu sách luật) */
.flip { perspective: 900px; width: 100%; max-width: 360px; margin: 0 auto; aspect-ratio: 16 / 10; font-size: 10px; }
.flip-in { position: relative; width: 100%; height: 100%; transition: transform .6s cubic-bezier(.3,.7,.3,1.2); transform-style: preserve-3d; }
.flip.flipped .flip-in { transform: rotateY(180deg); }
.flip-back, .flip-front { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 14px; overflow: hidden; box-shadow: 0 8px 22px rgba(0,0,0,.28); }
.flip-back { border: 5px solid #fff; }
.flip-front { transform: rotateY(180deg); }
.gc { width: 100%; height: 100%; padding: 9px 9px 22px; border-radius: 14px; position: relative; }
.gc.chance { background: #1e88e5; }
.gc.chest { background: #7cb342; }
.gc-in {
  width: 100%; height: 100%; background: #fff; border-radius: 10px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; padding: 10px 14px; gap: 3px;
}
.gc-title { font-weight: 900; font-size: 19px; text-transform: uppercase; line-height: 1.15; color: #1d2320; }
.gc-amt { font-weight: 900; font-size: 18px; color: #d32f2f; }
.gc-sub { font-size: 13.5px; font-weight: 700; color: #37474f; line-height: 1.3; }
.gc-ill { font-size: 46px; line-height: 1.1; margin-top: 4px; filter: drop-shadow(0 3px 2px rgba(0,0,0,.2)); }
.gc-tag {
  position: absolute; right: 16px; bottom: 3px; font-size: 9.5px; font-weight: 900; letter-spacing: .1em; color: #fff;
}
.modal.card-m { width: min(420px, 100%); }
.card-pop .flip { max-width: 340px; }
.card-pop {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(340px, 90vw); z-index: 40;
  pointer-events: none; animation: pop .2s; filter: drop-shadow(0 16px 30px rgba(0,0,0,.45));
}
.pop-who { text-align: center; color: #fff; font-weight: 800; margin-bottom: 6px; text-shadow: 0 2px 4px rgba(0,0,0,.6); }

/* Assets */
.a-head, .debt-head { font-size: 14px; margin-bottom: 10px; line-height: 1.5; }
.assets { display: flex; flex-direction: column; gap: 4px; max-height: 50vh; overflow: auto; }
.arow { display: flex; align-items: center; gap: 6px; padding: 5px 6px; background: #f6f7f6; border-radius: 8px; }
.arow.mort { opacity: .7; }
.aname { flex: 1; font-weight: 700; font-size: 14px; }
.abtns { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }

/* Auction */
.auc { display: grid; grid-template-columns: 240px 1fr; gap: 14px; }
.auc .deed-pic { height: 100px; }
.auc-high { font-size: 16px; padding: 8px 10px; background: #fff8d6; border-radius: 8px; margin-bottom: 8px; }
.auc-players { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.ap { padding: 4px 8px; border-radius: 99px; background: #f0f2f1; border: 2px solid var(--pc); font-size: 13px; }
.ap.out { opacity: .35; text-decoration: line-through; }
.ap.now { background: var(--pc); color: #fff; }
.ap.lead::after { content: ' 👑'; }
.auc-turn { margin-bottom: 6px; font-size: 14px; }
.auc-ctrl .row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.auc-ctrl .inp { width: 110px; }
.auc-log { font-size: 12.5px; color: var(--muted); max-height: 120px; overflow: auto; }

/* Trade */
.trade { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tcol h3 { font-size: 14px; margin: 0 0 8px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tcol > div { font-size: 14px; padding: 2px 0; }
.tlist { display: flex; flex-direction: column; gap: 3px; max-height: 260px; overflow: auto; margin-bottom: 8px; }
.titem { display: flex; align-items: center; gap: 4px; font-size: 13.5px; padding: 3px 4px; border-radius: 6px; cursor: pointer; }
.titem:hover { background: #f3f5f4; }
.titem.dis { opacity: .4; cursor: not-allowed; }
.tin { display: flex; align-items: center; gap: 6px; font-size: 13px; margin-top: 6px; flex-wrap: wrap; }
.tin .inp { width: 110px; }

/* Game over & rules */
.winner { font-size: 20px; text-align: center; margin-bottom: 12px; }
.rank { width: 100%; border-collapse: collapse; }
.rank td { padding: 6px 8px; border-bottom: 1px solid #e6eae7; }
.rank td:last-child { text-align: right; font-weight: 800; }
.rules h3 { font-size: 15px; margin: 12px 0 4px; color: var(--red); }
.rules ul { margin: 0; padding-left: 20px; font-size: 14px; line-height: 1.5; }

/* Toast */
#toasts { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast {
  background: rgba(20,24,22,.92); color: #fff; padding: 8px 16px; border-radius: 99px; font-size: 14px; font-weight: 600;
  box-shadow: 0 6px 18px rgba(0,0,0,.3); animation: pop .2s; transition: opacity .4s, transform .4s;
}
.toast.out { opacity: 0; transform: translateY(-8px); }

@media (max-width: 600px) {
  .opts { grid-template-columns: 1fr; }
  .auc, .trade { grid-template-columns: 1fr; }
  .brand-main { font-size: 36px; }
  .controls2 .btn { padding: 5px 8px; }
  .decks { display: none; }
  .nm { font-size: calc(var(--fs) * 0.8); }
}
.gc-line { font-size: 15px; }
.gc-ill .chest-svg { width: 64px; margin: 0 auto; }
.gc-q { color: #e53935; font-weight: 900; font-family: 'Be Vietnam Pro', Arial, sans-serif; font-size: 54px; line-height: 1; }
.cback.chest .cb-name { font-size: 2.2em; }
.cback.chest .chest-svg { width: 28%; right: 4%; }
