/* Cờ tỷ phú – toàn bộ CSS của trò (mọi lớp dùng tiền tố typhu-). Tách khỏi style.css; nạp ngay sau style.css.
   Bảng màu riêng rực rỡ hơn portal: bàn bìa cứng in màu, khung đỏ son, nền kem ấm. Đơn vị cqw tính theo bề ngang bàn cờ. */
.typhu-art {
  background-color: #fcfcf7;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 92'%3E%3Cg transform='rotate(-6 70 46)'%3E%3Crect x='34' y='10' width='72' height='72' fill='%23fff' stroke='%231c3ca8' stroke-width='2.5'/%3E%3Crect x='48' y='24' width='44' height='44' fill='none' stroke='%231c3ca8' stroke-width='1.5'/%3E%3Cpath fill='%238a5a3b' d='M78 68h14v5H78z'/%3E%3Cpath fill='%236fbfe0' d='M48 68h14v5H48z'/%3E%3Cpath fill='%23d6589b' d='M43 54h5v14h-5z'/%3E%3Cpath fill='%23e98a2c' d='M43 24h5v14h-5z'/%3E%3Cpath fill='%23d33a33' d='M48 19h14v5H48z'/%3E%3Cpath fill='%23e3bd2a' d='M78 19h14v5H78z'/%3E%3Cpath fill='%233a9a55' d='M92 24h5v14h-5z'/%3E%3Cpath fill='%2327449a' d='M92 54h5v14h-5z'/%3E%3C/g%3E%3Cg stroke='%2324233a' stroke-width='2'%3E%3Crect x='124' y='30' width='26' height='26' rx='5' fill='%23fff' transform='rotate(12 137 43)'/%3E%3Crect x='156' y='40' width='26' height='26' rx='5' fill='%23fff' transform='rotate(-10 169 53)'/%3E%3C/g%3E%3Cg fill='%23c3262c'%3E%3Ccircle cx='131' cy='37' r='2.6'/%3E%3Ccircle cx='137' cy='43' r='2.6'/%3E%3Ccircle cx='143' cy='49' r='2.6'/%3E%3Ccircle cx='163' cy='47' r='2.6'/%3E%3Ccircle cx='175' cy='59' r='2.6'/%3E%3Ccircle cx='163' cy='59' r='2.6'/%3E%3Ccircle cx='175' cy='47' r='2.6'/%3E%3C/g%3E%3C/svg%3E"),
    repeating-linear-gradient(180deg, transparent 0 5px, rgba(112,96,196,.2) 5px 6px);
}

