:root {
  --ink: #2b1d12;
  --ink-2: #5b4636;
  --paper: #fffaf0;
  --paper-2: #f6ecd9;
  --line: #e3d3b8;
  --red: #c8262f;
  --red-dk: #8f1a21;
  --gold: #f2b01e;
  --gold-dk: #a8740a;
  --jade: #1f8a5b;
  --jade-dk: #13603e;
  --sky: #2f7fdc;
  --shadow: 0 10px 30px rgba(43, 29, 18, 0.25), 0 2px 6px rgba(43, 29, 18, 0.18);
  --radius: 16px;
  --font: "Be Vietnam Pro", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #cfe3ea; font-family: var(--font); color: var(--ink); -webkit-tap-highlight-color: transparent; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--ink-2); opacity: 0.8; font-size: 0.86em; }

#stage { position: fixed; inset: 0; }
#stage canvas { display: block; touch-action: none; }

/* ---------- nút ---------- */
.btn {
  appearance: none; border: 0; cursor: pointer; user-select: none;
  background: var(--paper); color: var(--ink);
  padding: 10px 16px; border-radius: 12px; font-weight: 700; font-size: 15px;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,0.14), 0 1px 0 rgba(255,255,255,0.6) inset, 0 2px 6px rgba(43,29,18,0.15);
  transition: transform .08s, filter .15s, opacity .15s;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(2px); box-shadow: inset 0 -1px 0 rgba(0,0,0,0.14); }
