:root {
  --navy: #0F3A60; --navy-dark: #0A2540; --green: #2E9A63; --green-dark: #1F7A4C;
  --bg: #EAF1F4; --card: #FFFFFF; --text: #13293D; --body: #3C5163; --muted: #6A7C8B; --line: #E2EAF0;
  --navy-tint: #E5ECF5; --green-tint: #E4F4EA; --amber-tint: #FFF3DF; --amber: #C97A0A;
  --violet-tint: #EFEBFC; --violet: #6A4FD0; --rose-tint: #FDEBEE; --rose: #C9405A;
  --glass: rgba(255, 255, 255, .9); --shadow: 0 10px 30px rgba(19, 41, 61, .16);
  --r: 18px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text);
  font-family: 'Be Vietnam Pro', system-ui, -apple-system, sans-serif; -webkit-font-smoothing: antialiased; }
#the-gioi { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
a { color: var(--navy); }
button { font: inherit; color: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Thanh trên */
.top { position: fixed; top: 12px; left: 12px; right: 12px; display: flex; justify-content: space-between; align-items: center; gap: 10px; pointer-events: none; z-index: 5; }
.top > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); background: var(--glass);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); padding: 7px 14px 7px 8px; border-radius: 999px; box-shadow: var(--shadow); }
.brand img { border-radius: 9px; }
.brand span { display: flex; flex-direction: column; line-height: 1.15; }
.brand b { font-size: 14px; }
.brand small { font-size: 12px; color: var(--muted); }
.top-actions { display: flex; gap: 8px; }
.cta { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--green); color: #fff; border: 0; border-radius: 999px;
  padding: 10px 18px; font-weight: 700; font-size: 14px; text-decoration: none; cursor: pointer; box-shadow: var(--shadow); }
.cta:hover { background: var(--green-dark); }
.cta.wide { width: 100%; padding: 13px; font-size: 15px; }
.cta.small { padding: 8px 14px; font-size: 13px; box-shadow: none; }
.ghost { display: inline-flex; align-items: center; gap: 6px; background: var(--glass); backdrop-filter: blur(10px); border: 0; border-radius: 999px;
  padding: 9px 14px; font-weight: 600; font-size: 14px; cursor: pointer; box-shadow: var(--shadow); }

/* Thanh khu ở đáy */
.dock { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; gap: 6px; padding: 6px; max-width: calc(100vw - 24px);
  overflow-x: auto; scrollbar-width: none; background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-radius: 999px; box-shadow: var(--shadow); z-index: 4; }
.dock::-webkit-scrollbar { display: none; }
.dock button { flex: none; display: flex; align-items: center; gap: 7px; border: 0; background: transparent; border-radius: 999px; padding: 6px 12px 6px 6px;
  font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; color: var(--body); }