/* ================= Màn chọn người chơi ================= */
.typhu-setup { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
.typhu-head { display: flex; gap: 16px; align-items: center; }
.typhu-head .typhu-art { display: block; width: 132px; height: 70px; flex: none; border: 2px solid var(--ink); border-radius: 10px; background-size: cover; background-position: center; }
.typhu-h1 { font: 700 2.5rem/1.15 "Mali", var(--f-hand); color: #e8432f; text-shadow: 2px 2px 0 #ffd23f, 3px 3px 0 #24233a; letter-spacing: .01em; }
.typhu-head p { margin: 2px 0 0; color: var(--muted); }
.typhu-box { background: var(--label); border: 2px solid var(--ink); border-radius: 14px; padding: 14px 16px 16px; display: grid; gap: 12px; max-width: 560px; }
.typhu-box h2 { font-size: 1.5rem; }
.typhu-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 2px solid var(--ink); border-radius: 10px; overflow: hidden; }
.typhu-seg button { font: 500 .92rem/1.15 var(--f-body); padding: .55em 6px; background: var(--label); color: var(--ink); border: 0; border-left: 1.5px solid var(--ink); cursor: pointer; }
.typhu-seg button:first-child { border-left: 0; }
.typhu-seg button[aria-checked="true"] { background: var(--ink); color: #fff; }
.typhu-seats { display: grid; gap: 8px; }
.typhu-seat { display: grid; grid-template-columns: 34px minmax(0, 1fr) 128px; gap: 8px; align-items: center; }
.typhu-seat 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; }
.typhu-seat input:focus { outline: none; border-bottom-style: solid; }
.typhu-seat input::placeholder { color: var(--muted); opacity: .8; }
.typhu-tk { display: inline-block; width: 30px; height: 30px; flex: none; vertical-align: middle; }
.typhu-tk svg, .typhu-token svg { display: block; width: 100%; height: 100%; }
.typhu-chk { display: flex; gap: 10px; align-items: center; font-size: .95rem; cursor: pointer; }
.typhu-chk input { width: 20px; height: 20px; accent-color: var(--ink); }
.typhu-row { display: flex; gap: 10px; align-items: center; font-size: .95rem; }
.typhu-row .typhu-seg { flex: 1; max-width: 220px; }
.typhu-show { max-width: 560px; display: grid; gap: 14px; padding: 14px 16px 16px; background: #fff7e3; border: 2px solid #24233a; border-radius: 14px; box-shadow: 3px 4px 0 rgba(168, 50, 42, .25); }
.typhu-show h3 { margin: 0 0 6px; font: 400 1.3rem/1.1 var(--f-hand); color: #a8322a; }
.typhu-lv { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; text-align: center; }
.typhu-lv li { display: grid; justify-items: center; gap: 2px; }
.typhu-lv svg { width: 100%; max-width: 64px; height: auto; }
.typhu-lv span { font: .8rem/1.15 var(--f-body); color: var(--text); }
.typhu-notes { list-style: none; margin: 0; padding: 4px 0 0; display: flex; flex-wrap: wrap; gap: 6px 4px; }
.typhu-notes li { width: calc((100% - 12px) / 4); max-width: 110px; transform: rotate(-3deg); filter: drop-shadow(1px 2px 0 rgba(36, 35, 58, .25)); }
.typhu-notes li:nth-child(even) { transform: rotate(2.5deg); }
.typhu-notes svg { display: block; width: 100%; height: auto; }
.typhu-rules { background: var(--label); border: 1.5px dashed var(--ink-soft); border-radius: 14px; padding: 12px 18px; max-width: 72ch; }
.typhu-rules summary { font-family: var(--f-hand); font-size: 1.4rem; color: var(--ink); cursor: pointer; }
.typhu-rules p, .typhu-rules li { font-size: .95rem; }
.typhu-rules ul { padding-left: 1.2em; }
.typhu-note { color: var(--muted); font-size: .85rem !important; }
.typhu-svgh { font-family: var(--f-hand); }
.typhu-svgt { font-family: "Mali", var(--f-hand); }

/* ================= Màn chơi ================= */
.typhu-play { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
.typhu-bar { display: flex; align-items: center; gap: 10px; }
.typhu-back { font: 1.6rem var(--f-hand); color: var(--ink); background: none; border: 0; padding: 0 6px; cursor: pointer; }
.typhu-bt { flex: 1; min-width: 0; display: grid; }
.typhu-bt b { font: 700 1.5rem/1.15 "Mali", var(--f-hand); color: #e8432f; text-shadow: 1px 1px 0 #ffd23f, 2px 2px 0 #24233a; }
.typhu-sub { font-size: .8rem; line-height: 1.3; color: var(--muted); }
.typhu-icon { background: none; border: 0; font-size: 1.3rem; cursor: pointer; padding: 6px; }
.typhu-layout { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 900px) { .typhu-layout { grid-template-columns: minmax(0, 1fr) 290px; } }

/* Khung bàn: tấm bìa cứng viền đỏ son, có bề dày */
.typhu-frame {
  justify-self: center; width: 100%; max-width: min(100%, 80vh); padding: 1.7%;
  background: #b5372c repeating-linear-gradient(45deg, transparent 0 6px, rgba(255, 255, 255, .06) 6px 12px);
  border: 2px solid #24233a; border-radius: 10px;
  box-shadow: inset 0 0 0 3px #e9b23c, 0 2px 0 #7d2119, 0 4px 0 #7d2119, 0 5px 0 #24233a, 0 10px 18px rgba(36, 35, 58, .28);
}
.typhu-board {
  position: relative; container-type: inline-size; width: 100%; aspect-ratio: 1;
  display: grid; grid-template-columns: 1.5fr repeat(9, 1fr) 1.5fr; grid-template-rows: 1.5fr repeat(9, 1fr) 1.5fr;
  background: #fff8e8; border: 2px solid #24233a; border-radius: 3px;
}
.typhu-cell {
  position: relative; min-width: 0; min-height: 0; overflow: hidden; padding: 0; margin: 0; cursor: pointer;
  font: inherit; color: #24233a; background: #fffaf0; border: 0; outline-offset: -3px;
  box-shadow: inset 0 0 0 .6px rgba(36, 35, 58, .7); display: flex;
}
.typhu-cell:hover { filter: brightness(.97); }
.typhu-b { flex-direction: column; }
.typhu-t { flex-direction: column-reverse; }
.typhu-l { flex-direction: row-reverse; }
.typhu-r { flex-direction: row; }
.typhu-band, .typhu-ic { flex: none; display: grid; place-items: center; }
.typhu-band { background: var(--gc); box-shadow: inset 0 0 0 .6px rgba(36, 35, 58, .7), inset 0 -.5cqw 0 rgba(255, 255, 255, .22); }
.typhu-b .typhu-band, .typhu-t .typhu-band { height: 3.9cqw; }
.typhu-l .typhu-band, .typhu-r .typhu-band { width: 3.9cqw; }
.typhu-ic svg { display: block; width: 4.2cqw; height: 4.2cqw; }
.typhu-b .typhu-ic { height: 4.5cqw; padding-top: .3cqw; }
.typhu-t .typhu-ic { height: 4.5cqw; padding-bottom: .3cqw; }
.typhu-l .typhu-ic, .typhu-r .typhu-ic { width: 4.6cqw; }
.typhu-t-co .typhu-ic svg, .typhu-t-thu .typhu-ic svg { width: 6cqw; height: 6cqw; }
.typhu-b.typhu-t-co .typhu-ic, .typhu-t.typhu-t-co .typhu-ic, .typhu-b.typhu-t-thu .typhu-ic, .typhu-t.typhu-t-thu .typhu-ic { height: 6.6cqw; }
.typhu-l.typhu-t-co .typhu-ic, .typhu-r.typhu-t-co .typhu-ic, .typhu-l.typhu-t-thu .typhu-ic, .typhu-r.typhu-t-thu .typhu-ic { width: 4.8cqw; }
/* ô cạnh bên chật: biểu tượng thẻ cùng cỡ các ô khác để chữ không bị đè */
.typhu-l.typhu-t-co .typhu-ic svg, .typhu-r.typhu-t-co .typhu-ic svg, .typhu-l.typhu-t-thu .typhu-ic svg, .typhu-r.typhu-t-thu .typhu-ic svg { width: 4.5cqw; height: 4.5cqw; }
.typhu-t-co { background: #fff0ea; }
.typhu-t-thu { background: #fff7d6; }
.typhu-t-tax { background: #f4ecdf; }
.typhu-txt { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: .15cqw; padding: .35cqw .2cqw .9cqw; text-align: center; overflow: hidden; }
.typhu-t .typhu-txt { padding: .9cqw .2cqw .35cqw; }
.typhu-t .typhu-txt { flex-direction: column-reverse; }
.typhu-l .typhu-txt, .typhu-r .typhu-txt { justify-content: center; padding: .3cqw .2cqw; }
.typhu-l .typhu-txt { padding-left: .9cqw; }
.typhu-r .typhu-txt { padding-right: .9cqw; }
.typhu-nm { display: block; flex: none; width: 100%; font: 600 calc(2.5cqw * var(--fs, 1))/1.16 var(--f-cond); color: #24233a; white-space: pre; overflow: visible; letter-spacing: 0; }
.typhu-pr { display: block; flex: none; font: 700 calc(2.15cqw * var(--fp, 1))/1.15 var(--f-cond); color: #7a4d14; white-space: nowrap; letter-spacing: -.02em; }
.typhu-t-tax .typhu-pr { color: #c3262c; }
.typhu-hs { position: relative; display: grid; place-items: center; width: 100%; height: 100%; }
.typhu-bld { display: block; width: 4.2cqw; height: 4.2cqw; filter: drop-shadow(0 .25cqw 0 rgba(36, 35, 58, .35)); }
.typhu-hs .typhu-bld { background: rgba(255, 255, 255, .78); border-radius: .8cqw; padding: .15cqw; }
.typhu-up .typhu-bld { animation: typhu-build .55s cubic-bezier(.3, 1.6, .5, 1); }
.typhu-down .typhu-bld { animation: typhu-sell .45s ease-out; }
@keyframes typhu-build { 0% { transform: translateY(40%) scale(.2); } 60% { transform: translateY(-35%) scale(1.3); } 100% { transform: none; } }
@keyframes typhu-sell { 0% { transform: scale(1.35) rotate(-14deg); filter: grayscale(1); } 50% { transform: scale(.8) rotate(8deg); } 100% { transform: none; } }
.typhu-puff { position: absolute; left: 50%; top: 40%; z-index: 4; transform: translate(-50%, 0); font: 600 2.2cqw/1 var(--f-body); color: #c3262c; background: #fff; border-radius: 1cqw; padding: .3cqw .6cqw; white-space: nowrap; pointer-events: none; animation: typhu-puff .9s ease-out forwards; }
@keyframes typhu-puff { to { transform: translate(-50%, -160%); opacity: 0; } }

/* Ô đã có chủ: nền nhuốm màu chủ, dải màu ở mép ngoài, lá cờ nhỏ */
.typhu-owned { background-color: #fffaf0; background-image: linear-gradient(var(--ot), var(--ot)); }
.typhu-own { position: absolute; pointer-events: none; display: none; background: var(--oc); }
.typhu-owned .typhu-own { display: block; }
.typhu-b .typhu-own { left: 0; right: 0; bottom: 0; height: .75cqw; }
.typhu-t .typhu-own { left: 0; right: 0; top: 0; height: .75cqw; }
.typhu-l .typhu-own { top: 0; bottom: 0; left: 0; width: .75cqw; }
.typhu-r .typhu-own { top: 0; bottom: 0; right: 0; width: .75cqw; }
.typhu-flag { position: absolute; display: none; width: 2.1cqw; height: 2cqw; z-index: 1; pointer-events: none; background: #24233a; clip-path: polygon(0 0, 100% 50%, 0 100%); }
.typhu-flag::after { content: ""; position: absolute; left: .25cqw; top: .35cqw; width: 1.5cqw; height: 1.3cqw; background: var(--oc); clip-path: polygon(0 0, 100% 50%, 0 100%); }
.typhu-owned .typhu-flag { display: block; }
.typhu-b .typhu-flag { left: .15cqw; top: .95cqw; }
.typhu-t .typhu-flag { left: .15cqw; bottom: .95cqw; }
.typhu-l .typhu-flag { right: .9cqw; top: .15cqw; }
.typhu-r .typhu-flag { left: .9cqw; top: .15cqw; }
.typhu-mort .typhu-txt, .typhu-mort .typhu-band { opacity: .5; }
.typhu-mort::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(45deg, transparent 0 1cqw, rgba(195, 38, 44, .28) 1cqw 1.35cqw); }
.typhu-here { box-shadow: inset 0 0 0 .55cqw #ffb703, inset 0 0 0 .8cqw rgba(36, 35, 58, .5); }

/* 4 góc */
.typhu-c { display: block; }
.typhu-corner, .typhu-corner svg { display: block; width: 100%; height: 100%; }

/* Quân cờ: đi trên đường riêng phía trong các ô, không che tên ô */
.typhu-tokens { position: absolute; inset: 0; pointer-events: none; z-index: 6; }
.typhu-token { position: absolute; width: var(--sz, 5cqw); height: var(--sz, 5cqw); transform: translate(-50%, -50%); transition: left .14s ease-out, top .14s ease-out, width .2s, height .2s; }
.typhu-token::before { content: ""; position: absolute; left: 6%; right: 6%; bottom: -8%; height: 34%; border-radius: 50%; background: var(--tc); opacity: .45; }
.typhu-token.typhu-me::before { opacity: 1; box-shadow: 0 0 0 .3cqw #fff, 0 0 0 .55cqw #24233a; }
.typhu-tki { position: relative; display: block; width: 100%; height: 100%; filter: drop-shadow(0 .35cqw .25cqw rgba(0, 0, 0, .4)); }
.typhu-jailed .typhu-tki { filter: grayscale(.35) drop-shadow(0 .2cqw .2cqw rgba(0, 0, 0, .4)); }
.typhu-hop { animation: typhu-hop .16s ease-out; }
@keyframes typhu-hop { 45% { transform: translateY(-38%) scale(1.12); } }

/* Trung tâm bàn: đường đi + tấm bìa giữa */
.typhu-center { grid-area: 2 / 2 / 11 / 11; position: relative; min-width: 0; min-height: 0; padding: 6cqw; background: #f3dfb4; }
.typhu-center::before { content: ""; position: absolute; inset: 3cqw; border: .3cqw dashed rgba(122, 77, 20, .5); border-radius: 1.6cqw; pointer-events: none; }
.typhu-ctr {
  position: relative; height: 100%; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.2cqw;
  padding: 1.4cqw 2cqw; text-align: center; border: .4cqw solid #24233a; border-radius: 2.2cqw;
  background: radial-gradient(circle at 50% 42%, rgba(255, 253, 245, .95) 0 22%, rgba(255, 253, 245, 0) 62%), repeating-conic-gradient(from 0deg at 50% 42%, #fff1cf 0 7.5deg, #ffe6b0 7.5deg 15deg);
  box-shadow: inset 0 0 0 .7cqw rgba(255, 255, 255, .55);
}
.typhu-logo { display: grid; justify-items: center; transform: rotate(-3deg); }
.typhu-logo b {
  position: relative; display: block; font: 700 7.2cqw/1.2 "Mali", var(--f-hand); color: #e8432f; letter-spacing: .01em; white-space: nowrap;
  -webkit-text-stroke: .45cqw #24233a; paint-order: stroke fill; text-shadow: .35cqw .55cqw 0 #24233a;
  padding: .1cqw 3.2cqw .5cqw; background: #ffd23f; border: .4cqw solid #24233a; border-radius: 1.6cqw; box-shadow: .6cqw .8cqw 0 rgba(168, 50, 42, .9);
}
.typhu-logo b::before, .typhu-logo b::after { content: "★"; position: absolute; top: 50%; transform: translateY(-50%); font-size: 2.6cqw; -webkit-text-stroke: 0; text-shadow: none; color: #e8432f; }
.typhu-logo b::before { left: .8cqw; }
.typhu-logo b::after { right: .8cqw; }
.typhu-logo small { margin-top: 1cqw; font: 700 clamp(8px, 1.9cqw, 12px)/1 var(--f-body); color: #7a4d14; letter-spacing: .14em; text-transform: uppercase; }
.typhu-mid { display: flex; align-items: center; gap: 2.6cqw; }
.typhu-deck { position: relative; display: block; width: 8.4cqw; aspect-ratio: 60 / 84; border: .25cqw solid #24233a; border-radius: .9cqw; overflow: hidden; transform: rotate(-7deg);
  box-shadow: .35cqw .35cqw 0 #fff, .6cqw .6cqw 0 #24233a, .95cqw .95cqw 0 #fff, 1.2cqw 1.2cqw 0 rgba(36, 35, 58, .55); }
.typhu-deck-thu { transform: rotate(6deg); }
.typhu-deck svg { display: block; width: 100%; height: 100%; }
.typhu-draw { animation: typhu-draw .45s ease-out; }
@keyframes typhu-draw { 40% { transform: translateY(-25%) rotate(0deg) scale(1.08); } }
.typhu-tray { display: flex; gap: 2cqw; padding: 1.5cqw 2.2cqw; border: .7cqw solid #8a5a32; border-radius: 2.4cqw; background: radial-gradient(ellipse at 50% 35%, #45a862, #23683a); box-shadow: inset 0 .5cqw 1cqw rgba(0, 0, 0, .4), 0 0 0 .25cqw #24233a, .4cqw .6cqw 0 rgba(36, 35, 58, .35); transition: box-shadow .3s; }
.typhu-tray.typhu-dbl { box-shadow: inset 0 .5cqw 1cqw rgba(0, 0, 0, .4), 0 0 0 .25cqw #24233a, 0 0 0 .9cqw #ffd23f; }
.typhu-die { width: 7.6cqw; height: 7.6cqw; display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 1.1cqw; gap: .25cqw; border: .22cqw solid #24233a; border-radius: 1.6cqw;
  background: linear-gradient(150deg, #fff 0 55%, #ebe4d6); box-shadow: inset -.4cqw -.5cqw 0 rgba(0, 0, 0, .1), .3cqw .7cqw .5cqw rgba(0, 0, 0, .45); }
.typhu-die i { border-radius: 50%; }
.typhu-die i.on { background: radial-gradient(circle at 35% 35%, #5a5870, #14131f 70%); }
.typhu-die.typhu-one i.on { background: radial-gradient(circle at 35% 35%, #ff8a7a, #c3262c 70%); transform: scale(1.35); }
.typhu-rolling.typhu-r0 { animation: typhu-tumble .3s linear infinite; }
.typhu-rolling.typhu-r1 { animation: typhu-tumble .3s linear infinite reverse; }
@keyframes typhu-tumble { 0% { transform: translate(0, 0) rotate(0); } 25% { transform: translate(18%, -22%) rotate(90deg); } 50% { transform: translate(0, -8%) rotate(180deg); } 75% { transform: translate(-18%, -20%) rotate(270deg); } 100% { transform: rotate(360deg); } }
.typhu-landed { animation: typhu-land .3s ease-out; }
@keyframes typhu-land { 0% { transform: scale(1.18) rotate(-8deg); } 60% { transform: scale(.94) rotate(3deg); } }
.typhu-turn { margin: 0; display: flex; align-items: center; gap: 1cqw; font: clamp(14px, 3.6cqw, 24px)/1.1 var(--f-hand); color: #24233a; max-width: 100%; }
.typhu-turn > span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.typhu-turn .typhu-tk { width: clamp(17px, 4.4cqw, 28px); height: clamp(17px, 4.4cqw, 28px); }
.typhu-msg { margin: 0; min-height: 2.5em; font-size: clamp(11px, 2.6cqw, 15.5px); line-height: 1.25; color: #24233a; max-width: 46ch; }
.typhu-btns { display: flex; flex-wrap: wrap; gap: 1.2cqw; justify-content: center; }
.typhu-btns .btn { font-size: clamp(12px, 2.7cqw, 16px); padding: .5em .75em; }
.typhu-btns .btn:disabled { opacity: .45; cursor: not-allowed; }
.typhu-rollbtn { padding-inline: 1.4em !important; background: #e8432f !important; border-color: #24233a !important; box-shadow: 2px 3px 0 #24233a !important; }
.typhu-feed { list-style: none; margin: 0; padding: 0; display: grid; gap: .2cqw; width: 100%; font-size: clamp(10px, 2.1cqw, 13px); line-height: 1.25; color: #6b5a44; }
.typhu-feed li { overflow-wrap: anywhere; }
.typhu-feed li:first-child { color: #24233a; }
@media (max-width: 520px) { .typhu-feed li:nth-child(3) { display: none; } }

/* Lớp hiện thẻ rút / giấy chủ quyền giữa bàn */
.typhu-pop { position: absolute; inset: 6cqw; z-index: 7; display: grid; place-items: center; border-radius: 2.2cqw; background: rgba(36, 35, 58, .28); perspective: 800px; }
.typhu-flip { position: relative; width: min(92%, 62cqw); transform-style: preserve-3d; animation: typhu-flip .75s ease-out both; }
@keyframes typhu-flip { 0% { transform: translateY(25%) scale(.35) rotateY(180deg); opacity: 0; } 20% { opacity: 1; } 50% { transform: scale(1) rotateY(180deg); } 100% { transform: rotateY(0); } }
.typhu-face { -webkit-backface-visibility: hidden; backface-visibility: hidden; border: .45cqw solid #24233a; border-radius: 2cqw; box-shadow: .8cqw 1.2cqw 0 rgba(36, 35, 58, .45); }
.typhu-front { position: relative; display: grid; gap: 1.2cqw; padding: 0 0 1.4cqw; background: #fffdf6; overflow: hidden; }
.typhu-cback { position: absolute; inset: 0; transform: rotateY(180deg); display: grid; place-items: center; overflow: hidden; }
.typhu-cback svg { height: 100%; width: auto; }
.typhu-bk-co { background: #e8432f; }
.typhu-bk-thu { background: #fff3c4; }
.typhu-cfh { display: flex; align-items: center; justify-content: center; gap: 1.2cqw; padding: 1.2cqw 2cqw; border-bottom: .35cqw solid #24233a; }
.typhu-cfh span svg { display: block; width: 5.4cqw; height: 5.4cqw; }
.typhu-cfh b { font: 700 clamp(15px, 4cqw, 26px)/1.1 "Mali", var(--f-hand); }
.typhu-cf-co .typhu-cfh { background: #e8432f; color: #fff; }
.typhu-cf-co .typhu-cfh b { -webkit-text-stroke: .3cqw #24233a; paint-order: stroke fill; }
.typhu-cf-thu .typhu-cfh { background: #fff3c4 repeating-linear-gradient(135deg, #d1312f 0 2cqw, transparent 2cqw 3cqw, #2f6fb3 3cqw 5cqw, transparent 5cqw 6cqw) top / 100% 1.2cqw no-repeat; color: #1f5c9b; padding-top: 2cqw; }
.typhu-front p { margin: 0; padding: 0 3cqw; font: clamp(14px, 3.6cqw, 22px)/1.25 var(--f-hand); color: #24233a; }
.typhu-front small { justify-self: end; padding: 0 2.4cqw; font: 600 clamp(8px, 1.8cqw, 11px)/1 var(--f-body); color: #a8322a; letter-spacing: .12em; text-transform: uppercase; }

/* Giấy chủ quyền (lớn trong hộp thoại, nhỏ khi vừa mua) */
.typhu-deed { background: #fffdf4; }
.typhu-dh { display: grid; justify-items: center; gap: 1px; text-align: center; padding: 6px 10px 8px; background: #fff; border: 7px solid var(--gc, #24233a); border-top-width: 18px; box-shadow: 0 0 0 2px #24233a; }
.typhu-dh-plain { --gc: #24233a; }
.typhu-dh small { font: 700 .68rem/1.2 var(--f-body); letter-spacing: .12em; text-transform: uppercase; color: #7a4d14; }
.typhu-dh b { font: 700 1.45rem/1.15 "Mali", var(--f-hand); color: #24233a; }
.typhu-dh span { font-size: .82rem; color: var(--muted); }
.typhu-dic { display: grid; place-items: center; }
.typhu-dic svg { width: 84px; height: 84px; }
.typhu-dic-big svg { width: 150px; height: 150px; border: 2px solid #24233a; border-radius: 6px; }
.typhu-dic-card svg { width: 80px; height: 112px; border: 2px solid #24233a; border-radius: 8px; transform: rotate(-5deg); }
.typhu-dtxt { text-align: center; }
.typhu-rent { width: 100%; border-collapse: collapse; font-size: .92rem; }
.typhu-rent td { padding: 3px 4px; border-bottom: 1px dotted #b49a74; vertical-align: middle; }
.typhu-rent td:last-child { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.typhu-rent td small { display: block; font-size: .72rem; color: var(--muted); line-height: 1.1; }
.typhu-ri { width: 46px; }
.typhu-ri .typhu-bld { width: 40px; height: 40px; filter: drop-shadow(1px 2px 0 rgba(36, 35, 58, .25)); }
.typhu-lot { display: block; width: 38px; height: 20px; margin: 10px auto; border: 1.5px dashed #7a4d14; border-bottom: 4px solid #3b7d3a; border-radius: 3px 3px 0 0; background: #f7efd9; }
.typhu-rent tr.cur td { background: #fff1b8; color: #a8322a; }
.typhu-rent tr.cur td:first-child { box-shadow: inset 4px 0 0 #e8432f; }
.typhu-dfoot { display: flex; justify-content: space-around; gap: 6px; text-align: center; padding: 6px 0 2px; border-top: 2px solid #24233a; margin-top: 2px !important; }
.typhu-dfoot span { display: grid; font-size: .74rem; color: var(--muted); }
.typhu-dfoot b { font: 700 1rem var(--f-body); color: #24233a; }
.typhu-dstamp { justify-self: center; margin: 4px 0 0 !important; padding: 3px 12px; font: 700 .95rem/1.2 "Mali", var(--f-hand); color: var(--tc); border: 2.5px solid var(--tc); border-radius: 8px; transform: rotate(-4deg); background: rgba(255, 255, 255, .6); text-align: center; }
.typhu-dfree { text-align: center; color: var(--muted); font-style: italic; }
.typhu-mini { width: min(94%, 64cqw); display: grid; gap: 1cqw; padding: 1.6cqw; border: .45cqw solid #24233a; border-radius: 1.6cqw; box-shadow: .8cqw 1.2cqw 0 rgba(36, 35, 58, .45); animation: typhu-deed .45s cubic-bezier(.3, 1.4, .5, 1) both; }
@keyframes typhu-deed { from { transform: translateY(30%) rotate(-8deg) scale(.5); opacity: 0; } }
.typhu-mini .typhu-dh { padding: .6cqw 1.6cqw 1cqw; border-width: 1.2cqw; border-top-width: 2.8cqw; }
.typhu-mini .typhu-dh small { font-size: clamp(8px, 1.9cqw, 11px); }
.typhu-mini .typhu-dh b { font-size: clamp(14px, 3.8cqw, 22px); }
.typhu-mrent { width: 100%; border-collapse: collapse; font: 600 clamp(10px, 2.4cqw, 14px)/1.1 var(--f-body); color: #24233a; }
.typhu-mrent td { padding: .3cqw .4cqw; border-bottom: 1px dotted #b49a74; text-align: right; font-variant-numeric: tabular-nums; }
.typhu-mrent td:nth-child(odd) { text-align: center; font-weight: 400; font-size: .92em; }
.typhu-mrent .typhu-bld { width: 5cqw; height: 5cqw; display: inline-block; vertical-align: middle; }
.typhu-mini .typhu-dic svg { width: 12cqw; height: 12cqw; }
.typhu-mini .typhu-dstamp { font-size: clamp(11px, 2.8cqw, 16px); }

/* Bảng người chơi: xấp tiền xòe + số tiền nhảy */
.typhu-side { display: grid; gap: 10px; min-width: 0; }
.typhu-players { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); }
@media (min-width: 900px) { .typhu-players { grid-template-columns: 1fr; } }
.typhu-pl { position: relative; display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; grid-template-areas: "tk nm nm" "fan fan cash" "sm sm sm" "ch ch ch"; gap: 3px 8px; align-items: center;
  padding: 7px 9px 8px; background: #fffdf6; border: 2px solid #d8cdb5; border-left: 6px solid var(--tc); border-radius: 12px; transition: border-color .2s, box-shadow .2s; }
.typhu-pl .typhu-tk { grid-area: tk; }
.typhu-pl.on { border-color: #24233a; border-left-color: var(--tc); box-shadow: 3px 4px 0 rgba(36, 35, 58, .25), 0 0 0 3px #ffd23f; }
.typhu-pl.out { opacity: .5; }
.typhu-pl.out .typhu-pn { text-decoration: line-through; }
.typhu-pn { grid-area: nm; min-width: 0; font-weight: 600; font-size: .93rem; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.typhu-pn em { font-style: normal; color: var(--muted); font-weight: 400; font-size: .85em; }
.typhu-cash { grid-area: cash; justify-self: end; font: 700 1.2rem var(--f-body); color: #a8322a; font-variant-numeric: tabular-nums; white-space: nowrap; }
.typhu-cash.typhu-bump { animation: typhu-cash .45s ease-out; }
@keyframes typhu-cash { 35% { transform: scale(1.18); color: #e8432f; } }
.typhu-fan { grid-area: fan; position: relative; height: 32px; min-width: 0; }
.typhu-mn { position: absolute; left: calc(var(--i) * 11px); top: 2px; width: 48px; transform-origin: 20% 120%; transform: rotate(calc((var(--i) - (var(--n) - 1) / 2) * 9deg)); filter: drop-shadow(1px 1px 0 rgba(36, 35, 58, .3)); }
.typhu-mn svg { display: block; width: 100%; height: auto; }
.typhu-empty { font: .8rem var(--f-hand); color: var(--muted); }
.typhu-sm { grid-area: sm; min-width: 0; font-size: .76rem; line-height: 1.25; color: var(--muted); }
.typhu-chips { grid-area: ch; display: flex; flex-wrap: wrap; gap: 3px; min-height: 0; }
.typhu-chips:empty { display: none; }
.typhu-chips i { width: 12px; height: 8px; border-radius: 2px; box-shadow: inset 0 0 0 .5px rgba(36, 35, 58, .5); }
.typhu-chips i.m { opacity: .35; }
.typhu-delta { position: absolute; right: 8px; top: -10px; padding: 1px 7px; border-radius: 99px; font: 700 .8rem/1.3 var(--f-body); color: #fff; opacity: 0; pointer-events: none; }
.typhu-delta.plus { background: #2b7640; }
.typhu-delta.minus { background: #c3262c; }
.typhu-delta.go { animation: typhu-delta 1.1s ease-out; }
@keyframes typhu-delta { 0% { opacity: 0; transform: translateY(6px); } 15% { opacity: 1; transform: none; } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-10px); } }
.typhu-fly { position: fixed; left: 0; top: 0; z-index: 80; pointer-events: none; filter: drop-shadow(1px 2px 1px rgba(36, 35, 58, .35)); will-change: transform; }
.typhu-fly svg { display: block; width: 100%; height: auto; }
.typhu-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.typhu-log { background: var(--label); border: 1.5px dashed var(--ink-soft); border-radius: 12px; padding: 8px 12px; }
.typhu-log summary { font: 1.2rem var(--f-hand); color: var(--ink); cursor: pointer; }
.typhu-log ol { margin: 6px 0 0; padding-left: 1.1em; max-height: 280px; overflow: auto; font-size: .85rem; color: var(--text); display: grid; gap: 3px; }

/* Hộp thoại */
.typhu-modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(36, 35, 58, .5); }
.typhu-info { width: min(100%, 360px); max-height: calc(100vh - 32px); overflow: auto; display: grid; gap: 8px; padding: 14px 16px 16px;
  background: #fffdf4; border: 2px solid #24233a; border-radius: 12px; box-shadow: inset 0 0 0 5px #fffdf4, inset 0 0 0 6.5px #c9a227, 5px 7px 0 rgba(36, 35, 58, .35); animation: typhu-pop .22s ease-out; }
.typhu-info p { margin: 0; font-size: .92rem; }
@keyframes typhu-pop { from { transform: scale(.88) rotate(-2deg); opacity: .4; } to { transform: none; opacity: 1; } }
.typhu-ibtns { display: flex; flex-wrap: wrap; gap: 8px; }
.typhu-ibtns:empty { display: none; }
.typhu-col { display: grid; }
.typhu-close { justify-self: end; }
.typhu-res { text-align: center; padding-top: 18px; }
.typhu-res h2 { font-size: 2rem; }
.typhu-info .typhu-stamp { justify-self: center; font: 1.8rem var(--f-hand); color: var(--red); border: 3px solid var(--red); border-radius: 50%; width: 92px; height: 92px; display: grid; place-items: center; transform: rotate(-12deg); }
.typhu-stamp.lose { color: var(--ink); border-color: var(--ink); }
.typhu-rank { list-style: none; margin: 4px 0; padding: 0; display: grid; gap: 4px; counter-reset: r; }
.typhu-rank li { display: grid; grid-template-columns: 1.4em 28px 1fr auto; gap: 8px; align-items: center; text-align: left; padding: 4px 6px; border-bottom: 1px dotted var(--ink-soft); counter-increment: r; }
.typhu-rank li::before { content: counter(r) "."; font: 1.2rem var(--f-hand); color: var(--ink); }
.typhu-rank .typhu-tk { width: 26px; height: 26px; }
.typhu-rank b { color: var(--red); font-variant-numeric: tabular-nums; }

/* Điện thoại: bàn tràn gần sát mép màn hình để chữ trên ô to hơn */
@media (max-width: 520px) {
  .typhu-frame { width: calc(100% + 20px); max-width: none; margin-inline: -10px; padding: 1.4%; border-radius: 8px; }
  .typhu-head .typhu-art { width: 92px; height: 56px; }
  .typhu-h1 { font-size: 2.05rem; }
  .typhu-seat { grid-template-columns: 30px minmax(0, 1fr) 112px; }
  .typhu-pl { padding: 6px 7px 7px; gap: 2px 6px; grid-template-columns: 26px minmax(0, 1fr) auto; }
  .typhu-pl .typhu-tk { width: 26px; height: 26px; }
  .typhu-cash { font-size: 1.08rem; }
  .typhu-mn { width: 40px; left: calc(var(--i) * 9px); }
  .typhu-notes li { width: calc((100% - 8px) / 3); }
}
@media (prefers-reduced-motion: reduce) {
  .typhu-hop, .typhu-rolling, .typhu-landed, .typhu-flip, .typhu-mini, .typhu-info, .typhu-draw, .typhu-up .typhu-bld, .typhu-down .typhu-bld, .typhu-cash.typhu-bump, .typhu-delta.go, .typhu-puff { animation: none !important; }
  .typhu-token, .typhu-tray { transition: none; }
  .typhu-delta.go { opacity: 0; }
}

/* Điện thoại nằm ngang: bàn cờ vuông bên trái cao trọn màn hình, người chơi bên phải */
@media (orientation: landscape) and (max-height: 540px) {
  .typhu-play { grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); column-gap: 14px; row-gap: 8px; }
  .typhu-layout { display: contents; }
  .typhu-frame { grid-column: 1; grid-row: 1 / span 2; width: calc(100dvh - 20px); max-width: none; }
  .typhu-bar { grid-column: 2; grid-row: 1; }
  .typhu-bt b { font-size: 1.25rem; }
  .typhu-side { grid-column: 2; grid-row: 2; align-self: start; max-height: calc(100dvh - 76px); overflow-y: auto; overscroll-behavior: contain; padding-right: 2px; }
  .typhu-players { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}
