/**
 * Metaphysics OS — Meta Wow UX Layer v1
 * Additive visual system: clarity, hierarchy, delight.
 * Does not replace engines; enhances chrome + flow.
 * Cache: meta-wow-v1
 */

/* ═══════════════════════════════════════════════════════════
   Design tokens (extend existing :root)
   ═══════════════════════════════════════════════════════════ */
:root {
  --mw-radius: 18px;
  --mw-radius-sm: 12px;
  --mw-radius-pill: 999px;
  --mw-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --mw-glow: 0 0 40px rgba(167, 139, 250, 0.18);
  --mw-glass: rgba(18, 10, 34, 0.72);
  --mw-glass-border: rgba(167, 139, 250, 0.32);
  --mw-gold: #f0c14b;
  --mw-violet: #a78bfa;
  --mw-safe-b: env(safe-area-inset-bottom, 0px);
  --mw-safe-t: env(safe-area-inset-top, 0px);
  --mw-dock-h: 68px;
}

body.theme-light {
  --mw-glass: rgba(255, 255, 255, 0.82);
  --mw-glass-border: rgba(109, 40, 217, 0.22);
  --mw-glow: 0 0 32px rgba(109, 40, 217, 0.12);
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ═══════════════════════════════════════════════════════════
   Elevated glass & surfaces
   ═══════════════════════════════════════════════════════════ */
body.meta-wow .glass-panel {
  border-radius: var(--mw-radius);
  border-color: var(--mw-glass-border);
  background: linear-gradient(
    165deg,
    rgba(42, 16, 54, 0.88) 0%,
    rgba(12, 6, 22, 0.92) 100%
  );
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 0 0 1px rgba(167, 139, 250, 0.08),
    0 24px 48px rgba(0, 0, 0, 0.45),
    var(--mw-glow);
  transition: border-color 0.35s var(--mw-ease), box-shadow 0.35s var(--mw-ease),
    transform 0.35s var(--mw-ease);
}

body.theme-light.meta-wow .glass-panel {
  background: linear-gradient(
    165deg,
    rgba(255, 255, 255, 0.92) 0%,
    rgba(246, 239, 241, 0.95) 100%
  );
}

body.meta-wow .glass-card {
  border-radius: var(--mw-radius-sm);
  transition: transform 0.3s var(--mw-ease), border-color 0.3s, box-shadow 0.3s;
}

body.meta-wow .glass-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35), 0 0 24px rgba(167, 139, 250, 0.12);
}

body.meta-wow .btn-epic {
  border-radius: var(--mw-radius-sm);
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: linear-gradient(
    135deg,
    rgba(109, 40, 217, 0.25),
    rgba(167, 139, 250, 0.12)
  );
  border: 1px solid rgba(167, 139, 250, 0.55);
}

body.meta-wow .btn-epic:hover {
  background: linear-gradient(135deg, #a78bfa, #c4b5fd);
  color: #07050f;
}

body.meta-wow .btn-ghost {
  border-radius: var(--mw-radius-sm);
  min-height: 44px;
}

body.meta-wow .magic-input:focus,
body.meta-wow .magic-select:focus {
  outline: 2px solid rgba(167, 139, 250, 0.45);
  outline-offset: 2px;
}

/* ═══════════════════════════════════════════════════════════
   Command Center (replaces dense academic header)
   ═══════════════════════════════════════════════════════════ */
.mw-command {
  position: relative;
  margin: 0 auto 1.75rem;
  max-width: 1100px;
  padding: 1.35rem 1.35rem 1.25rem;
  border-radius: calc(var(--mw-radius) + 4px);
  border: 1px solid rgba(167, 139, 250, 0.35);
  background:
    radial-gradient(ellipse 80% 90% at 10% -20%, rgba(167, 139, 250, 0.22), transparent 55%),
    radial-gradient(ellipse 60% 70% at 95% 120%, rgba(240, 193, 75, 0.08), transparent 50%),
    linear-gradient(160deg, rgba(28, 12, 42, 0.95), rgba(8, 4, 16, 0.98));
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.4), var(--mw-glow);
  overflow: hidden;
  animation: mw-rise 0.65s var(--mw-ease) both;
}

