:root {
  --bg-void: #0a0a12;
  --bg-void-2: #12111d;
  --panel-bg: rgba(18, 18, 30, 0.55);
  --panel-border: rgba(201, 168, 106, 0.18);
  --accent-gold: #c9a86a;
  --accent-teal: #7fd8c4;
  --text-primary: #f2ede2;
  --text-muted: #9a94a6;
  --radius: 14px;
  --blur: 18px;
  --font-display: 'Cormorant Garamond', serif;
  --font-ui: 'Inter', -apple-system, sans-serif;
  /* Foreground color for text/icons sitting ON TOP of an
     accent-gold→accent-teal gradient (buttons, active chips/tabs,
     thumbnails). Dark theme's accents are light, so dark bg-void text
     reads fine; the deep theme's accents are saturated cyan/blue, so it uses
     its own near-black value — see the override below. */
  --on-accent: var(--bg-void);
}

/* "Deep Cyber Blue" theme (Xanh công nghệ huyền bí / chuyển đổi số): a deep
   navy void with cyan + blue accents — dark and atmospheric like the default
   theme, but cool instead of warm. Nearly every piece of UI chrome here is
   built from these variables, so redefining them reskins buttons, panels,
   borders and text in one place — set by app.js via
   document.documentElement.dataset.theme. */
:root[data-theme="deep"] {
  --bg-void: #040d1a;
  --bg-void-2: #082038;
  --panel-bg: rgba(5, 22, 42, 0.6);
  --panel-border: rgba(56, 189, 248, 0.3);
  --accent-gold: #22d3ee;
  --accent-teal: #3b82f6;
  --text-primary: #e4f4ff;
  --text-muted: #8fb2cc;
  --on-accent: #031019;
}
:root[data-theme="deep"] .glass-panel {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 22px rgba(34, 211, 238, 0.07);
}

/* Giao diện phòng: Gỗ ấm / Hiện đại / Đêm (cùng cách đổi biến màu như "deep") */
:root[data-theme="warm"] {
  --bg-void: #1a110a; --bg-void-2: #2a1b10; --panel-bg: rgba(40, 26, 14, 0.62); --panel-border: rgba(232, 184, 106, 0.32);
  --accent-gold: #e8b86a; --accent-teal: #c97a3c; --text-primary: #f7ecd9; --text-muted: #b9a283; --on-accent: #1a110a;
}
:root[data-theme="modern"] {
  --bg-void: #1e2430; --bg-void-2: #2b3342; --panel-bg: rgba(36, 44, 58, 0.66); --panel-border: rgba(138, 180, 255, 0.32);
  --accent-gold: #8ab4ff; --accent-teal: #5eead4; --text-primary: #f1f5fb; --text-muted: #9fb0c8; --on-accent: #0c1424;
}
:root[data-theme="night"] {
  --bg-void: #05030f; --bg-void-2: #130c2b; --panel-bg: rgba(20, 12, 46, 0.64); --panel-border: rgba(179, 136, 255, 0.34);
  --accent-gold: #ffd27a; --accent-teal: #b388ff; --text-primary: #efeafc; --text-muted: #a59ac8; --on-accent: #120a26;
}

* { box-sizing: border-box; }

/* ---------- Critical interaction-blocking fix ----------
 * An author stylesheet's `display` rule ALWAYS overrides the browser's
 * built-in `[hidden] { display: none }` rule, even with equal specificity —
 * because author CSS outranks the user-agent stylesheet in the cascade,
 * before specificity is even compared. Several elements here combine the
 * `hidden` attribute with a class that sets `display: flex` (the flipbook
 * modal, Admin's model/book fieldsets, the MC chroma-color row) — without
 * this rule, JS setting `.hidden = true` on them is silently ignored: the
 * element keeps rendering, keeps receiving pointer events, and — for any
 * `position: fixed; inset: 0` element like the flipbook modal — sits
 * invisibly on top of the ENTIRE page, swallowing every click and drag
 * anywhere (canvas, buttons, cards). `!important` here is what makes this
 * rule win regardless of any class's specificity. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  height: var(--app-h, 100dvh);
  background: radial-gradient(ellipse at 50% 20%, var(--bg-void-2), var(--bg-void) 70%);
  color: var(--text-primary);
  font-family: var(--font-ui);
  overflow: hidden;
}

#scene-root {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--app-h, 100dvh);
}
#scene-root canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ---------- Glass panel base ---------- */
.glass-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(var(--blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(140%);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

/* ---------- Loader ---------- */
.loader {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(360px, 85vw);
  padding: 28px 30px;
  text-align: center;
  z-index: 50;
  transition: opacity 0.6s ease;
}
.loader.hidden { opacity: 0; pointer-events: none; }
.loader-mark {
  font-family: var(--font-display);
  letter-spacing: 0.12em;
  font-size: calc((15px) * var(--fs, 1));
  line-height: 1.4;
  color: var(--accent-gold);
  margin-bottom: 16px;
}
.loader-bar {
  height: 2px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 12px;
}
.loader-progress {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-gold), var(--accent-teal));
  transition: width 0.25s ease;
}
.loader-label {
  font-size: calc((12px) * var(--fs, 1));
  color: var(--text-muted);
}

/* ---------- Top bar ---------- */
.topbar {
  position: fixed;
  top: 18px;
  left: 18px;
  right: 18px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 18px;
  z-index: 20;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: calc((17px) * var(--fs, 1));
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.brand-logo {
  width: 30px;
  height: 30px;
  object-fit: contain;
  border-radius: 6px;
  flex-shrink: 0;
}
.hint {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-size: calc((12px) * var(--fs, 1));
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.icon-btn {
  background: transparent;
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: calc((12px) * var(--fs, 1));
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.icon-btn:hover { border-color: var(--accent-gold); color: var(--accent-gold); }
.icon-btn[aria-pressed="true"] { color: var(--accent-teal); border-color: var(--accent-teal); }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.theme-toggle-btn,
.reset-view-btn { display: inline-flex; align-items: center; gap: 6px; }
.reset-view-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.bgm-volume {
  width: 70px;
  accent-color: var(--accent-teal);
  cursor: pointer;
}
@media (max-width: 900px) {
  .hint { display: none; }
}
@media (max-width: 860px) {
  .theme-toggle-label,
  .reset-view-label,
  .flipbook-external-label { display: none; }
  .bgm-volume { width: 46px; }
}
@media (max-width: 640px) {
  .flipbook-frame-wrap { width: 96vw; height: 90dvh; }
}

/* ---------- Info modal ---------- */
.info-modal {
  position: fixed;
  top: 90px;
  right: 18px;
  width: min(340px, calc(100vw - 36px));
  max-height: min(470px, calc(100vh - 130px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 18px 20px 14px;
  z-index: 30;
  transform: translateX(24px);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
}
.info-modal.open { transform: translateX(0); opacity: 1; }
.info-sheet-handle {
  display: none; /* only shown as a bottom-sheet grab handle on mobile, below */
}
.info-close {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 9px;
}
.info-eyebrow {
  font-size: calc((11px) * var(--fs, 1));
  color: var(--accent-teal);
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}
.info-title {
  font-family: var(--font-display);
  font-size: calc((22px) * var(--fs, 1));
  margin: 0 28px 8px 0;
  line-height: 1.2;
}
.info-head { flex: 0 0 auto; }
/* Khung chữ nhỏ gọn: nội dung dài thì cuộn trong khung, không tràn màn hình */
.info-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 6px;
  margin-right: -4px;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-gold) transparent;
}
.info-scroll::-webkit-scrollbar { width: 6px; }
.info-scroll::-webkit-scrollbar-thumb { background: var(--accent-gold); border-radius: 999px; }
.info-scroll:focus-visible { outline: 2px solid var(--accent-teal); outline-offset: 2px; border-radius: 6px; }
/* Nút chức năng cố định ngay dưới khung chữ */
.info-foot {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--panel-border);
}
.info-quote {
  font-family: var(--font-display);
  font-style: italic;
  font-size: calc((16px) * var(--fs, 1));
  color: var(--accent-gold);
  border-left: 2px solid var(--accent-gold);
  padding-left: 12px;
  margin: 0 0 10px;
  font-size: calc((14.5px) * var(--fs, 1));
}
.info-meta {
  display: grid; grid-template-columns: max-content 1fr; gap: 3px 12px;
  margin: 0 0 10px; font-size: calc((12.5px) * var(--fs, 1)); line-height: 1.4;
}
.info-meta[hidden] { display: none; }
.info-meta dt { color: var(--text-secondary, rgba(255,255,255,.6)); }
.info-meta dd { margin: 0; color: var(--text-primary, #fff); }
.info-description {
  font-size: calc((13.5px) * var(--fs, 1));
  line-height: 1.6;
  color: #d9d4e4;
  margin: 0;
  overflow-wrap: anywhere;
}
/* Rich text from Admin: airy paragraphs, visible bullets, readable on the dark glass. */
.info-description p, .info-description div { margin: 0 0 0.75em; }
.info-description > :last-child { margin-bottom: 0; }
.info-description ul, .info-description ol { margin: 0 0 0.85em; padding-left: 1.35em; }
.info-description ul { list-style: none; padding-left: 0.2em; }
.info-description ul > li { position: relative; padding-left: 1.4em; margin: 0.3em 0; }
.info-description ul > li::before {
  content: '◆';
  position: absolute;
  left: 0;
  top: 0.1em;
  font-size: calc((0.7em) * var(--fs, 1));
  line-height: 1.9;
  color: var(--accent-teal);
}
.info-description li { margin: 0.3em 0; }
.info-description h3, .info-description h4 { margin: 0.4em 0 0.4em; font-family: var(--font-display); color: var(--text-primary); }
.info-description blockquote { margin: 0 0 0.85em; padding-left: 12px; border-left: 2px solid var(--accent-gold); font-style: italic; }

.info-audio-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.pill-btn {
  background: linear-gradient(120deg, rgba(201, 168, 106, 0.18), rgba(127, 216, 196, 0.12));
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  border-radius: 999px;
  padding: 9px 16px;
  font-size: calc((12.5px) * var(--fs, 1));
  cursor: pointer;
  transition: border-color 0.2s ease;
}
.pill-btn:hover { border-color: var(--accent-gold); }
.audio-time { font-size: calc((11px) * var(--fs, 1)); color: var(--text-muted); }

.pill-btn-primary {
  background: linear-gradient(120deg, var(--accent-gold), var(--accent-teal));
  color: var(--on-accent);
  border: none;
  font-weight: 600;
}
.info-read-book {
  width: 100%;
  margin-top: 0;
  font-size: calc((13.5px) * var(--fs, 1));
  padding: 11px 16px;
}

/* ---------- Flipbook modal ---------- */
.flipbook-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 8, 16, 0.78);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  z-index: 60;
  opacity: 0;
  /* Defense-in-depth on top of the global [hidden] fix above: even while
     technically present pre-transition, a closed overlay must never
     intercept clicks meant for the page underneath it. */
  pointer-events: none;
  transition: opacity 0.35s ease;
}
.flipbook-overlay.open { opacity: 1; pointer-events: auto; }
.flipbook-frame-wrap {
  width: 90vw;
  max-width: 1600px;
  height: 85vh;
  height: 85dvh; /* mobile browsers: exclude the collapsing URL bar */
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  transform: scale(0.96);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.flipbook-overlay.open .flipbook-frame-wrap { transform: none; } /* không giữ transform: iOS lỗi vị trí / thanh điều khiển trong khung nhúng */
.flipbook-frame-wrap.glass-panel { backdrop-filter: none; -webkit-backdrop-filter: none; }
.flipbook-overlay.pseudo-fs .flipbook-frame-wrap { width: 100vw; max-width: none; height: 100vh; height: 100dvh; border-radius: 0; border: 0; }
.flipbook-overlay.pseudo-fs .flipbook-bar { display: none; }
.flipbook-overlay.pseudo-fs { padding: 0; backdrop-filter: none; -webkit-backdrop-filter: none; background: #0b0e1a; }
.flipbook-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--panel-border);
  flex-shrink: 0;
}
.flipbook-title {
  font-family: var(--font-display);
  font-size: calc((16px) * var(--fs, 1));
  color: var(--accent-gold);
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.flipbook-bar-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.flipbook-external { text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }

/* The stage holds the iframe and, on top of it until loaded, the spinner. */
.flipbook-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  background: #fff;
}
.flipbook-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
}
.flipbook-loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
  text-align: center;
  background: radial-gradient(ellipse at 50% 40%, var(--bg-void-2), var(--bg-void) 75%);
  transition: opacity 0.4s ease;
}
.flipbook-loading.done { opacity: 0; pointer-events: none; }
.flipbook-loading-msg {
  margin: 0;
  max-width: 420px;
  font-size: calc((13px) * var(--fs, 1));
  line-height: 1.6;
  color: var(--text-muted);
}
.flipbook-external-big { display: none; text-decoration: none; }
.flipbook-reload-big { display: none; }
.flipbook-loading[data-state="slow"] .flipbook-reload-big { display: inline-block; }
.flipbook-loading[data-state="slow"] .flipbook-external-big { display: inline-block; }
/* "blocked" (mixed content) hands off entirely to the smart fallback bar below. */
.flipbook-loading[data-state="blocked"], .flipbook-loading[data-state="busy"] { display: none; }

