/* Huế Du Ký - Truy tìm Sổ Lộc | css/styles.css | v0.5.0
   Bảng màu: tím đêm sông Hương, vàng hoàng cung, xanh ngọc ngói lưu ly, đỏ son (chỉ dùng cho con dấu).
   Chữ: Noto Serif Display cho tiêu đề, Be Vietnam Pro cho nội dung. */
:root {
  --dem: #241C4A;
  --dem2: #2F2660;
  --tim: #5B4BA6;
  --lilac: #E9E4F5;
  --giay: #F7F4FB;
  --vang: #D9A62E;
  --vang-d: #8A6208;
  --ngoc: #2C8C8A;
  --ngoc-d: #1E6664;
  --son: #B3352C;
  --muc: #1E1936;
  --muc2: #4A4466;
  --line: #D8D0EA;
  --disp: 'Noto Serif Display', 'Playfair Display', Georgia, 'Times New Roman', serif;
  --body: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--body); font-size: 15.5px; line-height: 1.55; color: var(--muc);
  background-color: var(--dem);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='44'%3E%3Cpath d='M22 8 L36 22 L22 36 L8 22 Z' fill='none' stroke='%23D9A62E' stroke-opacity='.12' stroke-width='1'/%3E%3C/svg%3E");
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--vang); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--disp); margin: 0; line-height: 1.2; }
p { margin: 0 0 .7em; }