body.theme-light .mw-command {
  background:
    radial-gradient(ellipse 80% 90% at 10% -20%, rgba(167, 139, 250, 0.15), transparent 55%),
    linear-gradient(160deg, #fff, #f6eff1);
}

.mw-command::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23a78bfa' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
  opacity: 0.7;
}

@keyframes mw-rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.mw-command-inner {
  position: relative;
  z-index: 1;
}

.mw-command-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
}

.mw-eyebrow {
  font-family: "Cinzel Decorative", Cinzel, serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--mw-violet);
  margin-bottom: 0.4rem;
}

.mw-title {
  font-family: var(--font-display), Cinzel, serif !important;
  font-size: clamp(1.45rem, 4vw, 2.1rem) !important;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.15;
  margin: 0 0 0.45rem;
  background: linear-gradient(120deg, #f5f3ff 20%, #a78bfa 55%, #f0c14b 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
}

body.theme-light .mw-title {
  background: linear-gradient(120deg, #2e1065 10%, #6d28d9 50%, #8f6e14 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

.mw-lede {
  margin: 0;
  max-width: 36rem;
  font-size: 0.82rem;
  line-height: 1.65;
  color: rgba(245, 243, 255, 0.62);
  font-weight: 500;
}

body.theme-light .mw-lede {
  color: rgba(47, 30, 33, 0.7);
}

.mw-live-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.9rem;
  border-radius: var(--mw-radius-pill);
  border: 1px solid rgba(240, 193, 75, 0.35);
  background: rgba(240, 193, 75, 0.08);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--mw-gold);
  white-space: nowrap;
  backdrop-filter: blur(8px);
}

.mw-live-chip .mw-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 10px #10b981;
  animation: mw-pulse 1.8s ease-in-out infinite;
}

@keyframes mw-pulse {
  0%,
  100% {
    opacity: 0.55;
    transform: scale(0.9);
  }
  50% {
    opacity: 1;
    transform: scale(1.15);
  }
}

/* Path steps */
.mw-path {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.65rem;
  margin-bottom: 1rem;
}

@media (max-width: 720px) {
  .mw-path {
    grid-template-columns: repeat(2, 1fr);
  }
}

.mw-step {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.75rem 0.85rem;
  border-radius: var(--mw-radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.28);
  cursor: pointer;
  text-align: left;
  color: inherit;
  transition: all 0.28s var(--mw-ease);
  font-family: inherit;
}

.mw-step:hover,
.mw-step:focus-visible {
  border-color: rgba(167, 139, 250, 0.45);
  background: rgba(167, 139, 250, 0.1);
  transform: translateY(-2px);
  outline: none;
}

.mw-step.is-done {
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.06);
}

.mw-step.is-active {
  border-color: rgba(167, 139, 250, 0.55);
  box-shadow: 0 0 20px rgba(167, 139, 250, 0.15);
}

.mw-step-num {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 900;
  background: rgba(167, 139, 250, 0.18);
  color: var(--mw-violet);
  border: 1px solid rgba(167, 139, 250, 0.35);
}

.mw-step.is-done .mw-step-num {
  background: rgba(16, 185, 129, 0.25);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.4);
}

.mw-step-body strong {
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
  color: #f5f3ff;
}

body.theme-light .mw-step-body strong {
  color: #2f1e21;
}

.mw-step-body span {
  display: block;
  font-size: 10px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.45);
}

body.theme-light .mw-step-body span {
  color: rgba(47, 30, 33, 0.55);
}

/* Quick launch tiles */
.mw-launches {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.55rem;
}

@media (max-width: 720px) {
  .mw-launches {
    grid-template-columns: repeat(2, 1fr);
  }
}

.mw-launch {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  padding: 0.85rem 0.9rem;
  border-radius: var(--mw-radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  color: inherit;
  font-family: inherit;
  transition: all 0.28s var(--mw-ease);
  min-height: 72px;
}

.mw-launch:hover,
.mw-launch:focus-visible {
  border-color: rgba(167, 139, 250, 0.5);
  background: rgba(167, 139, 250, 0.12);
  transform: translateY(-2px);
  outline: none;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25);
}

.mw-launch i {
  font-size: 1rem;
  color: var(--mw-violet);
}

.mw-launch b {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.mw-launch small {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.4);
  line-height: 1.35;
}

body.theme-light .mw-launch small {
  color: rgba(47, 30, 33, 0.5);
}

