:root {
  --glass: rgba(14, 20, 34, 0.52);
  --glass-strong: rgba(14, 20, 34, 0.78);
  --line: rgba(255, 255, 255, 0.14);
  --text: #f5f2ea;
  --muted: rgba(245, 242, 234, 0.66);
  --accent: #ffb35c;
  --accent-2: #ff7a59;
  --ok: #7fe0a8;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #0e1422; color: var(--text);
  font-family: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  touch-action: none;
}
button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; outline: none; }


.primary {
  display: block; width: 100%; padding: 14px; margin-top: 4px; border: 0; border-radius: 14px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2)); color: #2a1206; font-weight: 800; font-size: 17px;
  box-shadow: 0 10px 30px rgba(255, 122, 89, 0.35);
}
.primary:hover { filter: brightness(1.06); }
.primary.small { display: inline-block; width: auto; padding: 10px 16px; font-size: 15px; margin: 0; }
.primary:disabled { opacity: 0.5; cursor: not-allowed; }
.fine { margin: 12px 0 0; font-size: 12.5px; color: var(--muted); text-align: center; }

#loading { position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #0e1422; gap: 16px; }
.spinner { width: 44px; height: 44px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, 0.15); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Nhãn tên & bong bóng chat ---------- */
.nametag { display: flex; flex-direction: column; align-items: center; gap: 4px; transform: translateY(-50%); pointer-events: none; }
.nametag .label {
  display: flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px;
  background: rgba(10, 14, 26, 0.55); font-size: 12px; font-weight: 600; white-space: nowrap; color: #fff;
}
.nametag .dot { width: 7px; height: 7px; border-radius: 50%; }
.nametag.me .label { display: none; }
.nametag .bubble {
  max-width: 220px; padding: 6px 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.94); color: #1b1b24;
  font-size: 13px; line-height: 1.35; opacity: 0; transform: translateY(6px); transition: opacity 0.2s, transform 0.2s;
  word-wrap: break-word; text-align: center; position: relative;
}
.nametag .bubble::after { content: ''; position: absolute; left: 50%; bottom: -5px; margin-left: -5px; border: 5px solid transparent; border-bottom: 0; border-top-color: rgba(255, 255, 255, 0.94); }
.nametag .bubble.show { opacity: 1; transform: none; }
.nametag .bubble:empty { display: none; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#hud > * { pointer-events: auto; }
.panel { background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: var(--radius); }
#info { position: absolute; left: 16px; top: 16px; padding: 10px 14px 11px; min-width: 210px; max-width: 280px; pointer-events: none; }
#info .title { display: flex; flex-direction: column; margin-bottom: 6px; }
#info .title span { font-weight: 800; font-size: 16px; }
#info .title small { color: var(--muted); font-size: 12px; }
#info .stats { display: grid; grid-template-columns: repeat(2, auto); justify-content: start; gap: 4px 22px; }
#info .stats div { display: flex; flex-direction: column; }
#info .stats b { font-size: 17px; font-variant-numeric: tabular-nums; }
#info .stats small { font-size: 11px; color: var(--muted); }
#info .sub { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
#info .sub:empty { display: none; }
#info .sub b { color: var(--accent); }

#route { position: absolute; left: 50%; top: 16px; transform: translateX(-50%); width: min(460px, calc(100vw - 640px)); min-width: 260px; padding: 10px 14px 16px; pointer-events: none; }
.route-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.route-head b { color: var(--text); }
.track { position: relative; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.15); }
.track .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); width: 0; }
.track .cp { position: absolute; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: #29324a; border: 2px solid rgba(255, 255, 255, 0.6); }
.track .cp.done { background: var(--accent); border-color: #fff; }
.track .cp.summit { width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 3px; transform: rotate(45deg); }
.track .cp span { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); font-size: 9.5px; white-space: nowrap; color: var(--muted); }
.track .cp.summit span { transform: translateX(-50%) rotate(-45deg); top: 14px; }
.track .pdot { position: absolute; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; border: 1.5px solid #fff; transition: left 0.4s linear; }
.track .pdot.me { width: 14px; height: 14px; margin: -7px 0 0 -7px; border-width: 2.5px; z-index: 2; box-shadow: 0 0 0 3px rgba(255, 179, 92, 0.35); }

#topRight { position: absolute; right: 16px; top: 16px; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; pointer-events: none; }
#topRight .btns { display: flex; gap: 6px; pointer-events: auto; }
#topRight .btns button {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--glass);
  backdrop-filter: blur(10px); font-size: 18px;
}
#topRight .btns button:hover { background: var(--glass-strong); }
#players { padding: 10px 12px; width: 230px; max-height: 40vh; overflow-y: auto; pointer-events: auto; }
#players .ph { display: flex; align-items: center; gap: 4px; width: 100%; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; font: inherit; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
#players .ph .caret { margin-left: auto; font-style: normal; font-size: 12px; color: var(--text); transition: transform 0.2s; }
#players.collapsed .ph { margin-bottom: 0; }
#players.collapsed .ph .caret { transform: rotate(-90deg); }
#players.collapsed #playerList { display: none; }
#players .ph b { color: var(--text); }
#playerList { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
#playerList li { display: flex; align-items: center; gap: 7px; font-size: 13px; }
#playerList .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
#playerList .n { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#playerList .p { color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
#playerList li.me .n { font-weight: 700; }

#toasts { position: absolute; left: 50%; top: 96px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  padding: 9px 16px; border-radius: 999px; background: var(--glass-strong); border: 1px solid var(--line);
  font-size: 14px; animation: toast 4.2s ease forwards; white-space: nowrap; max-width: 92vw; overflow: hidden; text-overflow: ellipsis;
}
.toast b { color: var(--accent); }
@keyframes toast { 0% { opacity: 0; transform: translateY(-8px); } 8%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-6px); } }

#banner { position: absolute; left: 0; right: 0; top: 30%; text-align: center; pointer-events: none; opacity: 0; }
#banner.show { animation: banner 6s ease forwards; }
#banner .b1 { font-size: clamp(16px, 2.6vw, 22px); letter-spacing: 0.3em; text-transform: uppercase; color: #fff3dc; text-shadow: 0 2px 20px rgba(0, 0, 0, 0.5); }
#banner .b2 { font-size: clamp(36px, 7vw, 76px); font-weight: 800; color: #fff; text-shadow: 0 4px 40px rgba(255, 140, 60, 0.6), 0 2px 8px rgba(0, 0, 0, 0.4); }
@keyframes banner { 0% { opacity: 0; transform: scale(0.94); } 10%, 80% { opacity: 1; transform: none; } 100% { opacity: 0; } }

#hint {
  position: absolute; left: 50%; bottom: 104px; transform: translateX(-50%); padding: 8px 14px; border-radius: 12px;
  background: var(--glass-strong); font-size: 14px; pointer-events: none; transition: opacity 0.3s; white-space: nowrap; max-width: 92vw;
}
#hint:empty { opacity: 0; }
#hint kbd, .help-grid kbd { display: inline-block; padding: 1px 7px; border-radius: 6px; background: rgba(255, 255, 255, 0.16); border: 1px solid rgba(255, 255, 255, 0.25); font-family: inherit; font-size: 12px; font-weight: 700; }

#chat { position: absolute; left: 16px; bottom: 16px; width: 340px; display: flex; flex-direction: column; gap: 6px; }
#chatLog {
  max-height: 200px; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; padding: 4px 2px;
  mask-image: linear-gradient(to bottom, transparent, #000 24px); -webkit-mask-image: linear-gradient(to bottom, transparent, #000 24px);
  pointer-events: auto;
}
#chatLog div { font-size: 13.5px; line-height: 1.4; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8); word-wrap: break-word; }
#chatLog .who { font-weight: 700; }
#chatLog .sys { color: var(--accent); font-style: italic; }
#chatInput {
  width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--glass);
  color: var(--text); outline: none; backdrop-filter: blur(10px);
}
#chatInput:focus { border-color: var(--accent); background: var(--glass-strong); }

#bottomBar { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; }
#emotes { display: flex; gap: 6px; }
#emotes button {
  position: relative; width: 46px; height: 46px; border-radius: 14px; border: 1px solid var(--line); background: var(--glass);
  backdrop-filter: blur(10px); font-size: 21px;
}
#emotes button:hover { background: var(--glass-strong); transform: translateY(-2px); }
#emotes i { position: absolute; left: 4px; top: 2px; font-size: 10px; font-style: normal; color: var(--muted); }
.stamina { position: relative; width: 262px; height: 8px; border-radius: 4px; background: rgba(0, 0, 0, 0.35); overflow: hidden; pointer-events: none; }
#staminaFill { height: 100%; width: 100%; background: linear-gradient(90deg, #7fe0a8, #c8f07a); transition: width 0.15s; }
#staminaFill.tired { background: #ff7a59; }
.stamina span { display: none; }

.modal { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(5, 8, 16, 0.4); z-index: 5; padding: 16px; }
.modal-card {
  position: relative; width: min(560px, 100%); max-height: 82vh; overflow-y: auto; padding: 22px;
  background: rgba(16, 20, 36, 0.92); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}
.modal-card h2 { margin: 0 0 8px; font-size: 20px; }
.modal-card .close { position: absolute; right: 12px; top: 12px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.1); }
.muted { color: var(--muted); font-size: 13.5px; }
.wish-form { display: flex; gap: 8px; margin: 12px 0 14px; }
.wish-form input { flex: 1; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.08); color: var(--text); outline: none; }
#wishList { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
#wishList li { padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.06); border-left: 4px solid var(--c, var(--accent)); }
#wishList .wt { font-size: 14.5px; line-height: 1.45; word-wrap: break-word; }
#wishList .wm { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
#wishList .empty { border: 0; text-align: center; color: var(--muted); }
.help-grid { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14px; margin: 12px 0; align-items: center; }

#flash { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 50; }
#flash.on { animation: flash 0.5s ease-out; }
@keyframes flash { from { opacity: 0.85; } to { opacity: 0; } }

/* ---------- Cảm ứng ---------- */
#touchUI { display: none; }
body.touch #touchUI { display: block; pointer-events: none; position: absolute; inset: 0; }
#joyBase { position: absolute; width: 110px; height: 110px; margin: -55px 0 0 -55px; border-radius: 50%; background: rgba(255, 255, 255, 0.12); border: 2px solid rgba(255, 255, 255, 0.3); display: none; }
#joyBase.on { display: block; }
#joyKnob { position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; margin: -24px 0 0 -24px; border-radius: 50%; background: rgba(255, 255, 255, 0.55); }
#jumpBtn, #runBtn {
  position: absolute; right: 22px; width: 62px; height: 62px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.3);
  background: rgba(14, 20, 34, 0.5); font-size: 24px; pointer-events: auto;
}
#jumpBtn { bottom: 120px; }
#runBtn { bottom: 196px; right: 30px; width: 52px; height: 52px; font-size: 20px; }
#runBtn.on { background: var(--accent); }

@media (max-width: 900px) {
  #route { display: none; }
  #players { display: none; }
  #info { width: 230px; padding: 10px 12px; }
  #info .title span { font-size: 16px; }
  #info .stats b { font-size: 15px; }
  #chat { width: min(300px, calc(100vw - 32px)); }
  #chatLog { max-height: 120px; }
}
body.touch #chat { bottom: auto; top: 150px; width: 260px; }
body.touch #chatLog { max-height: 100px; }
body.touch #bottomBar { bottom: 12px; left: auto; right: 100px; transform: none; }
body.touch #emotes button { width: 40px; height: 40px; font-size: 18px; }
body.touch #hint { bottom: 76px; font-size: 12.5px; }
body.touch .stamina { width: 220px; }
@media (max-width: 600px) {
  #topRight .btns button { width: 36px; height: 36px; font-size: 16px; }
  #info .sub { display: none; }
  body.touch #bottomBar { right: 16px; bottom: 270px; }
  body.touch #emotes { flex-direction: column; }
  body.touch .stamina { display: none; }
}

/* ---------- Điện thoại ---------- */
body.touch #toasts { top: auto; bottom: 140px; left: 16px; transform: none; width: calc(100vw - 120px); align-items: flex-start; }
body.touch .toast { white-space: normal; text-align: center; font-size: 13px; }
body.touch #hint { white-space: normal; left: 16px; transform: none; width: max-content; max-width: calc(100vw - 120px); }
@media (max-width: 600px) {
  #info { width: calc(100vw - 84px); }
  #topRight .btns { flex-direction: column; }
  body.touch #chat { top: 136px; width: calc(100vw - 100px); }
}

/* ---------- NPC, bản đồ, hộp thoại ---------- */
.nametag.npc .label { background: rgba(60, 38, 14, 0.7); }
.nametag.porter .label { background: rgba(176, 92, 20, 0.8); }
.nametag .label small { font-weight: 500; opacity: 0.8; margin-left: 4px; font-size: 10.5px; }

#minimap {
  position: absolute; right: 16px; bottom: 16px; width: 180px; height: 180px; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.75); box-shadow: 0 8px 26px rgba(0, 0, 0, 0.35); overflow: hidden; cursor: pointer;
  background: #e8eef6;
}
#miniCanvas { width: 100%; height: 100%; display: block; }
#minimap .north { position: absolute; top: 4px; left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 800; color: #fff; text-shadow: 0 1px 3px #000; pointer-events: none; }
#camBtns { position: absolute; right: 204px; bottom: 20px; display: flex; gap: 6px; }
#camBtns button { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(10px); font-size: 20px; touch-action: none; }
#camBtns button:active { background: var(--accent); color: #2a1206; }

#dialog {
  position: absolute; left: 50%; bottom: 110px; transform: translateX(-50%); width: min(520px, calc(100vw - 32px));
  padding: 14px 16px; border-radius: 16px; background: rgba(28, 20, 12, 0.9); border: 1px solid rgba(255, 210, 150, 0.3);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.45); z-index: 4;
}
.dlg-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.dlg-head b { color: var(--accent); font-size: 16px; }
.dlg-head small { color: var(--muted); flex: 1; }
#dlgClose { border: 0; background: transparent; font-size: 16px; color: var(--muted); }
#dlgText { margin: 0 0 10px; font-size: 15px; line-height: 1.5; }
#dlgOpts { display: flex; flex-direction: column; gap: 6px; }
#dlgOpts button {
  text-align: left; padding: 9px 12px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.07); font-size: 14px; display: flex; gap: 8px; align-items: center;
}
#dlgOpts button:hover { background: rgba(255, 179, 92, 0.2); border-color: var(--accent); }
#dlgOpts button i { font-style: normal; font-size: 11px; color: var(--muted); border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 5px; padding: 0 5px; }
#dlgOpts button .sw { width: 10px; height: 10px; border-radius: 50%; flex: none; }
#dlgOpts button small { color: var(--muted); margin-left: auto; white-space: nowrap; }
#talkBtn { position: absolute; left: 50%; bottom: 150px; transform: translateX(-50%); padding: 10px 18px; border-radius: 999px; border: 0; background: var(--accent); color: #2a1206; font-weight: 700; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3); }

#rideBar {
  position: absolute; left: 50%; top: 92px; transform: translateX(-50%); display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 999px; background: var(--glass-strong); border: 1px solid var(--line); white-space: nowrap; z-index: 6;
}
.ride-track { width: 160px; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.15); overflow: hidden; }
#rideBar { max-width: calc(100vw - 24px); box-sizing: border-box; }
#rideText { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* điện thoại: chữ một dòng riêng ở trên, thanh tiến trình + nút Bỏ qua ở dưới – không tràn ra ngoài màn hình */
@media (max-width: 600px) {
  #rideBar { top: 116px; flex-wrap: wrap; justify-content: center; gap: 8px 10px; width: calc(100vw - 24px); padding: 10px 14px; border-radius: 16px; white-space: normal; }
  #rideText { flex: 1 1 100%; text-align: center; font-size: 13.5px; line-height: 1.35; }
  .ride-track { flex: 1 1 auto; width: auto; min-width: 0; }
  #rideSkip { flex: none; }
}
#rideFill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
#rideSkip { border: 0; border-radius: 999px; padding: 6px 12px; background: rgba(255, 255, 255, 0.14); font-weight: 600; font-size: 13px; }

