/* =====================================================================
   GIAO DIỆN PHÒNG ÔN THI ẢO (dùng chung biến màu với mô hình 3D)
   ===================================================================== */
:root {
  --po-gold: #f2b632;
  --po-green: #22a861;
  --po-red: #d64545;
  --po-r: 14px;
  --po-gap: 12px;
  --po-side: 360px;
  --po-ok-soft: rgba(34, 168, 97, .13);
  --po-bad-soft: rgba(214, 69, 69, .12);
}
*, *::before, *::after { box-sizing: border-box; }
/* giao diện gốc của mô hình: chỉ giữ bảng thang máy và bàn phím đàn piano */
#scene-dom .hud { z-index: 40; }
#scene-dom .hud > .top, #scene-dom .hud .hint, #scene-dom .hud .views, #scene-dom .dpad, #scene-dom #sitbtn { display: none !important; }
#scene-dom .liftpanel { right: auto; left: max(16px, env(safe-area-inset-left, 0px)); }
body.po-piano #po-mini, body.po-piano #po-quizchip, body.po-piano .po-ticker { display: none !important; }
body.po-piano .po-bottom { bottom: auto; top: 42%; left: auto; right: max(16px, env(safe-area-inset-right, 0px)); align-items: flex-end; z-index: 45; }
#labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }
/* nhãn tên, nhãn toà nhà, gợi ý ghế nằm đè lên khung 3D: vuốt bắt đầu trên chúng vẫn là xoay camera, không để trình duyệt cuộn/phóng trang */
#labels > * { touch-action: none; }
body { overscroll-behavior: none; }
.po-hud[hidden], .po-login[hidden], .po-modal[hidden], [hidden] { display: none !important; }
.po-card { background: var(--panel); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border: 1px solid var(--line); border-radius: var(--po-r); box-shadow: var(--shadow); }
.po-hud button, .po-modal button, .po-login button { font: inherit; color: inherit; }
.po-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 10px 16px; border-radius: 11px; font-weight: 600; font-size: 14px;
  background: var(--accent); color: var(--accent-ink) !important; border: 0; cursor: pointer; transition: transform .12s, filter .15s; white-space: nowrap; }
.po-btn:hover { filter: brightness(1.08); }
.po-btn:active { transform: translateY(1px); }
.po-btn.ghost { background: var(--accent-soft); color: var(--ink) !important; }
.po-btn.line { background: transparent; border: 1px solid var(--line); color: var(--ink) !important; }
.po-btn.warn { background: var(--po-gold); color: #2a2104 !important; }
.po-btn.sm { padding: 7px 11px; font-size: 13px; border-radius: 9px; }
.po-btn[disabled] { opacity: .5; cursor: not-allowed; }
.po-muted { color: var(--muted); }
.po-small { font-size: 12.5px; }
input.po-in, textarea.po-in, select.po-in { font: inherit; font-size: 14px; width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 80%, transparent); color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s; }
input.po-in:focus, textarea.po-in:focus, select.po-in:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.po-in.bad { border-color: var(--po-red); }
textarea.po-in { resize: vertical; min-height: 70px; }