/* Smart fallback bar — shown instead of the iframe/spinner when the browser
   can tell up-front the iframe cannot possibly work (mixed content: an
   https page is never allowed to frame http://). Keeps the experience
   unbroken with a prominent "open in a new tab" action, a preview of the
   book's own cover, and an explicit way back into the gallery. */
.flipbook-fallback {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 32px 24px;
  text-align: center;
  background: radial-gradient(ellipse at 50% 35%, var(--bg-void-2), var(--bg-void) 80%);
}
.flipbook-fallback[data-state="blocked"], .flipbook-fallback[data-state="busy"] { display: flex; }
.flipbook-fallback[data-state="busy"] .flipbook-fallback-open { display: none; }
.flipbook-fallback-cover {
  width: 120px;
  height: 168px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.04);
  margin-bottom: 6px;
}
.flipbook-fallback-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: calc((19px) * var(--fs, 1));
  font-weight: 600;
  color: var(--accent-gold);
}
.flipbook-fallback-msg {
  margin: 0;
  max-width: 440px;
  font-size: calc((13px) * var(--fs, 1));
  line-height: 1.6;
  color: var(--text-muted);
}
.flipbook-fallback-open {
  font-size: calc((14.5px) * var(--fs, 1));
  padding: 13px 24px;
  text-decoration: none;
}
.flipbook-fallback-back { font-size: calc((12.5px) * var(--fs, 1)); }

/* Sci-fi spinner: two counter-rotating arcs around a pulsing core. */
.scifi-spinner {
  position: relative;
  display: inline-block;
  width: 76px;
  height: 76px;
}
.scifi-spinner::before,
.scifi-spinner::after,
.scifi-spinner i {
  content: '';
  position: absolute;
  border-radius: 50%;
}
.scifi-spinner::before {
  inset: 0;
  border: 2px solid transparent;
  border-top-color: var(--accent-teal);
  border-bottom-color: var(--accent-gold);
  box-shadow: 0 0 14px rgba(34, 211, 238, 0.25);
  animation: scifi-spin 1.3s linear infinite;
}
.scifi-spinner::after {
  inset: 11px;
  border: 2px solid transparent;
  border-left-color: var(--accent-gold);
  border-right-color: var(--accent-teal);
  animation: scifi-spin 0.95s linear infinite reverse;
}
.scifi-spinner i {
  inset: 26px;
  background: radial-gradient(circle, var(--accent-gold), transparent 70%);
  animation: scifi-pulse 1.4s ease-in-out infinite;
}
@keyframes scifi-spin { to { transform: rotate(360deg); } }
@keyframes scifi-pulse {
  0%, 100% { transform: scale(0.7); opacity: 0.55; }
  50% { transform: scale(1.15); opacity: 1; }
}

/* ---------- Exhibit rail ---------- */

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .loader, .info-modal, .loader-progress { transition: none; }
  .scifi-spinner::before, .scifi-spinner::after, .scifi-spinner i { animation-duration: 3s; }
}

/* ---------- Small screens ---------- */
@media (max-width: 640px) {
  /* .hint already hidden below 900px, above */
  .brand-text { display: none; }
  /* Bottom sheet: collapses to a "peek" (title + actions only) by default —
     the handle bar can be swiped up/down or tapped to reveal/hide the quote
     and description, instead of a fixed floating panel covering the 3D
     view. A plain max-height/overflow toggle (not a translateY slide) keeps
     this robust regardless of how long the title or quote happens to be. */
  .info-modal {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: auto;
    max-height: 62dvh;
    padding: 8px 18px calc(12px + env(safe-area-inset-bottom, 0px));
    border-radius: 18px 18px 0 0;
    transform: translateY(16px);
  }
  .info-modal.open { transform: translateY(0); }
  .info-sheet-handle {
    display: flex;
    width: 100%;
    justify-content: center;
    padding: 10px 0 6px;
    background: none;
    border: none;
    cursor: grab;
    touch-action: none;
  }
  .info-sheet-grip {
    width: 40px;
    height: 4px;
    border-radius: 999px;
    background: var(--panel-border);
  }
  .info-close { top: 8px; }
  .info-modal:not(.expanded) .info-scroll { display: none !important; }
  .info-modal.expanded .info-scroll { max-height: 30dvh; }
  .info-title { font-size: calc((19px) * var(--fs, 1)); }
}


/* =====================================================================
   🎬 Video Media dock + embed stage, 🎧 Audiobook player
   ===================================================================== */
