/* Học viện HSK — giao diện game (mực xanh tím, khung vàng vát góc, ruy-băng đỏ son, thanh xanh ngọc). Không bối cảnh lớp học. */
:root {
  --bg: #0b0d22; --bg2: #171a3d; --p1: #29215a; --p2: #120e2c;
  --gold: #f5c451; --gold-hi: #fff1b0; --gold-lo: #9a5a12;
  --red: #d9361e; --red-hi: #ff8a3a; --jade: #4fe0b8; --cyan: #7fe7ff;
  --text: #f4ecff; --dim: #a9a3c9; --ink: #190b33;
  --cut: 12px;
  --font: 'Be Vietnam Pro', system-ui, sans-serif;
  --han: 'Noto Serif SC', 'Songti SC', serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { background: var(--bg); }
body {
  margin: 0; color: var(--text); font: 15px/1.45 var(--font); min-height: 100vh;
  background:
    radial-gradient(600px 380px at 50% -80px, rgba(127, 231, 255, 0.18), transparent 70%),
    radial-gradient(500px 500px at 110% 40%, rgba(166, 108, 255, 0.16), transparent 70%),
    radial-gradient(500px 400px at -20% 80%, rgba(217, 54, 30, 0.14), transparent 70%),
    var(--bg);
}
/* Hoạ tiết mây 祥云 chìm */
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='80' viewBox='0 0 120 80'%3E%3Cg fill='none' stroke='%23fff1b0' stroke-width='2'%3E%3Cpath d='M10 50c0-10 14-12 18-4 2-10 18-10 20 0 8-4 14 6 6 10H14c-3 0-4-3-4-6z'/%3E%3Cpath d='M70 20c0-8 11-9 14-3 2-8 14-8 16 0 6-3 11 5 5 8H73c-2 0-3-2-3-5z'/%3E%3C/g%3E%3C/svg%3E");
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--cyan); }
#app { position: relative; max-width: 480px; margin: 0 auto; min-height: 100vh; padding: 0 16px calc(84px + env(safe-area-inset-bottom)); }
.han { font-family: var(--han); }

