/* ================= CHỦ ĐỀ ================= */
:root, [data-theme="desert"] {
  --bg: #f5ecd9; --bg-img: radial-gradient(ellipse at 50% -10%, #fffaf0 0%, transparent 60%), radial-gradient(ellipse at 50% 120%, #e9d4a8 0%, transparent 60%);
  --surface: #fbf6ea; --surface2: #ece0c6; --on: #2f2114; --on2: #6b5440; --muted: #8a7560; --line: rgba(47,33,20,.18);
  --wood: #8a5a32; --wood2: #6b4224; --felt1: #f1e2c1; --felt2: #d8c094; --felt-mark: rgba(107,66,36,.13);
  --accent: #d4a63a; --accent-on: #2f2114; --red: #b8322a; --green: #3f8f4f; --blue: #2f6fa8;
  --card: #fbf6ea; --card-ink: #2f2114; --card-art-bg: #c9b48d;
  --shadow-c: 47,33,20; --glow: 212,166,58;
}
[data-theme="night"] {
  --bg: #121a2b; --bg-img: radial-gradient(circle at 96% 6%, rgba(255,246,214,.5) 0 26px, rgba(255,246,214,.08) 27px 80px, transparent 180px), linear-gradient(#0e1424, #1d2a44 70%, #2a3550);
  --surface: #1f2a40; --surface2: #18223a; --on: #eef1f8; --on2: #b9c3d8; --muted: #8592ad; --line: rgba(255,255,255,.12);
  --wood: #3b2a1e; --wood2: #24180f; --felt1: #2d5c5a; --felt2: #1b3d3d; --felt-mark: rgba(255,255,255,.07);
  --accent: #f0c75e; --accent-on: #1a1a1a; --red: #e0524a; --green: #5cc27a; --blue: #6aa8ea;
  --card: #f3ead6; --card-ink: #2a2015; --card-art-bg: #3a4660;
  --shadow-c: 0,0,0; --glow: 240,199,94;
}
[data-theme="saloon"] {
  --bg: #3a1414; --bg-img: repeating-linear-gradient(90deg, rgba(0,0,0,.08) 0 2px, transparent 2px 46px), radial-gradient(ellipse at 50% 0%, rgba(255,190,110,.25), transparent 60%), linear-gradient(#4a1a18, #2a0e0e);
  --surface: #f6ead2; --surface2: #e6d3ad; --on: #2a140e; --on2: #6b3f2a; --muted: #8a6a52; --line: rgba(42,20,14,.2);
  --wood: #4e2a14; --wood2: #2e170a; --felt1: #2f6b3f; --felt2: #1d4a2a; --felt-mark: rgba(255,230,170,.1);
  --accent: #d9a441; --accent-on: #2a140e; --red: #c0392b; --green: #3f8f4f; --blue: #2f6fa8;
  --card: #fbf3e2; --card-ink: #2a140e; --card-art-bg: #6b3f2a;
  --shadow-c: 0,0,0; --glow: 217,164,65;
}
[data-theme="sunset"] {
  --bg: #f2a46b; --bg-img: linear-gradient(180deg, #ffcf8a 0%, #f4a26a 35%, #d9675a 70%, #8e3f52 100%);
  --surface: #fff3e4; --surface2: #f6dcc0; --on: #3a1d14; --on2: #7a4030; --muted: #9a6450; --line: rgba(58,29,20,.18);
  --wood: #7a3a22; --wood2: #4f2214; --felt1: #f6d6a8; --felt2: #e3ad76; --felt-mark: rgba(122,58,34,.15);
  --accent: #ffb43c; --accent-on: #3a1d14; --red: #b5262f; --green: #3f8f4f; --blue: #2f6fa8;
  --card: #fff6ea; --card-ink: #3a1d14; --card-art-bg: #d98a5a;
  --shadow-c: 74,24,20; --glow: 255,180,60;
}
[data-theme="winter"] {
  --bg: #e8eff5; --bg-img: radial-gradient(ellipse at 50% -20%, #ffffff 0%, transparent 60%), linear-gradient(#dfe9f2, #f4f7fa);
  --surface: #ffffff; --surface2: #e6eef5; --on: #1d2a38; --on2: #4a5d70; --muted: #7a8a9a; --line: rgba(29,42,56,.14);
  --wood: #5a4636; --wood2: #3b2c20; --felt1: #f4f7fa; --felt2: #cfdde9; --felt-mark: rgba(29,42,56,.08);
  --accent: #4a90c8; --accent-on: #fff; --red: #c0392b; --green: #2f8a5a; --blue: #2f6fa8;
  --card: #fbfcfd; --card-ink: #1d2a38; --card-art-bg: #c9d6e2;
  --shadow-c: 29,42,56; --glow: 74,144,200;
}
:root { --shadow: 0 4px 14px rgba(var(--shadow-c),.25); --shadow-lg: 0 12px 30px rgba(var(--shadow-c),.38); }

/* ================= CƠ BẢN ================= */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: 'Nunito', system-ui, sans-serif; color: var(--on); background: var(--bg); background-image: var(--bg-img); background-attachment: fixed;
  -webkit-tap-highlight-color: transparent; overflow-x: hidden; transition: background .5s, color .3s; }
