/* Tỷ Phú Việt: giao diện bổ sung cho ChiaNè / Trò chơi nhóm (game.css). */
.ty-narrow { max-width: 460px; margin-left: auto; margin-right: auto; }
.ty-code-in { text-align: center; font-size: 2rem; font-weight: 800; letter-spacing: .5em; padding-left: calc(.5em + 14px); text-transform: uppercase; }
.ty-code-tag { display: inline-block; padding: 0 .5em; border-radius: 10px; background: var(--teal-soft); color: var(--teal-deep); letter-spacing: .25em; font-weight: 800; }
.ty-label { font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.ty-wait { margin: 8px 0; color: var(--ink-2); }
.ty-room .card { margin-bottom: 14px; }
.ty-msg { text-align: center; }
.ty-bigcode { font-size: clamp(2.4rem, 12vw, 3.6rem); font-weight: 800; letter-spacing: .3em; padding-left: .3em; color: var(--teal-deep); line-height: 1.15; }
.ty-guest-code { text-align: center; }
.ty-invite-grid { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center; }
@media (max-width: 520px) { .ty-invite-grid { grid-template-columns: 1fr; justify-items: center; text-align: center; } }
.ty-invite-info { min-width: 0; width: 100%; }
.ty-link { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.ty-link input { flex: 1; min-width: 0; padding: 9px 12px; border: 1.5px solid var(--line-strong); border-radius: var(--r-sm); background: #fff; font: inherit; font-size: .9rem; }
.ty-qr { width: 200px; height: 200px; line-height: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #fff; }
.ty-qr svg { width: 100%; height: 100%; display: block; }
.ty-count { font-weight: 600; color: var(--ink-3); font-size: .9em; }
.ty-plist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ty-prow { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.ty-prow.is-off { opacity: .6; }
.ty-av { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: var(--teal); color: #fff; font-weight: 800; }
.ty-pname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.ty-pname small { color: var(--ink-3); font-weight: 500; }
.ty-badge { padding: 2px 8px; border-radius: 99px; background: var(--khaki-soft); color: var(--ink-2); font-size: .72rem; font-weight: 700; }
.ty-badge.is-off { background: var(--mahogany-soft); color: var(--mahogany); }
.ty-x { flex: none; min-width: 30px; height: 30px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 99px; background: transparent; font: inherit; font-weight: 700; color: var(--mahogany); cursor: pointer; }
.ty-x:hover, .ty-x.is-arm { background: var(--mahogany); color: #fff; border-color: var(--mahogany); }
.ty-lobby-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ty-lobby-actions .btn-primary { margin-left: auto; min-width: 190px; }
.ty-lock-ico { font-size: 1.2rem; margin-right: 4px; }
#tyLock.is-locked { border-color: var(--mahogany); background: var(--mahogany-soft); color: var(--mahogany); }



.ty-modal { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(20, 16, 14, .55); }
.ty-modal[hidden] { display: none; }
.ty-modal-box { width: 100%; max-width: 440px; max-height: 92vh; overflow: auto; padding: 22px; border-radius: var(--r-lg); background: var(--paper); box-shadow: var(--shadow-lift); }
.ty-modal-box h2 { margin: 0 0 6px; }
.ty-hint { margin: 0 0 14px; color: var(--ink-2); font-size: .9rem; }
.ty-modal-sub { margin: 0 0 14px; color: var(--ink-2); }

/* ---- Trang chủ: Trở về -> tiêu đề -> Chơi riêng -> (tách đôi) Tạo phòng / Vào phòng ---- */
.ty-vlink { width: 5px; height: 28px; border-radius: 3px; background: #e8962a; }
.ty-vlink + a.mp-solo { margin-top: 0; }
.ty-vlink.is-pink { background: #f0558c; }
.mp-links.ty-after-solo .t { stroke: #f0558c; }
a.mp-card.mp-solo { flex-direction: row; gap: 10px; width: 156px; height: 116px; min-height: 0; padding: 0 12px; border-radius: 26px; }
a.mp-card.mp-solo .mp-ico { flex: none; width: 52px; height: 52px; font-size: 1.6rem; border-width: 3px; }
a.mp-card.mp-solo h2 { margin: 0; font-size: 1.15rem; }
@media (max-width: 480px) {
  a.mp-card.mp-solo { width: 140px; height: 96px; padding: 0 8px; }
  a.mp-card.mp-solo .mp-ico { width: 40px; height: 40px; font-size: 1.2rem; }
  a.mp-card.mp-solo h2 { font-size: 1rem; }
}

.ty-sub { margin: 14px 0 6px; font-size: .85rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.ty-pieces { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.ty-piece { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px; border: 2px solid var(--line); border-radius: 14px; background: #fff; font: inherit; font-size: .8rem; font-weight: 700; cursor: pointer; color: var(--ink); }
.ty-piece i { width: 26px; height: 26px; border-radius: 50%; display: block; }
.ty-piece[aria-pressed="true"] { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
.ty-piece:disabled { opacity: .35; cursor: not-allowed; }
.ty-dot { flex: none; width: 14px; height: 14px; border-radius: 50%; }
.ty-modal-box h2 { font-size: 1.3rem; }

/* =====================  Màn chơi (3D)  ===================== */
.ty-app { --bg:#E8ECE4; --panel:#FBFBF7; --ink:#1A2420; --muted:#56645D; --line:rgba(26,36,32,.13); --chip:#EEF1EA; --lacquer:#B3261E; --on-lacquer:#FFF7F2; --gold:#A97A1F; --jade:#13624F; --stage:#C7D3C8; --shade:rgba(20,30,26,.42);
  --display:'Phudu','Be Vietnam Pro',system-ui,sans-serif; --body:'Be Vietnam Pro',system-ui,-apple-system,'Segoe UI',sans-serif;
  position: fixed; inset: 0; z-index: 60; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 14px; line-height: 1.5; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ty-app { --bg:#0E1513; --panel:#151E1B; --ink:#E6ECE8; --muted:#97A69F; --line:rgba(230,236,232,.12); --chip:#1D2824; --lacquer:#E0574C; --on-lacquer:#1A0806; --gold:#E0B65A; --jade:#4DB496; --stage:#17231F; --shade:rgba(0,0,0,.55); color-scheme: dark; } }
:root[data-theme="dark"] .ty-app { --bg:#0E1513; --panel:#151E1B; --ink:#E6ECE8; --muted:#97A69F; --line:rgba(230,236,232,.12); --chip:#1D2824; --lacquer:#E0574C; --on-lacquer:#1A0806; --gold:#E0B65A; --jade:#4DB496; --stage:#17231F; --shade:rgba(0,0,0,.55); color-scheme: dark; }
body.ty-lock { overflow: hidden; }
.ty-app[hidden], .ty-app [hidden] { display: none !important; }
.ty-app *, .ty-app *::before, .ty-app *::after { box-sizing: border-box; }
.ty-app .app { height: 100%; display: grid; grid-template-columns: minmax(0, 1fr) 360px; }
.ty-app .stage { position: relative; min-height: 0; background: var(--stage); overflow: hidden; cursor: grab; }
.ty-app .stage canvas { display: block; width: 100%; height: 100%; }
.ty-app .side { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-left: 1px solid var(--line); }
.ty-app .head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 10px max(14px, env(safe-area-inset-right, 0px)) 8px 14px; border-bottom: 1px solid var(--line); }
.ty-app .brand { font-family: var(--display); font-weight: 800; font-size: 22px; letter-spacing: .01em; line-height: 1; }
.ty-app .brand span { color: var(--lacquer); }
.ty-app .head-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ty-app .scroll { overflow-y: auto; min-height: 0; flex: 1; padding: 12px max(14px, env(safe-area-inset-right, 0px)) 20px 14px; display: flex; flex-direction: column; gap: 14px; }
.ty-app .label { font-size: 11px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.ty-app .players { display: flex; flex-direction: column; gap: 6px; }
.ty-app .pl { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; padding: 7px 10px; border-radius: 8px; border: 1px solid transparent; }
.ty-app .pl.turn { border-color: var(--gold); background: var(--chip); }
.ty-app .pl.out { opacity: .45; }
.ty-app .pl .dot { width: 14px; height: 14px; border-radius: 50%; }
.ty-app .pl .nm { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ty-app .pl .nm small { font-weight: 500; color: var(--muted); margin-left: 6px; }
.ty-app .pl .money { font-variant-numeric: tabular-nums; font-weight: 600; }
.ty-app .pl .chips { grid-column: 2 / 4; display: flex; flex-wrap: wrap; gap: 3px; min-height: 4px; }
.ty-app .chipsq { width: 12px; height: 9px; border-radius: 2px; }
.ty-app .chipsq.m { opacity: .3; }
.ty-app .actbox { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--bg); }
.ty-app #prompt { font-size: 14px; margin-bottom: 10px; min-height: 21px; }
.ty-app #actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ty-app .btn { display: inline-flex; align-items: center; justify-content: center; font: inherit; font-weight: 600; font-size: 13px; line-height: 1.3; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; text-decoration: none; width: auto; min-height: 0; box-shadow: none; transform: none; }
.ty-app .btn:hover:not(:disabled) { border-color: var(--muted); }
.ty-app .btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.ty-app .btn.primary { background: var(--lacquer); color: var(--on-lacquer); border-color: var(--lacquer); }
.ty-app .btn:disabled { opacity: .4; cursor: default; }
.ty-app .btn.sm { padding: 4px 8px; font-size: 12px; font-weight: 500; }
.ty-app .btn.ghost { background: transparent; }
.ty-app .assets { display: flex; flex-direction: column; }
.ty-app .as { display: grid; grid-template-columns: 6px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.ty-app .as .bar { align-self: stretch; border-radius: 3px; }
.ty-app .as .an { font-weight: 600; font-size: 13px; cursor: pointer; }
.ty-app .as .an small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.ty-app .as .ab { display: flex; gap: 4px; }
.ty-app .empty { color: var(--muted); font-size: 13px; padding: 0; text-align: left; }
.ty-app .log { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
.ty-app .log div { line-height: 1.45; }
.ty-app .log b { font-weight: 600; }
.ty-app .ov { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--shade); z-index: 5; cursor: default; }
.ty-app .ov.clear { background: transparent; pointer-events: none; }
.ty-app .ov.clear > * { pointer-events: auto; }
.ty-app .card { background: var(--panel); color: var(--ink); border-radius: 14px; width: min(340px, 100%); max-height: 100%; overflow: auto; border: 1px solid var(--line); box-shadow: 0 18px 50px rgba(0,0,0,.28); margin: 0; padding: 0; }
.ty-app .card .ch { padding: 14px 18px; font-family: var(--display); font-weight: 800; font-size: 22px; color: #fff; line-height: 1.15; }
.ty-app .card .ch small { display: block; font-family: var(--body); font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; opacity: .85; margin-bottom: 2px; }
.ty-app .card .cb { padding: 14px 18px 16px; display: flex; flex-direction: column; gap: 10px; }
.ty-app .rt { width: 100%; border-collapse: collapse; font-size: 13px; }
.ty-app .rt td { padding: 3px 0; border-bottom: 1px dashed var(--line); }
.ty-app .rt td:last-child { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.ty-app .rt tr.on td { color: var(--lacquer); }
.ty-app .meta { font-size: 12.5px; color: var(--muted); }
.ty-app .drawn { animation: tyflip .45s cubic-bezier(.2,.8,.3,1); }
@keyframes tyflip { from { transform: perspective(800px) rotateY(80deg) scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .ty-app .drawn { animation: none; } }
.ty-app .drawtext { font-size: 17px; line-height: 1.5; font-weight: 500; padding: 6px 0 4px; }
.ty-app .start { width: min(460px, 100%); }
.ty-app .start .ch { background: var(--lacquer); }
.ty-app .seg { display: flex; gap: 6px; flex-wrap: wrap; }
.ty-app .seg .btn[aria-pressed="true"] { border-color: var(--lacquer); color: var(--lacquer); box-shadow: inset 0 0 0 1px var(--lacquer); }
.ty-app .tokens { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.ty-app .tok { font: inherit; font-size: 12px; font-weight: 600; padding: 8px 4px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.ty-app .tok i { width: 18px; height: 18px; border-radius: 50%; display: block; }
.ty-app .tok[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.ty-app .rules { font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.ty-app .ty-exit-link { text-align: center; font-size: 12.5px; color: var(--muted); }
.ty-app .trade { width: min(640px, 100%); }
.ty-app .trade .ch { background: var(--jade); }
.ty-app .tcols { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.ty-app .tlist { display: flex; flex-direction: column; gap: 2px; max-height: 200px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 6px; }
.ty-app .tlist label { display: flex; gap: 8px; align-items: center; font-size: 13px; padding: 3px 4px; border-radius: 6px; cursor: pointer; margin: 0; }
.ty-app .tlist label i { width: 8px; height: 14px; border-radius: 2px; flex: none; }
.ty-app .inp { font: inherit; width: 100%; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.ty-app select.inp { cursor: pointer; }
.ty-app .err { color: var(--lacquer); font-size: 12.5px; min-height: 18px; }
.ty-app .hint { position: absolute; left: max(12px, env(safe-area-inset-left, 0px)); bottom: 12px; font-size: 12px; color: var(--ink); background: var(--panel); border: 1px solid var(--line); padding: 5px 10px; border-radius: 999px; opacity: .85; pointer-events: none; margin: 0; }
.ty-viewtools { position: absolute; left: max(12px, env(safe-area-inset-left, 0px)); bottom: 44px; z-index: 3; display: flex; gap: 6px; align-items: center; }
.ty-app .auction { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 4; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.2); min-width: 240px; }
.ty-app .auction .big { font-family: var(--display); font-weight: 800; font-size: 28px; color: var(--lacquer); line-height: 1.1; }
.ty-away { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.ty-away .btn { justify-content: flex-start; text-align: left; }

/* ---- Khung chat: mờ mờ, góc phải dưới sân khấu ---- */
.ty-chat { position: absolute; right: 12px; bottom: 12px; z-index: 6; width: min(300px, calc(100% - 24px)); display: flex; flex-direction: column; align-items: flex-end; gap: 6px; cursor: default; }
.ty-chat-tab { font: inherit; font-size: 12px; font-weight: 700; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; opacity: .9; }
.ty-chat-badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 99px; background: var(--lacquer); color: var(--on-lacquer); font-size: 11px; text-align: center; }
.ty-chat-body { width: 100%; display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 12px; background: rgba(251,251,247,.55); border: 1px solid rgba(26,36,32,.12); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); opacity: .72; transition: opacity .2s; }
.ty-chat-body:hover, .ty-chat-body:focus-within { opacity: 1; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ty-chat-body { background: rgba(21,30,27,.6); } }
:root[data-theme="dark"] .ty-chat-body { background: rgba(21,30,27,.6); }
.ty-chat.is-min .ty-chat-body { display: none; }
.ty-chat-list { max-height: 130px; min-height: 60px; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; line-height: 1.4; }
.ty-chat-list div { word-break: break-word; }
.ty-chat-list b { font-weight: 700; }
.ty-chat-form { display: flex; gap: 6px; }
.ty-chat-form input { flex: 1; min-width: 0; font: inherit; font-size: 13px; padding: 5px 9px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); }

/* ---- Nhắc xoay ngang trên điện thoại cầm dọc ---- */
.ty-rotate { display: none; position: absolute; inset: 0; z-index: 20; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; text-align: center; background: var(--bg); color: var(--ink); }
.ty-rotate-ico { font-size: 3.4rem; animation: tyrot 2.4s ease-in-out infinite; }
@keyframes tyrot { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
.ty-rotate p { margin: 0; }
@media (max-width: 700px) and (orientation: portrait) { .ty-rotate { display: flex; } }

/* ---- Điện thoại ngang / màn hình thấp: bảng bên phải gọn hơn ---- */
@media (max-height: 520px) and (orientation: landscape) {
  .ty-app .app { grid-template-columns: minmax(0, 1fr) clamp(220px, 34vw, 290px); }
  .ty-app .head { padding: 5px max(10px, env(safe-area-inset-right, 0px)) 5px 10px; }
  .ty-app .brand { font-size: 17px; }
  .ty-app .scroll { padding: 8px max(10px, env(safe-area-inset-right, 0px)) 12px 10px; gap: 10px; }
  .ty-app .pl { padding: 4px 8px; }
  .ty-app .card .ch { padding: 10px 14px; font-size: 18px; }
  .ty-app .card .cb { padding: 10px 14px 12px; gap: 8px; }
  .ty-app .drawtext { font-size: 15px; }
  .ty-app .hint { display: none; }
  .ty-viewtools { bottom: 8px; }
  .ty-chat { right: 8px; bottom: 8px; width: min(250px, calc(100% - 16px)); }
  .ty-chat-list { max-height: 80px; min-height: 40px; }
  .ty-app .tlist { max-height: 110px; }
}
/* màn hình máy tính bảng / cửa sổ hẹp nhưng không phải điện thoại dọc */
@media (max-width: 860px) and (min-height: 521px) and (orientation: landscape) { .ty-app .app { grid-template-columns: minmax(0, 1fr) 300px; } }
.ty-app .sfx-btn { padding: 4px 8px; font-size: 12px; font-weight: 500; border-radius: 8px; min-height: 0; }
.ty-app .head .sfx-btn { padding: 4px 8px; font-size: 12px; font-weight: 500; border-width: 1px; box-shadow: none; border-radius: 8px; min-height: 0; line-height: 1.3; transform: none; }
@media (max-height: 520px) and (orientation: landscape) {
  .ty-app .actbox { padding: 8px 10px; }
  .ty-app #prompt { font-size: 13px; margin-bottom: 6px; min-height: 0; }
  .ty-app .head-tools { gap: 4px; }
  .ty-app .head .sfx-btn span { display: none; }
}
.ty-app .ty-logbox > summary { cursor: pointer; list-style: none; margin-bottom: 0; }
.ty-app .ty-logbox > summary::-webkit-details-marker { display: none; }
.ty-app .ty-logbox > summary::after { content: " ▾"; }
.ty-app .ty-logbox[open] > summary::after { content: " ▴"; }
.ty-app .ty-logbox[open] > summary { margin-bottom: 6px; }
.ty-app .stage canvas { touch-action: none; }

/* Nút hành động (đổ xúc xắc / mua / kết thúc lượt) nằm góc phải dưới sân khấu, chat xếp ngay phía trên */
.ty-br { position: absolute; right: 12px; bottom: 12px; z-index: 7; width: min(320px, calc(100% - 24px)); display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none; cursor: default; }
.ty-br > * { pointer-events: auto; }
.ty-br .ty-chat { position: static; width: 100%; }
.ty-br .actbox { width: 100%; box-shadow: 0 8px 26px rgba(0,0,0,.22); background: var(--panel); }
.ty-br .actbox:not(.on) { display: none; }
.ty-zoom { position: absolute; left: max(12px, env(safe-area-inset-left, 0px)); top: 12px; z-index: 3; display: flex; flex-direction: column; gap: 6px; }
.ty-zoom .btn { font-size: 14px; padding: 6px 10px; }
@media (max-height: 520px) and (orientation: landscape) { .ty-br { right: 8px; bottom: 8px; width: min(270px, calc(100% - 16px)); } .ty-zoom { top: 8px; } }

.ty-viewtools .btn { font-size: 13px; padding: 6px 10px; }
.ty-app .hint { max-width: calc(100% - 360px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Bố cục mới: nút công cụ góc trái trên, danh sách người chơi góc phải trên, ô hành động nằm ở bảng bên phải */
.ty-app .ty-tools { position: absolute; left: max(12px, env(safe-area-inset-left, 0px)); top: 12px; z-index: 6; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; max-width: calc(100% - 300px); }
.ty-app .ty-tools .btn { background: var(--panel); }
.ty-app .ty-plbox { position: absolute; right: 12px; top: 12px; z-index: 4; width: min(250px, 42%); pointer-events: none; }
.ty-app .ty-plbox > * { pointer-events: auto; }
.ty-app .ty-plbox .players { gap: 3px; }
.ty-app .ty-plbox .pl { grid-template-columns: 12px minmax(0, 1fr) auto; gap: 0 8px; padding: 4px 9px; background: rgba(251,251,247,.72); border: 1px solid rgba(26,36,32,.1); }
.ty-app .ty-plbox .pl.turn { border-color: var(--gold); background: var(--panel); }
.ty-app .ty-plbox .pl .nm small, .ty-app .ty-plbox .pl .chips { display: none; }
.ty-app .ty-plbox .pl .dot { width: 12px; height: 12px; }
.ty-app .side .actbox { order: 0; }
.ty-app .side .head { padding-bottom: 6px; }
@media (max-height: 520px) and (orientation: landscape) {
  .ty-app .ty-tools { top: 8px; max-width: calc(100% - 250px); }
  .ty-app .ty-plbox { top: 8px; right: 8px; width: min(210px, 40%); }
  .ty-app .ty-plbox .pl { padding: 2px 8px; font-size: 12px; }
}
.ty-app .ty-tools .sfx-btn { padding: 4px 8px !important; font-size: 12px !important; font-weight: 500 !important; min-height: 0 !important; border-width: 1px !important; box-shadow: none !important; border-radius: 8px !important; line-height: 1.3 !important; }

/* lần chỉnh 12:08 */
.ty-app .assets .empty { padding: 5px; }
.ty-app .ty-tools .sfx-btn { font-size: 15px !important; padding: 3px 9px !important; }
.ty-app .ty-tools .sfx-btn span { display: none; }
.ty-app .ty-tools #tyExit, .ty-app .ty-tools #tyQuit { background: #8E1B15; border-color: #8E1B15; color: #fff; }
.ty-app .ty-tools #tyExit:hover, .ty-app .ty-tools #tyQuit:hover { background: #741510; border-color: #741510; }
.ty-app .ty-plbox { width: auto; min-width: 0; }
.ty-app .ty-plbox .pl { grid-template-columns: 12px minmax(11ch, auto) auto; gap: 0 8px; }
.ty-app .ty-plbox .pl .money { margin-left: 12px; }
@media (max-height: 520px) and (orientation: landscape) { .ty-app .ty-plbox { width: auto; } }
.ty-app .ty-tools .sfx-btn { height: auto !important; width: auto !important; line-height: 1.3 !important; }
.ty-app .ty-tools .ty-break { flex-basis: 100%; height: 0; }
.ty-app .ty-tools .sfx-btn, .ty-app .ty-tools .sfx-btn:hover { background: transparent !important; border: 0 !important; box-shadow: none !important; padding: 0 4px !important; font-size: 20px !important; }

/* chữ bay trên đầu quân cờ */
.ty-app .ty-float { position: absolute; left: 0; top: 0; z-index: 4; pointer-events: none; display: flex; flex-direction: column; align-items: center; line-height: 1.15; white-space: nowrap; text-shadow: 0 1px 0 #fff, 0 -1px 0 #fff, 1px 0 0 #fff, -1px 0 0 #fff, 0 2px 6px rgba(0,0,0,.25); will-change: transform, opacity; }
.ty-app .ty-float b { font-family: var(--display); font-weight: 800; font-size: 20px; }
.ty-app .ty-float small { font-size: 11px; font-weight: 600; color: var(--muted); }
.ty-app .ty-float.gain b { color: #0E7A4B; }
.ty-app .ty-float.loss b { color: #C0281E; }
.ty-app .ty-float.fun b { color: #A97A1F; }
.ty-app .ty-float.bad b { color: #7A1F5C; }
@media (max-height: 520px) and (orientation: landscape) { .ty-app .ty-float b { font-size: 16px; } }

/* zoom: icon kính lúp, không nền, góc phải dưới sân khấu */
.ty-app .ty-zoom { position: absolute; left: auto; top: auto; flex-direction: row; right: 12px; bottom: 12px; z-index: 6; display: flex; gap: 6px; }
.ty-app .ty-ico { background: none; border: 0; padding: 4px; margin: 0; color: #6D6E71; cursor: pointer; line-height: 0; border-radius: 8px; box-shadow: none; min-height: 0; width: auto; }
.ty-app .ty-ico:hover { color: #3b3c3f; }
.ty-app .ty-ico:active { transform: scale(.92); }
.ty-app .ty-ico:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
@media (max-height: 520px) and (orientation: landscape) { .ty-app .ty-zoom { right: 8px; bottom: 8px; top: auto; } .ty-app .ty-ico svg { width: 26px; height: 26px; } }
/* chat: nửa dưới bảng bên phải (phòng nhiều người); nửa trên cuộn được */
.ty-app .side .ty-chat { position: static; width: 100%; height: 50%; flex: none; z-index: auto; align-items: stretch; gap: 0; border-top: 1px solid var(--line); padding: 8px 12px 10px 14px; background: var(--panel); }
.ty-app .side .ty-chat-tab, .ty-app .side .ty-chat-badge { display: none; }
.ty-app .side .ty-chat.is-min .ty-chat-body { display: flex; }
.ty-app .side .ty-chat-body { flex: 1; min-height: 0; padding: 0; background: transparent; border: 0; backdrop-filter: none; -webkit-backdrop-filter: none; opacity: 1; }
.ty-app .side .ty-chat-list { flex: 1; max-height: none; min-height: 0; }
.ty-app .side .scroll { flex: 1 1 0; min-height: 0; }

/* lần chỉnh 19:17: góc trái dưới = zoom in > zoom out > Đặt lại góc nhìn; góc phải dưới = các nút hành động xếp từng dòng */
.ty-app .ty-viewtools { flex-direction: column; align-items: flex-start; gap: 2px; }
.ty-app .ty-viewtools .ty-ico { padding: 2px 4px; }
.ty-app .ty-acts { position: absolute; right: 12px; bottom: 12px; z-index: 6; pointer-events: none; }
.ty-app .ty-acts #actions { display: flex; flex-direction: column; align-items: stretch; gap: 8px; flex-wrap: nowrap; }
.ty-app .ty-acts #actions .btn { pointer-events: auto; min-width: 150px; padding: 10px 18px; font-size: 14px; box-shadow: 0 6px 18px rgba(0,0,0,.2); }
.ty-app .ty-acts #actions:empty { display: none; }
@media (max-height: 520px) and (orientation: landscape) {
  .ty-app .ty-acts { right: 8px; bottom: 8px; }
  .ty-app .ty-acts #actions { gap: 5px; }
  .ty-app .ty-acts #actions .btn { min-width: 130px; padding: 6px 12px; font-size: 13px; }
}

/* mũi tên nhấp nhô trên đầu quân cờ của chính mình (chỉ mình thấy) */
.ty-app .ty-me { position: absolute; left: 0; top: 0; z-index: 3; pointer-events: none; will-change: transform; }
.ty-app .ty-me span { display: block; font-size: 22px; line-height: 1; color: var(--lacquer); text-shadow: 1px 0 0 #fff, -1px 0 0 #fff, 0 1px 0 #fff, 0 -1px 0 #fff, 0 2px 5px rgba(0,0,0,.3); animation: tybob .9s ease-in-out infinite; }
@keyframes tybob { 0%, 100% { transform: translateY(-7px); } 50% { transform: translateY(3px); } }
@media (prefers-reduced-motion: reduce) { .ty-app .ty-me span { animation: none; } }
/* nhóm zoom và Đặt lại góc nhìn: sát nhau */
.ty-app .ty-viewtools { gap: 0 !important; }
.ty-app .ty-viewtools .ty-ico { margin: 0 !important; padding: 0 4px !important; display: block; }
.ty-app .ty-viewtools .ty-ico svg { display: block; width: 26px; height: 26px; }
.ty-app .ty-viewtools #resetView { margin: 2px 0 0 !important; }
.ty-app .ty-viewtools #resetView { margin: 44px 0 0 !important; }   /* cách nhóm zoom khoảng 2 dòng trống */
.ty-app .ty-viewtools #zoomOut { margin-top: 20px !important; }      /* zoom in cách zoom out 20px */
.ty-app .ty-viewtools #resetView { margin: 20px 0 0 !important; }   /* zoom out cách Đặt lại góc nhìn 20px */
.ty-app .pl .nm .jc { font-size: 12px; font-weight: 600; margin-left: 2px; }
.ty-app .ty-jailbtns { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; padding: 0; background: none; border: 0; box-shadow: none; }
.ty-app .ty-jailbtns .btn { padding: 10px 20px; font-size: 14px; }
.ty-hint-sm { margin: 6px 0 0; font-size: .8rem; }
.ty-bots .ty-piece { padding: 10px 4px; }
#tyBotsNote { margin: 8px 0 0; color: var(--ink-2); font-size: .9rem; }
