/* Bố cục: thế giới 3D phủ kín màn hình, các bảng nhỏ nổi ở 4 góc */
:root {
  --ink: #14213d;
  --paper: #fffdf8;
  --accent: #ff7a45;
  --muted: #56607a;
  --glass: rgba(255, 253, 248, 0.92);
  --line: rgba(20, 33, 61, 0.14);
  --sky: #bfe3f5;
  --font-display: "Baloo 2", "Be Vietnam Pro", system-ui, sans-serif;
  --font-body: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body {
  background: var(--sky);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }

.hud { position: fixed; z-index: 5; pointer-events: none; }
.hud button, .hud canvas, #joystick { pointer-events: auto; }

#topLeft {
  top: calc(12px + env(safe-area-inset-top, 0px));
  left: calc(12px + env(safe-area-inset-left, 0px));
  display: flex; flex-direction: column; gap: 8px; align-items: flex-start;
  max-width: calc(100vw - 190px);
}
.row { display: flex; gap: 8px; flex-wrap: wrap; }

.chip {
  display: flex; align-items: center; gap: 8px;
  background: var(--glass); border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 14px; font-weight: 700; font-size: 15px;
  box-shadow: 0 2px 10px rgba(20, 33, 61, 0.12);
}
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); flex: none; }

.btn {
  font: inherit; font-weight: 600; font-size: 14px;
  border: 1px solid var(--line); background: var(--glass); color: var(--ink);
  border-radius: 12px; padding: 10px 14px; min-height: 44px; cursor: pointer;
  box-shadow: 0 2px 8px rgba(20, 33, 61, 0.1);
}
.btn:hover { background: var(--paper); }
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--accent); color: #fff; border-color: transparent; font-size: 16px; padding: 12px 22px; }
.btn-primary:hover { background: #f2652d; }
.btn-go { background: var(--ink); color: #fff; border-color: transparent; }
.btn-go:hover { background: #22325a; }

#minimapWrap {
  top: calc(12px + env(safe-area-inset-top, 0px));
  right: calc(12px + env(safe-area-inset-right, 0px));
}
#minimap {
  display: block; width: 200px; height: 136px;
  border-radius: 12px; border: 2px solid #fff; background: #8cc06a;
  box-shadow: 0 3px 12px rgba(20, 33, 61, 0.25); cursor: pointer;
  transition: width 0.2s, height 0.2s;
}
#minimapWrap.big { z-index: 12; }
#minimapWrap.big #minimap { width: min(88vw, 440px); height: calc(min(88vw, 440px) * 0.68); }
.mm-caption { font-size: 11px; font-weight: 600; margin: 4px 0 0 auto; width: max-content; color: var(--ink); background: var(--glass); padding: 2px 8px; border-radius: 999px; }

#flash {
  position: fixed; inset: 0; z-index: 15; pointer-events: none;
  background: #fffdf8; opacity: 0; transition: opacity 0.2s;
}
#flash.on { opacity: 0.95; }
#minimapWrap.big .mm-caption { background: var(--ink); color: #fff; font-size: 13px; padding: 5px 12px; }

#banner {
  top: calc(86px + env(safe-area-inset-top, 0px)); left: 50%;
  transform: translate(-50%, -8px); text-align: center; opacity: 0;
  transition: opacity 0.4s, transform 0.4s;
}
#banner.show { opacity: 1; transform: translate(-50%, 0); }
#banner .title {
  font-family: var(--font-display); font-size: 36px; font-weight: 800; line-height: 1.15;
  color: #fff; padding: 6px 24px; border-radius: 14px; background: var(--zone, var(--accent));
  box-shadow: 0 4px 16px rgba(20, 33, 61, 0.25); white-space: nowrap;
}
#banner .sub {
  margin-top: 6px; font-weight: 600; background: var(--glass); display: inline-block;
  padding: 4px 12px; border-radius: 999px;
}
#banner .sub:empty { display: none; }

#help {
  bottom: calc(14px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%);
  background: var(--glass); border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 16px; font-size: 13px; white-space: nowrap; color: var(--muted);
}

#joystick {
  left: calc(28px + env(safe-area-inset-left, 0px));
  bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  width: 136px; height: 136px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.28); border: 2px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 2px 14px rgba(20, 33, 61, 0.2); touch-action: none;
}
#knob {
  position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px;
  border-radius: 50%; background: rgba(255, 255, 255, 0.95); pointer-events: none;
  box-shadow: 0 2px 8px rgba(20, 33, 61, 0.3);
}
#touchHint {
  right: calc(16px + env(safe-area-inset-right, 0px)); bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  background: var(--glass); border-radius: 999px; padding: 6px 12px; font-size: 12px; color: var(--muted);
  max-width: 45vw; transition: opacity 0.6s;
}
#touchHint.fade { opacity: 0; }

.touch-only { display: none; }
body.is-touch .touch-only { display: block; }
body.is-touch .desk-only { display: none; }