.app { max-width: 460px; margin: 0 auto; min-height: 100dvh; background: var(--giay); position: relative; display: flex; flex-direction: column; box-shadow: 0 0 0 1px rgba(0,0,0,.25), 0 24px 70px rgba(0,0,0,.5); }
.top { background: var(--dem); color: #fff; padding: 10px 14px; display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 5; border-bottom: 2px solid var(--vang); }
.brand { flex: 1; font-family: var(--disp); font-weight: 700; font-size: 19px; line-height: 1.1; }
.brand small { display: block; font-family: var(--body); font-weight: 500; font-size: 11.5px; color: #CFC6EE; margin-top: 2px; }
.pts { display: flex; align-items: center; gap: 6px; background: rgba(255,255,255,.08); border: 1px solid rgba(217,166,46,.55); border-radius: 999px; padding: 4px 11px 4px 6px; font-weight: 600; font-variant-numeric: tabular-nums; }
.coin { width: 20px; height: 20px; flex: none; }
.me-btn { width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--vang); background: var(--lilac); padding: 0; overflow: hidden; flex: none; }
.me-btn svg { width: 100%; height: 100%; display: block; }
main.page { flex: 1; padding: 14px 14px 100px; }
main.page > h2 { font-size: 22px; margin: 4px 0 4px; }
.sub { color: var(--muc2); margin-bottom: 12px; }

nav.tabs { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 460px; background: #fff; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr); z-index: 6; padding-bottom: env(safe-area-inset-bottom); }
.tab { background: none; border: 0; padding: 8px 2px 9px; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 600; color: var(--muc2); border-top: 3px solid transparent; }
.tab svg { width: 24px; height: 24px; }
.tab.on { color: var(--dem); border-top-color: var(--vang); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 2px solid var(--dem); background: transparent; color: var(--dem); border-radius: 12px; padding: 11px 18px; font-weight: 700; min-height: 46px; }
.btn.primary { background: var(--ngoc); border-color: var(--ngoc); color: #fff; }
.btn.primary:hover { background: var(--ngoc-d); border-color: var(--ngoc-d); }
.btn.gold { background: var(--vang); border-color: var(--vang); color: var(--muc); }
.btn.dark { background: var(--dem); color: #fff; }
.btn.block { display: flex; width: 100%; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 14px; border-radius: 10px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.stack > * + * { margin-top: 10px; }

/* Màn mở đầu */
.splash { background: linear-gradient(180deg, var(--dem) 0%, var(--dem2) 62%, #4B3C8F 100%); color: #fff; padding: 28px 22px 26px; min-height: 100dvh; display: flex; flex-direction: column; }
.splash .logo { font-family: var(--disp); font-size: 38px; font-weight: 700; line-height: 1.05; }
.splash .logo span { display: block; font-size: 19px; font-weight: 500; color: var(--vang); margin-top: 8px; letter-spacing: .2px; }
.splash .hero { flex: 1; display: flex; align-items: flex-end; justify-content: center; margin: 4px 0 -4px; min-height: 280px; position: relative; }
.splash .hero svg.avatar { height: min(52dvh, 400px); width: auto; filter: drop-shadow(0 10px 18px rgba(0,0,0,.35)); }
.splash .hero::before { content: ''; position: absolute; bottom: 1%; left: 8%; right: 8%; top: 12%; border-radius: 200px 200px 14px 14px; border: 2px solid rgba(217,166,46,.55); background: radial-gradient(ellipse at 50% 30%, rgba(217,166,46,.28), transparent 70%); }
.splash .note { font-size: 13px; color: #CFC6EE; margin-top: 14px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; margin-bottom: 5px; }
.field input[type=text], .field input[type=email] { width: 100%; padding: 12px 13px; border-radius: 12px; border: 2px solid var(--line); background: #fff; color: var(--muc); }
.field input:focus { border-color: var(--tim); outline: none; box-shadow: 0 0 0 3px rgba(91,75,166,.25); }
.splash .field input { border-color: transparent; }
.splash .field label { color: #E7E1FA; }
.help { font-size: 13px; color: var(--muc2); }
.splash .help { color: #CFC6EE; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.seg button { padding: 9px 6px; border-radius: 10px; border: 2px solid var(--line); background: #fff; font-weight: 600; }
.seg button.on { border-color: var(--ngoc); background: #E3F2F1; color: var(--ngoc-d); }
.swatches { display: flex; gap: 10px; }
.swatches button { width: 40px; height: 40px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--line); padding: 0; }
.swatches button.on { box-shadow: 0 0 0 3px var(--ngoc); }

/* Sân khấu nhân vật */
.stage { position: relative; margin: 6px auto 12px; width: 100%; max-width: 330px; aspect-ratio: 5 / 6; border-radius: 170px 170px 18px 18px; background: radial-gradient(ellipse at 50% 28%, #6B59C2 0%, var(--dem2) 62%, var(--dem) 100%); border: 3px solid var(--vang); display: flex; align-items: flex-end; justify-content: center; overflow: hidden; }
.stage::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 12%; background: linear-gradient(0deg, rgba(0,0,0,.35), transparent); pointer-events: none; }
.stage svg.avatar { height: 94%; width: auto; position: relative; z-index: 1; }
.stage .scene-bg { position: absolute; inset: 0; opacity: .0; }
.stage .rank-tag { position: absolute; top: 14px; left: 0; right: 0; text-align: center; color: #F4E3AE; font-family: var(--disp); font-size: 15px; z-index: 2; }

/* Chương và nhiệm vụ */
.quest { display: grid; grid-template-columns: 52px 1fr; gap: 12px; background: #fff; border: 2px solid var(--vang); border-radius: 16px; padding: 12px; margin-bottom: 14px; }
.quest .npc { width: 52px; height: 52px; }
.quest h3 { font-size: 16px; margin-bottom: 3px; }
.quest p { margin: 0 0 6px; font-size: 14px; color: var(--muc2); }
.qsteps { display: flex; flex-direction: column; gap: 6px; }
.qstep { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: var(--giay); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; font-size: 14px; font-weight: 600; }
.qstep i { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); flex: none; display: grid; place-items: center; font-style: normal; font-size: 12px; color: #fff; }
.qstep.ok i { background: var(--ngoc); border-color: var(--ngoc); }
.qstep.ok { color: var(--muc2); }
.daily { display: flex; justify-content: space-between; font-size: 13px; color: var(--muc2); margin: 0 2px 10px; }

/* Đường hành trình */
.region { margin-bottom: 8px; }
.banner { background: var(--dem2); color: #fff; border-radius: 14px; padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 4px solid var(--vang); margin: 6px 0 0; }
.banner h3 { font-size: 18px; }
.banner small { color: #CFC6EE; font-size: 13px; display: block; margin-top: 2px; }
.banner .prog { font-weight: 700; color: var(--vang); font-variant-numeric: tabular-nums; white-space: nowrap; }
.trow { position: relative; height: 104px; }
.trow svg.link { position: absolute; inset: 0; width: 100%; height: 100%; }
.trow svg.link path { fill: none; stroke: var(--vang); stroke-width: 3; stroke-dasharray: 2 7; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.node { position: absolute; z-index: 3; top: 20px; width: 66px; height: 66px; margin-left: -33px; border-radius: 50%; border: 3px dashed #A89FC4; background: var(--lilac); padding: 0; overflow: visible; }
.node .thumb { position: absolute; inset: 0; border-radius: 50%; overflow: hidden; filter: grayscale(.85) opacity(.75); }
.node .thumb svg { width: 100%; height: 100%; display: block; }
.node.v { border: 3px solid var(--ngoc); }
.node.v .thumb { filter: none; }
.node.r { border: 3px solid var(--vang); }
.node .tag { position: absolute; right: -4px; bottom: -4px; min-width: 24px; height: 24px; border-radius: 12px; background: var(--dem); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; padding: 0 6px; border: 2px solid var(--giay); }
.node.v .tag { background: var(--ngoc); }
.node.r .tag { background: var(--vang); color: var(--muc); }
.node .mini-seal { position: absolute; left: -10px; top: -10px; width: 30px; height: 30px; transform: rotate(-14deg); }
.nlabel { position: absolute; z-index: 2; top: 24px; width: 42%; background: var(--giay); padding: 4px 8px; border-radius: 10px; font-size: 14px; line-height: 1.25; font-weight: 600; }
.nlabel small { display: block; font-weight: 500; color: var(--muc2); font-size: 12.5px; margin-top: 2px; }

/* Bảng chọn (sheet) */
#sheet { position: fixed; inset: 0; z-index: 20; display: none; }
#sheet.open { display: block; }
#sheet .backdrop { position: absolute; inset: 0; background: rgba(20,14,48,.62); }
#sheet .panel { position: absolute; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 460px; max-height: 92dvh; background: var(--giay); border-radius: 22px 22px 0 0; overflow-y: auto; box-shadow: 0 -10px 40px rgba(0,0,0,.4); }
.sheet-scene { position: relative; height: 150px; }
.sheet-scene svg { width: 100%; height: 100%; display: block; }
.sheet-scene .close { position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255,255,255,.9); font-size: 22px; line-height: 1; }
.sheet-plain-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 0; }
.sheet-plain-head .close { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--lilac); font-size: 22px; }
.sheet-body { padding: 16px 16px 24px; }
.sheet-body h2 { font-size: 24px; margin-bottom: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 12px; }
.chip { font-size: 12.5px; font-weight: 600; background: var(--lilac); color: var(--dem); border-radius: 999px; padding: 3px 10px; }
.chip.gold { background: #F6E7B8; color: #5E4306; }
.chip.ok { background: #D7EEEC; color: var(--ngoc-d); }
.story p { font-size: 16px; line-height: 1.65; max-width: 62ch; }
.readbar { height: 6px; background: var(--lilac); border-radius: 3px; overflow: hidden; margin: 12px 0; }
.readbar i { display: block; height: 100%; width: 0; background: var(--ngoc); transition: width 6s linear; }
.readbar.go i { width: 100%; }
.msg { border-radius: 12px; padding: 10px 12px; font-size: 14.5px; margin: 10px 0; }
.msg.err { background: #FBE6E4; color: #7C1F18; }
.msg.info { background: var(--lilac); color: var(--dem); }
.msg.test { background: #FFF3D1; color: #5E4306; }

.qhead { display: flex; justify-content: space-between; color: var(--muc2); font-size: 13.5px; margin-bottom: 6px; }
.qtext { font-family: var(--disp); font-size: 20px; line-height: 1.3; margin-bottom: 12px; }
.qopt { display: block; width: 100%; text-align: left; background: #fff; border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; font-weight: 600; }
.qopt.right { border-color: var(--ngoc); background: #DDF1EF; }
.qopt.wrong { border-color: var(--son); background: #FBE6E4; }
.qopt[disabled] { cursor: default; }

.result h2 { font-size: 24px; }
.lines { list-style: none; padding: 0; margin: 12px 0; }
.lines li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.lines li b { color: var(--vang-d); font-variant-numeric: tabular-nums; white-space: nowrap; }
.total { display: flex; justify-content: space-between; font-family: var(--disp); font-size: 22px; padding: 6px 0 12px; }
.sealwrap { display: grid; place-items: center; padding: 6px 0 4px; }
.sealwrap svg.seal { width: 118px; height: 118px; transform: rotate(-10deg); animation: thump .5s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes thump { 0% { transform: rotate(-24deg) scale(2.4); opacity: 0; } 60% { opacity: 1; } 100% { transform: rotate(-10deg) scale(1); opacity: 1; } }
.unlock { background: #F6E7B8; border: 1px solid #E5C568; border-radius: 12px; padding: 10px 12px; margin: 8px 0; font-weight: 600; }

/* Món ngon */
.dishes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.dish { background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 10px; text-align: left; display: flex; flex-direction: column; gap: 6px; }
.dish svg { width: 100%; height: 74px; }
.dish b { font-size: 15px; line-height: 1.25; }
.dish small { color: var(--muc2); font-size: 12.5px; }
.dish.l { border-color: var(--ngoc); }
.dish.a { border-color: var(--vang); }
.dish.off { background: transparent; border-style: dashed; opacity: .7; cursor: default; }

/* Tủ đồ */
.slots { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; }
.slots button { flex: none; padding: 7px 12px; border-radius: 999px; border: 2px solid var(--line); background: #fff; font-weight: 600; font-size: 14px; }
.slots button.on { background: var(--dem); border-color: var(--dem); color: #fff; }
.items { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.item { background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 10px 12px; text-align: left; min-height: 78px; }
.item b { display: block; font-size: 14.5px; line-height: 1.25; margin-bottom: 4px; }
.item small { color: var(--muc2); font-size: 12.5px; }
.item.worn { border-color: var(--ngoc); background: #E8F5F4; }
.item.lock { background: #F0ECF8; }
.price { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; color: var(--vang-d); }
.price svg { width: 14px; height: 14px; }
.looks { margin: 12px 0; }
.looks .field { margin-bottom: 12px; }

/* Sổ Lộc */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.stat { background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.stat b { display: block; font-family: var(--disp); font-size: 24px; line-height: 1.1; }
.stat small { color: var(--muc2); font-size: 13px; }
.rankbar { height: 8px; background: var(--lilac); border-radius: 4px; overflow: hidden; margin-top: 6px; }
.rankbar i { display: block; height: 100%; background: var(--vang); }
h3.sec { font-size: 18px; margin: 18px 0 8px; }
.stamps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stampc { position: relative; background: #fff; border: 2px dashed var(--line); border-radius: 12px; padding: 8px 6px; text-align: center; font-size: 12.5px; font-weight: 600; min-height: 74px; display: flex; align-items: center; justify-content: center; line-height: 1.25; }
.stampc.v { border: 2px solid var(--ngoc); background: #E8F5F4; }
.stampc.r { border: 2px solid var(--vang); background: #FBF2D6; }
.stampc svg.seal { position: absolute; right: -6px; top: -8px; width: 34px; height: 34px; transform: rotate(-12deg); }
.badges { display: flex; flex-wrap: wrap; gap: 8px; }
.ledger { list-style: none; padding: 0; margin: 0; }
.ledger li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.ledger b { font-variant-numeric: tabular-nums; }
.ledger .neg { color: var(--son); }
.ledger .pos { color: var(--ngoc-d); }
.empty { color: var(--muc2); background: var(--lilac); border-radius: 12px; padding: 12px; }

.bubble { display: grid; grid-template-columns: 56px 1fr; gap: 12px; align-items: start; margin-bottom: 12px; }
.bubble .npc { width: 56px; height: 56px; }
.bubble div { background: var(--lilac); border-radius: 4px 16px 16px 16px; padding: 10px 13px; }

#toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 30; background: var(--dem); color: #fff; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--vang); max-width: 90%; font-size: 14.5px; display: none; }
#toast.on { display: block; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (prefers-reduced-motion: reduce) {
  .sealwrap svg.seal { animation: none; }
  .readbar i { transition: none; }
}
@media (min-width: 520px) {
  .app { border-radius: 0; }
}

/* v0.2: trải nghiệm, nhiệm vụ mùa, mini-game, thẻ ảnh */
.seasonstrip { display: block; width: 100%; text-align: left; background: #F6E7B8; border: 2px solid var(--vang); border-radius: 14px; padding: 10px 12px; margin-bottom: 12px; }
.seasonstrip b { display: block; font-family: var(--disp); font-size: 15.5px; color: var(--muc); }
.seasonstrip span { font-size: 13.5px; color: #5E4306; }
.season { background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 12px; margin-bottom: 10px; }
.season.done { border-color: var(--ngoc); background: #F0F8F7; }
.season .shead { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.season .shead b { font-family: var(--disp); font-size: 17px; line-height: 1.25; }
.season p { margin: 0 0 6px; font-size: 14.5px; }
.steps { list-style: none; padding: 0; margin: 6px 0; }
.steps li { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 14.5px; }
.steps li i { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); flex: none; display: grid; place-items: center; font-style: normal; font-size: 12px; color: #fff; }
.steps li.ok i { background: var(--ngoc); border-color: var(--ngoc); }
.xgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 6px; }
.xcard { background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 10px 12px; text-align: left; min-height: 84px; display: flex; flex-direction: column; gap: 4px; }
.xcard b { font-size: 15px; line-height: 1.25; }
.xcard small { color: var(--muc2); font-size: 12.5px; line-height: 1.35; }
.xcard.off2 { background: #F0ECF8; }
svg.gart { width: 100%; height: auto; display: block; border-radius: 14px; margin-bottom: 10px; }
.gbar { height: 10px; background: var(--lilac); border-radius: 5px; overflow: hidden; margin: 8px 0 4px; }
.gbar i { display: block; height: 100%; background: var(--ngoc); transition: width .15s; }
.btn.big { min-height: 64px; font-size: 18px; }
.pond { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0; }
.cell { aspect-ratio: 1.3; border-radius: 14px; border: 2px solid #8EC7C4; background: linear-gradient(180deg, #A9D8D6, #6FB5B3); padding: 0; display: grid; place-items: center; }
.cell.on { border-color: var(--vang); background: linear-gradient(180deg, #CFEDEA, #8EC7C4); }
.cell svg { width: 70%; height: auto; }
.codebox { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--lilac); border-radius: 12px; padding: 8px 10px; margin: 8px 0; }
.codebox b { font-family: var(--disp); font-size: 20px; letter-spacing: 1px; }
.cardimg { width: 100%; height: auto; border-radius: 14px; display: block; margin-bottom: 8px; border: 1px solid var(--line); }
select { width: 100%; padding: 11px 12px; border-radius: 12px; border: 2px solid var(--line); background: #fff; font: inherit; color: var(--muc); }
.sheet-body .field input[type=text] { width: 100%; padding: 10px 12px; border-radius: 10px; border: 2px solid var(--line); background: #fff; min-width: 0; }
.row > input { flex: 1 1 60%; }
.row > .btn.small { flex: 0 0 auto; }
@media (prefers-reduced-motion: reduce) { .gbar i { transition: none; } }

/* ===== v0.3: Quảng trường Ngọ Môn (phòng chung) ===== */
body.room-open { overflow: hidden; }
.roomcard { display: grid; grid-template-columns: 112px 1fr; gap: 0; background: var(--dem); color: #fff; border: 2px solid var(--vang); border-radius: 16px; overflow: hidden; margin-bottom: 14px; }
.roomcard .rc-scene { position: relative; min-height: 150px; }
.roomcard .rc-scene svg.rc-art { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.roomcard .rc-body { padding: 12px 14px 14px; }
.roomcard h3 { font-size: 18px; margin-bottom: 3px; }
.roomcard p { margin: 0 0 6px; font-size: 14px; color: #D9D2F0; }
.roomcard .rc-note { color: var(--vang); font-size: 13px; }

.room { position: fixed; inset: 0; z-index: 25; background: #120E2E; display: flex; justify-content: center; }
.room-wrap { position: relative; width: 100%; max-width: 460px; height: 100dvh; overflow: hidden; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.room-bg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.room-stage { position: absolute; inset: 0; cursor: pointer; }
.room-top { position: absolute; top: 0; left: 0; right: 0; z-index: 3000; display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 12px 10px; background: linear-gradient(180deg, rgba(18,14,46,.88), rgba(18,14,46,0)); pointer-events: none; color: #fff; }
.room-top > * { pointer-events: auto; }
.room-back { border: 1.5px solid var(--vang); background: rgba(36,28,74,.85); color: #fff; border-radius: 999px; padding: 8px 14px; font-weight: 700; min-height: 40px; }
.room-title { flex: 1; min-width: 0; line-height: 1.15; }
.room-title b { font-family: var(--disp); font-size: 16.5px; display: block; line-height: 1.2; }
.room-title small { font-size: 12px; color: #CFC6EE; }
.room-title small.on { color: #8FE3C8; }
.room-count { font-size: 12px; text-align: right; color: #E7E1FA; line-height: 1.35; background: rgba(36,28,74,.7); border-radius: 10px; padding: 4px 9px; }
.room-count b { color: var(--vang); font-size: 14px; }
.room-check { position: absolute; top: calc(62px + env(safe-area-inset-top)); left: 12px; right: 12px; z-index: 3000; pointer-events: none; text-align: center; }
.room-check span { display: inline-block; background: rgba(36,28,74,.85); color: #F4E3AE; border: 1px solid rgba(217,166,46,.6); border-radius: 999px; padding: 4px 12px; font-size: 12.5px; }
.room-check span.ok { color: #8FE3C8; border-color: rgba(143,227,200,.5); }
.room-check i { display: block; height: 3px; background: var(--vang); border-radius: 3px; margin: 5px auto 0; max-width: 200px; transition: width .3s linear; }
.room-bar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3000; display: flex; gap: 8px; padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(0deg, rgba(18,14,46,.95), rgba(18,14,46,0)); }
.room-bar button { flex: 1; min-height: 46px; border-radius: 12px; border: 2px solid rgba(217,166,46,.7); background: rgba(36,28,74,.92); color: #fff; font-weight: 700; font-size: 13px; padding: 6px 2px; white-space: nowrap; }
.room-bar button:active { background: var(--tim); }
.room-pop { position: absolute; left: 10px; right: 10px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 3001; background: rgba(36,28,74,.97); border: 2px solid var(--vang); border-radius: 16px; padding: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.room-pop[hidden] { display: none; }
.room-pop b { grid-column: 1 / -1; color: var(--vang); font-family: var(--disp); font-size: 15px; }
.room-pop button { border: 1.5px solid #6B5BB5; background: #2F2660; color: #fff; border-radius: 10px; padding: 9px 8px; font-size: 13.5px; font-weight: 600; text-align: left; min-height: 42px; }
.room-pop button.on { border-color: var(--vang); background: #4A3D91; }

.ent { position: absolute; transform: translate(-50%, -100%); pointer-events: none; }
.ent-body { transform-origin: 50% 92%; }
.ent-av { display: block; height: calc(var(--eh) * var(--sc)); width: auto; filter: drop-shadow(0 3px 4px rgba(0,0,0,.4)); }
.ent.bot .ent-av { opacity: .94; }
.ent.me::before { content: ''; position: absolute; left: 50%; bottom: -2%; width: calc(var(--eh) * var(--sc) * .38); height: calc(var(--eh) * var(--sc) * .1); transform: translateX(-50%); border: 2px solid var(--vang); border-radius: 50%; background: rgba(217,166,46,.22); }
.ent-name { position: absolute; left: 50%; top: 100%; transform: translateX(-50%); margin-top: 1px; white-space: nowrap; text-align: center; color: #fff; font-weight: 700; font-size: calc(9px + 3.5px * var(--sc)); line-height: 1.15; text-shadow: 0 1px 3px #000, 0 0 6px rgba(0,0,0,.7); }
.ent-name i { font-style: normal; font-weight: 500; font-size: .8em; color: #B9AEE0; margin-left: 4px; }
.ent-name small { display: block; font-weight: 500; font-size: .82em; color: #F4E3AE; }
.ent.me .ent-name { color: var(--vang); }
.ent-bub { position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%); margin-bottom: 4px; background: #fff; color: var(--muc); border-radius: 12px; padding: 4px 9px; font-size: calc(10px + 3px * var(--sc)); font-weight: 600; line-height: 1.25; max-width: 168px; width: max-content; text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.ent-bub[hidden] { display: none; }
.ent-bub::after { content: ''; position: absolute; left: 50%; top: 100%; margin-left: -5px; border: 5px solid transparent; border-top-color: #fff; }
.ent-fx { position: absolute; left: 50%; bottom: 66%; width: calc(var(--eh) * var(--sc) * .3); transform: translateX(40%); pointer-events: none; }
.ent-fx svg { width: 100%; height: auto; display: block; animation: fxpop 1.2s ease-out both; }
@keyframes fxpop { 0% { transform: scale(.4); opacity: 0; } 25% { transform: scale(1.1); opacity: 1; } 100% { transform: scale(1) translateY(-8px); opacity: 0; } }
.ent.walk .ent-body { animation: bob .36s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3.5%); } }
.ent.a-wave .ent-body { animation: wavey 1.4s ease-in-out; }
@keyframes wavey { 0%, 100% { transform: rotate(0); } 15% { transform: rotate(-6deg); } 30% { transform: rotate(6deg); } 45% { transform: rotate(-6deg); } 60% { transform: rotate(6deg); } 80% { transform: rotate(0); } }
.ent.a-clap .ent-body { animation: clapy 1.4s ease-in-out; }
@keyframes clapy { 0%, 100% { transform: scale(1, 1); } 12%, 36%, 60% { transform: scale(1.04, .96); } 24%, 48%, 72% { transform: scale(.98, 1.02); } }
.ent.a-bow .ent-body { animation: bowy 1.5s ease-in-out; }
@keyframes bowy { 0%, 100% { transform: rotate(0); } 30%, 65% { transform: rotate(14deg) translateY(2%); } }
@media (prefers-reduced-motion: reduce) { .ent.walk .ent-body, .ent.a-wave .ent-body, .ent.a-clap .ent-body, .ent.a-bow .ent-body, .ent-fx svg { animation: none; } }

/* ===== v0.3.2: nút về app Huế City ===== */
.home-btn { width: 38px; height: 38px; flex: none; border-radius: 50%; border: 2px solid rgba(217,166,46,.7); background: rgba(255,255,255,.08); color: #fff; display: grid; place-items: center; text-decoration: none; margin-right: -2px; }
.home-btn svg { width: 22px; height: 22px; }
.home-btn:active { background: var(--tim); }

/* ===== v0.4.0: ảnh thật từ huecity.net, album, Xem thêm ===== */
.sheet-scene.has-photo { height: 200px; background: #2a2150; }
.sheet-scene .cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.sheet-scene .close { z-index: 2; }
.album { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 10px 0 8px; }
.album .thumb { padding: 0; border: 0; border-radius: 10px; overflow: hidden; aspect-ratio: 1; background: var(--lilac); cursor: pointer; position: relative; }
.album .tpic, .gph .gpic { width: 100%; height: 100%; object-fit: cover; display: block; }
.btn.more-btn { margin: 4px 0 10px; }
.grid-ph { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 12px 0; }
.gph { padding: 0; border: 0; border-radius: 12px; overflow: hidden; aspect-ratio: 4/3; background: var(--lilac); cursor: pointer; position: relative; }
.viewer { margin: 12px 0 8px; border-radius: 14px; overflow: hidden; background: #1c1640; min-height: 180px; display: flex; align-items: center; justify-content: center; position: relative; }
.viewer .vpic { width: 100%; max-height: 52dvh; object-fit: contain; display: block; }
.vnav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-weight: 700; }
.vnav .btn { min-width: 56px; font-size: 22px; line-height: 1; }
.noimg::after { content: 'Ảnh chưa tải được. Mở bài trên huecity.net để xem.'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 10px; font-size: 12px; color: #6b5fa0; }
.sheet-scene.noimg::after { display: none; }
.viewer.noimg::after { position: static; padding: 40px 16px; color: #CFC6EE; }
.info-list { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 10px 0; font-size: 14px; }
.info-list dt { font-weight: 700; color: var(--tim, #4b3a8f); }
.info-list dd { margin: 0; }
a.btn { display: block; text-align: center; text-decoration: none; }

/* ===== v0.5.0: phòng trải nghiệm 2D (js/scenes.js) ===== */
svg.gscene { width: 100%; height: auto; display: block; border-radius: 14px; margin-bottom: 8px; background: #EAE3F6; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.gscene .hit { fill: #000; fill-opacity: 0; cursor: pointer; }
.gscene .fig { transition: transform .45s ease-out; pointer-events: none; }
.gscene .arm { transform-origin: 0 0; transition: transform .2s; }
.gscene .fig.push .arm { transform: rotate(-82deg); }
.gscene .fig.pull .arm { transform: rotate(-66deg); }
.gscene .fig.pL .arm.L, .gscene .fig.pR .arm.R { animation: sc-armpush .3s ease-in-out; }
@keyframes sc-armpush { 50% { transform: rotate(-104deg); } }
.gscene .fig.ba.happy .arm.R { transform: rotate(150deg); }
.gscene .tools { transform-origin: 0 0; }
.gscene .tools.work { animation: sc-work .4s ease-in-out; }
@keyframes sc-work { 0%, 100% { transform: rotate(0); } 40% { transform: rotate(22deg); } 70% { transform: rotate(-8deg); } }
.gscene #sc-me .t { display: none; }
.gscene #sc-me.tool-gat .t-gat, .gscene #sc-me.tool-quet .t-quet, .gscene #sc-me.tool-xoi .t-xoi { display: inline; }
.gscene .item { transition: transform .55s cubic-bezier(.3, 1.4, .5, 1); }
.gscene .item.saved { pointer-events: none; }
.gscene .item.saved .sp { opacity: 0; }
.gscene .mudp { transition: transform .35s ease-out, opacity .35s; transform-box: fill-box; transform-origin: center; }
.gscene .stain { transition: opacity .6s; }
.gscene .flick { animation: sc-flick 1.1s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes sc-flick { from { transform: scaleY(.82); } to { transform: scaleY(1.18); } }
.gscene .fx { opacity: 0; transform-box: fill-box; transform-origin: center; }
.gscene .fx.pop { animation: sc-pop .6s ease-out; }
@keyframes sc-pop { 0% { opacity: 1; transform: scale(.4); } 100% { opacity: 0; transform: scale(1.9); } }
.gscene .cloud { animation: sc-cloud 40s linear infinite alternate; }
.gscene .cloud.c2 { animation-duration: 55s; }
@keyframes sc-cloud { from { transform: translateX(-30px); } to { transform: translateX(60px); } }
.gscene .rip { animation: sc-rip 3s linear infinite; }
@keyframes sc-rip { to { transform: translateX(-40px); } }
.gscene .bob { animation: sc-bob 2.4s ease-in-out infinite alternate; }
@keyframes sc-bob { from { transform: translateY(-2px); } to { transform: translateY(3px); } }
.gscene .spinslow { animation: sc-spin 24s linear infinite; }
.gscene .spin { transform-origin: 0 0; }
.gscene .rolling .spin { animation: sc-spin .5s linear; }
.gscene .slip .spin { animation: sc-spin .6s linear infinite reverse; }
@keyframes sc-spin { to { transform: rotate(360deg); } }
.gscene .trainin.bump { animation: sc-bump .3s ease-out; }
@keyframes sc-bump { 40% { transform: translateX(5px); } }
.gscene .sweat { opacity: 0; }
.gscene .slip .sweat { opacity: 1; }
.gscene .stone { transition: transform .5s, opacity .5s; }
.gscene .stone.gone { opacity: 0; pointer-events: none; }
.gscene .stone.gone .stin { transform: translateY(-30px) rotate(40deg); transition: transform .5s; }
.gscene .layer { transition: transform .4s linear; }
.gscene .flag { animation: sc-flag 1.6s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: 0 50%; }
@keyframes sc-flag { from { transform: skewY(-3deg); } to { transform: skewY(3deg); } }
.gscene #sc-flash.flash { animation: sc-flash .5s ease-out; }
@keyframes sc-flash { 0% { opacity: .9; } 100% { opacity: 0; } }
.gscene #sc-tour.snap { animation: sc-snap .6s ease-out; transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes sc-snap { 30% { transform: translateY(-5px); } }
.gscene .blink { animation: sc-blink .5s steps(2) infinite; }
@keyframes sc-blink { 50% { opacity: .2; } }
.gscene .drive { }
.gscene .wait .drive { animation: none; }
.gscene .go .drive-r { animation: sc-dr 2.3s linear forwards; }
.gscene .go .drive-l { animation: sc-dl 2.3s linear forwards; }
.gscene .go .drive-l.d2 { animation-delay: .35s; animation-fill-mode: both; }
@keyframes sc-dr { to { transform: translateX(480px); } }
@keyframes sc-dl { to { transform: translateX(-480px); } }
.gscene .honk { opacity: 0; transform-box: fill-box; transform-origin: center; }
.gscene .honk.pop { animation: sc-honk .9s ease-out; }
@keyframes sc-honk { 0% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; } }
.sc-ctl [hidden] { display: none !important; }
.sc-ctl .row > .btn { flex: 1; }
@media (prefers-reduced-motion: reduce) { .gscene * { animation: none !important; transition: none !important; } }
.gscene #sc-fx, .gscene #sc-bub, .gscene #sc-say, .gscene #sc-honk, .gscene #sc-flash { pointer-events: none; }