/* Hide legacy long header when command center is live */
body.meta-wow .mw-legacy-header-hidden {
  display: none !important;
}

/* ═══════════════════════════════════════════════════════════
   Sticky icon tab rail
   ═══════════════════════════════════════════════════════════ */
.mw-tab-shell {
  position: sticky;
  top: 64px;
  z-index: 40;
  margin-bottom: 0.75rem;
  padding: 0.55rem 0.55rem 0.45rem;
  border-radius: var(--mw-radius);
  border: 1px solid rgba(167, 139, 250, 0.22);
  background: rgba(7, 5, 15, 0.78);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

body.theme-light .mw-tab-shell {
  background: rgba(253, 251, 252, 0.88);
}

.mw-tab-groups {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.mw-tab-group-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(196, 181, 253, 0.45);
  padding: 0 0.35rem;
  margin-top: 0.15rem;
}

.mw-tab-row {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.mw-tab-row::-webkit-scrollbar {
  display: none;
}

body.meta-wow .tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.85rem;
  border-radius: var(--mw-radius-pill);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  border: 1px solid transparent;
  white-space: nowrap;
  flex-shrink: 0;
  min-height: 40px;
}

body.meta-wow .tab-btn .mw-tab-ico {
  font-size: 12px;
  opacity: 0.85;
}

body.meta-wow .tab-btn:hover {
  border-color: rgba(167, 139, 250, 0.25);
}

body.meta-wow .tab-btn.active {
  color: #07050f;
  background: linear-gradient(135deg, #a78bfa, #c4b5fd);
  box-shadow: 0 0 18px rgba(167, 139, 250, 0.45);
  border-color: transparent;
}

body.meta-wow .tab-btn .mw-tab-full {
  display: none;
}

@media (min-width: 1100px) {
  body.meta-wow .tab-btn .mw-tab-short {
    display: none;
  }
  body.meta-wow .tab-btn .mw-tab-full {
    display: inline;
  }
}

.mw-tab-shell .depth-filter-container {
  margin-top: 0.45rem;
  align-self: flex-end;
}

.mw-tab-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.mw-crumb {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(196, 181, 253, 0.55);
  padding: 0.25rem 0.5rem;
}

.mw-crumb strong {
  color: var(--mw-violet);
  font-weight: 900;
}

/* ═══════════════════════════════════════════════════════════
   Sidebar: collapsible drawer on mobile
   ═══════════════════════════════════════════════════════════ */
.mw-side-label {
  display: none;
}

.mw-side-head {
  display: none;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  padding: 0.25rem 0.15rem 0.75rem;
  border-bottom: 1px solid rgba(167, 139, 250, 0.2);
}

.mw-side-head-title {
  font-family: var(--font-display), Cinzel, serif;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mw-violet);
}

.mw-side-close {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.mw-side-close:hover {
  border-color: rgba(167, 139, 250, 0.45);
  color: var(--mw-violet);
}

@media (max-width: 1023px) {
  body.meta-wow:not(.meta-journey-veil) .mw-side-head {
    display: flex;
  }
}

@media (max-width: 1023px) {
  /* Flatten grid so drawer does not reserve a column */
  body.meta-wow:not(.meta-journey-veil) .main-container > .grid.lg\\:grid-cols-12 {
    display: block !important;
  }

  body.meta-wow.meta-mode-lab #mw-coord-side,
  body.meta-wow:not(.meta-journey-veil) #mw-coord-side {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(92vw, 380px);
    z-index: 90;
    overflow-y: auto;
    padding: calc(72px + var(--mw-safe-t)) 14px calc(24px + var(--mw-safe-b));
    background: rgba(7, 5, 15, 0.96);
    border-right: 1px solid rgba(167, 139, 250, 0.3);
    box-shadow: 24px 0 60px rgba(0, 0, 0, 0.55);
    transform: translateX(-105%);
    transition: transform 0.4s var(--mw-ease);
    pointer-events: none;
  }

  body.meta-wow.mw-side-open #mw-coord-side {
    transform: translateX(0);
    pointer-events: auto;
  }

  .mw-side-backdrop {
    position: fixed;
    inset: 0;
    z-index: 85;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
  }

  body.meta-wow.mw-side-open .mw-side-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  body.meta-wow:not(.meta-journey-veil) .main-container .grid.lg\\:grid-cols-12 > .lg\\:col-span-8,
  body.meta-wow:not(.meta-journey-veil) #mw-coord-side + .lg\\:col-span-8 {
    width: 100% !important;
    max-width: 100%;
  }
}