.btn:disabled { opacity: 0.45; pointer-events: none; }
.btn.primary { background: linear-gradient(#e2403f, var(--red)); color: #fff; box-shadow: inset 0 -4px 0 var(--red-dk), 0 4px 12px rgba(200,38,47,0.35); }
.btn.gold { background: linear-gradient(#ffd25a, var(--gold)); color: #3b2600; box-shadow: inset 0 -4px 0 var(--gold-dk), 0 4px 12px rgba(242,176,30,0.35); }
.btn.jade { background: linear-gradient(#2fae75, var(--jade)); color: #fff; box-shadow: inset 0 -4px 0 var(--jade-dk), 0 4px 12px rgba(31,138,91,0.35); }
.btn.ghost { background: transparent; box-shadow: none; border: 2px solid var(--line); }
.btn.small { padding: 6px 11px; font-size: 13px; border-radius: 10px; }
.btn.big { padding: 14px 22px; font-size: 17px; }
.btn .sub { font-weight: 500; opacity: 0.85; font-size: 0.85em; }
.icon-btn {
  appearance: none; border: 0; cursor: pointer; width: 38px; height: 38px; border-radius: 12px;
  background: rgba(255,250,240,0.9); box-shadow: 0 2px 8px rgba(43,29,18,0.2); font-size: 17px; position: relative;
}
.icon-btn.off { opacity: 0.45; }
.dot { position: absolute; top: 5px; right: 5px; width: 9px; height: 9px; border-radius: 50%; background: var(--red); border: 2px solid #fff; }

/* ---------- loading ---------- */
.loading { position: fixed; inset: 0; display: grid; place-content: center; text-align: center; gap: 12px; background: #e9dcc3; z-index: 50; font-weight: 600; transition: opacity .5s; }
.loading-dice { font-size: 54px; animation: spin 1.2s infinite cubic-bezier(.5,0,.5,1); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- lobby ---------- */
.screen { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; overflow-y: auto;
  background: radial-gradient(ellipse at 50% 30%, rgba(255,250,240,0.15), rgba(43,29,18,0.45)); }
.lobby-card {
  width: min(440px, 100%); background: var(--paper); border-radius: 22px; padding: 26px 24px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 14px; position: relative;
  background-image: radial-gradient(rgba(140,100,60,0.06) 1px, transparent 1px); background-size: 6px 6px;
}
.lobby-card.wide { width: min(860px, 100%); }
.logo { text-align: center; }
.logo h1 { margin: 6px 0 4px; font-size: 34px; font-weight: 900; letter-spacing: -0.5px; color: var(--red); }
.logo h1 em { font-style: normal; color: var(--ink); background: var(--gold); padding: 0 8px; border-radius: 8px; font-size: 0.75em; vertical-align: 4px; }
.logo p { margin: 0; color: var(--ink-2); font-size: 14px; }
.logo-dice { width: 56px; height: 56px; margin: 0 auto; background: #fff; border-radius: 14px; box-shadow: inset 0 -5px 0 #ddd, 0 6px 14px rgba(0,0,0,.18); position: relative; transform: rotate(-8deg); }
.logo-dice span { position: absolute; width: 10px; height: 10px; border-radius: 50%; background: var(--ink); }
.logo-dice span:nth-child(1) { top: 10px; left: 10px; } .logo-dice span:nth-child(2) { top: 10px; right: 10px; }
.logo-dice span:nth-child(3) { top: 23px; left: 23px; background: var(--red); }
.logo-dice span:nth-child(4) { bottom: 10px; left: 10px; } .logo-dice span:nth-child(5) { bottom: 10px; right: 10px; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; }
input { border: 2px solid var(--line); background: #fff; border-radius: 12px; padding: 11px 13px; outline: none; font-size: 16px; }
input:focus { border-color: var(--gold); }
.divider { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: 13px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.room-list { display: flex; flex-direction: column; gap: 8px; max-height: 210px; overflow-y: auto; }
.room-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--paper-2); border: 2px solid transparent; cursor: pointer; }
.room-item:hover { border-color: var(--gold); }
.room-item .code { font-weight: 900; letter-spacing: 2px; background: var(--ink); color: var(--paper); padding: 3px 8px; border-radius: 8px; }
.room-item .info { flex: 1; font-size: 14px; }
.room-item.started { opacity: .55; cursor: default; }
.empty { text-align: center; color: var(--ink-2); font-size: 14px; padding: 8px; }
.join-row { display: flex; gap: 8px; }
.join-row input { flex: 1; text-transform: uppercase; letter-spacing: 4px; font-weight: 800; text-align: center; }
.lan-hint { font-size: 12.5px; color: var(--ink-2); text-align: center; }
.lan-hint b { color: var(--ink); }

.room-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.room-code { font-size: 42px; font-weight: 900; letter-spacing: 6px; color: var(--red); line-height: 1; }
.share { display: flex; gap: 12px; align-items: center; background: var(--paper-2); padding: 8px 12px 8px 8px; border-radius: 14px; }
.share img { width: 86px; height: 86px; border-radius: 8px; background: #fff; }
.lan-url { font-weight: 800; font-size: 15px; word-break: break-all; }
.room-body { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.room-body h3 { margin: 4px 0 10px; font-size: 15px; }
.members { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.members li { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 12px; padding: 6px 10px; border: 2px solid var(--line); }
.members li img { width: 36px; height: 36px; object-fit: contain; }
.members li .nm { flex: 1; font-weight: 700; }
.members li .tag { font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 6px; background: var(--gold); }
.members li .tag.off { background: #ccc; }
.members li .swatch { width: 14px; height: 14px; border-radius: 50%; }
.members li button { border: 0; background: none; cursor: pointer; font-size: 16px; opacity: 0.6; }
.piece-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; margin-bottom: 10px; max-height: 236px; overflow-y: auto; padding-right: 2px; }
.piece-opt { border: 2px solid var(--line); background: #fff; border-radius: 12px; padding: 4px 2px 2px; cursor: pointer; text-align: center; font-size: 10.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.piece-opt img { width: 100%; aspect-ratio: 3 / 4; object-fit: contain; display: block; }
.piece-opt.sel { border-color: var(--red); background: #fff3ef; }
.piece-opt.taken { opacity: .3; pointer-events: none; }
.color-pick { display: flex; gap: 8px; margin-bottom: 14px; }
.color-opt { width: 30px; height: 30px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--line); cursor: pointer; }
.color-opt.sel { box-shadow: 0 0 0 3px var(--ink); }
.color-opt.taken { opacity: .25; pointer-events: none; }
.settings { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.settings label { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #fff; padding: 7px 10px; border-radius: 10px; border: 2px solid var(--line); }
.settings select { border: 0; background: var(--paper-2); border-radius: 8px; padding: 4px 6px; font-weight: 700; }
.settings input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--red); }
.settings.readonly { pointer-events: none; opacity: .85; }
.room-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-top: 2px dashed var(--line); padding-top: 14px; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#hud > * { pointer-events: auto; }
#topbar { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; align-items: center; gap: 10px; pointer-events: none; }
#topbar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 8px; background: var(--ink); color: var(--paper); padding: 6px 12px 6px 6px; border-radius: 14px; font-weight: 900; box-shadow: var(--shadow); }
.brand-mark { width: 26px; height: 26px; border-radius: 8px; background: var(--gold); color: var(--ink); display: grid; place-items: center; font-size: 16px; }
.chip { background: rgba(255,250,240,0.92); padding: 7px 12px; border-radius: 12px; font-size: 13px; font-weight: 700; box-shadow: 0 2px 8px rgba(43,29,18,0.18); }
.top-actions { margin-left: auto; display: flex; gap: 6px; }

#players { position: absolute; top: 62px; left: 10px; width: 240px; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.pcard { pointer-events: auto; display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 8px; background: rgba(255,250,240,0.94); border-radius: 14px; padding: 6px 10px 6px 6px; box-shadow: 0 3px 12px rgba(43,29,18,0.18); border-left: 6px solid var(--c); position: relative; transition: transform .25s, box-shadow .25s; cursor: pointer; }
.pcard img { width: 40px; height: 40px; object-fit: contain; }
.pcard .nm { font-weight: 800; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard .sub { font-size: 11.5px; color: var(--ink-2); display: flex; gap: 6px; flex-wrap: wrap; }
.pcard .money { font-weight: 900; font-size: 16px; font-variant-numeric: tabular-nums; }
.pcard.turn { transform: translateX(8px); box-shadow: 0 0 0 3px var(--gold), 0 6px 18px rgba(43,29,18,0.3); }
.pcard.turn::before { content: "▶"; position: absolute; left: -16px; color: var(--gold); text-shadow: 0 1px 2px rgba(0,0,0,.4); font-size: 13px; }
.pcard.me .nm::after { content: " (bạn)"; color: var(--ink-2); font-weight: 600; font-size: 12px; }
.pcard.out { opacity: 0.45; filter: grayscale(1); }
.pcard.offline .nm { opacity: .6; }
.badge { font-size: 10.5px; font-weight: 800; padding: 1px 6px; border-radius: 6px; background: var(--paper-2); }
.badge.red { background: #ffd9d9; color: var(--red-dk); }
.badge.gray { background: #ddd; }

#status { position: absolute; top: 58px; left: 50%; transform: translateX(-50%); background: rgba(43,29,18,0.82); color: var(--paper); padding: 7px 16px; border-radius: 999px; font-weight: 700; font-size: 14px; white-space: nowrap; max-width: calc(100vw - 30px); overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
#status:empty { display: none; }
#ticker { position: absolute; top: 96px; left: 50%; transform: translateX(-50%); background: rgba(255,250,240,0.92); color: var(--ink); padding: 5px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; max-width: min(560px, calc(100vw - 30px)); text-align: center; pointer-events: none; opacity: 0; transition: opacity .4s; box-shadow: 0 2px 8px rgba(43,29,18,.18); }
#ticker.show { opacity: 1; }

#sidepanel { position: absolute; right: 10px; bottom: 10px; width: 300px; height: 300px; background: rgba(255,250,240,0.95); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; }
#sidepanel.collapsed { display: none; }
.tabs { display: flex; border-bottom: 2px solid var(--line); }
.tab { flex: 1; border: 0; background: none; padding: 9px; font-weight: 700; cursor: pointer; color: var(--ink-2); }
.tab.active { color: var(--ink); box-shadow: inset 0 -3px 0 var(--red); }
.scroll { flex: 1; overflow-y: auto; padding: 8px 12px; font-size: 13px; display: flex; flex-direction: column; gap: 5px; }
.scroll .ln { line-height: 1.35; }
.scroll .ln time { color: var(--ink-2); opacity: .6; font-size: 11px; margin-right: 6px; }
.chatmsg b { color: var(--c); }
#chat-form { display: flex; gap: 6px; padding: 8px; border-top: 2px solid var(--line); }
#chat-form input { flex: 1; padding: 7px 10px; font-size: 14px; }

#bottom { position: absolute; left: 10px; right: 10px; bottom: calc(14px + var(--safe-b)); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
#bottom > * { pointer-events: auto; }
#actionbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: center; background: rgba(43,29,18,0.78); padding: 8px; border-radius: 18px; box-shadow: var(--shadow); backdrop-filter: blur(6px); }
#actionbar .wait { color: var(--paper); font-weight: 600; padding: 0 10px; font-size: 14px; }
#emotes { position: absolute; top: 56px; right: 10px; display: flex; gap: 4px; background: rgba(255,250,240,0.95); padding: 6px; border-radius: 999px; box-shadow: var(--shadow); z-index: 2; }
#roominfo .short { display: none; }
#emotes button { border: 0; background: rgba(255,250,240,0.85); width: 34px; height: 34px; border-radius: 50%; font-size: 18px; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.15); transition: transform .1s; }
#emotes button:active { transform: scale(1.25); }
#timerbar { width: 260px; height: 6px; background: rgba(255,250,240,0.6); border-radius: 4px; overflow: hidden; }
#timerbar > div { height: 100%; background: var(--gold); width: 100%; }
#timerbar.low > div { background: var(--red); }

/* chữ nổi trên đầu quân */
#floaters { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.floater { position: absolute; transform: translate(-50%, -100%); font-weight: 900; font-size: 22px; text-shadow: 0 2px 0 #fff, 0 0 8px rgba(255,255,255,.8); animation: rise 1.8s ease-out forwards; white-space: nowrap; }
.floater.neg { color: var(--red); }
.floater.pos { color: var(--jade); }
.floater.emoji { font-size: 38px; text-shadow: none; animation: rise 2.4s ease-out forwards; }
.floater.bubble { font-size: 13px; font-weight: 600; background: #fff; color: var(--ink); padding: 6px 10px; border-radius: 12px; text-shadow: none; box-shadow: 0 3px 10px rgba(0,0,0,.2); animation: rise 4s ease-out forwards; max-width: 220px; white-space: normal; }
@keyframes rise { 0% { opacity: 0; margin-top: 10px; } 12% { opacity: 1; margin-top: 0; } 75% { opacity: 1; } 100% { opacity: 0; margin-top: -60px; } }

/* ---------- modal ---------- */
#modal-root { position: fixed; inset: 0; z-index: 30; pointer-events: none; }
.backdrop { position: absolute; inset: 0; background: rgba(43,29,18,0.35); display: grid; place-items: center; padding: 14px; pointer-events: auto; animation: fade .2s; }
.backdrop.clear { background: transparent; pointer-events: none; }
.backdrop.clear > * { pointer-events: auto; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--paper); border-radius: 20px; box-shadow: var(--shadow); width: min(420px, 100%); max-height: calc(100vh - 28px); overflow-y: auto; padding: 18px; animation: pop .25s cubic-bezier(.3,1.4,.6,1); position: relative; }
.modal.wide { width: min(720px, 100%); }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
.modal h2 { margin: 0 0 12px; font-size: 20px; }
.modal .row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
.modal .close { position: absolute; top: 10px; right: 10px; border: 0; background: var(--paper-2); width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 15px; }

/* thẻ đất */
.deed { border: 3px solid var(--ink); border-radius: 10px; overflow: hidden; background: #fff; }
.deed-head { padding: 12px; text-align: center; color: #fff; font-weight: 900; font-size: 20px; text-transform: uppercase; letter-spacing: .5px; }
.deed-head small { display: block; font-size: 11px; font-weight: 600; opacity: .9; letter-spacing: 1px; }
.deed-head.light { color: var(--ink); }
.deed table { width: 100%; border-collapse: collapse; font-size: 14px; }
.deed td { padding: 5px 14px; }
.deed td:last-child { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.deed tr.cur td { background: #fff3c4; }
.deed .foot { border-top: 1px solid var(--line); padding: 8px 14px; font-size: 13px; display: grid; grid-template-columns: 1fr 1fr; gap: 3px 10px; }
.owner-line { margin-top: 10px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.swatch { width: 14px; height: 14px; border-radius: 50%; display: inline-block; background: var(--c); }

/* danh sách tài sản */
.props { display: flex; flex-direction: column; gap: 10px; }
.pgroup { border-left: 6px solid var(--c); padding-left: 10px; }
.pitem { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 14px; flex-wrap: wrap; }
.pitem .nm { flex: 1; font-weight: 700; min-width: 120px; }
.pitem .nm small { font-weight: 500; color: var(--ink-2); }
.pitem.mort .nm { text-decoration: line-through; opacity: .6; }
.houses { letter-spacing: 1px; }

/* trao đổi */
.trade-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.trade-col { background: var(--paper-2); border-radius: 14px; padding: 10px; }
.trade-col h4 { margin: 0 0 8px; }
.trade-col .tl { display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow-y: auto; margin-bottom: 8px; }
.trade-col label.t { display: flex; gap: 8px; align-items: center; font-size: 13.5px; background: #fff; border-radius: 8px; padding: 5px 8px; border-left: 5px solid var(--c); cursor: pointer; }
.trade-col input[type=number] { width: 100%; padding: 7px 10px; }
.trade-summary { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; }
.trade-summary ul { margin: 0; padding-left: 18px; font-size: 14px; }
.arrow { font-size: 26px; }
select.full { width: 100%; padding: 9px; border-radius: 10px; border: 2px solid var(--line); background: #fff; font-weight: 700; margin-bottom: 12px; }

/* đấu giá */
.auction .big-bid { text-align: center; font-size: 40px; font-weight: 900; color: var(--red); line-height: 1.1; }
.auction .bidder { text-align: center; font-weight: 700; margin-bottom: 10px; }
.auction .bar { height: 8px; background: var(--paper-2); border-radius: 4px; overflow: hidden; margin: 10px 0; }
.auction .bar > div { height: 100%; background: var(--gold); transition: width .25s linear; }
.auction .bids { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.auction .mini-deed { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.auction .mini-deed > span { width: 18px; height: 40px; border-radius: 4px; background: var(--c); flex: none; }

/* thẻ Cơ hội / Khí vận lật 3D */
.card-stage { perspective: 1000px; }
.flip { width: min(320px, 84vw); aspect-ratio: 1.55; position: relative; transform-style: preserve-3d; animation: flip 0.9s cubic-bezier(.3,1.2,.5,1) forwards; }
@keyframes flip { 0% { transform: rotateY(0) translateY(60px) scale(.6); } 40% { transform: rotateY(0) translateY(0) scale(1); } 100% { transform: rotateY(180deg); } }
.face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 18px; box-shadow: var(--shadow); display: grid; place-items: center; text-align: center; padding: 18px; }
.face.front { background: linear-gradient(135deg, #ffb347, #f0832a); color: #fff; font-weight: 900; font-size: 28px; }
.face.front.chest { background: linear-gradient(135deg, #6bb6ff, #2f7fdc); }
.face.front .q { font-size: 70px; line-height: 1; }
.face.back { background: var(--paper); transform: rotateY(180deg); border: 4px solid #f0832a; font-weight: 700; font-size: 17px; line-height: 1.4; }
.face.back.chest { border-color: #2f7fdc; }
.face.back .t { font-size: 12px; letter-spacing: 3px; color: var(--ink-2); margin-bottom: 8px; display: block; }

/* chiến thắng */
.winner { text-align: center; }
.winner .trophy { font-size: 72px; animation: bob 1.5s infinite ease-in-out; }
@keyframes bob { 50% { transform: translateY(-8px) rotate(4deg); } }
.winner ol { text-align: left; }
.chart { width: 100%; height: 150px; }

/* thông báo nhanh */
#toasts { position: fixed; top: 64px; right: 12px; z-index: 40; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; pointer-events: none; }
.toast { background: var(--ink); color: var(--paper); padding: 9px 14px; border-radius: 12px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow); animation: toast 3.2s forwards; max-width: 320px; }
.toast.err { background: var(--red); }
@keyframes toast { 0% { opacity: 0; transform: translateX(20px); } 8% { opacity: 1; transform: none; } 85% { opacity: 1; } 100% { opacity: 0; } }

/* banner lớn giữa màn hình */
.banner { position: fixed; left: 50%; top: 38%; transform: translate(-50%, -50%); z-index: 35; background: var(--ink); color: var(--gold); font-weight: 900; font-size: 30px; padding: 14px 28px; border-radius: 18px; box-shadow: var(--shadow); animation: banner 2.2s forwards; pointer-events: none; text-align: center; }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.6); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); } 25% { transform: translate(-50%, -50%) scale(1); } 85% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- điện thoại ---------- */
@media (max-width: 760px) {
  .brand-text { display: none; }
  #roominfo { white-space: nowrap; padding: 6px 9px; font-size: 12px; }
  #roominfo .long { display: none; }
  #roominfo .short { display: inline; }
  .brand { display: none; }
  #emotes { top: 48px; right: 8px; left: 8px; justify-content: space-between; }
  #topbar { top: 8px; left: 8px; right: 8px; gap: 6px; }
  .icon-btn { width: 34px; height: 34px; font-size: 15px; }
  #players { top: 52px; left: 0; right: 0; width: auto; flex-direction: row; overflow-x: auto; padding: 4px 8px 8px; scrollbar-width: none; }
  #players::-webkit-scrollbar { display: none; }
  .pcard { flex: 0 0 auto; grid-template-columns: 30px auto; grid-template-rows: auto auto; padding: 4px 8px 4px 4px; gap: 0 6px; }
  .pcard img { width: 30px; height: 30px; grid-row: span 2; }
  .pcard .money { font-size: 13px; grid-column: 2; }
  .pcard .sub { display: none; }
  .pcard .nm { font-size: 12px; max-width: 90px; }
  .pcard.turn { transform: translateY(2px); }
  .pcard.turn::before { display: none; }
  .pcard.me .nm::after { content: ""; }
  #status { top: 112px; font-size: 12.5px; padding: 5px 12px; }
  #ticker { top: 146px; font-size: 12px; }
  #sidepanel { left: 8px; right: 8px; width: auto; bottom: calc(150px + var(--safe-b)); height: 42vh; }
  #actionbar .btn { padding: 9px 12px; font-size: 14px; }
  .room-body { grid-template-columns: 1fr; }
  .room-code { font-size: 34px; }
  .lobby-card { padding: 20px 16px; }
  .trade-grid { grid-template-columns: 1fr; }
  .modal { padding: 16px 14px; }
  .floater { font-size: 18px; }
  #toasts { top: 150px; }
}
@media (min-width: 761px) {
  #sidepanel.mobile-only-hidden { display: flex; }
}
.pitem a { color: inherit; text-decoration: underline dotted; text-underline-offset: 3px; }

/* ---------- luật thêm: sảnh, vòng, cược ---------- */
.settings-head { font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--red-dk); margin-top: 6px; }
.settings label > span { display: flex; flex-direction: column; }
.settings label small { font-size: 11.5px; font-weight: 500; opacity: .7; }
#roominfo .hot { color: var(--red); animation: hotpulse 1s ease-in-out infinite alternate; }
@keyframes hotpulse { from { opacity: 1; } to { opacity: .55; } }
.betbox { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; background: rgba(255,250,240,.12); border-radius: 12px; padding: 4px 6px; }
.betbox .lbl { color: var(--paper); font-size: 12.5px; font-weight: 700; }
.betbox.placed { color: var(--paper); font-size: 13px; padding: 6px 10px; }
.betbox .stake { color: var(--paper); border-color: rgba(255,250,240,.5); }

/* ---------- sự kiện, đặc tính, nhiệm vụ ---------- */
.face.front.season { background: linear-gradient(135deg, #e2403f, #b3121f); }
.face.back.season { border-color: #b3121f; }
.perk-line { background: #fff7e0; border: 2px solid #f2d27a; border-radius: 10px; padding: 7px 10px; font-size: 13px; margin: 8px 0; line-height: 1.4; }
.badge.perk { background: #fff1c2; }
.badge.gold { background: #ffe08a; }
#roominfo .season { color: var(--red-dk); }
#btn-mission { position: relative; }
#btn-mission.done::after { content: '✓'; position: absolute; right: -2px; top: -4px; background: var(--jade); color: #fff; border-radius: 50%; width: 16px; height: 16px; font-size: 11px; line-height: 16px; text-align: center; }
.mission { background: linear-gradient(135deg, #2b1d12, #4a3020); color: var(--paper); border-radius: 14px; padding: 16px; margin: 8px 0 10px; text-align: center; }
.mission .mtext { font-size: 19px; font-weight: 800; }
.mission .mreward { margin-top: 6px; color: #ffd25a; font-weight: 700; }
.mission.done { background: linear-gradient(135deg, #1f8a5b, #146a44); }

/* ---------- ngân hàng, thống kê ---------- */
.bank { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0; }
.bank > div { background: #fff; border: 2px solid var(--line); border-radius: 12px; padding: 8px; text-align: center; display: flex; flex-direction: column; gap: 2px; }
.bank b { font-size: 17px; }
.awards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; margin: 12px 0 4px; text-align: left; }
.award { display: flex; gap: 8px; align-items: center; background: #fff; border: 2px solid var(--line); border-radius: 12px; padding: 8px 10px; font-size: 13px; line-height: 1.35; }
.award .ic { font-size: 24px; }
@media (max-width: 600px) {
  .betbox .lbl { flex-basis: 100%; text-align: center; }
  .bank { grid-template-columns: 1fr; }
}