.modal-card.wide { width: min(1080px, 100%); }
.map-wrap { display: flex; gap: 16px; align-items: flex-start; }
#fullCanvas { width: min(640px, 62vh, 100%); height: auto; aspect-ratio: 1; border-radius: 12px; flex: none; }
.map-side { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 12px; }
#routeLegend { display: flex; flex-direction: column; gap: 8px; }
.route-item { padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.06); border-left: 5px solid var(--c); }
.route-item b { display: block; font-size: 14.5px; }
.route-item span { font-size: 12.5px; color: var(--accent); }
.route-item p { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.route-item.on { background: rgba(255, 179, 92, 0.14); }
.legend-icons { display: grid; grid-template-columns: 1fr; gap: 3px; font-size: 12.5px; color: var(--muted); }

@media (max-width: 900px) {
  #minimap { width: 130px; height: 130px; }
  #camBtns { right: 152px; }
  .map-wrap { flex-direction: column; }
  #fullCanvas { width: 100%; }
}
body.touch #minimap { top: 140px; right: 16px; bottom: auto; width: 120px; height: 120px; }
body.touch #camBtns { right: auto; left: 16px; bottom: 16px; }
body.touch #dialog { bottom: 64px; }
@media (max-width: 600px) {
  body.touch #minimap { top: 245px; bottom: auto; left: 16px; right: auto; width: 100px; height: 100px; }
  body.touch #toasts { top: 360px; bottom: auto; }
  #info .stats b { font-size: 14px; }
}
/* điện thoại xoay ngang */
@media (max-height: 500px) and (orientation: landscape) {
  #info { padding: 8px 10px; width: 250px; }
  #info .stats b { font-size: 14px; white-space: nowrap; }
  #info .sub { display: none; }
  #route, #players { display: none; }
  body.touch #chat { top: 112px; width: 230px; }
  body.touch #chatLog { max-height: 60px; }
  body.touch #minimap { top: 70px; bottom: auto; right: 64px; width: 96px; height: 96px; }
  body.touch #bottomBar { right: 96px; bottom: 8px; }
  body.touch #emotes { flex-direction: row; }
  body.touch #jumpBtn { bottom: 20px; }
  body.touch #runBtn { bottom: 92px; }
  #topRight .btns { flex-direction: row; }
  #dialog { bottom: 56px; max-height: 60vh; overflow-y: auto; }
}

/* ---------- Check-in & hộ chiếu ---------- */

#checkinCard {
  position: absolute; right: 16px; top: 240px; width: min(340px, calc(100vw - 32px)); border-radius: 18px; overflow: hidden;
  background: rgba(22, 16, 10, 0.92); border: 1px solid rgba(255, 210, 150, 0.35); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); z-index: 4;
}
#checkinCard.pop { animation: ciPop 0.45s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes ciPop { from { transform: translateY(20px) scale(0.92); opacity: 0; } to { transform: none; opacity: 1; } }
.ci-photo { position: relative; aspect-ratio: 16 / 10; background: #222; }
.ci-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
#ciReal { position: absolute; left: 10px; top: 10px; padding: 3px 8px; border-radius: 999px; background: rgba(0, 0, 0, 0.55); font-size: 11.5px; }
.ci-body { padding: 12px 14px 14px; }
.ci-stamp { display: inline-block; padding: 2px 8px; border: 2px solid #e0384a; color: #ff6b7a; border-radius: 6px; font-weight: 800; font-size: 11px; letter-spacing: 0.12em; transform: rotate(-3deg); }
.ci-body h3 { margin: 6px 0 4px; font-size: 19px; }
.ci-body p { margin: 0 0 8px; font-size: 13.5px; line-height: 1.5; color: rgba(245, 242, 234, 0.85); }
#ciMeta { font-size: 12.5px; color: var(--accent); margin-bottom: 10px; }
.ci-btns { display: flex; gap: 6px; }
.ci-btns button { flex: 1; padding: 8px 6px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, 0.15); background: rgba(255, 255, 255, 0.08); font-size: 13px; }
.ci-btns button:hover { background: rgba(255, 179, 92, 0.22); }

#albumGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-top: 12px; }
.album-card { position: relative; text-align: left; padding: 0; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.05); display: flex; flex-direction: column; }
.album-card img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; display: block; filter: grayscale(0.85) brightness(0.7); transition: filter 0.2s; }
.album-card.stamped img, .album-card:hover img { filter: none; }
.album-card .ai { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; }
.album-card b { font-size: 14.5px; }
.album-card p { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.album-card .af { font-size: 12px; color: var(--accent); }
.album-card.stamped .af { color: var(--ok); }
.album-card code { font-size: 10.5px; color: rgba(245, 242, 234, 0.5); word-break: break-all; }
.album-card .stamp {
  position: absolute; right: 10px; top: 10px; padding: 4px 10px; border: 3px solid #e0384a; color: #ff5a6c; border-radius: 8px;
  font-weight: 900; letter-spacing: 0.1em; transform: rotate(8deg); background: rgba(255, 255, 255, 0.85); font-size: 13px;
}
@media (max-width: 600px) {
  #checkinCard { top: auto; bottom: 150px; right: 16px; }
  .ci-photo { aspect-ratio: 16 / 8; }
}

.profile-box { padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); }
.pb-head { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.pb-head small { font-weight: 400; color: var(--muted); }
#profileCanvas { width: 100%; height: auto; aspect-ratio: 760 / 300; display: block; }

/* ---------- Đèn pin trong thanh động tác ---------- */
#emotes .lamp { width: auto; padding: 0 10px 0 16px; display: flex; align-items: center; gap: 4px; }
#emotes .lamp b { font-size: 11px; font-weight: 700; color: var(--muted); }
#emotes .lamp.on { background: rgba(255, 214, 120, 0.35); border-color: #ffd678; box-shadow: 0 0 14px rgba(255, 214, 120, 0.5); }
#emotes .lamp.on b { color: #ffe3a0; }

/* ---------- Cắt ảnh mặt ---------- */
#cropModal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; background: rgba(8, 10, 20, 0.7); padding: 16px; }
.crop-card { width: min(420px, 100%); padding: 20px; border-radius: 18px; background: rgba(20, 22, 38, 0.97); border: 1px solid var(--line); }
.crop-card h3 { margin: 0 0 4px; }
#cropCanvas { width: 100%; aspect-ratio: 1; border-radius: 14px; margin: 12px 0; cursor: grab; touch-action: none; background: #111; display: block; }
#cropZoom { width: 100%; accent-color: var(--accent); }
.crop-btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }

/* =====================================================================
   Trang chủ: thanh trên · sân khấu nhân vật · bảng chọn 2 bước · hộ chiếu
   ===================================================================== */
.muted { color: var(--muted); }
#lobby {
  position: fixed; inset: 0; z-index: 30; overflow-x: hidden; overflow-y: auto; touch-action: pan-y; scroll-behavior: smooth;
  background: #1c2346;
}
/* nền tranh: hai lớp đổi nhau cho mượt khi chuyển bước / chọn cung */
.home-bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.bg-layer { position: absolute; inset: -2%; background: center 62% / cover no-repeat; opacity: 0; transform: scale(1.06); transition: opacity 0.9s ease, transform 9s ease-out; }
.bg-layer.on { opacity: 1; transform: scale(1); }
.bg-shade {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(12, 14, 32, 0.45) 0%, rgba(12, 14, 32, 0) 26%),
    linear-gradient(90deg, rgba(12, 14, 32, 0.38) 0%, rgba(12, 14, 32, 0) 34%, rgba(12, 14, 32, 0) 52%, rgba(12, 14, 32, 0.5) 100%);
}
#lobby.journal-mode .home-bg { display: none; }
.home-top, .hero, .journal { position: relative; z-index: 1; }