.mw-fab-coord {
  display: none;
  position: fixed;
  right: 16px;
  bottom: calc(var(--mw-dock-h) + 16px + var(--mw-safe-b));
  z-index: 70;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid rgba(167, 139, 250, 0.55);
  background: linear-gradient(145deg, #a78bfa, #6d28d9);
  color: #07050f;
  font-size: 1.15rem;
  box-shadow: 0 12px 32px rgba(109, 40, 217, 0.45), 0 0 24px rgba(167, 139, 250, 0.3);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s var(--mw-ease);
}

.mw-fab-coord:hover {
  transform: scale(1.06);
}

@media (max-width: 1023px) {
  body.meta-wow:not(.meta-journey-veil) .mw-fab-coord {
    display: flex;
  }
}

body.meta-journey-veil .mw-fab-coord,
body.mj-open .mw-fab-coord {
  display: none !important;
}

/* ═══════════════════════════════════════════════════════════
   Mobile bottom dock (Lab mode)
   ═══════════════════════════════════════════════════════════ */
.mw-dock {
  display: none;
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(10px + var(--mw-safe-b));
  z-index: 65;
  height: var(--mw-dock-h);
  padding: 6px 8px;
  border-radius: 20px;
  border: 1px solid rgba(167, 139, 250, 0.35);
  background: rgba(10, 6, 20, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 30px rgba(167, 139, 250, 0.12);
  align-items: stretch;
  justify-content: space-around;
  gap: 2px;
}

body.theme-light .mw-dock {
  background: rgba(255, 255, 255, 0.94);
}

@media (max-width: 1023px) {
  body.meta-wow:not(.meta-journey-veil):not(.mj-open) .mw-dock {
    display: flex;
  }

  body.meta-wow:not(.meta-journey-veil) .main-container {
    padding-bottom: calc(var(--mw-dock-h) + 36px + var(--mw-safe-b)) !important;
  }

  body.meta-wow:not(.meta-journey-veil) .toast {
    bottom: calc(var(--mw-dock-h) + 28px + var(--mw-safe-b));
  }
}

.mw-dock-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: none;
  background: transparent;
  color: rgba(196, 181, 253, 0.55);
  border-radius: 14px;
  cursor: pointer;
  font-family: inherit;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  transition: all 0.2s;
  min-width: 0;
  padding: 4px 2px;
}

.mw-dock-btn i {
  font-size: 15px;
}

.mw-dock-btn.active,
.mw-dock-btn:hover {
  color: #07050f;
  background: linear-gradient(135deg, #a78bfa, #c4b5fd);
}

.mw-dock-btn span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════
   Panel section headers & empty-state polish
   ═══════════════════════════════════════════════════════════ */
body.meta-wow .sec-title {
  letter-spacing: 0.14em;
  border-bottom-color: rgba(167, 139, 250, 0.15);
}

body.meta-wow .hud-alert.info {
  border-radius: var(--mw-radius-sm);
  background: linear-gradient(
    100deg,
    rgba(167, 139, 250, 0.1),
    rgba(167, 139, 250, 0.03)
  );
}

body.meta-wow .bazi-pillar[data-hero="1"] {
  box-shadow: 0 0 28px rgba(167, 139, 250, 0.2);
  position: relative;
}

body.meta-wow .bazi-pillar[data-hero="1"]::after {
  content: "日主";
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.1em;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(167, 139, 250, 0.25);
  color: var(--mw-violet);
}

html[lang="en"] body.meta-wow .bazi-pillar[data-hero="1"]::after,
body.meta-wow.lang-en .bazi-pillar[data-hero="1"]::after {
  content: "DAY";
}

/* Tab content entrance */
body.meta-wow .tab-content:not(.hidden) {
  animation: mw-panel-in 0.4s var(--mw-ease) both;
}

@keyframes mw-panel-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Gate polish */
body.meta-wow .gate-card {
  border-radius: 20px;
  border-color: rgba(167, 139, 250, 0.4);
  box-shadow: 0 40px 80px rgba(0, 0, 0, 0.65), 0 0 60px rgba(167, 139, 250, 0.15);
}

body.meta-wow #boot .boot-orb {
  box-shadow: 0 0 80px rgba(167, 139, 250, 0.5);
}

/* Mystic journey hero elevation (Lab + Journey) */
body.meta-wow .mj-hero {
  border-radius: 22px !important;
  border: 1px solid rgba(167, 139, 250, 0.35) !important;
  overflow: hidden;
  margin-bottom: 1.25rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35), 0 0 40px rgba(167, 139, 250, 0.1);
}

