/* Chùa Online 3D — lớp giao diện trên khung 3D. Không bo góc, chữ Bai Jamjuree / Lexend / Roboto. */
:root {
  --g-ink: #fff4e2; --g-dim: #d8c4a4; --g-gold: #f0c46a; --g-lac: #8e1f15; --g-wood: rgba(38, 20, 10, .86);
  --g-wood-solid: #2a160b; --g-line: rgba(240, 196, 106, .38); --g-ok: #9fd97a; --g-warn: #ffb27a;
  --g-safe-t: env(safe-area-inset-top, 0px); --g-safe-b: env(safe-area-inset-bottom, 0px);
  --g-safe-l: env(safe-area-inset-left, 0px); --g-safe-r: env(safe-area-inset-right, 0px);
}
html.chua-game, html.chua-game body { margin: 0; height: 100%; overflow: hidden; background: #1b0f08; overscroll-behavior: none; }
html.chua-game body { -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; touch-action: none; }
#game { position: fixed; inset: 0; overflow: hidden; font-family: "Lexend", "Roboto", system-ui, sans-serif; color: var(--g-ink); }
#game * { box-sizing: border-box; border-radius: 0 !important; }
#game [hidden] { display: none !important; }
#gameCanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
#game button { font: inherit; color: inherit; cursor: pointer; }
#game button:focus-visible, #game input:focus-visible, #game a:focus-visible { outline: 2px solid var(--g-gold); outline-offset: 2px; }

/* ---------------------------------------------------------------- màn hình vào chùa */
.g-loading { position: absolute; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(120% 80% at 50% 30%, rgba(60, 28, 12, .55), rgba(20, 10, 5, .94)), #1b0f08; transition: opacity .45s; }
.g-loading.is-gone { opacity: 0; pointer-events: none; }
.g-gate { width: min(420px, 100%); text-align: center; }
.g-gate h1 { font-family: "Bai Jamjuree", sans-serif; font-weight: 700; font-size: clamp(30px, 7vw, 44px); line-height: 1.1; margin: 0 0 10px; color: var(--g-gold); letter-spacing: .01em; }
.g-gate p { margin: 0 0 22px; color: var(--g-dim); font-size: 15px; line-height: 1.55; }
.g-gate form { display: flex; flex-direction: column; gap: 10px; }
.g-gate input { height: 50px; padding: 0 14px; font: 500 17px "Lexend", sans-serif; text-align: center; color: var(--g-ink); background: rgba(0, 0, 0, .35); border: 1px solid var(--g-line); }
.g-gate input::placeholder { color: rgba(216, 196, 164, .6); }
.g-gate button { height: 52px; font: 700 18px "Bai Jamjuree", sans-serif !important; background: var(--g-gold); color: #2a1407 !important; border: 0; }
.g-gate button:disabled { opacity: .5; }
.g-loading:not(.is-ready) #gStart::after { content: " (đang dựng chùa…)"; font-weight: 500; font-size: 14px; }
.g-gate .g-back { display: inline-block; margin-top: 16px; color: var(--g-dim); font-size: 14px; }

/* ---------------------------------------------------------------- HUD */
.g-hud { position: absolute; top: calc(8px + var(--g-safe-t)); left: calc(8px + var(--g-safe-l)); right: calc(8px + var(--g-safe-r)); display: flex; align-items: flex-start; gap: 8px; pointer-events: none; z-index: 5; }
.g-hud > * { pointer-events: auto; }
.g-me { display: grid; grid-template-columns: auto auto; gap: 2px 8px; align-items: baseline; padding: 7px 10px 9px; background: var(--g-wood); border: 1px solid var(--g-line); text-align: left; min-width: 150px; }
.g-me-name { font: 600 15px "Bai Jamjuree", sans-serif; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-me-lv { font-size: 12px; color: var(--g-gold); }
.g-bar { grid-column: 1 / -1; height: 4px; background: rgba(255, 255, 255, .12); margin-top: 3px; }
.g-bar i { display: block; height: 100%; background: var(--g-gold); width: 0; transition: width .4s; }
.g-stats { display: flex; flex-direction: column; gap: 2px; padding: 6px 10px; background: var(--g-wood); border: 1px solid var(--g-line); font-size: 12px; color: var(--g-dim); }
.g-stat b { color: var(--g-ink); font: 600 14px "Lexend", sans-serif; }
.g-sen b { color: #ffb5c4; }
.g-top-r { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.g-online { font-size: 12px; color: var(--g-ok); padding: 6px 8px; background: var(--g-wood); border: 1px solid var(--g-line); white-space: nowrap; }
.g-ico { height: 34px; padding: 0 12px; white-space: nowrap; background: var(--g-wood); border: 1px solid var(--g-line); font-size: 13px !important; }
.g-map { position: absolute; top: calc(60px + var(--g-safe-t)); right: calc(8px + var(--g-safe-r)); width: 112px; height: 157px; border: 1px solid var(--g-line); z-index: 4; pointer-events: none; }
.g-status { position: absolute; top: calc(100px + var(--g-safe-t)); left: 50%; transform: translateX(-50%); padding: 5px 10px; font-size: 12px; background: rgba(80, 40, 10, .85); border: 1px solid var(--g-line); z-index: 6; white-space: nowrap; }

/* ---------------------------------------------------------------- chat */
.g-chat { position: absolute; left: calc(8px + var(--g-safe-l)); bottom: calc(118px + var(--g-safe-b)); width: min(420px, calc(100% - 16px)); z-index: 4; pointer-events: none; }
.g-chat-log { list-style: none; margin: 0; padding: 0; max-height: 30vh; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; pointer-events: auto; scrollbar-width: none; mask-image: linear-gradient(to bottom, transparent, #000 22px); }
.g-chat-log li { font: 400 13.5px/1.4 "Roboto", sans-serif; padding: 3px 8px; background: rgba(20, 10, 5, .55); text-shadow: 0 1px 2px rgba(0, 0, 0, .8); width: fit-content; max-width: 100%; opacity: .55; transition: opacity .4s; }
.g-chat.is-fresh .g-chat-log li, .g-chat-log li:nth-last-child(-n+3) { opacity: 1; }
.g-chat-log b { font-weight: 600; color: #ffe3b0; }
.g-chat-log b.is-adm { color: var(--g-gold); }
.g-chat-log li.is-sys { color: var(--g-gold); }
.g-chat-log li.is-level, .g-chat-log li.is-joy { color: #ffd76a; font-weight: 500; }
.g-chat-log li.is-notice { color: #fff; background: rgba(142, 31, 21, .8); }
.g-chat-log li.is-admin { color: var(--g-ok); }
.g-chat-form { position: absolute; left: calc(8px + var(--g-safe-l)); right: calc(8px + var(--g-safe-r)); bottom: calc(66px + var(--g-safe-b)); display: flex; z-index: 9; max-width: 560px; }
.g-chat-form input { flex: 1; height: 46px; padding: 0 12px; font: 400 16px "Roboto", sans-serif; color: var(--g-ink); background: var(--g-wood-solid); border: 1px solid var(--g-gold); }
.g-chat-form button { width: 72px; background: var(--g-gold); color: #2a1407 !important; border: 0; font-weight: 600 !important; }

/* ---------------------------------------------------------------- nút nghi thức */
.g-actions { position: absolute; right: calc(8px + var(--g-safe-r)); bottom: calc(10px + var(--g-safe-b)); left: calc(8px + var(--g-safe-l)); display: flex; flex-wrap: wrap-reverse; justify-content: flex-end; gap: 6px; z-index: 5; pointer-events: none; }
.g-act { pointer-events: auto; height: 44px; padding: 0 14px; background: var(--g-wood); border: 1px solid var(--g-line); font-size: 14px !important; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.g-act.is-main { background: var(--g-lac); border-color: var(--g-gold); font-weight: 600 !important; height: 50px; font-size: 15px !important; }
.g-act.is-on { background: #2f5a24; border-color: var(--g-ok); }
.g-act:active { transform: translateY(1px); }
.g-act kbd { font: 600 11px "Lexend", sans-serif; padding: 1px 5px; border: 1px solid rgba(255, 255, 255, .5); }
.g-chat-btn { display: none; }

/* joystick */
#game .g-joy { position: absolute; left: calc(18px + var(--g-safe-l)); bottom: calc(22px + var(--g-safe-b)); width: 124px; height: 124px; border: 1px solid rgba(240, 196, 106, .45); background: rgba(30, 15, 8, .35); z-index: 6; touch-action: none; border-radius: 50% !important; }
#game .g-joy i { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; background: rgba(240, 196, 106, .75); border-radius: 50% !important; transition: transform .05s; }

/* ---------------------------------------------------------------- thông báo nhỏ, điểm bay */
.g-toasts { position: absolute; top: calc(96px + var(--g-safe-t)); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; z-index: 20; pointer-events: none; width: min(92vw, 440px); }
.g-toast { padding: 9px 14px; background: var(--g-wood-solid); border-left: 3px solid var(--g-gold); font-size: 14px; line-height: 1.4; transition: opacity .4s, transform .4s; text-align: center; }
.g-toast.is-ok { border-color: var(--g-ok); } .g-toast.is-warn { border-color: var(--g-warn); }
.g-toast.out { opacity: 0; transform: translateY(-8px); }
.g-floats { position: absolute; left: 50%; top: 44%; z-index: 8; pointer-events: none; }
.g-float { position: absolute; left: 0; transform: translateX(-50%); white-space: nowrap; font: 700 18px "Bai Jamjuree", sans-serif; color: var(--g-gold); text-shadow: 0 2px 4px rgba(0, 0, 0, .9); animation: gFloat 1.6s ease-out forwards; }
@keyframes gFloat { from { opacity: 0; transform: translate(-50%, 10px); } 15% { opacity: 1; } to { opacity: 0; transform: translate(-50%, -60px); } }

/* ---------------------------------------------------------------- menu & sheet */
.g-menu-wrap, .g-sheet-wrap { position: absolute; inset: 0; z-index: 30; background: rgba(10, 5, 2, .5); display: flex; justify-content: flex-end; }
.g-sheet-wrap { align-items: center; justify-content: center; padding: 16px; }
.g-menu { width: min(440px, 100%); height: 100%; background: #24130a; border-left: 1px solid var(--g-line); display: flex; flex-direction: column; padding-top: var(--g-safe-t); padding-bottom: var(--g-safe-b); animation: gIn .2s ease-out; }
@keyframes gIn { from { transform: translateX(30px); opacity: 0; } }
.g-menu-head { display: flex; align-items: stretch; border-bottom: 1px solid var(--g-line); }
.g-tabs { display: flex; overflow-x: auto; flex: 1; scrollbar-width: none; }
.g-tabs button { flex: none; padding: 14px 12px; background: none; border: 0; border-bottom: 2px solid transparent; font: 600 14px "Bai Jamjuree", sans-serif !important; color: var(--g-dim) !important; }
.g-tabs button[aria-selected=true] { color: var(--g-gold) !important; border-bottom-color: var(--g-gold); }
.g-x { padding: 0 14px; background: none; border: 0; border-left: 1px solid var(--g-line); font-size: 13px !important; color: var(--g-dim) !important; }
.g-menu-body { flex: 1; overflow-y: auto; padding: 14px 16px 24px; -webkit-overflow-scrolling: touch; touch-action: pan-y; user-select: text; }
.g-menu-body h3 { font: 600 15px "Bai Jamjuree", sans-serif; color: var(--g-gold); margin: 18px 0 8px; }
.g-sub { font-size: 13px; color: var(--g-dim); line-height: 1.5; margin: 10px 0; }
.g-checkin { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--g-line); background: rgba(142, 31, 21, .25); }
.g-checkin > div { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.g-checkin b { font: 600 15px "Bai Jamjuree", sans-serif; }
.g-checkin span { font-size: 12.5px; color: var(--g-dim); }
.g-checkin button, .g-shop button, .g-btn { min-height: 40px; padding: 0 14px; background: var(--g-gold); color: #2a1407 !important; border: 0; font-weight: 600 !important; font-size: 14px !important; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.g-checkin button:disabled, .g-shop button:disabled { background: rgba(255, 255, 255, .12); color: var(--g-dim) !important; cursor: default; }
.g-btn.is-ghost, .g-sheet-btns .is-ghost { background: transparent; color: var(--g-ink) !important; border: 1px solid var(--g-line); }
.g-quests { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.g-quests li { position: relative; display: flex; justify-content: space-between; padding: 10px 12px; background: rgba(255, 255, 255, .05); font-size: 14px; overflow: hidden; }
.g-quests li > i { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--g-gold); }
.g-quests li.is-done { color: var(--g-ok); }
.g-q-n { font-weight: 600; }
.g-shop { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.g-shop li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: rgba(255, 255, 255, .05); border: 1px solid transparent; }
.g-shop li.is-on { border-color: var(--g-gold); }
.g-sw-img { width: 40px; height: 40px; object-fit: contain; flex: none; background: rgba(255, 255, 255, .06); }
.g-sw { width: 22px; height: 22px; flex: none; background: rgba(255, 255, 255, .15); border: 1px solid rgba(255, 255, 255, .25); }
.g-shop-n { flex: 1; font-size: 14px; }
.g-shop button { min-width: 96px; }
.g-seg { display: flex; margin-bottom: 10px; }
.g-seg button { flex: 1; height: 38px; background: transparent; border: 1px solid var(--g-line); color: var(--g-dim) !important; font-size: 14px !important; }
.g-seg button[aria-pressed=true] { background: var(--g-gold); color: #2a1407 !important; font-weight: 600 !important; }
.g-rank { margin: 0; padding: 0; list-style: none; counter-reset: r; }
.g-rank li { counter-increment: r; display: grid; grid-template-columns: 28px 1fr auto; grid-template-rows: auto auto; column-gap: 8px; padding: 9px 4px; border-bottom: 1px solid rgba(240, 196, 106, .15); align-items: center; }
.g-rank li::before { content: counter(r); grid-row: 1 / 3; font: 700 16px "Bai Jamjuree", sans-serif; color: var(--g-gold); text-align: center; }
.g-rank li span { font-weight: 500; font-size: 14.5px; } .g-rank li small { grid-column: 2; color: var(--g-dim); font-size: 12px; }
.g-rank li b { grid-row: 1 / 3; grid-column: 3; font: 600 15px "Lexend", sans-serif; }
.g-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; font-size: 13px; color: var(--g-dim); }
.g-field input, .g-sheet input { height: 44px; padding: 0 12px; font: 400 16px "Roboto", sans-serif; color: var(--g-ink); background: rgba(0, 0, 0, .3); border: 1px solid var(--g-line); width: 100%; }
.g-toggle { display: flex; width: 100%; justify-content: space-between; align-items: center; margin-top: 10px; padding: 12px; background: rgba(255, 255, 255, .05); border: 0; text-align: left; font-size: 14px !important; }
.g-toggle::after { content: "Tắt"; font-size: 12px; padding: 3px 8px; border: 1px solid var(--g-line); color: var(--g-dim); }
.g-toggle[aria-pressed=true]::after { content: "Bật"; background: var(--g-gold); color: #2a1407; border-color: var(--g-gold); }
.g-menu-body > .g-btn { margin-top: 12px; width: 100%; }
.g-sheet { width: min(420px, 100%); max-height: 85vh; overflow-y: auto; background: #24130a; border: 1px solid var(--g-gold); padding: 18px; user-select: text; touch-action: pan-y; animation: gUp .2s ease-out; }
@keyframes gUp { from { transform: translateY(14px); opacity: 0; } }
.g-sheet h2 { font: 700 20px "Bai Jamjuree", sans-serif; color: var(--g-gold); margin: 0 0 10px; }
.g-sheet p { font-size: 14.5px; line-height: 1.6; margin: 0 0 12px; color: var(--g-ink); }
.g-ftitle { font: 600 16px "Bai Jamjuree", sans-serif !important; }
.g-poem { font: italic 400 15px/1.7 "Roboto", serif; color: #ffe8bf; white-space: pre-wrap; margin: 0 0 12px; padding: 10px 12px; border-left: 2px solid var(--g-gold); background: rgba(0, 0, 0, .2); }
.g-sheet-btns { display: flex; gap: 8px; margin-top: 14px; }
.g-sheet-btns button { flex: 1; min-height: 46px; background: var(--g-gold); color: #2a1407 !important; border: 0; font-weight: 600 !important; }

/* ---------------------------------------------------------------- tràng hạt */
.g-beads { position: absolute; inset: 0; z-index: 25; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: rgba(15, 7, 3, .62); padding: 20px; }
.g-beads-say { font: 600 20px "Bai Jamjuree", sans-serif; color: var(--g-gold); margin: 0; }
.g-beads-tap { --r: min(36vw, 150px); position: relative; width: calc(var(--r) * 2 + 40px); height: calc(var(--r) * 2 + 40px); background: transparent; border: 0; display: grid; place-items: center; touch-action: manipulation; }
.g-beads-ring { position: absolute; inset: 0; }
#game .g-beads-ring i { position: absolute; left: 50%; top: 50%; width: 9px; height: 9px; margin: -4.5px; background: #6b3f20; border-radius: 50% !important; transform-origin: center; }
.g-beads-ring i.on { background: var(--g-gold); box-shadow: 0 0 6px rgba(240, 196, 106, .7); }
.g-beads-n { font: 700 54px "Bai Jamjuree", sans-serif; color: var(--g-ink); line-height: 1; }
.g-beads-tap small { position: absolute; bottom: 34%; font-size: 12px; color: var(--g-dim); }
.g-beads-sub { font-size: 13px; color: var(--g-dim); margin: 0; text-align: center; }

/* ---------------------------------------------------------------- phòng nói chuyện trong menu */
.g-menu-body .pp-voice { display: flex !important; background: transparent; border: 0; padding: 0; }

/* ---------------------------------------------------------------- điện thoại */
@media (max-width: 640px) {
  .g-me { min-width: 0; padding: 6px 8px 7px; }
  .g-hud { gap: 5px; }
  .g-me { padding: 5px 7px 6px; gap: 1px 6px; }
  .g-me-name { max-width: 78px; font-size: 13px; }
  .g-me-lv { font-size: 11px; }
  .g-stats { padding: 4px 7px; font-size: 10.5px; white-space: nowrap; }
  .g-stat b { font-size: 13px; }
  .g-top-r { gap: 4px; flex-wrap: nowrap; }
  .g-online { display: none; }
  .g-ico { height: 32px; padding: 0 7px; font-size: 12px !important; }
  .g-actions { left: calc(150px + var(--g-safe-l)); bottom: calc(12px + var(--g-safe-b)); }
  .g-act { height: 40px; padding: 0 11px; font-size: 13px !important; }
  .g-act.is-main { height: 46px; font-size: 14px !important; }
  .g-chat { bottom: calc(158px + var(--g-safe-b)); width: calc(100% - 16px); }
  .g-chat-log { max-height: 15vh; }
  .g-chat-log li { font-size: 12.5px; }
  .g-map { top: calc(54px + var(--g-safe-t)); width: 90px; height: 126px; }
  .g-menu { width: 100%; border-left: 0; }
}
@media (pointer: coarse) { .g-chat-btn { display: inline-flex; } }
@media (prefers-reduced-motion: reduce) { .g-float, .g-menu, .g-sheet { animation: none; } }

/* ---------------------------------------------------------------- lịch chùa & lời kinh */
.g-event { position: absolute; top: calc(56px + var(--g-safe-t)); left: calc(8px + var(--g-safe-l)); max-width: min(520px, calc(100% - 140px)); z-index: 5; padding: 6px 10px; background: var(--g-wood); border: 1px solid var(--g-line); font-size: 12.5px !important; text-align: left; line-height: 1.35; color: var(--g-dim) !important; }
.g-event.is-special { border-color: var(--g-gold); color: #ffe3a8 !important; }
.g-event.is-live { background: rgba(142, 31, 21, .9); color: #fff !important; border-color: var(--g-gold); }
.g-caption { position: absolute; left: 50%; bottom: calc(70px + var(--g-safe-b)); transform: translateX(-50%); width: min(640px, calc(100% - 24px)); text-align: center; z-index: 4; padding: 8px 14px; font: 500 italic 17px/1.45 "Roboto", serif; color: #fff3d6; text-shadow: 0 2px 6px rgba(0, 0, 0, .9); background: linear-gradient(90deg, transparent, rgba(30, 14, 6, .55), transparent); pointer-events: none; }
@media (max-width: 640px) {
  .g-event { top: calc(48px + var(--g-safe-t)); max-width: calc(100% - 110px); font-size: 11.5px !important; padding: 5px 8px; }
  .g-caption { bottom: calc(118px + var(--g-safe-b)); font-size: 15px; }
}

/* ---------------------------------------------------------------- chợ trước cổng, túi đồ, tạo nhân vật */
.g-chips { display: flex; flex-direction: column; gap: 3px; pointer-events: none; }
.g-chips span { font-size: 11.5px; padding: 3px 8px; background: rgba(80, 40, 10, .82); border: 1px solid var(--g-line); color: var(--g-ink); white-space: nowrap; }
.g-chat-log li.is-npc { color: #ffd9a8; font-style: italic; }
.g-npc-line { margin: 0 0 12px; padding: 10px 12px; background: rgba(0, 0, 0, .28); border-left: 3px solid var(--g-gold); font-size: 15px; line-height: 1.5; }
.g-npc-line b { color: var(--g-gold); }
.g-goods .g-shop-n small { display: block; font-size: 11.5px; color: var(--g-dim); margin-top: 2px; }
.g-sheet-wrap.is-wide .g-sheet { width: min(560px, calc(100vw - 20px)); max-height: calc(100vh - 40px); overflow-y: auto; }
.g-creator h3 { margin: 14px 0 8px; font-size: 13px; color: var(--g-gold); font-weight: 600; }
.g-cr-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.g-cr-card { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 4px 8px; background: rgba(0, 0, 0, .25); border: 1px solid var(--g-line); font-size: 12.5px !important; }
.g-cr-card[aria-pressed="true"] { border-color: var(--g-gold); background: rgba(142, 31, 21, .55); }
.g-cr-card small { color: var(--g-warn); font-size: 10.5px; line-height: 1.2; text-align: center; }
.g-cr-img { width: 100%; aspect-ratio: 3 / 4; object-fit: contain; }
.g-seg-wrap { flex-wrap: wrap; }
.g-seg-wrap button { flex: 1 0 30%; }
.g-chips[hidden] { display: none; }

/* ---------------------------------------------------------------- màn hình vào game: chơi thử / tài khoản */
.g-lotus { width: 56px; height: 36px; color: var(--g-gold); margin: 0 auto 8px; display: block; }
.g-auth { text-align: left; }
.g-tabs2 { display: flex; border-bottom: 1px solid var(--g-line); margin-bottom: 14px; }
.g-tabs2 button { flex: 1; height: 42px !important; background: transparent !important; color: var(--g-dim) !important; font: 600 15px "Bai Jamjuree", sans-serif !important; border-bottom: 2px solid transparent !important; }
.g-tabs2 button[aria-selected="true"] { color: var(--g-gold) !important; border-bottom-color: var(--g-gold) !important; }
.g-gate form small { color: var(--g-dim); font-size: 12.5px; line-height: 1.45; text-align: center; }
.g-gate form input { text-align: left; }
.g-gate .g-link { background: none !important; height: auto !important; color: var(--g-dim) !important; font: 400 14px "Lexend", sans-serif !important; text-decoration: underline; text-underline-offset: 3px; text-align: center; padding: 4px; display: block; margin: 4px auto 0; }
.g-hello { text-align: center; margin: 0 0 14px !important; color: var(--g-ink) !important; }
.g-hello b { color: var(--g-gold); }
.g-social { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.g-social > span { text-align: center; color: var(--g-dim); font-size: 13px; }
.g-soc { display: flex; align-items: center; justify-content: center; height: 48px; font: 600 16px "Bai Jamjuree", sans-serif; color: #fff; text-decoration: none; }
.g-soc.is-fb { background: #1877f2; }
.g-soc.is-zalo { background: #0068ff; }
.g-err { color: var(--g-warn) !important; font-size: 14px !important; min-height: 1em; margin: 10px 0 0 !important; }
.g-err:empty { display: none; }
.g-loading { overflow-y: auto; }
.g-loading.is-ready { background: radial-gradient(90% 70% at 50% 45%, rgba(27, 15, 8, .78), rgba(15, 8, 4, .5)); }
.g-loading.is-ready .g-gate { background: rgba(27, 15, 8, .72); padding: 26px 24px 20px; border: 1px solid var(--g-line); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
#game:has(.g-loading:not(.is-gone)) :is(.g-hud, .g-actions, .g-map, .g-chat, .g-event, .g-joy, .g-caption) { visibility: hidden; }

/* ---------------------------------------------------------------- bàn cờ / sòng bài */
.g-xu b { color: #ffd98a; }
.g-tb { position: absolute; z-index: 28; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(500px, calc(100vw - 16px)); max-height: calc(100vh - 16px - var(--g-safe-t) - var(--g-safe-b));
  overflow-y: auto; background: #24130a; border: 1px solid var(--g-gold); padding: 12px; display: flex; flex-direction: column; gap: 8px; touch-action: pan-y; animation: gUp .2s ease-out; }
.g-tb-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.g-tb-head strong { display: block; font: 700 19px "Bai Jamjuree", sans-serif; color: var(--g-gold); }
.g-tb-head span { font-size: 13px; color: var(--g-dim); }
.g-tb-x { background: transparent; border: 1px solid var(--g-line); padding: 8px 12px; font-size: 14px !important; white-space: nowrap; }
.g-tb-seats { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.g-tb-seats li { font-size: 13px; padding: 4px 8px; border: 1px solid rgba(240, 196, 106, .22); color: var(--g-dim); }
.g-tb-seats li.is-me { color: var(--g-ink); border-color: var(--g-line); }
.g-tb-seats li.is-turn { background: rgba(240, 196, 106, .18); color: var(--g-gold); border-color: var(--g-gold); }
.g-tb-seats .is-win { color: var(--g-ok); } .g-tb-seats .is-lose { color: var(--g-warn); }
.g-tb-board { display: flex; justify-content: center; }
.g-tb-cv { display: block; touch-action: manipulation; cursor: pointer; }
.g-tb-hint { margin: 10px 4px; font-size: 14.5px; line-height: 1.6; color: var(--g-ink); }
.g-tb-msg { margin: 0; font-size: 14px; color: var(--g-gold); min-height: 1.4em; }
.g-tb-ctl { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.g-tb-ctl button { min-height: 44px; padding: 0 16px; background: rgba(240, 196, 106, .12); border: 1px solid var(--g-line); font-weight: 600 !important; }
.g-tb-ctl .g-tb-go { background: var(--g-gold); color: #2a1407 !important; border: 0; font: 700 16px "Bai Jamjuree", sans-serif !important; min-width: 120px; }
.g-tb-note { font-size: 13px; color: var(--g-dim); flex-basis: 100%; }
.g-tb-note.is-warn { color: var(--g-warn); font-weight: 600; }
.g-tb-felt { width: 100%; background: #1d4a2e; border: 1px solid #3c7a4f; padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.g-tb-opp { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 13px; color: #d5ead8; }
.g-tb-opp .is-turn { color: #ffe08a; font-weight: 600; }
.g-tb-pile { min-height: 74px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; justify-content: center; }
.g-tb-pile em { font-size: 13px; color: #b9d6bf; }
.g-tb-hand { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; padding-top: 10px; }
.g-card { width: 40px; height: 58px; background: #fbf8f1; color: #1a1a1a; border: 1px solid #b9b2a2; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; cursor: pointer; transition: transform .12s; }
.g-card b { font: 700 17px "Roboto", sans-serif; } .g-card i { font-style: normal; font-size: 18px; }
.g-card.is-red { color: #c0201a; }
.g-card.is-sel { transform: translateY(-10px); border-color: #e6a91f; box-shadow: 0 0 0 2px #e6a91f; }
.g-card.is-back { background: repeating-linear-gradient(45deg, #8e1f15 0 5px, #a8382b 5px 10px); border-color: #5c140d; cursor: default; }
.g-card.is-peek { opacity: .92; }
.g-tb-cao { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.g-tb-cao-p { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #d5ead8; }
.g-tb-cao-p.is-me b { color: #ffe08a; }
.g-tb-cao-p > div { display: flex; gap: 3px; }
@media (max-width: 420px) { .g-card { width: 34px; height: 50px; } .g-card b { font-size: 15px; } }
/* công đức một hàng, Sen + Xu chung một hàng cho gọn (không bị dải thông báo che) */
.g-stats { display: grid; grid-template-columns: auto auto; column-gap: 10px; }
.g-stats > .g-stat:first-child { grid-column: 1 / -1; }
@media (max-width: 480px) { .g-stats { column-gap: 6px; } .g-stats .g-stat b { font-size: 12px; } .g-stats { font-size: 10px; } }

/* ---------------------------------------------------------------- chạm vào người: bảng tương tác, ảnh chụp, biểu cảm */
.g-ix { position: absolute; z-index: 27; left: max(8px, calc(50% - 210px)); bottom: calc(96px + var(--g-safe-b)); width: min(420px, calc(100vw - 16px));
  background: #24130a; border: 1px solid var(--g-gold); padding: 10px 12px 12px; touch-action: pan-y; }
.g-ix-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.g-ix-head strong { font: 700 17px "Bai Jamjuree", sans-serif; color: var(--g-gold); }
.g-ix-head span { font-size: 12.5px; color: var(--g-dim); flex: 1; }
.g-ix-x { background: none; border: 0; font-size: 24px !important; line-height: 1; padding: 0 4px; color: var(--g-dim) !important; }
.g-ix-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.g-ix-acts button { flex: 1 1 calc(50% - 6px); min-height: 44px; background: rgba(240, 196, 106, .1); border: 1px solid var(--g-line); text-align: left; padding: 6px 10px; font-size: 14.5px !important; transition: background .12s, transform .08s; }
.g-ix-acts button:active { transform: scale(.97); background: rgba(240, 196, 106, .28); }
.g-ix-acts .g-ix-q { flex-basis: 100%; }
.g-ix-acts .is-ghost { background: transparent; color: var(--g-dim) !important; }
.g-ix-say { flex-basis: 100%; margin: 0 0 4px; padding: 8px 10px; min-height: 2.6em; background: #fff6e4; color: #2a1608; font-size: 14.5px; line-height: 1.5; border-left: 3px solid var(--g-gold); }
.g-flash { position: absolute; inset: 0; z-index: 40; background: #fff; pointer-events: none; animation: gFlash .65s ease-out forwards; }
@keyframes gFlash { 0% { opacity: .95; } 100% { opacity: 0; } }
.g-photo { position: absolute; z-index: 41; left: 50%; top: 50%; width: min(360px, calc(100vw - 32px)); background: #fbf6ea; padding: 10px 10px 12px; box-shadow: 0 18px 40px rgba(0, 0, 0, .5);
  transform: translate(-50%, -46%) rotate(-3deg) scale(.9); opacity: 0; transition: transform .35s cubic-bezier(.2, 1.4, .4, 1), opacity .25s; }
.g-photo.is-in { transform: translate(-50%, -50%) rotate(-2deg) scale(1); opacity: 1; }
.g-photo img { display: block; width: 100%; height: auto; border: 1px solid #d8ccb4; }
.g-photo div { display: flex; gap: 8px; margin-top: 10px; }
.g-photo .g-btn { flex: 1; text-align: center; text-decoration: none; color: #2a1407 !important; }
.g-photo .g-btn.is-ghost { color: #5a3a22 !important; border-color: #c9b08a; }
.g-emo-btn { position: absolute; z-index: 9; right: calc(12px + var(--g-safe-r)); bottom: calc(150px + var(--g-safe-b)); width: 48px; height: 48px; font-size: 24px !important; background: var(--g-wood); border: 1px solid var(--g-line); }
.g-emo { position: absolute; z-index: 9; right: calc(66px + var(--g-safe-r)); bottom: calc(150px + var(--g-safe-b)); display: flex; gap: 4px; padding: 4px; background: var(--g-wood); border: 1px solid var(--g-line); animation: gUp .15s ease-out; }
.g-emo button { width: 42px; height: 42px; font-size: 22px !important; background: none; border: 0; transition: transform .1s; }
.g-emo button:active { transform: scale(1.25); }
#game:has(.g-loading:not(.is-gone)) :is(.g-emo-btn, .g-emo) { display: none; }