.video-dock {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  z-index: 24;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  width: min(640px, calc(100vw - 36px));
  border-color: rgba(244, 251, 255, 0.5);
  box-shadow: 0 0 22px rgba(190, 235, 255, 0.28), 0 8px 32px rgba(0, 0, 0, 0.4);
}
.video-dock-title {
  flex: 0 1 140px;
  min-width: 0;
  font-size: calc((12.5px) * var(--fs, 1));
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.video-btn { min-width: 34px; height: 34px; padding: 0 8px; }
.video-seek { flex: 1 1 auto; min-width: 60px; accent-color: #f4fbff; }
.video-volume { flex: 0 0 70px; accent-color: #f4fbff; }
.video-time { font-size: calc((11px) * var(--fs, 1)); color: var(--text-muted); white-space: nowrap; }
.video-embed-toggle { margin-left: auto; font-size: calc((12.5px) * var(--fs, 1)); }

.video-embed {
  position: fixed;
  inset: 0;
  z-index: 22;
  pointer-events: none;
  overflow: hidden;
}
.video-embed[hidden] { display: none; }
.video-embed-frame {
  position: absolute;
  left: 0;
  top: 0;
  border: 0;
  background: #000;
  transform-origin: 0 0;
  visibility: hidden;
  pointer-events: none;
}

.ab-player {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 25;
  width: min(360px, calc(100vw - 36px));
  padding: 12px 14px 14px;
  border-color: rgba(143, 233, 255, 0.45);
  box-shadow: 0 0 24px rgba(127, 216, 255, 0.2), 0 8px 32px rgba(0, 0, 0, 0.4);
}
.ab-player[hidden] { display: none; }
.ab-head { display: flex; align-items: center; gap: 12px; }
.ab-cover {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(143, 233, 255, 0.7);
  animation: ab-spin 12s linear infinite;
}
.ab-meta { flex: 1; min-width: 0; }
.ab-eyebrow { font-size: calc((10px) * var(--fs, 1)); letter-spacing: 0.14em; color: var(--accent-teal); }
.ab-title, .ab-chapter { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ab-title { font-size: calc((14px) * var(--fs, 1)); font-weight: 600; color: var(--text-primary); }
.ab-chapter { font-size: calc((12px) * var(--fs, 1)); color: var(--text-muted); }
.ab-min { width: 30px; height: 30px; padding: 0; }
.ab-body { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.ab-player.minimized .ab-body { display: none; }
.ab-seek-row { display: flex; align-items: center; gap: 8px; }
.ab-seek { flex: 1; accent-color: var(--accent-teal); }
.ab-time { font-size: calc((11px) * var(--fs, 1)); color: var(--text-muted); white-space: nowrap; }
.ab-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ab-btn { min-width: 36px; height: 36px; padding: 0 10px; }
.ab-btn:disabled { opacity: 0.4; cursor: default; }
.ab-btn-main {
  min-width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-gold), var(--accent-teal));
  color: var(--on-accent);
  border-color: transparent;
  font-size: calc((16px) * var(--fs, 1));
}
.ab-vol { display: inline-flex; align-items: center; gap: 4px; flex: 1; min-width: 80px; }
.ab-vol input { flex: 1; min-width: 40px; accent-color: var(--accent-teal); }
.ab-list-btn { font-size: calc((12px) * var(--fs, 1)); }
.ab-chapters {
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 2px;
}
.ab-chapters[hidden] { display: none; }
.ab-chapter-item {
  display: flex;
  gap: 10px;
  align-items: baseline;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 7px 10px;
  color: var(--text-primary);
  font: inherit;
  font-size: calc((13px) * var(--fs, 1));
  cursor: pointer;
}
.ab-chapter-item:hover { border-color: var(--panel-border); }
.ab-chapter-item.active {
  border-color: var(--accent-teal);
  color: var(--accent-teal);
  background: rgba(127, 216, 196, 0.08);
}
.ab-chapter-num { font-size: calc((11px) * var(--fs, 1)); color: var(--text-muted); font-variant-numeric: tabular-nums; }
@keyframes ab-spin { to { transform: rotate(360deg); } }


@media (max-width: 640px) {
  .video-dock { bottom: auto; top: 76px; flex-wrap: wrap; gap: 8px; }
  .video-dock-title { flex: 1 1 100%; }
  .video-volume { display: none; }
  .ab-player { left: 0; right: 0; bottom: auto; top: 70px; width: auto; margin: 0 10px; }
}
@media (prefers-reduced-motion: reduce) { .ab-cover { animation: none; } }



/* ---------- Mobile floating actions (text panel hidden until asked for) ---------- */
.mobile-actions { display: none; }
@media (max-width: 640px) {
  .mobile-actions {
    position: fixed;
    right: 14px;
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    z-index: 22;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
  }
  .mobile-actions[hidden] { display: none; }
  .fab {
    border: 1px solid var(--panel-border);
    background: var(--panel-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    color: var(--text-primary);
    font: inherit;
    font-size: calc((14px) * var(--fs, 1));
    font-weight: 600;
    padding: 12px 18px;
    border-radius: 999px;
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.4);
    cursor: pointer;
  }
  .fab[hidden] { display: none; }
  .fab-primary { background: linear-gradient(135deg, var(--accent-gold), var(--accent-teal)); color: var(--on-accent); border-color: transparent; }
}


/* ---------- Welcome card (MC chào + chọn chuyên đề) ---------- */
.intro-card {
  position: fixed;
  top: 90px;
  right: 18px;
  width: min(400px, calc(100vw - 36px));
  max-height: min(520px, calc(100vh - 130px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 20px 22px 16px;
  z-index: 30;
  opacity: 0;
  transform: translateX(24px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.intro-card[hidden] { display: none; }
.intro-card.open { opacity: 1; transform: translateX(0); }
.intro-close { position: absolute; top: 12px; right: 12px; padding: 6px 10px; }
.intro-title { margin: 0 34px 12px 0; font-family: var(--font-display); font-size: calc((21px) * var(--fs, 1)); }
.intro-body p { margin: 0 0 10px; font-size: calc((14px) * var(--fs, 1)); line-height: 1.65; color: #d9d4e4; }
:root[data-theme="deep"] .intro-body p { color: var(--text-primary); }
.intro-title { flex: 0 0 auto; }
/* Lời chào dài: cuộn trong khung; các nút (Bắt đầu khám phá / Để sau / MC dẫn tham quan…) luôn hiện bên dưới */
.intro-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-right: 6px; scrollbar-width: thin; scrollbar-color: var(--accent-gold) transparent; }
.intro-body::-webkit-scrollbar { width: 6px; }
.intro-body::-webkit-scrollbar-thumb { background: var(--accent-gold); border-radius: 999px; }
.intro-actions { flex: 0 0 auto; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--panel-border); }
.intro-themes { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 6px; }
.intro-theme {
  --theme-color: var(--accent-teal);
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 11px 14px;
  color: var(--text-primary);
  font: inherit;
  cursor: pointer;
  border-radius: 14px;
  border: 1px solid var(--panel-border);
  border-left: 5px solid var(--theme-color);
  background: color-mix(in srgb, var(--theme-color) 10%, transparent);
  transition: transform 0.15s ease, background 0.15s ease;
}
.intro-theme:hover { transform: translateX(3px); background: color-mix(in srgb, var(--theme-color) 22%, transparent); }
.intro-theme-icon {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: calc((18px) * var(--fs, 1));
  box-shadow: inset 0 0 0 2px var(--theme-color);
  flex-shrink: 0;
}
.intro-theme-info { display: flex; flex-direction: column; min-width: 0; }
.intro-theme-info strong { font-size: calc((14px) * var(--fs, 1)); }
.intro-theme-info small { font-size: calc((11.5px) * var(--fs, 1)); color: var(--text-muted); }
.help-btn { display: inline-flex; align-items: center; }
body.intro-open .joystick-zone { display: none; }
@media (max-width: 640px) {
  .intro-card {
    top: auto;
    right: 0;
    left: 0;
    bottom: 0;
    width: auto;
    max-height: 52dvh;
    padding: 14px 18px calc(10px + env(safe-area-inset-bottom, 0px));
    border-radius: 18px 18px 0 0;
    transform: translateY(24px);
  }
  .intro-card.open { transform: translateY(0); }
  .intro-title { font-size: calc((18px) * var(--fs, 1)); margin-bottom: 8px; }
  .intro-body p { font-size: calc((13.5px) * var(--fs, 1)); }
  .help-btn { width: 44px; height: 44px; padding: 0; justify-content: center; font-size: calc((18px) * var(--fs, 1)); }
  .help-btn .reset-view-label { display: none; }
}

/* ---- Sảnh MC: guide menu ---- */
.intro-lead { margin-top: 14px !important; font-weight: 600; color: var(--text-primary) !important; }
.intro-guides { display: flex; flex-direction: column; gap: 6px; }
.intro-guide { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 12px; border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.05); color: inherit; font: inherit; font-size: calc((13.5px) * var(--fs, 1)); text-align: left; cursor: pointer; transition: transform .15s, background .15s; }
.intro-guide:hover { transform: translateX(3px); background: rgba(255,255,255,.12); }
.intro-guide-title { flex: 1; }
.intro-guide-icon { font-size: calc((18px) * var(--fs, 1)); }
.intro-guide-go { opacity: .6; font-size: calc((18px) * var(--fs, 1)); }

/* ---- GuideTour (coach bubble + spotlight) ---- */
.coach { position: fixed; z-index: 60; top: 88px; left: 20px; width: min(360px, calc(100vw - 40px)); padding: 14px 16px; border: 1px solid rgba(255,211,77,.55); }
.coach[hidden] { display: none; }
.coach-step { font-size: calc((11.5px) * var(--fs, 1)); letter-spacing: .04em; text-transform: uppercase; color: #ffd34d; margin-bottom: 4px; }
.coach-text { margin: 0 0 10px; font-size: calc((14.5px) * var(--fs, 1)); line-height: 1.55; }
.coach-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.coach-spot { position: fixed; z-index: 70; pointer-events: none; border-radius: 14px; border: 3px solid #ffd34d; box-shadow: 0 0 0 4px rgba(255,211,77,.25), 0 0 18px rgba(255,211,77,.7); animation: coach-pulse 1.1s ease-in-out infinite; }
.coach-spot[hidden] { display: none; }
.coach-spot-arrow { position: absolute; left: 50%; top: -34px; transform: translateX(-50%); font-size: calc((26px) * var(--fs, 1)); animation: coach-bob .8s ease-in-out infinite; }
.coach-spot-arrow::before { content: '👇'; }
.coach-spot.below .coach-spot-arrow { top: auto; bottom: -36px; }
.coach-spot.below .coach-spot-arrow::before { content: '👆'; }
@keyframes coach-pulse { 50% { box-shadow: 0 0 0 9px rgba(255,211,77,.12), 0 0 26px rgba(255,211,77,.95); } }
@keyframes coach-bob { 50% { transform: translateX(-50%) translateY(6px); } }
body.touring .joystick-zone { opacity: 1; }
@media (max-width: 760px) {
  .coach { top: 64px; left: 10px; right: 10px; width: auto; padding: 10px 12px; }
  .coach-text { font-size: calc((13.5px) * var(--fs, 1)); margin-bottom: 8px; }
}
body.tour-nojoy .joystick-zone { display: none; }
@media (max-width: 760px) { .coach.bottom { top: auto; bottom: 10px; } }

/* dim everything except the spotlighted control ("follow the light") */
.coach-spot { box-shadow: 0 0 0 4px rgba(255,211,77,.3), 0 0 0 100vmax rgba(5,8,16,.55), 0 0 22px rgba(255,211,77,.8) !important; }
.coach-hand { position: fixed; z-index: 75; pointer-events: none; width: 0; height: 0; }
.coach-hand[hidden] { display: none; }
.coach-hand .hand-mover { position: absolute; left: -22px; top: -33px; display: inline-flex; gap: 6px; filter: drop-shadow(0 4px 8px rgba(0,0,0,.6)); }
.coach-hand .hand-finger { font-size: calc((46px) * var(--fs, 1)); line-height: 1; display: inline-block; }
.coach-hand .hand-ring { position: absolute; left: -62px; top: -62px; width: 124px; height: 124px; border-radius: 50%; border: 3px dashed rgba(255,211,77,.8); animation: hand-spin 6s linear infinite; }
.coach-hand .hand-tag { position: absolute; top: 56px; left: 0; transform: translateX(-50%); white-space: nowrap; background: #ffd34d; color: #231c05; font-weight: 700; font-size: calc((13px) * var(--fs, 1)); padding: 3px 10px; border-radius: 12px; }
.hand-mouse .mL, .hand-mouse .mR, .hand-mouse .mW { fill: #3a4258; }
.hand-mouse.left .mL, .hand-mouse.right .mR, .hand-mouse.wheel .mW { fill: #ffd34d; }
.coach-hand.mouse-left .hand-mover, .coach-hand.mouse-right .hand-mover, .coach-hand.touch-1 .hand-mover, .coach-hand.touch-joystick .hand-mover { animation: hand-circle 2.4s ease-in-out infinite; }
.coach-hand.touch-2 .hand-mover { animation: hand-swipe 2s ease-in-out infinite; }
.coach-hand.mouse-wheel .hand-mover { animation: hand-wheel .9s ease-in-out infinite; }
.coach-hand .pinch .hand-finger:first-child { animation: hand-pinch-a 1.8s ease-in-out infinite; }
.coach-hand .pinch .hand-finger:last-child { animation: hand-pinch-b 1.8s ease-in-out infinite; }
.coach-hand .pinch { gap: 0; left: -40px; }
@keyframes hand-spin { to { transform: rotate(360deg); } }
@keyframes hand-circle { 0% { transform: translate(0, -46px); } 25% { transform: translate(46px, 0); } 50% { transform: translate(0, 46px); } 75% { transform: translate(-46px, 0); } 100% { transform: translate(0, -46px); } }
@keyframes hand-swipe { 0%, 100% { transform: translateX(-44px); } 50% { transform: translateX(44px); } }
@keyframes hand-wheel { 0%, 100% { transform: translateY(-12px); } 50% { transform: translateY(12px); } }
@keyframes hand-pinch-a { 0%, 100% { transform: translate(-6px, 6px) rotate(-30deg); } 50% { transform: translate(-40px, 40px) rotate(-30deg); } }
@keyframes hand-pinch-b { 0%, 100% { transform: translate(6px, -6px) rotate(150deg); } 50% { transform: translate(40px, -40px) rotate(150deg); } }

.intro-device { display: flex; gap: 6px; margin: 4px 0 8px; }
.intro-device-btn { flex: 1; padding: 6px 8px; border-radius: 10px; border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.05); color: inherit; font: inherit; font-size: calc((13px) * var(--fs, 1)); cursor: pointer; }
.intro-device-btn.on { background: #ffd34d; color: #231c05; font-weight: 700; border-color: #ffd34d; }

/* pager (big themes) */
.pager { position: fixed; z-index: 20; left: 50%; bottom: 92px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 6px 12px; border-radius: 16px; }
.pager[hidden] { display: none; }
.pager-label { font-size: calc((13px) * var(--fs, 1)); white-space: nowrap; }
.pager-select { background: rgba(255,255,255,.1); color: inherit; border: 1px solid rgba(255,255,255,.25); border-radius: 10px; padding: 4px 8px; font-size: calc((13px) * var(--fs, 1)); }
.pager-select option { color: #111; }
body.lobby .pager, body.touring .pager { display: none; }
@media (max-width: 760px) { .pager { bottom: 74px; } }

/* LED wall player overlay */
.led-player { position: fixed; inset: 0; z-index: 90; background: rgba(4,6,12,.96); display: flex; flex-direction: column; }
.led-player[hidden] { display: none; }
.led-player-bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; color: #fff; }
.led-player-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 0 12px 16px; }
.led-player-stage video, .led-player-stage iframe { width: 100%; height: 100%; max-width: 1280px; border: 0; border-radius: 12px; background: #000; }

.coach-hand .hand-tapper { position: absolute; left: -22px; top: 6px; animation: hand-tap 1s ease-in-out infinite; filter: drop-shadow(0 4px 8px rgba(0,0,0,.6)); }
@keyframes hand-tap { 0%, 100% { transform: translateY(14px) scale(1); } 50% { transform: translateY(0) scale(.92); } }
.coach-actions .pill-btn[hidden] { display: none; }

/* =====================================================================
   Trợ năng · Tương phản cao · Chế độ nhẹ
   ===================================================================== */
.sr-only { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
/* danh sách hiện vật cho bàn phím: ẩn, nhưng khi nhận focus thì hiện ra đọc được */
.sr-focusable:focus, .sr-focusable:focus-within { position: fixed !important; z-index: 1200; left: 12px; top: 64px; width: min(520px, calc(100vw - 24px)); height: auto; max-height: calc(100vh - 90px); margin: 0; padding: 12px 14px; overflow: auto; clip: auto; clip-path: none; white-space: normal; border-radius: 14px; background: #fff; color: #0b1220; box-shadow: 0 12px 40px rgba(0, 0, 0, .5); }
.sr-focusable:focus h2, .sr-focusable:focus-within h2 { position: static !important; width: auto; height: auto; margin: 0 0 8px; clip: auto; clip-path: none; font-size: calc(15px * var(--fs, 1)); white-space: normal; }
.sr-focusable ul { list-style: none; margin: 0; padding: 0; }
.sr-focusable button { display: block; width: 100%; text-align: left; padding: 8px 10px; margin: 2px 0; border: 1px solid #cbd5e1; border-radius: 10px; background: #f8fafc; color: #0b1220; font: inherit; font-size: calc(14px * var(--fs, 1)); cursor: pointer; }
.skip-link { position: fixed; left: 12px; top: -60px; z-index: 1300; padding: 10px 16px; border-radius: 10px; background: #fff; color: #0b1220; font-weight: 700; text-decoration: none; box-shadow: 0 6px 24px rgba(0, 0, 0, .5); transition: top .15s; }
.skip-link:focus { top: 10px; }

:focus-visible { outline: 3px solid #ffd54a; outline-offset: 2px; }
#scene-root canvas:focus-visible { outline-offset: -4px; }

.a11y-panel { position: fixed; z-index: 1100; right: 12px; top: 64px; width: min(400px, calc(100vw - 24px)); max-height: calc(100vh - 84px); overflow: auto; padding: 16px 18px 18px; color: var(--text-primary); }
.a11y-close { position: absolute; right: 8px; top: 8px; }
.a11y-title { margin: 0 34px 12px 0; font-size: calc(18px * var(--fs, 1)); font-family: var(--font-display); }
.a11y-sub { margin: 14px 0 6px; font-size: calc(13px * var(--fs, 1)); text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.a11y-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 6px 0; }
.a11y-label { font-size: calc(14px * var(--fs, 1)); }
.a11y-ctl { display: flex; align-items: center; gap: 8px; }
.a11y-ctl .pill-btn { padding: 6px 12px; }
.a11y-fs-val { min-width: 3.2em; text-align: center; font-variant-numeric: tabular-nums; font-size: calc(14px * var(--fs, 1)); }
.a11y-ctl input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--accent-gold); }
.a11y-select { max-width: 220px; padding: 7px 10px; border-radius: 10px; border: 1px solid var(--panel-border); background: rgba(0, 0, 0, .35); color: var(--text-primary); font: inherit; font-size: calc(13.5px * var(--fs, 1)); }
.a11y-note { margin: 2px 0 0; font-size: calc(12.5px * var(--fs, 1)); line-height: 1.5; color: var(--text-muted); }
.a11y-keys { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; font-size: calc(13px * var(--fs, 1)); }
.a11y-keys dt { font-family: ui-monospace, Menlo, monospace; color: var(--accent-gold); white-space: nowrap; }
.a11y-keys dd { margin: 0; }
.lite-btn[aria-pressed="true"] { background: var(--accent-gold); color: var(--on-accent); }
.drawer-lang[data-lite-toggle][aria-pressed="true"] { background: var(--accent-gold); color: var(--on-accent); }

/* ---------- Chế độ nhẹ: bỏ làm mờ kính, bóng đổ và mọi chuyển động của giao diện ---------- */
body.lite *, body.lite *::before, body.lite *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
body.lite .glass-panel, body.lite .info-modal, body.lite .topbar, body.lite .pager, body.lite .coach, body.lite .intro-card, body.lite .a11y-panel, body.lite .mobile-drawer {
  backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
  background: color-mix(in srgb, var(--bg-void) 94%, transparent) !important;
  box-shadow: none !important;
}
body.lite * { text-shadow: none !important; }
body.lite .loader-progress { transition: width .2s linear !important; }

/* ---------- Tương phản cao: nền đen đặc, chữ trắng, viền rõ ---------- */
body.hc, :root:has(body.hc) {
  --panel-bg: #000; --panel-border: #fff; --text-primary: #fff; --text-muted: #f1f1f1;
  --accent-gold: #ffd54a; --accent-teal: #5ee6ff; --on-accent: #000; --bg-void: #000; --bg-void-2: #000;
}
body.hc .glass-panel, body.hc .info-modal, body.hc .topbar, body.hc .pager, body.hc .coach, body.hc .intro-card, body.hc .a11y-panel, body.hc .mobile-drawer, body.hc .flipbook-modal-box {
  backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
  background: #000 !important; color: #fff !important; border: 2px solid #fff !important; box-shadow: none !important;
}
body.hc .info-quote, body.hc .info-description, body.hc .info-description *, body.hc .info-eyebrow, body.hc .intro-body, body.hc .intro-body *, body.hc .coach-text, body.hc .hint, body.hc .brand-text, body.hc .pager-label, body.hc .a11y-note, body.hc .a11y-keys dd, body.hc .a11y-label { color: #fff !important; }
body.hc .icon-btn, body.hc .pill-btn, body.hc .a11y-select { background: #000 !important; color: #fff !important; border: 2px solid #fff !important; }
body.hc .pill-btn-primary, body.hc [aria-pressed="true"].icon-btn, body.hc .lite-btn[aria-pressed="true"] { background: #ffd54a !important; color: #000 !important; border-color: #ffd54a !important; }
body.hc a { color: #5ee6ff; text-decoration: underline; }
body.hc :focus-visible { outline: 4px solid #ffd54a; outline-offset: 3px; }

/* ---------- MC dẫn tham quan tự động ---------- */
.tour-bar { position: fixed; z-index: 45; left: 24px; bottom: 20px; width: min(600px, calc(100vw - 440px)); display: grid; grid-template-columns: 1fr auto; gap: 8px 14px; align-items: center; padding: 12px 16px 14px; border-radius: 18px; }
.tour-bar[hidden] { display: none; }
.tour-text { min-width: 0; }
.tour-kicker { font-size: calc((11.5px) * var(--fs, 1)); letter-spacing: .06em; text-transform: uppercase; color: var(--accent-gold); font-weight: 700; }
.tour-title { font-size: calc((16px) * var(--fs, 1)); font-weight: 700; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tour-caption { font-size: calc((13px) * var(--fs, 1)); color: var(--text-muted); line-height: 1.4; min-height: 1.4em; max-height: 4.2em; overflow: hidden; }
.tour-ctrl { display: flex; gap: 6px; }
.tour-btn { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--panel-border); background: color-mix(in srgb, var(--text-primary) 8%, transparent); color: var(--text-primary); font-size: 16px; cursor: pointer; display: grid; place-items: center; }
.tour-btn:hover:not(:disabled) { background: color-mix(in srgb, var(--accent-teal) 25%, transparent); }
.tour-btn:disabled { opacity: .35; cursor: default; }
.tour-btn-main { background: var(--accent-gold); color: var(--on-accent, #1a1204); border-color: transparent; }
.tour-btn-stop { color: #ff8a8a; }
.tour-progress { grid-column: 1 / -1; height: 4px; border-radius: 3px; background: color-mix(in srgb, var(--text-primary) 14%, transparent); overflow: hidden; }
.tour-progress i { display: block; height: 100%; width: 0; background: var(--accent-teal); transition: width .5s ease; }
@media (max-width: 900px) { .tour-bar { left: 12px; width: calc(100vw - 24px); } }
@media (max-width: 760px) { .tour-bar { bottom: auto; top: 62px; padding: 10px 12px 12px; } .tour-btn { width: 38px; height: 38px; } }
/* đang tham quan: bớt các lớp chồng nhau ở đáy màn hình */
body.autotouring .pager, body.autotouring .hint { display: none; }
body.hc .tour-bar { background: #000 !important; color: #fff !important; border: 2px solid #fff !important; backdrop-filter: none !important; }
body.hc .tour-btn { background: #000; color: #fff; border: 2px solid #fff; }
body.hc .tour-btn-main { background: #ffd54a; color: #000; }
body.hc .tour-caption { color: #fff; }
body.lite .tour-progress i { transition: none; }

/* ================= Điện thoại: thanh trên gọn — chỉ ☰ và ⋯; các công cụ nằm trong bảng bấm ⋯ mới hiện ================= */
.tools-btn { display: none; }
@media (max-width: 760px), (pointer: coarse) and (max-width: 1280px) {
  .tools-btn { display: inline-flex; position: absolute; right: 0; top: 0; width: 44px; height: 44px; padding: 0; justify-content: center; align-items: center; font-size: calc((22px) * var(--fs, 1)); line-height: 1; background: var(--panel-bg); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
  .topbar { height: 44px; }
  .topbar-actions { display: none; position: absolute; right: 0; top: 52px; margin: 0; flex-direction: column; align-items: stretch; gap: 6px; padding: 10px; width: min(250px, 72vw); max-height: calc(100dvh - 130px); overflow-y: auto; border-radius: 16px; background: var(--panel-bg); border: 1px solid var(--panel-border); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 12px 36px rgba(0, 0, 0, .45); }
  .topbar.tools-open .topbar-actions { display: flex; }
  .topbar.tools-open .tools-btn { color: var(--accent-gold); border-color: var(--accent-gold); }
  .topbar .topbar-actions .icon-btn { width: 100%; box-sizing: border-box; height: auto; min-height: 44px; padding: 8px 14px; justify-content: flex-start !important; text-align: left; gap: 10px; font-size: calc((14.5px) * var(--fs, 1)); border-radius: 12px; background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .topbar-actions .reset-view-label, .topbar-actions .theme-toggle-label { display: inline; }
  .topbar .topbar-actions .icon-audio-on { font-size: inherit; display: inline; }
  .topbar .topbar-actions .icon-audio-on::first-letter { font-size: inherit; }
  .topbar-actions .bgm-volume { display: block; width: 100%; }
  /* Chế độ nhẹ / tương phản cao: thanh trên KHÔNG có nền (trước đây bị tô đặc thành khối đen che màn hình) */
  body.lite .topbar, body.hc .topbar { background: transparent !important; border: 0 !important; box-shadow: none !important; }
  .topbar .topbar-actions .icon-btn[aria-pressed="true"].lite-btn { background: var(--accent-gold); color: var(--on-accent); }
  body.lite .topbar .topbar-actions { background: #0e131c !important; }
  body.lite .topbar-actions, body.lite .tools-btn { background: var(--panel-bg) !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
  body.hc .topbar-actions, body.hc .tools-btn { background: #000 !important; border: 2px solid #fff !important; color: #fff !important; }
}

/* Thông báo giọng đọc trong thanh tham quan */
.tour-notice { grid-column: 1 / -1; font-size: calc(12px * var(--fs, 1)); color: var(--text-muted); line-height: 1.4; }
.tour-notice:empty, .tour-notice[hidden] { display: none; }
@media (max-width: 760px) {
  .tour-bar { grid-template-columns: 1fr; gap: 6px; }
  .tour-ctrl { justify-content: center; }
  .tour-caption { max-height: 2.8em; }
  .tour-notice { font-size: calc(11px * var(--fs, 1)); margin-top: 4px; }
}

/* ---------- Gợi ý "Xem tiếp" ---------- */
.next-up { position: fixed; z-index: 29; left: 50%; bottom: 100px; width: min(640px, calc(100vw - 36px)); transform: translate(-50%, 14px); opacity: 0; padding: 10px 12px 12px; border-radius: 16px; transition: opacity .3s ease, transform .3s ease; }
.next-up[hidden] { display: none; }
.next-up.open { opacity: 1; transform: translate(-50%, 0); }
.next-up-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: calc(13px * var(--fs, 1)); color: var(--accent-gold); }
.next-up-close { background: none; border: 0; color: var(--text-muted); cursor: pointer; font-size: 14px; padding: 2px 6px; border-radius: 8px; }
.next-up-close:hover { color: var(--text-primary); }
.next-up-list { display: flex; gap: 8px; }
.next-up-item { flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 10px; text-align: left; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--panel-border); background: rgba(255,255,255,.04); color: var(--text-primary); font: inherit; cursor: pointer; transition: border-color .2s, background .2s, transform .15s; }
.next-up-item:hover, .next-up-item:focus-visible { border-color: var(--accent-gold); background: rgba(201,168,106,.1); transform: translateY(-2px); outline: none; }
.next-up-icon { font-size: calc(20px * var(--fs, 1)); flex: 0 0 auto; }
.next-up-text { display: flex; flex-direction: column; min-width: 0; }
.next-up-title { font-size: calc(13px * var(--fs, 1)); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.next-up-why { font-size: calc(11px * var(--fs, 1)); color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 760px) {
  .next-up { bottom: auto; top: 62px; transform: translate(-50%, -10px); }
  .next-up.open { transform: translate(-50%, 0); }
  .next-up-list { flex-direction: column; }
}
body.hc .next-up { background: #000 !important; color: #fff !important; border: 2px solid #fff !important; }
body.hc .next-up-item { border: 2px solid #fff !important; color: #fff !important; background: #000 !important; }
body.hc .next-up-why { color: #fff !important; }

.tilt-btn[aria-pressed="true"] { background: var(--accent-gold); color: var(--on-accent); }
@media (max-width: 760px) { .topbar .topbar-actions .icon-btn[aria-pressed="true"].tilt-btn { background: var(--accent-gold); color: var(--on-accent); } }

/* Thanh tham quan gọn: chỉ nút lùi / tiếp (thuyết minh đã có ở bảng riêng) */
.tour-bar { width: auto !important; max-width: calc(100vw - 24px); left: 16px; bottom: 16px; top: auto !important; grid-template-columns: auto !important; padding: 6px 10px !important; border-radius: 999px; gap: 0; }
.tour-bar .tour-text, .tour-bar .tour-progress, .tour-bar .tour-notice { display: none !important; }
.tour-bar .tour-ctrl { align-items: center; gap: 6px; justify-content: center; }
.tour-count { min-width: 38px; text-align: center; font-size: calc(12.5px * var(--fs, 1)); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.tour-bar .tour-btn { width: 40px; height: 40px; }
.tour-bar .tour-btn-main, .tour-bar .tour-btn-stop { width: 34px; height: 34px; font-size: 13px; }
@media (max-width: 760px) { .tour-bar { left: 10px; bottom: 12px; top: auto !important; } }

/* ---------- Màn LED tương tác (video + trắc nghiệm), khớp đúng khung LED ---------- */
.led-studio { --u: 10px; position: fixed; z-index: 44; display: flex; flex-direction: column; background: radial-gradient(120% 140% at 30% 0%, #101a33, #05070d 70%); color: #eaf2ff; overflow: hidden; opacity: 0; transition: opacity .35s ease; box-shadow: 0 0 calc(var(--u) * 2) rgba(80, 200, 255, .25); font-size: calc(var(--u) * 2.1); line-height: 1.35; }
.led-studio[hidden] { display: none; }
.led-studio.on { opacity: 1; }
.led-studio.full { z-index: 70; }
.led-studio button { font: inherit; cursor: pointer; }
.led-studio button:focus-visible { outline: 3px solid var(--accent-gold, #e6c97a); outline-offset: 2px; }
.ls-head { display: flex; align-items: center; justify-content: space-between; gap: calc(var(--u) * 1); padding: calc(var(--u) * 1) calc(var(--u) * 1.6); flex: 0 0 auto; }
.ls-tabs { display: flex; gap: calc(var(--u) * 1); }
.ls-tab { padding: calc(var(--u) * .7) calc(var(--u) * 1.8); border-radius: 999px; border: 1px solid rgba(255,255,255,.22); background: rgba(255,255,255,.06); color: #eaf2ff; font-size: calc(var(--u) * 1.9); }
.ls-tab.on { background: var(--accent-gold, #e6c97a); color: #1a1204; border-color: transparent; font-weight: 700; }
.ls-close { width: calc(var(--u) * 4); height: calc(var(--u) * 4); min-width: 34px; min-height: 34px; border-radius: 50%; border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.08); color: #fff; font-size: calc(var(--u) * 2); }
.ls-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; padding: 0 calc(var(--u) * 1.6) calc(var(--u) * 1.4); gap: calc(var(--u) * 1); }
.ls-stage { flex: 1 1 auto; min-height: 0; background: #000; border-radius: calc(var(--u) * 1); overflow: hidden; display: grid; }
.ls-stage video, .ls-stage iframe { width: 100%; height: 100%; border: 0; background: #000; object-fit: contain; }
.ls-vtitle { text-align: center; opacity: .85; font-size: calc(var(--u) * 1.9); }
.ls-list { display: flex; gap: calc(var(--u) * .8); overflow-x: auto; padding-bottom: 2px; flex: 0 0 auto; }
.ls-vid { display: inline-flex; align-items: center; gap: calc(var(--u) * .8); max-width: calc(var(--u) * 30); padding: calc(var(--u) * .7) calc(var(--u) * 1.4); border-radius: calc(var(--u) * 1); border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.06); color: #eaf2ff; font-size: calc(var(--u) * 1.7); white-space: nowrap; }
.ls-vid span { overflow: hidden; text-overflow: ellipsis; }
.ls-vid b { display: grid; place-items: center; min-width: 1.7em; height: 1.7em; border-radius: 50%; background: rgba(255,255,255,.16); font-size: .9em; }
.ls-vid.on { background: rgba(94, 230, 255, .2); border-color: #5ee6ff; }
/* trắc nghiệm */
.ls-start, .ls-result { margin: auto; width: min(100%, calc(var(--u) * 74)); display: flex; flex-direction: column; gap: calc(var(--u) * 1.2); align-items: center; text-align: center; }
.ls-big { font-size: calc(var(--u) * 3); font-weight: 800; color: var(--accent-gold, #e6c97a); }
.ls-note { opacity: .85; font-size: calc(var(--u) * 1.8); }
.ls-label { font-size: calc(var(--u) * 1.6); letter-spacing: .08em; text-transform: uppercase; opacity: .7; margin-top: calc(var(--u) * .4); }
.ls-chips { display: flex; flex-wrap: wrap; gap: calc(var(--u) * .8); justify-content: center; }
.ls-chip { padding: calc(var(--u) * .7) calc(var(--u) * 1.6); border-radius: 999px; border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.06); color: #eaf2ff; font-size: calc(var(--u) * 1.8); }
.ls-chip.on { background: #5ee6ff; color: #04202a; border-color: transparent; font-weight: 700; }
.ls-primary { padding: calc(var(--u) * 1) calc(var(--u) * 3); border-radius: 999px; border: 0; background: var(--accent-gold, #e6c97a); color: #1a1204; font-weight: 800; font-size: calc(var(--u) * 2.1); }
.ls-ghost { padding: calc(var(--u) * 1) calc(var(--u) * 2); border-radius: 999px; border: 1px solid rgba(255,255,255,.3); background: rgba(255,255,255,.07); color: #eaf2ff; font-size: calc(var(--u) * 1.9); }
.ls-q { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: calc(var(--u) * 1.2); overflow: auto; }
.ls-prog { display: grid; grid-template-columns: auto auto 1fr; gap: calc(var(--u) * 1.4); align-items: center; font-size: calc(var(--u) * 1.7); opacity: .9; }
.ls-prog i { display: block; height: calc(var(--u) * .6); border-radius: 99px; background: rgba(255,255,255,.14); overflow: hidden; }
.ls-prog u { display: block; height: 100%; background: #5ee6ff; text-decoration: none; transition: width .4s ease; }
.ls-qtext { font-size: calc(var(--u) * 2.9); font-weight: 700; line-height: 1.3; }
.ls-opts { display: grid; grid-template-columns: 1fr 1fr; gap: calc(var(--u) * 1); }
.led-studio.full .ls-opts { grid-template-columns: 1fr; }
.ls-opt { display: flex; align-items: center; gap: calc(var(--u) * 1.2); text-align: left; padding: calc(var(--u) * 1.1) calc(var(--u) * 1.4); border-radius: calc(var(--u) * 1.2); border: 2px solid rgba(255,255,255,.2); background: rgba(255,255,255,.06); color: #eaf2ff; font-size: calc(var(--u) * 2.2); transition: background .15s, border-color .15s; }
.ls-opt:hover:not(:disabled) { background: rgba(94,230,255,.16); border-color: #5ee6ff; }
.ls-opt b { flex: 0 0 auto; display: grid; place-items: center; width: 1.9em; height: 1.9em; border-radius: 50%; background: rgba(255,255,255,.14); }
.ls-opt:disabled { cursor: default; opacity: .75; }
.ls-opt.right { background: rgba(34,197,94,.28); border-color: #22c55e; opacity: 1; }
.ls-opt.wrong { background: rgba(239,68,68,.28); border-color: #ef4444; opacity: 1; }
.ls-fb { display: flex; flex-direction: column; gap: calc(var(--u) * .8); }
.ls-fb[hidden] { display: none; }
.ls-verdict { font-size: calc(var(--u) * 2.2); font-weight: 800; } .ls-verdict.ok { color: #4ade80; } .ls-verdict.bad { color: #fca5a5; }
.ls-explain { font-size: calc(var(--u) * 1.9); opacity: .92; }
.ls-fb-actions { display: flex; gap: calc(var(--u) * 1); flex-wrap: wrap; justify-content: center; margin-top: calc(var(--u) * .4); }
.ls-score { font-size: calc(var(--u) * 9); font-weight: 900; color: #5ee6ff; line-height: 1; }
.ls-wrong { width: 100%; display: flex; flex-direction: column; gap: calc(var(--u) * .8); text-align: left; }
.ls-wrong-item { display: flex; flex-direction: column; gap: 4px; padding: calc(var(--u) * 1) calc(var(--u) * 1.4); border-radius: calc(var(--u) * 1); background: rgba(255,255,255,.06); font-size: calc(var(--u) * 1.8); align-items: flex-start; }
.ls-wrong-item span { opacity: .85; }
.led-studio.full .ls-head { padding-top: max(calc(var(--u) * 1), env(safe-area-inset-top)); }
.led-studio.full { font-size: calc(var(--u) * 2.2); }
.led-studio.full .ls-score { font-size: calc(var(--u) * 7); }
@media (prefers-reduced-motion: reduce) { .led-studio, .ls-prog u { transition: none; } }

.ls-q::before, .ls-q::after { content: ''; flex: 1 1 0; }

/* ---------- Vòng AE ---------- */
.hint { display: none !important; }
html.app-fit { position: fixed; top: 0; left: 0; right: 0; width: 100%; height: var(--app-h, 100dvh); overflow: hidden; overscroll-behavior: none; }
html.app-fit body { position: fixed; top: 0; left: 0; right: 0; width: 100%; height: var(--app-h, 100dvh); overflow: hidden; overscroll-behavior: none; -webkit-overflow-scrolling: auto; }
#vh-probe { position: fixed; top: 0; bottom: 0; left: 0; width: 0; pointer-events: none; visibility: hidden; }

/* ---------- Vòng AF: điểm, huy hiệu, xếp hạng, hỏi đáp ---------- */
.ls-name { width: min(100%, calc(var(--u) * 34)); box-sizing: border-box; padding: calc(var(--u) * .9) calc(var(--u) * 1.6); border-radius: 999px; border: 1px solid rgba(255,255,255,.3); background: rgba(255,255,255,.08); color: #fff; font-size: calc(var(--u) * 1.9); text-align: center; }
.ls-name::placeholder { color: rgba(255,255,255,.55); }
.ls-weekly { display: flex; flex-direction: column; gap: 3px; align-items: center; padding: calc(var(--u) * 1) calc(var(--u) * 2); border-radius: calc(var(--u) * 1.4); border: 1px solid #e6c97a; background: linear-gradient(135deg, rgba(230,201,122,.22), rgba(94,230,255,.12)); color: #fff; font-size: calc(var(--u) * 1.7); cursor: pointer; }
.ls-weekly b { font-size: calc(var(--u) * 2.2); color: #e6c97a; }
.ls-badges, .ls-newbadges { display: flex; flex-wrap: wrap; gap: calc(var(--u) * .8); justify-content: center; }
.ls-badge { display: inline-flex; align-items: center; gap: .4em; padding: calc(var(--u) * .6) calc(var(--u) * 1.2); border-radius: 999px; border: 1px dashed rgba(255,255,255,.25); font-size: calc(var(--u) * 1.6); opacity: .55; }
.ls-badge i { font-style: normal; }
.ls-badge.got { opacity: 1; border: 1px solid #e6c97a; background: rgba(230,201,122,.16); color: #fff3cf; }
.ls-newbadges .ls-badge { animation: ls-pop .6s ease both; }
@keyframes ls-pop { from { transform: scale(.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.ls-rank-list { width: 100%; display: flex; flex-direction: column; gap: calc(var(--u) * .5); }
.ls-rank-row { display: grid; grid-template-columns: 2.4em 1fr auto; align-items: center; gap: calc(var(--u) * 1); padding: calc(var(--u) * .7) calc(var(--u) * 1.4); border-radius: calc(var(--u) * 1); background: rgba(255,255,255,.07); font-size: calc(var(--u) * 1.9); text-align: left; }
.ls-rank-row.me { outline: 2px solid #5ee6ff; }
.ls-rank-row em { font-style: normal; font-weight: 800; color: #5ee6ff; }
.ls-rank-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .ls-newbadges .ls-badge { animation: none; } }

/* Hỏi về cuốn sách */
.qa-btn { margin-top: 10px; }
.qa-box { margin-top: 10px; padding: 10px; border-radius: 12px; border: 1px solid var(--panel-border); background: rgba(255,255,255,.05); display: flex; flex-direction: column; gap: 8px; }
.qa-box[hidden] { display: none; }
.qa-row { display: flex; gap: 6px; }
.qa-row input { flex: 1; min-width: 0; padding: 9px 12px; border-radius: 999px; border: 1px solid var(--panel-border); background: rgba(255,255,255,.08); color: var(--text-primary); font-size: calc(13px * var(--fs, 1)); }
.qa-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.qa-chips button { padding: 5px 10px; border-radius: 999px; border: 1px solid var(--panel-border); background: transparent; color: var(--text-muted); font-size: calc(12px * var(--fs, 1)); cursor: pointer; }
.qa-chips button:hover { color: var(--accent-gold); border-color: var(--accent-gold); }
.qa-a { font-size: calc(13.5px * var(--fs, 1)); line-height: 1.55; white-space: pre-wrap; }
.qa-a.err { color: #fca5a5; }
.qa-note { font-size: calc(11px * var(--fs, 1)); opacity: .65; }

/* Thanh trên máy tính: màn vừa (≤1500px) chỉ giữ chữ cho các nút chính, còn lại là biểu tượng — không tràn mép phải */
@media (min-width: 761px) and (max-width: 1500px) and (pointer: fine) {
  .topbar-actions { gap: 6px; }
  .topbar-actions .icon-btn { padding: 8px 11px; }
  .led-open-btn .reset-view-label, .autotour-btn .reset-view-label, .tilt-btn .reset-view-label, .lite-btn .reset-view-label, .a11y-btn .reset-view-label { display: none; }
}

/* Thông báo tự bật chế độ nhẹ */
.perf-toast { position: fixed; z-index: 90; left: 50%; bottom: 96px; transform: translate(-50%, 14px); max-width: min(560px, calc(100vw - 32px)); padding: 10px 16px; border-radius: 14px; background: rgba(12, 16, 28, .94); border: 1px solid var(--accent-teal, #7fd8c4); color: #fff; font-size: calc(13px * var(--fs, 1)); line-height: 1.45; opacity: 0; transition: opacity .35s, transform .35s; text-align: center; pointer-events: none; }
.perf-toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Sự kiện: banner thông báo + trang chào ---------- */
.event-banners { position: fixed; z-index: 24; top: 84px; left: 50%; transform: translateX(-50%); width: min(560px, calc(100vw - 24px)); display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.event-banner { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 14px; color: #fff; font-size: calc(13.5px * var(--fs, 1)); line-height: 1.4; box-shadow: 0 8px 24px rgba(0,0,0,.4); border: 1px solid rgba(255,255,255,.25); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); animation: evIn .4s ease; }
.event-banner.tone-festive, .event-welcome-card.tone-festive { --ev: linear-gradient(120deg, #b3122b, #e0a21b); }
.event-banner.tone-info, .event-welcome-card.tone-info { --ev: linear-gradient(120deg, #1d4ed8, #0e9aa7); }
.event-banner.tone-warn, .event-welcome-card.tone-warn { --ev: linear-gradient(120deg, #c2410c, #f59e0b); }
.event-banner { background: var(--ev); }
.event-banner-img { height: 40px; max-width: 120px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.event-banner-text { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.event-banner-link { color: #fff; text-decoration: underline; white-space: nowrap; font-size: .92em; }
.event-banner-x { border: 0; background: rgba(0,0,0,.25); color: #fff; width: 26px; height: 26px; border-radius: 50%; cursor: pointer; flex-shrink: 0; font-size: 12px; }
@keyframes evIn { from { opacity: 0; transform: translateY(-8px); } }
.event-welcome { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(5,8,18,.72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); opacity: 0; transition: opacity .22s ease; }
.event-welcome.open { opacity: 1; } .event-welcome.closing { opacity: 0; }
.event-welcome-card { width: min(520px, 100%); max-height: min(86vh, 100%); overflow-y: auto; border-radius: 22px; background: #14192a; color: #f2eee4; border: 1px solid rgba(255,255,255,.18); box-shadow: 0 24px 80px rgba(0,0,0,.6); display: flex; flex-direction: column; }
.event-welcome-card::before { content: ""; display: block; height: 6px; background: var(--ev); flex-shrink: 0; }
.event-welcome-img { width: 100%; max-height: 38vh; object-fit: cover; display: block; }
.event-welcome-title { margin: 18px 22px 8px; font-family: var(--font-display); font-size: calc(24px * var(--fs, 1)); line-height: 1.25; overflow-wrap: anywhere; }
.event-welcome-body { margin: 0 22px; font-size: calc(14.5px * var(--fs, 1)); line-height: 1.7; color: #d9d4e4; }
.event-welcome-body p { margin: 0 0 10px; overflow-wrap: anywhere; }
.event-welcome-btn { margin: 14px 22px 20px; align-self: flex-start; }
@media (max-width: 640px) { .event-banners { top: 66px; } }
@media (prefers-reduced-motion: reduce) { .event-banner { animation: none; } .event-welcome { transition: none; } }
.about-card { width: min(540px, 100%); }
.about-list { margin: 4px 22px 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 14px; font-size: calc(14px * var(--fs, 1)); }
.about-list dt { color: #aab3c8; font-size: .9em; } .about-list dd { margin: 0; overflow-wrap: anywhere; color: #f2eee4; }
.about-list a { color: var(--accent-gold, #e6c97a); }
.about-sec { margin: 14px 22px 0; }
.about-sec > .about-list { margin: 0; }
.about-h { margin: 0 0 8px; font-size: calc(11.5px * var(--fs, 1)); letter-spacing: .09em; text-transform: uppercase; color: var(--accent-gold, #e6c97a); font-weight: 700; }
.about-addrs { display: grid; gap: 8px; }
.about-addr { padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); }
.about-addr-label { font-size: calc(12px * var(--fs, 1)); font-weight: 700; color: #aab3c8; margin-bottom: 3px; }
.about-addr-text { white-space: pre-line; overflow-wrap: anywhere; line-height: 1.55; font-size: calc(14px * var(--fs, 1)); color: #f2eee4; }
.about-links { display: flex; flex-wrap: wrap; gap: 8px; }
.about-link { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 999px; background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.18); color: #f2eee4; text-decoration: none; font-size: calc(13.5px * var(--fs, 1)); font-weight: 600; }
.about-link:hover, .about-link:focus-visible { border-color: var(--accent-gold, #e6c97a); background: rgba(230,201,122,.14); }
.about-rich { overflow-wrap: anywhere; }
.about-rich p, .about-rich div { margin: 0 0 .7em; }
.about-rich ul, .about-rich ol { margin: 0 0 .8em; padding-left: 1.4em; }
.about-rich li { margin: .25em 0; }
.about-rich > :last-child { margin-bottom: 0; }
.about-meta { margin-top: 14px; }
.about-note { margin: 12px 22px 0; font-size: calc(13.5px * var(--fs, 1)); line-height: 1.6; color: #d9d4e4; }
.about-copy { margin: 14px 22px 0; font-size: calc(12px * var(--fs, 1)); line-height: 1.5; color: #98a2bb; }
@media (max-width: 480px) { .about-list { grid-template-columns: minmax(0, 1fr); gap: 2px; } .about-list dd { margin-bottom: 8px; } }

/* ---------- Chế độ DỄ ĐỌC (người cao tuổi / nhìn kém): bật ở ♿ Trợ năng ---------- */
body.easy { line-height: 1.7; letter-spacing: .015em; word-spacing: .06em; }
body.easy .icon-btn, body.easy .pill-btn, body.easy button { min-height: 48px; min-width: 48px; font-size: max(1em, 16px); }
body.easy .icon-btn { font-size: calc(20px * var(--fs, 1)); }
body.easy .info-description, body.easy .info-quote, body.easy .intro-body, body.easy p, body.easy li { font-size: calc(17px * var(--fs, 1)); line-height: 1.75; }
body.easy :focus-visible { outline: 4px solid #ffd54a; outline-offset: 3px; }
body.easy a { text-decoration: underline; text-underline-offset: 3px; }
body.easy input, body.easy select, body.easy textarea { min-height: 48px; font-size: max(1em, 16px); }
body.easy * { scroll-behavior: auto !important; }
body.easy .hint { display: none; }
.a11y-easy-row { background: rgba(255, 213, 74, .12); border-radius: 12px; padding: 8px 10px; }
.a11y-row input[type=checkbox] { width: 26px; height: 26px; accent-color: #ffd54a; }

/* ---------- Tủ sách của tôi (yêu thích / đã đọc) ---------- */
.info-mark { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 8px; }
.info-mark .pill-btn { flex: 1 1 auto; }
.info-mark [hidden] { display: none; }
.shelf-count:not(:empty) { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent-gold); color: var(--on-accent, #000); font-size: 11px; line-height: 18px; text-align: center; }
.shelf-panel { max-height: min(78dvh, 640px); overflow: auto; }
.shelf-tabs { display: flex; gap: 8px; margin: 6px 0 10px; flex-wrap: wrap; }
.shelf-list { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.shelf-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--panel-border); border-radius: 12px; }
.shelf-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.shelf-open { background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; padding: 4px 2px; font-weight: 600; }
.shelf-open:hover:not(:disabled) { color: var(--accent-gold); text-decoration: underline; }
.shelf-sub { font-size: 12px; opacity: .7; padding: 0 2px; }

#amb-toggle.is-off { opacity: 0.55; }

/* ---------- AR (ArViewer.js) ---------- */
.ar-overlay { position: fixed; inset: 0; z-index: 400; display: grid; place-items: center; padding: 12px; background: rgba(4, 6, 14, 0.86); } /* không dùng backdrop-filter: nó làm hỏng lớp phủ AR (WebXR) trên Chrome Android */
.ar-card { width: min(720px, 100%); max-height: 100%; display: flex; flex-direction: column; gap: 8px; padding: 12px; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; filter: none; transform: none; }
.ar-overlay.ar-live, .ar-overlay.ar-live .ar-card { background: transparent !important; box-shadow: none; }
.ar-overlay.ar-live .ar-stage { overflow: visible; border-radius: 0; background: transparent; }
.ar-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ar-title { font-family: var(--font-display); font-size: 1.15rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ar-stage { position: relative; height: min(62vh, 520px); border-radius: 12px; overflow: hidden; background: rgba(0, 0, 0, 0.35); }
.ar-stage model-viewer { width: 100%; height: 100%; --poster-color: transparent; background: transparent; }
.ar-rot { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.ar-rot-btn { min-width: 40px; height: 40px; padding: 0 10px; font-size: 1.1rem; }
.ar-rot-slider { flex: 1 1 auto; min-width: 80px; accent-color: var(--accent-gold); }
.ar-rot-deg { min-width: 3.2em; text-align: right; font-variant-numeric: tabular-nums; font-size: 0.85rem; color: var(--text-muted); }
.ar-go { position: absolute; right: 12px; bottom: 12px; }
.ar-note { margin: 0; font-size: 0.85rem; color: var(--text-muted); line-height: 1.45; }

/* ---------- Điều khiển rảnh tay (HandsFree.js) ---------- */
.hf-panel { position: fixed; left: 14px; bottom: 14px; z-index: 350; width: min(360px, calc(100vw - 28px)); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.hf-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hf-row { display: flex; flex-direction: column; gap: 4px; }
.hf-sw { display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.hf-sw input { width: 20px; height: 20px; accent-color: var(--accent-gold); }
.hf-hint, .hf-privacy { margin: 0; font-size: 0.8rem; line-height: 1.4; color: var(--text-muted); }
.hf-privacy { font-size: 0.72rem; opacity: 0.85; }
.hf-video { width: 100%; max-height: 150px; border-radius: 10px; background: #000; transform: scaleX(-1); object-fit: cover; }
.hf-status { margin: 0; min-height: 1.3em; font-size: 0.9rem; color: var(--accent-gold); }
.hf-status.bad { color: #ff9b8a; }
.hf-chip { position: fixed; left: 14px; bottom: 14px; z-index: 349; border: 1px solid var(--panel-border); background: var(--panel-bg); color: var(--text-primary); border-radius: 999px; padding: 8px 14px; font: inherit; font-size: 0.85rem; cursor: pointer; backdrop-filter: blur(10px); }
@media (max-width: 640px) { .hf-panel { bottom: 76px; } .hf-chip { bottom: 76px; } }

/* ---------- Kiosk (Kiosk.js) ---------- */
body.kiosk { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; overscroll-behavior: none; }
body.kiosk input, body.kiosk textarea { -webkit-user-select: text; user-select: text; }
body.kiosk a[href^="http"] { pointer-events: none; text-decoration: none; }
.kiosk-warn { position: fixed; inset: 0; z-index: 900; display: grid; place-items: center; background: rgba(4, 6, 14, 0.6); backdrop-filter: blur(5px); }
.kiosk-card { width: min(520px, calc(100vw - 32px)); padding: 26px 28px; text-align: center; display: flex; flex-direction: column; gap: 12px; }
.kiosk-q { font-family: var(--font-display); font-size: 2rem; }
.kiosk-sub { color: var(--text-muted); font-size: 1.05rem; line-height: 1.5; }
.kiosk-sub b { color: var(--accent-gold); font-size: 1.3em; }
.kiosk-bar { height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.kiosk-bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--accent-gold), var(--accent-teal)); transition: width 1s linear; }

.search-result-sem { color: var(--accent-gold); font-style: normal; }