body.meta-wow .mj-hero-primary {
  min-height: 48px !important;
  border-radius: 14px !important;
  font-weight: 900 !important;
}

body.meta-wow .mj-hero-ghost {
  min-height: 48px !important;
  border-radius: 14px !important;
}

/* Depth filter plain-language tooltips via title already; visual polish */
body.meta-wow .depth-btn {
  min-height: 34px;
  padding: 6px 12px;
}

/* Main container spacing under sticky navbar */
body.meta-wow .main-container {
  padding-top: 88px;
}

@media (max-width: 768px) {
  body.meta-wow .main-container {
    padding-top: 76px;
  }

  body.meta-wow .mw-tab-shell {
    top: 56px;
    margin-left: -4px;
    margin-right: -4px;
    border-radius: 14px;
  }

  body.meta-wow h1 {
    font-size: clamp(1.35rem, 6vw, 1.85rem) !important;
  }
}

/* Focus visible for a11y */
body.meta-wow .tab-btn:focus-visible,
body.meta-wow .depth-btn:focus-visible,
body.meta-wow .btn-epic:focus-visible,
body.meta-wow .btn-ghost:focus-visible,
body.meta-wow .mw-dock-btn:focus-visible {
  outline: 2px solid rgba(167, 139, 250, 0.7);
  outline-offset: 2px;
}

/* Journey veil: pure portal — Lab chrome (command + tabs) stays hidden */
body.meta-journey-veil .mw-command,
body.meta-journey-veil .mw-tab-shell,
body.meta-journey-veil .mw-next-strip {
  display: none !important;
}

/* Journey hero: more cinematic breathing room */
body.meta-journey-veil .mj-hero-veil-focus {
  animation: mw-rise 0.7s var(--mw-ease) both;
}

body.meta-journey-veil .main-container {
  padding-top: 100px;
}

/* Status energy panel readability */
body.meta-wow #status-energy-panel {
  border-radius: 12px;
}

/* Soft scroll margin so sticky bar doesn't cover headings */
body.meta-wow .tab-content {
  scroll-margin-top: 140px;
}

/* Gallery polish */
body.meta-wow .gallery-item {
  border-radius: 16px;
}

/* Loading shimmer for async zones */
.mw-shimmer {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.03) 0%,
    rgba(167, 139, 250, 0.1) 50%,
    rgba(255, 255, 255, 0.03) 100%
  );
  background-size: 200% 100%;
  animation: mw-shimmer 1.4s ease infinite;
}

@keyframes mw-shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

/* Compact "where next" strip inside observatory */
.mw-next-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.mw-next-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border-radius: var(--mw-radius-pill);
  border: 1px solid rgba(167, 139, 250, 0.3);
  background: rgba(167, 139, 250, 0.08);
  color: var(--mw-violet);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.mw-next-chip:hover {
  background: rgba(167, 139, 250, 0.2);
  transform: translateY(-1px);
}

/* Print: hide chrome */
@media print {
  .mw-dock,
  .mw-fab-coord,
  .mw-side-backdrop,
  .mw-tab-shell,
  #bgCanvas,
  .aurora {
    display: none !important;
  }
}

/* ═══════════════════════════════════════════════════════════
   Meta Wow UX Layer v2 — all surfaces
   ═══════════════════════════════════════════════════════════ */
:root { --mw-context-h: 44px; }

body.meta-wow-v2 { --mw-version: 'v2'; }

