/* Bài Đổi Màu – toàn bộ CSS của trò (mọi lớp dùng tiền tố doimau-, riêng ảnh trang chủ là .art-doimau). Nạp sau style.css.
   Khung cảnh: mặt bàn học gỗ, giữa bàn trải chiếu cói viền đỏ xanh; lá bài vẽ SVG trong doimau.js. */
.art-doimau { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 96'%3E%3Crect width='96' height='96' fill='%23e8cd8a'/%3E%3Cpath d='M0 2h96M0 6h96M0 10h96M0 14h96M0 18h96M0 22h96M0 26h96M0 30h96M0 34h96M0 38h96M0 42h96M0 46h96M0 50h96M0 54h96M0 58h96M0 62h96M0 66h96M0 70h96M0 74h96M0 78h96M0 82h96M0 86h96M0 90h96M0 94h96' stroke='%23b88a3a' stroke-opacity='.28' stroke-width='1.4'/%3E%3Cpath d='M2 0v96M7 0v96M12 0v96M17 0v96M22 0v96M27 0v96M32 0v96M37 0v96M42 0v96M47 0v96M52 0v96M57 0v96M62 0v96M67 0v96M72 0v96M77 0v96M82 0v96M87 0v96M92 0v96' stroke='%23fff6d6' stroke-opacity='.35' stroke-width='1'/%3E%3Crect x='2.5' y='2.5' width='91' height='91' fill='none' stroke='%23b9342b' stroke-width='5'/%3E%3Crect x='6.5' y='6.5' width='83' height='83' fill='none' stroke='%232e7d4f' stroke-width='1.6'/%3E%3Cellipse cx='48' cy='86' rx='40' ry='6' fill='%236b3d10' opacity='.18'/%3E%3Cg transform='translate(33 84) rotate(-20) scale(.86)'%3E%3Cg transform='translate(-21 -67)'%3E%3Csvg width='42' height='63' viewBox='0 0 60 90'%3E%3Crect x='.8' y='.8' width='58.4' height='88.4' rx='6.5' fill='%23fffdf4' stroke='%2324233a' stroke-width='1.3'/%3E%3Crect x='4.5' y='4.5' width='51' height='81' rx='4' fill='%232a5bc8'/%3E%3Cpath d='M4.5 9.5H55.5M4.5 14.5H55.5M4.5 19.5H55.5M4.5 24.5H55.5M4.5 29.5H55.5M4.5 34.5H55.5M4.5 39.5H55.5M4.5 44.5H55.5M4.5 49.5H55.5M4.5 54.5H55.5M4.5 59.5H55.5M4.5 64.5H55.5M4.5 69.5H55.5M4.5 74.5H55.5M4.5 79.5H55.5' stroke='%23fff' stroke-opacity='.17' stroke-width='.7'/%3E%3Cpath d='M8.5 4.5V85.5' stroke='%23fff' stroke-opacity='.35' stroke-width='.8'/%3E%3Cg transform='translate(48 13.5) scale(.78)'%3E%3Cpath d='M0-5.4C2.8-1.6 4 .4 4 2.2A4 4 0 0 1-4 2.2C-4 .4-2.8-1.6 0-5.4z' fill='%23fff'/%3E%3Cellipse cx='-1.4' cy='1.4' rx='.9' ry='1.5' fill='%23fff' opacity='.6'/%3E%3C/g%3E%3Cg transform='translate(12 76.5) scale(.78)'%3E%3Cpath d='M0-5.4C2.8-1.6 4 .4 4 2.2A4 4 0 0 1-4 2.2C-4 .4-2.8-1.6 0-5.4z' fill='%23fff'/%3E%3Cellipse cx='-1.4' cy='1.4' rx='.9' ry='1.5' fill='%23fff' opacity='.6'/%3E%3C/g%3E%3Cpath d='M14.5 24H45.5A4.5 4.5 0 0 0 50 28.5V61.5A4.5 4.5 0 0 0 45.5 66H14.5A4.5 4.5 0 0 0 10 61.5V28.5A4.5 4.5 0 0 0 14.5 24z' fill='%23fffef8' stroke='%2315378a' stroke-width='1.3'/%3E%3Cpath d='M15.5 26.6H44.5A3 3 0 0 0 47.4 29.5V60.5A3 3 0 0 0 44.5 63.4H15.5A3 3 0 0 0 12.6 60.5V29.5A3 3 0 0 0 15.5 26.6z' fill='none' stroke='%232a5bc8' stroke-width='.7' stroke-dasharray='1.6 1.2'/%3E%3Cg transform='translate(23 36) rotate(-12)'%3E%3Crect x='-5' y='-7' width='10' height='14' rx='1.8' fill='%23fff' stroke='%2315378a' stroke-width='1'/%3E%3C/g%3E%3Cg transform='translate(37 34) rotate(10)'%3E%3Crect x='-5' y='-7' width='10' height='14' rx='1.8' fill='%232a5bc8' stroke='%2315378a' stroke-width='1'/%3E%3C/g%3E%3Ctext x='30' y='60' text-anchor='middle' font-size='21' font-weight='700' fill='%232a5bc8' stroke='%2315378a' stroke-width='1.1' paint-order='stroke' font-family='Arial,Helvetica,sans-serif'%3E%2B2%3C/text%3E%3Cg transform='translate(11.5 13.5)'%3E%3Ctext x='0' y='3.6' text-anchor='middle' font-size='9' font-weight='700' fill='%23fff' stroke='%2315378a' stroke-width='2.2' paint-order='stroke' font-family='Arial,Helvetica,sans-serif'%3E%2B2%3C/text%3E%3C/g%3E%3Cg transform='rotate(180 30 45)'%3E%3Cg transform='translate(11.5 13.5)'%3E%3Ctext x='0' y='3.6' text-anchor='middle' font-size='9' font-weight='700' fill='%23fff' stroke='%2315378a' stroke-width='2.2' paint-order='stroke' font-family='Arial,Helvetica,sans-serif'%3E%2B2%3C/text%3E%3C/g%3E%3C/g%3E%3C/svg%3E%3C/g%3E%3C/g%3E%3Cg transform='translate(47 84) rotate(-2) scale(.86)'%3E%3Cg transform='translate(-21 -67)'%3E%3Csvg width='42' height='63' viewBox='0 0 60 90'%3E%3Crect x='.8' y='.8' width='58.4' height='88.4' rx='6.5' fill='%23fffdf4' stroke='%2324233a' stroke-width='1.3'/%3E%3Crect x='4.5' y='4.5' width='51' height='81' rx='4' fill='%23d8392e'/%3E%3Cpath d='M4.5 9.5H55.5M4.5 14.5H55.5M4.5 19.5H55.5M4.5 24.5H55.5M4.5 29.5H55.5M4.5 34.5H55.5M4.5 39.5H55.5M4.5 44.5H55.5M4.5 49.5H55.5M4.5 54.5H55.5M4.5 59.5H55.5M4.5 64.5H55.5M4.5 69.5H55.5M4.5 74.5H55.5M4.5 79.5H55.5' stroke='%23fff' stroke-opacity='.17' stroke-width='.7'/%3E%3Cpath d='M8.5 4.5V85.5' stroke='%23fff' stroke-opacity='.35' stroke-width='.8'/%3E%3Cg transform='translate(48 13.5) scale(.78)'%3E%3Cg fill='%23fff'%3E%3Cellipse cx='0' cy='-3.1' rx='2.3' ry='3.3' transform='rotate(0)'/%3E%3Cellipse cx='0' cy='-3.1' rx='2.3' ry='3.3' transform='rotate(72)'/%3E%3Cellipse cx='0' cy='-3.1' rx='2.3' ry='3.3' transform='rotate(144)'/%3E%3Cellipse cx='0' cy='-3.1' rx='2.3' ry='3.3' transform='rotate(216)'/%3E%3Cellipse cx='0' cy='-3.1' rx='2.3' ry='3.3' transform='rotate(288)'/%3E%3C/g%3E%3Ccircle r='1.5' fill='%23ffe27a'/%3E%3C/g%3E%3Cg transform='translate(12 76.5) scale(.78)'%3E%3Cg fill='%23fff'%3E%3Cellipse cx='0' cy='-3.1' rx='2.3' ry='3.3' transform='rotate(0)'/%3E%3Cellipse cx='0' cy='-3.1' rx='2.3' ry='3.3' transform='rotate(72)'/%3E%3Cellipse cx='0' cy='-3.1' rx='2.3' ry='3.3' transform='rotate(144)'/%3E%3Cellipse cx='0' cy='-3.1' rx='2.3' ry='3.3' transform='rotate(216)'/%3E%3Cellipse cx='0' cy='-3.1' rx='2.3' ry='3.3' transform='rotate(288)'/%3E%3C/g%3E%3Ccircle r='1.5' fill='%23ffe27a'/%3E%3C/g%3E%3Cpath d='M14.5 24H45.5A4.5 4.5 0 0 0 50 28.5V61.5A4.5 4.5 0 0 0 45.5 66H14.5A4.5 4.5 0 0 0 10 61.5V28.5A4.5 4.5 0 0 0 14.5 24z' fill='%23fffef8' stroke='%238a1d16' stroke-width='1.3'/%3E%3Cpath d='M15.5 26.6H44.5A3 3 0 0 0 47.4 29.5V60.5A3 3 0 0 0 44.5 63.4H15.5A3 3 0 0 0 12.6 60.5V29.5A3 3 0 0 0 15.5 26.6z' fill='none' stroke='%23d8392e' stroke-width='.7' stroke-dasharray='1.6 1.2'/%3E%3Ctext x='30' y='56.5' text-anchor='middle' font-size='31' font-weight='700' fill='%23d8392e' stroke='%238a1d16' stroke-width='1.1' paint-order='stroke' font-family='Arial,Helvetica,sans-serif'%3E7%3C/text%3E%3Cg transform='translate(11.5 13.5)'%3E%3Ctext x='0' y='4' text-anchor='middle' font-size='11.5' font-weight='700' fill='%23fff' stroke='%238a1d16' stroke-width='2.4' paint-order='stroke' font-family='Arial,Helvetica,sans-serif'%3E7%3C/text%3E%3C/g%3E%3Cg transform='rotate(180 30 45)'%3E%3Cg transform='translate(11.5 13.5)'%3E%3Ctext x='0' y='4' text-anchor='middle' font-size='11.5' font-weight='700' fill='%23fff' stroke='%238a1d16' stroke-width='2.4' paint-order='stroke' font-family='Arial,Helvetica,sans-serif'%3E7%3C/text%3E%3C/g%3E%3C/g%3E%3C/svg%3E%3C/g%3E%3C/g%3E%3Cg transform='translate(62 84) rotate(17) scale(.86)'%3E%3Cg transform='translate(-21 -67)'%3E%3Csvg width='42' height='63' viewBox='0 0 60 90'%3E%3Crect x='.8' y='.8' width='58.4' height='88.4' rx='6.5' fill='%23fffdf4' stroke='%2324233a' stroke-width='1.3'/%3E%3Crect x='4.5' y='4.5' width='51' height='81' rx='4' fill='%2323392f'/%3E%3Cpath d='M4.5 9.5H55.5M4.5 14.5H55.5M4.5 19.5H55.5M4.5 24.5H55.5M4.5 29.5H55.5M4.5 34.5H55.5M4.5 39.5H55.5M4.5 44.5H55.5M4.5 49.5H55.5M4.5 54.5H55.5M4.5 59.5H55.5M4.5 64.5H55.5M4.5 69.5H55.5M4.5 74.5H55.5M4.5 79.5H55.5' stroke='%23fff' stroke-opacity='.07' stroke-width='.7'/%3E%3Cpath d='M9 70c8-3 14 2 22-1s13 1 20-2' stroke='%23fff' stroke-opacity='.12' stroke-width='5' fill='none' stroke-linecap='round'/%3E%3Ccircle cx='30' cy='43' r='19' fill='none' stroke='%23f4f1e6' stroke-opacity='.7' stroke-width='1' stroke-dasharray='2.2 2'/%3E%3Cpath d='M30 45L30.6 80' stroke='%23b07a3e' stroke-width='2.6' stroke-linecap='round'/%3E%3Cg transform='translate(30 43)'%3E%3Cg transform='scale(1.12)'%3E%3Cpath d='M0 0L0-13C6.5-13 11-8.2 10-1.6z' fill='%23d8392e' stroke='%2324233a' stroke-width='1' stroke-linejoin='round' transform='rotate(0)'/%3E%3Cpath d='M0 0L0-13C6.5-13 11-8.2 10-1.6z' fill='%23eeac17' stroke='%2324233a' stroke-width='1' stroke-linejoin='round' transform='rotate(90)'/%3E%3Cpath d='M0 0L0-13C6.5-13 11-8.2 10-1.6z' fill='%232e9850' stroke='%2324233a' stroke-width='1' stroke-linejoin='round' transform='rotate(180)'/%3E%3Cpath d='M0 0L0-13C6.5-13 11-8.2 10-1.6z' fill='%232a5bc8' stroke='%2324233a' stroke-width='1' stroke-linejoin='round' transform='rotate(270)'/%3E%3Ccircle r='2.4' fill='%23fff' stroke='%2324233a' stroke-width='1'/%3E%3C/g%3E%3C/g%3E%3Cg transform='translate(11.5 13.5)'%3E%3Cg transform='scale(0.36)'%3E%3Cpath d='M0 0L0-13C6.5-13 11-8.2 10-1.6z' fill='%23d8392e' stroke='%2324233a' stroke-width='1' stroke-linejoin='round' transform='rotate(0)'/%3E%3Cpath d='M0 0L0-13C6.5-13 11-8.2 10-1.6z' fill='%23eeac17' stroke='%2324233a' stroke-width='1' stroke-linejoin='round' transform='rotate(90)'/%3E%3Cpath d='M0 0L0-13C6.5-13 11-8.2 10-1.6z' fill='%232e9850' stroke='%2324233a' stroke-width='1' stroke-linejoin='round' transform='rotate(180)'/%3E%3Cpath d='M0 0L0-13C6.5-13 11-8.2 10-1.6z' fill='%232a5bc8' stroke='%2324233a' stroke-width='1' stroke-linejoin='round' transform='rotate(270)'/%3E%3Ccircle r='2.4' fill='%23fff' stroke='%2324233a' stroke-width='1'/%3E%3C/g%3E%3C/g%3E%3Cg transform='rotate(180 30 45)'%3E%3Cg transform='translate(11.5 13.5)'%3E%3Cg transform='scale(0.36)'%3E%3Cpath d='M0 0L0-13C6.5-13 11-8.2 10-1.6z' fill='%23d8392e' stroke='%2324233a' stroke-width='1' stroke-linejoin='round' transform='rotate(0)'/%3E%3Cpath d='M0 0L0-13C6.5-13 11-8.2 10-1.6z' fill='%23eeac17' stroke='%2324233a' stroke-width='1' stroke-linejoin='round' transform='rotate(90)'/%3E%3Cpath d='M0 0L0-13C6.5-13 11-8.2 10-1.6z' fill='%232e9850' stroke='%2324233a' stroke-width='1' stroke-linejoin='round' transform='rotate(180)'/%3E%3Cpath d='M0 0L0-13C6.5-13 11-8.2 10-1.6z' fill='%232a5bc8' stroke='%2324233a' stroke-width='1' stroke-linejoin='round' transform='rotate(270)'/%3E%3Ccircle r='2.4' fill='%23fff' stroke='%2324233a' stroke-width='1'/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/svg%3E%3C/g%3E%3C/g%3E%3C/svg%3E") center/cover no-repeat; }
.doimau-svgt { font-family: "Mali", "Patrick Hand", "Comic Sans MS", cursive; }
.doimau-svg { display: block; width: 100%; height: 100%; }

/* ================= Khung cảnh: mặt bàn gỗ ================= */
body[data-scene="doimau"] {
  background-color: #b27646;
  background-image:
    radial-gradient(ellipse 70% 45% at 18% 6%, rgba(255, 228, 185, .30), transparent 70%),
    radial-gradient(ellipse 60% 50% at 90% 80%, rgba(70, 30, 5, .22), transparent 70%),
    repeating-linear-gradient(180deg, transparent 0 238px, rgba(60, 28, 6, .35) 238px 240px, rgba(255, 220, 170, .12) 240px 242px),
    repeating-linear-gradient(178.6deg, rgba(90, 45, 12, .00) 0 9px, rgba(90, 45, 12, .10) 9px 11px, rgba(255, 215, 160, .05) 11px 19px, rgba(90, 45, 12, .07) 19px 20px),
    linear-gradient(180deg, #c08750, #a5693a);
  background-attachment: fixed;
}
body[data-scene="doimau"] #app { max-width: 1000px; }

/* ================= Màn chọn ================= */
.doimau-setup { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.doimau-setup > .back, .doimau-back { justify-self: start; font: 1.2rem var(--f-hand); color: var(--ink); text-decoration: none; background: #fffdf4; border: 2px solid #24233a; border-radius: 999px; padding: .15em .8em; box-shadow: 2px 3px 0 rgba(36, 35, 58, .35); cursor: pointer; }
.doimau-resume { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; justify-content: space-between; padding: 12px 16px; background: #fff4c9; border: 3px solid #d8392e; border-radius: 16px; box-shadow: 3px 4px 0 rgba(36, 35, 58, .35); }
.doimau-resume > div:first-child { display: grid; gap: 2px; min-width: 0; }
.doimau-resume b { font: 700 1.25rem/1.15 "Mali", var(--f-hand); color: #d8392e; }
.doimau-resume span { font-size: .88rem; color: var(--text); }
.doimau-rbtn { display: flex; gap: 8px; flex-wrap: wrap; }
.doimau-head { display: flex; gap: 14px; align-items: center; background: #fffdf4; border: 2px solid #24233a; border-radius: 16px; padding: 10px 14px; box-shadow: 3px 4px 0 rgba(36, 35, 58, .3); }
.doimau-head .doimau-art { display: block; width: 76px; height: 76px; flex: none; border-radius: 12px; border: 2px solid #24233a; }
.doimau-h1 { white-space: nowrap; font: 700 clamp(1.7rem, 8.5vw, 2.4rem)/1.15 "Mali", var(--f-hand); color: #d8392e; text-shadow: 2px 2px 0 #f2c94c, 3px 3px 0 #24233a; }
.doimau-head p { margin: 4px 0 0; color: var(--muted); font-size: .95rem; }
.doimau-cols { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 880px) { .doimau-cols { grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); } }
.doimau-box, .doimau-show { background: #fffdf4; border: 2px solid #24233a; border-radius: 16px; padding: 14px 16px 16px; display: grid; gap: 12px; box-shadow: 3px 4px 0 rgba(36, 35, 58, .3); min-width: 0; }
.doimau-box h2 { font-size: 1.5rem; }
.doimau-show h3 { margin: 0; font: 400 1.4rem/1.1 var(--f-hand); color: #a8322a; }
.doimau-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 2px solid var(--ink); border-radius: 10px; overflow: hidden; min-width: 0; }
.doimau-seg button { font: 600 clamp(.78rem, 3.6vw, .92rem)/1.15 var(--f-body); padding: .55em 2px; text-wrap: balance; background: #fff; color: var(--ink); border: 0; border-left: 1.5px solid var(--ink); cursor: pointer; min-width: 0; }
.doimau-seg button:first-child { border-left: 0; }
.doimau-seg button[aria-checked="true"] { background: var(--ink); color: #fff; }
.doimau-seats-cfg { display: grid; gap: 7px; }
.doimau-seat-cfg { display: grid; grid-template-columns: 30px minmax(0, 1fr) 124px; gap: 8px; align-items: center; }
.doimau-seat-cfg input { min-width: 0; font: 1.15rem var(--f-hand); color: var(--red); border: 0; border-bottom: 1.5px dotted var(--ink-soft); background: transparent; padding: 2px; }
.doimau-seat-cfg input:focus { outline: none; border-bottom-style: solid; }
.doimau-seat-cfg input::placeholder { color: var(--muted); opacity: .85; }
.doimau-row { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 10px; align-items: center; font-size: .95rem; }
.doimau-mods { display: grid; gap: 8px; padding: 10px 12px; border: 1.5px dashed var(--ink-soft); border-radius: 12px; background: #f6f3ff; }
.doimau-chk { display: flex; gap: 10px; align-items: center; font-size: .95rem; cursor: pointer; }
.doimau-chk input { width: 20px; height: 20px; flex: none; accent-color: var(--ink); }
.doimau-stat { color: var(--ink); }
.doimau-sample { display: flex; justify-content: center; padding: 18px 0 8px; }
.doimau-sample span { width: clamp(52px, 13vw, 74px); aspect-ratio: 2 / 3; flex: none; margin-left: calc(clamp(52px, 13vw, 74px) * -.38); transform: rotate(calc((var(--i) - 3) * 6deg)) translateY(calc((var(--i) - 3) * (var(--i) - 3) * 2px)); transform-origin: 50% 120%; filter: drop-shadow(1px 2px 1px rgba(0, 0, 0, .3)); }
.doimau-sample span:first-child { margin-left: 0; }
.doimau-legend { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; font-size: .9rem; }
.doimau-legend li { display: flex; gap: 6px; align-items: center; }
.doimau-legend svg { width: 18px; height: 18px; flex: none; }
.doimau-rules { background: #fffdf4; border: 2px solid #24233a; border-radius: 16px; padding: 12px 18px; box-shadow: 3px 4px 0 rgba(36, 35, 58, .3); }
.doimau-rules summary { font-family: var(--f-hand); font-size: 1.4rem; color: var(--ink); cursor: pointer; }
.doimau-rules p, .doimau-rules li, .doimau-rtext p, .doimau-rtext li { font-size: .95rem; }
.doimau-rules ul, .doimau-rtext ul { padding-left: 1.2em; }
.doimau-rules h3, .doimau-rtext h3 { margin: 12px 0 0; font: 400 1.3rem/1.2 var(--f-hand); color: #a8322a; }
.doimau-note { color: var(--muted); font-size: .85rem !important; }

/* Mặt người chơi (chữ cái đầu) */
.doimau-av { display: grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--av); color: #fff; font: 700 .95rem/1 "Mali", var(--f-body); border: 2px solid #24233a; }

/* ================= Màn chơi ================= */
.doimau-play { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
.doimau-play > * { min-width: 0; }
.doimau-bar { display: flex; align-items: center; gap: 10px; }
.doimau-back { font-size: 1.4rem; line-height: 1.2; padding: 0 .55em; }
.doimau-bt { flex: 1; min-width: 0; display: grid; }
.doimau-bt b { font: 700 1.55rem/1.15 "Mali", var(--f-hand); color: #fffdf4; text-shadow: 2px 2px 0 #7a3f14; }
.doimau-sub { font-size: .8rem; color: #fff3dc; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 1px rgba(0, 0, 0, .4); }
.doimau-icon { background: #fffdf4; border: 2px solid #24233a; border-radius: 50%; width: 40px; height: 40px; font-size: 1.1rem; cursor: pointer; }

/* Ghế ngồi */
.doimau-seats { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 6px; }
.doimau-seat { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 6px; row-gap: 2px; align-items: center; padding: 6px 7px 5px; background: #fffdf4; border: 2px solid #8b7a66; border-radius: 12px; box-shadow: 1px 2px 0 rgba(36, 35, 58, .3); transition: transform .2s, border-color .2s, box-shadow .2s; min-width: 0; }
.doimau-seat .doimau-av { grid-row: 1 / 3; }
.doimau-sn { font: 600 .86rem/1.15 var(--f-body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.doimau-sn em { font-style: normal; font-weight: 400; font-size: .72rem; color: var(--muted); }
.doimau-cnt { display: inline-flex; align-items: center; gap: 4px; font: 700 .9rem/1 var(--f-body); color: #24233a; font-variant-numeric: tabular-nums; }
.doimau-cnt i { display: inline-block; width: 10px; height: 14px; border-radius: 2px; background: #1c3ca8; border: 1.5px solid #fffdf4; box-shadow: 0 0 0 1px #24233a, 2px -2px 0 -.5px #1c3ca8, 2px -2px 0 .5px #24233a; margin-right: 2px; }
.doimau-meta { display: flex; justify-content: space-between; align-items: center; gap: 4px; min-width: 0; }
.doimau-pts { font: 700 .72rem/1 var(--f-body); color: var(--red); font-variant-numeric: tabular-nums; white-space: nowrap; }
.doimau-seat.on { border-color: #24233a; transform: translateY(-2px); box-shadow: 0 0 0 3px #ffd84a, 2px 4px 0 rgba(36, 35, 58, .35); }
.doimau-seat.me .doimau-sn { color: var(--ink); }
.doimau-one, .doimau-nxt { position: absolute; top: -9px; right: 4px; font: 700 .66rem/1 var(--f-body); padding: .25em .5em; border-radius: 999px; white-space: nowrap; }
.doimau-one { background: #d8392e; color: #fff; border: 1.5px solid #24233a; }
.doimau-nxt { background: #fffdf4; color: var(--muted); border: 1px solid #c9bfae; font-weight: 600; }
.doimau-seat.vuln { border-style: dashed; border-color: #d8392e; }
.doimau-seat.bump .doimau-cnt { animation: doimau-bump .45s ease-out; }
.doimau-seat.skipped::after { content: "Mất lượt"; position: absolute; inset: 0; display: grid; place-items: center; border-radius: 10px; background: rgba(216, 57, 46, .88); color: #fff; font: 700 .85rem var(--f-body); animation: doimau-fade 1.1s ease-out forwards; pointer-events: none; }
.doimau-seats.shuffle .doimau-seat { animation: doimau-wiggle .5s ease-in-out; }

/* Chiếu giữa bàn */
.doimau-table {
  --pw: clamp(70px, 20vw, 112px);
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; justify-items: center; gap: 10px;
  padding: 20px 12px; border-radius: 10px; min-height: calc(var(--pw) * 1.5 + 46px);
  background-color: #e8cd8a;
  background-image:
    repeating-linear-gradient(90deg, rgba(150, 100, 30, .16) 0 2px, transparent 2px 5px),
    repeating-linear-gradient(0deg, rgba(255, 248, 215, .35) 0 2px, transparent 2px 6px),
    repeating-linear-gradient(0deg, transparent 0 34px, rgba(140, 90, 25, .22) 34px 36px),
    radial-gradient(ellipse at 50% 40%, rgba(255, 245, 210, .5), transparent 70%);
  border: 7px solid #b9342b;
  box-shadow: inset 0 0 0 3px #e8cd8a, inset 0 0 0 6px #2e7d4f, inset 0 0 26px rgba(120, 70, 10, .25), 0 8px 16px rgba(50, 20, 0, .35);
}
.doimau-drawpile { position: relative; justify-self: end; display: grid; justify-items: center; gap: 6px; padding: 0; border: 0; background: none; cursor: pointer; font: inherit; }
.doimau-stack { position: relative; display: block; width: var(--pw); aspect-ratio: 2 / 3; }
.doimau-stack svg { position: absolute; inset: 0; filter: drop-shadow(1px 2px 1px rgba(0, 0, 0, .35)); }
.doimau-stack svg:nth-child(1) { transform: translate(-4px, 4px) rotate(-4deg); }
.doimau-stack svg:nth-child(2) { transform: translate(-2px, 2px) rotate(-1.5deg); }
.doimau-drawpile:hover .doimau-stack svg:nth-child(3) { transform: translateY(-3px); }
.doimau-drawpile.low .doimau-stack svg:nth-child(1) { display: none; }
.doimau-dcount { font: 600 .78rem/1 var(--f-body); color: #5a3a12; background: rgba(255, 253, 244, .85); border-radius: 999px; padding: .25em .6em; }
.doimau-discard { position: relative; width: calc(var(--pw) * 1.05); aspect-ratio: 2 / 3; }
.doimau-discard::before { content: ""; position: absolute; inset: -18% -26%; border-radius: 50%; background: radial-gradient(closest-side, color-mix(in srgb, var(--cur) 55%, transparent) 0, color-mix(in srgb, var(--cur) 25%, transparent) 60%, transparent 100%); transition: background .3s; }
.doimau-dc { position: absolute; inset: 0; transform: rotate(var(--r)) translate(calc(var(--k) * -2px), calc(var(--k) * 1px)); filter: drop-shadow(1px 2px 1.5px rgba(0, 0, 0, .35)); }
.doimau-dc.top { transform: rotate(calc(var(--r) * .5)); }
.doimau-dc.top.land { animation: doimau-land .3s ease-out; }
.doimau-info { justify-self: start; display: grid; gap: 7px; justify-items: start; min-width: 0; }
.doimau-cur { display: inline-flex; align-items: center; gap: 5px; padding: .35em .7em; border-radius: 999px; background: var(--cur); color: #fff; font: 700 .85rem/1.1 var(--f-body); border: 2px solid #24233a; text-shadow: 0 1px 1px rgba(0, 0, 0, .35); transition: background .3s; max-width: 100%; }
.doimau-cur svg { width: 16px; height: 16px; flex: none; }
.doimau-dir { display: inline-flex; align-items: center; gap: 5px; font: 600 .8rem/1.1 var(--f-body); color: #5a3a12; background: rgba(255, 253, 244, .85); border-radius: 999px; padding: .3em .65em .3em .4em; }
.doimau-dir svg { width: 20px; height: 20px; flex: none; transition: transform .4s; }
.doimau-dir.rev svg { transform: scaleX(-1); }
.doimau-dir.spin svg { animation: doimau-spin .6s ease-in-out; }
.doimau-pend { font: 700 1.5rem/1 "Mali", var(--f-body); color: #fff; background: #d8392e; border: 2.5px solid #24233a; border-radius: 12px; padding: .15em .45em; transform: rotate(-6deg); box-shadow: 2px 3px 0 rgba(36, 35, 58, .35); animation: doimau-pulse 1s ease-in-out infinite; }

.doimau-flash { position: absolute; left: 50%; top: 4px; z-index: 3; margin: 0; max-width: calc(100% - 16px); transform: translate(-50%, -6px); opacity: 0; pointer-events: none; text-align: center;
  font: 700 .86rem/1.25 var(--f-body); color: #fff; background: #24233a; border: 2px solid #ffd84a; border-radius: 999px; padding: .35em .9em; box-shadow: 0 3px 8px rgba(0, 0, 0, .3); transition: opacity .25s, transform .25s; }
.doimau-flash.show { opacity: 1; transform: translate(-50%, 0); }
.doimau-status { margin: 0; min-height: 2.75em; display: flex; align-items: center; padding: 6px 12px; font: 1.12rem/1.2 var(--f-hand); color: var(--ink); background: rgba(255, 253, 244, .94); border: 1.5px solid #24233a; border-radius: 10px; }
.doimau-acts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; min-height: 46px; align-items: center; }
.doimau-acts .btn { box-shadow: 2px 3px 0 rgba(36, 35, 58, .35); }
.doimau-onebtn { font: 700 1.35rem/1 "Mali", var(--f-body) !important; color: #fff !important; background: #d8392e !important; border: 3px solid #24233a !important; border-radius: 16px !important; padding: .55em 1.1em !important; transform: rotate(-2deg); }
.doimau-onebtn.hot { animation: doimau-pulse .7s ease-in-out infinite; }
.doimau-called { color: #2e7d4f !important; border-color: #2e7d4f !important; cursor: default; }
.doimau-catch { background: #fff3f1 !important; }

/* Bài trên tay: xòe quạt, cuộn ngang trong vùng riêng */
.doimau-handwrap { background: rgba(50, 22, 4, .28); border-radius: 16px; padding: 8px 4px 2px; box-shadow: inset 0 2px 8px rgba(0, 0, 0, .25); }
.doimau-handlbl { margin: 0 10px; display: flex; gap: 8px; align-items: center; font: 600 .85rem/1.3 var(--f-body); color: #fff3dc; text-shadow: 0 1px 1px rgba(0, 0, 0, .5); min-height: 1.3em; }
.doimau-yt { margin-left: auto; font: 700 .78rem/1 var(--f-body); color: #24233a; background: #ffd84a; border-radius: 999px; padding: .3em .7em; text-shadow: none; }
.doimau-hand { --cw: clamp(66px, 20.5vw, 104px); display: flex; align-items: flex-end; overflow-x: auto; overflow-y: hidden; padding: 30px 12px 14px; min-height: calc(var(--cw) * 1.5 + 44px); scrollbar-width: thin; scrollbar-color: rgba(255, 243, 220, .6) transparent; overscroll-behavior-x: contain; }
.doimau-card { flex: none; width: var(--cw); aspect-ratio: 2 / 3; margin: 0 0 0 var(--ov, 0px); padding: 0; border: 0; background: none; cursor: pointer; border-radius: 11% / 7.3%; position: relative;
  transform: translateY(var(--ty, 0px)) rotate(var(--rot, 0deg)); transform-origin: 50% 140%; transition: transform .18s ease-out, opacity .2s, filter .2s; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .4)); }
.doimau-card:first-child { margin-left: auto; }
.doimau-card:last-child { margin-right: auto; }
.doimau-card.ok { transform: translateY(calc(var(--ty, 0px) - 16px)) rotate(var(--rot, 0deg)); box-shadow: 0 0 0 3px #ffd84a; }
.doimau-card.ok:hover, .doimau-card.ok:focus-visible { transform: translateY(calc(var(--ty, 0px) - 24px)) rotate(var(--rot, 0deg)); z-index: 2; }
.doimau-card.no { opacity: .5; filter: saturate(.5) brightness(.92) drop-shadow(0 1px 1px rgba(0, 0, 0, .3)); cursor: not-allowed; }
.doimau-card.chen { transform: translateY(calc(var(--ty, 0px) - 10px)) rotate(var(--rot, 0deg)); box-shadow: 0 0 0 3px #7ee08a; animation: doimau-glow 1s ease-in-out infinite; }
.doimau-card.chen::before, .doimau-card.drawn::before { content: "Chen!"; position: absolute; left: 50%; top: -20px; transform: translateX(-50%); font: 700 .7rem/1 var(--f-body); background: #2e7d4f; color: #fff; border-radius: 999px; padding: .3em .55em; white-space: nowrap; }
.doimau-card.drawn::before { content: "vừa rút"; background: #1c3ca8; }
.doimau-card.drawn { box-shadow: 0 0 0 3px #ffd84a, 0 0 0 6px #1c3ca8; }
.doimau-card.new:not(.ok):not(.drawn) { box-shadow: 0 0 0 3px rgba(255, 255, 255, .85); }
.doimau-card.nope { animation: doimau-shake .35s; }
.doimau-hand.dealt .doimau-card { animation: doimau-in .35s ease-out backwards; animation-delay: calc(var(--i) * 45ms); }
.doimau-empty { margin: auto; padding: 10px; text-align: center; font: 1.1rem/1.3 var(--f-hand); color: #fff3dc; text-shadow: 0 1px 1px rgba(0, 0, 0, .5); }
.doimau-tools { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.doimau-tools .btn { background: #fffdf4; }

.doimau-fly { position: fixed; z-index: 70; pointer-events: none; filter: drop-shadow(2px 5px 4px rgba(0, 0, 0, .35)); will-change: transform; }

/* ================= Hộp thoại ================= */
.doimau-modal { position: fixed; inset: 0; z-index: 55; display: grid; place-items: center; padding: 16px; background: rgba(36, 35, 58, .5); }
.doimau-dlg { width: min(100%, 420px); max-height: calc(100vh - 32px); overflow: auto; background: #fffdf4; border: 3px double var(--ink); border-radius: 18px; padding: 18px; display: grid; gap: 12px; text-align: center; animation: pop .22s ease-out; }
.doimau-dlg h2 { font-size: 1.7rem; line-height: 1.15; }
.doimau-dlg p { margin: 0; }
.doimau-colors { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.doimau-colors button { display: grid; justify-items: center; gap: 3px; padding: 14px 8px 10px; border-radius: 14px; border: 3px solid var(--d); background: var(--c); color: #fff; cursor: pointer; box-shadow: 0 4px 0 var(--d); text-shadow: 0 1px 1px rgba(0, 0, 0, .35); }
.doimau-colors button:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--d); }
.doimau-colors svg { width: 34px; height: 34px; }
.doimau-colors b { font: 700 1.25rem/1 "Mali", var(--f-body); }
.doimau-colors small { font-size: .78rem; opacity: .95; }
.doimau-targets { display: grid; gap: 8px; }
.doimau-targets button { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; align-items: center; text-align: left; padding: 10px 12px; border: 2px solid var(--ink); border-radius: 12px; background: #fff; cursor: pointer; font: 600 1rem var(--f-body); color: var(--text); }
.doimau-targets small { font-size: .9rem; color: var(--red); font-weight: 700; }
.doimau-cover { background: #24392f; background-image: radial-gradient(rgba(255, 255, 255, .04) 1px, transparent 1.4px); background-size: 5px 5px; }
.doimau-cover .doimau-dlg { border-color: #24233a; }
.doimau-pass { font: 1.2rem var(--f-hand); color: var(--muted); }
.doimau-cover h2 { font: 700 2.3rem/1.1 "Mali", var(--f-hand); color: #d8392e; }
.doimau-rulesdlg .doimau-dlg { width: min(100%, 640px); text-align: left; }
.doimau-rulesdlg .btn { justify-self: center; }
.doimau-res { text-align: center; }
.doimau-stamp { justify-self: center; font-family: var(--f-hand); font-size: 1.6rem; color: var(--red); border: 3px solid var(--red); border-radius: 50%; width: 92px; height: 92px; display: grid; place-items: center; transform: rotate(-12deg); line-height: 1; }
.doimau-stamp.lose { color: var(--ink); border-color: var(--ink); }
.doimau-rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; text-align: left; }
.doimau-rank li { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding: 5px 8px; border-radius: 10px; background: #f6f3ff; font-size: .92rem; }
.doimau-rank li.win { background: #fff1b8; box-shadow: inset 0 0 0 2px #e6b800; }
.doimau-rn { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doimau-rl { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.doimau-rank b { color: var(--red); font-variant-numeric: tabular-nums; min-width: 3ch; text-align: right; }
.doimau-rbtns { display: grid; gap: 8px; margin-top: 4px; }

/* ================= Hoạt cảnh ================= */
@keyframes doimau-bump { 30% { transform: scale(1.35); color: #d8392e; } }
@keyframes doimau-fade { 0% { opacity: 0; } 15%, 70% { opacity: 1; } 100% { opacity: 0; } }
@keyframes doimau-wiggle { 25% { transform: rotate(-3deg); } 75% { transform: rotate(3deg); } }
@keyframes doimau-land { from { transform: rotate(calc(var(--r) * .5)) scale(1.12); } }
@keyframes doimau-spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
@keyframes doimau-pulse { 50% { transform: rotate(-2deg) scale(1.07); } }
@keyframes doimau-glow { 50% { box-shadow: 0 0 0 5px #7ee08a; } }
@keyframes doimau-shake { 25% { translate: -5px 0; } 75% { translate: 5px 0; } }
@keyframes doimau-in { from { opacity: 0; translate: 0 -60px; } }

@media (max-width: 480px) {
  .doimau-h1 { font-size: 2rem; }
  .doimau-head .doimau-art { width: 64px; height: 64px; }
  .doimau-seat-cfg { grid-template-columns: 28px minmax(0, 1fr) 112px; }
  .doimau-table { padding: 16px 8px; gap: 8px; }
  .doimau-cur, .doimau-dir { font-size: .74rem; }
  .doimau-seat { grid-template-columns: 22px minmax(0, 1fr); column-gap: 5px; padding: 6px 6px 5px; }
  .doimau-seat .doimau-av { width: 22px; height: 22px; font-size: .78rem; border-width: 1.5px; }
  .doimau-sn { font-size: .8rem; }
  .doimau-sn em { display: none; }
  .doimau-status { font-size: 1.02rem; }
}
@media (min-width: 900px) {
  .doimau-table { padding: 24px 30px; }
}
@media (prefers-reduced-motion: reduce) {
  .doimau-card, .doimau-seat, .doimau-dir svg, .doimau-cur, .doimau-discard::before { transition: none !important; }
  .doimau-pend, .doimau-onebtn.hot, .doimau-card.chen, .doimau-hand.dealt .doimau-card, .doimau-dc.top.land, .doimau-seats.shuffle .doimau-seat, .doimau-dir.spin svg, .doimau-card.nope { animation: none !important; }
  .doimau-seat.skipped::after { display: none; }
}

/* ================= Điện thoại xoay ngang ================= */
/* Cột trái: tiêu đề, ghế (tự cuộn), trạng thái, nút, công cụ; cột phải: chiếu giữa bàn và bài trên tay, cùng nằm gọn trong màn hình. */
@media (orientation: landscape) and (max-height: 540px) {
  body[data-scene="doimau"] #app { max-width: none; }
  .doimau-play {
    --lx: clamp(52px, calc((100dvh - 142px) / 3.1), 92px);
    grid-template-columns: minmax(240px, 38%) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto auto auto;
    grid-template-areas: "bar table" "seats table" "status hand" "acts hand" "tools hand";
    column-gap: 14px; row-gap: 6px; height: calc(100dvh - 18px);
  }
  .doimau-bar { grid-area: bar; gap: 4px; }
  .doimau-back { min-height: 40px; min-width: 44px; padding: 0 .3em; }
  .doimau-bar .rot-btn { min-height: 40px; }
  .doimau-bt b { font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-top: .1em; }
  .doimau-seats { grid-area: seats; align-content: start; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 10px 2px 4px; }
  .doimau-status { grid-area: status; min-height: 2.5em; font-size: 1.02rem; padding: 4px 10px; }
  .doimau-acts { grid-area: acts; min-height: 40px; gap: 6px; }
  .doimau-acts .btn { min-height: 40px; padding-block: .3em; }
  .doimau-onebtn { font-size: 1.1rem !important; padding: .35em .9em !important; }
  .doimau-tools { grid-area: tools; display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 6px; }
  .doimau-tools .btn { min-height: 40px; padding: .2em .3em; font-size: .8rem; line-height: 1.15; }
  .doimau-table { --pw: var(--lx); grid-area: table; align-self: start; min-height: 0; padding: 8px 10px; gap: 8px; }
  .doimau-handwrap { grid-area: hand; align-self: end; padding-top: 4px; }
  .doimau-hand { --cw: var(--lx); padding: 26px 10px 8px; min-height: calc(var(--cw) * 1.5 + 34px); }
}