/* ---------- Khung game ---------- */
/* Khung 9-slice (SVG): viền vàng đôi vát góc + đá đỏ ở 4 góc, góc giữ nguyên khi khung co giãn (không dùng clip-path: cắt mất viền). */
.panel {
  position: relative; margin: 30px 0 14px; padding: 4px 2px 2px;
  border: 22px solid transparent;
  border-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%23fff3b8'/%3E%3Cstop offset='.45' stop-color='%23f5c451'/%3E%3Cstop offset='1' stop-color='%239a5a12'/%3E%3C/linearGradient%3E%3ClinearGradient id='b' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%2330276b'/%3E%3Cstop offset='1' stop-color='%23140f38'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M14 0H82L96 14V82L82 96H14L0 82V14Z' fill='%230a071d'/%3E%3Cpath d='M15 2H81L94 15V81L81 94H15L2 81V15Z' fill='url%28%23g%29'/%3E%3Cpath d='M17 6H79L90 17V79L79 90H17L6 79V17Z' fill='url%28%23b%29'/%3E%3Cpath d='M19 10H77L86 19V77L77 86H19L10 77V19Z' fill='none' stroke='%23f5c451' stroke-opacity='.5'/%3E%3Cg fill='%23ff5a3c' stroke='%230a071d' stroke-width='1.5'%3E%3Cpath d='M9 3l5 5-5 5-5-5z'/%3E%3Cpath d='M87 3l5 5-5 5-5-5z'/%3E%3Cpath d='M9 83l5 5-5 5-5-5z'/%3E%3Cpath d='M87 83l5 5-5 5-5-5z'/%3E%3C/g%3E%3C/svg%3E") 26 fill / 22px stretch;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.45));
}
.panel::after { content: ''; position: absolute; inset: -12px -12px auto; height: 40%; border-radius: 6px; background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent); pointer-events: none; }
.panel > * { position: relative; z-index: 1; }
/* Ruy-băng tiêu đề hai đuôi, đặt giữa mép trên khung */
.ribbon {
  display: table; margin: -42px auto 14px; padding: 6px 30px; font-weight: 900; font-size: 15px; letter-spacing: 0.05em; text-transform: uppercase; color: #fff;
  background: linear-gradient(#ffe08a, #ffe08a) top / 100% 2px no-repeat, linear-gradient(#7a1206, #7a1206) bottom / 100% 3px no-repeat, linear-gradient(180deg, #ff9d5a, #e0452a 50%, #a52312);
  clip-path: polygon(0 0, 100% 0, calc(100% - 13px) 50%, 100% 100%, 0 100%, 13px 50%);
  text-shadow: 0 2px 0 #5a0d05, 0 0 2px #5a0d05;
}
.ribbon small { font-weight: 700; text-transform: none; opacity: 0.9; letter-spacing: 0; }
.gold { background: linear-gradient(180deg, #fff, #ffe27a 45%, #f0a020); -webkit-background-clip: text; background-clip: text; color: transparent; }
.outline { text-shadow: 0 2px 0 var(--ink), 2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 -2px 0 var(--ink), 0 4px 6px rgba(0, 0, 0, 0.6); }
.dim { color: var(--dim); }
/* Nút nổi 3D: gờ dưới đậm, nhấn thì lún */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 18px; font-weight: 900; text-decoration: none;
  color: #3a1d05; border: 2px solid #3a1d05; border-radius: 12px;
  background: linear-gradient(180deg, #fff6c8 0%, #ffd45e 45%, #f0a11f 55%, #d98a12 100%);
  box-shadow: 0 4px 0 #7a4a08, 0 7px 12px rgba(0, 0, 0, 0.45), inset 0 2px 0 rgba(255, 255, 255, 0.75);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6); transition: transform 0.08s, box-shadow 0.08s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #7a4a08, 0 2px 4px rgba(0, 0, 0, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.75); }
.btn.red { color: #fff; border-color: #4a0a03; background: linear-gradient(180deg, #ffb38a 0%, #ff6a3d 45%, #e0381e 55%, #b8240f 100%); box-shadow: 0 4px 0 #6e1206, 0 7px 12px rgba(0, 0, 0, 0.45), inset 0 2px 0 rgba(255, 255, 255, 0.55); text-shadow: 0 2px 0 #6e1206; }
.btn.ghost { color: #fff; border-color: #0d1240; background: linear-gradient(180deg, #9fb2ff 0%, #5b74e0 45%, #3a50c4 55%, #2a3a9c 100%); box-shadow: 0 4px 0 #161f66, 0 7px 12px rgba(0, 0, 0, 0.45), inset 0 2px 0 rgba(255, 255, 255, 0.5); text-shadow: 0 2px 0 #161f66; }
.bar { position: relative; height: 12px; background: #07051a; border: 2px solid #0a071d; box-shadow: 0 0 0 1px rgba(245, 196, 81, 0.55); border-radius: 7px; overflow: hidden; }
.bar > b { position: absolute; inset: 0 auto 0 0; background: linear-gradient(180deg, #b8fff0, var(--jade) 50%, #1f9f86); box-shadow: 0 0 8px var(--cyan); border-radius: 5px; transition: width 0.8s; }
.bar.gold > b { background: linear-gradient(180deg, #fff3b8, var(--gold) 50%, #c47f12); box-shadow: 0 0 8px var(--gold); }

/* ---------- Thanh trên + tab dưới ---------- */
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 10px 0 14px; background: linear-gradient(180deg, var(--bg) 65%, transparent); }
.topbar .me { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; background: none; border: 0; padding: 0; text-align: left; }
.topbar .me b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .me small { color: var(--gold); font-weight: 800; font-size: 12px; }
.logo { font-weight: 900; font-size: 18px; flex: 1; }
.res { display: flex; gap: 6px; }
.res span { display: flex; align-items: center; gap: 4px; padding: 2px 9px 2px 2px; border-radius: 999px; background: linear-gradient(180deg, #120d33, #05040f); box-shadow: 0 0 0 2px #0a071d, 0 0 0 3px rgba(245, 196, 81, 0.6); font-weight: 900; font-size: 12px; white-space: nowrap; }
.res span i { font-style: normal; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; font-size: 12px; background: radial-gradient(circle at 50% 35%, #4b3ca3, #1a1240); }
.av { position: relative; flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; color: #fff; overflow: hidden; background: #3d2f8f; box-shadow: 0 0 0 2px #0a071d, 0 0 0 4px var(--gold), 0 0 10px rgba(245, 196, 81, 0.5); }
.av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avwrap { position: relative; flex: none; }
.avwrap .lv { position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%); padding: 0 6px; border-radius: 6px; font-size: 10px; font-weight: 900; color: #3a1d05; background: linear-gradient(180deg, #fff3b8, #f5c451); border: 1.5px solid #3a1d05; white-space: nowrap; }
.tabs {
  position: fixed; z-index: 6; left: 50%; bottom: 0; transform: translateX(-50%); width: min(480px, 100%); display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, #2b2264, #0e0a26);
  border-top: 3px solid #f5c451; box-shadow: 0 -2px 0 #0a071d, 0 -10px 24px rgba(0, 0, 0, 0.6);
}
.tabs button { position: relative; border: 0; background: none; padding: 0; display: grid; justify-items: center; color: var(--dim); font-size: 11px; font-weight: 800; }
.tabs button i { font-style: normal; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; font-size: 23px; filter: grayscale(0.6) brightness(0.85); transition: transform 0.2s; }
.tabs button.on { color: var(--gold); }
.tabs button.on i { filter: none; transform: translateY(-16px) scale(1.12); background: radial-gradient(circle at 50% 35%, #fff0b0, #f5b83a 60%, #a8650e); box-shadow: 0 0 0 3px #3a1d05, 0 0 0 5px #f5c451, 0 0 16px #f5c451; }
.tabs button.on span { margin-top: -14px; text-shadow: 0 2px 0 #0a071d; }
.tabs button.dot::after { content: ''; position: absolute; top: 4px; right: calc(50% - 20px); width: 11px; height: 11px; border-radius: 50%; background: #ff4d3a; box-shadow: 0 0 0 2px #0a071d, 0 0 6px #ff4d3a; }
.viewing { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; padding: 8px 12px; border-radius: 10px; background: rgba(127, 231, 255, 0.1); border: 1px solid rgba(127, 231, 255, 0.35); font-size: 13px; }

/* ---------- Nhân vật ---------- */
.stage { position: relative; height: 380px; margin: 6px -16px 0; overflow: hidden; }
.stage .rays { position: absolute; left: 50%; top: 45%; width: 640px; height: 640px; margin: -320px 0 0 -320px; border-radius: 50%; opacity: 0.35;
  background: repeating-conic-gradient(from 0deg, var(--tier) 0deg 6deg, transparent 6deg 18deg); animation: spin 40s linear infinite; mask: radial-gradient(circle, #000 20%, transparent 62%); -webkit-mask: radial-gradient(circle, #000 20%, transparent 62%); }
.stage .glow { position: absolute; left: 50%; top: 58%; width: 260px; height: 260px; margin: -130px 0 0 -130px; border-radius: 50%; background: radial-gradient(circle, var(--tier), transparent 68%); opacity: 0.55; }
.stage .pedestal { position: absolute; left: 50%; bottom: 34px; width: 220px; height: 44px; margin-left: -110px; border-radius: 50%;
  background: radial-gradient(ellipse at 50% 35%, #4a3a8f, #150f33 70%); border: 2px solid var(--gold); box-shadow: 0 0 24px var(--tier), inset 0 -6px 12px rgba(0, 0, 0, 0.5); }
.stage .char { position: absolute; left: 50%; bottom: 52px; height: 300px; transform: translateX(-50%); filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.5)); animation: bob 3.2s ease-in-out infinite; }
.stage .badge { position: absolute; left: 16px; top: 12px; text-align: center; }
.stage .badge b { display: block; margin-top: -6px; font-size: 13px; font-weight: 900; }
.stage .share { position: absolute; right: 16px; top: 16px; }
.stage .plate { position: absolute; left: 16px; right: 16px; bottom: 0; text-align: center; }
.stage .plate h1 { margin: 0; font-size: 24px; font-weight: 900; text-shadow: 0 3px 0 var(--ink), 0 0 12px rgba(0, 0, 0, 0.6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bob { 50% { transform: translateX(-50%) translateY(-6px); } }
.title-line { font-weight: 900; font-size: 18px; }
.xprow { display: flex; justify-content: space-between; font-size: 12px; font-weight: 800; margin: 6px 0 4px; }
.stats { display: grid; grid-template-columns: 150px 1fr; gap: 12px; align-items: center; }
.stats ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.stats li { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.stats li .han { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 6px; background: rgba(245, 196, 81, 0.15); color: var(--gold); font-size: 16px; }
.stats li em { margin-left: auto; font-style: normal; font-weight: 900; }
.slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.slot { aspect-ratio: 1; display: grid; place-items: center; align-content: center; gap: 2px; border-radius: 10px; background: rgba(0, 0, 0, 0.35); border: 1px dashed rgba(245, 196, 81, 0.4); font-size: 22px; color: var(--dim); }
.slot small { font-size: 10px; }
.road { list-style: none; margin: 0; padding: 0 0 0 8px; position: relative; }
.road::before { content: ''; position: absolute; left: 33px; top: 20px; bottom: 20px; width: 4px; background: linear-gradient(var(--gold), rgba(245, 196, 81, 0.15)); border-radius: 2px; }
.road li { position: relative; display: flex; align-items: center; gap: 12px; padding: 6px 0; }
.road li.lock { opacity: 0.5; filter: grayscale(0.6); }
.road li.cur .info { background: rgba(127, 231, 255, 0.12); border-color: var(--cyan); }
.road .info { flex: 1; padding: 6px 10px; border-radius: 10px; border: 1px solid transparent; }
.road .info b { display: block; }
.road .info small { color: var(--dim); }
.road .here { color: var(--cyan); font-weight: 800; font-size: 12px; }

/* ---------- Nhiệm vụ + huy hiệu ---------- */
.quest { position: relative; display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; padding: 12px; margin: 8px 0; border-radius: 12px; background: rgba(0, 0, 0, 0.3); border: 1px solid rgba(245, 196, 81, 0.25); }
.quest > i { font-style: normal; font-size: 26px; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 10px; background: rgba(245, 196, 81, 0.12); }
.quest b { display: block; font-size: 14px; }
.quest .bar { margin-top: 6px; height: 9px; }
.quest .reward { font-weight: 900; font-size: 12px; color: var(--gold); text-align: center; }
.quest.done { border-color: var(--jade); }
.quest.done .stamp { position: absolute; right: 10px; top: 50%; translate: 0 -50%; rotate: -14deg; padding: 2px 8px; border: 3px solid var(--red); color: var(--red); font: 900 20px var(--han); border-radius: 6px; background: rgba(20, 0, 0, 0.6); }
.reset { font-size: 12px; color: var(--dim); }
.flame { display: flex; align-items: center; gap: 14px; }
.flame big { font-size: 46px; filter: drop-shadow(0 0 12px #ff7a2a); }
.flame b { font-size: 26px; font-weight: 900; }
.medals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.medal { text-align: center; padding: 10px 4px; border-radius: 12px; background: rgba(0, 0, 0, 0.3); }
.medal .m { width: 58px; height: 58px; margin: 0 auto 6px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; border: 3px solid #4b4570; background: radial-gradient(circle at 50% 35%, #3a2f7a, #160f38); }
.medal.t1 .m { border-color: #d9853b; box-shadow: 0 0 10px rgba(217, 133, 59, 0.6); }
.medal.t2 .m { border-color: #dfe6ee; box-shadow: 0 0 10px rgba(223, 230, 238, 0.6); }
.medal.t3 .m { border-color: var(--gold); box-shadow: 0 0 14px var(--gold); }
.medal.t0 { opacity: 0.5; filter: grayscale(1); }
.medal b { display: block; font-size: 12px; }
.medal small { font-size: 11px; color: var(--dim); }
.pips { display: flex; justify-content: center; gap: 3px; margin: 3px 0; }
.pips i { width: 8px; height: 8px; border-radius: 50%; background: #3b3560; }
.pips i.on { background: var(--gold); box-shadow: 0 0 5px var(--gold); }

/* ---------- Xếp hạng ---------- */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 12px; background: rgba(0, 0, 0, 0.4); }
.seg button { border: 0; padding: 8px 0; border-radius: 9px; background: none; font-weight: 800; font-size: 13px; color: var(--dim); }
.seg button.on { background: linear-gradient(180deg, var(--gold-hi), var(--gold)); color: var(--ink); }
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; align-items: end; gap: 6px; margin-top: 18px; }
.podium .p { text-align: center; min-width: 0; }
.podium .name { position: relative; z-index: 1; margin: 2px 0 6px; }
.podium .p img { height: 120px; filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.5)); }
.podium .r1 img { height: 150px; }
.podium .blk { padding: 8px 4px; font-weight: 900; clip-path: polygon(8% 0, 92% 0, 100% 100%, 0 100%); }
.podium .r1 .blk { height: 92px; background: linear-gradient(180deg, #fff6c2, #f5c542 50%, #a86a0c); color: var(--ink); }
.podium .r2 .blk { height: 70px; background: linear-gradient(180deg, #ffffff, #c9d3de 50%, #6f7c8c); color: var(--ink); }
.podium .r3 .blk { height: 56px; background: linear-gradient(180deg, #ffd2a6, #d9853b 50%, #7a3c10); color: var(--ink); }
.podium .blk big { display: block; font-size: 22px; line-height: 1; }
.podium .name { font-size: 12px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rows { list-style: none; margin: 10px 0 0; padding: 0; }
.rows li { display: grid; grid-template-columns: 30px 38px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; margin: 6px 0; border-radius: 10px; background: rgba(0, 0, 0, 0.3); cursor: pointer; }
.rows li .n { font-weight: 900; color: var(--dim); text-align: center; }
.rows li .who { min-width: 0; }
.rows li .who b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rows li .who small { color: var(--dim); font-size: 12px; }
.rows li .v { font-weight: 900; color: var(--gold); font-size: 13px; }
.rows li.mine { position: sticky; bottom: calc(76px + env(safe-area-inset-bottom)); background: linear-gradient(90deg, #2c4b78, #1f2a5a); border: 1px solid var(--cyan); }

/* ---------- Sổ từ ---------- */
.collect { display: flex; align-items: center; gap: 16px; }
.ring { --p: 0; flex: none; width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--jade) calc(var(--p) * 1%), rgba(0, 0, 0, 0.45) 0); }
.ring div { width: 74px; height: 74px; border-radius: 50%; background: var(--p2); display: grid; place-items: center; text-align: center; font-weight: 900; line-height: 1.1; }
.ring small { display: block; font-size: 10px; color: var(--dim); font-weight: 600; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 4px; }
.chips button { border: 1px solid rgba(245, 196, 81, 0.4); background: rgba(0, 0, 0, 0.3); border-radius: 999px; padding: 4px 12px; font-size: 12px; font-weight: 700; }
.chips button.on { background: var(--gold); color: var(--ink); }
.wgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.wcard { aspect-ratio: 3 / 4; display: grid; place-items: center; align-content: center; gap: 2px; padding: 4px; border: 0; border-radius: 10px; background: linear-gradient(180deg, #2f2766, #171236); box-shadow: inset 0 0 0 1px rgba(245, 196, 81, 0.35); }
.wcard .han { font-size: 28px; font-weight: 900; line-height: 1.1; }
.wcard .han.long { font-size: 18px; }
.wcard small { font-size: 10px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.wcard .stars { font-size: 10px; color: var(--gold); letter-spacing: -1px; }
.wcard.m3 { box-shadow: inset 0 0 0 2px var(--gold), 0 0 10px rgba(245, 196, 81, 0.4); }
.wcard.locked { background: rgba(0, 0, 0, 0.3); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); color: #3e3866; font: 900 26px var(--font); cursor: default; }

/* ---------- Sảnh ---------- */
.live { display: flex; align-items: center; gap: 12px; }
.live .dotlive { flex: none; width: 12px; height: 12px; border-radius: 50%; background: #ff3b5c; box-shadow: 0 0 0 0 rgba(255, 59, 92, 0.7); animation: pulse 1.6s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 12px rgba(255, 59, 92, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 59, 92, 0); } }
.mini { display: grid; grid-template-columns: 84px 1fr; gap: 12px; align-items: center; cursor: pointer; }
.mini .pic { position: relative; height: 120px; display: grid; place-items: end center; border-radius: 12px; overflow: hidden; background: radial-gradient(circle at 50% 70%, var(--tier), transparent 70%); }
.mini .pic img { height: 112px; }
.steps { display: grid; gap: 10px; margin: 6px 0 14px; padding: 0; list-style: none; counter-reset: s; }
.steps li { display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: center; counter-increment: s; }
.steps li::before { content: counter(s); width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; font-weight: 900; color: var(--ink); background: linear-gradient(180deg, var(--gold-hi), var(--gold)); }
.find { display: flex; gap: 8px; }
.find input { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(245, 196, 81, 0.5); background: rgba(0, 0, 0, 0.4); color: var(--text); font: inherit; }
.mq { display: grid; gap: 6px; margin-top: 10px; }
.mq div { display: grid; grid-template-columns: 22px 1fr 44px; gap: 8px; align-items: center; font-size: 13px; }
.mq .bar { height: 7px; }
.empty { text-align: center; color: var(--dim); padding: 20px 0; }
.toast { position: fixed; z-index: 9; left: 50%; bottom: 96px; transform: translateX(-50%); padding: 10px 16px; border-radius: 10px; background: #000c; border: 1px solid var(--gold); font-weight: 700; }
.skeleton { height: 120px; border-radius: 12px; background: linear-gradient(90deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.04)); background-size: 200% 100%; animation: sk 1.2s infinite; margin: 14px 0; }
@keyframes sk { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .stage .rays, .stage .char, .live .dotlive { animation: none; } }

/* ---------- Sảnh kiểu lobby game: nhân vật giữa màn hình, nút tròn hai bên, nút VÀO LỚP ---------- */
.lobby { position: relative; height: max(560px, calc(100svh - 150px)); margin: -6px -16px 0; overflow: hidden; }
.lobby .rays { position: absolute; left: 50%; top: 48%; width: 720px; height: 720px; margin: -360px 0 0 -360px; border-radius: 50%; opacity: 0.4;
  background: repeating-conic-gradient(from 0deg, var(--tier) 0deg 6deg, transparent 6deg 18deg); animation: spin 40s linear infinite; mask: radial-gradient(circle, #000 18%, transparent 60%); -webkit-mask: radial-gradient(circle, #000 18%, transparent 60%); }
.lobby .glow { position: absolute; left: 50%; top: 55%; width: 300px; height: 300px; margin: -150px 0 0 -150px; border-radius: 50%; background: radial-gradient(circle, var(--tier), transparent 68%); opacity: 0.55; }
.lobby .pedestal { position: absolute; left: 50%; bottom: 112px; width: 240px; height: 48px; margin-left: -120px; border-radius: 50%;
  background: radial-gradient(ellipse at 50% 35%, #4a3a8f, #150f33 70%); border: 3px solid var(--gold); box-shadow: 0 0 0 3px #0a071d, 0 0 30px var(--tier), inset 0 -6px 12px rgba(0, 0, 0, 0.5); }
.lobby .char { position: absolute; left: 50%; bottom: 132px; height: 330px; transform: translateX(-50%); filter: drop-shadow(0 10px 10px rgba(0, 0, 0, 0.55)); animation: bob 3.2s ease-in-out infinite; }
.lobby .char.mystery { filter: brightness(0) drop-shadow(0 0 12px rgba(127, 231, 255, 0.8)); opacity: 0.85; }
.lobby .mark { position: absolute; left: 50%; bottom: 300px; transform: translateX(-50%); font: 900 72px var(--font); color: var(--cyan); text-shadow: 0 0 20px var(--cyan); }
.nameplate { position: absolute; left: 70px; right: 70px; top: 6px; display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 12px;
  background: linear-gradient(180deg, rgba(20, 15, 56, 0.92), rgba(8, 6, 26, 0.92)); box-shadow: 0 0 0 2px #0a071d, 0 0 0 3px rgba(245, 196, 81, 0.7); }
.nameplate .np { min-width: 0; flex: 1; }
.nameplate b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nameplate .t { font-weight: 900; font-size: 13px; }
.nameplate .bar { height: 8px; margin-top: 4px; }
.side { position: absolute; top: 96px; display: grid; gap: 16px; }
.side.l { left: 12px; }
.side.r { right: 12px; }
.orb { position: relative; display: grid; justify-items: center; gap: 3px; border: 0; padding: 0; background: none; color: #fff; font-size: 11px; font-weight: 900; text-shadow: 0 2px 0 #0a071d, 0 0 4px #000; }
.orb i { font-style: normal; width: 54px; height: 54px; display: grid; place-items: center; border-radius: 50%; font-size: 25px;
  background: radial-gradient(circle at 50% 30%, #5a49bf, #1a1240 72%); box-shadow: 0 0 0 2px #0a071d, 0 0 0 4px var(--gold), 0 0 0 6px #0a071d, 0 6px 12px rgba(0, 0, 0, 0.6), inset 0 3px 0 rgba(255, 255, 255, 0.25); }
.orb:active i { transform: scale(0.94); }
.orb em { position: absolute; top: -2px; right: 0; width: 13px; height: 13px; border-radius: 50%; background: #ff4d3a; box-shadow: 0 0 0 2px #0a071d, 0 0 8px #ff4d3a; }
.cta { position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%); width: min(300px, 82%); display: grid; justify-items: center; text-align: center; padding: 12px 0 10px; font-size: 24px; letter-spacing: 0.08em; border-radius: 16px; animation: glowpulse 2.2s ease-in-out infinite; }
.cta small { font-size: 11px; letter-spacing: 0; font-weight: 800; opacity: 0.9; }
.cta:active { transform: translateX(-50%) translateY(3px); }
@keyframes glowpulse { 50% { filter: drop-shadow(0 0 14px rgba(255, 106, 61, 0.9)); } }
.livetag { position: absolute; left: 50%; bottom: 94px; transform: translateX(-50%); display: flex; align-items: center; gap: 6px; padding: 3px 12px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap;
  background: rgba(8, 6, 26, 0.85); box-shadow: 0 0 0 1px rgba(255, 77, 92, 0.6); }
.livetag .dotlive { width: 9px; height: 9px; }

/* Khiên hạng top 3, đồng xu thưởng, hàng xếp hạng có khung */
.rows li { background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(0, 0, 0, 0.25)); box-shadow: inset 0 0 0 1px rgba(245, 196, 81, 0.25); }
.rows li .n.rk { width: 30px; height: 34px; display: grid; place-items: center; color: #3a1d05; font-size: 15px; clip-path: polygon(50% 0, 100% 15%, 100% 60%, 50% 100%, 0 60%, 0 15%); }
.rows li .n.rk1 { background: linear-gradient(180deg, #fff6c2, #f5c542 55%, #a86a0c); }
.rows li .n.rk2 { background: linear-gradient(180deg, #ffffff, #c9d3de 55%, #6f7c8c); }
.rows li .n.rk3 { background: linear-gradient(180deg, #ffd2a6, #d9853b 55%, #7a3c10); }
.quest .reward { width: 50px; height: 50px; display: grid; place-content: center; line-height: 1; border-radius: 50%; color: #3a1d05; font-size: 13px;
  background: radial-gradient(circle at 50% 35%, #fff6c2, #f5c542 55%, #b8760e); box-shadow: 0 0 0 2px #3a1d05, 0 3px 0 #7a4a08, inset 0 2px 0 rgba(255, 255, 255, 0.7); }
.quest .reward small { font-size: 9px; }
.quest { background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.3)); }
.quest > i { box-shadow: 0 0 0 2px #0a071d, 0 0 0 3px rgba(245, 196, 81, 0.6); }
/* Bụi sáng bay lên ở nền */
body::after { content: ''; position: fixed; left: 0; top: 0; width: 2px; height: 2px; border-radius: 50%; pointer-events: none; opacity: 0.6; animation: motes 18s linear infinite;
  box-shadow: 40px 900px #fff1b0, 120px 760px #7fe7ff, 220px 980px #fff1b0, 300px 820px #f5c451, 360px 940px #7fe7ff, 80px 1100px #f5c451, 260px 1180px #fff1b0, 420px 1040px #7fe7ff; }
@keyframes motes { to { transform: translateY(-1200px); } }
@media (prefers-reduced-motion: reduce) { .lobby .rays, .lobby .char, .cta, body::after { animation: none; } }

/* ---------- Sảnh vừa một màn hình (không cuộn) ---------- */
#app.home { height: 100svh; overflow: hidden; padding-bottom: 0; }
body:has(#app.home) { overflow: hidden; }
#app.home .lobby { height: calc(100svh - 136px - env(safe-area-inset-bottom)); min-height: 0; }
.lobby .char { height: min(330px, calc(100% - 290px)); min-height: 150px; }
.lobby .mark { bottom: auto; top: 50%; }
.nameplate .claim1 { flex: none; }
.nameplate.col { flex-direction: column; align-items: stretch; text-align: center; }
.acts { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.nameplate .acts { margin-top: 6px; }
.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 10px; }
.ok { display: inline-grid; place-items: center; width: 17px; height: 17px; border-radius: 50%; font-size: 11px; color: #062a20; background: var(--jade); vertical-align: 2px; text-shadow: none; }
.note { font-size: 12px; text-align: center; margin: 8px 0 0; }

/* ---------- Hộp thoại kiểu game ---------- */
.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; background: rgba(4, 3, 14, 0.78); backdrop-filter: blur(3px); animation: fade 0.15s; }
.dialog { width: min(420px, 100%); margin: 0; animation: pop 0.22s cubic-bezier(0.2, 1.4, 0.4, 1); }
.dialog .x { position: absolute; z-index: 2; right: -8px; top: -36px; width: 32px; height: 32px; border-radius: 50%; border: 2px solid #3a1d05; font-weight: 900; color: #3a1d05;
  background: linear-gradient(180deg, #fff6c8, #f0a11f); box-shadow: 0 3px 0 #7a4a08; }
.code { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0 12px; padding: 12px 14px; border-radius: 12px; background: #07051a; box-shadow: inset 0 0 0 2px var(--gold), 0 0 18px rgba(245, 196, 81, 0.35); }
.code b { font-size: 28px; font-weight: 900; letter-spacing: 0.04em; color: var(--gold-hi); }
.wait { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 13px; color: var(--dim); }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 3px solid rgba(127, 231, 255, 0.25); border-top-color: var(--cyan); animation: spin 0.8s linear infinite; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(0.85); opacity: 0; } }