/* Sticky context strip */
.mw-context {
  position: sticky;
  top: 56px;
  z-index: 45;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin: 0 auto 0.85rem;
  max-width: 1400px;
  padding: 0.45rem 0.85rem;
  border-radius: 14px;
  border: 1px solid rgba(167,139,250,0.28);
  background: rgba(8,5,18,0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.35);
  animation: mw-rise 0.45s var(--mw-ease) both;
}
body.theme-light .mw-context {
  background: rgba(255,255,255,0.92);
}
.mw-context-left, .mw-context-right {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem 0.75rem;
}
.mw-ctx-pill {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  font-size: 10px; font-weight: 800; letter-spacing: 0.04em;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: rgba(245,243,255,0.75);
}
.mw-ctx-pill.gold {
  border-color: rgba(240,193,75,0.4);
  color: #f0c14b;
  background: rgba(240,193,75,0.08);
}
.mw-ctx-pill.violet {
  border-color: rgba(167,139,250,0.4);
  color: #c4b5fd;
  background: rgba(167,139,250,0.1);
}
.mw-ctx-pill.ok {
  border-color: rgba(16,185,129,0.35);
  color: #34d399;
  background: rgba(16,185,129,0.08);
}
.mw-ctx-btn {
  border: 1px solid rgba(167,139,250,0.35);
  background: rgba(167,139,250,0.12);
  color: #a78bfa;
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  font-size: 10px; font-weight: 900;
  cursor: pointer; font-family: inherit;
  transition: all 0.2s;
}
.mw-ctx-btn:hover { background: #a78bfa; color: #07050f; }
.mw-explore {
  display: inline-flex; align-items: center; gap: 3px;
}
.mw-explore i {
  font-size: 7px; color: rgba(167,139,250,0.25);
}
.mw-explore i.on { color: #a78bfa; text-shadow: 0 0 6px rgba(167,139,250,0.6); }

body.meta-journey-veil .mw-context { display: none !important; }

@media (max-width: 768px) {
  .mw-context { top: 48px; padding: 0.4rem 0.6rem; }
  body.meta-wow .mw-tab-shell { top: calc(48px + var(--mw-context-h) + 4px); }
}

/* Surface action rail (every tab) */
.mw-surface-rail {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.85rem;
  padding: 0.75rem 0.9rem;
  border-radius: 14px;
  border: 1px solid rgba(167,139,250,0.22);
  background: linear-gradient(100deg, rgba(167,139,250,0.1), rgba(0,0,0,0.2));
}
.mw-surface-rail .mw-rail-icon {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  background: rgba(167,139,250,0.18);
  color: #a78bfa; flex-shrink: 0;
}
.mw-surface-rail .mw-rail-copy { flex: 1; min-width: 140px; }
.mw-surface-rail .mw-rail-copy strong {
  display: block; font-size: 12px; font-weight: 900; letter-spacing: 0.04em;
  color: #f5f3ff; margin-bottom: 2px;
}
body.theme-light .mw-surface-rail .mw-rail-copy strong { color: #2f1e21; }
.mw-surface-rail .mw-rail-copy span {
  font-size: 10px; line-height: 1.4; color: rgba(255,255,255,0.45);
}
body.theme-light .mw-surface-rail .mw-rail-copy span { color: rgba(47,30,33,0.55); }
.mw-surface-rail .mw-rail-actions {
  display: flex; flex-wrap: wrap; gap: 0.35rem;
}
.mw-rail-chip {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.4rem 0.7rem; border-radius: 999px;
  border: 1px solid rgba(167,139,250,0.3);
  background: rgba(0,0,0,0.25);
  color: #c4b5fd; font-size: 10px; font-weight: 800;
  cursor: pointer; font-family: inherit; transition: all 0.2s;
}
.mw-rail-chip:hover, .mw-rail-chip:focus-visible {
  background: rgba(167,139,250,0.25); color: #fff; outline: none;
}
.mw-rail-chip.primary {
  background: linear-gradient(135deg,#a78bfa,#c4b5fd);
  color: #07050f; border-color: transparent;
}

/* Empty state */
.mw-empty {
  text-align: center;
  padding: 1.5rem 1rem;
  border-radius: 16px;
  border: 1px dashed rgba(167,139,250,0.35);
  background: rgba(167,139,250,0.05);
  margin-bottom: 0.85rem;
}
.mw-empty i { font-size: 1.6rem; color: #a78bfa; margin-bottom: 0.5rem; }
.mw-empty h5 {
  font-size: 13px; font-weight: 900; letter-spacing: 0.06em;
  color: #f5f3ff; margin-bottom: 0.35rem;
}
body.theme-light .mw-empty h5 { color: #2f1e21; }
.mw-empty p {
  font-size: 11px; color: rgba(255,255,255,0.5); line-height: 1.55;
  max-width: 28rem; margin: 0 auto 0.85rem;
}
body.theme-light .mw-empty p { color: rgba(47,30,33,0.6); }
.mw-empty.has-chart { display: none !important; }

/* Collapsible long intro */
.mw-collapse-wrap { position: relative; }
.mw-collapse-wrap.is-collapsed .mw-collapse-body {
  max-height: 3.2em; overflow: hidden;
  mask-image: linear-gradient(180deg, #000 40%, transparent);
  -webkit-mask-image: linear-gradient(180deg, #000 40%, transparent);
}
.mw-collapse-toggle {
  margin-top: 0.35rem;
  border: none; background: none; cursor: pointer;
  color: #a78bfa; font-size: 10px; font-weight: 800;
  letter-spacing: 0.08em; text-transform: uppercase;
  font-family: inherit; padding: 0.2rem 0;
}
.mw-collapse-toggle:hover { text-decoration: underline; }

/* Oracle topic chips */
.mw-oracle-topics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}
@media (max-width: 720px) {
  .mw-oracle-topics { grid-template-columns: repeat(2, 1fr); }
}
.mw-topic-chip {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.25rem;
  padding: 0.75rem 0.85rem; border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.28);
  cursor: pointer; font-family: inherit; color: inherit;
  transition: all 0.25s var(--mw-ease); text-align: left; min-height: 72px;
}
.mw-topic-chip i { color: #a78bfa; font-size: 1rem; }
.mw-topic-chip b { font-size: 11px; font-weight: 900; }
.mw-topic-chip small { font-size: 9px; color: rgba(255,255,255,0.4); }
.mw-topic-chip:hover { border-color: rgba(167,139,250,0.4); transform: translateY(-2px); }
.mw-topic-chip.active {
  border-color: rgba(167,139,250,0.6);
  background: rgba(167,139,250,0.15);
  box-shadow: 0 0 20px rgba(167,139,250,0.15);
}

/* Ontology subtabs */
.mw-onto-tabs {
  display: flex; gap: 0.4rem; flex-wrap: wrap;
  padding: 0.4rem; border-radius: 14px;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(167,139,250,0.2);
  margin-bottom: 0.5rem;
}
body.meta-wow-v2 #view-ontology > .flex.gap-2.border-b {
  border: none !important; padding: 0 !important;
}
body.meta-wow-v2 #view-ontology > .flex.gap-2.border-b button,
body.meta-wow-v2 .mw-onto-tabs button {
  border-radius: 999px !important;
  min-height: 40px;
  padding: 0.45rem 1rem !important;
}

/* Sidebar plain helper */
.mw-side-help {
  margin-bottom: 0.75rem;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(240,193,75,0.25);
  background: rgba(240,193,75,0.06);
  font-size: 11px; line-height: 1.5;
  color: rgba(245,243,255,0.7);
}
.mw-side-help strong { color: #f0c14b; display: block; margin-bottom: 0.25rem; font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; }

/* Slider plain labels */
body.meta-wow-v2 .mw-slider-hint {
  display: block; font-size: 9px; color: rgba(255,255,255,0.35);
  margin-top: 2px; font-weight: 600;
}

/* Gallery empty */
.mw-gallery-tip {
  grid-column: 1 / -1;
  text-align: center; padding: 1.25rem;
  border-radius: 14px; border: 1px dashed rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.4); font-size: 11px;
}

/* Coach tour overlay */
.mw-tour {
  position: fixed; inset: 0; z-index: 100080;
  display: none; align-items: flex-end; justify-content: center;
  padding: 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom));
}
.mw-tour.show { display: flex; }
.mw-tour-backdrop {
  position: absolute; inset: 0;
  background: rgba(4,2,10,0.72);
  backdrop-filter: blur(6px);
}
.mw-tour-card {
  position: relative; z-index: 1;
  width: min(420px, 100%);
  border-radius: 22px;
  border: 1px solid rgba(167,139,250,0.4);
  background: linear-gradient(165deg, rgba(30,14,48,0.98), rgba(10,5,18,0.99));
  padding: 1.35rem 1.25rem 1.15rem;
  box-shadow: 0 30px 80px rgba(0,0,0,0.65), 0 0 50px rgba(167,139,250,0.15);
  animation: mw-rise 0.4s var(--mw-ease) both;
}
.mw-tour-step {
  font-size: 9px; font-weight: 900; letter-spacing: 0.2em;
  text-transform: uppercase; color: #a78bfa; margin-bottom: 0.5rem;
}
.mw-tour-card h3 {
  font-family: var(--font-display), Cinzel, serif;
  font-size: 1.15rem; font-weight: 900; margin-bottom: 0.5rem;
  color: #f5f3ff;
}
.mw-tour-card p {
  font-size: 12px; line-height: 1.6; color: rgba(255,255,255,0.6);
  margin-bottom: 1rem;
}
.mw-tour-actions {
  display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: flex-end;
}
.mw-tour-actions button {
  min-height: 42px; padding: 0 1rem; border-radius: 12px;
  font-size: 11px; font-weight: 900; letter-spacing: 0.06em;
  cursor: pointer; font-family: inherit;
}
.mw-tour-skip {
  border: 1px solid rgba(255,255,255,0.15);
  background: transparent; color: rgba(255,255,255,0.5);
}
.mw-tour-next {
  border: none;
  background: linear-gradient(135deg,#a78bfa,#c4b5fd);
  color: #07050f;
}

/* Celebrate burst */
.mw-celebrate {
  position: fixed; inset: 0; z-index: 100090;
  pointer-events: none; overflow: hidden;
}
.mw-celebrate span {
  position: absolute; top: -10px;
  width: 8px; height: 8px; border-radius: 2px;
  opacity: 0.9;
  animation: mw-fall 1.6s ease-out forwards;
}
@keyframes mw-fall {
  0% { transform: translateY(0) rotate(0); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* Chart lock flash on command */
body.mw-chart-locked .mw-live-chip {
  animation: card-flash-animation 1.4s var(--mw-ease);
  border-color: rgba(16,185,129,0.5) !important;
}

/* Visited tab badge */
.tab-btn.mw-visited:not(.active)::after {
  content: '';
  width: 5px; height: 5px; border-radius: 50%;
  background: #a78bfa;
  box-shadow: 0 0 6px #a78bfa;
  margin-left: 2px;
}

/* Gate wow */
body.meta-wow-v2 .gate-card .eyebrow {
  letter-spacing: 0.28em;
}
body.meta-wow-v2 #gate .gate-card {
  animation: mw-rise 0.55s var(--mw-ease) both;
}
body.meta-wow-v2 #gate .gate-card p {
  font-size: 13px;
}

/* Section card lift on lab panels */
body.meta-wow-v2 .tab-content .glass-panel {
  position: relative;
}
body.meta-wow-v2 #view-bazi .bazi-grid {
  gap: 14px;
}
body.meta-wow-v2 #view-dynamics .hud-alert,
body.meta-wow-v2 #view-org .glass-card {
  border-radius: 14px;
}

/* Footer next CTA strip */
.mw-footer-next {
  margin-top: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(167,139,250,0.2);
  background: rgba(0,0,0,0.25);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.65rem;
}
.mw-footer-next p {
  margin: 0; font-size: 11px; color: rgba(255,255,255,0.5); line-height: 1.45;
}
.mw-footer-next p strong { color: #c4b5fd; }

/* Progress ring tiny */
.mw-prog {
  font-size: 10px; font-weight: 800; color: rgba(196,181,253,0.7);
  letter-spacing: 0.06em;
}

/* Make glass cards in readiness more touch friendly */
body.meta-wow-v2 #view-observatory .p-4.rounded-xl {
  transition: border-color 0.25s, transform 0.25s;
}
body.meta-wow-v2 #view-observatory .p-4.rounded-xl:hover {
  border-color: rgba(167,139,250,0.3) !important;
}

/* FSS / archive readable labels */
body.meta-wow-v2 #view-fss .sec-title,
body.meta-wow-v2 #view-ontology .sec-title {
  letter-spacing: 0.1em;
}

/* Reduce sticky stacking on small screens */
@media (max-width: 1023px) {
  body.meta-wow-v2 .mw-tab-shell {
    position: relative;
    top: auto;
  }
}

/* Print hide tour */
@media print {
  .mw-tour, .mw-context, .mw-celebrate { display: none !important; }
}
