:root { --gold: #e6bd62; --gold-2: #f6dc9c; --ink: #0c0504; --sans: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: #060302; }
html, body { margin: 0; height: 100%; overflow: hidden; font-family: var(--sans); color: #fff; touch-action: none; user-select: none; -webkit-user-select: none; }
html, body { height: 100dvh; }
/* màn hình rộng (PC, máy tính bảng ngang): hai bên khung là bản mờ của chính tranh nền, không để viền đen */
body::before { content: ''; position: fixed; inset: -40px; background: url(../assets/v2/nen.jpg) center / cover; filter: blur(28px) brightness(.55) saturate(1.2); z-index: -1; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
@media (hover: hover) { .act:hover { filter: brightness(1.2); } #chip:hover { filter: brightness(1.15); } }
.hidden { display: none !important; }

/* khung 540x960 cố định, JS phóng/thu theo màn hình */
#stage { position: absolute; left: 0; top: 0; width: 540px; height: 960px; transform-origin: 0 0; overflow: hidden; background: #0c0504; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

#ticker { position: absolute; right: 10px; top: 92px; width: 150px; padding: 6px 8px; border-radius: 12px; background: linear-gradient(180deg, rgba(20,12,8,.62), rgba(20,12,8,.34)); backdrop-filter: blur(3px); }
.trow { display: grid; grid-template-columns: 22px 38px 1fr; align-items: center; gap: 2px 4px; height: 30px; font-size: 11px; }
.trow svg { width: 20px; height: 20px; color: #ffb0c4; }
.trow[data-k='huong'] svg { color: #ffe3a6; } .trow[data-k='phat'] svg { color: #cfe0ff; }
.trow b { font-size: 15px; font-weight: 700; color: #fff; font-variant-numeric: tabular-nums; }
.trow span { color: #f6e9d0; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trow.pop b { animation: pop .5s ease; }
@keyframes pop { 40% { transform: scale(1.5); color: var(--gold-2); } }

#chip { position: absolute; left: 10px; top: 92px; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px 0 5px; border-radius: 19px; background: rgba(12,7,4,.6); backdrop-filter: blur(3px); cursor: pointer; }
#chip i { width: 28px; height: 28px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #f6dc9c, #b9812b); display: block; }
#chip b { display: block; font-size: 12px; font-weight: 600; line-height: 1.1; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#chip small { display: block; font-size: 10px; color: var(--gold-2); opacity: .9; }
#btnSound { position: absolute; left: 10px; top: 136px; width: 34px; height: 34px; border-radius: 50%; background: rgba(12,7,4,.6); display: grid; place-items: center; color: var(--gold-2); }
#btnSound[aria-pressed='false'] #sndWave { display: none; }

#bubbles { position: absolute; inset: 0; pointer-events: none; }
.bub { position: absolute; left: 0; top: 0; max-width: 250px; padding: 7px 11px; border-radius: 9px; background: rgba(8,6,5,.82); font-size: 13px; line-height: 1.28; font-weight: 500; text-align: center; transition: opacity .5s; will-change: transform; overflow-wrap: anywhere; }
.bub.out { opacity: 0; }

#banner { position: absolute; left: 50%; top: 150px; transform: translate(-50%, -12px); max-width: 420px; padding: 9px 16px; border-radius: 20px; background: linear-gradient(180deg, rgba(120,70,12,.85), rgba(60,30,6,.85)); border: 1px solid rgba(246,220,156,.5); font-size: 13px; font-weight: 600; text-align: center; color: var(--gold-2); opacity: 0; transition: opacity .4s, transform .4s; pointer-events: none; }
#banner.show { opacity: 1; transform: translate(-50%, 0); }

#board { position: absolute; right: 10px; bottom: 90px; width: 132px; padding: 7px 9px; border-radius: 12px; background: rgba(12,7,4,.55); backdrop-filter: blur(3px); opacity: 0; transition: opacity .4s; }
#board.show { opacity: 1; }
#board h4 { margin: 0 0 4px; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--gold-2); font-weight: 600; }
#board ol { list-style: none; margin: 0; padding: 0; }
#board li { display: grid; grid-template-columns: 14px 1fr auto; gap: 5px; align-items: center; font-size: 11px; line-height: 1.7; }
#board li i { font-style: normal; font-weight: 700; color: var(--gold); text-align: center; }
#board li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#board li b { color: var(--gold-2); font-variant-numeric: tabular-nums; }

#bar { position: absolute; left: 10px; right: 10px; bottom: 12px; display: flex; gap: 8px; align-items: stretch; margin: 0 auto; max-width: 640px; }
#chatIn { flex: 1; min-width: 0; height: 58px; border-radius: 29px; border: 0; padding: 0 16px; background: rgba(12,7,4,.68); color: #fff; font: 500 13px var(--sans); outline: none; user-select: text; -webkit-user-select: text; }
#chatIn::placeholder { color: rgba(255,255,255,.55); }
.act { width: 74px; height: 58px; border-radius: 16px; background: linear-gradient(180deg, rgba(60,32,10,.82), rgba(24,12,4,.86)); border: 1px solid rgba(246,220,156,.35); display: grid; grid-template-rows: 22px 12px 11px; justify-items: center; align-content: center; gap: 0; color: var(--gold-2); transition: transform .12s, filter .2s; }
.act svg { width: 22px; height: 22px; }
.act span { font-size: 10px; font-weight: 600; color: #fff; line-height: 12px; }
.act em { font-style: normal; font-size: 9px; color: #f0c14a; line-height: 11px; }
.act:active { transform: scale(.94); filter: brightness(1.25); }

#sim { position: absolute; left: 10px; top: 190px; width: 250px; padding: 10px; border-radius: 14px; background: rgba(12,7,4,.9); border: 1px solid rgba(246,220,156,.3); z-index: 5; }
#sim header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 12px; }
#sim .row { display: flex; gap: 6px; margin-bottom: 8px; }
#sim input { flex: 1; min-width: 0; height: 32px; border-radius: 8px; border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.06); color: #fff; padding: 0 8px; font: 12px var(--sans); user-select: text; -webkit-user-select: text; }
#sim .grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
#sim .grid button { height: 30px; border-radius: 8px; background: rgba(246,220,156,.14); font-size: 11px; }
#sim p { margin: 8px 0 0; font-size: 10px; opacity: .6; line-height: 1.4; }

#loading { position: absolute; inset: 0; display: grid; place-items: center; background: #0c0504; color: var(--gold-2); font-size: 15px; letter-spacing: .02em; z-index: 9; transition: opacity .6s; }
#loading.out { opacity: 0; pointer-events: none; }


/* màn tạo nhân vật */
#create { position: absolute; inset: 0; z-index: 8; display: grid; place-items: center; background: rgba(6,3,2,.72); backdrop-filter: blur(4px); padding: 12px; overflow-y: auto; }
#create .card { width: min(390px, 100%); max-height: 100%; overflow-y: auto; border-radius: 20px; padding: 18px 18px 16px; background: linear-gradient(180deg, #2a1a0e, #170d07); border: 1px solid rgba(246,220,156,.3); box-shadow: 0 20px 60px rgba(0,0,0,.6); }
#create h2 { margin: 0 0 12px; font-size: 20px; font-weight: 700; color: var(--gold-2); letter-spacing: .01em; }
.fld { display: block; margin-bottom: 11px; }
.fld > span { display: block; font-size: 11px; color: #cdb48a; margin-bottom: 6px; }
.row { display: flex; gap: 8px; }
#inName { flex: 1; min-width: 0; height: 42px; border-radius: 11px; border: 1px solid rgba(246,220,156,.28); background: rgba(255,255,255,.06); padding: 0 13px; color: #fff; font: 500 15px var(--sans); outline: none; user-select: text; -webkit-user-select: text; }
#inName:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(230,189,98,.22); }
.ico { width: 42px; height: 42px; flex: none; border-radius: 11px; display: grid; place-items: center; background: rgba(246,220,156,.14); color: var(--gold-2); }
.seg { display: flex; gap: 8px; }
.seg button { flex: 1; height: 38px; border-radius: 10px; background: rgba(246,220,156,.1); font-size: 14px; font-weight: 600; color: #e9d7b4; transition: background .15s, color .15s; }
.seg button.on { background: linear-gradient(180deg, #e8c277, #c98f2e); color: #2a1604; }
.styles { display: flex; gap: 8px; }
.styles button { flex: 1; aspect-ratio: 1; border-radius: 12px; background: rgba(255,255,255,.06); border: 2px solid transparent; padding: 0; overflow: hidden; display: grid; place-items: center; }
.styles button.on { border-color: var(--gold); background: rgba(246,220,156,.14); }
.styles canvas { width: 100%; height: 100%; display: block; }
.swatches { display: flex; gap: 11px; }
.swatches button { width: 30px; height: 30px; border-radius: 50%; border: 3px solid transparent; outline: 1px solid rgba(255,255,255,.25); outline-offset: -1px; }
.swatches button.on { border-color: var(--gold-2); transform: scale(1.1); }
.pv { display: grid; place-items: center; height: 190px; margin: 4px 0 12px; border-radius: 14px; background: radial-gradient(ellipse at 50% 80%, rgba(246,190,90,.28), rgba(0,0,0,0) 70%), rgba(255,255,255,.04); }
.pv canvas { height: 100%; max-width: 100%; }
.cta { width: 100%; height: 48px; border-radius: 14px; background: linear-gradient(180deg, #e8c277, #c98f2e); color: #2a1604; font-weight: 700; font-size: 16px; box-shadow: 0 6px 18px rgba(201,143,46,.35), inset 0 1px 0 rgba(255,255,255,.5); }
.cta:active { transform: scale(.985); }

/* chế độ Live (?overlay): chỉ còn tranh, bảng quà, bảng tên, bong bóng — không nút bấm */
.overlay #bar, .overlay #chip, .overlay #btnSound, .overlay #sim { display: none !important; }

/* a11y: viền khi dùng phím Tab (không hiện khi chạm/chuột) */
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible { outline: 2px solid #e0452f; outline-offset: 2px; }