/* thanh trên cùng */
.home-top {
  position: sticky; top: 0; z-index: 5 !important; height: 60px; display: flex; align-items: center; gap: 14px;
  padding: 0 clamp(14px, 3vw, 32px);
  background: linear-gradient(180deg, rgba(14, 18, 36, 0.72), rgba(14, 18, 36, 0.38));
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.logo { display: flex; align-items: center; gap: 10px; min-width: max-content; color: #fff8e9; }
.logo-mark { width: 39px; height: 39px; display: block; filter: drop-shadow(0 7px 14px rgba(72, 200, 192, 0.18)); }
.logo-type { position: relative; display: block; height: 35px; padding: 2px 3px 0 0; line-height: 1; }
.logo-type b { display: flex; align-items: baseline; gap: 5px; font-size: 22px; letter-spacing: -0.075em; font-weight: 800; font-style: normal; }
.logo-type b i, .logo-type b em { font-style: normal; }
.logo-type b i { color: #fff7e5; text-shadow: 0 2px 10px rgba(255, 220, 156, 0.16); }
.logo-type b em { color: #ffba70; text-shadow: 0 3px 12px rgba(244, 111, 79, 0.32); }
.logo-cloud { position: absolute; left: 2px; right: 0; bottom: 0; height: 5px; border-radius: 50%; border-top: 2px solid #76d5cf; opacity: 0.95; transform: skewX(-18deg); }
.logo-cloud::after { content: ''; position: absolute; right: 7px; top: 2px; width: 30%; border-top: 2px solid #f58a5b; border-radius: 50%; }
.top-nav { margin-left: auto; display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: rgba(0, 0, 0, 0.25); border: 1px solid rgba(255, 255, 255, 0.08); }
.top-nav button { height: 32px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 700; }
.top-nav button:hover { color: var(--text); }
.top-nav button.on { background: rgba(255, 255, 255, 0.14); color: var(--text); }
.top-actions { display: flex; align-items: center; gap: 8px; }
.pill { padding: 7px 12px; border-radius: 999px; background: rgba(20, 16, 36, 0.45); backdrop-filter: blur(8px); font-size: 13px; color: rgba(255, 246, 236, 0.92); }
.pill.live { color: #b9f5cf; }
.account-box { display: flex; align-items: center; }
.login-open { height: 38px; padding: 0 16px; border-radius: 999px; border: 0; font-weight: 700; font-size: 14px; color: #2a1206; background: linear-gradient(90deg, var(--accent), var(--accent-2)); box-shadow: 0 6px 18px rgba(255, 122, 89, 0.3); }
.user-chip { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 4px 0 4px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); border: 1px solid var(--line); }
.user-chip .av { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: linear-gradient(135deg, #6b5ca5, #e58e6e); display: grid; place-items: center; font-weight: 800; font-size: 14px; }
.user-chip .nm { font-size: 14px; font-weight: 600; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .nm small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); }
.user-chip .out { width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.08); font-size: 14px; }
.user-chip .out:hover { background: rgba(255, 100, 100, 0.25); }

/* sân khấu + bảng chọn */
.hero { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(400px, 500px); height: calc(100vh - 60px); height: calc(100dvh - 60px); min-height: 560px; }
.stage { position: relative; min-height: 0; }
#stageCanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: pan-y; }
#stageCanvas:active { cursor: grabbing; }
.brand { position: absolute; left: clamp(20px, 4vw, 56px); top: clamp(18px, 4vh, 44px); pointer-events: none; }
.brand h1 {
  margin: 0; font-size: clamp(44px, 6.4vw, 88px); font-weight: 800; letter-spacing: -0.035em; line-height: 0.95;
  background: linear-gradient(90deg, #fff6e6, #ffc58a 55%, #ff9a7a); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 16px rgba(30, 14, 40, 0.55));
}
.brand .tagline { margin: 10px 0 0; max-width: 400px; color: rgba(255, 248, 240, 0.95); font-size: clamp(14px, 1.3vw, 17px); line-height: 1.5; text-shadow: 0 1px 10px rgba(20, 12, 30, 0.7); }
.stage-hint { position: absolute; right: 22px; bottom: 26px; pointer-events: none; font-size: 12.5px; color: rgba(255, 255, 255, 0.55); letter-spacing: 0.01em; }


.wizard { position: relative; display: flex; align-items: center; padding: 20px clamp(14px, 2vw, 24px) 20px 0; min-height: 0; min-width: 0; }
/* thẻ chọn luôn vừa một màn hình: phần nội dung cuộn bên trong, nút bấm luôn nằm ở đáy */
.wiz-card {
  width: 100%; min-width: 0; max-height: calc(100dvh - 60px - 40px); display: flex; flex-direction: column; padding: 18px 20px 18px; border-radius: 24px;
  background: rgba(16, 20, 36, 0.66); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--line); box-shadow: 0 30px 80px rgba(10, 10, 30, 0.45);
}
.stepper { list-style: none; margin: 0 0 16px; padding: 4px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; border-radius: 16px; background: rgba(0, 0, 0, 0.22); }
.stepper button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: 12px; background: transparent; text-align: left; color: var(--muted); }
.stepper .num { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; background: rgba(255, 255, 255, 0.1); }
.stepper .lbl { display: flex; flex-direction: column; min-width: 0; }
.stepper b { font-size: 14.5px; color: var(--text); }
.stepper small { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stepper li.on button { background: rgba(255, 255, 255, 0.1); box-shadow: inset 0 0 0 1px rgba(255, 179, 92, 0.5); }
.stepper li.on .num { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #2a1206; }
.stepper li.done .num { background: rgba(127, 224, 168, 0.22); color: var(--ok); }
.wiz-step { animation: stepIn 0.28s ease; display: flex; flex-direction: column; min-height: 0; min-width: 0; flex: 1; }
.wiz-scroll { min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 0 -8px; padding: 2px 8px; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.2) transparent; }
.wiz-step > .primary, .wiz-foot { flex: none; margin-top: 10px; }
@keyframes stepIn { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.07em; }
.field input {
  width: 100%; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08); color: var(--text); outline: none; font-size: 16px;
}
.field input:focus { border-color: var(--accent); background: rgba(255, 255, 255, 0.11); }
.row.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.char-row { display: flex; gap: 14px; align-items: center; margin-bottom: 4px; }
.char-fields { flex: 1; min-width: 0; }
.char-fields .field { margin-bottom: 8px; }
.face-btn {
  flex: none; width: 80px; height: 80px; border-radius: 50%; padding: 0; overflow: hidden; position: relative;
  border: 2px dashed rgba(255, 255, 255, 0.35); background: rgba(255, 255, 255, 0.06); font-size: 26px;
}
.face-btn:hover { border-color: var(--accent); }
.face-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.face-btn.has-face { border-style: solid; border-color: var(--accent); }
.face-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.body-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.body-grid button {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05); font-size: 14px; font-weight: 600; text-align: left;
}
.body-grid button i { font-style: normal; font-size: 20px; }
/* chân dung nhân vật thay cho emoji */
.body-grid button i.thumb { flex: none; width: 38px; height: 38px; border-radius: 50%; overflow: hidden; background: rgba(255, 255, 255, 0.08); display: grid; place-items: center; }
.body-grid button i.thumb img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.25); }
.body-grid button .price { display: inline-flex; align-items: center; }
.gear-row .ghost { display: inline-flex; align-items: center; gap: 6px; }
.gear-row .ghost i { display: inline-flex; }
#breedList button { display: inline-flex; align-items: center; gap: 6px; }
.body-grid button:hover { background: rgba(255, 255, 255, 0.1); }
.body-grid button.on { background: rgba(255, 179, 92, 0.18); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatches button { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.15); transition: transform 0.12s; }
.swatches button.on { border-color: #fff; transform: scale(1.12); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { padding: 7px 11px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.06); font-size: 13.5px; }
.chips button.on { background: var(--accent); color: #2a1a08; border-color: var(--accent); font-weight: 700; }
.ghost { padding: 7px 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.07); font-size: 13px; }
.ghost:hover { background: rgba(255, 179, 92, 0.18); border-color: var(--accent); }
.ghost.big { padding: 13px 16px; border-radius: 14px; font-size: 15px; font-weight: 600; white-space: nowrap; }
.fine.left { text-align: left; margin: 0 0 14px; }

/* bước 2: chọn cung */
.maps { display: flex; flex-direction: column; gap: 8px; }
.map-card {
  position: relative; width: 100%; min-width: 0; display: flex; gap: 12px; align-items: stretch; text-align: left; padding: 8px; border-radius: 16px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.05); transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.map-card:hover { background: rgba(255, 255, 255, 0.09); transform: translateY(-1px); }
.map-card.on { border-color: var(--accent); background: rgba(255, 179, 92, 0.13); box-shadow: inset 0 0 0 1px var(--accent); }
.map-card .cover { flex: none; width: 104px; aspect-ratio: 4 / 3; border-radius: 11px; background: #3a3558 center / cover; position: relative; overflow: hidden; }
.map-card .cover b { position: absolute; left: 6px; bottom: 6px; font-size: 11px; padding: 2px 6px; border-radius: 6px; background: rgba(0, 0, 0, 0.55); }
.map-card .mc-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; padding: 2px 4px 2px 0; }
.map-card .mn { font-weight: 800; font-size: 16px; display: flex; align-items: center; gap: 6px; }
.map-card .mn .done { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: rgba(127, 224, 168, 0.18); color: var(--ok); }
.map-card .alt { font-size: 12.5px; color: var(--accent); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-card .prog { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-top: auto; }
.map-card .prog .bar { flex: 1; height: 5px; border-radius: 99px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.map-card .prog .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.map-card .meta { display: flex; gap: 10px; font-size: 11.5px; color: var(--muted); }
.map-card .meta .live { color: var(--ok); }
/* nút leo trên từng thẻ núi; nút "Bắt đầu leo" chung ở chân khung bị ẩn */
.map-card .mc-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.map-card .mc-foot .meta { flex: 1; min-width: 0; flex-wrap: wrap; }
.map-card .mc-go { flex: none; margin-left: auto; padding: 8px 16px; border-radius: 10px; background: linear-gradient(90deg, #ffb347, #ff7a3d); color: #2a1206; font-size: 14px; font-weight: 900; letter-spacing: 0.02em; white-space: nowrap; cursor: pointer; box-shadow: 0 4px 14px rgba(255, 122, 61, 0.35); transition: transform 0.12s, filter 0.12s; }
.map-card .mc-go:hover { filter: brightness(1.08); transform: translateY(-1px); }
.map-card .mc-go:active { transform: translateY(1px); }
#step2 #startBtn { display: none; }
.map-card .meta .live.tap { cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
.map-card .meta .live.tap:hover { color: #a8f0c6; }
.map-card .tick { position: absolute; right: 10px; top: 10px; width: 22px; height: 22px; border-radius: 50%; display: none; place-items: center; background: var(--accent); color: #2a1206; font-size: 13px; font-weight: 900; }
.map-card.on .tick { display: grid; }
.wiz-foot { display: flex; gap: 8px; }
.wiz-foot .primary { margin: 0; }


/* đăng nhập */
#loginModal { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px; background: rgba(8, 10, 20, 0.66); backdrop-filter: blur(4px); }
.login-card { position: relative; width: min(400px, 100%); padding: 24px 22px 18px; border-radius: 22px; background: #181b2e; border: 1px solid var(--line); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5); animation: stepIn 0.25s ease; }
.login-card h3 { margin: 0 0 6px; font-size: 21px; }
.login-card p.muted { margin: 0 0 12px; font-size: 14px; line-height: 1.5; }
.login-card .x { position: absolute; right: 12px; top: 12px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.08); }
.perks { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 6px; font-size: 13.5px; }
.perks li { display: flex; align-items: center; gap: 10px; }
.perks i { font-style: normal; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: rgba(255, 179, 92, 0.16); color: var(--accent); font-weight: 800; flex: none; }
.login-list { display: grid; gap: 8px; }
.login-btn { position: relative; display: flex; align-items: center; justify-content: center; gap: 10px; height: 46px; border-radius: 12px; border: 1px solid transparent; font-weight: 700; font-size: 15px; }
.login-btn svg { width: 20px; height: 20px; flex: none; }
.login-btn.google { background: #fff; color: #1f1f1f; border-color: #dadce0; }
.login-btn.facebook { background: #1877f2; color: #fff; }
.login-btn.tiktok { background: #010101; color: #fff; border-color: #333; }
.login-btn.dev { background: transparent; color: var(--text); border: 1px dashed var(--line); }
.login-btn:not(:disabled):hover { filter: brightness(1.07); }
.login-btn:disabled { opacity: 0.42; cursor: not-allowed; }
.login-btn em { font-style: normal; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 99px; background: rgba(127, 127, 127, 0.25); }
.home-toast { position: fixed; left: 50%; top: 74px; z-index: 80; transform: translateX(-50%); padding: 10px 16px; border-radius: 12px; background: rgba(16, 20, 36, 0.92); border: 1px solid var(--line); font-size: 14px; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35); animation: stepIn 0.25s ease; }

/* nhãn tên: dấu đã xác thực */
.nametag .ok { display: inline-grid; place-items: center; width: 13px; height: 13px; border-radius: 50%; background: #3ba0ff; color: #fff; font-size: 9px; font-weight: 900; }

@media (max-width: 960px) {
  .hero { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto; height: auto; min-height: 0; }
  .wiz-card { max-height: none; }
  .wiz-scroll { overflow: visible; }
  .stage { height: 62vh; min-height: 420px; }
  .wizard { padding: 0 14px 10px; }
  #lobby.wizard-mode .brand .tagline { display: none; }
  .stage-hint { display: none; }
}
@media (max-width: 600px) {
  .home-top { gap: 8px; }
  #onlinePill { display: none; }
  .user-chip .nm { display: none; }
  .brand h1 { font-size: 46px; }
  .brand .tagline { max-width: 260px; font-size: 13.5px; }
  .wiz-card { padding: 14px 14px 14px; border-radius: 20px; }
  .stepper small { display: none; }
  .body-grid { grid-template-columns: repeat(2, 1fr); }
  .row.two { grid-template-columns: 1fr; gap: 0; }
  .map-card .cover { width: 84px; }
}

/* ================= Nhật ký săn mây (màn riêng) ================= */
.journal {
  min-height: calc(100vh - 60px); min-height: calc(100dvh - 60px); padding: 26px clamp(14px, 4vw, 48px) 28px;
  background:
    radial-gradient(ellipse at 15% 0%, rgba(255, 190, 120, 0.12), transparent 50%),
    radial-gradient(ellipse at 100% 100%, rgba(120, 70, 40, 0.25), transparent 55%),
    repeating-linear-gradient(92deg, rgba(255, 255, 255, 0.012) 0 3px, rgba(0, 0, 0, 0.02) 3px 7px),
    #231a14;
  animation: stepIn 0.3s ease;
}
.jr-inner { max-width: 1240px; margin: 0 auto; }
/* đầu Nhật ký: hàng 1 = nút về + tiêu đề, hàng 2 = các ô thống kê trải hết chiều ngang */
.jr-head { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: 'back title' 'stats stats'; align-items: start; gap: 16px 22px; margin-bottom: 24px; }
.jr-back { grid-area: back; }
.jr-title { grid-area: title; min-width: 0; }
.jr-back { align-self: start; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid rgba(255, 233, 196, 0.22); background: rgba(255, 255, 255, 0.05); color: #f3e3c6; font-weight: 700; font-size: 13.5px; }
.jr-back:hover { background: rgba(255, 255, 255, 0.1); }
.jr-title h2 { margin: 0; font-size: clamp(28px, 3.4vw, 42px); letter-spacing: -0.02em; color: #fbecd2; }
.jr-sub { margin: 6px 0 0; color: rgba(243, 227, 198, 0.7); font-size: 14px; max-width: 680px; line-height: 1.55; }
.jr-sub button { display: inline; margin: 0; padding: 0; border: 0; background: none; font: inherit; color: var(--accent); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; cursor: pointer; }
.jr-stats { grid-area: stats; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 1100px) { .jr-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.jr-stat { min-width: 0; padding: 12px 14px; border-radius: 16px; background: rgba(255, 233, 196, 0.06); border: 1px solid rgba(255, 233, 196, 0.14); }
.jr-stat b { display: block; font-size: 24px; line-height: 1.2; color: #fbecd2; font-variant-numeric: tabular-nums; white-space: nowrap; }
.jr-stat span { display: block; margin-top: 2px; font-size: 12px; line-height: 1.35; color: rgba(243, 227, 198, 0.62); }
.jr-book { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 540px), 1fr)); gap: 20px; }
.jr-page {
  --ink: #b23a3a; position: relative; color: #3b2f22; border-radius: 16px; overflow: hidden;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(255, 255, 255, 0.55), transparent 60%),
    radial-gradient(ellipse at 100% 100%, rgba(190, 160, 110, 0.25), transparent 55%),
    #f2e7cf;
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(120, 90, 50, 0.18);
}
.jr-banner { position: relative; height: 128px; background: #6b5b8a center 64% / cover; }
.jr-banner::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(20, 14, 30, 0.05) 30%, rgba(20, 14, 30, 0.55) 80%, #f2e7cf 100%); }
.jr-banner .jr-name { position: absolute; z-index: 1; left: 18px; right: 90px; bottom: 16px; color: #fff; text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5); }
.jr-name h3 { margin: 0; font-size: 21px; letter-spacing: -0.01em; }
.jr-name small { display: block; font-size: 12.5px; opacity: 0.9; margin-top: 2px; }
.jr-ring { position: absolute; z-index: 1; right: 16px; bottom: 6px; width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--ink) calc(var(--p) * 1%), rgba(120, 90, 50, 0.22) 0); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25); }
.jr-ring b { width: 47px; height: 47px; border-radius: 50%; display: grid; place-items: center; background: #f2e7cf; font-size: 13px; font-variant-numeric: tabular-nums; }
.jr-body { position: relative; padding: 10px 18px 14px; }
.jr-body::before { content: ''; position: absolute; inset: 0 8px 8px; border-radius: 0 0 10px 10px; border: 1px dashed rgba(120, 90, 50, 0.28); border-top: 0; pointer-events: none; }
.jr-stamps { position: relative; display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px 8px; }
.stamp { display: flex; flex-direction: column; align-items: center; gap: 5px; text-align: center; min-width: 0; }
.stamp .seal { width: 74px; height: 74px; border-radius: 50%; display: grid; place-items: center; font-size: 28px; position: relative; transform: rotate(var(--rot, 0deg)); }
.stamp.on .seal {
  color: var(--ink); border: 3px solid var(--ink);
  box-shadow: inset 0 0 0 3px #f2e7cf, inset 0 0 0 5px var(--ink);
  background: radial-gradient(circle, color-mix(in srgb, var(--ink) 10%, transparent), transparent 70%);
}
.stamp.on .seal span { transform: translateY(-5px); }
.stamp.on .seal::after { content: 'ĐÃ ĐẾN'; position: absolute; bottom: 9px; font-size: 7.5px; font-weight: 900; letter-spacing: 0.14em; color: var(--ink); }
.stamp.off .seal { border: 2px dashed rgba(120, 90, 50, 0.38); }
.stamp.off .seal span { filter: grayscale(1); opacity: 0.32; }
.stamp.off .seal::after { content: '?'; position: absolute; right: 2px; top: 2px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; background: rgba(120, 90, 50, 0.2); color: #7a6a52; }
.stamp b { font-size: 12px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.stamp small { font-size: 11px; color: #8a7a62; }
.stamp.off b { color: #7a6a52; font-weight: 600; }
.jr-foot { position: relative; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; padding-top: 10px; border-top: 1px dashed rgba(120, 90, 50, 0.3); font-size: 12.5px; color: #6a5a42; }
.jr-foot .peak.got { color: var(--ink); font-weight: 700; }
.jr-foot button { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--ink); background: transparent; color: var(--ink); font-weight: 700; font-size: 12.5px; }
.jr-foot button:hover { background: color-mix(in srgb, var(--ink) 12%, transparent); }
.journal .home-foot { color: rgba(243, 227, 198, 0.35); }
@media (max-width: 760px) {
  .jr-head { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'back' 'title' 'stats'; gap: 12px; }
  .jr-back { justify-self: start; }
  .jr-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .jr-stat { padding: 10px 10px; border-radius: 14px; }
  .jr-stat b { font-size: 20px; }
  .jr-stat span { font-size: 11.5px; }
  .jr-stamps { grid-template-columns: repeat(3, 1fr); }
  .stamp .seal { width: 64px; height: 64px; font-size: 24px; }
}
@media (max-width: 600px) {
  .top-nav button { padding: 0 10px; }
  .top-nav button span { display: none; }
  .top-nav { margin-left: auto; }
}

/* ================= Bước chọn nhân vật: phòng trưng bày kiểu trang sản phẩm ================= */
@property --tint { syntax: '<color>'; inherits: true; initial-value: #e85d3a; }
#lobby { --tint: #e85d3a; transition: --tint 0.9s ease; }
.bg-studio {
  position: absolute; inset: 0; opacity: 0; transition: opacity 0.9s ease;
  background:
    radial-gradient(42% 52% at var(--gx, 31%) 50%, color-mix(in srgb, var(--tint) 30%, transparent), transparent 72%),
    radial-gradient(30% 22% at var(--gx, 31%) 84%, rgba(255, 255, 255, 0.07), transparent 75%),
    radial-gradient(90% 70% at 50% 0%, #17171a 0%, transparent 70%),
    linear-gradient(180deg, #050506 0%, #000 55%, #0a0a0c 100%);
}
#lobby.studio .bg-studio { opacity: 1; }
#lobby.studio .bg-layer, #lobby.studio .bg-shade { opacity: 0; }
#lobby.studio { background: #000; }
#lobby.studio .home-top { background: rgba(22, 22, 23, 0.72); border-bottom-color: rgba(255, 255, 255, 0.07); }
/* chữ gọn, đậm, ánh kim nhẹ */
#lobby.studio .brand h1 {
  font-weight: 700; letter-spacing: -0.045em;
  background: linear-gradient(180deg, #ffffff 25%, #9a9aa1 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: none;
}
#lobby.studio .brand .tagline { color: #a1a1a6; text-shadow: none; font-weight: 500; max-width: 340px; }
#lobby.studio .brand .tagline b { color: #f5f5f7; font-weight: 600; }
/* chú thích dưới bệ như chú thích sản phẩm */
.stage-caption { position: absolute; left: 50%; bottom: 46px; transform: translateX(-50%); text-align: center; pointer-events: none; opacity: 0; transition: opacity 0.5s ease; white-space: nowrap; }
#lobby.studio .stage-caption { opacity: 1; }
.stage-caption b { display: block; font-size: 21px; font-weight: 700; letter-spacing: -0.02em; color: #f5f5f7; }
.stage-caption span { display: inline-flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 13.5px; color: #a1a1a6; }
.stage-caption i { width: 10px; height: 10px; border-radius: 50%; background: var(--tint); box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.18); }
/* thẻ chọn: bề mặt xám trung tính thay cho xanh than */
#lobby.studio .wiz-card { background: rgba(29, 29, 31, 0.72); border-color: rgba(255, 255, 255, 0.08); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); }
#lobby.studio .stepper { background: rgba(255, 255, 255, 0.05); }
#lobby.studio .field input, #lobby.studio .body-grid button:not(.on), #lobby.studio .chips button:not(.on), #lobby.studio .ghost { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.1); }
#lobby.studio .swatches button { width: 32px; height: 32px; border: 0; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15); }
#lobby.studio .swatches button.on { transform: none; box-shadow: 0 0 0 2px #000, 0 0 0 4px #f5f5f7; }
@media (max-width: 960px) {
  .bg-studio { --gx: 50%; background:
    radial-gradient(70% 34% at 50% 26%, color-mix(in srgb, var(--tint) 30%, transparent), transparent 72%),
    linear-gradient(180deg, #050506 0%, #000 60%, #0a0a0c 100%); }
  .stage-caption { bottom: 14px; }
  .stage-caption b { font-size: 18px; }
  .stage-hint { display: none; }
}

/* ================= Chế độ ngắm cảnh: ẩn toàn bộ giao diện ================= */
#zenExit {
  position: fixed; right: 16px; bottom: 16px; z-index: 20; display: none; align-items: center; gap: 6px;
  padding: 9px 14px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(10, 12, 22, 0.5); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  color: #fff; font-size: 13.5px; font-weight: 600; opacity: 0; transition: opacity 0.4s ease;
}
body.zen #hud > *:not(#zenExit):not(#touchUI):not(#minimap):not(#topRight) { display: none !important; }
body.zen.touch #hud > #topRight { display: none !important; }
/* ngắm cảnh vẫn giữ bản đồ nhỏ (mờ hơn) để biết mình đang ở đâu */
body.zen #minimap { opacity: 0.8; }
body.zen #zenExit { display: flex; }
body.zen.zen-peek #zenExit, #zenExit:hover { opacity: 1; }
/* điện thoại: vẫn giữ cần điều khiển (mờ) để đi lại, nút hiện giao diện luôn thấy được */
body.zen #touchUI { opacity: 0.35; }
body.zen.touch #zenExit { opacity: 0.75; top: 14px; bottom: auto; }
/* điện thoại: nút hiện giao diện chỉ còn biểu tượng */
body.touch #zenExit { width: 44px; height: 44px; padding: 0; justify-content: center; font-size: 20px; }
body.touch #zenExit span { display: none; }

/* bộ đếm ký tự ô tên và ô chat */
.count { font-style: normal; font-weight: 600; font-size: 11px; letter-spacing: 0; text-transform: none; color: var(--muted); font-variant-numeric: tabular-nums; }
.field > span .count { float: right; }
.count.full { color: #ff8a7a; }
.chat-input { position: relative; }
.chat-input #chatInput { width: 100%; padding-right: 58px; }
.chat-input .count { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); pointer-events: none; }

/* chọn bộ lông cho chó */
.coat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.coat-grid button { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.05); font-size: 13.5px; font-weight: 600; text-align: left; }
.coat-grid button i { flex: none; width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25); }
.coat-grid button.on { background: rgba(255, 179, 92, 0.18); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
#lobby.studio .coat-grid button:not(.on) { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.1); }

/* =====================================================================
   Trang chủ mở đầu: bình minh trên biển mây → tạo nhân vật → chọn cung
   ===================================================================== */
#lobby.intro-mode { background: #0d1326; }
#lobby.intro-mode .home-bg { display: none; }
/* trên trang chủ, thanh trên cùng chỉ còn logo + tài khoản, không nền */
#lobby.intro-mode .home-top {
  position: absolute; left: 0; right: 0; top: 0; width: 100%;
  background: none; border-bottom: 0; backdrop-filter: none; -webkit-backdrop-filter: none;
}
#lobby.intro-mode .home-top .top-nav,
#lobby.intro-mode #onlinePill { display: none; }
/* ẩn chữ logo để không trùng với tiêu đề lớn, chỉ giữ biểu tượng */
#lobby.intro-mode .logo-type { display: none; }
#lobby.intro-mode .login-open {
  background: rgba(255, 255, 255, 0.12); color: #fff; border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: none; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}

.intro {
  position: relative; z-index: 1; isolation: isolate; overflow: hidden;
  min-height: 100vh; min-height: 100dvh;
}
.intro-bg {
  position: absolute; inset: 0; z-index: -3; background: #1b2350 center 62% / cover no-repeat;
  transform: scale(1.04); animation: introZoom 30s ease-in-out infinite alternate;
}
@keyframes introZoom { from { transform: scale(1.04); } to { transform: scale(1.12); } }
.intro-veil {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(9, 12, 28, 0) 0%, rgba(9, 12, 28, 0.12) 52%, rgba(9, 12, 28, 0.5) 100%),
    linear-gradient(180deg, rgba(9, 12, 28, 0.5) 0%, rgba(9, 12, 28, 0) 26%, rgba(9, 12, 28, 0) 56%, rgba(9, 12, 28, 0.5) 100%);
}
.intro-mist { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; mix-blend-mode: screen; opacity: 0.5; }
.intro-mist i {
  position: absolute; width: 80vw; height: 36vw; border-radius: 50%; filter: blur(16px);
  background: radial-gradient(closest-side, rgba(255, 240, 228, 0.9), rgba(255, 240, 228, 0) 70%);
}
.intro-mist i:nth-child(1) { left: -26vw; bottom: 2%; animation: mistDrift 36s ease-in-out infinite alternate; }
.intro-mist i:nth-child(2) { right: -30vw; bottom: 18%; opacity: 0.75; animation: mistDrift 46s ease-in-out -14s infinite alternate-reverse; }
@keyframes mistDrift { from { transform: translate3d(-4%, 0, 0) scale(1); } to { transform: translate3d(6%, -3%, 0) scale(1.08); } }

/* chữ hiệu nằm giữa màn hình, bị dãy núi tiền cảnh che chân chữ */
.intro-hero {
  position: absolute; left: 0; right: 0; top: 45%; transform: translateY(-50%);
  z-index: 1; display: flex; flex-direction: column; align-items: center;
  padding: 0 16px; text-align: center; pointer-events: none;
  animation: introFade 0.9s cubic-bezier(.2, .7, .2, 1) both;
}
@keyframes introFade { from { opacity: 0; } to { opacity: 1; } }
.intro-ridge {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  display: block; width: 100%; height: 62vh; pointer-events: none;
}
.intro-ridge .ridge-back { fill: url(#ridgeBack); stroke: rgba(188, 208, 255, 0.16); stroke-width: 2; }
.intro-ridge .ridge-front { fill: url(#ridgeFront); }

/* nội dung nằm trước dãy núi, dưới chân chữ */
.intro-content {
  position: absolute; left: 0; right: 0; bottom: clamp(150px, 20vh, 200px); z-index: 3;
  display: flex; flex-direction: column; align-items: center; padding: 0 22px; text-align: center;
  animation: introRise 0.9s 0.12s cubic-bezier(.2, .7, .2, 1) both;
}
@keyframes introRise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

/* khung HUD + đốm sáng cho cảm giác giao diện game */
.intro-frame { position: absolute; inset: clamp(12px, 2vw, 22px); z-index: 4; pointer-events: none; }
.intro-frame i { position: absolute; width: 26px; height: 26px; border: 0 solid rgba(255, 190, 120, 0.4); }
.intro-frame i:nth-child(1) { left: 0; top: 0; border-left-width: 1px; border-top-width: 1px; }
.intro-frame i:nth-child(2) { right: 0; top: 0; border-right-width: 1px; border-top-width: 1px; }
.intro-frame i:nth-child(3) { left: 0; bottom: 0; border-left-width: 1px; border-bottom-width: 1px; }
.intro-frame i:nth-child(4) { right: 0; bottom: 0; border-right-width: 1px; border-bottom-width: 1px; }
.intro-sparks { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.intro-sparks i {
  position: absolute; width: 3px; height: 3px; border-radius: 50%;
  background: #ffd9a0; opacity: 0; box-shadow: 0 0 10px rgba(255, 190, 120, 0.9);
  animation: sparkFloat 9s linear infinite;
}
.intro-sparks i:nth-child(1) { left: 12%; bottom: 18%; animation-delay: -1s; }
.intro-sparks i:nth-child(2) { left: 26%; bottom: 34%; animation-delay: -4.2s; animation-duration: 11s; }
.intro-sparks i:nth-child(3) { left: 41%; bottom: 12%; animation-delay: -7.5s; animation-duration: 8s; }
.intro-sparks i:nth-child(4) { left: 58%; bottom: 26%; animation-delay: -2.6s; animation-duration: 12s; }
.intro-sparks i:nth-child(5) { left: 69%; bottom: 8%; animation-delay: -6s; }
.intro-sparks i:nth-child(6) { left: 77%; bottom: 42%; animation-delay: -3.3s; animation-duration: 10s; }
.intro-sparks i:nth-child(7) { left: 88%; bottom: 20%; animation-delay: -8.4s; animation-duration: 13s; }
.intro-sparks i:nth-child(8) { left: 94%; bottom: 36%; animation-delay: -5.1s; animation-duration: 9.5s; }
@keyframes sparkFloat {
  0% { transform: translate3d(0, 20px, 0) scale(0.7); opacity: 0; }
  18% { opacity: 0.8; }
  75% { opacity: 0.5; }
  100% { transform: translate3d(10px, -150px, 0) scale(1); opacity: 0; }
}

.intro-kicker {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 16px;
  padding: 6px 13px 6px 9px; border: 1px solid rgba(255, 179, 92, 0.34); border-radius: 6px;
  background: rgba(12, 16, 30, 0.42); font-size: 10.5px; font-weight: 800;
  letter-spacing: 0.18em; text-transform: uppercase; color: #ffd7a8;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%);
}
.intro-kicker span { font-size: 13px; letter-spacing: 0; }

.intro-title {
  margin: 0; font-weight: 800; font-size: clamp(88px, 16vw, 240px); line-height: 0.8; letter-spacing: -0.065em;
  background: linear-gradient(100deg, #fffaf0 0%, #ffe1b4 40%, #ffac68 70%, #ff8a63 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 rgba(96, 34, 12, 0.3)) drop-shadow(0 16px 46px rgba(255, 140, 80, 0.32));
}
.intro-title em {
  font-style: normal;
  background: linear-gradient(100deg, #ffd9a4, #ff8456 72%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.intro-lead {
  margin: 0; max-width: 540px; font-size: clamp(15px, 1.5vw, 18px); line-height: 1.55;
  color: rgba(255, 247, 238, 0.88); text-shadow: 0 1px 16px rgba(10, 10, 20, 0.55);
}

.intro-cta { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 18px; margin: 24px 0 0; }
.primary.big {
  position: relative; overflow: hidden; display: inline-flex; align-items: center; gap: 11px; width: auto; margin: 0;
  padding: 13px 22px 13px 13px; border-radius: 12px;
  font-size: 15px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase;
  box-shadow: 0 10px 30px rgba(255, 122, 89, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  animation: ctaPulse 3.6s ease-in-out infinite;
}
.primary.big::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(105deg, transparent 32%, rgba(255, 255, 255, 0.4) 48%, transparent 62%);
  transform: translateX(-120%); animation: ctaShine 4.2s ease-in-out infinite;
}
.play-ico {
  display: grid; place-items: center; flex: none; width: 28px; height: 28px; padding-left: 2px;
  border-radius: 50%; background: rgba(42, 18, 6, 0.16); font-size: 10px;
}
.primary.big kbd {
  margin-left: 3px; padding: 2px 6px; border-radius: 4px; border: 1px solid rgba(42, 18, 6, 0.28);
  background: rgba(42, 18, 6, 0.1); font: inherit; font-size: 11px; letter-spacing: 0; text-transform: none;
}
@keyframes ctaPulse {
  0%, 100% { box-shadow: 0 10px 30px rgba(255, 122, 89, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.4); }
  50% { box-shadow: 0 12px 38px rgba(255, 122, 89, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.4); }
}
@keyframes ctaShine { 0%, 55% { transform: translateX(-120%); } 85%, 100% { transform: translateX(120%); } }
.intro-link { border: 0; background: none; padding: 6px 2px; font-size: 14px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: rgba(255, 249, 242, 0.66); border-bottom: 1px solid rgba(255, 255, 255, 0.24); }
.intro-link:hover { color: #fff; border-bottom-color: rgba(255, 179, 92, 0.85); }

.intro-meta { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 20px 0 0; font-size: 10.5px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(255, 246, 236, 0.5); }
.hud-item { display: inline-flex; align-items: center; gap: 6px; }
.hud-item b { color: #fff; font-size: 12px; letter-spacing: 0.06em; font-variant-numeric: tabular-nums; }
.hud-sep { color: rgba(255, 255, 255, 0.2); }
.intro-meta .live-dot { width: 6px; height: 6px; border-radius: 50%; background: #7fe0a8; animation: livePulse 2.6s ease-in-out infinite; }
@keyframes livePulse { 0%, 100% { box-shadow: 0 0 0 3px rgba(127, 224, 168, 0.16); } 50% { box-shadow: 0 0 0 7px rgba(127, 224, 168, 0.04); } }

/* bảng chọn cung kiểu sảnh game */
.intro-board {
  position: absolute; left: 50%; bottom: clamp(22px, 4.5vh, 46px); z-index: 3;
  width: min(900px, calc(100vw - 44px)); padding: 10px; border-radius: 16px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, rgba(12, 18, 36, 0.74), rgba(10, 14, 28, 0.62));
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 26px 64px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  animation: boardUp 0.9s 0.18s cubic-bezier(.2, .7, .2, 1) both;
}
@keyframes boardUp { from { opacity: 0; transform: translate(-50%, 18px); } to { opacity: 1; transform: translate(-50%, 0); } }
.board-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 2px 4px 10px; font-size: 10.5px; font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase; color: rgba(255, 246, 236, 0.6); }
.board-head b { padding: 2px 7px; border-radius: 6px; background: rgba(255, 179, 92, 0.16); color: #ffcf9a; font-size: 11px; letter-spacing: 0.08em; }
.board-list { display: flex; flex-direction: row; gap: 8px; }
.pick { display: flex; gap: 8px; align-items: stretch; flex: 1 1 0; width: 0; min-width: 0; padding: 7px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.09); background: rgba(255, 255, 255, 0.035); text-align: left; transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease; }
.pick:hover { transform: translateY(-2px); border-color: rgba(255, 179, 92, 0.45); background: rgba(255, 179, 92, 0.08); }
.pick.on { border-color: rgba(255, 179, 92, 0.8); background: linear-gradient(90deg, rgba(255, 179, 92, 0.16), rgba(255, 179, 92, 0.03)); box-shadow: inset 0 0 0 1px rgba(255, 179, 92, 0.22); }
.pick-art { position: relative; flex: none; width: 64px; border-radius: 8px; background: #2a3352 center / cover no-repeat; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); }
.pick-art::after { content: ''; position: absolute; inset: 0; border-radius: 8px; background: linear-gradient(180deg, transparent 42%, rgba(6, 9, 20, 0.5)); }
.pick-body { display: flex; flex-direction: column; justify-content: center; gap: 3px; flex: 1; min-width: 0; }
.pick-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pick-top b { font-size: 13.5px; font-weight: 800; letter-spacing: -0.01em; color: #fff5e8; }
.pick-go { font-size: 9px; color: var(--accent); opacity: 0.85; }
.pick-body small { font-size: 11.5px; color: rgba(255, 246, 236, 0.58); }
.pick-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pick-diff { display: flex; gap: 3px; }
.pick-diff i { width: 12px; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.16); }
.pick-diff i.on { background: linear-gradient(90deg, #ffcf7a, #ff7a59); }
.pick-on { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; color: rgba(255, 246, 236, 0.48); }
.pick-on .live-dot { width: 5px; height: 5px; border-radius: 50%; background: #7fe0a8; }
.pick-on b { color: #d7f7e2; font-size: 11.5px; font-variant-numeric: tabular-nums; }

@media (max-width: 1120px) {
  .intro-board { display: none; }
  .intro-content { bottom: clamp(40px, 8vh, 90px); }
}
@media (max-width: 960px) {
  .intro-hero { top: 41%; }
  .intro-title { font-size: clamp(84px, 17vw, 128px); }
  .intro-ridge { height: 64vh; }
  .intro-content { bottom: clamp(28px, 5vh, 54px); }
  .intro-mist { opacity: 0.38; }
}
@media (max-width: 560px) {
  .intro-cta { flex-direction: column; align-items: center; gap: 14px; }
  .primary.big kbd { display: none; }
  .intro-frame { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .intro-bg, .intro-mist i, .intro-hero, .intro-content, .intro-board, .intro-sparks i, .primary.big, .primary.big::after { animation: none !important; }
}

/* màn tạo nhân vật / chọn cung: bỏ hẳn thanh trên cùng */
#lobby.wizard-mode .home-top { display: none; }
#lobby.wizard-mode .hero { height: 100vh; height: 100dvh; }

/* nút về trang chủ trong thẻ tạo nhân vật */
.wiz-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.wiz-home { padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.06); font-size: 12.5px; font-weight: 700; color: var(--muted); }
.wiz-home:hover { color: var(--text); background: rgba(255, 255, 255, 0.12); }
.wiz-crumb { font-size: 11.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }


/* ================= Thử thách leo núi, ăn uống ================= */
#vitals { display: flex; gap: 6px; margin-top: 6px; justify-content: center; pointer-events: auto; }
#vitals button { position: relative; display: flex; align-items: center; gap: 4px; padding: 5px 10px 8px; border-radius: 12px; border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(10px); font-size: 15px; color: var(--text); }
#vitals button b { font-size: 12px; min-width: 10px; }
#vitals .vb { position: absolute; left: 6px; right: 6px; bottom: 3px; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.18); overflow: hidden; }
#vitals .vb i { display: block; height: 100%; width: 100%; background: #7ed957; transition: width 0.4s; }
#drinkBtn .vb i { background: #5ab8ff; }
#vitals button.low .vb i { background: #ff6b5a; }
#vitals button.low { animation: lowPulse 1.2s infinite; }
@keyframes lowPulse { 50% { border-color: #ff6b5a; } }
#hazardChip { position: absolute; left: 50%; bottom: 128px; transform: translateX(-50%); padding: 7px 14px 9px; border-radius: 14px; background: rgba(40, 24, 8, 0.82); border: 1px solid #f2c230; color: #ffe9a8; font-size: 13.5px; text-align: center; pointer-events: none; z-index: 6; }
#hazardChip.climb { border-color: #ff8a3d; }
#hazardChip .grip { height: 5px; margin-top: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.18); overflow: hidden; }
#hazardChip .grip i { display: block; height: 100%; width: 100%; background: #7ed957; }
#hazardChip.danger .grip i { background: #ff6b5a; }
#eventChip { position: absolute; left: 16px; top: 132px; padding: 7px 12px; border-radius: 12px; background: rgba(120, 40, 10, 0.8); border: 1px solid #ff9a4d; color: #ffe2c2; font-size: 13px; max-width: 260px; pointer-events: none; }
#nightFade { position: fixed; inset: 0; background: #05070c; opacity: 0; pointer-events: none; z-index: 60; display: flex; align-items: center; justify-content: center; transition: opacity 1.2s; color: #e8e2d0; font-size: 20px; text-align: center; padding: 24px; }
#nightFade.on { opacity: 1; pointer-events: auto; }
#slowBtn { position: absolute; right: 96px; bottom: 120px; width: 52px; height: 52px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.3); background: rgba(14, 20, 34, 0.5); font-size: 20px; pointer-events: auto; }
#slowBtn.on { background: var(--accent); }
#sitBtn { position: absolute; right: 96px; bottom: 186px; width: 52px; height: 52px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.3); background: rgba(14, 20, 34, 0.5); font-size: 20px; pointer-events: auto; }
#sitBtn.on { background: var(--accent); }
/* điện thoại: nút quay về điểm mốc khi bị lạc (thay phím R), nổi giữa màn hình phía dưới */
#returnBtn { position: absolute; left: 50%; bottom: 168px; transform: translateX(-50%); padding: 12px 20px; border-radius: 99px; border: 2px solid rgba(255, 255, 255, 0.85); background: var(--accent); color: #2a1206; font-size: 16px; font-weight: 800; white-space: nowrap; pointer-events: auto; box-shadow: 0 6px 22px rgba(0, 0, 0, 0.45); animation: returnPulse 1.6s ease-in-out infinite; }
#returnBtn[hidden] { display: none; }
@keyframes returnPulse { 0%, 100% { box-shadow: 0 6px 22px rgba(0, 0, 0, 0.45), 0 0 0 0 rgba(255, 179, 92, 0.55); } 50% { box-shadow: 0 6px 22px rgba(0, 0, 0, 0.45), 0 0 0 10px rgba(255, 179, 92, 0); } }
#jumpBtn.climb { background: #e8622c; animation: lowPulse 0.9s infinite; }

/* ================= Giao tiếp ================= */
.badge { position: absolute; right: -4px; top: -4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: #e8443a; color: #fff; font-size: 10px; font-style: normal; line-height: 16px; text-align: center; }
#topRight .btns button, #menuBtn, #chatBtn { position: relative; }
#topRight .btns button.on, #drawerBtns button.on { background: var(--accent); color: #2a1206; }
#topRight .btns { flex-wrap: wrap; justify-content: flex-end; max-width: 420px; }
#asks { position: absolute; left: 50%; top: 86px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 30; width: min(440px, calc(100vw - 24px)); }
.ask { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 14px; background: rgba(14, 20, 34, 0.92); border: 1px solid var(--accent); font-size: 14px; pointer-events: auto; }
.ask span { flex: 1; }
#playerCard { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); width: 270px; padding: 14px; border-radius: 16px; background: rgba(14, 20, 34, 0.94); border: 1px solid var(--line); z-index: 25; pointer-events: auto; }
#playerCard .x { position: absolute; right: 8px; top: 8px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.1); color: var(--text); }
#pcName { font-size: 18px; display: block; margin-right: 30px; }
#pcTags { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0; }
#pcTags span { font-size: 11.5px; padding: 3px 8px; border-radius: 10px; background: rgba(255, 255, 255, 0.09); }
#pcInfo { display: grid; gap: 5px; padding: 9px; margin-bottom: 8px; border-radius: 12px; background: rgba(255, 255, 255, 0.06); }
#pcInfo div { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; }
#pcInfo small { color: var(--muted); white-space: nowrap; }
#pcInfo b { text-align: right; word-break: break-word; }
#pcActs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
#pcActs button { padding: 8px 6px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.08); color: var(--text); font-size: 13px; }
#pcActs button:hover { background: rgba(255, 255, 255, 0.16); }
.stabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 12px; }
.stabs button { padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line, rgba(255, 255, 255, 0.2)); background: rgba(255, 255, 255, 0.06); color: inherit; font-size: 13.5px; }
.stabs button.on { background: var(--accent, #ffb35c); color: #2a1206; border-color: transparent; }
.slist { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 46vh; overflow-y: auto; }
.slist li { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.06); cursor: pointer; }
.slist li:hover { background: rgba(255, 255, 255, 0.12); }
.slist .dot { width: 10px; height: 10px; border-radius: 50%; background: #888; flex: none; }
.slist small { color: var(--muted); margin-left: auto; font-size: 12px; text-align: right; }
.slist button { padding: 2px 8px; }
#socialBody input { width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.08); color: var(--text); outline: none; }
#dmList { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
#dmList button { padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.06); color: var(--text); font-size: 13px; }
#dmList button.on { background: var(--accent); color: #2a1206; }
#dmLog { height: min(38vh, 300px); overflow-y: auto; display: flex; flex-direction: column; gap: 5px; padding: 8px; border-radius: 12px; background: rgba(0, 0, 0, 0.22); }
#dmLog div { max-width: 82%; align-self: flex-start; }
#dmLog div.me { align-self: flex-end; }
#dmLog span { display: inline-block; padding: 6px 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.1); font-size: 14px; word-break: break-word; }
#dmLog div.me span { background: var(--accent); color: #2a1206; }
.toast.click { cursor: pointer; pointer-events: auto; }
#queueOverlay { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; background: rgba(6, 10, 18, 0.82); backdrop-filter: blur(6px); padding: 20px; }
.queue-card { max-width: 420px; text-align: center; padding: 26px; border-radius: 20px; background: rgba(14, 20, 34, 0.95); border: 1px solid rgba(255, 255, 255, 0.16); color: #f2efe6; }
.queue-card .spinner { margin: 0 auto 12px; }
#queueText { font-size: 17px; }
#queueText b { color: #ffb35c; font-size: 24px; }

/* ================= Cửa hàng, tủ đồ, tiếp sức ================= */
.smodal { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 14px; background: rgba(6, 10, 18, 0.7); backdrop-filter: blur(5px); color: #f2efe6; }
.smodal[hidden] { display: none; }
.smodal-card { position: relative; width: min(760px, 100%); max-height: 90vh; overflow-y: auto; padding: 20px; border-radius: 20px; background: #131a29; border: 1px solid rgba(255, 255, 255, 0.14); }
.smodal-card > .close { position: absolute; right: 12px; top: 12px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.1); color: inherit; }
.smodal .muted { color: #a9b0bf; font-size: 13.5px; }
.sgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.sitem { display: flex; flex-direction: column; gap: 4px; padding: 12px; border-radius: 14px; background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.1); }
.sitem.have { border-color: #4caf7a; }
.sitem i { font-size: 30px; font-style: normal; }
.sitem p { margin: 0; font-size: 12.5px; color: #c3c9d6; flex: 1; }
.sitem small { font-size: 11.5px; color: #e6c97a; }
.sitem .tag { align-self: flex-start; padding: 3px 9px; border-radius: 10px; background: #2c6e49; font-size: 12px; }
.sitem button { margin-top: 4px; }
.sitem button:disabled { opacity: 0.45; }
.snote { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; margin: 8px 0; border-radius: 12px; background: rgba(255, 190, 90, 0.12); border: 1px solid rgba(255, 190, 90, 0.4); font-size: 13.5px; }
.snote.good { background: rgba(80, 200, 120, 0.12); border-color: rgba(80, 200, 120, 0.45); }
.snote.bad { background: rgba(255, 90, 80, 0.14); border-color: rgba(255, 90, 80, 0.5); }
.srow { margin: 12px 0; }
.srow > span { display: block; font-size: 12.5px; color: #a9b0bf; margin-bottom: 6px; }
.smodal .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.smodal .chips button { padding: 7px 12px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.2); background: rgba(255, 255, 255, 0.06); color: inherit; font-size: 13.5px; }
.smodal .chips button.on { background: #ffb35c; color: #2a1206; border-color: transparent; }
.smodal .chips button.locked { opacity: 0.55; }
.smodal .chips button.swatch::before { content: ''; display: inline-block; width: 12px; height: 12px; margin-right: 6px; border-radius: 50%; background: var(--sw); border: 1px solid rgba(255, 255, 255, 0.5); vertical-align: -1px; }
.sdonate { display: flex; flex-direction: column; gap: 10px; margin: 10px 0 16px; }
.sdonate input { padding: 10px 12px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.2); background: rgba(255, 255, 255, 0.08); color: inherit; outline: none; }
.sboard { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.sboard li { padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.06); font-size: 13.5px; }
.sboard small { float: right; color: #a9b0bf; font-size: 11.5px; }
.spay { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.spay .amount { font-size: 28px; font-weight: 700; color: #ffb35c; margin: 0; }
.spay .qr { width: min(280px, 80vw); border-radius: 14px; background: #fff; }
.spay .sdone { font-size: 54px; }
.sbank { width: min(360px, 100%); display: grid; gap: 4px; font-size: 13.5px; text-align: left; }
.sbank div { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.06); }
.sbank span { color: #a9b0bf; flex: none; width: 96px; }
.sbank b { flex: 1; word-break: break-all; }
.spay .wait { color: #ffd98a; }
.gear-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.gear-summary { flex: 1; min-width: 140px; font-size: 13px; opacity: 0.85; }

/* ================= Điện thoại: giao diện tối giản + ngăn kéo ☰ ================= */
#menuBtn, #chatBtn, #drawer { display: none; }
body.touch #menuBtn, body.touch #chatBtn { display: block; position: absolute; right: 12px; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(10px); font-size: 20px; color: var(--text); pointer-events: auto; z-index: 8; }
body.touch #menuBtn { top: 12px; }
body.touch #chatBtn { top: 64px; }
body.touch #topRight, body.touch #route, body.touch #camBtns, body.touch #hint { display: none !important; }
body.touch #info { width: auto; max-width: calc(100vw - 180px); padding: 8px 10px; }
body.touch #info .sub { font-size: 11px; }
body.touch #minimap { top: 12px !important; right: 66px !important; left: auto !important; bottom: auto !important; width: 92px !important; height: 92px !important; }
body.touch #chat { display: none; }
body.touch.chat-open #chat { display: block; top: 116px !important; left: 12px; bottom: auto; width: calc(100vw - 24px) !important; max-width: 420px; z-index: 9; }
body.touch.chat-open #chatLog { max-height: 150px; background: rgba(8, 12, 22, 0.72); border-radius: 12px; padding: 6px; }
body.touch #bottomBar { left: 50% !important; right: auto !important; bottom: 10px !important; transform: translateX(-50%) !important; flex-direction: column; align-items: center; }
body.touch #bottomBar .stamina { display: block !important; width: 150px !important; }
body.touch #toasts { top: 112px !important; bottom: auto !important; left: 50% !important; transform: translateX(-50%) !important; width: min(92vw, 420px) !important; align-items: center !important; }
body.touch #hazardChip { bottom: 96px; font-size: 12.5px; max-width: 70vw; }
body.touch #eventChip { top: auto; bottom: 150px; left: 12px; max-width: 46vw; font-size: 12px; }
body.touch #playerCard { right: 50%; transform: translate(50%, -50%); }
/* tỏ tình */
#confessModal { position: fixed; inset: 0; z-index: 75; display: grid; place-items: center; padding: 16px; background: rgba(8, 10, 20, 0.6); backdrop-filter: blur(3px); pointer-events: auto; }
#confessModal[hidden] { display: none; }
.confess-card { position: relative; width: min(400px, 100%); padding: 20px 18px 16px; border-radius: 18px; background: #1b1424; border: 1px solid rgba(255, 140, 180, 0.35); box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55); color: var(--text); }
.confess-card h3 { margin: 0 34px 6px 0; font-size: 19px; }
.confess-card .muted { margin: 0 0 12px; font-size: 13px; }
.confess-card .x { position: absolute; right: 10px; top: 10px; width: 30px; height: 30px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.1); color: var(--text); font-size: 18px; }
.confess-card textarea { width: 100%; box-sizing: border-box; resize: none; padding: 10px 12px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.16); background: rgba(255, 255, 255, 0.06); color: var(--text); font: inherit; font-size: 15px; }
.confess-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 14px; }
.confess-chips button { padding: 5px 10px; border-radius: 99px; border: 1px solid rgba(255, 140, 180, 0.35); background: rgba(255, 140, 180, 0.08); color: #ffd3e2; font-size: 12.5px; }
.confess-card .primary { width: 100%; margin: 0; background: linear-gradient(90deg, #ff6b9a, #ff9a6b); color: #2a0614; }
body.touch #drawer:not([hidden]) { display: flex; position: fixed; inset: 0; z-index: 40; align-items: flex-end; background: rgba(6, 10, 18, 0.55); pointer-events: auto; }
.drawer-card { width: 100%; max-height: 82vh; overflow-y: auto; padding: 14px 14px calc(18px + env(safe-area-inset-bottom)); border-radius: 20px 20px 0 0; background: #131a29; border-top: 1px solid rgba(255, 255, 255, 0.16); }
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 16px; }
.drawer-head button { width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.1); color: var(--text); }
.drawer-sub { margin: 14px 0 8px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
#drawerBtns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
#drawerBtns button { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 2px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.06); font-size: 22px; color: var(--text); }
#drawerBtns button::after { content: attr(data-label); font-size: 11px; color: var(--muted); }
#drawerBtns button.on::after { color: #2a1206; }
#drawerEmotes #emotes { flex-direction: row !important; flex-wrap: wrap; gap: 8px; }
#drawerEmotes #emotes button { width: 48px !important; height: 48px !important; font-size: 21px !important; }
#drawerEmotes #emotes i { display: none; }
#drawerPlayers #players { display: block !important; width: auto; max-height: 30vh; background: none; border: 0; padding: 0; backdrop-filter: none; }
@media (max-height: 500px) and (orientation: landscape) {
  body.touch #bottomBar { bottom: 6px !important; }
  body.touch #jumpBtn { bottom: 20px; }
  body.touch #runBtn { bottom: 92px; }
  body.touch #slowBtn { bottom: 20px; right: 96px; }
  body.touch #sitBtn { bottom: 92px; right: 96px; }
  body.touch.chat-open #chat { top: 64px !important; left: 200px; width: 300px !important; }
  #drawerBtns { grid-template-columns: repeat(7, 1fr); }
}

/* thanh dưới cao hơn vì có thêm nút ăn uống: đẩy gợi ý và cảnh báo lên trên */
#hint { bottom: 138px; }
#hazardChip { bottom: 178px; }
body.touch #hazardChip { bottom: 96px; }

.sgates { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 4px 0; }
.sgates a { text-decoration: none; display: inline-block; }

/* thanh nút trên: nút đồ hoạ kèm số FPS, voice khác hẳn nút âm thanh */
#qualityBtn.wide { width: auto !important; padding: 0 10px; display: inline-flex; align-items: center; gap: 5px; }
#qualityBtn b { font-size: 12px; font-variant-numeric: tabular-nums; min-width: 18px; }
#drawerBtns #qualityBtn b { position: absolute; top: 4px; right: 8px; }
#voiceBtn .vicon { position: relative; display: inline-block; }
#voiceBtn.off .vicon { opacity: 0.55; }
#voiceBtn.off .vicon::after { content: ''; position: absolute; left: -3px; right: -3px; top: 50%; height: 2.5px; background: #ff5a4f; transform: rotate(-45deg); border-radius: 2px; }
#voiceBtn.talk { background: #2fb37a !important; }
.modal-card.small { width: min(420px, 100%); }
.quit-card { text-align: center; padding-top: 22px; }
.quit-card .quit-ic { width: 54px; height: 54px; margin: 0 auto 10px; display: grid; place-items: center; border-radius: 50%; color: #ffb347; background: rgba(255, 179, 71, 0.12); box-shadow: inset 0 0 0 1px rgba(255, 179, 71, 0.35); }
.quit-card .quit-ic i { display: inline-grid; }
.quit-card h2 { margin: 0 0 6px; }
.quit-card p { margin: 0 auto; max-width: 340px; line-height: 1.5; }
.quit-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.quit-btns button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; margin: 0; padding: 0 12px; font-size: 15px; font-weight: 800; width: 100%; }
.quit-btns button i { display: inline-grid; }
.gear-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.gear-row .gear-summary { grid-column: 1 / -1; }
.gear-row button { white-space: nowrap; }

#eventChip.next { background: rgba(14, 20, 34, 0.62); border-color: rgba(255, 255, 255, 0.18); color: #cfd6e4; font-size: 12px; }
#eventChip { top: 148px; }
body.touch #eventChip.next { display: none; }

/* ================= Trang chủ: chữ tiêu đề nổi trên dãy núi, bố cục điện thoại ================= */
.intro-hero { top: 33%; }
.intro-ridge { height: 50vh; }
@media (max-width: 960px) {
  .intro-hero { top: 31%; }
  .intro-ridge { height: 52vh; }
  /* sân khấu nhân vật và thẻ chọn xếp chồng dọc, không đè lên nhau */
  #lobby .hero { display: flex; flex-direction: column; height: auto; min-height: 0; }
  #lobby .stage { flex: none; height: 42vh; min-height: 300px; max-height: 420px; }
  #lobby .wizard { flex: none; margin-top: 0; }
  .stage-caption { bottom: 6px; }
}
@media (max-width: 600px) {
  .gear-row { grid-template-columns: repeat(3, 1fr); }
  .gear-row button { padding-left: 4px; padding-right: 4px; font-size: 12.5px; }
}

/* ================= Nhiệm vụ & Bảng kỷ lục (popup dùng chung trang chủ / trong game) ================= */
.qmodal { position: fixed; inset: 0; z-index: 74; display: grid; place-items: center; padding: 16px; background: rgba(8, 10, 20, 0.62); backdrop-filter: blur(4px); pointer-events: auto; }
.qmodal[hidden] { display: none; }
.qcard { position: relative; width: min(520px, 100%); max-height: min(720px, calc(100vh - 32px)); max-height: min(720px, calc(100dvh - 32px)); display: flex; flex-direction: column; padding: 18px 16px 14px; border-radius: 18px; background: #141a2b; border: 1px solid rgba(255, 255, 255, 0.1); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55); color: #eef1f8; outline: none; animation: stepIn 0.22s ease; }
.qx { position: absolute; right: 12px; top: 12px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.08); color: #fff; font-size: 20px; line-height: 1; cursor: pointer; }
.qx:hover { background: rgba(255, 255, 255, 0.16); }
.qhead h3 { margin: 0 40px 4px 0; font-size: 20px; }
.qhead p { margin: 0 0 10px; font-size: 13px; color: #9aa3b5; }
.qtabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.qtabs button { padding: 6px 12px; border-radius: 99px; border: 1px solid rgba(255, 255, 255, 0.12); background: rgba(255, 255, 255, 0.04); color: #c9d0de; font-size: 13px; font-weight: 600; cursor: pointer; }
.qtabs button.on { background: #ffb35c; border-color: #ffb35c; color: #2a1206; }
.qbody { overflow-y: auto; overscroll-behavior: contain; margin: 0 -6px; padding: 0 6px 2px; }
.qgroup { margin-top: 10px; }
.qgroup h4 { display: flex; justify-content: space-between; align-items: baseline; margin: 0 0 4px; font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; color: #7fe0c8; }
.qgroup h4 b { color: #9aa3b5; font-weight: 600; }
.qnote { margin: 0 0 6px; font-size: 12px; color: #8a93a6; }
.qrow { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.04); margin-bottom: 4px; }
.qrow.next { background: rgba(255, 179, 92, 0.12); box-shadow: inset 0 0 0 1px rgba(255, 179, 92, 0.45); }
.qrow.done { opacity: 0.6; }
.qcheck { flex: none; width: 20px; height: 20px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.3); display: grid; place-items: center; font-style: normal; font-size: 12px; font-weight: 900; color: #0d1b12; }
.qrow.done .qcheck { background: #7fe0a8; border-color: #7fe0a8; }
.qtext { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.qtext b { font-size: 14px; font-weight: 600; }
.qtext small { font-size: 12px; color: #9aa3b5; }
.qbar { display: block; height: 4px; border-radius: 99px; background: rgba(255, 255, 255, 0.12); overflow: hidden; margin-top: 3px; }
.qbar i { display: block; height: 100%; background: linear-gradient(90deg, #ffb35c, #ff8a5c); }
.qprog { flex: none; font-style: normal; font-size: 12px; color: #c9d0de; font-variant-numeric: tabular-nums; }
.qempty { text-align: center; color: #9aa3b5; padding: 24px 0; }
/* bảng kỷ lục */
.rcard { position: relative; width: min(560px, 100%); max-height: min(760px, calc(100vh - 32px)); max-height: min(760px, calc(100dvh - 32px)); display: flex; flex-direction: column; padding: 20px 18px 0; background: linear-gradient(180deg, #1a2034 0%, #0f1424 100%); color: #eef1f8; outline: none; clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 22px 100%, 0 calc(100% - 22px)); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55); animation: stepIn 0.22s ease; }
.rcard::before { content: ''; position: absolute; left: 0; top: 0; width: 90px; height: 3px; background: #ffb347; }
.rcard::after { content: ''; position: absolute; right: 0; bottom: 0; width: 90px; height: 3px; background: #5fe3d0; }
.rhead { display: flex; align-items: center; gap: 12px; margin: 0 40px 14px 0; }
.rtrophy { flex: none; width: 48px; height: 48px; display: grid; place-items: center; font-size: 26px; border-radius: 14px; background: radial-gradient(circle at 50% 35%, rgba(255, 210, 120, 0.35), rgba(255, 179, 71, 0.08)); box-shadow: inset 0 0 0 1px rgba(255, 179, 71, 0.4); }
.rhead h3 { margin: 0; font-size: 22px; font-weight: 900; font-style: italic; letter-spacing: 0.02em; text-transform: uppercase; background: linear-gradient(180deg, #fff3d6, #ffb347); -webkit-background-clip: text; background-clip: text; color: transparent; }
.rhead p { margin: 2px 0 0; font-size: 12.5px; color: #8f98ad; }
.rcats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rcat { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 12px; background: rgba(255, 255, 255, 0.03); color: #c9d0de; text-align: left; cursor: pointer; transition: background 0.15s, border-color 0.15s; }
.rcat:hover { background: rgba(255, 255, 255, 0.06); }
.rcat i { font-style: normal; font-size: 20px; }
.rcat b { font-size: 13.5px; color: #eef1f8; }
.rcat small { font-size: 11px; color: #8f98ad; }
.rcat.on { border-color: #ffb347; background: linear-gradient(180deg, rgba(255, 179, 71, 0.18), rgba(255, 179, 71, 0.04)); box-shadow: inset 0 -3px 0 #ffb347; }
.rmaps { display: flex; gap: 6px; margin-top: 10px; overflow-x: auto; scrollbar-width: none; }
.rmaps button { flex: none; padding: 5px 12px; border-radius: 99px; border: 1px solid rgba(255, 255, 255, 0.1); background: none; color: #aab2c4; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.rmaps button.on { background: #5fe3d0; border-color: #5fe3d0; color: #062420; }
.rbody { overflow-y: auto; overscroll-behavior: contain; margin: 12px -6px 0; padding: 0 6px 10px; min-height: 0; }
.rempty { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 30px 0 22px; color: #8f98ad; text-align: center; }
.rempty i { font-style: normal; font-size: 34px; opacity: 0.75; }
.rempty b { color: #dfe4ef; font-size: 15px; }
/* bục vinh danh */
.rpodium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; align-items: end; gap: 8px; padding: 6px 4px 0; }
.rpod { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; text-align: center; }
.rpod .rmedal { font-size: 22px; line-height: 1; }
.rpod.p1 .rmedal { font-size: 28px; filter: drop-shadow(0 0 8px rgba(255, 200, 80, 0.6)); }
.rav { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: 18px; color: #fff; background: hsl(var(--h, 200) 55% 42%); box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.12); flex: none; }
.rpod.p1 .rav { width: 56px; height: 56px; font-size: 22px; box-shadow: 0 0 0 3px #ffd36b, 0 0 22px rgba(255, 200, 80, 0.45); }
.rpod.p2 .rav { box-shadow: 0 0 0 3px #cfd6e2; }
.rpod.p3 .rav { box-shadow: 0 0 0 3px #d9925a; }
.rpod.me .rav { outline: 2px solid #5fe3d0; outline-offset: 3px; }
.rpn { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.rpv { font-style: normal; font-size: 12.5px; font-weight: 700; color: #ffd08a; font-variant-numeric: tabular-nums; }
.rstep { width: 100%; margin-top: 4px; display: grid; place-items: center; font-size: 22px; font-weight: 900; font-style: italic; color: rgba(255, 255, 255, 0.55); border-radius: 10px 10px 0 0; background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.02)); }
.rpod.p1 .rstep { height: 74px; background: linear-gradient(180deg, rgba(255, 200, 80, 0.35), rgba(255, 179, 71, 0.05)); color: #ffe2a3; }
.rpod.p2 .rstep { height: 54px; }
.rpod.p3 .rstep { height: 40px; }
.rpod.empty .rstep { opacity: 0.35; }
/* các hạng sau */
.rrows { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.rrows li { position: relative; display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.035); overflow: hidden; }
.rrows li::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: var(--w, 0); background: linear-gradient(90deg, rgba(95, 227, 208, 0.12), rgba(95, 227, 208, 0.02)); pointer-events: none; }
.rrows li.me { box-shadow: inset 0 0 0 1px #5fe3d0; }
.rrank { flex: none; width: 22px; font-style: normal; font-weight: 800; color: #8f98ad; text-align: center; font-variant-numeric: tabular-nums; position: relative; }
.rav.sm { width: 28px; height: 28px; font-size: 13px; box-shadow: none; position: relative; }
.rname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 14px; position: relative; }
.rval { flex: none; font-variant-numeric: tabular-nums; color: #ffd08a; font-size: 13.5px; position: relative; }
.rnote { margin: 12px 2px 0; font-size: 11.5px; color: #6f788c; text-align: center; }
/* thành tích của mình */
.rme { display: flex; align-items: center; gap: 10px; margin: 0 -18px; padding: 12px 18px 16px; background: linear-gradient(90deg, rgba(95, 227, 208, 0.16), rgba(95, 227, 208, 0.04)); border-top: 1px solid rgba(95, 227, 208, 0.3); }
.rme .rmrank { flex: none; min-width: 42px; padding: 4px 8px; border-radius: 8px; text-align: center; font-weight: 900; font-style: italic; font-size: 16px; background: #5fe3d0; color: #062420; }
.rme .rmlabel { flex: 1; font-size: 13px; color: #c9d0de; }
.rme b { font-size: 15px; color: #5fe3d0; font-variant-numeric: tabular-nums; }
.rme.guest { justify-content: center; }
@media (max-width: 480px) {
  .rcat { padding: 8px; }
  .rcat small { display: none; }
  .rcat b { font-size: 12.5px; }
  .rhead h3 { font-size: 19px; }
}

/* nút Nhiệm vụ: nhấp nháy sáng + mũi tên chỉ vào khi có việc mới */
@keyframes questGlow { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 179, 71, 0.75), 0 0 10px rgba(255, 179, 71, 0.4); } 50% { box-shadow: 0 0 0 8px rgba(255, 179, 71, 0), 0 0 18px rgba(255, 179, 71, 0.8); } }
@keyframes questBob { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, 5px); } }
#questBtn.attn, #menuBtn.attn { background: #ffb347 !important; color: #2a1206; animation: questGlow 1.2s ease-in-out infinite; }
#questBtn .qarrow { display: none; }
#topBtns #questBtn.attn .qarrow { display: block; position: absolute; left: 50%; top: calc(100% + 8px); padding: 3px 8px 3px; border-radius: 99px; background: #ffb347; color: #2a1206; font-size: 11px; font-weight: 800; font-style: normal; white-space: nowrap; pointer-events: none; animation: questBob 0.9s ease-in-out infinite; z-index: 3; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35); }
#topBtns #questBtn.attn .qarrow::before { content: ''; position: absolute; left: 50%; top: -5px; margin-left: -5px; border: 5px solid transparent; border-top: 0; border-bottom-color: #ffb347; }
#menuBtn.attn::after { content: ''; position: absolute; right: -2px; top: -2px; width: 10px; height: 10px; border-radius: 50%; background: #e8443a; box-shadow: 0 0 0 2px #fff; }
/* trang chủ: nút Nhiệm vụ có nhãn MỚI cho tới khi mở lần đầu */
.gm-btn .gm-new { display: none; margin-left: auto; padding: 2px 7px; border-radius: 6px; background: #e8443a; color: #fff; font-size: 10.5px; font-weight: 900; font-style: normal; letter-spacing: 0.06em; }
.gm-btn.attn .gm-new { display: inline-block; animation: questPulse 1.1s ease-in-out infinite; }
.gm-btn.attn { box-shadow: inset 3px 0 0 #ffb347; }
@keyframes questPulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.6; transform: scale(0.92); } }

/* ô thông tin: dòng sự kiện nằm trong ô (bấm mở lịch), không còn là ô riêng */
#info #eventChip { position: static; display: block; margin-top: 3px; padding: 0; background: none; border: 0; border-radius: 0; width: auto; max-width: 100%;
  font-size: 12.5px; color: #ffc89a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: auto; cursor: pointer; }
#info #eventChip[hidden] { display: none; }
#info #eventChip.next { color: var(--muted); }
body.touch #info #eventChip { width: auto; max-width: 100%; }
/* hàng động tác + ăn / uống */
.act-row { display: flex; align-items: center; gap: 10px; }
.act-row #vitals { margin-top: 0; }
.act-row #vitals button { height: 46px; padding: 0 12px 6px; }
body.touch .act-row #vitals button { height: 40px; }
/* nút đồ hoạ: số FPS to ở giữa, nhãn "FPS" (data-label) bên dưới – không lặp chữ */
#drawerBtns #qualityBtn b, #topBtns #qualityBtn b { position: static !important; font-size: 19px !important; font-weight: 800; line-height: 1.15; color: var(--text) !important; font-variant-numeric: tabular-nums; }

/* tự kết nối lại khi rớt mạng */
#reconnectBar { position: absolute; left: 50%; top: 70px; transform: translateX(-50%); z-index: 30; display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; border-radius: 14px; background: rgba(20, 24, 34, 0.88); border: 1px solid rgba(255, 200, 120, 0.45); color: #ffe2b8;
  font-size: 14px; font-weight: 600; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35); pointer-events: auto; max-width: calc(100vw - 24px); }
#reconnectBar[hidden] { display: none; }
#reconnectBar span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#reconnectBar button { flex: none; border: 0; border-radius: 10px; padding: 6px 12px; background: var(--accent); color: #2a1206; font-weight: 700; }
body.touch #reconnectBar { top: 120px; font-size: 13px; }

/* thẻ mời khách đăng nhập khi lên đỉnh */
.guest-card { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 40; width: min(380px, calc(100vw - 32px)); box-sizing: border-box;
  padding: 18px 18px 16px; border-radius: 18px; background: rgba(16, 20, 30, 0.94); border: 1px solid rgba(255, 200, 120, 0.4); color: #f4efe4;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45); pointer-events: auto; text-align: center; animation: guestIn 0.35s ease-out; }
.guest-card b { display: block; font-size: 18px; margin: 4px 22px 8px; }
.guest-card p { margin: 0 0 14px; font-size: 14px; line-height: 1.5; color: #cfd4de; }
.guest-card .row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.guest-card .x { position: absolute; right: 10px; top: 10px; width: 28px; height: 28px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.1); color: inherit; }
@keyframes guestIn { from { opacity: 0; transform: translate(-50%, -44%); } to { opacity: 1; transform: translate(-50%, -50%); } }

/* máy tính: menu ☰ thả xuống ở góc phải trên (dùng chung ngăn kéo của điện thoại) */
#moreBtn { font-size: 18px; }
body.touch #moreBtn, #drawerBtns #moreBtn { display: none; }
body:not(.touch) #drawer:not([hidden]) { display: flex; position: fixed; inset: 0; z-index: 40; justify-content: flex-end; align-items: flex-start; pointer-events: auto; background: transparent; }
body:not(.touch) #drawer .drawer-card { width: 360px; max-height: calc(100vh - 90px); margin: 66px 16px 0 0; padding: 12px 12px 14px; border-radius: 16px; border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(19, 26, 41, 0.96); box-shadow: 0 18px 44px rgba(0, 0, 0, 0.45); }
body:not(.touch) #drawer .drawer-sub, body:not(.touch) #drawerEmotes, body:not(.touch) #drawerPlayers { display: none; }
body:not(.touch) #drawerBtns { grid-template-columns: repeat(4, 1fr); }

/* mũi tên "Nhiệm vụ" dưới nút 🎯 không bị ô "Đang leo cùng" che: hàng nút nằm lớp trên, ô danh sách lùi xuống khi mũi tên hiện */
#topRight .btns { position: relative; z-index: 4; }
#topRight:has(#questBtn.attn) #players { margin-top: 24px; }
/* máy tính: khi ngắm cảnh chỉ giữ lại đúng nút 🏞️ ở góc trên (mờ) để bấm tắt – cùng chỗ với lúc bật */
body.zen:not(.touch) #hud > #topRight:not(#zenExit) { display: flex !important; }
body.zen:not(.touch) #topRight > :not(.btns) { display: none !important; }
body.zen:not(.touch) #topBtns > :not(#zenBtn) { display: none !important; }
body.zen:not(.touch) #zenBtn { opacity: 0.55; transition: opacity 0.3s ease; }
body.zen:not(.touch) #zenBtn:hover, body.zen.zen-peek:not(.touch) #zenBtn { opacity: 1; }
body.zen:not(.touch) #zenExit { display: none; }
/* nút bay dù lượn: hiện khi đứng trên đỉnh và còn lượt bay */
#glideBtn {
  position: absolute; left: 50%; bottom: 205px; transform: translateX(-50%); z-index: 4; pointer-events: auto;
  display: flex; align-items: center; gap: 10px; padding: 12px 22px; border: 0; cursor: pointer;
  font: 800 15px/1 "Be Vietnam Pro", sans-serif; letter-spacing: 0.08em; text-transform: uppercase; color: #1d0f02;
  background: linear-gradient(95deg, #ffb347, #ff7a3d); box-shadow: 0 10px 30px rgba(255, 122, 61, 0.35);
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
  animation: glidePulse 1.8s ease-in-out infinite;
}
#glideBtn[hidden] { display: none; }
#glideBtn i { font-style: normal; font-size: 22px; }
#glideBtn:hover { filter: brightness(1.08); }
@keyframes glidePulse { 0%, 100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(-4px); } }
/* điện thoại: nút tròn nhỏ ở cột phải (dưới 💬 và 📜), không che giữa màn hình, nằm dưới thẻ / popup */
body.touch #glideBtn {
  left: auto; right: 10px; top: 168px; bottom: auto; transform: none; z-index: 4;
  width: 48px; height: 48px; padding: 0; justify-content: center; gap: 0;
  clip-path: none; border-radius: 50%; animation: glideRing 1.8s ease-in-out infinite;
}
body.touch #glideBtn span { display: none; }
body.touch #glideBtn i { font-size: 24px; }
@keyframes glideRing { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 179, 71, 0.6); } 50% { box-shadow: 0 0 0 8px rgba(255, 179, 71, 0); } }
body.zen #glideBtn { display: none !important; }
/* nút ↩️ Về điểm mốc trên điện thoại: viên nhỏ sát mép phải (dưới nút 💬), không che giữa màn hình */
body.touch #returnBtn {
  left: auto; right: 10px; top: 168px; bottom: auto; transform: none; z-index: 5; animation: none;
  padding: 7px 12px; font-size: 13px; border-width: 1.5px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
/* nút "không gấp" (sổ lưu bút, lấy nước): tròn nhỏ dưới nút 💬, không che giữa màn hình */
body.touch #talkBtn.mini {
  left: auto; right: 12px; top: 116px; bottom: auto; transform: none;
  width: 44px; height: 44px; padding: 0; border-radius: 50%; font-size: 20px; line-height: 44px; text-align: center;
  background: rgba(255, 179, 71, 0.9); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* đang bay: nút đổi thành ✂️ Cắt dù (đỏ) */
#glideBtn.cut { background: linear-gradient(95deg, #e8443a, #b8242a); color: #fff; animation: none; }
body.touch #glideBtn.cut { animation: none; }
/* đang bay dù / rơi tự do: ẩn các nút đi bộ (ngồi, chạy, nhảy, đi chậm) và nút sổ lưu bút cho thoáng cảnh */
body.gliding #sitBtn, body.gliding #runBtn, body.gliding #jumpBtn, body.gliding #slowBtn, body.gliding #talkBtn { display: none !important; }
/* đang bay dù / rơi tự do: ẩn nút ăn, uống */
body.gliding #vitals { display: none !important; }
/* máy tính: nút Bay dù / Cắt dù gọn ở góc phải, phía trên bản đồ nhỏ, chỉ có chữ (không emoji) */
body:not(.touch) #glideBtn {
  left: auto; right: 16px; bottom: 232px; transform: none; padding: 10px 18px; font-size: 13.5px;
  animation: none; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
body:not(.touch) #glideBtn i { display: none; }
/* thẻ check-in đang mở (cùng góc phải) thì tạm ẩn nút bay dù cho khỏi đè */
#hud:has(#checkinCard:not([hidden])) #glideBtn { display: none; }
/* huy hiệu "Người đến nơi xa nhất" cạnh tên */
.nametag .label .badge-far { margin-left: 3px; font-size: 12px; filter: drop-shadow(0 0 3px rgba(201, 182, 255, 0.9)); }
.nametag .label .badge-far img { width: 15px; height: 15px; vertical-align: -3px; }

/* ---------- Chế độ cốt truyện ---------- */
/* khung nhiệm vụ truyện: gọn – dòng nhỏ "Chương 2 · 6/8" + khoảng cách, dưới là việc cần làm
   (top do story.js đặt ngay dưới ô thông tin góc trái) */
#storyBar {
  position: absolute; left: 16px; top: 140px; width: auto; max-width: 280px; display: flex; flex-direction: column; gap: 2px;
  padding: 8px 12px; text-align: left; border: 0; border-left: 3px solid #35e0c8; border-radius: 10px;
  background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); color: var(--text);
}
#storyBar[hidden] { display: none; }
#storyBar .sb-top { display: flex; align-items: baseline; gap: 10px; }
#storyBar small { flex: 1; font-size: 11px; font-weight: 700; color: #8fe9dc; white-space: nowrap; }
#storyBar em { font-style: normal; font-size: 11px; font-weight: 700; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
#storyBar em:empty { display: none; }
#storyBar b { font-size: 13.5px; line-height: 1.3; font-weight: 600; }
#storyBar.pop { animation: storyPop 0.8s ease-out; }
#storyBar.done { border-left-color: var(--accent); }
@keyframes storyPop { 0% { box-shadow: 0 0 0 0 rgba(53, 224, 200, 0.6); } 100% { box-shadow: 0 0 0 12px rgba(53, 224, 200, 0); } }
@media (max-width: 600px) { #storyBar { max-width: calc(100vw - 84px); padding: 7px 10px; } #storyBar b { font-size: 12.5px; } }

/* điểm tín hiệu 📶 trong cảnh: biểu tượng sóng + tên chỗ cần đến và khoảng cách (giữ nguyên cỡ dù ở xa) */
.story-pin { display: flex; flex-direction: column; align-items: center; gap: 3px; transform: translateY(-50%); pointer-events: none; }
.story-pin .sp-ic {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(6, 34, 38, 0.82); border: 2px solid #35e0c8; box-shadow: 0 0 14px rgba(53, 224, 200, 0.7);
  animation: pinBob 2s ease-in-out infinite;
}
.story-pin .sp-ic svg { width: 18px; height: 18px; fill: #35e0c8; }
.story-pin .sp-lb { padding: 2px 9px; border-radius: 999px; background: rgba(6, 34, 38, 0.78); color: #d9fff8; font-size: 12px; font-weight: 700; white-space: nowrap; }
.story-pin .sp-lb:empty { display: none; }
@keyframes pinBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

/* điện thoại: khung chat nhóm Đội Săn Mây */
.phone-card { width: min(400px, 100%); height: min(640px, 86vh); max-height: none; display: flex; flex-direction: column; padding: 18px 16px 14px; overflow: hidden; }
.ph-head { display: flex; flex-direction: column; gap: 2px; padding-right: 40px; }
.ph-head b { font-size: 17px; }
.ph-head small { color: var(--muted); font-size: 12px; }
.ph-goal { margin: 12px 0 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; background: rgba(53, 224, 200, 0.1); border-left: 3px solid #35e0c8; }
.ph-goal small { font-size: 11px; color: #8fe9dc; }
.ph-goal b { font-size: 14px; }
.ph-goal span { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.ph-msgs { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px 2px 6px; }
.pm { display: flex; flex-direction: column; align-items: flex-start; max-width: 86%; }
.pm.sys { align-self: center; max-width: 92%; text-align: center; font-size: 12px; color: var(--muted); padding: 4px 10px; border-radius: 99px; background: rgba(255, 255, 255, 0.06); }
.pm-who { font-style: normal; font-size: 11.5px; font-weight: 700; margin: 0 0 3px 4px; color: #9fb4d9; }
.pm-b { padding: 8px 12px; border-radius: 4px 14px 14px 14px; background: rgba(255, 255, 255, 0.1); font-size: 13.5px; line-height: 1.45; }
.pm-b small { display: block; font-size: 11px; color: #8fe9dc; margin-bottom: 3px; }
.pm.fwd .pm-b { background: rgba(53, 224, 200, 0.1); border: 1px dashed rgba(53, 224, 200, 0.4); font-style: italic; }
.pm.draft .pm-b { background: rgba(255, 143, 179, 0.12); border: 1px dashed rgba(255, 143, 179, 0.55); }
.pm.draft .pm-b small { color: #ffb3cb; }
.pm-clip { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding: 9px 14px 9px 10px; border: 0; border-radius: 4px 14px 14px 14px; background: linear-gradient(95deg, rgba(255, 143, 179, 0.25), rgba(53, 224, 200, 0.18)); text-align: left; }
.pm-clip i { grid-row: span 2; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #fff; color: #10141f; font-style: normal; font-size: 13px; }
.pm-clip span { font-weight: 700; font-size: 13.5px; }
.pm-clip small { font-size: 11px; color: var(--muted); }
.pm-clip:hover { filter: brightness(1.15); }

/* màn kết chương */
.story-end { text-align: center; }
.story-end .se-kicker { font-size: 12px; color: #8fe9dc; letter-spacing: 0.04em; margin-bottom: 6px; }
.story-end h2 { font-size: 20px; }
.story-end p { font-size: 14px; line-height: 1.5; }
.se-reward { margin: 14px auto; padding: 12px 16px; display: flex; flex-direction: column; align-items: center; gap: 2px; background: rgba(255, 179, 92, 0.1); border: 1px solid rgba(255, 179, 92, 0.35); }
.se-reward i { font-style: normal; font-size: 34px; }
.se-reward small { color: var(--muted); font-size: 11.5px; }
.se-btns { display: flex; gap: 10px; justify-content: center; margin-top: 12px; }

/* clip cốt truyện: khung điện ảnh, chữ thoại, bình luận chạy, chữ MẤT SÓNG */
#cinema { position: fixed; inset: 0; z-index: 30; pointer-events: none; }
#cinema[hidden] { display: none; }
body.cinema #hud, body.cinema #labels { visibility: hidden; }
.cin-bar { position: absolute; left: 0; right: 0; height: 9vh; background: #000; }
.cin-bar.top { top: 0; } .cin-bar.bot { bottom: 0; }
.cin-tag { position: absolute; left: 20px; top: calc(9vh + 14px); display: flex; align-items: center; gap: 8px; font-size: 13px; color: #fff; text-shadow: 0 1px 4px #000; }
.cin-tag b { padding: 3px 8px; border-radius: 4px; font-size: 12px; letter-spacing: 0.04em; }
.cin-tag b.live { background: #e8243a; }
.cin-tag b.rec { background: rgba(0, 0, 0, 0.55); color: #ff5b5b; }
.cin-tag em { font-style: normal; font-weight: 700; }
.cin-cmts { position: absolute; right: 20px; bottom: calc(9vh + 70px); width: min(280px, 46vw); display: flex; flex-direction: column; gap: 5px; }
.cin-cmts .cc { padding: 5px 10px; border-radius: 10px; background: rgba(0, 0, 0, 0.42); font-size: 12.5px; color: #fff; animation: ccIn 0.3s ease-out; }
.cin-cmts .cc b { color: #8fe9dc; font-weight: 700; }
@keyframes ccIn { from { opacity: 0; transform: translateY(8px); } }
.cin-sub { position: absolute; left: 50%; bottom: calc(9vh + 18px); transform: translateX(-50%); width: min(760px, calc(100vw - 32px)); text-align: center; font-size: 18px; line-height: 1.45; color: #fff; text-shadow: 0 2px 6px #000, 0 0 2px #000; }
.cin-sub b { color: #ffb3cb; margin-right: 8px; }
.cin-sub:empty { display: none; }
.cin-cut { position: absolute; inset: 0; display: none; place-items: center; font-size: clamp(40px, 9vw, 96px); font-weight: 900; letter-spacing: 0.08em; color: #fff; }
#cinema.cut .cin-cut { display: grid; background: #05070b; animation: cutFlick 1.2s steps(10) both; }
#cinema.cut .cin-tag b.live { background: #444; }
@keyframes cutFlick { 0% { opacity: 0; } 10% { opacity: 1; text-shadow: 6px 0 #e8243a, -6px 0 #35e0c8; } 30% { text-shadow: -3px 0 #e8243a, 3px 0 #35e0c8; } 50% { opacity: 0.6; } 60%, 100% { opacity: 1; text-shadow: none; } }
.cin-skip { position: absolute; right: 18px; top: calc(9vh + 12px); pointer-events: auto; padding: 7px 14px; border: 1px solid rgba(255, 255, 255, 0.4); border-radius: 99px; background: rgba(0, 0, 0, 0.45); color: #fff; font-size: 13px; }
@media (max-width: 600px) { .cin-sub { font-size: 15px; } .cin-cmts { display: none; } .cin-tag { font-size: 11.5px; left: 12px; } }

/* sảnh: thẻ cốt truyện ở đầu danh sách núi */
.story-card { grid-column: 1 / -1; }
.story-card { border-left: 4px solid #35e0c8 !important; background: linear-gradient(90deg, rgba(53, 224, 200, 0.16), rgba(53, 224, 200, 0.03)) !important; cursor: default; }
.story-card:hover { transform: none; }
.gx.maps-mode .map-card.story-card { flex-direction: row; }
.gx.maps-mode .map-card.story-card .cover { width: min(300px, 34%); aspect-ratio: auto; min-height: 150px; }
.story-card .cover b { background: rgba(6, 34, 38, 0.8); color: #8fe9dc; }
.story-card .sc-kicker { font-size: 11px; font-weight: 800; letter-spacing: 0.08em; color: #35e0c8; }
.story-card .sc-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.story-card .sc-tag { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; font-size: 11px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: #bff6ec; background: rgba(53, 224, 200, 0.12); border: 1px solid rgba(53, 224, 200, 0.35); }
.story-card .sc-tag.season { color: #062420; background: #35e0c8; border-color: #35e0c8; }
.story-card .sc-tag.clip { color: #ffd08a; background: rgba(255, 179, 71, 0.1); border-color: rgba(255, 179, 71, 0.35); }
.story-card .sc-title { margin: 2px 0 6px; font-size: clamp(30px, 3.6vw, 44px); line-height: 1.05; font-weight: 900; font-style: italic; letter-spacing: 0.01em; text-transform: uppercase; background: linear-gradient(180deg, #ffffff 0%, #c9fff4 55%, #35e0c8 100%); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 3px 10px rgba(0, 0, 0, 0.45)); }
.story-card .sc-desc { margin: 0 0 10px; padding: 2px 0 2px 12px; border-left: 3px solid #ffb347; font-size: 15px; line-height: 1.55; color: #f3efe6; max-width: 760px; }
.story-card .mc-foot { margin-top: 4px; }
.story-card .sc-go { background: linear-gradient(90deg, #5ff0d8, #2fb8c9); color: #04211f; box-shadow: 0 4px 14px rgba(53, 224, 200, 0.35); }
.story-card .sc-again { font-size: 12.5px; color: var(--muted); cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
.story-card .sc-again:hover { color: #fff; }
@media (max-width: 760px) { .gx.maps-mode .map-card.story-card { flex-direction: column; } .gx.maps-mode .map-card.story-card .cover { width: 100%; min-height: 0; aspect-ratio: 16 / 6; } }
/* điện thoại: nút 📷 chụp ảnh ngay trên màn hình, ở cột nút bên phải (không phải mở ☰) */
#shotBtn { display: none; }
body.touch #shotBtn {
  display: block; position: absolute; right: 12px; top: 222px; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(10px); font-size: 20px; color: var(--text); pointer-events: auto; z-index: 8;
}
body.touch #shotBtn:active { background: var(--accent); }
/* sảnh: danh sách 4 chương của mùa */
.story-card .sc-chs { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.story-card .sc-ch { display: flex; align-items: center; gap: 10px; padding: 7px 10px; background: rgba(255, 255, 255, 0.05); border-left: 3px solid rgba(53, 224, 200, 0.6); }
.story-card .sc-ch.done { border-left-color: var(--ok); }
.story-card .sc-ch.locked { opacity: 0.55; border-left-color: rgba(255, 255, 255, 0.2); }
.story-card .sc-chi { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.story-card .sc-chi b { font-size: 14px; }
.story-card .sc-chi small { font-size: 12px; color: var(--muted); }
.story-card .sc-ch .mc-go { padding: 6px 14px; font-size: 13px; }
.story-card .sc-go.login { background: rgba(255, 255, 255, 0.12); color: #fff; box-shadow: none; }
.story-card .sc-lock { font-size: 16px; padding: 0 8px; }
/* màn kết chương: danh sách phần thưởng */
.se-reward .se-r { display: flex; align-items: center; gap: 8px; }
.se-reward .se-r i { font-size: 26px; }
.se-reward small + small { margin-top: 2px; }
.se-btns { flex-wrap: wrap; }
/* điện thoại: dòng clip thất lạc, tin nhắn thoại, clip thất lạc */
.ph-goal em { font-style: normal; font-size: 11.5px; color: #ffb3cb; margin-top: 3px; }
.pm.voice .pm-b { background: rgba(255, 179, 92, 0.12); border: 1px dashed rgba(255, 179, 92, 0.5); }
.pm.voice .pm-b small { color: #ffc98a; }
.pm-clip.lost { background: linear-gradient(95deg, rgba(255, 93, 143, 0.32), rgba(255, 179, 92, 0.18)); }
/* clip cảnh đêm: tối và lạnh màu như quay bằng điện thoại lúc 2 giờ sáng */
body.cin-night #game { filter: brightness(0.32) saturate(0.45) contrast(1.15); }
body.cin-night #cinema::before { content: ''; position: absolute; inset: 0; background: rgba(20, 40, 90, 0.28); mix-blend-mode: multiply; }
/* điện thoại: thông báo không che cột nút bên phải (☰ 💬 📷…) */
body.touch #hud #toasts { left: 12px !important; transform: none !important; width: calc(100vw - 80px) !important; max-width: 420px; align-items: flex-start !important; }
/* danh hiệu "Đội Săn Mây" cạnh tên (hoàn thành Mùa 1 cốt truyện) */
.nametag .label .tag-team { margin-left: 4px; padding: 0 6px; border-radius: 99px; background: linear-gradient(90deg, #1f7a78, #2fb8c9); color: #fff; font-size: 10px; font-weight: 800; letter-spacing: 0.02em; }
/* màn kết chương: trạng thái nhận phần thưởng từ máy chủ */
.se-reward .se-claim { margin-top: 4px; font-weight: 700; color: var(--muted); }
.se-reward .se-claim.ok { color: var(--ok); }
.se-reward .se-claim.wait { color: #ffc98a; }
.se-reward .se-claim.bad { color: #ff9c9c; }

/* chọn cách chơi ở màn chọn núi: hai tab Theo cốt truyện / Leo tự do */
.mode-switch { margin-bottom: 14px; }
.mode-tabs { display: flex; gap: 4px; border-bottom: 1px solid rgba(255, 255, 255, 0.12); }
.mode-tab { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px 12px; border: 0; background: none; color: #9aa3b5; font-size: 15px; font-weight: 800; letter-spacing: 0.02em; cursor: pointer; transition: color 0.15s; }
.mode-tab:hover { color: #e6e9f2; }
.mode-tab svg { width: 19px; height: 19px; }
.mode-tab::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: transparent; transition: background 0.15s; }
.mode-tab.on { color: #ffb347; }
.mode-tab.on::after { background: #ffb347; }
.mode-note { display: flex; align-items: flex-start; gap: 6px; margin: 10px 2px 0; font-size: 12.5px; line-height: 1.45; color: #9fb4c8; }
.mode-note svg { flex: none; width: 15px; height: 15px; margin-top: 2px; color: #7fe0c8; }
#mapList.story-only { grid-template-columns: 1fr; }
@media (max-width: 600px) {
  .mode-tab { flex: 1; justify-content: center; padding: 10px 6px 12px; font-size: 14px; }
}

/* icon Lucide trong cửa hàng / tủ đồ / tiếp sức / lịch sử (thay cho emoji) */
.ilbl { display: inline-flex; align-items: center; gap: 6px; }
.ilbl svg { flex: none; }
.ilbl.h3 { display: flex; margin: 0 0 8px; font-size: 18px; font-weight: 800; }
.ilbl.shead { display: flex; margin: 4px 0 10px; font-size: 12px; font-weight: 800; letter-spacing: 0.2em; text-transform: uppercase; color: #5fe3d0; }
.ilbl.shead ~ .ilbl.shead { margin-top: 20px; }
.ilbl.small { font-size: 12px; }
.stabs button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.stabs button i, .smodal-card .close i { display: inline-flex; }
.smodal-card .close { display: grid; place-items: center; }
.sitem .tag.lock { display: inline-grid; place-items: center; }
.dopt i { display: grid; place-items: center; height: 30px; color: #ffb347; }
.pcheck { display: grid; place-items: center; }
.sitem .sact .ghost, .dgo { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
svg.tier1 { color: #5fd38a; } svg.tier2 { color: #ffc93c; } svg.tier3 { color: #6fdcff; }
.sboard b { display: inline-flex; align-items: center; gap: 4px; }
.pwhat > i.thumb { width: 56px; height: 56px; border-radius: 12px; overflow: hidden; }
.pwhat > i.thumb img { width: 100%; height: 100%; object-fit: cover; }

/* icon trong màn chọn núi */
.map-card .mc-go.ilbl, .map-card .sc-go.ilbl, .map-card .sc-again.ilbl { gap: 6px; }
.map-card .mc-go svg.ic-play, .map-card .sc-go svg.ic-play { fill: currentColor; }
.map-card .tick { display: none; place-items: center; }
.map-card.on .tick { display: grid; }
.map-card .sc-lock { display: inline-grid; place-items: center; color: #9aa3b5; }
.map-card .prog .ilbl, .map-card .meta .ilbl { gap: 4px; }
.map-card .soon-tag.ilbl { gap: 5px; }
.map-card .mn .done.ilbl { gap: 4px; }

/* tab cốt truyện không có dòng ghi chú cuối màn */
#startNote:empty { display: none; }

/* ghi chú cách chơi (icon info) ở cuối màn chọn núi */
#startNote { display: flex; align-items: flex-start; justify-content: flex-end; gap: 6px; color: #9fb4c8; }
#startNote svg { flex: none; width: 15px; height: 15px; margin-top: 2px; color: #7fe0c8; }
@media (max-width: 760px) { #startNote { justify-content: center; text-align: left; } }

/* icon Lucide trên thanh nút trong game */
#topBtns button > i[data-icon], #drawerBtns button > i[data-icon], #topBtns .vicon, #drawerBtns .vicon, #menuBtn > i, #chatBtn > i, #drawerClose > i, #shotBtn > i { display: inline-grid; place-items: center; font-style: normal; }
#topBtns button svg, #drawerBtns button svg, #menuBtn svg, #chatBtn svg { display: block; }
/* căn icon đúng tâm nút (trước là căn theo dòng chữ cho emoji nên icon SVG bị lệch lên) */
#topRight .btns button { display: inline-grid; place-items: center; padding: 0; line-height: 1; }
/* nút chỉ dành cho điện thoại: chỉ đổi cách căn khi đang hiện (body.touch), không làm hiện ra trên máy tính */
body.touch #menuBtn, body.touch #chatBtn, body.touch #shotBtn:not([hidden]) { display: inline-grid; place-items: center; padding: 0; line-height: 1; }
#topRight .btns button[hidden] { display: none; }
#topRight .btns button > i[data-icon], #topRight .btns .vicon { line-height: 0; }
#zenExit > i { display: inline-grid; place-items: center; }

/* icon thay emoji: thanh động tác, ăn/uống, nút di chuyển điện thoại, nút gửi chat, nút thẻ người chơi */
#emotes button i.ico, #vitals button i.ico { display: inline-grid; place-items: center; font-style: normal; }
#emotes button, #vitals button { display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
#jumpBtn, #runBtn, #slowBtn, #sitBtn { display: grid; place-items: center; padding: 0; }
#jumpBtn i.ico, #runBtn i.ico, #slowBtn i.ico, #sitBtn i.ico { display: inline-grid; place-items: center; }
#pcActs button { display: inline-flex; align-items: center; gap: 6px; }
.chat-input #chatInput { padding-right: 92px; }
.chat-input .count { right: 46px; }
#chatSend { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); width: 34px; height: 30px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 8px; background: var(--accent, #ffb347); color: #2a1206; cursor: pointer; pointer-events: auto; }
#chatSend:hover { filter: brightness(1.08); }
#chatSend i { display: inline-grid; }
/* thẻ <i> của số phím tắt định vị tuyệt đối: icon (i.ico) thì nằm giữa nút như bình thường, kể cả trong menu điện thoại */
#emotes button i.ico { position: static; font-size: inherit; color: inherit; }
#drawerEmotes #emotes i.ico { display: inline-grid !important; }
.idle-box .quit-ic { width: 54px; height: 54px; margin: 0 auto 10px; display: grid; place-items: center; border-radius: 50%; color: #ffb347; background: rgba(255, 179, 71, 0.12); box-shadow: inset 0 0 0 1px rgba(255, 179, 71, 0.35); }

/* sổ lưu bút: nút Ghi lại có icon, nút đóng icon */
#wishSend { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
#wishSend i, #wishPanel .close i { display: inline-grid; }
#wishPanel .close { display: grid; place-items: center; }
/* điện thoại: khung chat mở thấp hơn (nhiều người để chat mở suốt, đừng che màn hình) */
body.touch.chat-open #chatLog { max-height: 84px; }
@media (max-height: 500px) and (orientation: landscape) {
  body.touch.chat-open #chat { width: 260px !important; }
  body.touch.chat-open #chatLog { max-height: 60px; }
}

/* hướng dẫn: icon Lucide thay emoji */
#tutorial .tt-icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 14px; color: #ffb347; background: rgba(255, 179, 71, 0.12); box-shadow: inset 0 0 0 1px rgba(255, 179, 71, 0.35); }
#tutorial .tt-row kbd.ic { display: inline-grid; place-items: center; }
#loadingTip { display: inline-flex; align-items: flex-start; gap: 6px; }
#loadingTip svg { flex: none; margin-top: 2px; color: #ffb347; }
/* popup tỏ tình: dùng chung khung popup của game */
#confessModal { position: fixed; inset: 0; z-index: 75; display: grid; place-items: center; padding: 16px; background: rgba(8, 10, 20, 0.6); backdrop-filter: blur(3px); pointer-events: auto; }
#confessModal .confess-card { position: relative; width: min(420px, 100%); padding: 22px; background: linear-gradient(180deg, rgba(26, 32, 52, 0.97) 0%, rgba(15, 20, 36, 0.97) 100%); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5); color: var(--text); }
#confessModal .confess-card h2 { margin: 0 34px 6px 0; }
#confessModal .close { display: grid; place-items: center; }
#confessModal .confess-card .primary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin: 0; background: var(--accent, #ffb347); color: #2a1206; }
#confessModal .confess-chips button { border-color: rgba(255, 255, 255, 0.14); background: rgba(255, 255, 255, 0.05); color: var(--text); }
#confessModal .confess-chips button:hover { border-color: var(--accent, #ffb347); }
/* bạn đồng hành, tin nhắn riêng, hướng dẫn: nút đóng / gửi bằng icon */
#socialPanel .close, #helpPanel .close { display: grid; place-items: center; }
#dmSend { display: inline-grid; place-items: center; min-width: 46px; }
.slist li .ghost { display: inline-grid; place-items: center; }
#returnBtn { display: inline-flex; align-items: center; gap: 8px; }
#returnBtn[hidden] { display: none; }
#returnBtn i { display: inline-grid; }
#wishSend { min-width: 46px; }

/* bảng kỷ lục: icon Lucide */
.rtrophy { color: #ffd36b; }
.rcat i { display: inline-grid; color: #c9d0de; }
.rcat.on i { color: #ffb347; }
.rempty i { display: grid; place-items: center; color: #8f98ad; }
.rpod .rmedal { display: inline-grid; place-items: center; }
.rpod .rmedal.m1 { color: #ffd36b; filter: drop-shadow(0 0 8px rgba(255, 200, 80, 0.6)); }
.rpod .rmedal.m2 { color: #cfd6e2; }
.rpod .rmedal.m3 { color: #d9925a; }
.rme .rmlabel { display: inline-flex; align-items: center; gap: 4px; }
.qx { display: grid; place-items: center; }

/* nút cắt dù: nền đỏ, icon kéo */
#glideBtn.cut { color: #fff; background: linear-gradient(95deg, #e5484d, #b3261e); box-shadow: 0 10px 30px rgba(229, 72, 77, 0.4); }
#glideBtn i { display: inline-grid; place-items: center; }

/* điện thoại: ô thông tin góc trái gọn – chỉ độ cao, giờ núi, bình minh / hoàng hôn */
body.touch #info .title { display: none; }
body.touch #info .sub { display: block !important; margin-top: 4px; }
/* menu ☰: tên núi + sự kiện sắp tới ở đầu, rồi động tác, người đang leo cùng, các nút */
.drawer-info { display: none; }
body.touch .drawer-info { display: flex; flex-direction: column; gap: 6px; margin-top: 2px; }
body.touch .drawer-info #drawerMap { font-size: 16px; font-weight: 800; }
body.touch .drawer-info #eventChip { position: static; max-width: none; pointer-events: auto; }
body.touch .drawer-info #eventChip[hidden] { display: none; }
/* điện thoại: ô thông tin nhỏ gọn sát góc (màn hình hẹp) */
body.touch #info { top: 8px; left: 8px; width: auto; max-width: 52vw; padding: 6px 9px; border-radius: 10px; }
body.touch #info .stats { gap: 10px; }
body.touch #info .stats b { font-size: 13px; line-height: 1.1; white-space: nowrap; }
body.touch #info .stats small { font-size: 9px; }
body.touch #info .sub { font-size: 10.5px; margin-top: 3px; white-space: nowrap; }

/* bản đồ lớn: zoom / kéo, nút + − ở góc */
.map-view { position: relative; flex: none; }
.map-view #fullCanvas { display: block; touch-action: none; cursor: grab; }
.map-view #fullCanvas:active { cursor: grabbing; }
.map-zoom { position: absolute; right: 10px; bottom: 10px; display: flex; flex-direction: column; gap: 6px; }
.map-zoom button { width: 36px; height: 36px; display: grid; place-items: center; padding: 0; border-radius: 10px; border: 1px solid rgba(0, 0, 0, 0.15); background: rgba(255, 255, 255, 0.92); color: #1d2333; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25); cursor: pointer; }
.map-zoom button:hover { background: #fff; }
.map-zoom button i { display: inline-grid; }
#mapPanel .close { display: grid; place-items: center; }
@media (max-width: 760px) { .map-view { width: 100%; } }
.map-view { width: fit-content; max-width: 100%; }
.map-side { flex: 1; min-width: 260px; }
.map-side .profile-box canvas { width: 100%; height: auto; display: block; }
@media (max-width: 760px) { .map-view { width: 100%; } .map-view #fullCanvas { width: 100%; } .map-side { min-width: 0; width: 100%; } }
/* khung bản đồ có chiều rộng cố định, bản đồ lấp đầy khung → nút + − nằm đúng góc bản đồ */
.map-view { width: min(640px, 62vh); }
.map-view #fullCanvas { width: 100%; }
@media (max-width: 760px) { .map-view { width: 100%; } }

/* điện thoại: góc trái chỉ còn giờ núi + bình minh / hoàng hôn trên một dòng; độ cao dưới bản đồ nhỏ */
#altBadge { display: none; }
body.touch #info { display: flex; align-items: center; gap: 8px; padding: 5px 10px; }
body.touch #info .stats { display: flex; gap: 0; }
body.touch #info .stats > div:first-child, body.touch #info .stats small { display: none; }
body.touch #info .stats b { font-size: 12.5px; }
body.touch #info .sub { margin-top: 0; font-size: 12px; }
body.touch #info .sub::before { content: '·'; margin-right: 8px; color: var(--muted); }
body.touch #altBadge { display: block; position: absolute; z-index: 3; pointer-events: none; padding: 2px 8px; border-radius: 99px; background: rgba(10, 14, 24, 0.7); color: #fff; font-size: 11.5px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; transform: translateX(-50%); }
/* bản đồ nhỏ trên điện thoại: top 12px, right 66px, 92px → độ cao căn giữa ngay dưới */
body.touch #altBadge { top: 106px; right: 112px; transform: translateX(50%); }

/* nút chụp ảnh trên điện thoại: đặt ngay trên nút chạy (cùng cột) thay vì lơ lửng cạnh bản đồ */
body.touch #shotBtn { top: auto; bottom: 262px; right: 32px; width: 48px; height: 48px; }
@media (max-height: 500px) and (orientation: landscape) { body.touch #shotBtn { bottom: 158px; } }
body.gliding #shotBtn { display: none !important; }
/* dấu ngăn giờ núi · bình minh trên cùng một dòng */
body.touch #info .sub { display: flex !important; align-items: center; }

/* ô thông tin: bỏ chú thích "độ cao", "giờ núi" – nhìn số là hiểu */
#info .stats small { display: none; }

/* điện thoại: nút ngồi đã có ngoài màn hình → ẩn trong menu; đầu menu không có chữ */
body.touch #drawerEmotes button[data-emote="3"] { display: none !important; }
.drawer-head b:empty { display: none; }
.drawer-head { justify-content: flex-end; }

/* menu ☰ điện thoại: thanh tiến độ hành trình */
body.touch #drawerInfo #route { display: block !important; position: static; transform: none; width: auto; margin: 0; padding: 8px 10px; background: rgba(255, 255, 255, 0.05); border: 0; backdrop-filter: none; pointer-events: auto; }
body.touch #drawerBtns { margin-top: 14px; }

/* ---- cờ quốc gia cạnh tên + popup chọn quốc gia ---- */
img.flag { display: inline-block; width: 1.35em; height: 1em; object-fit: cover; border-radius: 2px; vertical-align: -0.12em; margin-right: 5px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25); flex: none; }
.nametag .label img.flag { width: 16px; height: 12px; margin: 0 1px 0 0; vertical-align: middle; }
.country-modal { position: fixed; z-index: 60; background: rgba(5, 8, 16, 0.62); }
.country-card { display: flex; flex-direction: column; width: min(480px, 100%); max-height: min(640px, 88vh); overflow: hidden; }
.country-search { width: 100%; margin: 10px 0 8px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.08); color: var(--text); font: inherit; outline: none; }
.country-search:focus { border-color: var(--accent); }
.country-list { list-style: none; margin: 0 -6px; padding: 0 6px; overflow-y: auto; flex: 1; min-height: 160px; }
.country-list li { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; cursor: pointer; font-size: 15px; }
.country-list li:hover { background: rgba(255, 255, 255, 0.07); }
.country-list li[aria-selected="true"] { background: rgba(255, 179, 92, 0.18); box-shadow: inset 0 0 0 1px var(--accent); }
.country-list li img.flag { width: 28px; height: 21px; margin: 0; }
.country-list li .cc { margin-left: auto; font-size: 11.5px; color: var(--muted); letter-spacing: 0.06em; }
.country-list .sep { cursor: default; padding: 6px 10px 4px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.country-list .sep:hover { background: none; }
.country-ok { margin-top: 12px; }
.country-btn { display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.08); color: var(--text); font: inherit; font-size: 15px; text-align: left; cursor: pointer; }
.country-btn:hover { border-color: var(--accent); }
.country-btn img.flag { width: 24px; height: 18px; margin: 0; }
.country-btn .chev { margin-left: auto; color: var(--muted); font-size: 12px; }
#pcName img.flag { width: 22px; height: 16px; }