#ambient { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.screen { position: relative; z-index: 1; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.screen { display: none; min-height: 100vh; }
.screen.active { display: block; }
.logo { font-family: 'Bevan', 'Rye', serif; font-size: clamp(40px, 12vw, 62px); margin: 0; color: var(--on); letter-spacing: 2px; text-shadow: 3px 3px 0 var(--accent); }
.logo.small { font-size: 22px; text-shadow: 2px 2px 0 var(--accent); }
.btn { font-family: 'Oswald', sans-serif; font-weight: 600; font-size: 16px; letter-spacing: .5px; padding: 9px 18px; border-radius: 10px; border: 2px solid var(--on); background: var(--surface); color: var(--on); cursor: pointer; box-shadow: 0 3px 0 var(--on); transition: transform .06s, box-shadow .06s, filter .15s; }
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--on); }
.btn.primary { background: var(--accent); color: var(--accent-on); }
.btn.danger { background: var(--red); color: #fff; }
.btn.small { padding: 4px 10px; font-size: 14px; }
.btn.ghost { background: transparent; box-shadow: none; border-color: var(--line); }
.btn.icon { padding: 4px 9px; font-size: 16px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
input, select { font-family: inherit; font-size: 16px; padding: 10px 12px; border-radius: 10px; border: 2px solid var(--on); background: var(--surface); color: var(--on); width: 100%; }
label { display: block; font-weight: 700; margin: 12px 0 4px; text-align: left; }

/* ================= HOME / LOBBY ================= */
.home-box, .lobby-box { max-width: 480px; margin: 0 auto; padding: 40px 20px; text-align: center; }
.panel { background: var(--surface); border-radius: 18px; padding: 22px; box-shadow: var(--shadow-lg); }
.tagline { margin: 4px 0 18px; color: var(--on2); font-size: 17px; }
[data-theme="night"] .tagline, [data-theme="saloon"] .tagline { color: #f3e6c8; }
[data-theme="saloon"] .home-box > .logo, [data-theme="saloon"] .lobby-box > h2, [data-theme="night"] .lobby-box > h2 { color: #f6ead2; }
.hero-cards { display: flex; justify-content: center; margin: 4px 0 18px; height: 150px; }
.hero-cards .pcard { --w: 92px; margin: 0 -14px; transform: rotate(var(--r)) translateY(var(--y)); animation: heroin .6s backwards; animation-delay: var(--d); }
@keyframes heroin { from { opacity: 0; transform: translateY(40px) rotate(0); } }
.home-actions { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.join-row { display: flex; gap: 8px; }
.join-row input { text-transform: uppercase; letter-spacing: 3px; font-weight: 800; text-align: center; }
.theme-pick { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.theme-pick button { font-family: 'Oswald'; font-size: 13px; padding: 5px 10px; border-radius: 20px; border: 2px solid var(--line); background: var(--surface2); color: var(--on); cursor: pointer; }
.theme-pick button.on { border-color: var(--accent); background: var(--accent); color: var(--accent-on); }
.rules { margin-top: 18px; text-align: left; background: var(--surface); border-radius: 14px; padding: 10px 16px; box-shadow: var(--shadow); }
.rules summary { cursor: pointer; font-weight: 800; }
.rules h4 { margin: 12px 0 4px; color: var(--red); }
.rules p, .rules li { font-size: 14px; line-height: 1.5; }
.foot { font-size: 12px; color: var(--muted); margin-top: 18px; }
[data-theme="night"] .foot, [data-theme="saloon"] .foot { color: #d8c9a8; }
.code-box { font-size: 18px; margin: 4px 0 16px; }
#lobby-code { font-family: 'Rye', serif; font-size: 34px; color: var(--red); letter-spacing: 4px; }
#lobby-players { list-style: none; padding: 0; margin: 0 0 18px; text-align: left; }
#lobby-players li { display: flex; justify-content: space-between; align-items: center; padding: 9px 14px; margin: 6px 0; background: var(--surface2); border-radius: 10px; font-weight: 700; }
#lobby-players li .off { color: var(--red); font-size: 12px; }
.lobby-actions { display: flex; gap: 10px; justify-content: center; margin-bottom: 14px; }

/* ================= LÁ BÀI ================= */
/* Bố cục: [số/chất + loại] — [tranh] — [tên]. Không gì đè lên tranh. */
.pcard { --w: 100px; width: var(--w); height: calc(var(--w) * 1.42); flex: 0 0 auto; position: relative; border-radius: calc(var(--w) * .08);
  background: var(--card); color: var(--card-ink); box-shadow: var(--shadow), inset 0 0 0 1px rgba(0,0,0,.14);
  display: grid; grid-template-rows: calc(var(--w) * .2) 1fr calc(var(--w) * .26); padding: 0 calc(var(--w) * .06) calc(var(--w) * .04);
  user-select: none; cursor: default; transition: transform .16s cubic-bezier(.2,.8,.3,1), box-shadow .16s, opacity .2s, filter .2s; }
.pcard .ctop { display: flex; align-items: center; justify-content: space-between; gap: 2px; min-width: 0; }
.pcard .idx { font-family: 'Oswald', sans-serif; font-weight: 700; font-size: calc(var(--w) * .15); line-height: 1; white-space: nowrap; }
.pcard .idx.red { color: var(--red); }
.pcard .ktag { font-family: 'Oswald'; font-size: calc(var(--w) * .085); letter-spacing: .4px; text-transform: uppercase; color: #fff; padding: 1px calc(var(--w) * .045); border-radius: 4px; background: #555; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard.brown .ktag { background: #b5651d; } .pcard.blue .ktag { background: #2f6fa8; } .pcard.gun .ktag { background: #4a5057; }
.pcard.role .ktag { background: var(--red); } .pcard.char .ktag { background: #2f2114; }
.pcard .chp { color: var(--red); font-size: calc(var(--w) * .09); letter-spacing: 1px; }
.pcard .art { border-radius: calc(var(--w) * .04); overflow: hidden; background: var(--card-art-bg); box-shadow: inset 0 0 0 1px rgba(0,0,0,.2); min-height: 0; }
.pcard .art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pcard .cname { display: flex; align-items: center; justify-content: center; text-align: center; font-family: 'Bevan', serif; font-size: calc(var(--w) * .12); line-height: 1; padding-top: calc(var(--w) * .02); }
.pcard .cdesc { font-size: 12px; line-height: 1.3; color: var(--card-ink); opacity: .8; text-align: center; padding: 0 4px 6px; }
.pcard.brown, .pcard.blue, .pcard.gun { cursor: pointer; }
.pcard.char, .pcard.role { cursor: pointer; }
.pcard.lg { --w: 190px; } .pcard.lg.char, .pcard.lg.role { height: auto; grid-template-rows: calc(var(--w) * .2) calc(var(--w) * 1.05) calc(var(--w) * .2) auto; }
.pcard.sm { --w: 72px; } .pcard.sm .ktag { display: none; }
.pcard.xs { --w: 30px; grid-template-rows: 1fr; padding: 2px; border-radius: 4px; } .pcard.xs .ctop, .pcard.xs .cname { display: none; } .pcard.xs .art { border-radius: 2px; }
/* trạng thái trên tay */
.hand .pcard { transform: rotate(var(--rot, 0)) translateY(var(--lift, 0)); transform-origin: 50% 120%; margin: 0 var(--overlap, -10px); }
.hand .pcard.playable:hover { transform: rotate(0) translateY(-24px) scale(1.12); box-shadow: var(--shadow-lg); z-index: 5; }
.pcard.disabled { filter: saturate(.3) brightness(.9); opacity: .72; cursor: not-allowed; }
.hand .pcard.selected { transform: rotate(0) translateY(-32px) scale(1.12); box-shadow: 0 0 0 3px var(--accent), var(--shadow-lg); z-index: 6; }
.pcard.respond { box-shadow: 0 0 0 3px var(--green), 0 0 18px var(--green); animation: glow 1.2s infinite; }
.pcard.discardable:hover { box-shadow: 0 0 0 3px var(--red), var(--shadow-lg) !important; }
@keyframes glow { 50% { box-shadow: 0 0 0 3px var(--green), 0 0 30px var(--green); } }
/* mặt sau */
.pcard.back { background: #8f2e22; display: block; padding: 0; }
.pcard.back .back-inner { position: absolute; inset: calc(var(--w) * .07); border: 2px solid rgba(251,246,234,.8); border-radius: calc(var(--w) * .05);
  background: repeating-linear-gradient(45deg, rgba(255,255,255,.06) 0 6px, transparent 6px 12px), radial-gradient(circle, #a8392b, #6e2018); display: flex; align-items: center; justify-content: center; }
.pcard.back span { font-family: 'Bevan', 'Rye', serif; color: #fbf6ea; font-size: calc(var(--w) * .13); white-space: nowrap; text-align: center; transform: rotate(-12deg); text-shadow: 0 2px 0 rgba(0,0,0,.4); }

/* ================= BÀN CHƠI ================= */
#screen-game { display: none; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }
#screen-game.active { display: flex; }
.topbar { display: flex; align-items: center; gap: 8px; padding: 6px 12px; font-size: 15px; background: var(--surface); color: var(--on); box-shadow: 0 1px 0 var(--line); z-index: 5; }
#turn-info { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar select { width: auto; padding: 3px 6px; font-size: 13px; border-width: 1px; }
.vol { width: 70px; accent-color: var(--accent); }

.table-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 30px 90px 6px; min-height: 0; }
.table { position: relative; width: 100%; max-width: 1080px; height: 100%; max-height: 580px; }
.felt { position: absolute; inset: 11% 9%; border-radius: 50%;
  background: radial-gradient(ellipse at 50% 40%, var(--felt1) 0%, var(--felt2) 100%);
  box-shadow: 0 0 0 14px var(--wood), 0 0 0 17px var(--wood2), 0 18px 40px rgba(var(--shadow-c),.4), inset 0 0 50px rgba(0,0,0,.18); transition: background .5s; }
.felt::before { content: ''; position: absolute; inset: -14px; border-radius: 50%; background: repeating-linear-gradient(100deg, rgba(255,255,255,.05) 0 3px, transparent 3px 9px); pointer-events: none; mask: radial-gradient(farthest-side, transparent calc(100% - 14px), #000 calc(100% - 14px)); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 14px), #000 calc(100% - 14px)); }
.felt::after { content: 'CÀ ĐÙNG!'; position: absolute; left: 50%; top: 80%; transform: translate(-50%, -50%); font-family: 'Bevan', 'Rye', serif; font-size: 40px; color: var(--felt-mark); letter-spacing: 6px; }
.center { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -52%); display: flex; flex-direction: column; align-items: center; gap: 10px; width: min(440px, 52%); z-index: 2; }
.piles { display: flex; gap: 24px; align-items: center; }
.pile { position: relative; width: 72px; height: 102px; }
.pile-count { position: absolute; bottom: -8px; right: -10px; background: #2f2114; color: #fbf6ea; font-family: 'Oswald'; font-size: 12px; padding: 1px 7px; border-radius: 10px; z-index: 2; }
.pile-empty { width: 72px; height: 102px; border: 2px dashed rgba(0,0,0,.25); border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--muted); text-align: center; }
#deck .pcard { box-shadow: 2px 2px 0 #6e2018, 4px 4px 0 #5a1a13, var(--shadow); }
.prompt { background: var(--surface); color: var(--on); border-radius: 14px; padding: 10px 16px; text-align: center; box-shadow: var(--shadow); max-width: 100%; }
.prompt.quiet { background: transparent; box-shadow: none; color: var(--on2); font-style: italic; font-size: 14px; padding: 2px; }
[data-theme="night"] .prompt.quiet, [data-theme="saloon"] .prompt.quiet { color: #f3e6c8; }
.prompt.mine { box-shadow: 0 0 0 3px var(--accent), var(--shadow-lg); animation: pop .25s; }
@keyframes pop { from { transform: scale(.9); opacity: 0; } }
.prompt .ptitle { font-family: 'Oswald'; font-weight: 600; font-size: 18px; }
.prompt .sub { color: var(--on2); font-size: 13px; margin-top: 2px; }
.prompt .row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }
.prompt .row .pcard.playable:hover { transform: translateY(-6px); }

/* ghế */
.seat { position: absolute; transform: translate(-50%, -50%); width: 140px; display: flex; flex-direction: column; align-items: center; z-index: 3; cursor: pointer; transition: transform .15s; }
.seat .avatar { position: relative; width: 76px; height: 76px; border-radius: 50%; background: var(--surface); box-shadow: 0 0 0 4px var(--surface), 0 0 0 6px var(--wood2), var(--shadow); transition: box-shadow .2s; }
.seat .avatar .face { position: absolute; inset: 0; border-radius: 50%; overflow: hidden; }
.seat .avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.seat .plate { margin-top: -6px; background: var(--surface); color: var(--on); border-radius: 10px; padding: 8px 10px 5px; min-width: 124px; text-align: center; box-shadow: var(--shadow); position: relative; z-index: -1; }
.seat .pname { font-family: 'Oswald'; font-weight: 600; font-size: 15px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
.seat .pchar { font-size: 11px; color: var(--muted); }
.hpbar { display: flex; gap: 3px; justify-content: center; margin: 3px 0 1px; }
.hpbar i { width: 10px; height: 10px; border-radius: 50%; background: rgba(184,50,42,.15); box-shadow: inset 0 0 0 1.5px rgba(184,50,42,.45); transition: background .3s; }
.hpbar i.on { background: var(--red); box-shadow: inset 0 -2px 0 rgba(0,0,0,.2); }
.role-chip { display: inline-block; margin-top: 3px; font-family: 'Oswald'; font-size: 11px; padding: 1px 8px; border-radius: 10px; background: #2f2114; color: #fbf6ea; white-space: nowrap; }
.role-chip.sheriff { background: var(--accent); color: var(--accent-on); }
.seat-meta { display: flex; gap: 8px; align-items: center; margin-top: 5px; font-size: 12px; padding: 1px 8px; border-radius: 10px; background: var(--surface); color: var(--on2); box-shadow: var(--shadow); }
.hand-fan { display: inline-flex; align-items: center; }
.hand-fan b { width: 9px; height: 13px; background: #8f2e22; border: 1px solid #fbf6ea; border-radius: 2px; margin-left: -4px; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.hand-fan b:first-child { margin-left: 0; }
.hand-fan em { font-style: normal; margin-left: 4px; font-weight: 700; }
.equip { position: absolute; top: -6px; display: flex; flex-direction: column; gap: 3px; }
.equip.right { left: calc(50% + 74px); } .equip.left { right: calc(50% + 74px); }
.hcount, .rng { position: absolute; top: 50%; font-family: 'Oswald'; font-size: 11px; padding: 0 5px; border-radius: 8px; background: var(--surface); color: var(--on); box-shadow: 0 0 0 1px var(--line), var(--shadow); z-index: 2; white-space: nowrap; }
.hcount { right: calc(100% + 2px); } .rng { left: calc(100% + 2px); }
.dist { position: absolute; top: -4px; right: -8px; width: 24px; height: 24px; border-radius: 50%; background: #2f2114; color: #fbf6ea; font-family: 'Oswald'; font-size: 13px; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px var(--surface); z-index: 2; }
.rip { position: absolute; inset: 0; border-radius: 50%; background: rgba(30,20,10,.6); color: #fbf6ea; font-size: 34px; display: flex; align-items: center; justify-content: center; }
.bars { position: absolute; inset: 0; border-radius: 50%; overflow: hidden; pointer-events: none; background: repeating-linear-gradient(90deg, transparent 0 9px, rgba(40,40,45,.9) 9px 13px); box-shadow: inset 0 0 0 3px rgba(40,40,45,.9); animation: slam .35s cubic-bezier(.3,1.6,.5,1); }
@keyframes slam { from { transform: translateY(-100%); } }
.fuse { position: absolute; left: -10px; top: -6px; font-size: 22px; animation: fuse .5s infinite alternate; filter: drop-shadow(0 0 6px orange); }
@keyframes fuse { to { transform: rotate(-12deg) scale(1.12); } }
.seat.current .avatar { box-shadow: 0 0 0 4px var(--accent), 0 0 0 8px rgba(var(--glow),.35), 0 0 28px rgba(var(--glow),.85); animation: breathe 1.6s infinite; }
@keyframes breathe { 50% { box-shadow: 0 0 0 4px var(--accent), 0 0 0 12px rgba(var(--glow),.2), 0 0 38px rgba(var(--glow),.95); } }
.seat.waiting .plate { box-shadow: 0 0 0 2px var(--blue), var(--shadow); }
.seat.dead { opacity: .6; filter: grayscale(1); }
.seat.targetable .avatar { box-shadow: 0 0 0 4px var(--red), 0 0 22px var(--red); animation: aim 1s infinite; }
.seat.targetable:hover { transform: translate(-50%, -50%) scale(1.08); }
.seat.targetable .face::after { content: ''; position: absolute; inset: 10%; border-radius: 50%; border: 2px dashed rgba(255,255,255,.9); animation: spin 4s linear infinite; }
@keyframes aim { 50% { transform: scale(1.06); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* khu của tôi */
.me { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: end; padding: 6px 16px 12px; position: relative;
  background: linear-gradient(to top, var(--surface2) 0%, transparent 100%); }
.me.current::before { content: ''; position: absolute; left: 10%; right: 10%; top: 0; height: 3px; border-radius: 3px; background: linear-gradient(90deg, transparent, var(--accent), transparent); box-shadow: 0 0 14px var(--accent); }
.me.dead { filter: grayscale(.8); }
.me-left { display: flex; gap: 10px; align-items: flex-end; }
.me-cards { display: flex; gap: 6px; }
.me-info { background: var(--surface); padding: 6px 10px; border-radius: 10px; box-shadow: var(--shadow); }
.me-info .pname { font-family: 'Oswald'; font-weight: 600; font-size: 18px; }
.me-info .hpbar { justify-content: flex-start; }
.me-info .hpbar i { width: 13px; height: 13px; }
.me-info .muted { font-size: 12px; }
.me-mid { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.hand { display: flex; justify-content: center; align-items: flex-end; padding: 32px 20px 4px; min-height: 176px; max-width: 100%; }
.actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; min-height: 40px; align-items: center; }
.me-right { text-align: center; }
.small-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; color: var(--on2); }
.me-table { display: flex; gap: 6px; flex-wrap: wrap; max-width: 240px; justify-content: center; }
.winner { font-family: 'Bevan', serif; font-size: 26px; color: var(--red); background: var(--surface); padding: 2px 14px; border-radius: 10px; }

/* modal, log, toast */
.modal { position: fixed; inset: 0; background: rgba(20,12,6,.6); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal-box { background: var(--surface); color: var(--on); border-radius: 16px; padding: 20px; max-width: 540px; width: 100%; text-align: center; box-shadow: var(--shadow-lg); animation: pop .2s; max-height: 92vh; overflow-y: auto; }
.modal-box h3 { margin: 8px 0 4px; font-family: 'Bevan', serif; font-weight: 400; color: var(--red); font-size: 22px; }
.modal-box .cards { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin: 6px 0 10px; align-items: flex-start; }
.pick-hand { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; cursor: pointer; }
.pick-hand:hover .pcard { transform: translateY(-4px); }
.log { position: fixed; right: 0; top: 42px; bottom: 0; width: 300px; max-width: 90vw; background: var(--surface); color: var(--on); box-shadow: -6px 0 20px rgba(var(--shadow-c),.25); padding: 10px 12px; overflow-y: auto; z-index: 40; font-size: 13px; }
.log h3 { margin: 0 0 8px; font-family: 'Bevan'; font-weight: 400; color: var(--red); }
.log div { padding: 3px 0; border-bottom: 1px dashed var(--line); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--red); color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 700; z-index: 60; box-shadow: var(--shadow-lg); max-width: 90vw; }
.toast.info { background: #2f2114; color: #fbf6ea; }

/* ================= HIỆU ỨNG ================= */
#fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 45; overflow: hidden; }
#fx-canvas { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 44; }
.flyer { position: absolute; left: 0; top: 0; will-change: transform; }
.shake { animation: shake calc(.5s * var(--fx, 1)); }
@keyframes shake { 10%, 90% { translate: -2px 0; } 20%, 80% { translate: 4px 0; } 30%, 50%, 70% { translate: -7px 0; } 40%, 60% { translate: 7px 0; } }
.screen-shake { animation: sshake .6s; }
@keyframes sshake { 10% { translate: -8px 4px; } 20% { translate: 9px -6px; } 30% { translate: -10px 2px; } 40% { translate: 7px 6px; } 55% { translate: -5px -3px; } 70% { translate: 3px 2px; } }
.flash-red .avatar, .me.flash-red { animation: flashred calc(.6s * var(--fx, 1)); }
@keyframes flashred { 30% { filter: drop-shadow(0 0 14px rgba(220,30,20,.95)) brightness(1.2) sepia(1) hue-rotate(-30deg) saturate(4); } }
.flash-heal .avatar, .me.flash-heal { animation: flashheal .8s; }
@keyframes flashheal { 30% { filter: drop-shadow(0 0 14px rgba(80,200,120,.95)) brightness(1.15); } }
.white-flash { position: fixed; inset: 0; background: #fff3c4; z-index: 46; pointer-events: none; animation: wf .5s forwards; }
@keyframes wf { from { opacity: .9; } to { opacity: 0; } }
.float-text { position: fixed; transform: translate(-50%, -50%); font-family: 'Bevan', serif; font-size: 34px; text-shadow: 0 2px 0 #fff, 0 0 10px #fff; animation: floatup calc(1.1s * var(--fx, 1)) forwards; }
@keyframes floatup { from { opacity: 0; transform: translate(-50%, -20%) scale(.6); } 20% { opacity: 1; transform: translate(-50%, -60%) scale(1.15); } to { opacity: 0; transform: translate(-50%, -160%) scale(1); } }
.stamp { position: fixed; transform: translate(-50%, -50%) rotate(-14deg); font-family: 'Bevan', serif; font-size: 26px; color: var(--blue); border: 3px solid var(--blue); padding: 0 10px; border-radius: 6px; background: rgba(255,255,255,.85); animation: stamp calc(.9s * var(--fx, 1)) forwards; }
@keyframes stamp { 0% { opacity: 0; transform: translate(-50%, -50%) rotate(-14deg) scale(2.4); } 15% { opacity: 1; transform: translate(-50%, -50%) rotate(-14deg) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }
.banner { position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%) rotate(-3deg); background: #2f2114; color: #fbf6ea; padding: 12px 40px; font-family: 'Bevan', serif; font-size: 34px; text-align: center; box-shadow: 0 0 0 4px var(--accent), var(--shadow-lg); animation: bannerin .35s cubic-bezier(.2,1.4,.4,1); white-space: nowrap; }
.banner small { display: block; font-family: 'Oswald'; font-size: 15px; letter-spacing: 2px; opacity: .85; }
.banner.out { transition: opacity .4s, transform .4s; opacity: 0; transform: translate(-50%, -70%) rotate(-3deg); }
@keyframes bannerin { from { transform: translate(-50%, -50%) rotate(-3deg) scale(.4); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ================= MOBILE ================= */
@media (max-width: 760px) {
  .logo { font-size: 50px; }
  .hero-cards { height: 120px; } .hero-cards .pcard { --w: 72px; }
  .table-wrap { padding: 10px 4px 0; }
  .felt { inset: 15% 11%; box-shadow: 0 0 0 8px var(--wood), 0 0 0 10px var(--wood2), 0 10px 24px rgba(var(--shadow-c),.3); }
  .felt::after { font-size: 24px; }
  .seat .avatar { width: 46px; height: 46px; }
  .seat .plate { min-width: 84px; padding: 6px 4px 3px; }
  .seat .pname { font-size: 12px; max-width: 86px; } .seat .pchar { display: none; }
  .hpbar i { width: 7px; height: 7px; }
  .equip .pcard.xs { --w: 20px; } .equip.right { left: calc(50% + 46px); } .equip.left { right: calc(50% + 46px); }
  .hcount, .rng { font-size: 9px; padding: 0 3px; }
  .seat { width: 86px; }
  .role-chip { font-size: 9px; padding: 0 5px; }
  .center { width: 50%; gap: 6px; } .prompt { padding: 7px 8px; font-size: 12px; } .prompt .sub { font-size: 11px; } .prompt .btn { font-size: 13px; padding: 5px 10px; } .pile, .pile-empty { width: 52px; height: 74px; } .piles .pcard.sm { --w: 52px; }
  .prompt .ptitle { font-size: 13px; line-height: 1.2; }
  .me { grid-template-columns: 1fr; gap: 4px; padding: 4px 8px 8px; }
  .me-left { justify-content: space-between; } .me-right { display: flex; gap: 8px; align-items: center; justify-content: center; } .small-label { margin: 0; }
  .me-cards .pcard.sm { --w: 48px; }
  .hand { min-height: 124px; padding: 22px 6px 2px; }
  .hand .pcard { --w: 72px; }
  .banner { font-size: 22px; padding: 10px 22px; }
  .vol { display: none; } #theme-select { max-width: 48px; padding: 3px 2px; } .topbar { gap: 5px; padding: 6px 8px; } .topbar .logo.small { font-size: 18px; } #btn-log-toggle { padding: 4px 6px; font-size: 12px; }
}

/* ================= TRAU CHUỐT (kiểu Poker Night) ================= */
:root { --plate-bg: linear-gradient(180deg, #3a2818, #22170d); --plate-on: #f6ead2; --plate-sub: #c9b28a; --gold-grad: linear-gradient(180deg, #f6d77a 0%, #d9a73a 48%, #b9852a 52%, #e2b650 100%); }
[data-theme="night"] { --plate-bg: linear-gradient(180deg, #2a3652, #161e30); --plate-on: #eef1f8; --plate-sub: #a9b6d0; }
[data-theme="winter"] { --plate-bg: linear-gradient(180deg, #34495e, #1d2a38); --plate-on: #f4f8fb; --plate-sub: #b8c8d8; }
.title { font-family: 'Bevan', serif; font-weight: 400; font-size: 30px; margin: 0 0 14px; color: var(--on); text-shadow: 2px 2px 0 var(--accent); }
[data-theme="night"] .title, [data-theme="saloon"] .title { color: #f6ead2; }
.screen.active { animation: screenin .35s ease; }
@keyframes screenin { from { opacity: 0; transform: translateY(8px); } }

/* nút vàng bóng bẩy */
.btn.primary { background: var(--gold-grad); color: #2a1a0a; border-color: #6b4a1a; box-shadow: 0 3px 0 #6b4a1a, inset 0 1px 0 rgba(255,255,255,.6), 0 6px 14px rgba(var(--shadow-c),.25); text-shadow: 0 1px 0 rgba(255,255,255,.4); }
.btn.primary:active { box-shadow: 0 1px 0 #6b4a1a, inset 0 1px 0 rgba(255,255,255,.6); }
.btn.danger { background: linear-gradient(180deg, #e0574d, #a8261f); border-color: #5a120e; box-shadow: 0 3px 0 #5a120e, inset 0 1px 0 rgba(255,255,255,.35); }
#actions .btn.primary { font-size: 18px; padding: 10px 26px; border-radius: 30px; }

/* thanh trên */
.topbar { background: linear-gradient(180deg, rgba(30,20,12,.92), rgba(30,20,12,.82)); color: #f6ead2; box-shadow: 0 2px 12px rgba(0,0,0,.3); backdrop-filter: blur(6px); }
.topbar .logo.small { color: #f6ead2; }
.topbar .btn.ghost { color: #f6ead2; border-color: rgba(246,234,210,.3); }
.topbar select { background: rgba(255,255,255,.1); color: #f6ead2; border-color: rgba(246,234,210,.3); }
.topbar select option { color: #222; }
#turn-info b { color: #f6d77a; }

/* bàn: ánh đèn rọi + vân nỉ + viền gỗ có bóng */
.table-wrap { position: relative; }
.table-wrap::before { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse 60% 55% at 50% 45%, rgba(255,240,200,.16), transparent 70%); }
#screen-game::after { content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0; background: radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(var(--shadow-c),.25) 100%); }
#screen-game > .topbar, #screen-game > .table-wrap, #screen-game > .me { position: relative; z-index: 1; }
#screen-game > .topbar { z-index: 6; }
.felt { background:
    radial-gradient(ellipse 70% 60% at 50% 38%, rgba(255,255,255,.22), transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(ellipse at 50% 40%, var(--felt1) 0%, var(--felt2) 100%);
  box-shadow: 0 0 0 3px rgba(0,0,0,.25), 0 0 0 15px var(--wood), 0 0 0 16px rgba(255,255,255,.18), 0 0 0 19px var(--wood2), 0 22px 50px rgba(var(--shadow-c),.5), inset 0 0 60px rgba(0,0,0,.25), inset 0 0 0 6px rgba(0,0,0,.06); }
.felt::before { inset: -15px; background: repeating-linear-gradient(100deg, rgba(255,255,255,.07) 0 2px, transparent 2px 7px, rgba(0,0,0,.05) 7px 9px, transparent 9px 14px); }
.pile .pcard, .prompt .row .pcard { box-shadow: 0 6px 14px rgba(0,0,0,.35); }
.prompt { border: 1px solid rgba(0,0,0,.08); }
.prompt.mine { background: linear-gradient(180deg, var(--surface), var(--surface2)); }

/* ghế: bảng tên da, viền kim loại, vòng sáng lượt */
.seat .avatar { box-shadow: 0 0 0 3px #2b1d12, 0 0 0 6px transparent, 0 8px 18px rgba(0,0,0,.4); background: conic-gradient(from 210deg, #f6d77a, #8a6224, #f6d77a, #8a6224, #f6d77a); padding: 3px; }
.seat .avatar .face { inset: 3px; box-shadow: inset 0 0 0 2px rgba(0,0,0,.35); }
.seat .plate { background: var(--plate-bg); color: var(--plate-on); border: 1px solid rgba(255,255,255,.08); box-shadow: 0 6px 16px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.12); margin-top: -8px; padding-top: 10px; }
.seat .pchar { color: var(--plate-sub); }
.seat .hpbar i { background: rgba(255,255,255,.12); box-shadow: inset 0 0 0 1.5px rgba(255,120,110,.45); }
.seat .hpbar i.on { background: radial-gradient(circle at 35% 30%, #ff8a7a, #c0392b 60%); box-shadow: 0 0 6px rgba(255,80,60,.6); }
.me-info .hpbar i.on { background: radial-gradient(circle at 35% 30%, #ff8a7a, #c0392b 60%); box-shadow: 0 0 6px rgba(255,80,60,.6); }
.seat.current .avatar { animation: none; box-shadow: 0 0 0 3px #2b1d12, 0 0 30px rgba(var(--glow),.9), 0 8px 18px rgba(0,0,0,.4); }
.seat.current .avatar::before { content: ''; position: absolute; inset: -9px; border-radius: 50%; background: conic-gradient(from 0deg, transparent 0 55%, rgba(var(--glow),.2) 60%, rgba(var(--glow),1) 75%, #fff 78%, transparent 80%); animation: spin 1.6s linear infinite; z-index: -1;
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px)); mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px)); }
.seat.current .plate { box-shadow: 0 0 0 2px rgba(var(--glow),.9), 0 0 18px rgba(var(--glow),.5), 0 6px 16px rgba(0,0,0,.35); }
.seat.waiting .plate { box-shadow: 0 0 0 2px var(--blue), 0 0 14px var(--blue); }
.hcount, .rng { background: #2b1d12; color: #f6ead2; box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.dist { background: var(--gold-grad); color: #2a1a0a; font-weight: 700; box-shadow: 0 0 0 2px #2b1d12, 0 2px 6px rgba(0,0,0,.4); }
.role-chip { background: rgba(255,255,255,.12); color: var(--plate-on); }
.role-chip.sheriff { background: var(--gold-grad); color: #2a1a0a; }

/* khu của tôi */
.me { background: linear-gradient(to top, rgba(var(--shadow-c),.28) 0%, transparent 100%); }
.me-info { background: var(--plate-bg); color: var(--plate-on); display: flex; gap: 10px; align-items: center; padding: 8px 14px 8px 8px; border-radius: 40px 14px 14px 40px; box-shadow: 0 8px 20px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.12); }
.me-info .muted { color: var(--plate-sub); }
.me-ava { position: relative; width: 58px; height: 58px; border-radius: 50%; padding: 3px; background: conic-gradient(from 210deg, #f6d77a, #8a6224, #f6d77a, #8a6224, #f6d77a); flex: 0 0 auto; }
.me-ava .face { position: absolute; inset: 3px; border-radius: 50%; overflow: hidden; }
.me-ava img { width: 100%; height: 100%; object-fit: cover; display: block; }
.me.current .me-ava { box-shadow: 0 0 22px rgba(var(--glow),.95); }
.me.current .me-ava::before { content: ''; position: absolute; inset: -7px; border-radius: 50%; background: conic-gradient(from 0deg, transparent 0 55%, rgba(var(--glow),1) 75%, #fff 78%, transparent 80%); animation: spin 1.6s linear infinite; -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px)); mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px)); }
.small-label { color: var(--plate-sub); }
.hand .pcard { box-shadow: 0 6px 16px rgba(0,0,0,.35), inset 0 0 0 1px rgba(0,0,0,.14); }

/* khung mô tả lá bài khi rê chuột */
#card-tip { position: fixed; z-index: 48; width: 250px; pointer-events: none; background: var(--plate-bg); color: var(--plate-on); border-radius: 12px; padding: 10px 12px; box-shadow: 0 12px 30px rgba(0,0,0,.45); border: 1px solid rgba(255,255,255,.1); opacity: 0; transform: translateY(6px); transition: opacity .12s, transform .12s; }
#card-tip.on { opacity: 1; transform: none; }
#card-tip .tn { font-family: 'Bevan', serif; font-size: 17px; color: #f6d77a; }
#card-tip .te { font-size: 11px; color: var(--plate-sub); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; }
#card-tip .td { font-size: 13px; line-height: 1.4; }
#card-tip .tw { margin-top: 6px; font-size: 12px; color: #ff9d8f; }

/* bong bóng thoại cạnh ghế */
.bubble { position: fixed; transform: translate(-50%, -100%); z-index: 47; display: flex; align-items: center; gap: 6px; background: #fffaf0; color: #2b1d12; padding: 5px 10px 5px 5px; border-radius: 14px; box-shadow: 0 6px 18px rgba(0,0,0,.35); font-family: 'Bevan', serif; font-size: 14px; white-space: nowrap; animation: bubble calc(1.9s * var(--fx, 1)) forwards; pointer-events: none; }
.bubble::after { content: ''; position: absolute; left: 50%; bottom: -7px; transform: translateX(-50%); border: 7px solid transparent; border-top-color: #fffaf0; border-bottom: 0; }
.bubble img { width: 26px; height: 34px; object-fit: cover; border-radius: 4px; box-shadow: 0 0 0 1px rgba(0,0,0,.2); }
@keyframes bubble { 0% { opacity: 0; transform: translate(-50%, -80%) scale(.6); } 12% { opacity: 1; transform: translate(-50%, -100%) scale(1.05); } 20% { transform: translate(-50%, -100%) scale(1); } 85% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -115%); } }

/* sảnh: thẻ tên */
#lobby-players li { background: var(--plate-bg); color: var(--plate-on); box-shadow: inset 0 1px 0 rgba(255,255,255,.1), var(--shadow); }
#lobby-players li .btn.ghost { color: var(--plate-on); border-color: rgba(255,255,255,.25); }
.panel { border: 1px solid rgba(0,0,0,.06); }
.banner { font-family: 'Bevan', serif; background: linear-gradient(180deg, #3a2818, #1e140b); border-radius: 6px; }
.pcard .cname { font-size: calc(var(--w) * .118); letter-spacing: -.2px; }
.pcard.sm .cname { font-size: max(9px, calc(var(--w) * .12)); }
@media (max-width: 760px) { .me-ava { width: 40px; height: 40px; } .me-info { padding: 5px 10px 5px 5px; } #card-tip { display: none; } .bubble { font-size: 11px; } .bubble img { width: 18px; height: 24px; } }

/* ===== Nâng cấp bàn: trang bị đọc được, diễn biến trên bàn, làm mờ ngoài tầm ===== */
.equip { gap: 4px; }
.eqchip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px 2px 2px; border-radius: 7px; background: var(--plate-bg); color: var(--plate-on); font-family: 'Oswald'; font-size: 12px; white-space: nowrap; box-shadow: 0 3px 8px rgba(0,0,0,.3); border-left: 3px solid #4a5057; }
.eqchip.blue { border-left-color: #3b7dbd; } .eqchip.brown { border-left-color: #b5651d; }
.eqchip img { width: 20px; height: 26px; object-fit: cover; border-radius: 3px; display: block; }
.equip.right { left: calc(50% + 50px); } .equip.left { right: calc(50% + 50px); align-items: flex-end; }
.seat.out { opacity: .38; filter: grayscale(.8); transform: translate(-50%, -50%) scale(.95); }
.seat.out:hover { opacity: .55; }
.feed { display: flex; flex-direction: column; gap: 3px; width: 100%; max-width: 340px; align-items: center; }
.feed div { font-size: 12px; padding: 3px 10px; border-radius: 10px; background: rgba(255,255,255,.45); color: var(--on); opacity: .75; text-align: center; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[data-theme="night"] .feed div, [data-theme="saloon"] .feed div { background: rgba(0,0,0,.35); color: #f6ead2; }
.feed div.new { opacity: 1; font-weight: 700; background: var(--surface); box-shadow: var(--shadow); animation: pop .3s; }
@media (max-width: 760px) {
  .eqchip { padding: 1px; font-size: 0; gap: 0; border-left-width: 2px; } .eqchip b { display: none; } .eqchip img { width: 16px; height: 21px; }
  .equip.right { left: calc(50% + 30px); } .equip.left { right: calc(50% + 30px); }
  .feed div { font-size: 10px; padding: 2px 6px; } .feed div:not(.new) { display: none; }
}

/* chất bài có màu trong chữ */
.suit { font-weight: 800; font-size: 1.12em; line-height: 1; font-family: 'Segoe UI Symbol', 'Noto Sans Symbols 2', sans-serif; }
.suit.red { color: #d63b30; } .suit.black { color: #1d1712; }
#card-tip .suit.red, .bubble .suit.red, .mat .suit.red { color: #ff7062; }
#card-tip .suit.black { color: #f3e9d6; }
[data-theme="night"] .log .suit.black, [data-theme="night"] .feed .suit.black, [data-theme="saloon"] .feed div:not(.new) .suit.black { color: #f3e9d6; }
[data-theme="night"] .log .suit.red { color: #ff7062; }

/* ================= HƯỚNG DẪN ================= */
.guide-btn { margin-top: 16px; width: 100%; }
.guide { position: fixed; inset: 0; z-index: 70; background: rgba(20,12,6,.65); display: flex; justify-content: center; padding: 18px; animation: fade .15s; }
.guide-box { background: var(--surface); color: var(--on); width: 100%; max-width: 900px; border-radius: 18px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden; }
.g-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; background: var(--plate-bg); color: var(--plate-on); }
.g-head h2 { margin: 0; font-family: 'Bevan', serif; font-weight: 400; font-size: 22px; color: #f6d77a; }
.g-head .btn { color: var(--plate-on); background: transparent; border-color: rgba(255,255,255,.3); box-shadow: none; }
.g-toc { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 20px; border-bottom: 1px solid var(--line); background: var(--surface2); }
.g-toc a { font-family: 'Oswald'; font-size: 13px; padding: 3px 10px; border-radius: 14px; background: var(--surface); color: var(--on); text-decoration: none; box-shadow: 0 1px 0 var(--line); }
.g-toc a:hover { background: var(--accent); color: var(--accent-on); }
.g-body { overflow-y: auto; padding: 6px 24px 30px; line-height: 1.55; font-size: 15px; scroll-behavior: smooth; }
.g-body section { scroll-margin-top: 10px; padding-top: 8px; }
.g-body h3 { font-family: 'Bevan', serif; font-weight: 400; font-size: 20px; color: var(--red); margin: 22px 0 10px; padding-bottom: 6px; border-bottom: 2px dashed var(--line); }
.g-body h4 { margin: 0 0 3px; font-family: 'Oswald'; font-weight: 600; font-size: 17px; }
.g-body h4 small { font-family: 'Nunito'; font-weight: 400; font-size: 12px; color: var(--muted); margin-left: 4px; }
.g-body p { margin: 0 0 6px; } .g-body ul, .g-body ol { padding-left: 22px; margin: 6px 0; } .g-body li { margin: 4px 0; }
.g-lead { font-size: 16px; margin-top: 14px !important; padding: 12px 14px; border-radius: 12px; background: var(--surface2); }
.g-note { font-size: 14px; padding: 8px 12px; border-left: 4px solid var(--accent); background: var(--surface2); border-radius: 0 8px 8px 0; margin-top: 10px !important; }
.g-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.g-role, .g-card, .g-char { display: flex; gap: 12px; align-items: center; }
.g-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
.g-card .pcard, .g-role .pcard { flex: 0 0 auto; cursor: default; }
.g-chars { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
.g-ava { width: 60px; height: 60px; border-radius: 50%; overflow: hidden; flex: 0 0 auto; box-shadow: 0 0 0 3px #d4a63a, 0 0 0 5px #2b1d12; }
.g-ava img { width: 100%; height: 100%; object-fit: cover; }
.g-table { border-collapse: collapse; margin: 14px 0 6px; width: 100%; font-size: 14px; }
.g-table th, .g-table td { padding: 6px 8px; text-align: center; border-bottom: 1px solid var(--line); }
.g-table th { font-family: 'Oswald'; font-weight: 600; background: var(--surface2); }
.g-flex { display: flex; gap: 18px; align-items: center; }
.g-svg { width: 300px; flex: 0 0 auto; }
.g-steps > li { margin-bottom: 8px; }
@media (max-width: 760px) {
  .guide { padding: 0; } .guide-box { border-radius: 0; } .g-body { padding: 4px 14px 24px; font-size: 14px; }
  .g-grid2, .g-cards, .g-chars { grid-template-columns: 1fr; } .g-flex { flex-direction: column; } .g-svg { width: 100%; max-width: 320px; }
  .g-card .pcard, .g-role .pcard { --w: 74px !important; } .g-toc { padding: 8px 12px; } .g-table { font-size: 12px; }
}

/* ================= DỄ NHÌN CHO NGƯỜI MỚI ================= */
.pick-lbl { font-family: 'Oswald'; font-size: 13px; align-self: center; color: var(--on2); margin-right: 2px; }
/* máu = viên đạn */
.hpbar { gap: 2px; align-items: flex-end; }
.hpbar i.bul { width: 9px; height: 22px; background: none !important; box-shadow: none !important; display: inline-block; }
.hpbar i.bul svg { width: 100%; height: 100%; display: block; overflow: visible; }
.bul .tip { fill: #8a8a8a; } .bul .case { fill: #6e6e6e; } .bul .rim { fill: #5a5a5a; } .bul .shine { fill: rgba(255,255,255,.15); }
.bul { opacity: .35; }
.bul.on { opacity: 1; filter: drop-shadow(0 1px 1px rgba(0,0,0,.5)); }
.bul.on .tip { fill: #c47a3a; } .bul.on .case { fill: #e3b54a; } .bul.on .rim { fill: #b98a2a; } .bul.on .shine { fill: rgba(255,255,255,.55); }
.me-info .hpbar i.bul { width: 12px; height: 30px; }
/* khoảng cách to, có chữ */
.dist { width: 38px; height: 38px; top: -8px; right: -14px; flex-direction: column; line-height: 1; }
.dist b { font-size: 18px; } .dist small { font-size: 8px; font-family: 'Nunito'; font-weight: 800; letter-spacing: .3px; text-transform: uppercase; }
/* chỉ số trong bảng tên */
.seat .stats { display: flex; gap: 6px; justify-content: center; margin-top: 3px; }
.seat .stats span { font-family: 'Oswald'; font-size: 13px; padding: 1px 7px; border-radius: 8px; background: rgba(255,255,255,.1); }
.seat .stats .rngbig { background: rgba(var(--glow),.25); color: #f6d77a; font-weight: 700; }
/* trang bị to hơn */
.eqchip { font-size: 13px; padding: 3px 9px 3px 3px; }
.eqchip img { width: 24px; height: 31px; }
/* khu của tôi: vai trò + kỹ năng luôn hiện */
.me-info { display: block; width: 470px; max-width: 40vw; padding: 9px 12px; border-radius: 16px; cursor: pointer; }
.me-info:hover { box-shadow: 0 0 0 2px rgba(var(--glow),.6), 0 8px 20px rgba(0,0,0,.35); }
.me-top { display: flex; gap: 10px; align-items: center; }
.me-id { flex: 1; min-width: 0; }
.me-range { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 58px; height: 58px; border-radius: 12px; background: var(--gold-grad); color: #2a1a0a; box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 3px 8px rgba(0,0,0,.3); flex: 0 0 auto; }
.me-range b { font-family: 'Oswald'; font-size: 28px; line-height: 1; } .me-range small { font-size: 10px; font-weight: 800; text-transform: uppercase; }
.me-role, .me-skill { margin-top: 8px; font-size: 13px; line-height: 1.35; padding: 6px 9px; border-radius: 10px; background: rgba(255,255,255,.07); }
.me-role b { font-family: 'Oswald'; font-size: 16px; margin-right: 6px; color: #f6d77a; }
.me-role .goal { display: block; color: var(--plate-sub); }
.me-role.sheriff { box-shadow: inset 3px 0 0 #e3b54a; } .me-role.deputy { box-shadow: inset 3px 0 0 #6aa8ea; } .me-role.outlaw { box-shadow: inset 3px 0 0 #e0524a; } .me-role.renegade { box-shadow: inset 3px 0 0 #9b6bd6; }
.me-skill { box-shadow: inset 3px 0 0 rgba(255,255,255,.3); }
.lbl { display: block; font-family: 'Oswald'; font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--plate-sub); opacity: .85; }
.me-right .small-label { font-size: 13px; font-family: 'Oswald'; color: var(--on); }
/* gợi ý */
.prompt.hint { background: var(--surface); box-shadow: var(--shadow); font-style: normal; color: var(--on); padding: 8px 14px; font-size: 14px; line-height: 1.45; }
.prompt .inrange { font-size: 13px; color: var(--on2); }
/* màn giới thiệu vai trò */
.intro { text-align: center; }
.intro-kicker { font-family: 'Oswald'; letter-spacing: 2px; text-transform: uppercase; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.intro .cards { gap: 16px; }
.intro .pcard.lg { --w: 170px; }
.intro-txt { text-align: left; max-width: 440px; margin: 8px auto 4px; font-size: 15px; line-height: 1.45; }
.intro-txt .lbl { color: var(--muted); }
.intro-txt .big { font-family: 'Bevan', serif; font-weight: 400; font-size: 24px; color: var(--red); }
.intro-txt .goal { padding: 8px 12px; border-radius: 10px; background: var(--surface2); font-weight: 700; }
.intro-txt .skill { padding: 8px 12px; border-radius: 10px; background: var(--surface2); }
.intro-txt .tip { font-size: 13px; color: var(--muted); }
.intro .row { display: flex; gap: 10px; justify-content: center; margin-top: 12px; }
#speed-select { width: auto; padding: 3px 6px; font-size: 13px; border-width: 1px; background: rgba(255,255,255,.1); color: #f6ead2; border-color: rgba(246,234,210,.3); }
#speed-select option { color: #222; }
@media (max-width: 760px) {
  .hpbar i.bul { width: 7px; height: 16px; } .me-info .hpbar i.bul { width: 9px; height: 22px; }
  .dist { width: 30px; height: 30px; right: -12px; } .dist b { font-size: 14px; } .dist small { font-size: 6px; }
  .seat .stats span { font-size: 10px; padding: 0 4px; }
  .eqchip img { width: 20px; height: 26px; }
  .me-info { max-width: none; padding: 7px 9px; } .me-range { width: 44px; height: 44px; } .me-range b { font-size: 20px; }
  .me-role, .me-skill { margin-top: 5px; font-size: 11px; padding: 4px 7px; } .me-role b { font-size: 13px; }
  .me-role .goal { display: none; }
  .intro .pcard.lg { --w: 120px; } .intro-txt { font-size: 13px; }
  #speed-select { max-width: 48px; padding: 3px 2px; }
}

.me-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 7px; }
.me-cols .me-role, .me-cols .me-skill { margin-top: 0; font-size: 12.5px; }
.hand { min-height: 160px; padding-top: 26px; }
@media (max-width: 760px) { .me-info { width: auto; max-width: none; } .me-cols { gap: 5px; margin-top: 5px; } .me-cols .me-role, .me-cols .me-skill { font-size: 11px; } .hand { min-height: 120px; } }

@media (max-width: 760px) { .hide-m { display: none; } .me-range small { font-size: 7px; } }

/* xấp bài úp của đối thủ */
.seat .stats { align-items: center; }
.seat .stats .hfan { display: inline-flex; align-items: center; gap: 4px; padding: 0 6px 0 4px; background: none; }
.hfan .backs { position: relative; display: inline-block; height: 26px; width: calc(22px + var(--n, 1) * 7px); }
.hfan .backs i { position: absolute; left: 50%; bottom: 0; width: 15px; height: 22px; margin-left: -7.5px; border-radius: 2.5px; transform-origin: 50% 100%;
  transform: translateX(var(--x)) rotate(var(--r)); background: repeating-linear-gradient(45deg, #a8392b 0 3px, #8f2e22 3px 6px); box-shadow: 0 0 0 1.5px #f6ead2, 0 1px 3px rgba(0,0,0,.5); }
.hfan b { font-family: 'Oswald'; font-size: 14px; color: var(--plate-on); }
.hfan.zero .backs { display: none; }
.role-chip.hidden-role { background: rgba(255,255,255,.08); color: var(--plate-sub); font-weight: 400; }
@media (max-width: 760px) { .hfan .backs { height: 17px; width: calc(14px + var(--n, 1) * 4px); } .hfan .backs i { width: 10px; height: 15px; margin-left: -5px; transform: translateX(calc(var(--x) * .55)) rotate(var(--r)); } .hfan b { font-size: 11px; } .role-chip.hidden-role { display: none; } }
.seat .stats { flex-wrap: nowrap; white-space: nowrap; }
.prompt .store-row { gap: 6px; } .prompt .store-row .pcard { --w: 60px; } .prompt .store-row .pcard .ktag { display: none; }
.prompt .store-row.peek .pcard { --w: 40px; grid-template-rows: 1fr; padding: 2px; } .prompt .store-row.peek .pcard .ctop, .prompt .store-row.peek .pcard .cname { display: none; }
.prompt:has(.store-row:not(.peek)) { position: relative; z-index: 5; }
@media (max-width: 760px) { .prompt .store-row .pcard { --w: 46px; } .prompt .store-row.peek .pcard { --w: 28px; } }

/* ===== Mô tả trên mặt lá ===== */
.pcard { height: calc(var(--w) * 1.56); grid-template-rows: calc(var(--w) * .2) 1fr calc(var(--w) * .2) calc(var(--w) * .27); }
.pcard .cname { padding-top: 0; font-size: calc(var(--w) * .118); }
.pcard .cshort { font-size: max(8px, calc(var(--w) * .088)); line-height: 1.15; text-align: center; color: var(--card-ink); opacity: .82; display: flex; align-items: center; justify-content: center; padding: 0 1px; overflow: hidden; }
.pcard .cshort .suit { font-size: 1em; }
.pcard.sm { height: calc(var(--w) * 1.42); grid-template-rows: calc(var(--w) * .2) 1fr calc(var(--w) * .26); } .pcard.sm .cshort { display: none; }
.pcard.xs .cshort { display: none; }
.hero-cards .pcard .cshort { display: none; } .hero-cards .pcard { height: calc(var(--w) * 1.42); grid-template-rows: calc(var(--w) * .2) 1fr calc(var(--w) * .26); }
.pcard.char, .pcard.role { height: calc(var(--w) * 1.42); grid-template-rows: calc(var(--w) * .2) 1fr calc(var(--w) * .26); }
.hand { min-height: 178px; }
/* lá to (xem chi tiết, giới thiệu): tên tự xuống dòng không đè chữ */
.pcard.lg { height: auto !important; grid-template-rows: calc(var(--w) * .2) calc(var(--w) * 1.05) auto auto !important; padding-bottom: 10px; }
.pcard.lg .cname { padding: 6px 4px 2px; line-height: 1.1; font-size: calc(var(--w) * .12); }
.pcard.lg .cshort { font-size: 13px; padding: 2px 6px; }
.pcard.lg .cdesc { padding-top: 4px; }
/* khung chi tiết lá */
.detail { display: flex; gap: 16px; align-items: flex-start; text-align: left; }
.detail .pcard.lg { --w: 170px; flex: 0 0 auto; }
.detail-txt h3 { margin: 2px 0 6px; } .detail-txt h3 small { font-family: 'Nunito'; font-size: 13px; color: var(--muted); }
.detail-txt p { font-size: 15px; line-height: 1.5; margin: 0 0 8px; }
/* khung nhân vật */
.charview { display: flex; gap: 14px; align-items: center; text-align: left; }
.cv-ava { width: 84px; height: 84px; border-radius: 50%; overflow: hidden; flex: 0 0 auto; box-shadow: 0 0 0 3px #d4a63a, 0 0 0 5px #2b1d12; }
.cv-ava img { width: 100%; height: 100%; object-fit: cover; }
.cv-head h3 { margin: 0 0 2px; } .cv-role { font-family: 'Oswald'; font-size: 15px; color: var(--on2); }
.cv-head .hpbar { justify-content: flex-start; } .cv-head .hpbar i.bul { width: 11px; height: 26px; }
.cv-stats { display: flex; gap: 10px; margin: 12px 0 8px; }
.cv-stats div { flex: 1; background: var(--surface2); border-radius: 10px; padding: 6px; display: flex; flex-direction: column; align-items: center; }
.cv-stats b { font-family: 'Oswald'; font-size: 24px; line-height: 1; } .cv-stats small { font-size: 11px; color: var(--muted); }
.cv-box { text-align: left; background: var(--surface2); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; font-size: 14px; line-height: 1.4; }
.cv-box .lbl { color: var(--muted); margin-bottom: 2px; }
.eqrow { display: flex; gap: 8px; align-items: center; padding: 5px 0; border-top: 1px dashed var(--line); cursor: pointer; }
.eqrow:first-of-type { border-top: 0; }
.eqrow img { width: 34px; height: 44px; object-fit: cover; border-radius: 4px; flex: 0 0 auto; }
.eqrow b { display: block; font-family: 'Oswald'; font-size: 15px; } .eqrow span { font-size: 13px; }
@media (max-width: 760px) {
  .hand { min-height: 134px; }
  .detail { flex-direction: column; align-items: center; } .detail .pcard.lg { --w: 140px; }
  .modal-box .cards .pcard.lg { --w: min(40vw, 150px); }
  .pcard.lg .cname { font-size: calc(var(--w) * .115); }
}
.pcard .cshort span { display: block; }
.hand .pcard { --w: 112px; }
@media (max-width: 760px) {
  .hand { justify-content: flex-start; overflow-x: auto; overflow-y: visible; scroll-snap-type: x proximity; padding: 18px 10px 4px; gap: 6px; -webkit-overflow-scrolling: touch; }
  .hand .pcard { --w: 84px; margin: 0 !important; transform: none !important; scroll-snap-align: center; }
  .hand .pcard.playable:hover { transform: translateY(-6px) !important; }
  .hand .pcard.selected { transform: translateY(-12px) !important; }
  .hand::after { content: ''; flex: 0 0 4px; }
}

/* lá mới vào tay */
.hand .pcard.fresh { box-shadow: 0 0 0 3px #f6d77a, 0 0 22px rgba(246,215,122,.9), var(--shadow); animation: freshin calc(.6s * var(--fx, 1)) cubic-bezier(.2,1.4,.4,1); }
.hand .pcard.fresh::after { content: 'MỚI'; position: absolute; top: -10px; left: 50%; transform: translateX(-50%); font-family: 'Oswald'; font-size: 11px; font-weight: 700; letter-spacing: 1px; padding: 1px 8px; border-radius: 8px; background: var(--gold-grad); color: #2a1a0a; box-shadow: 0 2px 6px rgba(0,0,0,.35); border: 0; inset: auto; }
@keyframes freshin { from { transform: translateY(-40px) scale(1.2); opacity: .2; } }
/* máy tính (có chuột): mô tả xem bằng cách rê chuột, mặt lá gọn như cũ */
@media (hover: hover) and (pointer: fine) {
  .pcard .cshort { display: none; }
  .pcard { height: calc(var(--w) * 1.42); grid-template-rows: calc(var(--w) * .2) 1fr calc(var(--w) * .26); }
  .hand .pcard { --w: 104px; }
  .hand { min-height: 168px; }
}
@media (max-width: 760px) {
  .hand .pcard { --w: 78px !important; }
  .hand { min-height: 0; padding: 14px 8px 2px; }
  .me-right { flex-wrap: wrap; } .me-right .me-table { max-width: none; } .me-right .pcard.sm { --w: 42px; }
  .me-right .pcard.sm .cname { font-size: 7px; }
  .me { gap: 2px; }
}

/* đồng hồ đếm giờ */
#turn-timer{margin-left:10px;background:#2b1d12e6;color:#ffe9c2;border:2px solid #c9a35b;border-radius:999px;padding:3px 14px;font-weight:700;font-size:14px;box-shadow:0 4px 12px #0005;pointer-events:none;white-space:nowrap}
#turn-timer b{font-size:16px}
#turn-timer.mine{background:#7a4b12;color:#fff}
#turn-timer.low{background:#b3261e;color:#fff;border-color:#ffb4a8;animation:timerPulse .6s ease-in-out infinite}
@keyframes timerPulse{50%{transform:scale(1.08)}}
@media (max-width:640px){#turn-timer{font-size:12px;padding:2px 8px;margin-left:4px}#turn-timer b{font-size:13px}}

/* ---------- Bài trên tay: dễ nhìn hơn ---------- */
.hand .pcard { --w: var(--hw, 116px); transform: translateY(var(--lift, 0)); transform-origin: 50% 100%; margin: 0 var(--overlap, -6px); border: 2px solid #fffaf0; }
.hand .pcard.brown { border-color: #e0a35f; } .hand .pcard.blue { border-color: #7fb2e0; } .hand .pcard.gun { border-color: #a9b0b8; }
.hand .pcard .art img { filter: contrast(1.12) saturate(1.15); }
.hand .pcard .ctop .idx { background: #fffdf7; border-radius: 5px; padding: 1px 5px; box-shadow: 0 1px 0 rgba(0,0,0,.25); font-size: calc(var(--w) * .16); }
.hand .pcard .ctop .ktag { font-size: calc(var(--w) * .088); }
.hand .pcard .cname { margin: 0 calc(var(--w) * -.06); border-radius: 4px; color: #fff; font-size: calc(var(--w) * .13); text-shadow: 0 1px 2px rgba(0,0,0,.45); background: #8a4b1c; }
.hand .pcard.blue .cname { background: #245d8f; } .hand .pcard.gun .cname { background: #3d434a; }
.hand .pcard.playable { box-shadow: 0 0 0 2px #fff, 0 0 0 5px #3fae5a, 0 10px 20px rgba(0,0,0,.35); --lift: -10px; }
.hand .pcard.playable:hover { transform: translateY(-26px) scale(1.1); }
.hand .pcard.selected { transform: translateY(-32px) scale(1.1); }
.hand .pcard.disabled { filter: saturate(.75) brightness(.95); opacity: .86; }
@media (max-width: 760px) { .hand .pcard { margin: 0 var(--overlap, 2px); border-width: 1.5px; } .hand .pcard .cname { font-size: calc(var(--w) * .14); } .hand .pcard .cshort { font-size: max(9px, calc(var(--w) * .1)); } }

/* bỏ bớt bài */
.prompt .discard-row { flex-wrap: wrap; justify-content: center; gap: 6px; margin: 6px 0; }
.prompt .discard-row .pcard { --w: 64px; }
.pcard.to-discard { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--red) !important; filter: saturate(.6); }
.pcard.to-discard::after { content: "✕"; position: absolute; inset: 0; display: grid; place-items: center; font-size: calc(var(--w) * .55); font-weight: 900; color: var(--red); text-shadow: 0 0 6px #fff, 0 0 2px #fff; background: rgba(255,255,255,.35); border-radius: inherit; z-index: 3; }
.hand .pcard.to-discard { transform: translateY(-18px); }
@media (max-width: 760px) { .prompt .discard-row .pcard { --w: 46px; } }
.hand .pcard .cshort span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* biểu tượng tác dụng dưới hình */
.pcard .art { position: relative; }
.pcard .cicons { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; gap: calc(var(--w) * .03); padding: calc(var(--w) * .025) 2px; background: linear-gradient(transparent, rgba(251,246,234,.92) 35%); }
.pcard .cicons:empty { display: none; }
.pcard .cicons .ic { font-style: normal; font-family: 'Oswald', sans-serif; font-weight: 700; font-size: calc(var(--w) * .11); line-height: 1.1; color: #2b1d12; background: #fffdf7; border: 1px solid rgba(43,29,18,.35); border-radius: 5px; padding: 0 calc(var(--w) * .03); white-space: nowrap; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.pcard .cicons .ic.red { color: var(--red); }
.pcard .cicons .ic.irng { background: #2b1d12; color: #ffe9c2; border-color: #2b1d12; }
.pcard.xs .cicons, .prompt .store-row.peek .cicons, .equip .cicons, .hero-cards .cicons { display: none; }
.pcard.sm .cicons .ic { font-size: max(8px, calc(var(--w) * .12)); }
#me-hand.hand .pcard { --w: var(--hw, 116px); }
.pcard .cicons .ic { font-size: calc(var(--w) * .135); padding: 1px calc(var(--w) * .035); }

/* viên đạn thêm của Cảnh sát trưởng */
.hpbar i.bul.star { position: relative; }
.hpbar i.bul.star::after { content: "★"; position: absolute; left: 50%; top: -9px; transform: translateX(-50%); font-size: 9px; font-style: normal; color: #ffd54a; text-shadow: 0 0 4px #ffb300, 0 0 1px #000; animation: starTw 1.6s ease-in-out infinite; }
.hpbar i.bul.star.on { animation: starGlow 1.6s ease-in-out infinite; }
.bul.star.on .tip { fill: #fff3b0; } .bul.star.on .case { fill: #ffc928; } .bul.star.on .rim { fill: #d89a00; }
.hpbar i.bul.star:not(.on)::after { opacity: .35; animation: none; }
@keyframes starGlow { 0%,100% { filter: drop-shadow(0 0 2px #ffcc33); } 50% { filter: drop-shadow(0 0 7px #ffe066) brightness(1.2); } }
@keyframes starTw { 50% { transform: translateX(-50%) scale(1.35) rotate(20deg); } }

/* ================= KHÔNG CHỒNG LẤN ================= */
.tb-opts { display: contents; }
#btn-more { display: none; }
.center { margin-top: var(--cpush, 0px); }
@media (max-width: 760px) {
  #btn-more { display: inline-flex; }
  .tb-opts { display: none; position: absolute; right: 8px; top: calc(100% + 6px); flex-direction: column; align-items: stretch; gap: 8px; padding: 12px; border-radius: 14px; background: linear-gradient(180deg, #2b1d12, #1e140b); box-shadow: 0 12px 30px rgba(0,0,0,.45); z-index: 20; min-width: 190px; }
  .tb-opts.open { display: flex; }
  .tb-opts select, #theme-select { max-width: none; width: 100%; padding: 6px 8px; font-size: 14px; }
  .tb-opts .vol { display: block; width: 100%; }
  .tb-opts .btn { justify-content: center; }
  .topbar { position: relative; }
  .topbar .logo.small { font-size: 16px; }
}
/* màn hình thấp: gọn khu của mình, bấm vào tên để xem vai trò/kỹ năng */
@media (max-width: 760px) and (max-height: 760px) {
  .me-role, .me-skill { display: none; }
  .hand { min-height: 108px; padding-top: 16px; }
  .seat .avatar { width: 38px; height: 38px; }
  .seat .role-chip { display: none; }
  .seat .stats { margin-top: 1px; }
}
@media (max-width: 760px) {
  #screen-game > .table-wrap:has(.center.big) { z-index: 7; }
  .center.big { position: fixed; inset: 0; transform: none; width: auto; max-width: none !important; margin: 0; padding: 12px; z-index: 8; display: flex; align-items: center; justify-content: center; background: rgba(20,12,6,.5); animation: fade .15s; }
  .center.big .prompt { width: min(94vw, 420px); max-height: calc(100dvh - 24px); overflow: auto; padding: 12px; box-shadow: 0 14px 40px rgba(0,0,0,.5); }
  .center.big .prompt .pcard { --w: 76px; }
  .center.big .prompt .ptitle { font-size: 16px; }
  .center.big .piles, .center.big .feed { display: none; }
}
@media (max-width: 420px) { .topbar .logo.small { display: none; } }

/* ================= RÀ SOÁT 11/2026 ================= */
/* trang chủ: ô mã phòng + nút Vào phòng gọn 1 dòng, nút đủ to để bấm */
.join-row input { flex: 1; min-width: 0; }
.join-row .btn { white-space: nowrap; flex: 0 0 auto; }
#btn-offline { min-height: 44px; font-size: 15px; }
.theme-pick button { min-height: 36px; }
.g-head .btn { white-space: nowrap; flex: 0 0 auto; }
/* thông báo nhanh trong ván: hiện ở trên, không che bài trên tay */
#screen-game.active ~ #toast { top: 62px; bottom: auto; }
/* khu trang bị trống thì ẩn luôn nhãn "Trang bị" */
.me-right.empty { display: none; }
/* điện thoại: khối thông tin của mình chiếm đủ bề ngang (không bị dạt sang phải) */
.me-cards:empty { display: none; }
@media (max-width: 760px) { .me-left .me-info { flex: 1; } #lobby-players li .btn { min-height: 36px; } #btn-leave { min-height: 40px; padding: 6px 16px; } }
/* điện thoại xoay ngang: thu gọn khu của mình để còn chỗ cho bàn chơi */
@media (max-height: 500px) and (orientation: landscape) {
  .me { grid-template-columns: auto 1fr auto; gap: 8px; padding: 2px 8px 4px; }
  .me-info { width: 230px; max-width: 32vw; padding: 5px 8px; }
  .me-cols { display: none; }
  .me-ava { width: 36px; height: 36px; } .me-range { width: 40px; height: 40px; } .me-range b { font-size: 18px; } .me-range small { font-size: 7px; }
  #me-hand.hand .pcard, .hand .pcard { --w: 60px !important; }
  .hand { min-height: 0 !important; padding: 12px 6px 2px !important; }
  .hand .pcard .cshort { display: none; } .hand .pcard { height: calc(var(--w) * 1.42); grid-template-rows: calc(var(--w) * .2) 1fr calc(var(--w) * .26); }
  #actions .btn.primary { font-size: 14px; padding: 6px 14px; }
  .me-right .pcard.sm { --w: 38px; }
  .topbar { padding: 4px 8px; }
  #card-tip { display: none; }
  .seat { width: 86px; } .seat .avatar { width: 40px; height: 40px; }
  .seat .plate { min-width: 84px; padding: 5px 4px 3px; } .seat .pname { font-size: 12px; max-width: 86px; } .seat .pchar, .seat .role-chip.hidden-role { display: none; }
  .seat .role-chip { font-size: 9px; padding: 0 5px; margin-top: 1px; }
  .hpbar i.bul { width: 7px; height: 16px; } .seat .stats span { font-size: 10px; padding: 0 4px; } .seat .stats { margin-top: 1px; }
  .hfan .backs { height: 17px; width: calc(14px + var(--n, 1) * 4px); } .hfan .backs i { width: 10px; height: 15px; margin-left: -5px; } .hfan b { font-size: 11px; }
  .dist { width: 28px; height: 28px; right: -12px; } .dist b { font-size: 13px; } .dist small { font-size: 6px; }
  .eqchip { padding: 1px; font-size: 0; gap: 0; } .eqchip b { display: none; } .eqchip img { width: 16px; height: 21px; }
  .equip.right { left: calc(50% + 30px); } .equip.left { right: calc(50% + 30px); }
  .pile, .pile-empty { width: 44px; height: 62px; } .piles .pcard.sm { --w: 44px; }
  .center { gap: 4px; } .prompt { padding: 5px 8px; font-size: 12px; } .prompt.hint { font-size: 12px; padding: 5px 10px; } .prompt .ptitle { font-size: 14px; } .feed div:not(.new) { display: none; }
}

/* ================= NÂNG CẤP: màu người chơi, né một chạm, ⏪ tóm tắt, 🐣 người mới ================= */
.pn { display: inline-block; font-weight: 800; font-style: normal; color: #fff; background: var(--pc, #6b5440); padding: 0 6px; border-radius: 999px; line-height: 1.45; text-shadow: 0 1px 0 rgba(0,0,0,.25); white-space: nowrap; }
.feed .pn { padding: 0 5px; }
.seat .pname::before, .me-info .pname::before { content: ''; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--pc, transparent); margin-right: 4px; vertical-align: 1px; box-shadow: 0 0 0 1.5px rgba(255,255,255,.7); }
.log-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.log-head h3 { margin: 0; }
.log-head .btn { min-height: 34px; font-size: 13px; padding: 3px 10px; box-shadow: 0 2px 0 var(--on); }
.log #log-list div.who { border-left: 4px solid var(--pc); padding-left: 7px; }
.log #log-list div.turnline { margin-top: 6px; font-weight: 800; border-bottom: 0; }
/* né một chạm */
.prompt .resp-row .resp-btn { background: #2f9a52; color: #fff; border-color: #1d6b37; box-shadow: 0 3px 0 #1d6b37; }
.prompt .resp-row .resp-btn .suit.red { color: #ffd0c8; } .prompt .resp-row .resp-btn .suit.black { color: #10301b; }
.prompt .resp-row .btn { min-height: 42px; }
.prompt .resp-row .btn:disabled { opacity: .6; }
/* ⏪ Lượt vừa rồi */
.recap { text-align: left; }
.recap h3 { text-align: center; }
.recap h4 { margin: 14px 0 6px; font-family: 'Oswald'; font-weight: 600; font-size: 16px; }
.rc-turn { border: 1px solid var(--line); border-radius: 12px; padding: 7px 10px; margin: 8px 0; background: rgba(255,255,255,.25); }
.rc-turn.last { border: 2px solid var(--accent, #d9a73a); background: rgba(255,214,120,.16); }
.rc-h { font-family: 'Oswald'; font-size: 15px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rc-lbl { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--on2); }
.rc-turn ul { margin: 4px 0 0; padding-left: 4px; list-style: none; }
.rc-turn li { padding: 3px 0; font-size: 14px; line-height: 1.6; }
.rc-turn i { font-style: normal; font-weight: 800; } .rc-turn i.ok { color: #2f8a4c; } .rc-turn i.bad { color: #c0392b; }
[data-theme="night"] .rc-turn i.ok { color: #7fdc9b; } [data-theme="night"] .rc-turn i.bad { color: #ff8a7a; }
.rc-none { margin: 4px 0 0; font-size: 13px; }
.rc-tally div { padding: 3px 0; font-size: 14px; line-height: 1.7; border-bottom: 1px dashed var(--line); }
.rc-hint { font-size: 13px; color: var(--on2); margin: 8px 0 12px; }
.recap > .btn { display: block; margin: 10px auto 0; }
/* 🐣 người mới */
.coach { flex-shrink: 0; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; justify-content: center; max-width: min(720px, 100%); margin: 0 auto 2px; padding: 5px 12px; border-radius: 12px; font-size: 13px; line-height: 1.35; text-align: center;
  background: #fff6d6; color: #3a2a14; border: 1px solid #e2c47c; box-shadow: 0 4px 12px rgba(0,0,0,.18); }
.coach.hidden { display: none; }
.coach .co-role { font-weight: 600; }
.coach .co-tip { color: #5b3a10; }
.coach .pn { font-size: 12px; }
.newbie-btn { margin: 6px auto 0; display: block; min-height: 40px; }
.newbie-btn.on { background: #fff1c4; border-color: #b9852a; }
.nb-note { font-size: 12px; margin: 4px 0 8px; }
.tb-opts .nb-lbl { display: none; }
@media (max-width: 760px) {
  .tb-opts .nb-lbl { display: inline; }
  .coach { font-size: 12px; padding: 4px 8px; gap: 2px 8px; margin-bottom: 0; }
  .coach .pn { font-size: 11px; }
  .rc-turn li, .rc-tally div { font-size: 13px; }
  #btn-recap { padding: 4px 6px; font-size: 12px; }
}
/* màn thấp / ngang: mẹo chỉ 1 dòng */
@media (max-height: 500px) and (orientation: landscape) {
  .coach { font-size: 11px; padding: 2px 8px; flex-wrap: nowrap; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
  .coach .co-role { display: none; }
}
#btn-recap, #btn-log-toggle { white-space: nowrap; flex: 0 0 auto; }
@media (max-width: 1180px) { #btn-recap .hide-m { display: none; } }
/* 📝 Có gì mới */
.home-help { display: flex; gap: 10px; margin-top: 16px; }
.home-help .guide-btn { margin-top: 0; flex: 1 1 0; min-height: 44px; }
.bgvn-dot { position: relative; }
.bgvn-dot::after { content: ''; position: absolute; top: 2px; right: 2px; width: 10px; height: 10px; border-radius: 50%; background: #ff4d5e; box-shadow: 0 0 0 2px #fff; }
.news-btn.bgvn-dot::after { top: -4px; right: -4px; width: 12px; height: 12px; }
@media (max-width: 380px) { .home-help .guide-btn { font-size: 14px; padding: 9px 8px; } }
/* nút của hộp nhắc đưa xuống thanh dưới (điện thoại dọc) */
#actions.prompt-acts { gap: 6px; }
#actions.prompt-acts { flex-wrap: nowrap; }
#actions.prompt-acts .btn { min-height: 44px; font-size: 14px; padding: 6px 10px; white-space: nowrap; min-width: 0; }
.me-left { position: relative; }
#actions.prompt-acts .resp-btn { background: #2f9a52; color: #fff; border-color: #1d6b37; box-shadow: 0 3px 0 #1d6b37; }
#actions.prompt-acts .resp-btn .suit.red { color: #ffd0c8; } #actions.prompt-acts .resp-btn .suit.black { color: #10301b; }
#actions.prompt-acts .btn:disabled { opacity: .6; }
.prompt .co-inline { margin-top: 3px; font-size: 12px; font-style: normal; color: var(--on); background: #fff6d6; border-radius: 8px; padding: 2px 8px; display: inline-block; }
.prompt .co-inline .pn { font-size: 11px; }
@media (min-width: 761px) { .coach { margin-bottom: 10px; } }
/* nút thả emoji: máy tính đặt ở mép dưới bàn (giữa các ghế), điện thoại dọc đưa xuống góc phải dưới */
/* màn vừa (máy tính bảng, điện thoại xoay ngang): gom cài đặt vào ⚙️ để thanh trên không tràn */
@media (min-width: 761px) and (max-width: 1100px) {
  #btn-more { display: inline-flex; }
  .topbar { position: relative; }
  .tb-opts { display: none; position: absolute; right: 8px; top: calc(100% + 6px); flex-direction: column; align-items: stretch; gap: 8px; padding: 12px; border-radius: 14px; background: linear-gradient(180deg, #2b1d12, #1e140b); box-shadow: 0 12px 30px rgba(0,0,0,.45); z-index: 20; min-width: 200px; }
  .tb-opts.open { display: flex; }
  .tb-opts select, #theme-select { max-width: none; width: 100%; padding: 6px 8px; font-size: 14px; }
  .tb-opts .vol { display: block; width: 100%; }
  .tb-opts .nb-lbl { display: inline; }
  #turn-info { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (max-width: 760px) { .me-left .me-id { min-width: 0; padding-right: 50px; } .me-left .me-id .pname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } }
@media (max-height: 500px) and (orientation: landscape) { .me-left .me-id { padding-right: 0; } }
@media (min-width: 761px) {
  .me-left:has(#coach) { flex-direction: column; align-items: stretch; gap: 8px; }
  .me-left .coach { margin: 0; max-width: none; width: 100%; justify-content: flex-start; text-align: left; box-sizing: border-box; contain: inline-size; }
}
/* điện thoại xoay ngang: hộp chọn lá (General Store, Kit Carlson…) nổi giữa màn như hộp thoại, không đè tay bài */
@media (max-height: 500px) and (orientation: landscape) {
  #screen-game > .table-wrap:has(.center.big) { z-index: 7; }
  .center.big { position: fixed; inset: 0; transform: none; width: auto; max-width: none !important; margin: 0; padding: 10px; z-index: 8; display: flex; align-items: center; justify-content: center; background: rgba(20,12,6,.5); animation: fade .15s; }
  .center.big .prompt { width: min(94vw, 560px); max-height: calc(100dvh - 20px); overflow: auto; padding: 10px; box-shadow: 0 14px 40px rgba(0,0,0,.5); }
  .center.big .prompt .pcard { --w: 70px; }
  .center.big .piles, .center.big .feed { display: none; }
}
.center.narrow .prompt .inrange, .center.narrow .prompt .co-inline { display: none; }
@media (max-width: 1100px) { .tb-opts.open #speed-select { max-width: none; width: 100%; padding: 6px 8px; font-size: 14px; } }
