:root {
  --bg: #eee8f3;
  --bg-2: #dcd2e6;
  --panel: #fcfaff;
  --panel-2: #f1ebf7;
  --ink: #21142e;
  --ink-soft: #6f5f80;
  --line: #ddd2e8;
  --wine: #9c1d34;
  --gold: #c9a24a;
  --gold-soft: #f3dc96;
  --moon: #f6e7a6;
  --shadow: 0 4px 14px rgba(40, 15, 60, .14);
  --r: 14px;
  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-body: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1d1229; --bg-2: #0e0817; --panel: #2a1c3a; --panel-2: #36254a;
    --ink: #f3ecfa; --ink-soft: #b8a6cc; --line: #46325c; --shadow: 0 4px 16px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1d1229; --bg-2: #0e0817; --panel: #2a1c3a; --panel-2: #36254a;
  --ink: #f3ecfa; --ink-soft: #b8a6cc; --line: #46325c; --shadow: 0 4px 16px rgba(0, 0, 0, .5);
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
html { scroll-padding-top: env(safe-area-inset-top, 0px); }
body {
  background:
    radial-gradient(40% 22% at 88% 4%, color-mix(in srgb, var(--moon) 30%, transparent), transparent 70%),
    radial-gradient(70% 30% at 0% 100%, color-mix(in srgb, var(--wine) 18%, transparent), transparent 70%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%) fixed;
  background-color: var(--bg);
  color: var(--ink);
  font: 15px/1.45 var(--font-body);
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
#app { min-height: 100%; max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; }
.por { display: block; }
.cat svg, .por svg { width: 100%; height: 100%; display: block; }

/* ---------- Trang chủ, sảnh ---------- */
.home, .lobby { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 24px 22px; gap: 14px; position: relative; }
.lobby { justify-content: flex-start; }
.moon { position: absolute; top: 18px; right: 22px; width: 64px; height: 64px; border-radius: 50%; background: var(--moon); box-shadow: 0 0 40px color-mix(in srgb, var(--moon) 70%, transparent); }
.moon::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--bg); transform: translate(18px, -8px); }
.party { display: flex; align-items: flex-end; height: 128px; }
.party .por { width: 70px; height: 92px; margin-right: -8px; }
.party .por:nth-child(3) { width: 92px; height: 120px; z-index: 1; }
.logo { font: 700 58px/0.9 var(--font-display); margin: 0; letter-spacing: -.5px; }
.logo span { display: block; font-size: 30px; color: var(--wine); font-style: italic; margin-top: 4px; }
.tagline { font-size: 16px; color: var(--ink-soft); margin: 0 0 4px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; color: var(--ink-soft); font-weight: 500; }
.input { background: var(--panel); border: 2px solid var(--line); border-radius: var(--r); padding: 12px 14px; width: 100%; min-width: 0; }
.input:focus { border-color: var(--gold); outline: none; }
.row { display: flex; gap: 8px; align-items: center; }
.btn { padding: 12px 16px; border-radius: var(--r); font-weight: 600; background: var(--panel); border: 2px solid var(--line); white-space: nowrap; min-height: 46px; }
.btn.primary { background: var(--wine); color: #fff4ea; border-color: transparent; box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--gold) 65%, transparent); }
.btn.gold { background: linear-gradient(160deg, var(--gold-soft), var(--gold)); color: #2a1a00; border-color: transparent; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.hint { color: var(--ink-soft); font-size: 13px; margin: 0; }
.label { font-size: 13px; font-weight: 600; color: var(--ink-soft); margin: 12px 0 6px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--ink-soft); font-size: 13px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.code { font: 700 50px/1 var(--font-display); letter-spacing: 6px; }
.seats { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.seat { display: flex; align-items: center; gap: 12px; background: var(--panel); border-radius: var(--r); padding: 7px 12px; }
.seat .name { flex: 1; font-weight: 600; }
.seat .tag { font-size: 12px; color: var(--ink-soft); }
.seat.empty { background: transparent; border: 2px dashed var(--line); color: var(--ink-soft); padding: 10px 12px; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; }

/* Avatar mèo đeo mặt nạ dạ hội */
.ava { width: 40px; height: 40px; border-radius: 50%; flex: none; background: var(--panel-2); box-shadow: 0 0 0 2.5px var(--pc, var(--gold)); display: grid; place-items: center; overflow: hidden; position: relative; }
.ava .cat { width: 84%; height: 84%; margin-top: 5px; }
.ava .mask { position: absolute; left: 8%; width: 84%; top: 40%; height: auto; }
.ava.rev { background: color-mix(in srgb, var(--pc, var(--gold)) 35%, var(--panel-2)); }
.ava.rev .por { width: 100%; height: 125%; margin-top: 18%; }
.ava.seen { box-shadow: 0 0 0 2.5px var(--pc), 0 0 0 5px color-mix(in srgb, var(--gold) 60%, transparent); }
.ava.mysa { background: linear-gradient(160deg, #3a2550, #1d1229); color: var(--moon); font: 700 24px var(--font-display); box-shadow: 0 0 0 2.5px var(--gold); }

/* ---------- Trong ván ---------- */
.game { flex: 1; display: flex; flex-direction: column; gap: 10px; padding: 10px 10px 14px; }
.topbar { display: flex; align-items: center; justify-content: space-between; }
.topbar h1 { font: 700 30px/1 var(--font-display); margin: 0; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; background: var(--panel); box-shadow: var(--shadow); font-size: 17px; font-weight: 700; }
.guests { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.guest { background: var(--panel); border-radius: var(--r); padding: 8px 4px 7px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; border: 2px solid transparent; position: relative; min-width: 0; }
.guest.turn { border-color: var(--pc); box-shadow: 0 0 0 4px color-mix(in srgb, var(--pc) 22%, transparent); }
.guest.busy::after { content: "…"; position: absolute; top: 2px; right: 6px; font-weight: 800; color: var(--gold); }
.guest.mys { background: linear-gradient(170deg, color-mix(in srgb, var(--gold) 16%, var(--panel)), var(--panel)); }
.guest .gn { font-weight: 600; font-size: 12.5px; line-height: 1.2; overflow-wrap: anywhere; }
.guest .known { font-size: 11px; font-weight: 700; color: var(--wine); line-height: 1.2; }
.guest .poss { font-size: 10.5px; color: var(--ink-soft); line-height: 1.2; }
.guest .tagr { position: absolute; top: -6px; left: 50%; transform: translateX(-50%); background: var(--wine); color: #fff; font-size: 9.5px; font-weight: 700; padding: 0 6px; border-radius: 999px; white-space: nowrap; }

.event { background: var(--panel); border-radius: 18px; padding: 12px 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; position: relative; overflow: hidden; border: 1.5px solid color-mix(in srgb, var(--gold) 40%, transparent); }
.event .ev { display: flex; flex-direction: column; gap: 2px; }
.event .ev b { font-size: 15px; }
.event .ev span { font-size: 13px; color: var(--ink-soft); }
.event .answer { font: 700 40px/1.1 var(--font-display) !important; }
.event .answer.yes { color: #1f8a4c !important; }
.event .answer.no { color: var(--wine) !important; }
.event .btns { display: flex; gap: 6px; flex-wrap: wrap; }
.event .btns .btn { flex: 1; min-height: 44px; padding: 8px 10px; font-size: 14px; }
.event .timer { position: absolute; left: 0; bottom: 0; height: 4px; background: var(--gold); transition: width .5s linear; }
.event .recent { font-size: 12px; color: var(--ink-soft); border-top: 1px dashed var(--line); padding-top: 6px; display: flex; flex-direction: column; gap: 2px; }
.whisper { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink-soft); flex-wrap: wrap; }
.whisper i { width: 16px; height: 22px; border-radius: 4px; display: inline-block; }
.whisper i.y { background: #2f9a5a; }
.whisper i.n { background: var(--wine); }

.mine { display: flex; gap: 10px; align-items: center; background: linear-gradient(160deg, color-mix(in srgb, var(--pc) 22%, var(--panel)), var(--panel)); border-radius: 18px; padding: 8px 12px 8px 6px; box-shadow: var(--shadow); border: 1.5px solid color-mix(in srgb, var(--gold) 45%, transparent); }
.mine .por { width: 74px; height: 96px; flex: none; }
.mine .mt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mine small { color: var(--ink-soft); font-size: 12px; }
.mine b { font: 700 24px/1 var(--font-display); }
.mine span { font-size: 12.5px; line-height: 1.35; }

.acts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.act { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 9px 4px; border-radius: 14px; background: var(--panel); box-shadow: var(--shadow); min-height: 74px; }
.act .ic { font-size: 22px; line-height: 1.1; }
.act b { font-size: 14px; }
.act small { font-size: 11px; color: var(--ink-soft); }
.act.accuse { background: var(--wine); color: #fff4ea; }
.act.accuse small { color: #f3d3d9; }
.act:disabled { opacity: .42; cursor: not-allowed; }

/* ---------- Bảng trượt ---------- */
.scrim { position: fixed; inset: 0; background: rgba(15, 5, 25, .55); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--panel); width: 100%; max-width: 560px; border-radius: 22px 22px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px)); max-height: 88vh; overflow: auto; }
.sheet.anim { animation: up .2s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sheet.anim { animation: none; } .event .timer { transition: none; } }
.sheet h2 { font: 700 26px/1.15 var(--font-display); margin: 0 0 4px; }
.sheet .sub { color: var(--ink-soft); font-size: 13px; margin: 0 0 12px; }
.opt { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 12px; border-radius: 12px; background: var(--panel-2); margin-bottom: 7px; text-align: left; border: 2px solid transparent; }
.opt.on { border-color: var(--gold); }
.opt .t { flex: 1; min-width: 0; }
.opt .t b { display: block; }
.opt .t small { color: var(--ink-soft); font-size: 12px; }
.opt .pick { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; }
.opt .pick .por { width: 28px; height: 36px; }
.opt .pick.none { color: var(--ink-soft); font-weight: 500; }
.rgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 8px; }
.rc { background: var(--panel-2); border-radius: 12px; padding: 6px 4px 8px; display: flex; flex-direction: column; align-items: center; gap: 2px; border: 2px solid transparent; }
.rc .por { width: 62px; height: 80px; }
.rc b { font-size: 12.5px; }
.rc.on { border-color: var(--gold); }
.rc.used { opacity: .55; }
.rules { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.rule { display: flex; gap: 10px; align-items: center; background: var(--panel-2); border-radius: 12px; padding: 8px; }
.rule .por { width: 46px; height: 60px; flex: none; }
.rule .ic { width: 46px; flex: none; font-size: 26px; text-align: center; }
.rule b { display: block; font-family: var(--font-display); font-size: 19px; }
.rule small { font-size: 12.5px; color: var(--ink-soft); line-height: 1.35; display: block; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--panel-2); border-radius: 999px; padding: 4px 10px; font-size: 13px; font-weight: 600; }
.log { list-style: none; padding: 0; margin: 0 0 12px; font-size: 13px; }
.log li { padding: 5px 0; border-bottom: 1px solid var(--line); }
.toast { position: fixed; left: 50%; top: calc(14px + env(safe-area-inset-top, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--panel); padding: 10px 16px; border-radius: 999px; font-size: 14px; z-index: 40; box-shadow: var(--shadow); max-width: 90vw; text-align: center; }
.win { text-align: center; }
.win > .por { width: 110px; height: 143px; margin: 0 auto; }
.rank { list-style: none; padding: 0; margin: 12px 0; text-align: left; }
.rank li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.rank li b { margin-left: auto; font-family: var(--font-display); font-size: 17px; }

/* ---------- Bàn tiệc tròn ---------- */
.table-wrap { display: flex; flex-direction: column; gap: 4px; }
.tablebox { position: relative; width: 100%; max-width: 420px; aspect-ratio: 1 / 1; margin: 0 auto; }
.tabletop { position: absolute; left: 21%; top: 21%; width: 58%; height: 58%; border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #6e1f33 0%, #4a1022 60%, #2c0814 100%);
  box-shadow: inset 0 0 0 5px #8a6a2a, inset 0 0 0 7px #2c0814, 0 10px 30px rgba(0,0,0,.35), 0 0 60px color-mix(in srgb, var(--moon) 14%, transparent); color: color-mix(in srgb, var(--gold) 80%, transparent); }
.tabletop::before { content: ""; position: absolute; inset: 14%; border-radius: 50%; border: 1.5px dashed color-mix(in srgb, var(--gold) 45%, transparent); }
.tabletop .dir { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .65; }
.candle { position: absolute; width: 6px; height: 16px; border-radius: 2px; background: #f3ead2; box-shadow: 0 0 12px 4px rgba(255, 200, 90, .35); }
.candle::before { content: ""; position: absolute; left: 50%; top: -9px; width: 6px; height: 9px; transform: translateX(-50%); border-radius: 50% 50% 50% 50% / 70% 70% 30% 30%; background: radial-gradient(circle at 50% 70%, #fff6c2, #ffb23e 60%, transparent 70%); }
.candle.c1 { left: 22%; top: 30%; }
.candle.c2 { right: 22%; top: 30%; }
@media (prefers-reduced-motion: no-preference) { .candle::before { animation: flick 1.6s ease-in-out infinite alternate; } }
@keyframes flick { to { transform: translateX(-50%) scale(.85, 1.1); opacity: .85; } }
.board-center { position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 2px; color: #fbeef2; text-align: center; width: 34%; }
.board-center .ava { width: 52px; height: 52px; }
.board-center b { font: 700 17px/1.1 var(--font-display); }
.board-center span:last-child { font-size: 11px; color: #e6c9d2; }
.seatc { position: absolute; transform: translate(-50%, -50%); width: 24%; display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; padding: 5px 2px 4px; border-radius: 14px; background: color-mix(in srgb, var(--panel) 92%, transparent); box-shadow: var(--shadow); border: 2px solid transparent; }
.seatc .ava { width: 42px; height: 42px; }
.seatc .gn { font-weight: 600; font-size: 12px; line-height: 1.15; overflow-wrap: anywhere; }
.seatc .known { font-size: 10.5px; font-weight: 700; color: var(--wine); line-height: 1.15; }
.seatc .poss { font-size: 10px; color: var(--ink-soft); line-height: 1.15; }
.seatc.me { background: linear-gradient(160deg, color-mix(in srgb, var(--pc) 28%, var(--panel)), var(--panel)); border-color: color-mix(in srgb, var(--gold) 55%, transparent); }
.seatc.turn { border-color: var(--pc); box-shadow: 0 0 0 4px color-mix(in srgb, var(--pc) 25%, transparent), var(--shadow); }
.seatc.nb { border-color: #5aa35a; border-style: dashed; }
.seatc.busy::after { content: "…"; position: absolute; top: 0; right: 7px; font-weight: 800; color: var(--gold); }
.seatc .tagr, .seatc .tagn { position: absolute; top: -8px; left: 50%; transform: translateX(-50%); color: #fff; font-size: 9px; font-weight: 700; padding: 0 6px; border-radius: 999px; white-space: nowrap; }
.seatc .tagr { background: var(--wine); }
.seatc .tagn { background: #3f8a3f; top: auto; bottom: -8px; }
.seatc .turnmark { position: absolute; left: 5px; top: 3px; color: var(--pc); font-size: 10px; }
.hint.center { text-align: center; font-size: 11.5px; }
.mine .por { width: 60px; height: 78px; }
@media (max-width: 360px) { .seatc .ava { width: 34px; height: 34px; } .seatc .gn { font-size: 11px; } }

/* Gắn vào boardgame.oneclickaz.com: tên biến màu mà chat/mic/âm thanh dùng chung (social.css) cần */
:root { --sun: var(--gold); --sun-ink: #2a1d00; --danger: var(--wine); --r-sm: 10px; --r-lg: 18px; }
.home .back { color: var(--ink-soft); font-size: 14px; text-decoration: none; align-self: flex-start; }
.lobby, .game { padding-bottom: 76px; }   /* chừa chỗ cho nút chat/mic ở góc dưới */
.topbar .row { gap: 6px; }
/* online: nút chat/mic nằm góc phải dưới → hàng nút hành động chừa chỗ bên phải */
.acts.docked { margin-right: 98px; }
.acts.docked .act small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