.dock button:hover { background: rgba(19, 41, 61, .06); }
.dock button[aria-current="true"] { background: var(--text); color: #fff; }
.dock button[aria-current="true"] .zone-ic { background: rgba(255,255,255,.18); color: #fff; }

.zone-ic { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; flex: none; }
.zone-ic svg { width: 16px; height: 16px; }
.panel-head .zone-ic { width: 42px; height: 42px; }
.panel-head .zone-ic svg { width: 21px; height: 21px; }

/* Bảng của khu */
.panel { position: fixed; top: 72px; right: 12px; bottom: 76px; width: min(420px, calc(100vw - 24px)); display: flex; flex-direction: column;
  background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); z-index: 6; overflow: hidden; }
.panel[hidden] { display: none; }
.panel-grip { display: none; }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 14px 12px 12px 14px; border-bottom: 1px solid var(--line); }
.panel-title { flex: 1; min-width: 0; }
.panel-title h2 { margin: 0; font-size: 17px; line-height: 1.25; }
.panel-title p { margin: 2px 0 0; font-size: 13px; color: var(--muted); line-height: 1.35; }
.icon-btn { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; border: 0;
  background: #F1F5F8; cursor: pointer; flex: none; }
.icon-btn:hover { background: #E4EBF0; }
.panel-body { flex: 1; overflow-y: auto; padding: 12px 14px 18px; overscroll-behavior: contain; }

.sec { margin: 6px 0 18px; }
.sec h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 8px; font-weight: 700; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.sec h3 small { text-transform: none; letter-spacing: 0; font-weight: 500; }
.lead { font-size: 14px; color: var(--body); line-height: 1.5; margin: 0 0 12px; }
.card { border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin-bottom: 8px; background: #fff; }
button.card, a.card { display: block; width: 100%; text-align: left; cursor: pointer; text-decoration: none; color: inherit; }
button.card:hover, a.card:hover { border-color: #C9D6DF; background: #FAFCFD; }
.card h4 { margin: 0 0 4px; font-size: 14.5px; line-height: 1.35; }
.card p { margin: 0; font-size: 13px; color: var(--body); line-height: 1.45; }
.meta { font-size: 12px; color: var(--muted); margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.tag { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--navy-tint); color: var(--navy); }
.tag.rose { background: var(--rose-tint); color: var(--rose); }
.tag.amber { background: var(--amber-tint); color: var(--amber); }
.tag.teal { background: var(--green-tint); color: var(--green-dark); }
.tag.violet { background: var(--violet-tint); color: var(--violet); }
.row { display: flex; gap: 10px; align-items: flex-start; }
.row .zone-ic { margin-top: 1px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat { border-radius: 14px; padding: 12px; background: #F5F8FA; }
.stat b { display: block; font-size: 20px; line-height: 1.15; }
.stat span { font-size: 12.5px; color: var(--body); line-height: 1.4; display: block; margin-top: 4px; }
.stat small { display: block; font-size: 11px; color: var(--muted); margin-top: 4px; }
.bars { display: flex; flex-direction: column; gap: 6px; }
.bar { display: grid; grid-template-columns: 110px 1fr 32px; align-items: center; gap: 8px; font-size: 12.5px; }
.bar i { display: block; height: 8px; border-radius: 8px; background: var(--navy); }
.bar span:last-child { text-align: right; font-weight: 600; }
.empty { font-size: 13px; color: var(--muted); padding: 10px 0; }
.err { font-size: 13px; color: var(--rose); background: var(--rose-tint); padding: 10px 12px; border-radius: 12px; }
.links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.links a { font-size: 13px; font-weight: 600; text-decoration: none; }
.links a:hover { text-decoration: underline; }
ul.plain { margin: 6px 0 0; padding-left: 18px; font-size: 13px; color: var(--body); line-height: 1.5; }
ul.plain li { margin: 2px 0; }

/* Ô tìm */
.search { display: flex; gap: 8px; margin-bottom: 10px; }
.search input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; font: inherit; font-size: 14px; background: #F8FAFB; }
.search input:focus { outline: 2px solid rgba(46,154,99,.35); border-color: var(--green); background: #fff; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; font-size: 13px; font-weight: 600; color: var(--body); }
.field input, .field select { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font: inherit; font-size: 15px; background: #F8FAFB; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.seg button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: #fff; }
.result { border-radius: 14px; background: #F5F8FA; padding: 12px; font-size: 13.5px; line-height: 1.5; }
.result .big { font-size: 22px; font-weight: 800; }
.result dl { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; margin: 8px 0 0; }
.result dt { color: var(--body); } .result dd { margin: 0; font-weight: 700; text-align: right; }
.note { font-size: 12px; color: var(--muted); line-height: 1.45; margin-top: 8px; }

/* Bài đọc */
.slide { border-left: 3px solid var(--violet); padding: 2px 0 2px 12px; margin: 0 0 16px; }
.slide .tag { margin-bottom: 6px; }
.slide h4 { margin: 0 0 6px; font-size: 15.5px; line-height: 1.35; }
.slide p { margin: 0 0 6px; font-size: 14px; line-height: 1.55; color: var(--body); }
.slide table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 6px; }
.slide td, .slide th { border: 1px solid var(--line); padding: 5px 6px; text-align: left; vertical-align: top; }
audio, video { width: 100%; border-radius: 12px; margin: 4px 0 12px; background: #000; }
audio { background: transparent; }

/* Gợi ý nổi, hướng dẫn, đang tải */
.hint { position: fixed; left: 50%; bottom: 78px; transform: translateX(-50%); background: var(--text); color: #fff; font-size: 13.5px; font-weight: 600;
  padding: 9px 16px; border-radius: 999px; box-shadow: var(--shadow); z-index: 5; pointer-events: none; white-space: nowrap; max-width: calc(100vw - 24px); overflow: hidden; text-overflow: ellipsis; }
.guide { position: fixed; inset: 0; background: rgba(19, 41, 61, .35); display: flex; align-items: center; justify-content: center; z-index: 10; padding: 16px; }
.guide[hidden] { display: none; }
.guide-card { background: #fff; border-radius: 22px; padding: 22px; max-width: 440px; width: 100%; box-shadow: var(--shadow); }
.guide-card h2 { margin: 0 0 12px; font-size: 20px; }
.guide-card ol { margin: 0 0 18px; padding-left: 20px; font-size: 14.5px; line-height: 1.55; color: var(--body); }
.guide-card li { margin-bottom: 8px; }
.loading { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 600; color: var(--body); background: var(--bg); z-index: 20; transition: opacity .3s; }
.loading.done { opacity: 0; pointer-events: none; }
.spin { width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--green); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.noscript { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--bg); margin: 0; z-index: 30; }

/* Điện thoại: bảng thành tấm trượt dưới */
@media (max-width: 720px) {
  .brand small { display: none; }
  .ghost span { display: none; }
  .ghost { padding: 9px; }
  .panel { top: auto; left: 0; right: 0; bottom: 0; width: 100%; height: 62vh; border-radius: 20px 20px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .panel.tall { height: calc(100vh - 70px); }
  .panel-grip { display: block; width: 40px; height: 5px; border-radius: 5px; background: #D5DEE4; margin: 8px auto 0; }
  .panel-head { padding-top: 8px; }
  body.panel-open .dock { display: none; }
  .hint { bottom: 76px; }
  .bar { grid-template-columns: 90px 1fr 28px; }
}
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } .loading { transition: none; } }

/* Nhãn tên khu nổi trên toà nhà */
.labels { position: fixed; inset: 0; pointer-events: none; z-index: 3; }
.lbl { position: absolute; left: 0; top: 0; pointer-events: auto; display: flex; align-items: center; gap: 8px; padding: 5px 12px 5px 5px; border: 0;
  border-radius: 999px; background: var(--glass); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: 0 6px 18px rgba(19,41,61,.16);
  cursor: pointer; text-align: left; white-space: nowrap; will-change: transform; }
.lbl::after { content: ''; position: absolute; left: 50%; bottom: -5px; width: 10px; height: 10px; background: inherit; transform: translateX(-50%) rotate(45deg); border-radius: 2px; }
.lbl span { display: flex; flex-direction: column; line-height: 1.2; }
.lbl b { font-size: 13px; }
.lbl small { font-size: 11.5px; color: var(--muted); }
.lbl small:empty { display: none; }
.lbl.on { background: var(--text); color: #fff; }
.lbl.on small { color: rgba(255,255,255,.75); }
.lbl.on .zone-ic { background: rgba(255,255,255,.16) !important; color: #fff !important; }
@media (max-width: 720px) { .lbl small { display: none; } .lbl { padding: 4px 10px 4px 4px; } .lbl b { font-size: 12px; } .lbl .zone-ic { width: 24px; height: 24px; } }
.lbl.sunk { opacity: 0; pointer-events: none; }
.icon-btn[hidden] { display: none; }
.lbl .short { display: none; }
@media (max-width: 720px) { .lbl .full { display: none; } .lbl .short { display: inline; } }

/* Chế độ "Trong khu" */
.room-bar { display: none; position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 5; align-items: center; gap: 6px; padding: 5px;
  background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-radius: 999px; box-shadow: var(--shadow); max-width: calc(100vw - 24px); }
body.mode-khu .room-bar { display: flex; }
body.mode-khu .labels { display: none; }
.room-name { display: flex; align-items: center; gap: 8px; padding: 0 8px; min-width: 0; }
.room-name span { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.room-name b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-name small { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.mode-btn { background: var(--text) !important; color: #fff; }
body.mode-khu .mode-btn { background: var(--glass) !important; color: var(--text); }
.spots { position: fixed; inset: 0; pointer-events: none; z-index: 3; }
.spot { position: absolute; left: 0; top: 0; pointer-events: auto; display: flex; align-items: center; gap: 7px; padding: 4px 11px 4px 4px; border: 0; border-radius: 999px;
  background: #fff; box-shadow: 0 6px 16px rgba(19,41,61,.22); cursor: pointer; white-space: nowrap; font-size: 12.5px; font-weight: 700; color: var(--text); will-change: transform; }
.spot i { display: inline-flex; width: 26px; height: 26px; border-radius: 50%; align-items: center; justify-content: center; background: var(--c); color: #fff; }
.spot i svg { width: 15px; height: 15px; }
.spot::after { content: ''; position: absolute; left: 50%; bottom: -12px; width: 2px; height: 12px; background: var(--c); transform: translateX(-50%); }
.spot:hover, .spot.on { background: var(--c); color: #fff; }
.spot:hover i, .spot.on i { background: rgba(255,255,255,.22); }
.card.hl { border-color: var(--green); box-shadow: 0 0 0 3px rgba(46,154,99,.18); }
.link-all { display: block; width: 100%; margin-top: 6px; padding: 11px; border: 1px dashed var(--line); border-radius: 12px; background: #fff; font-weight: 600; font-size: 13.5px; color: var(--navy); cursor: pointer; }
.enter-room { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; border-radius: 14px; padding: 12px; margin-bottom: 14px; cursor: pointer;
  background: linear-gradient(135deg, #13293D, #0F3A60); color: #fff; }
.enter-room svg { width: 22px; height: 22px; padding: 5px; box-sizing: content-box; border-radius: 50%; background: rgba(255,255,255,.16); }
.enter-room span { display: flex; flex-direction: column; } .enter-room b { font-size: 14.5px; } .enter-room small { font-size: 12.5px; opacity: .8; }
@media (max-width: 720px) {
  .room-bar { top: 62px; }
  .mode-btn span { display: none; }
  .mode-btn { padding: 9px; }
  .spot span { display: none; }
  .spot { padding: 4px; }
  .spot.on span { display: inline; padding-right: 8px; }
}
.cta, .brand b { white-space: nowrap; }
@media (max-width: 720px) { .brand b { font-size: 13px; } .brand { padding: 6px 12px 6px 6px; } .brand img { width: 28px; height: 28px; } .top-actions .cta { padding: 9px 14px; } }
@media (max-width: 400px) { .brand span { display: none; } .brand { padding: 6px; } }
.room-name { cursor: pointer; border-radius: 999px; } .room-name:hover { background: rgba(19,41,61,.06); }

/* Popup đăng nhập (Google hoặc mã email) */
.auth-card { position: relative; max-width: 400px; text-align: center; }
.auth-card h2 { margin: 10px 0 6px; font-size: 20px; }
.auth-card form { text-align: left; }
.auth-x { position: absolute; top: 10px; right: 10px; background: transparent; }
.auth-ic { width: 52px; height: 52px; background: var(--green-tint); color: var(--green-dark); }
.auth-ic svg { width: 24px; height: 24px; }
.auth-lead { margin: 0 0 16px; font-size: 14px; line-height: 1.5; color: var(--body); }
.auth-google { position: relative; min-height: 46px; }
.g-btn { width: 100%; height: 46px; display: flex; align-items: center; justify-content: center; gap: 10px; background: #fff; border: 1px solid #d5dde3;
  border-radius: 999px; font-weight: 600; font-size: 15px; color: #1f2937; cursor: pointer; transition: background .15s, border-color .15s; }
.g-btn:hover { background: #f7f9fa; border-color: #c3ccd3; }
.g-btn:disabled { opacity: .6; cursor: default; }
.g-logo { width: 20px; height: 20px; stroke: none; }
/* Nút Google thật (khung của Google) nằm trong suốt đè lên nút của trang: bấm vào là mở cửa sổ Google. */
.g-gsi { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; opacity: .011; overflow: hidden; border-radius: 999px; }
.g-gsi.off { display: none; }
.g-gsi iframe { transform: scale(1.12); }
.auth-google[hidden], .auth-or[hidden] { display: none; }
.auth-or { display: flex; align-items: center; gap: 10px; margin: 14px 0; color: var(--muted); font-size: 13px; }
.auth-or::before, .auth-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.otp { letter-spacing: .5em; text-align: center; font-size: 22px !important; font-weight: 700; }
.auth-links { display: flex; justify-content: space-between; gap: 10px; margin-top: 12px; }
.link-btn { border: 0; background: none; color: var(--navy); font-weight: 600; font-size: 14px; cursor: pointer; padding: 6px 0; }
.link-btn:disabled { color: var(--muted); cursor: default; }
.wide-ghost { width: 100%; justify-content: center; margin-top: 14px; box-shadow: none; border: 1px solid var(--line); background: #fff; color: var(--rose); }
.auth-card .err { margin: 12px 0 0; text-align: left; }
.auth-card .err[hidden] { display: none; }
.cta:disabled { opacity: .6; cursor: default; }
.auth-card .note { text-align: left; }
#auth { z-index: 25; background: rgba(8, 18, 28, .58); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
@media (min-width: 721px) and (max-width: 1180px) { .room-bar { top: 62px; } }