/* ---------- màn chờ ---------- */
.po-splash { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: radial-gradient(circle at 50% 30%, #2b3a7e, #121733 70%); color: #fff; transition: opacity .6s; }
.po-splash.out { opacity: 0; pointer-events: none; }
.po-splash-in { text-align: center; padding: 24px; }
.po-splash h1 { font-size: 28px; margin: 14px 0 6px; color: #fff; }
.po-splash p { margin: 0 0 18px; opacity: .8; font-size: 14px; }
.po-logo { width: 64px; height: 64px; margin: 0 auto; filter: drop-shadow(0 6px 18px rgba(0,0,0,.35)); }
.po-logo.sm { width: 40px; height: 40px; margin: 0; flex: none; filter: none; }
.po-bar { width: 220px; height: 5px; border-radius: 9px; background: rgba(255,255,255,.18); overflow: hidden; margin: 0 auto; }
.po-bar i { display: block; height: 100%; width: 40%; background: #ffd166; border-radius: 9px; animation: po-load 1.2s ease-in-out infinite; }
@keyframes po-load { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }

/* ---------- HUD ---------- */
.po-hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
.po-hud > * { pointer-events: auto; }
.po-top { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); left: max(14px, env(safe-area-inset-left)); right: max(14px, env(safe-area-inset-right));
  display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; pointer-events: none; }
.po-top > * { pointer-events: auto; }
.po-brand { display: flex; align-items: center; gap: 11px; padding: 9px 14px 9px 10px; min-width: 0; }
.po-brand-t { min-width: 0; }
.po-eyebrow { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.po-zone { font-size: 17px; font-weight: 700; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.po-meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.po-net { font-weight: 600; }
.po-net.off { color: var(--po-gold); }
.po-net.bad { color: var(--po-red); }
.po-top-r { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; justify-content: flex-end; }
.po-stats { display: flex; padding: 4px; gap: 2px; }
.po-stat { display: flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: 10px; border: 0; background: none; cursor: pointer; font-variant-numeric: tabular-nums; }
.po-stat:hover { background: var(--accent-soft); }
.po-stat b { font-size: 15px; }
.po-stat span { font-size: 12.5px; color: var(--muted); }
.po-stat .ic { font-size: 14px; color: inherit; }
.po-stat .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--po-green); box-shadow: 0 0 0 3px rgba(34,168,97,.2); animation: po-pulse 2s infinite; }
@keyframes po-pulse { 50% { box-shadow: 0 0 0 6px rgba(34,168,97,0); } }
.po-stat.counting b { color: var(--po-green); }
.po-stat.paused b { color: var(--muted); }
.po-tools { display: flex; padding: 4px; gap: 2px; }
.po-ibtn { display: flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: 10px; border: 0; background: none; cursor: pointer; font-size: 13px; font-weight: 600; }
.po-ibtn:hover { background: var(--accent-soft); }
.po-ibtn.on { background: var(--accent); color: var(--accent-ink); }
.po-ibtn span { font-size: 15px; }

.po-notice { position: absolute; top: 86px; left: 50%; transform: translateX(-50%); max-width: min(620px, calc(100% - 32px)); background: #2b3a7e; color: #fff;
  padding: 10px 40px 10px 16px; border-radius: 12px; box-shadow: var(--shadow); font-size: 14px; font-weight: 500; }
.po-notice b { color: #ffd166; margin-right: 6px; }
.po-notice button { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: #fff; cursor: pointer; font-size: 16px; opacity: .8; }

/* ---------- bảng bên ---------- */
.po-side { position: absolute; right: max(14px, env(safe-area-inset-right)); top: 84px; bottom: 84px; width: var(--po-side); display: flex; flex-direction: column; overflow: hidden; transition: transform .3s, opacity .3s; }
.po-side.closed { transform: translateX(calc(100% + 24px)); opacity: 0; pointer-events: none; }
.po-tabs { display: flex; gap: 2px; padding: 5px; border-bottom: 1px solid var(--line); flex: none; }
.po-tabs button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 4px; border-radius: 9px; border: 0; background: none; cursor: pointer; font-size: 15px; position: relative; color: var(--muted); }
.po-tabs button span { font-size: 11px; font-weight: 600; }
.po-tabs button[aria-selected="true"] { background: var(--accent-soft); color: var(--ink); }
.po-tabs .po-side-x { flex: none; width: 34px; font-size: 13px; }
.po-badge { position: absolute; top: 4px; right: 18%; min-width: 8px; height: 8px; border-radius: 9px; background: var(--po-red); }
.po-pane { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.po-pane h3 { margin: 2px 0 0; font-size: 14px; }
.po-seg { display: flex; background: var(--accent-soft); border-radius: 10px; padding: 3px; gap: 2px; }
.po-seg button { flex: 1; padding: 6px 8px; border-radius: 8px; border: 0; background: none; cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.po-seg button.on { background: var(--accent); color: var(--accent-ink); }

/* xếp hạng */
.po-lb { display: flex; flex-direction: column; gap: 2px; }
.po-lb-row { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 9px; font-size: 13.5px; cursor: pointer; }
.po-lb-row:hover { background: var(--accent-soft); }
.po-lb-row .rk { font-weight: 700; text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; }
.po-lb-row.top1 .rk, .po-lb-row.top2 .rk, .po-lb-row.top3 .rk { font-size: 16px; }
.po-lb-row .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.po-lb-row .v { font-weight: 700; font-variant-numeric: tabular-nums; }
.po-lb-row.me { background: var(--accent-soft); outline: 1px solid var(--accent); }
.po-lb-me { border-top: 1px dashed var(--line); padding-top: 6px; margin-top: 4px; }
.po-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.po-kpi { background: var(--accent-soft); border-radius: 10px; padding: 8px; text-align: center; }
.po-kpi b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; }
.po-kpi span { font-size: 11px; color: var(--muted); }
.po-empty { text-align: center; color: var(--muted); font-size: 13px; padding: 18px 8px; }

/* trò chuyện */
.po-chat { flex: 1; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; min-height: 120px; }
.po-msg { font-size: 13.5px; line-height: 1.4; padding: 6px 9px; border-radius: 10px; background: color-mix(in srgb, var(--accent-soft) 60%, transparent); word-wrap: break-word; }
.po-msg .who { font-weight: 700; margin-right: 5px; cursor: pointer; }
.po-msg .t { font-size: 11px; color: var(--muted); margin-left: 4px; }
.po-msg.mine { background: var(--accent-soft); }
.po-msg.hl { outline: 1.5px solid var(--po-gold); }
.po-msg .tag { color: var(--accent); font-weight: 600; }
.po-msg .rep { float: right; border: 0; background: none; cursor: pointer; opacity: 0; font-size: 11px; color: var(--muted); }
.po-msg:hover .rep { opacity: 1; }
.po-compose { display: flex; flex-direction: column; gap: 6px; flex: none; }
.po-compose-row { display: flex; gap: 6px; }
.po-compose-row .po-in { flex: 1; }
.po-tpls { display: flex; flex-wrap: wrap; gap: 5px; max-height: 120px; overflow-y: auto; }
.po-chip { border: 1px solid var(--line); background: var(--panel); border-radius: 99px; padding: 5px 10px; font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.po-chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.po-chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.po-tagbar { display: flex; align-items: center; gap: 6px; font-size: 12.5px; }

/* hỏi bài */
.po-qa-item { padding: 9px 10px; border-radius: 10px; border: 1px solid var(--line); cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.po-qa-item:hover { border-color: var(--accent); }
.po-qa-item .tt { font-weight: 600; font-size: 13.5px; }
.po-qa-item .mt { font-size: 11.5px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.po-qa-item.pin { background: color-mix(in srgb, var(--po-gold) 12%, transparent); }
.po-subj { font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }
.po-qa-body { font-size: 13.5px; line-height: 1.5; }
.po-ans { border-left: 3px solid var(--accent-soft); padding: 4px 0 4px 10px; font-size: 13.5px; }
.po-ans .who { font-weight: 600; font-size: 12.5px; }

/* của tôi */
.po-me-head { display: flex; gap: 12px; align-items: center; }
.po-me-av { width: 70px; height: 90px; border-radius: 12px; background: var(--accent-soft); flex: none; }
.po-me-name { font-weight: 700; font-size: 16px; }
.po-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13.5px; padding: 4px 0; }
.po-switch { position: relative; width: 38px; height: 22px; flex: none; }
.po-switch input { opacity: 0; position: absolute; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.po-switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--line); transition: background .2s; }
.po-switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform .2s; }
.po-switch input:checked + i { background: var(--accent); }
.po-switch input:checked + i::after { transform: translateX(16px); }
.po-sec { border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.po-pending { background: color-mix(in srgb, var(--po-gold) 18%, transparent); border-radius: 10px; padding: 8px 10px; font-size: 12.5px; }
.po-range { display: grid; grid-template-columns: 1fr 110px; align-items: center; gap: 10px; font-size: 13px; }
.po-range input { width: 100%; accent-color: var(--accent); }

/* ---------- thanh dưới ---------- */
.po-bottom { position: absolute; left: 0; right: 0; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.po-bottom > * { pointer-events: auto; }
.po-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; padding: 0 14px; }
.po-actions .po-btn { box-shadow: var(--shadow); }
/* nút viền (vd. "Dừng đọc sách") nằm trên cảnh 3D: cần nền như thẻ, nền trong suốt thì chữ tối chìm vào cảnh tối */
.po-actions .po-btn.line { background: var(--panel); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.po-ticker { font-size: 12.5px; background: var(--panel); border: 1px solid var(--line); border-radius: 99px; padding: 5px 14px; box-shadow: var(--shadow); color: var(--ink); max-width: calc(100% - 28px); text-align: center; }
.po-ticker b { color: var(--accent); }

/* ---------- nhãn tên trên đầu ---------- */
.po-tag { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; pointer-events: auto; cursor: pointer; will-change: transform; touch-action: none; user-select: none; -webkit-user-select: none; }
.po-name { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: rgba(20, 24, 40, .72); color: #fff; white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.po-tag.me .po-name { background: rgba(34, 140, 84, .9); }
.po-bubble { display: none; max-width: 220px; font-size: 13px; line-height: 1.35; padding: 6px 10px; background: #fff; color: #1f2433; border-radius: 12px; box-shadow: 0 4px 14px rgba(0,0,0,.2); position: relative; text-align: center; }
.po-bubble::after { content: ""; position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%); border: 6px solid transparent; border-top-color: #fff; border-bottom: 0; }
.po-bubble.mention { background: #fff4d1; }
.po-bubble.mention::after { border-top-color: #fff4d1; }
.po-tag.talk .po-bubble { display: block; animation: po-pop .25s ease-out; }
@keyframes po-pop { from { transform: scale(.7); opacity: 0; } }
.po-blabel { position: absolute; left: 0; top: 0; pointer-events: auto; display: flex; flex-direction: column; align-items: center; gap: 1px; border: 0; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 12px; padding: 6px 12px; font: inherit; color: var(--ink); }
.po-blabel b { font-size: 13px; }
.po-blabel span { font-size: 11.5px; color: var(--muted); }
.po-blabel.busy span { color: var(--po-green); font-weight: 600; }
.po-blabel:hover { border-color: var(--accent); }

/* ---------- câu hỏi chung ---------- */
.po-quiz { position: absolute; top: 84px; left: 50%; transform: translateX(-50%); width: min(560px, calc(100% - 28px)); max-height: calc(100% - 180px); overflow-y: auto; padding: 14px 16px 16px; z-index: 3; }
.po-quiz-h { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.po-quiz-h .lbl { flex: 1; min-width: 0; }
.po-quiz-h .lbl b { display: block; font-size: 13px; }
.po-quiz-h .lbl span { font-size: 11.5px; color: var(--muted); }
.po-ring { width: 46px; height: 46px; flex: none; position: relative; }
.po-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.po-ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 14px; font-variant-numeric: tabular-nums; }
.po-q-de { font-size: 15.5px; line-height: 1.55; margin: 6px 0 12px; }
.po-q-ops { display: grid; gap: 7px; }
.po-q-op { display: flex; gap: 10px; align-items: center; text-align: left; padding: 10px 12px; border-radius: 11px; border: 1.5px solid var(--line); background: var(--panel); cursor: pointer; font-size: 14.5px; position: relative; overflow: hidden; }
.po-q-op:hover:not([disabled]) { border-color: var(--accent); }
.po-q-op .k { width: 26px; height: 26px; border-radius: 8px; background: var(--accent-soft); display: grid; place-items: center; font-weight: 700; flex: none; font-size: 13px; }
.po-q-op .tx { flex: 1; position: relative; z-index: 1; }
.po-q-op .pct { position: relative; z-index: 1; font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.po-q-op .fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent-soft); z-index: 0; transition: width .6s; }
.po-q-op.picked { border-color: var(--accent); }
.po-q-op.picked .k { background: var(--accent); color: var(--accent-ink); }
.po-q-op.right { border-color: var(--po-green); background: var(--po-ok-soft); }
.po-q-op.right .k { background: var(--po-green); color: #fff; }
.po-q-op.wrong { border-color: var(--po-red); background: var(--po-bad-soft); }
.po-q-op[disabled] { cursor: default; }
.po-q-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; font-size: 13px; flex-wrap: wrap; }
.po-q-res { font-weight: 700; font-size: 15px; }
.po-q-res.ok { color: var(--po-green); }
.po-q-res.no { color: var(--po-red); }
.po-q-giai { margin-top: 10px; font-size: 13.5px; line-height: 1.55; background: var(--accent-soft); padding: 10px 12px; border-radius: 10px; }
.po-quizchip { position: absolute; top: 84px; left: 50%; transform: translateX(-50%); padding: 7px 14px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 13px; cursor: pointer; white-space: nowrap; }
.po-quizchip.hot { background: var(--accent); color: var(--accent-ink); }

/* ---------- thông báo nhanh ---------- */
.po-toasts { position: fixed; z-index: 60; bottom: calc(118px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column-reverse; gap: 8px; align-items: center; pointer-events: none; width: min(440px, calc(100% - 28px)); }
.po-toast { pointer-events: none; background: var(--panel); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border: 1px solid var(--line); box-shadow: var(--shadow);
  padding: 10px 14px; border-radius: 12px; font-size: 13.5px; animation: po-in .3s ease-out; max-width: 100%; }
.po-toast.err { border-color: var(--po-red); }
.po-toast.gold { border-color: var(--po-gold); }
/* thông báo chỉ để đọc: không chặn thao tác kéo xoay camera / cần điều khiển nằm phía dưới */
.po-toast.out { opacity: 0; transform: translateY(-6px); transition: .3s; }
@keyframes po-in { from { opacity: 0; transform: translateY(-8px); } }

/* ---------- hộp thoại ---------- */
.po-modal { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: rgba(12, 16, 32, .45); padding: 16px; animation: po-fade .2s; }
@keyframes po-fade { from { opacity: 0; } }
.po-dlg { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 20px 22px; position: relative; background: var(--panel); border-radius: 18px; border: 1px solid var(--line); box-shadow: 0 24px 60px rgba(0,0,0,.35); }
@supports (backdrop-filter: blur(1px)) { .po-dlg { background: color-mix(in srgb, var(--panel) 96%, transparent); backdrop-filter: blur(18px); } }
.po-dlg h2 { margin: 0 0 6px; font-size: 21px; line-height: 1.25; }
.po-dlg .x { position: absolute; right: 12px; top: 12px; width: 32px; height: 32px; border-radius: 9px; border: 0; background: var(--accent-soft); cursor: pointer; font-size: 14px; }
.po-dlg-foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.po-feats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.po-feat { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: 12px; background: var(--accent-soft); }
.po-feat .i { font-size: 22px; line-height: 1; }
.po-feat b { display: block; font-size: 13.5px; margin-bottom: 2px; }
.po-feat span { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.po-steps { display: flex; gap: 8px; margin: 6px 0 4px; }
.po-step { flex: 1; display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; line-height: 1.4; }
.po-step i { font-style: normal; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; flex: none; font-size: 12px; }
.po-note { font-size: 11.5px; color: var(--muted); line-height: 1.45; margin-top: 10px; }
.po-card-prof { display: flex; gap: 14px; align-items: center; margin-bottom: 10px; }
.po-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.po-break { text-align: center; }
.po-break .big { font-size: 64px; line-height: 1; margin: 6px 0; }
.po-break .cd { font-size: 44px; font-weight: 800; font-variant-numeric: tabular-nums; margin: 8px 0; }
.po-break ul { text-align: left; font-size: 14px; line-height: 1.6; margin: 8px auto; max-width: 360px; padding-left: 20px; }
.po-bprog { height: 6px; border-radius: 9px; background: var(--line); overflow: hidden; margin: 10px 0; }
.po-bprog i { display: block; height: 100%; background: var(--accent); transition: width 1s linear; }
.po-modal.lock { background: rgba(10, 14, 30, .78); }

/* ---------- đăng nhập ---------- */
.po-login { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; padding: 20px; overflow-y: auto; background: linear-gradient(90deg, rgba(14,18,40,.55), rgba(14,18,40,.05) 60%); }
.po-login-card { width: min(520px, 100%); padding: 22px 22px 18px; display: flex; flex-direction: column; gap: 12px; margin: auto 0; }
.po-login-card h1 { margin: 0; font-size: 24px; }
.po-login-card .lead { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.po-field { display: flex; flex-direction: column; gap: 5px; }
.po-field label { font-size: 12.5px; font-weight: 600; }
.po-field .err { font-size: 12px; color: var(--po-red); min-height: 0; }
.po-field .ok { font-size: 12px; color: var(--po-green); }
.po-check { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; cursor: pointer; line-height: 1.4; }
.po-check input { margin-top: 3px; width: 17px; height: 17px; accent-color: var(--accent); flex: none; }
.po-avbox { display: grid; grid-template-columns: 150px 1fr; gap: 12px; align-items: start; }
.po-avbox canvas { width: 150px; height: 200px; border-radius: 14px; background: linear-gradient(#dfe7ff, #f3f5fb); cursor: grab; touch-action: none; }
.po-opts { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.po-opt-row { display: flex; flex-direction: column; gap: 4px; }
.po-opt-row > span { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.po-opt-row > div { display: flex; flex-wrap: wrap; gap: 4px; }
.po-sw { width: 24px; height: 24px; border-radius: 7px; border: 2px solid transparent; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.po-sw.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--panel) inset; }
.po-start { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.po-start button { padding: 10px; border-radius: 12px; border: 1.5px solid var(--line); background: none; cursor: pointer; text-align: left; display: flex; gap: 9px; align-items: center; }
.po-start button b { display: block; font-size: 13.5px; }
.po-start button span { font-size: 11.5px; color: var(--muted); }
.po-start button.on { border-color: var(--accent); background: var(--accent-soft); }
.po-start button .e { font-size: 22px; }
details.po-more summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent); }
details.po-more > div { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }

/* ---------- cần điều khiển, vòng tập trung ---------- */
.po-joy { position: absolute; left: max(18px, env(safe-area-inset-left)); bottom: calc(90px + env(safe-area-inset-bottom, 0px)); width: 118px; height: 118px; border-radius: 50%;
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); touch-action: none; display: grid; place-items: center; }
.po-joy i { width: 48px; height: 48px; border-radius: 50%; background: var(--accent); box-shadow: 0 4px 12px rgba(0,0,0,.25); display: block; }
.po-focusring { position: absolute; left: max(14px, env(safe-area-inset-left)); top: 90px; padding: 8px 12px; display: flex; gap: 10px; align-items: center; font-size: 13px; }

/* ---------- điện thoại ---------- */
@media (max-width: 860px) {
  :root { --po-side: min(100vw - 20px, 420px); }
  .po-side { top: auto; bottom: 0; right: 0; left: 0; margin: 0 auto; height: min(62vh, 560px); border-radius: 18px 18px 0 0; width: 100%; max-width: 560px; z-index: 4; }
  .po-side.closed { transform: translateY(105%); }
  .po-ibtn em { display: none; }
  .po-stat span:not(.ic) { display: none; }
  .po-top { flex-direction: column; align-items: stretch; }
  .po-top-r { justify-content: space-between; flex-wrap: nowrap; }
  .po-brand { padding: 7px 10px; }
  .po-zone { font-size: 15px; }
  .po-quiz, .po-quizchip, .po-notice { top: 140px; }
  .po-quiz { max-height: calc(100% - 230px); }
  .po-toasts { bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
  .po-meta { font-size: 11px; }
  .po-logo.sm { width: 34px; height: 34px; }
  .po-feats { grid-template-columns: 1fr; }
  .po-steps { flex-direction: column; }
  .po-avbox { grid-template-columns: 110px 1fr; }
  .po-avbox canvas { width: 110px; height: 150px; }
  .po-login { background: rgba(14,18,40,.35); align-items: flex-start; }
  .po-focusring { top: auto; bottom: calc(150px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 420px) {
  .po-stat { padding: 6px 7px; }
  .po-ibtn { padding: 6px 8px; }
  .po-ticker { display: none; }
}
@media (prefers-reduced-motion: reduce) { .po-stat .dot, .po-bar i { animation: none; } }

/* ---------- vị trí hiện tại, bản đồ nhỏ, quan sát ---------- */
.po-place { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.po-place:empty { display: none; }
.po-mini { position: absolute; left: max(16px, env(safe-area-inset-left, 0px)); top: 108px; padding: 6px; z-index: 6; }
.po-mini canvas { display: block; width: 200px; height: 160px; cursor: crosshair; border-radius: 9px; background: #48526a; }
.po-mini-x { position: absolute; top: 2px; right: 2px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: var(--panel); cursor: pointer; font-size: 11px; opacity: .8; }
.po-mini-btn { position: absolute; left: max(16px, env(safe-area-inset-left, 0px)); top: 108px; width: 40px; height: 40px; cursor: pointer; font-size: 18px; z-index: 6; }
.po-observe { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 60; padding: 8px 10px 8px 14px; display: flex; gap: 10px; align-items: center; font-size: 13px; font-weight: 600; }
.po-soon { opacity: .55; cursor: not-allowed; }
input.po-range { width: 130px; accent-color: var(--accent); }
.po-av2 { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
/* phòng thay đồ mở trong khung */
.po-modal.wide { padding: 0; }
.po-dress { width: min(1240px, 100vw); height: min(860px, 100dvh); background: var(--panel); border-radius: 18px; overflow: hidden; box-shadow: 0 24px 60px rgba(0,0,0,.35); }
.po-dress-fr { width: 100%; height: 100%; border: 0; display: block; }
@media (max-width: 860px) {
  .po-soon { display: none; }
  .po-dress { border-radius: 0; }
  .po-mini { top: auto; bottom: calc(230px + env(safe-area-inset-bottom, 0px)); left: auto; right: max(12px, env(safe-area-inset-right, 0px)); }
  .po-mini canvas { width: 140px; height: 112px; }
  .po-mini-btn { top: auto; bottom: calc(230px + env(safe-area-inset-bottom, 0px)); left: auto; right: max(12px, env(safe-area-inset-right, 0px)); }
}

/* ---------- đợt 2 phần 2: mọi người, gợi ý @, nhắn riêng, NPC ---------- */
.po-people { display: flex; flex-direction: column; gap: 6px; }
.po-person { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 12px; background: none; text-align: left; font: inherit; color: inherit; width: 100%; }
button.po-person { cursor: pointer; }
button.po-person:hover { border-color: var(--accent); }
.po-person b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.po-person > div:first-child { min-width: 0; }
.po-person .po-small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.po-person-act { display: flex; gap: 4px; flex: none; }
.po-person-act .po-btn.sm { padding: 6px 9px; }
.po-person.npc { border-style: dashed; }
.po-npc { display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: .06em; padding: 1px 6px; border-radius: 99px; background: #7c3aed; color: #fff; vertical-align: middle; }
.po-tag.npc .po-name { background: rgba(110, 60, 200, .9); }
.po-tag.npc .po-npc { margin-top: -1px; }
.po-at { position: absolute; left: 0; bottom: calc(100% + 4px); z-index: 5; min-width: 200px; max-width: 100%; display: flex; flex-direction: column; padding: 4px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow); }
.po-at-item { text-align: left; padding: 7px 10px; border: 0; border-radius: 8px; background: none; cursor: pointer; font-weight: 600; }
.po-at-item.on, .po-at-item:hover { background: var(--accent-soft); }
.po-near { margin-right: 2px; }
.po-seg button .po-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--po-red); margin-left: 4px; vertical-align: middle; }
.po-badge:not(:empty) { height: 16px; top: 1px; min-width: 16px; padding: 0 4px; font-style: normal; font-size: 10px; line-height: 16px; color: #fff; text-align: center; }

/* ---------- đợt 2 phần 3: cử chỉ, thẻ sinh viên ---------- */
.po-emo-bar { display: flex; gap: 4px; padding: 6px; pointer-events: auto; flex-wrap: wrap; justify-content: center; }
.po-emo-bar button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 9px; border: 0; border-radius: 10px; background: none; cursor: pointer; font-size: 22px; }
.po-emo-bar button:hover { background: var(--accent-soft); }
.po-emo-bar em { font-style: normal; font-size: 11px; font-weight: 600; color: var(--muted); }
canvas.po-idcard { width: 170px; max-width: 45%; height: auto; border-radius: 8px; box-shadow: 0 4px 14px rgba(0,0,0,.18); flex: none; }
.po-me-card { display: flex; justify-content: center; }
.po-me-card canvas.po-idcard { width: 220px; max-width: 80%; }

/* ---------- đợt 2 phần 4: mini-game ---------- */
.po-game { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(120px + env(safe-area-inset-bottom, 0px)); z-index: 30; display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; min-width: min(340px, 92vw); pointer-events: auto; text-align: center; }
.po-game .po-bprog { height: 10px; border-radius: 99px; background: var(--accent-soft); overflow: hidden; }
.po-game .po-bprog i { display: block; height: 100%; background: linear-gradient(90deg, #8cbf3f, #f2b23a); transition: width .15s; }
.po-countdown { position: fixed; inset: 0; display: grid; place-items: center; z-index: 80; pointer-events: none; font: 800 120px/1 "Be Vietnam Pro", system-ui, sans-serif; color: #fff; text-shadow: 0 6px 30px rgba(0,0,0,.45); }
#po-play.on { background: var(--accent-soft); }

/* ---------- lời nhắc theo ngữ cảnh (thay thanh nút dịch chuyển cũ) ---------- */
.po-actions .po-btn.po-ctx { padding: 8px 13px; font-size: 13.5px; border-radius: 99px; gap: 8px; }
.po-actions .po-btn.po-ctx kbd, .po-wheel-btn kbd { font: 700 11px/1 var(--font-ui, system-ui); padding: 3px 6px; border-radius: 6px; background: rgba(255,255,255,.22); border: 1px solid rgba(255,255,255,.35); color: inherit; }
.po-actions .po-btn.ghost.po-ctx kbd, .po-actions .po-btn.line.po-ctx kbd { background: var(--accent-soft); border-color: var(--line); }

/* ---------- vòng hành động nhanh (giữ Q / nút ✋) ---------- */
.po-wheel-btn { position: absolute; right: max(18px, env(safe-area-inset-right)); bottom: calc(18px + env(safe-area-inset-bottom, 0px)); width: 58px; height: 58px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--panel); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: var(--shadow); cursor: pointer; z-index: 7;
  display: grid; place-items: center; font-size: 26px; touch-action: none; user-select: none; -webkit-user-select: none; transition: transform .15s; }
.po-wheel-btn:hover { transform: scale(1.06); }
.po-wheel-btn kbd { position: absolute; right: -4px; bottom: -4px; background: var(--accent); color: var(--accent-ink); border: 0; }
@media (pointer: coarse) { .po-wheel-btn kbd { display: none; } }
body.po-wheel-on .po-wheel-btn { background: var(--accent); color: var(--accent-ink); }
.po-wheel { position: fixed; inset: 0; z-index: 70; background: radial-gradient(circle at 50% 50%, rgba(10, 14, 30, .18), rgba(10, 14, 30, .42)); touch-action: none; user-select: none; -webkit-user-select: none; opacity: 0; transition: opacity .12s; }
.po-wheel.in { opacity: 1; }
.po-wheel-ring { position: absolute; border-radius: 50%; transform: scale(.86); transition: transform .16s cubic-bezier(.2, .9, .3, 1.3); filter: drop-shadow(0 14px 34px rgba(0, 0, 0, .35)); }
.po-wheel.in .po-wheel-ring { transform: scale(1); }
.po-wheel-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.po-wheel-sl { fill: var(--panel); stroke: var(--line); stroke-width: .6; transition: fill .1s; }
.po-wheel-sl.on { fill: var(--accent); }
.po-wheel-it { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 1px; width: 84px; padding: 4px 2px; border: 0; background: none; cursor: pointer; color: var(--ink); font: inherit; border-radius: 12px; }
.po-wheel-it .ic { font-size: 27px; line-height: 1.1; transition: transform .12s; }
.po-wheel-it em { font-style: normal; font-size: 11.5px; font-weight: 700; line-height: 1.15; text-align: center; }
.po-wheel-it i { font-style: normal; font-size: 10px; font-weight: 700; color: var(--muted); }
.po-wheel-it.on { color: var(--accent-ink); }
.po-wheel-it.on .ic { transform: scale(1.18); }
.po-wheel-it.on i { color: inherit; opacity: .8; }
.po-wheel-it.cur::after { content: "đang làm"; position: absolute; top: -10px; font-size: 9.5px; font-weight: 800; padding: 1px 6px; border-radius: 99px; background: var(--po-green); color: #fff; }
.po-wheel-it:focus-visible, .po-wheel-hub:focus-visible { outline: 3px solid var(--po-gold); outline-offset: 1px; }
.po-wheel-hub { position: absolute; left: 50%; top: 50%; width: 34%; height: 34%; transform: translate(-50%, -50%); border-radius: 50%; border: 1px solid var(--line); background: var(--panel);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; cursor: pointer; color: var(--ink); font: inherit; padding: 4px; }
.po-wheel-hub .ic { font-size: 22px; line-height: 1; }
.po-wheel-hub em { font-style: normal; font-size: 11px; font-weight: 700; line-height: 1.15; text-align: center; max-width: 100%; }
.po-wheel-hub.stop { background: color-mix(in srgb, var(--po-red) 16%, var(--panel)); }
.po-wheel-hint { position: absolute; transform: translateX(-50%); white-space: nowrap; max-width: calc(100vw - 24px); overflow: hidden; text-overflow: ellipsis; font-size: 12.5px; font-weight: 600; color: #fff; background: rgba(14, 18, 36, .72); padding: 5px 12px; border-radius: 99px; }
@media (max-width: 860px) {
  .po-wheel-btn { bottom: calc(96px + env(safe-area-inset-bottom, 0px)); width: 62px; height: 62px; }
  .po-wheel-it { width: 72px; }
  .po-wheel-it em { font-size: 10.5px; }
  .po-wheel-hint { white-space: normal; text-align: center; width: calc(100vw - 32px); }
}
@media (prefers-reduced-motion: reduce) { .po-wheel, .po-wheel-ring { transition: none; } }
@media (max-height: 360px) {
  .po-wheel-it { width: 64px; gap: 0; padding: 2px; }
  .po-wheel-it .ic { font-size: 21px; }
  .po-wheel-it em, .po-wheel-hub em { font-size: 9px; }
  .po-wheel-it i { display: none; }
  .po-wheel-hint { font-size: 10px; line-height: 1.2; padding: 3px 8px; }
}

/* ---------- bong bóng chat trên đầu nhân vật ---------- */
.po-bubbles { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.po-bubbles:empty { display: none; }
.po-bubbles .po-bubble { display: block; max-width: min(240px, 70vw); overflow-wrap: anywhere; animation: po-pop .25s ease-out; transition: opacity .4s, transform .4s; }
.po-bubbles .po-bubble > span { display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.po-bubbles .po-bubble.old { opacity: .72; transform: scale(.88); transform-origin: 50% 100%; }
.po-bubbles .po-bubble.old::after { display: none; }
.po-bubbles .po-bubble.out { opacity: 0; transform: translateY(-6px) scale(.92); }
.po-bubbles .po-bubble.icon { font-size: 20px; line-height: 1.1; padding: 4px 8px; }
.po-tag.pinned .po-name { display: none; }
@media (max-height: 480px) {
  .po-bubbles .po-bubble.old { display: none; }
  .po-bubbles .po-bubble > span { -webkit-line-clamp: 2; line-clamp: 2; }
}

.po-startup-error { max-width: 440px; margin: 18px auto 0; padding: 0 16px; }
.po-startup-error p { line-height: 1.6; }