#welcome {
  position: fixed; inset: 0; z-index: 20; display: grid; place-items: center;
  background: rgba(20, 33, 61, 0.42);
  padding: calc(16px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) calc(16px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  overflow: auto;
}
#welcome[hidden] { display: none; }
.card {
  background: var(--paper); border-radius: 20px; max-width: 460px; width: 100%;
  padding: 24px; box-shadow: 0 12px 40px rgba(20, 33, 61, 0.3);
  display: flex; flex-direction: column; gap: 14px; user-select: text;
}
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.card h1 { font-family: var(--font-display); font-size: 34px; line-height: 1.05; margin: -6px 0 0; text-wrap: balance; }
.card h1 .city { display: block; font-size: 0.62em; color: var(--accent); margin-top: 2px; }
.lead { margin: 0; font-size: 15px; line-height: 1.55; }
.levels { display: flex; gap: 6px; flex-wrap: wrap; }
.pick-label { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: -6px; }
.levels { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.lv {
  font: inherit; color: #fff; font-weight: 800; font-size: 15px; border: 0; cursor: pointer;
  padding: 10px 4px; min-height: 48px; border-radius: 10px; box-shadow: inset 0 -3px 0 rgba(0,0,0,0.18);
  transition: transform 0.12s;
}
.lv:hover { transform: translateY(-2px); }
.lv:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.lv small { display: block; font-size: 10.5px; font-weight: 600; opacity: 0.9; }
.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.controls div { background: #f3efe6; border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; line-height: 1.45; min-width: 0; }
.controls b { font-size: 14px; }
.note { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.card .btn-primary { align-self: stretch; }

@media (max-width: 640px) {
  #minimap { width: 140px; height: 95px; }
  #topLeft { max-width: calc(100vw - 180px); }
  .chip { font-size: 13px; padding: 6px 12px; }
  .btn { font-size: 13px; padding: 8px 11px; }
  #banner { top: calc(130px + env(safe-area-inset-top, 0px)); }
  #banner .title { font-size: 26px; }
  .controls { grid-template-columns: 1fr; }
  .card h1 { font-size: 30px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ================= Bước 3 + 5: tài khoản, hộp thoại, gian hàng ================= */
.btn-acc { background: var(--accent); color: #fff; border-color: transparent; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-acc:hover { background: #f2652d; }
.btn-jobs { background: #7c3aed; color: #fff; border-color: transparent; }
.btn.sm { min-height: 36px; padding: 6px 10px; font-size: 13px; }
.btn.full { width: 100%; }
.btn.danger { color: #c92a2a; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.link { font: inherit; background: none; border: 0; color: var(--accent); font-weight: 700; cursor: pointer; padding: 0; text-decoration: underline; }

.welcome-acc { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.welcome-acc .btn { flex: 1 1 140px; }
.welcome-acc .hello { flex: 1 1 100%; font-weight: 600; }
.controls-wrap summary { cursor: pointer; font-weight: 700; font-size: 14px; }
.controls-wrap .controls { margin-top: 8px; }

/* Hộp thoại */
.modal {
  position: fixed; inset: 0; z-index: 30; display: grid; place-items: center;
  background: rgba(20, 33, 61, 0.45); overflow: auto;
  padding: calc(16px + env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) calc(16px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
}
.sheet {
  position: relative; background: var(--paper); border-radius: 20px; width: 100%; max-width: 440px;
  box-shadow: 0 16px 50px rgba(20, 33, 61, 0.35); user-select: text; -webkit-user-select: text;
}
.sheet.wide { max-width: 720px; }
.sheet-body { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.sheet h2 { font-family: var(--font-display); font-size: 26px; line-height: 1.15; margin: 0; padding-right: 40px; text-wrap: balance; }
.sheet h3 { margin: 0; }
.x {
  position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: #f0ebe1; color: var(--ink); font-size: 24px; line-height: 1; cursor: pointer;
}
.x.sm { position: static; width: 30px; height: 30px; font-size: 18px; }
.hint { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.hint.center { text-align: center; }
.err { margin: 0; color: #c92a2a; background: #fff0f0; border-radius: 10px; padding: 8px 12px; font-weight: 600; font-size: 13.5px; }
.err[hidden] { display: none; }
em { color: #c92a2a; font-style: normal; }

.form { display: flex; flex-direction: column; gap: 12px; }
.form.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form .full, .form .field.full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label, .field .lbl { font-weight: 600; font-size: 13.5px; }
.lbl-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 26px; }
.field input, .field select, .field textarea {
  font: inherit; font-size: 15px; color: var(--ink); background: #fff; width: 100%; box-sizing: border-box;
  border: 1.5px solid #d9d2c3; border-radius: 10px; padding: 10px 12px; min-height: 44px;
}
.field textarea { resize: vertical; min-height: 80px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 122, 69, 0.2); }
.priv {
  font: inherit; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 3px 10px; cursor: pointer;
  border: 1.5px solid #2f9e44; color: #2b8a3e; background: #ebfbee;
}
.priv.hidden-mode { border-color: #868e96; color: #495057; background: #f1f3f5; }
.actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.actions .btn { min-width: 120px; }

.steps { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0; counter-reset: s; }
.steps li { flex: 1; font-size: 12.5px; font-weight: 700; color: var(--muted); padding-top: 8px; border-top: 4px solid #e6dfd1; counter-increment: s; }
.steps li::before { content: counter(s) ". "; }
.steps li.on { color: var(--accent); border-color: var(--accent); }
.steps li.done { color: var(--ink); border-color: var(--ink); }

.roles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.role {
  font: inherit; text-align: left; cursor: pointer; border: 2px solid #e2dbcd; background: #fff; border-radius: 14px;
  padding: 12px; display: flex; flex-direction: column; gap: 4px; color: var(--ink);
}
.role b { font-size: 15px; }
.role span { font-size: 12.5px; color: var(--muted); }
.role.on { border-color: var(--accent); background: #fff4ee; box-shadow: 0 0 0 3px rgba(255, 122, 69, 0.18); }

.progress { background: #f6f1e7; border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.progress p { margin: 0; font-size: 13px; color: var(--muted); }
.bar { height: 10px; border-radius: 999px; background: #e3dccd; overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #ff7a45, #2f9e44); transition: width 0.3s; }

.logo-row { display: flex; gap: 12px; align-items: center; }
.logo-prev { width: 72px; height: 72px; border-radius: 14px; background: #f1ece2; display: grid; place-items: center; overflow: hidden; flex: none; font-size: 12px; color: var(--muted); }
.logo-prev img { width: 100%; height: 100%; object-fit: cover; }

.avatar-pick { display: grid; grid-template-columns: 200px 1fr; gap: 16px; align-items: start; }
.avatar-canvas { width: 200px; height: 240px; border-radius: 16px; background: radial-gradient(circle at 50% 40%, #fff, #f0e9db); display: block; }
.avatar-opts { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.avatar-opts b { font-size: 13.5px; display: block; margin-bottom: 6px; }
.sws, .chips { display: flex; gap: 8px; flex-wrap: wrap; }
.sw { width: 38px; height: 38px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1.5px #d9d2c3; cursor: pointer; }
.sw.on { box-shadow: 0 0 0 3px var(--accent); }
.chipbtn { font: inherit; font-weight: 600; border: 1.5px solid #d9d2c3; background: #fff; border-radius: 999px; padding: 8px 14px; cursor: pointer; min-height: 40px; color: var(--ink); }
.chipbtn.on { border-color: var(--accent); background: #fff4ee; color: #d9480f; }

.menu { display: flex; flex-direction: column; gap: 8px; }
.menu .btn { text-align: left; }

.lvl { color: #fff; font-weight: 800; font-size: 12px; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.lvl-btn { font: inherit; color: #fff; font-weight: 700; font-size: 12.5px; border: 0; padding: 5px 10px; border-radius: 8px; cursor: pointer; }

/* Trạng thái tin */
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.st-open { background: #d3f9d8; color: #2b8a3e; }
.st-closing { background: #ffe8cc; color: #d9480f; }
.st-upcoming, .st-notyet { background: #efe3ff; color: #6f2dbd; }
.st-closed, .st-expired { background: #e9ecef; color: #495057; }
.st-upcoming, .st-closing { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.15); } }

.head-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding-right: 40px; }
.joblist { display: flex; flex-direction: column; gap: 10px; }
.jobrow { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; border: 1.5px solid #e6dfd1; border-radius: 14px; padding: 12px; background: #fff; }
.jobrow-main { min-width: 0; flex: 1 1 260px; display: flex; flex-direction: column; gap: 6px; }
.jobrow-title { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.jobrow-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); align-items: center; }
.jobrow-act { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.empty { text-align: center; padding: 24px; background: #f6f1e7; border-radius: 14px; }
.empty p { margin: 6px 0 0; color: var(--muted); }
.done-box { text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.done-box h2 { padding: 0; }
.done-box p { margin: 0; }
.done-ic { width: 56px; height: 56px; border-radius: 50%; background: #2f9e44; color: #fff; font-size: 30px; display: grid; place-items: center; }

/* Bảng thông tin gian hàng */
.co-head { display: flex; gap: 14px; align-items: center; padding-right: 36px; }
.co-logo { width: 72px; height: 72px; border-radius: 16px; object-fit: cover; flex: none; box-shadow: 0 2px 8px rgba(20, 33, 61, 0.15); }
.co-head h2 { padding: 0; }
.rating { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.stars { color: #f59f00; letter-spacing: 1px; }
.intro { margin: 0; line-height: 1.6; max-width: 65ch; }
.co-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 13.5px; color: var(--muted); }
.co-meta svg, .window svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sec { font-size: 16px; display: flex; align-items: center; gap: 8px; border-top: 1px solid #ece5d7; padding-top: 12px; }
.count { background: var(--ink); color: #fff; font-size: 12px; border-radius: 999px; padding: 1px 8px; }
.jobs { display: flex; flex-direction: column; gap: 12px; }
.job { border: 1.5px solid #e6dfd1; border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: #fff; }
.job-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.job-head h3 { font-size: 17px; line-height: 1.3; min-width: 0; }
.job-pos { font-size: 13.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tile { display: flex; gap: 10px; align-items: flex-start; background: #f6f1e7; border-radius: 12px; padding: 10px 12px; min-width: 0; }
.tile svg { width: 26px; height: 26px; flex: none; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tile div { display: flex; flex-direction: column; min-width: 0; }
.tile span { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.tile b { font-size: 15px; line-height: 1.35; overflow-wrap: anywhere; }
.tile.hl { background: #fff1e8; }
.tile.hl b { color: #d9480f; font-size: 17px; }
.window { display: flex; gap: 8px; align-items: center; font-size: 13.5px; color: var(--ink); }
.job details summary { cursor: pointer; font-weight: 600; font-size: 13.5px; }
.job details p { margin: 6px 0 0; line-height: 1.6; font-size: 14px; }

/* Thẻ khi đứng gần gian hàng */
#boothPrompt {
  pointer-events: auto; left: 50%; transform: translateX(-50%);
  bottom: calc(60px + env(safe-area-inset-bottom, 0px));
  display: flex; align-items: center; gap: 12px; background: var(--paper); border-radius: 16px;
  padding: 10px 12px; box-shadow: 0 6px 24px rgba(20, 33, 61, 0.25); width: min(440px, calc(100vw - 32px)); box-sizing: border-box;
}
#boothPrompt[hidden] { display: none; }
#boothPrompt img { width: 48px; height: 48px; border-radius: 12px; object-fit: cover; flex: none; }
.bp-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.bp-text b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bp-text > span { font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
body.is-touch #boothPrompt { left: auto; right: max(12px, env(safe-area-inset-right, 0px)); transform: none; bottom: calc(180px + env(safe-area-inset-bottom, 0px)); width: min(360px, calc(100vw - 24px)); }

/* Mũi tên chỉ đường tới khu của bạn */
#guide {
  pointer-events: auto; top: calc(12px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; font: inherit; font-weight: 700; font-size: 14px;
  background: #f59f00; color: #fff; border: 0; border-radius: 999px; padding: 8px 16px 8px 10px; cursor: pointer;
  box-shadow: 0 4px 14px rgba(20, 33, 61, 0.25);
}
#guide[hidden] { display: none; }
#guide svg { width: 26px; height: 26px; fill: #fff; transition: transform 0.15s linear; }
body.is-touch #guide { top: auto; left: auto; transform: none; right: max(12px, env(safe-area-inset-right, 0px)); bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }

/* Thông báo tin đáng chú ý */
.notice { pointer-events: auto; background: var(--paper); border-radius: 14px; padding: 10px; box-shadow: 0 6px 20px rgba(20, 33, 61, 0.2); width: min(320px, calc(100vw - 200px)); display: flex; flex-direction: column; gap: 6px; }
.notice[hidden] { display: none; }
.notice-head { display: flex; justify-content: space-between; align-items: center; }
.notice-item { font: inherit; text-align: left; border: 0; background: #f6f1e7; border-radius: 10px; padding: 8px 10px; cursor: pointer; display: flex; flex-direction: column; gap: 3px; align-items: flex-start; color: var(--ink); }
.notice-item:hover { background: #efe7d7; }
.ni-title { font-weight: 700; font-size: 13.5px; }
.ni-co { font-size: 12px; color: var(--muted); }

#toasts { position: fixed; z-index: 40; left: 50%; transform: translateX(-50%); bottom: calc(110px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; font-weight: 600; box-shadow: 0 6px 20px rgba(20, 33, 61, 0.3); transition: opacity 0.4s, transform 0.4s; text-align: center; }
.toast.good { background: #2b8a3e; }
.toast.bad { background: #c92a2a; }
.toast.out { opacity: 0; transform: translateY(8px); }

@media (max-width: 640px) {
  .form.grid { grid-template-columns: 1fr; }
  .roles { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: 1fr; }
  .avatar-pick { grid-template-columns: 1fr; justify-items: center; }
  .avatar-canvas { width: 180px; height: 200px; }
  .sheet-body { padding: 18px 16px; }
  .sheet h2 { font-size: 22px; }
  .notice { width: calc(100vw - 24px); }
  .btn-acc { max-width: 140px; }
}
.lv.mine { box-shadow: 0 0 0 3px #ffd43b, inset 0 -3px 0 rgba(0,0,0,0.18); }
.form.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pw { display: flex; gap: 6px; }
.pw input { flex: 1; min-width: 0; }
.pw-eye { font: inherit; font-weight: 600; font-size: 13px; border: 1.5px solid #d9d2c3; background: #fff; border-radius: 10px; padding: 0 12px; cursor: pointer; color: var(--ink); }
.roles .role { padding: 10px 12px; }
#rg .roles { grid-template-columns: 1fr 1fr; }
.field input.ok { border-color: #2f9e44; background: #ebfbee; }
.field input.ok:focus { border-color: #2f9e44; box-shadow: 0 0 0 3px rgba(47, 158, 68, 0.2); }
.ok-hint { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.ok-hint.good { color: #2b8a3e; }

/* Form đăng tin: chọn nhanh */
.jf { gap: 10px; }
.jsec { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border: 1.5px solid #ece5d7; border-radius: 14px; background: #fff; }
.jsec h3 { font-size: 15px; display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.jsec h3 .hint { font-weight: 600; }
.qc .chipbtn { min-height: 38px; padding: 6px 12px; font-size: 13.5px; }
.qc .chipbtn[style] { border-color: var(--c); color: var(--c); }
.qc .chipbtn[style].on { background: var(--c); color: #fff; }
.qinput, .jsec select, .jsec input[type=date], .stepper input {
  font: inherit; font-size: 15px; color: var(--ink); background: #fff; border: 1.5px solid #d9d2c3; border-radius: 10px;
  padding: 9px 12px; min-height: 44px; box-sizing: border-box; width: 100%;
}
.qinput:focus, .jsec select:focus, .jsec input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 122, 69, 0.2); }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper .btn { width: 46px; padding: 0; font-size: 22px; }
.stepper input { width: 90px; text-align: center; font-weight: 700; }
.time-row { display: flex; gap: 12px; flex-wrap: wrap; }
.time-row label { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.time-row select { width: auto; min-width: 100px; }
.date-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.date-row > div { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.preview { margin: 0; font-size: 13.5px; color: var(--muted); }
.err-inline { color: #c92a2a; font-weight: 600; }
.sticky-actions { position: sticky; bottom: -22px; background: var(--paper); padding: 12px 0; margin-bottom: -10px; }
@media (max-width: 640px) { .date-row { grid-template-columns: 1fr; } .sticky-actions { bottom: -18px; } }
.chipbtn.big { min-width: 80px; font-size: 15px; }

/* Thẻ nhân vật góc trái */
.me-card {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; cursor: pointer;
  font: inherit; color: var(--ink); text-align: left; background: var(--glass); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 16px 4px 4px; box-shadow: 0 3px 12px rgba(20, 33, 61, 0.15); max-width: 260px;
}
.me-card:hover { background: var(--paper); }
.me-card:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.me-card img { width: 56px; height: 56px; border-radius: 50%; background: radial-gradient(circle at 50% 35%, #fff, #ffe3d3); border: 3px solid #fff; box-shadow: 0 0 0 2px var(--accent); flex: none; object-fit: cover; }
.me-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.me-text b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-tag { align-self: flex-start; color: #fff; font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 6px; background: #64748b; white-space: nowrap; }
@media (max-width: 640px) { .me-card img { width: 46px; height: 46px; } .me-card { max-width: 190px; padding-right: 12px; } .me-text b { font-size: 14px; } }

/* ================= Bước 4: trò chuyện ================= */
.btn-inbox { position: relative; }
.badge-n { position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; box-sizing: border-box; border-radius: 999px; background: #e03131; color: #fff; font-size: 11.5px; font-weight: 800; display: grid; place-items: center; border: 2px solid #fff; }
#chatBox {
  pointer-events: auto; left: calc(12px + env(safe-area-inset-left, 0px)); bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  width: 340px; background: rgba(255, 253, 248, 0.94); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 6px 22px rgba(20, 33, 61, 0.2); display: none; flex-direction: column; overflow: hidden; z-index: 6;
}
#chatBox.open { display: flex; }
.chat-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 8px 8px 14px; border-bottom: 1px solid #ece5d7; }
.chat-head b { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-list { list-style: none; margin: 0; padding: 8px 12px; height: 170px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; user-select: text; -webkit-user-select: text; }
.chat-list li { font-size: 13.5px; line-height: 1.4; }
.chat-list li p { margin: 1px 0 0; overflow-wrap: anywhere; }
.chat-list li.me p { color: #c2410c; }
.chat-list li.note { color: var(--muted); font-size: 12px; font-style: italic; }
.chat-list .who { font: inherit; font-weight: 700; border: 0; background: none; padding: 0; color: var(--ink); cursor: pointer; text-decoration: underline dotted; }
.chat-list .t, .convs .t, .thread-head .t { font-size: 11px; font-weight: 700; color: #fff; background: #64748b; border-radius: 5px; padding: 0 5px; }
.chat-list .tm { font-size: 11px; color: var(--muted); margin-left: 6px; }
.chat-send { display: flex; gap: 6px; padding: 8px; border-top: 1px solid #ece5d7; }
.chat-send input { flex: 1; min-width: 0; font: inherit; font-size: 15px; border: 1.5px solid #d9d2c3; border-radius: 10px; padding: 8px 10px; min-height: 42px; background: #fff; color: var(--ink); }
.chat-send input:focus { outline: none; border-color: var(--accent); }
.chat-send .btn { min-height: 42px; padding: 0 14px; font-size: 14px; }
#chatFab {
  pointer-events: auto; left: calc(12px + env(safe-area-inset-left, 0px)); bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  font: inherit; font-weight: 700; background: var(--ink); color: #fff; border: 0; border-radius: 999px; padding: 12px 20px; cursor: pointer; box-shadow: 0 4px 14px rgba(20, 33, 61, 0.3);
}
body.is-touch #chatFab { left: auto; right: calc(16px + env(safe-area-inset-right, 0px)); bottom: calc(24px + env(safe-area-inset-bottom, 0px)); padding: 14px 20px; }
body.is-touch #touchHint { display: none; }
body.is-touch #chatBox { left: 8px; right: 8px; width: auto; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); z-index: 12; }
body.is-touch #chatBox .chat-list { height: 32vh; }
body:not(.is-touch) #boothPrompt { bottom: calc(60px + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 900px) { body:not(.is-touch) #boothPrompt { left: auto; right: 16px; transform: none; bottom: 60px; } }

.convs { display: flex; flex-direction: column; gap: 6px; }
.conv { font: inherit; text-align: left; border: 1.5px solid #ece5d7; background: #fff; border-radius: 12px; padding: 10px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 3px; color: var(--ink); }
.conv.unread { border-color: var(--accent); background: #fff6f0; }
.conv-top { display: flex; gap: 6px; align-items: center; }
.conv-top .count { margin-left: auto; background: #e03131; color: #fff; border-radius: 999px; font-size: 11.5px; font-weight: 800; padding: 1px 8px; }
.conv-last { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.online { color: #2b8a3e; font-size: 12px; font-weight: 700; margin-left: 6px; }
.thread-head { display: flex; align-items: center; gap: 8px; padding-right: 40px; }
.thread { list-style: none; margin: 0; padding: 4px; max-height: 50vh; min-height: 120px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.thread li { align-self: flex-start; max-width: 80%; background: #f1ece2; border-radius: 14px 14px 14px 4px; padding: 8px 12px; }
.thread li.mine { align-self: flex-end; background: var(--accent); color: #fff; border-radius: 14px 14px 4px 14px; }
.thread li p { margin: 0; overflow-wrap: anywhere; }
.thread li span { font-size: 10.5px; opacity: 0.7; }
.sheet .chat-send { padding: 0; border: 0; }
.pc-head { display: flex; gap: 14px; align-items: center; padding-right: 36px; }
.pc-head img { width: 84px; height: 84px; border-radius: 50%; background: radial-gradient(circle at 50% 35%, #fff, #ffe3d3); border: 3px solid #fff; box-shadow: 0 0 0 2px var(--accent); }
.pc-head h2 { padding: 0; margin-bottom: 4px; }
.pc-rows { display: flex; flex-direction: column; gap: 6px; background: #f6f1e7; border-radius: 12px; padding: 10px 12px; }
.pc-row { display: flex; gap: 10px; font-size: 13.5px; }
.pc-row span { color: var(--muted); min-width: 120px; flex: none; }
.pc-row b { font-weight: 600; overflow-wrap: anywhere; }

/* ================= Điện thoại: gọn gàng, không che nhân vật ================= */
html, body { touch-action: manipulation; overscroll-behavior: none; }
/* iPhone tự phóng to trang khi chữ trong ô nhập nhỏ hơn 16px -> luôn để 16px */
input, select, textarea { font-size: 16px !important; }
body.is-touch #where { display: none; }
body.is-touch .me-card { padding: 3px 12px 3px 3px; max-width: 58vw; }
body.is-touch .me-card img { width: 38px; height: 38px; border-width: 2px; }
body.is-touch .me-text b { font-size: 13px; }
body.is-touch .me-tag { font-size: 10.5px; }
body.is-touch #topLeft { max-width: calc(100vw - 150px); }
/* các nút xếp dọc ở cạnh phải, ngay trên nút Chat */
body.is-touch #topLeft .row {
  position: fixed; right: calc(12px + env(safe-area-inset-right, 0px)); bottom: calc(86px + env(safe-area-inset-bottom, 0px));
  flex-direction: column; align-items: flex-end; gap: 8px; flex-wrap: nowrap;
}
body.is-touch #topLeft .row .btn { min-height: 42px; padding: 8px 14px; font-size: 13.5px; box-shadow: 0 2px 10px rgba(20, 33, 61, 0.18); }
body.is-touch #chatFab { bottom: calc(24px + env(safe-area-inset-bottom, 0px)); right: calc(12px + env(safe-area-inset-right, 0px)); padding: 12px 22px; }
body.is-touch #minimap { width: 118px; height: 80px; }
body.is-touch .mm-caption { font-size: 10px; }
body.is-touch #banner { top: calc(110px + env(safe-area-inset-top, 0px)); max-width: calc(100vw - 32px); }
body.is-touch #banner .title { font-size: 22px; white-space: normal; padding: 4px 16px; }
body.is-touch #banner .sub { font-size: 12px; }
body.is-touch .notice { width: min(320px, calc(100vw - 24px)); padding: 8px; gap: 4px; }
body.is-touch .notice-head b { font-size: 13px; }
body.is-touch .notice-item { padding: 6px 8px; }
body.is-touch .notice-item .ni-title { font-size: 12.5px; }
body.is-touch .notice-item .ni-co { font-size: 11px; }
body.is-touch .notice-item .badge { font-size: 11px; padding: 1px 7px; }
body.is-touch #guide { right: auto; left: 50%; transform: translateX(-50%); bottom: calc(196px + env(safe-area-inset-bottom, 0px)); top: auto; font-size: 13px; padding: 6px 14px 6px 8px; }
body.is-touch #guide svg { width: 22px; height: 22px; }
body.is-touch #boothPrompt { left: 12px; right: 12px; width: auto; transform: none; top: calc(64px + env(safe-area-inset-top, 0px)); bottom: auto; }
body.is-touch #joystick { width: 120px; height: 120px; left: calc(20px + env(safe-area-inset-left, 0px)); bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
body.is-touch #knob { width: 52px; height: 52px; margin: -26px 0 0 -26px; }
body.is-touch #toasts { bottom: auto; top: calc(110px + env(safe-area-inset-top, 0px)); }
.nh-toggle { font: inherit; border: 0; background: none; padding: 0; cursor: pointer; display: flex; gap: 8px; align-items: baseline; color: var(--ink); }
.nh-more { display: none; font-size: 12px; color: var(--accent); font-weight: 700; }
.notice.collapsed .notice-item { display: none; }
.notice.collapsed .nh-more { display: inline; }
body.is-touch .notice.collapsed { width: auto; padding: 6px 6px 6px 12px; border-radius: 999px; }
body.is-touch.near-booth .notice { display: none; }
#guide span { white-space: nowrap; }
body.is-touch #boothPrompt { top: calc(72px + env(safe-area-inset-top, 0px)); padding: 8px 10px; }
body.is-touch #boothPrompt img { width: 40px; height: 40px; }
body.is-touch #banner { top: calc(160px + env(safe-area-inset-top, 0px)); }
body.is-touch #toasts { top: 38vh; }
body.is-touch #topLeft .row .btn { font-size: 13px; padding: 7px 12px; min-height: 40px; }
body.is-touch #chatBox { background: var(--paper); }
body.is-touch.chat-open #topLeft .row, body.is-touch.chat-open #guide, body.is-touch.chat-open #joystick { display: none; }

/* File JD (PDF) */
.pdf-head { display: flex; align-items: center; gap: 10px; padding-right: 40px; }
.pdf-title { display: flex; flex-direction: column; min-width: 0; }
.pdf-title b { font-size: 16px; overflow-wrap: anywhere; }
.pdf-pages { display: flex; flex-direction: column; gap: 10px; max-height: 70vh; overflow-y: auto; background: #e9e4da; border-radius: 12px; padding: 10px; -webkit-overflow-scrolling: touch; }
.pdf-page { width: 100%; height: auto; background: #fff; box-shadow: 0 2px 8px rgba(20, 33, 61, 0.15); border-radius: 4px; }
.pdf-loading { padding: 40px; text-align: center; color: var(--muted); font-weight: 600; }
.btn-jd { background: #fff4ee; border-color: var(--accent); color: #c2410c; font-weight: 700; }
.jd-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.jd-file { display: flex; align-items: center; gap: 8px; background: #fff4ee; border: 1.5px solid #ffd2bd; border-radius: 10px; padding: 8px 12px; min-width: 0; flex: 1 1 220px; }
.jd-file b { overflow-wrap: anywhere; font-size: 14px; }
.jd-ic { width: 32px; height: 38px; border-radius: 4px; background: #e8590c; color: #fff; font-size: 10px; font-weight: 800; display: grid; place-items: center; flex: none; }
.jd-tag { font-size: 11.5px; font-weight: 700; color: #c2410c; }
.doc-view { max-height: 70vh; overflow: auto; background: #e9e4da; border-radius: 12px; padding: 10px; -webkit-overflow-scrolling: touch; user-select: text; -webkit-user-select: text; }
.doc-view.pages { display: flex; flex-direction: column; gap: 10px; }
.doc-paper { background: #fff; border-radius: 6px; padding: 24px 22px; box-shadow: 0 2px 8px rgba(20, 33, 61, 0.12); line-height: 1.6; font-size: 15px; overflow-wrap: anywhere; }
.doc-paper h1, .doc-paper h2, .doc-paper h3 { line-height: 1.3; margin: 0.8em 0 0.4em; }
.doc-paper table, .sheet-view table { border-collapse: collapse; }
.doc-paper td, .doc-paper th { border: 1px solid #d9d2c3; padding: 4px 8px; }
.doc-paper img { max-width: 100%; height: auto; }
.sheet-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.sheet-view { background: #fff; border-radius: 6px; overflow: auto; }
.sheet-view table { font-size: 13.5px; min-width: 100%; }
.sheet-view td, .sheet-view th { border: 1px solid #e3dccd; padding: 5px 9px; white-space: nowrap; }
.sheet-view tr:first-child td { background: #f6f1e7; font-weight: 700; position: sticky; top: 0; }
.doc-img { width: 100%; height: auto; display: block; border-radius: 6px; background: #fff; }
.pdf-head .jd-ic { width: 44px; }
a.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; box-sizing: border-box; text-align: center; }
.btn.full { box-sizing: border-box; }
.btn-apply { background: #0068ff; color: #fff; border-color: transparent; font-weight: 700; }
.btn-apply:hover { background: #0057d6; }
.btn-zalo { background: #0068ff; color: #fff; border-color: transparent; font-size: 16px; font-weight: 800; min-height: 52px; }
.btn-zalo:hover { background: #0057d6; }
.apply-steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 10px; font-size: 14px; line-height: 1.5; }
.apply-steps .chips { margin: 6px 0; }
.apply-text { width: 100%; resize: vertical; line-height: 1.55; font-size: 15px; }
.zalo-num { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; background: #eef4ff; border-radius: 12px; padding: 8px 12px; font-size: 14px; }
.btn.sm { white-space: nowrap; flex: none; }
.jd-box { background: #fffaf3; border: 1.5px solid #f2e3cf; border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.jd-box h4 { margin: 0; font-size: 14px; }
.jd-desc { margin: 0; font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.btn-jd .jd-ic { width: auto; height: auto; padding: 2px 8px; border-radius: 6px; font-size: 11px; margin-right: 8px; }
.btn-jd { display: flex; align-items: center; justify-content: center; }
.tip { margin: 0; background: #fff8e6; border: 1.5px solid #ffd98a; border-radius: 10px; padding: 8px 12px; font-size: 13.5px; text-align: left; }
.gate { text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.gate h2 { padding: 0; }
.gate p { margin: 0; line-height: 1.55; color: var(--muted); }
.gate-ic { font-size: 40px; line-height: 1; }
.btn-lock { background: #f1ece2; border: 1.5px dashed #c9bfae; color: var(--ink); font-weight: 700; }
.guest-hint { margin: 0; font-weight: 400 !important; font-size: 13px; color: var(--muted); line-height: 1.5; }
.welcome-acc .btn-acc { max-width: none; }
.gate .menu .btn { text-align: center; }
.me-tag { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

/* Đánh giá công ty */
.reviews { display: flex; flex-direction: column; gap: 12px; }
.rv-sum { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; background: #f6f1e7; border-radius: 14px; padding: 12px 14px; }
.rv-score { display: flex; flex-direction: column; align-items: center; min-width: 90px; }
.rv-score b { font-family: var(--font-display); font-size: 34px; line-height: 1; }
.rv-react { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.react { font: inherit; font-weight: 700; font-size: 14px; border: 1.5px solid #cfe8d5; background: #fff; color: #2b8a3e; border-radius: 999px; padding: 8px 14px; min-height: 42px; cursor: pointer; }
.react.bad { border-color: #f3d3d3; color: #c92a2a; }
.react.on { background: #2b8a3e; color: #fff; border-color: #2b8a3e; }
.react.bad.on { background: #c92a2a; border-color: #c92a2a; }
.rv-form { display: flex; flex-direction: column; gap: 8px; border: 1.5px solid #ece5d7; border-radius: 14px; padding: 12px; background: #fff; }
.rv-stars { display: flex; align-items: center; gap: 2px; }
.star { font-size: 30px; line-height: 1; border: 0; background: none; color: #d9d2c3; cursor: pointer; padding: 2px 3px; }
.star.on { color: #f59f00; }
.rv-stars .hint { margin-left: 8px; }
.rv-form .btn { align-self: flex-end; }
.rv-list { display: flex; flex-direction: column; gap: 8px; }
.rv-item { border-bottom: 1px solid #ece5d7; padding-bottom: 8px; }
.rv-item.mine { background: #fff8f2; border-radius: 10px; padding: 8px 10px; border: 0; }
.rv-top { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.rv-top .t { font-size: 11px; font-weight: 700; color: #fff; background: #64748b; border-radius: 5px; padding: 0 5px; }
.rv-item p { margin: 4px 0 0; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.rv-note { background: #f6f1e7; border-radius: 10px; padding: 8px 12px; }

/* Việc hợp với bạn */
.btn-match { position: relative; background: #2f9e44; color: #fff; border-color: transparent; }
.btn-match:hover { background: #2b8a3e; }
.match { font: inherit; text-align: left; border: 1.5px solid #d3f0da; background: #f4fbf5; border-radius: 12px; padding: 8px 10px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; color: var(--ink); width: 100%; box-sizing: border-box; }
.match:hover { background: #e9f8ec; }
.match-top { display: flex; gap: 8px; align-items: flex-start; justify-content: space-between; }
.match-top b { font-size: 14px; line-height: 1.3; }
.match-co { font-size: 12.5px; color: var(--muted); }
.match-why { display: flex; gap: 4px; flex-wrap: wrap; }
.why { font-size: 11px; font-weight: 700; color: #2b8a3e; background: #d3f9d8; border-radius: 999px; padding: 1px 8px; }
.matches { display: flex; flex-direction: column; gap: 8px; }
.notice-all { font-size: 13px; align-self: flex-start; }
.nudge { margin: 0; font-size: 13px; line-height: 1.5; }
.tour-link { font-size: 13.5px; align-self: flex-start; }

/* Hướng dẫn lần đầu */
.tour { position: fixed; inset: 0; z-index: 60; }
.tour-hole { position: fixed; border-radius: 16px; box-shadow: 0 0 0 9999px rgba(20, 33, 61, 0.55); border: 3px solid #ffd43b; pointer-events: none; transition: all 0.25s; }
.tour::before { content: ""; position: fixed; inset: 0; }
.tour-card {
  position: fixed; left: 50%; transform: translateX(-50%); width: min(400px, calc(100vw - 24px)); box-sizing: border-box;
  background: var(--paper); border-radius: 18px; padding: 16px 18px; box-shadow: 0 12px 40px rgba(20, 33, 61, 0.35);
  display: flex; flex-direction: column; gap: 8px;
}
.tour-step { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.tour-card h3 { margin: 0; font-family: var(--font-display); font-size: 22px; }
.tour-card p { margin: 0; font-size: 14.5px; line-height: 1.55; }
.tour-btns { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 4px; }
body.is-touch #btnMatch { order: -1; }

/* Bảng xếp hạng */
.btn-rank { background: #f59f00; color: #fff; border-color: transparent; }
.btn-rank:hover { background: #e08e00; }
.rank-pill { display: inline-block; background: #f59f00; color: #fff; font-weight: 800; font-size: 12px; border-radius: 6px; padding: 1px 7px; }
.how { background: #f6f1e7; border-radius: 12px; padding: 8px 12px; font-size: 13.5px; line-height: 1.55; }
.how summary { cursor: pointer; font-weight: 700; }
.how ul { margin: 6px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.how p { margin: 6px 0 0; }
.rank-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rank-row { display: flex; align-items: center; gap: 10px; border: 1.5px solid #ece5d7; border-radius: 14px; padding: 8px 10px; background: #fff; }
.rank-row:first-child { border-color: #f5c542; background: #fffbea; }
.rank-no { font-size: 22px; font-weight: 800; min-width: 36px; text-align: center; }
.rank-row img { width: 42px; height: 42px; border-radius: 10px; object-fit: cover; flex: none; }
.rank-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.rank-main b { overflow-wrap: anywhere; }
.rank-score { display: flex; flex-direction: column; align-items: center; flex: none; }
.rank-score b { font-family: var(--font-display); font-size: 24px; line-height: 1; color: #d9480f; }
.rank-score span { font-size: 11px; color: var(--muted); }

/* Danh bạ công ty + hạng gian hàng */
.btn-dir { background: #0c8599; color: #fff; border-color: transparent; }
.btn-dir:hover { background: #0b7285; }
.dir-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 55vh; overflow-y: auto; }
.dir-row { display: flex; align-items: center; gap: 10px; border: 1.5px solid #ece5d7; border-radius: 14px; padding: 8px 10px; background: #fff; }
.dir-row img { width: 42px; height: 42px; border-radius: 10px; object-fit: cover; flex: none; }
.dir-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.dir-main b { overflow-wrap: anywhere; }
.dir-sal { font-size: 12.5px; font-weight: 700; color: #d9480f; }
.tier { display: inline-block; font-size: 11px; font-weight: 800; color: #fff; border-radius: 6px; padding: 1px 7px; vertical-align: middle; }
.tier-top { background: #f59f00; }
.tier-featured { background: #1c7ed6; }

/* Đang online */
.online-chip { display: flex; align-items: center; gap: 6px; margin: 6px 0 0 auto; font: inherit; font-size: 12.5px; color: var(--ink); background: var(--glass); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; cursor: pointer; box-shadow: 0 2px 8px rgba(20, 33, 61, 0.12); max-width: 380px; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: #2f9e44; box-shadow: 0 0 0 3px rgba(47, 158, 68, 0.25); flex: none; animation: live 1.6s ease-in-out infinite; }
@keyframes live { 50% { box-shadow: 0 0 0 6px rgba(47, 158, 68, 0.05); } }
body.is-touch .oc-detail { display: none; }
body.is-touch .online-chip { font-size: 11.5px; padding: 4px 10px; }
.ol-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ol-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border: 1.5px solid #ece5d7; border-radius: 12px; padding: 8px 10px; background: #fff; }
.ol-name { flex: 1; min-width: 140px; }
.ol-row .t { font-size: 11px; font-weight: 700; color: #fff; background: #64748b; border-radius: 5px; padding: 0 5px; }
.ol-act { display: flex; gap: 6px; }

/* Thao tác nhân vật */
#emoteBar {
  pointer-events: auto; left: 50%; transform: translateX(-50%); bottom: calc(52px + env(safe-area-inset-bottom, 0px));
  display: flex; gap: 6px; background: var(--glass); border: 1px solid var(--line); border-radius: 18px; padding: 6px; box-shadow: 0 4px 16px rgba(20, 33, 61, 0.18);
}
#emoteBar button { font: inherit; border: 0; background: transparent; border-radius: 12px; padding: 4px 8px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 1px; color: var(--ink); min-width: 54px; }
#emoteBar button:hover { background: #fff1e8; }
#emoteBar button:focus-visible { outline: 3px solid var(--accent); }
#emoteBar span { font-size: 22px; line-height: 1.1; }
#emoteBar small { font-size: 11px; font-weight: 600; color: var(--muted); }
body:not(.is-touch) #boothPrompt { bottom: calc(120px + env(safe-area-inset-bottom, 0px)); }
#emoteFab { pointer-events: auto; right: calc(118px + env(safe-area-inset-right, 0px)); bottom: calc(24px + env(safe-area-inset-bottom, 0px)); width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--paper); font-size: 26px; box-shadow: 0 4px 14px rgba(20, 33, 61, 0.3); }
body.is-touch #emoteBar { display: none; left: 12px; right: 12px; transform: none; bottom: calc(86px + env(safe-area-inset-bottom, 0px)); flex-wrap: wrap; justify-content: center; z-index: 9; }
body.is-touch.emote-open #emoteBar { display: flex; }
body.is-touch.chat-open #emoteFab { display: none; }

/* ===== Nói vào micro để nhập chữ ===== */
.chat-send .mic-btn, .chat-send .mic-lang {
  flex: none; min-height: 42px; border: 1.5px solid #d9d2c3; background: #fff; color: var(--ink);
  border-radius: 10px; cursor: pointer; font: inherit;
}
.chat-send .mic-btn { width: 44px; font-size: 19px; padding: 0; }
.chat-send .mic-lang { width: 34px; font-size: 12.5px; font-weight: 700; padding: 0; color: var(--muted); }
.chat-send .mic-btn.on { background: #e5484d; border-color: #e5484d; animation: micPulse 1s ease-in-out infinite; }
@keyframes micPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(229, 72, 77, 0.5); } 50% { box-shadow: 0 0 0 6px rgba(229, 72, 77, 0); } }

/* ===== Hộp thư: thẻ Tin nhắn / Bạn bè / Thông báo ===== */
.tabs { display: flex; gap: 6px; margin: 4px 0 12px; border-bottom: 1.5px solid #ece5d7; overflow-x: auto; }
.tabs .tab { flex: 1 0 auto; font: inherit; font-weight: 700; font-size: 14px; background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 8px; cursor: pointer; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; justify-content: center; min-height: 44px; }
.tabs .tab.on { color: var(--ink); border-bottom-color: var(--accent); }
.tabs .tab .count { background: #e5484d; color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 7px; }
.fr-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.fr-row { display: flex; align-items: center; gap: 10px; background: #f6f1e7; border-radius: 12px; padding: 8px 10px; flex-wrap: wrap; }
.fr-row img { width: 44px; height: 44px; border-radius: 50%; background: #fff; flex: none; }
.fr-name { flex: 1; min-width: 120px; display: flex; flex-direction: column; }
.fr-name small.online { color: #1f9d55; font-weight: 600; }
.fr-act { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-friend { background: #1f9d55; color: #fff; border-color: #1f9d55; }
.rec-row { display: flex; gap: 6px; margin: 6px 0; }
.rec-row:empty { display: none; }
.rec-row .hint { margin: 0; }
.rec-btn { min-height: 46px; font-weight: 700; }
.rec-btn.on { background: #e5484d; color: #fff; border-color: #e5484d; animation: micPulse 1s ease-in-out infinite; }
.rec-cancel { min-height: 46px; flex: none; }
.vmsg { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; }
.vmsg audio { height: 36px; width: 210px; max-width: 58vw; }
.vmsg small { opacity: 0.7; }
.follow-box { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0 4px; }
.follow-box:empty { display: none; }
.btn.follow { display: inline-flex; gap: 8px; align-items: center; font-weight: 700; min-height: 44px; }
.btn.follow b { background: rgba(0, 0, 0, 0.08); border-radius: 999px; padding: 0 8px; font-size: 13px; }
.btn.follow.on { background: #fff4d6; border-color: #e0a800; color: #7a5600; }
.follow-box small { flex: 1; min-width: 180px; }
.fol-box { background: #f6f1e7; border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
.fol-box .chips { margin-top: 6px; }
.nt-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.nt { width: 100%; text-align: left; font: inherit; background: #fff; border: 1.5px solid #ece5d7; border-radius: 12px; padding: 10px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; color: var(--ink); }
.nt.unread { border-color: var(--accent); background: #fff7f1; font-weight: 600; }
#frBtn:empty { display: none; }
#frBtn .btn { width: 100%; }
/* máy tính: khi khung chat mở thì đặt thanh thao tác ở giữa phần còn trống bên phải */
body:not(.is-touch).chat-open #emoteBar { left: calc(364px + (100vw - 364px) / 2); }
@media (max-width: 860px) { body:not(.is-touch).chat-open #emoteBar { left: auto; right: 12px; transform: none; } }
