/* ════════════════════════════════════════════════════════════════════════
   METASPEAK · Kiosk Stylesheet
   Design language: Holographic Glass × Neon Tactical
   - Frosted glass surfaces (heavy backdrop-blur, hairline borders)
   - Iridescent edge halo on key panels (cyan→magenta)
   - Scan-line animation in transcript (Neon HUD signature)
   - JetBrains Mono timestamps with `::` separator (terminal feel)
   - Color-coded vertical bars per speaker (cyan/pink/gold)
   - Live status badge replaces generic "Voice-Driven 3D" subtitle
   ════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700&display=swap');

* { box-sizing: border-box; }
html, body, #root { margin: 0; padding: 0; height: 100%; overflow: hidden; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: #04050a;
  color: #e8eaf0;
  -webkit-font-smoothing: antialiased;
}

/* CSS custom properties — theme tokens. Adjust here to retheme entire UI. */
:root {
  --bg-base: #04050a;
  --glass-fill: rgba(8, 12, 20, 0.72);
  --glass-fill-strong: rgba(8, 12, 20, 0.88);
  --glass-stroke: rgba(255, 255, 255, 0.1);
  --glass-stroke-strong: rgba(255, 255, 255, 0.16);
  --neon-cyan: #5ce8ff;
  --neon-magenta: #ff5cd9;
  --neon-green: #6affb0;
  --neon-amber: #ffd07b;
  --char1-color: #5ce8ff;
  --char2-color: #ff80e0;
  --user-color: #ffd07b;
}

.ms-root {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-base);
}

/* ─────────────────────────────────────────────────────────────────
   FUTURISTIC HUD FRAME — corner brackets
   Pure CSS gaming/sci-fi HUD aesthetic. Four L-shaped brackets sit
   at viewport corners with cyan glow + animated scan line. No full
   border around the screen so the 3D scene + UI stay unobstructed.

   Structure:
     .ms-frame-corner.tl  — top-left bracket
     .ms-frame-corner.tr  — top-right bracket
     .ms-frame-corner.bl  — bottom-left bracket
     .ms-frame-corner.br  — bottom-right bracket
     .ms-frame-scanline   — horizontal beam that drifts top→bottom

   All non-interactive (pointer-events: none).
   ───────────────────────────────────────────────────────────────── */
.ms-frame-corner {
  position: absolute;
  width: 64px;
  height: 64px;
  pointer-events: none;
  z-index: 3;
}
.ms-frame-corner::before,
.ms-frame-corner::after {
  content: '';
  position: absolute;
  background: linear-gradient(135deg, var(--neon-cyan), rgba(92, 232, 255, 0.3));
  box-shadow:
    0 0 8px rgba(92, 232, 255, 0.7),
    0 0 16px rgba(92, 232, 255, 0.35);
  border-radius: 1px;
}
/* Bracket arms — one horizontal + one vertical per corner */
.ms-frame-corner.tl::before { top: 0;    left: 0;  width: 38px; height: 3px; }
.ms-frame-corner.tl::after  { top: 0;    left: 0;  width: 3px;  height: 38px; }
.ms-frame-corner.tr::before { top: 0;    right: 0; width: 38px; height: 3px; }
.ms-frame-corner.tr::after  { top: 0;    right: 0; width: 3px;  height: 38px; }
.ms-frame-corner.bl::before { bottom: 0; left: 0;  width: 38px; height: 3px; }
.ms-frame-corner.bl::after  { bottom: 0; left: 0;  width: 3px;  height: 38px; }
.ms-frame-corner.br::before { bottom: 0; right: 0; width: 38px; height: 3px; }
.ms-frame-corner.br::after  { bottom: 0; right: 0; width: 3px;  height: 38px; }

/* Inset position from viewport edges — varies per mode below */
.ms-frame-corner.tl { top: 10px;    left: 10px; }
.ms-frame-corner.tr { top: 10px;    right: 10px; }
.ms-frame-corner.bl { bottom: 10px; left: 10px; }
.ms-frame-corner.br { bottom: 10px; right: 10px; }

/* Tick marks — small notches inside each bracket for added detail */
.ms-frame-tick {
  position: absolute;
  width: 8px;
  height: 1.5px;
  background: var(--neon-cyan);
  opacity: 0.6;
  box-shadow: 0 0 6px var(--neon-cyan);
}
.ms-frame-corner.tl .ms-frame-tick:nth-child(1) { top: 8px; left: 12px; }
.ms-frame-corner.tl .ms-frame-tick:nth-child(2) { top: 12px; left: 8px; transform: rotate(90deg); transform-origin: left; }
.ms-frame-corner.tr .ms-frame-tick:nth-child(1) { top: 8px; right: 12px; }
.ms-frame-corner.tr .ms-frame-tick:nth-child(2) { top: 12px; right: 8px; transform: rotate(90deg); transform-origin: right; }
.ms-frame-corner.bl .ms-frame-tick:nth-child(1) { bottom: 8px; left: 12px; }
.ms-frame-corner.bl .ms-frame-tick:nth-child(2) { bottom: 12px; left: 8px; transform: rotate(90deg); transform-origin: left; }
.ms-frame-corner.br .ms-frame-tick:nth-child(1) { bottom: 8px; right: 12px; }
.ms-frame-corner.br .ms-frame-tick:nth-child(2) { bottom: 12px; right: 8px; transform: rotate(90deg); transform-origin: right; }

/* Subtle horizontal scan beam — drifts top→bottom over 8s loop */
.ms-frame-scanline {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(92, 232, 255, 0.5) 30%, rgba(255, 92, 217, 0.5) 70%, transparent);
  pointer-events: none;
  z-index: 2;
  filter: blur(0.5px);
  animation: ms-frame-scan 8s linear infinite;
  opacity: 0.55;
}
@keyframes ms-frame-scan {
  0%   { top: -2px; opacity: 0; }
  10%  { opacity: 0.55; }
  90%  { opacity: 0.55; }
  100% { top: 100%; opacity: 0; }
}

/* Mode-specific sizing — vertical kiosk gets bigger brackets since
   the screen is taller; landscape uses default; mobile is tighter. */
.ms-mode-vertical .ms-frame-corner { width: 96px; height: 96px; }
.ms-mode-vertical .ms-frame-corner::before,
.ms-mode-vertical .ms-frame-corner::after { width: 56px; }
.ms-mode-vertical .ms-frame-corner.tl::after,
.ms-mode-vertical .ms-frame-corner.tr::after,
.ms-mode-vertical .ms-frame-corner.bl::after,
.ms-mode-vertical .ms-frame-corner.br::after { width: 4px; height: 56px; }
.ms-mode-vertical .ms-frame-corner.tl::before,
.ms-mode-vertical .ms-frame-corner.tr::before,
.ms-mode-vertical .ms-frame-corner.bl::before,
.ms-mode-vertical .ms-frame-corner.br::before { width: 56px; height: 4px; }
.ms-mode-vertical .ms-frame-corner.tl { top: 16px; left: 16px; }
.ms-mode-vertical .ms-frame-corner.tr { top: 16px; right: 16px; }
.ms-mode-vertical .ms-frame-corner.bl { bottom: 16px; left: 16px; }
.ms-mode-vertical .ms-frame-corner.br { bottom: 16px; right: 16px; }

.ms-mode-mobile .ms-frame-corner { width: 40px; height: 40px; }
.ms-mode-mobile .ms-frame-corner::before { width: 24px; height: 2px; }
.ms-mode-mobile .ms-frame-corner::after  { width: 2px; height: 24px; }
.ms-mode-mobile .ms-frame-corner.tl { top: 6px; left: 6px; }
.ms-mode-mobile .ms-frame-corner.tr { top: 6px; right: 6px; }
.ms-mode-mobile .ms-frame-corner.bl { bottom: 6px; left: 6px; }
.ms-mode-mobile .ms-frame-corner.br { bottom: 6px; right: 6px; }

/* Optional: hide frame on admin preview (cluttered there) */
body[data-ms-mode="admin"] .ms-frame-corner,
body[data-ms-mode="admin"] .ms-frame-scanline { display: none; }


.ms-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  /* R37.5.6 — GPU compositor optimization hints.
     transform: translateZ(0) — force its own GPU layer so DOM overlays
       above (welcome card, FPS pill, dialogue bubbles) don't trigger
       canvas repaints. Big win on integrated GPUs.
     will-change: transform — Chrome reserves GPU layer up-front.
     image-rendering: auto — let browser pick best upscale (bilinear).
     contain: strict — isolate paint/layout from rest of page. */
  transform: translateZ(0);
  will-change: transform;
  image-rendering: auto;
  contain: strict;
}

.ms-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.55) 100%);
  z-index: 2;
}

/* ════════════════════════════════════════════════════════════════════════
   TOP BAR — Brand (left) + Session badge (right)
   ════════════════════════════════════════════════════════════════════════ */
.ms-topbar {
  position: absolute;
  top: 18px;
  left: 332px;
  right: 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 5;
  pointer-events: none;
}
/* When bubble mode is active, the side chat panel is gone — let topbar
   span the full width so brand can use the screen edge. */
.ms-bubbles-on .ms-topbar {
  left: 22px;
}
.ms-topbar > * { pointer-events: auto; }

/* Brand pill — Tourism Malaysia logo + label, holographic glass surface */
.ms-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px 10px 10px;
  background: var(--glass-fill);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid var(--glass-stroke);
  border-radius: 14px;
  position: relative;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 6px 24px rgba(0, 0, 0, 0.35);
}
/* Iridescent halo behind the brand pill — subtle neon shimmer */
.ms-brand::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--neon-cyan), transparent 35%, transparent 65%, var(--neon-magenta));
  z-index: -1;
  opacity: 0.35;
  filter: blur(8px);
}
.ms-brand-logo {
  width: var(--brand-logo-size, 56px);
  height: var(--brand-logo-size, 56px);
  border-radius: 8px;
  background: #fff;
  padding: 5px;
  object-fit: contain;
  display: block;
}
.ms-brand-dot {
  width: var(--brand-logo-size, 56px);
  height: var(--brand-logo-size, 56px);
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--neon-cyan), var(--neon-magenta), var(--neon-cyan));
  box-shadow: 0 0 14px rgba(92, 232, 255, 0.45);
}
.ms-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  gap: 1px;
}
.ms-brand-name {
  font-weight: 800;
  font-size: 14px;
  color: #ffffff;
  letter-spacing: 0.1em;
  text-shadow: 0 0 12px rgba(92, 232, 255, 0.35);
}
.ms-brand-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--neon-cyan);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.85;
}
.ms-brand-tag {
  font-family: 'Inter', system-ui, sans-serif;
  font-style: italic;
  font-size: 11px;
  font-weight: 500;
  color: var(--neon-magenta);
  letter-spacing: 0.06em;
  margin-top: 1px;
  text-shadow: 0 0 8px rgba(255, 92, 217, 0.3);
}

/* Session badge — Wira & Manja avatars + LIVE indicator */
.ms-status-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Language picker — small flag-row pill that lets the user force a
   reply language (Auto = let the system detect from speech, or pick
   BM/EN/中文/Tamil explicitly). Active state shows cyan glow. */
.ms-langpicker {
  display: flex;
  gap: 2px;
  padding: 4px;
  background: var(--glass-fill);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--glass-stroke);
  border-radius: 10px;
  pointer-events: auto;
}
.ms-lang-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 5px 9px;
  border-radius: 6px;
  cursor: pointer;
  transition: all .14s ease;
  min-width: 32px;
}
.ms-lang-btn:hover { color: #ffffff; background: rgba(255, 255, 255, 0.05); }
.ms-lang-btn.is-active {
  color: #02111B;
  background: linear-gradient(135deg, var(--neon-cyan), #2dd4bf);
  box-shadow: 0 0 12px rgba(92, 232, 255, 0.45);
}

/* Landscape — bigger picker. Desktop kiosk has more real estate so we
   can afford larger tap targets + better legibility from 1-2m viewing
   distance. Vertical kiosk keeps the compact size since topbar there
   is constrained. */
.ms-mode-landscape .ms-langpicker {
  gap: 4px;
  padding: 6px;
  border-radius: 14px;
}
.ms-mode-landscape .ms-lang-btn {
  font-size: 15px;
  padding: 9px 16px;
  min-width: 48px;
  letter-spacing: 0.08em;
}
.ms-mode-landscape .ms-lang-btn.is-active {
  box-shadow: 0 0 18px rgba(92, 232, 255, 0.6);
}

.ms-session {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 14px 7px 9px;
  background: var(--glass-fill);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid var(--glass-stroke);
  border-radius: 12px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 6px 24px rgba(0, 0, 0, 0.35);
}
.ms-session-avs {
  display: flex;
}
.ms-session-av {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #0a0e1a;
  margin-left: -8px;
}
.ms-session-av:first-child { margin-left: 0; }
.ms-av-c1 {
  background: linear-gradient(135deg, var(--neon-cyan), #0c8bb8);
  box-shadow: 0 0 8px rgba(92, 232, 255, 0.4);
}
.ms-av-c2 {
  background: linear-gradient(135deg, var(--neon-magenta), #a02a85);
  box-shadow: 0 0 8px rgba(255, 92, 217, 0.4);
}
.ms-session-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.ms-session-names {
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
}
.ms-session-live {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  color: var(--neon-green);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.ms-live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--neon-green);
  box-shadow: 0 0 8px var(--neon-green);
  animation: live-blink 1.5s infinite;
}
@keyframes live-blink {
  0%, 80%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ════════════════════════════════════════════════════════════════════════
   TRANSCRIPT PANEL (LEFT RAIL) — Holographic Glass + Neon Tactical
   ════════════════════════════════════════════════════════════════════════ */
.ms-chat {
  position: absolute;
  top: 18px;
  left: 18px;
  bottom: 18px;
  width: 296px;
  background: linear-gradient(180deg, rgba(8, 14, 26, 0.92), rgba(4, 8, 16, 0.88));
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
  border: 1px solid rgba(92, 232, 255, 0.18);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  z-index: 6;
  overflow: hidden;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 -1px 0 rgba(0, 0, 0, 0.4),
    0 12px 50px rgba(0, 0, 0, 0.55);
}
/* Iridescent edge halo — cyan top, magenta bottom */
.ms-chat::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--neon-cyan), transparent 30%, transparent 70%, var(--neon-magenta));
  z-index: -1;
  opacity: 0.32;
  filter: blur(6px);
  pointer-events: none;
}
/* Scan-line animation — travels top to bottom every 5s */
.ms-chat-scanline {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--neon-cyan), transparent);
  opacity: 0.55;
  z-index: 3;
  pointer-events: none;
  animation: chat-scan 5s linear infinite;
}
@keyframes chat-scan {
  0% { top: 0%; opacity: 0; }
  5% { opacity: 0.55; }
  50% { top: 100%; opacity: 0.55; }
  55% { opacity: 0; }
  100% { top: 0%; opacity: 0; }
}

.ms-chat-header {
  padding: 14px 16px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid rgba(92, 232, 255, 0.12);
  background: linear-gradient(135deg, rgba(92, 232, 255, 0.06), transparent);
  position: relative;
}
.ms-chat-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--neon-cyan);
  text-transform: uppercase;
  text-shadow: 0 0 8px rgba(92, 232, 255, 0.4);
}
.ms-chat-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--neon-cyan);
  box-shadow: 0 0 8px var(--neon-cyan);
  animation: live-blink 2s infinite;
}
.ms-chat-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 0.04em;
}
.ms-chat-close {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 22px;
  cursor: pointer;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  line-height: 1;
  padding: 0;
  margin-left: 4px;
}
.ms-chat-close:hover {
  background: rgba(92, 232, 255, 0.1);
  color: var(--neon-cyan);
}
.ms-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 12.5px;
  line-height: 1.55;
}
.ms-chat-body::-webkit-scrollbar { width: 4px; }
.ms-chat-body::-webkit-scrollbar-track { background: transparent; }
.ms-chat-body::-webkit-scrollbar-thumb {
  background: rgba(92, 232, 255, 0.25);
  border-radius: 2px;
}
.ms-chat-empty {
  color: rgba(255, 255, 255, 0.35);
  font-size: 12px;
  text-align: center;
  margin-top: 40px;
  line-height: 1.6;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.04em;
}

/* Message — vertical color bar marks speaker, mono label with timestamp */
.ms-msg {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-left: 12px;
  position: relative;
}
.ms-msg::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 2px;
  border-radius: 2px;
}
.ms-msg-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  display: inline-flex;
  align-items: baseline;
}
.ms-msg-ts {
  font-weight: 400;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.35);
  margin-left: 0;
}
.ms-msg-text {
  color: rgba(255, 255, 255, 0.88);
}
/* Speaker accents */
.ms-msg-user::before { background: var(--user-color); box-shadow: 0 0 6px var(--user-color); }
.ms-msg-user .ms-msg-label { color: var(--user-color); }
.ms-msg-lira::before,
.ms-msg-char1::before { background: var(--char1-color); box-shadow: 0 0 6px var(--char1-color); }
.ms-msg-lira .ms-msg-label,
.ms-msg-char1 .ms-msg-label { color: var(--char1-color); }
.ms-msg-kiro::before,
.ms-msg-char2::before { background: var(--char2-color); box-shadow: 0 0 6px var(--char2-color); }
.ms-msg-kiro .ms-msg-label,
.ms-msg-char2 .ms-msg-label { color: var(--char2-color); }
.ms-msg-host::before,
.ms-msg-system::before { background: rgba(255, 255, 255, 0.25); }
.ms-msg-host .ms-msg-label,
.ms-msg-system .ms-msg-label { color: rgba(255, 255, 255, 0.5); }
.ms-msg-partial .ms-msg-text {
  color: rgba(255, 255, 255, 0.5);
  font-style: italic;
}

/* Collapsed-state toggle button (when chat is closed) */
.ms-chat-toggle {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 6;
  width: 44px;
  height: 44px;
  background: var(--glass-fill);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid rgba(92, 232, 255, 0.2);
  border-radius: 12px;
  color: var(--neon-cyan);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 6px 20px rgba(0, 0, 0, 0.35);
  transition: all 0.18s ease;
}
.ms-chat-toggle:hover {
  border-color: rgba(92, 232, 255, 0.5);
  box-shadow: 0 0 18px rgba(92, 232, 255, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* ════════════════════════════════════════════════════════════════════════
   MENU BUBBLES — Holographic chips floating above mic
   ════════════════════════════════════════════════════════════════════════ */
.ms-menu {
  position: absolute;
  bottom: 130px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.ms-menu > * { pointer-events: auto; }

.ms-menu-title {
  background: var(--glass-fill);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid rgba(92, 232, 255, 0.3);
  /* R37.8.40 — title scales with --menu-scale. Note: inline style on the
     title element from app.js overrides font-size for quiz questions; that
     inline style now also incorporates menu-scale (see app.js). */
  padding: calc(10px * var(--menu-scale, 1)) calc(26px * var(--menu-scale, 1));
  border-radius: 999px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  font-size: calc(11.5px * var(--menu-scale, 1));
  color: var(--neon-cyan);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-shadow: 0 0 8px rgba(92, 232, 255, 0.4);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 0 22px rgba(92, 232, 255, 0.15),
    0 8px 30px rgba(0, 0, 0, 0.5);
  animation: bubbleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}
.ms-menu-options {
  display: flex;
  flex-direction: column;
  /* R37.8.40 — gap scales with --menu-scale (default 1). */
  gap: calc(7px * var(--menu-scale, 1));
  align-items: center;
}
.ms-menu-opt {
  background: var(--glass-fill-strong);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid var(--glass-stroke);
  /* R37.8.40 — padding + font-size + min-width all scale with --menu-scale. */
  padding: calc(11px * var(--menu-scale, 1)) calc(26px * var(--menu-scale, 1));
  border-radius: 999px;
  font-family: inherit;
  font-size: calc(13.5px * var(--menu-scale, 1));
  color: #ffffff;
  cursor: pointer;
  min-width: calc(280px * var(--menu-scale, 1));
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.18s ease;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 6px 18px rgba(0, 0, 0, 0.4);
  animation: bubbleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  position: relative;
}
.ms-menu-opt:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: rgba(92, 232, 255, 0.5);
  background: linear-gradient(135deg, rgba(92, 232, 255, 0.18), rgba(255, 92, 217, 0.12));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 0 22px rgba(92, 232, 255, 0.25),
    0 10px 28px rgba(0, 0, 0, 0.5);
}
.ms-menu-opt:disabled { opacity: 0.4; cursor: not-allowed; }
.ms-menu-opt.ms-menu-back {
  background: rgba(8, 12, 20, 0.85);
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 4px;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.ms-menu-opt.ms-menu-back:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.9);
}
@keyframes bubbleIn {
  from { transform: translateY(20px) scale(0.92); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* ════════════════════════════════════════════════════════════════════════
   MIC — Holographic ring with neon recording state
   ════════════════════════════════════════════════════════════════════════ */
.ms-mic-wrap {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 7;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.ms-mic {
  /* R37.8.29 — Base width/height scale via --mic-scale (default 1). This rule
     applies to landscape mode directly (no .ms-mode-landscape override exists).
     vertical and mobile modes have their own width/height overrides below. */
  width: calc(72px * var(--mic-scale, 1));
  height: calc(72px * var(--mic-scale, 1));
  border-radius: 50%;
  border: 1px solid rgba(92, 232, 255, 0.35);
  background:
    radial-gradient(circle at 30% 30%, rgba(92, 232, 255, 0.15), transparent 60%),
    linear-gradient(135deg, rgba(40, 45, 58, 0.95), rgba(20, 24, 32, 0.95));
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  position: relative;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    0 10px 30px rgba(0, 0, 0, 0.5),
    0 0 26px rgba(92, 232, 255, 0.18);
}
.ms-mic::before {
  /* Iridescent halo around mic */
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-magenta));
  z-index: -1;
  opacity: 0.35;
  filter: blur(6px);
}
.ms-mic:hover:not(:disabled) {
  border-color: rgba(92, 232, 255, 0.7);
  transform: scale(1.05);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 10px 36px rgba(0, 0, 0, 0.6),
    0 0 36px rgba(92, 232, 255, 0.35);
}
.ms-mic.recording {
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 92, 217, 0.3), transparent 60%),
    linear-gradient(135deg, #ff5c8a, #ff5cd9);
  border-color: #ff8dd9;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    0 10px 40px rgba(255, 92, 217, 0.6),
    0 0 36px rgba(255, 92, 217, 0.5);
}
.ms-mic.recording::before {
  background: linear-gradient(135deg, #ff5cd9, #ff5c8a);
  opacity: 0.5;
}
.ms-mic.disabled { opacity: 0.4; cursor: not-allowed; }
/* Interrupt-ready state — AI is speaking, user can tap to barge in.
   Amber glow signals "I'm listening to AI now, tap if you want to
   interrupt and say something new". */
.ms-mic.interrupt-ready {
  background:
    radial-gradient(circle at 30% 30%, rgba(251, 191, 36, 0.25), transparent 60%),
    linear-gradient(135deg, #f59e0b, #d97706);
  border-color: rgba(251, 191, 36, 0.7);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 10px 36px rgba(251, 191, 36, 0.45),
    0 0 28px rgba(251, 191, 36, 0.4);
  animation: micInterruptPulse 2s ease-in-out infinite;
  cursor: pointer;
}
@keyframes micInterruptPulse {
  0%, 100% { box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 10px 36px rgba(251,191,36,0.45), 0 0 28px rgba(251,191,36,0.4); }
  50%      { box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 14px 44px rgba(251,191,36,0.6), 0 0 44px rgba(251,191,36,0.55); }
}
.ms-mic-pulse {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid #ff5cd9;
  animation: micPulse 1.2s infinite;
}
@keyframes micPulse {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(1.7); opacity: 0; }
}
.ms-mic-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  color: rgba(255, 255, 255, 0.55);
  text-transform: uppercase;
}

/* ════════════════════════════════════════════════════════════════════════
   WELCOME OVERLAY
   ════════════════════════════════════════════════════════════════════════ */
.ms-welcome {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, rgba(5, 6, 10, 0.6), rgba(5, 6, 10, 0.92));
  backdrop-filter: blur(8px);
  animation: fadeIn 0.4s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.ms-welcome-card {
  max-width: 520px;
  padding: 40px 44px;
  background: rgba(15, 18, 26, 0.85);
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
  border: 1px solid rgba(92, 232, 255, 0.2);
  border-radius: 20px;
  text-align: center;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 30px 80px rgba(0, 0, 0, 0.6);
  position: relative;
}
.ms-welcome-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--neon-cyan), transparent 30%, transparent 70%, var(--neon-magenta));
  z-index: -1;
  opacity: 0.35;
  filter: blur(10px);
}
.ms-welcome-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--neon-cyan);
  margin-bottom: 18px;
  text-transform: uppercase;
  text-shadow: 0 0 8px rgba(92, 232, 255, 0.4);
}
.ms-welcome-card h1 {
  font-size: 36px;
  margin: 0 0 14px;
  letter-spacing: -0.02em;
  font-weight: 800;
  background: linear-gradient(135deg, #ffffff, var(--neon-cyan), #ffffff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.ms-welcome-card p {
  margin: 0 0 28px;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.55;
  text-wrap: pretty;
}
.ms-welcome-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-magenta));
  color: #04050a;
  border: none;
  padding: 14px 32px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 12px 30px rgba(92, 232, 255, 0.4),
    0 0 32px rgba(255, 92, 217, 0.3);
}
.ms-welcome-cta:hover {
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    0 18px 40px rgba(92, 232, 255, 0.55),
    0 0 48px rgba(255, 92, 217, 0.45);
}
.ms-welcome-hint {
  margin-top: 18px;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.4);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.08em;
}

/* R37.3.7 — Loading progress bar inside welcome card. Visible only while
   isKioskMode && charLoadState !== 'ready' && loadProgress.total > 0. */
.ms-welcome-progress-wrap {
  margin-top: 20px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ms-welcome-progress-bar {
  height: 5px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.ms-welcome-progress-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(120, 220, 255, 0.25) 50%,
    transparent 100%
  );
  animation: ms-bootprogress-shimmer 1.4s linear infinite;
  pointer-events: none;
}
.ms-welcome-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #5ce8ff 0%, #b794f4 60%, #ff9bd2 100%);
  border-radius: 999px;
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 0 8px rgba(120, 220, 255, 0.45);
}
.ms-welcome-progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.04em;
}
.ms-welcome-progress-label {
  text-transform: lowercase;
  font-weight: 500;
}
.ms-welcome-progress-pct {
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  color: rgba(120, 220, 255, 0.85);
}
.ms-welcome-progress-count {
  color: rgba(255, 255, 255, 0.35);
  margin-left: 4px;
}

/* ════════════════════════════════════════════════════════════════════════
   RESPONSIVE — tablet & phone
   ════════════════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .ms-chat { width: 248px; }
  .ms-topbar { left: 276px; }
  .ms-menu-opt { min-width: calc(240px * var(--menu-scale, 1)); }
  .ms-brand-name { font-size: 11.5px; }
  .ms-session-names { font-size: 11px; }
}

/* Mobile portrait — collapse chat by default, lift menu, smaller top bar */
@media (max-width: 600px) {
  .ms-chat {
    top: 12px;
    left: 12px;
    right: 12px;
    bottom: auto;
    width: auto;
    max-height: 35vh;
  }
  .ms-chat-toggle {
    top: 12px;
    left: 12px;
  }
  .ms-topbar {
    top: 64px;          /* below chat panel when chat is open */
    left: 12px;
    right: 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  /* When chat is collapsed, topbar sits at very top next to toggle */
  .ms-chat-toggle ~ .ms-topbar {
    top: 12px;
    left: 68px;
  }
  .ms-brand,
  .ms-session {
    padding: 6px 12px 6px 6px;
    border-radius: 999px;
  }
  .ms-brand-logo,
  .ms-brand-dot {
    /* Honor admin-set logo size, fall back to small for narrow viewports */
    width: var(--brand-logo-size, 30px);
    height: var(--brand-logo-size, 30px);
  }
  .ms-brand-name { font-size: 11px; letter-spacing: 0.08em; }
  .ms-brand-sub { font-size: 8.5px; }
  .ms-session-av { width: 22px; height: 22px; }
  .ms-session-names { font-size: 10.5px; }
  .ms-session-live { font-size: 8.5px; }

  .ms-menu { bottom: 110px; }
  /* R37.8.40 — mobile-breakpoint sizes also scale with --menu-scale. */
  .ms-menu-opt {
    min-width: calc(220px * var(--menu-scale, 1));
    font-size: calc(13px * var(--menu-scale, 1));
    padding: calc(9px * var(--menu-scale, 1)) calc(22px * var(--menu-scale, 1));
  }
  .ms-menu-title {
    font-size: calc(10.5px * var(--menu-scale, 1));
    padding: calc(8px * var(--menu-scale, 1)) calc(22px * var(--menu-scale, 1));
  }

  .ms-mic { width: 64px; height: 64px; }
  .ms-mic-wrap { bottom: 22px; gap: 8px; }
  .ms-mic-label { font-size: 9px; }
}

/* ════════════════════════════════════════════════════════════════════════
   BUBBLE CHAT — used on mobile (auto) + vertical kiosk (always)
   ════════════════════════════════════════════════════════════════════════ */
/* Layout flag — when .ms-bubbles-on is on the root, hide the side panel
   and the toggle button. The BubbleChat component renders independently. */
.ms-bubbles-on .ms-chat,
.ms-bubbles-on .ms-chat-toggle { display: none !important; }

.ms-bubbles {
  position: absolute;
  /* Position controlled via CSS var so admin slider can shift bubbles up
     or down without code changes. Default 35% from bottom — sits roughly
     at upper chest / shoulder height of the characters, NOT blocking
     their faces but still grouped with them visually. */
  bottom: var(--bubble-bottom, 35%);
  left: 18px;
  right: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  z-index: 8;
}

.ms-bubble {
  /* Tighter max-width forces longer messages to wrap to multiple lines
     instead of one giant horizontal block. Keeps bubble compact and
     readable from a distance. */
  max-width: calc(360px * var(--bubble-size, 1));
  width: max-content;
  /* R37.8.41 — Increased max-height to accommodate R37.8.38 adaptive-length
     answers (practical Qs up to 350 chars = ~8-9 lines on mobile). Previous
     140px clipped welcome message and any longer tourism answers. Now ~9
     lines fit. JS-side truncation (MAX_BUBBLE_CHARS) already trims overly
     long content with ellipsis at sentence boundary, so this CSS limit
     mainly guards against pathological no-space strings. */
  max-height: calc(220px * var(--bubble-size, 1));
  overflow: hidden;
  padding: calc(10px * var(--bubble-size, 1)) calc(14px * var(--bubble-size, 1));
  /* Background opacity controlled via CSS var so admin slider can fine-tune
     how see-through the bubble is. Lower value = more transparent = less
     screen blocking. RGB stays the same; only alpha multiplied by var. */
  background: rgba(8, 12, 20, var(--bubble-opacity, 0.86));
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid rgba(92, 232, 255, 0.3);
  border-radius: 18px;
  border-bottom-left-radius: 5px;
  font-size: calc(13px * var(--bubble-size, 1));
  line-height: 1.45;
  color: #ffffff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 8px 22px rgba(0, 0, 0, calc(0.4 * var(--bubble-opacity, 0.86))),
    0 0 24px rgba(92, 232, 255, calc(0.12 * var(--bubble-opacity, 0.86)));
  /* Animation duration synced to lifetimeMs prop via CSS var.
     Default 4500ms — JS sets --bubble-life inline per bubble. */
  animation: bubble-rise var(--bubble-life, 4500ms) ease-out forwards;
  display: flex;
  flex-direction: column;
  gap: 3px;
  /* Word wrapping — break long words gracefully */
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.ms-bubble-spk {
  font-family: 'JetBrains Mono', monospace;
  font-size: calc(9px * var(--bubble-size, 1));
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.85;
}
.ms-bubble-text {
  color: rgba(255, 255, 255, 0.92);
}
/* Speaker colors — match transcript palette */
.ms-bubble-c1 {
  align-self: flex-start;
  border-color: rgba(92, 232, 255, 0.35);
}
.ms-bubble-c1 .ms-bubble-spk { color: var(--neon-cyan); }
.ms-bubble-c2 {
  align-self: flex-end;
  border-color: rgba(255, 128, 224, 0.35);
  border-bottom-left-radius: 18px;
  border-bottom-right-radius: 5px;
}
.ms-bubble-c2 .ms-bubble-spk { color: var(--char2-color); }
.ms-bubble-user {
  align-self: flex-end;
  background: rgba(255, 208, 123, 0.08);
  border-color: rgba(255, 208, 123, 0.4);
  border-bottom-left-radius: 18px;
  border-bottom-right-radius: 5px;
}
.ms-bubble-user .ms-bubble-spk { color: var(--neon-amber); }
.ms-bubble-sys {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.15);
}
.ms-bubble-sys .ms-bubble-spk { color: rgba(255, 255, 255, 0.6); }
/* Live partial — always lowest opacity, italic */
.ms-bubble-partial {
  border-style: dashed;
  opacity: 0.85;
  animation: none !important;
}
.ms-bubble-partial .ms-bubble-text { font-style: italic; }

/* The lifecycle animation — used for all bubbles. Keyframes match the
   spec: fade in (7%), hold (~70%), fade up & out (last 25%). Because we
   use var(--bubble-life) for duration, JS can tune speed without CSS. */
@keyframes bubble-rise {
  0% { opacity: 0; transform: translateY(20px) scale(0.96); }
  7% { opacity: 1; transform: translateY(0) scale(1); }
  75% { opacity: 1; transform: translateY(-4px) scale(1); }
  100% { opacity: 0; transform: translateY(-32px) scale(0.98); }
}

/* History drawer pill — hint that transcript is available on tap */
.ms-history-pill {
  position: absolute;
  bottom: 132px;
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 14px;
  background: rgba(8, 12, 20, 0.85);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  z-index: 7;
  pointer-events: auto;
  transition: opacity 0.2s ease;
}
.ms-history-pill:hover {
  color: var(--neon-cyan);
  border-color: rgba(92, 232, 255, 0.4);
}
/* Hide history pill when topic/quiz menu is open — prevents overlap with
   menu options that share the lower-screen real-estate */
body[data-ms-menu-open] .ms-history-pill {
  opacity: 0;
  pointer-events: none;
}

/* History drawer — full transcript, slides up from bottom */
.ms-history-drawer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 70vh;
  background: linear-gradient(180deg, rgba(8, 14, 26, 0.92), rgba(4, 8, 16, 0.98));
  backdrop-filter: blur(40px) saturate(160%);
  border-top: 1px solid rgba(92, 232, 255, 0.25);
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  animation: drawer-up 0.28s cubic-bezier(0.34, 1.2, 0.64, 1) both;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.6);
}
@keyframes drawer-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.ms-history-head {
  padding: 14px 18px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(92, 232, 255, 0.15);
}
.ms-history-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--neon-cyan);
  text-transform: uppercase;
}
.ms-history-close {
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.ms-history-close:hover { background: rgba(92, 232, 255, 0.1); color: var(--neon-cyan); }
.ms-history-body {
  padding: 14px 18px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 12.5px;
  line-height: 1.55;
}

/* ════════════════════════════════════════════════════════════════════════
   VERTICAL KIOSK (4K standing pylon) — applied when body[data-ms-mode='vertical']
   ════════════════════════════════════════════════════════════════════════ */
body[data-ms-mode='vertical'] {
  /* Optional aspect lock — letterbox if window doesn't match 9:16.
     Toggle via .ms-aspect-lock class on root. */
  background: #000;
}
/* R37.8.61 — Vertical mode layout. Uses viewport-relative units (vh/%) so the
   SAME rules render correctly at 4K pylon (2160×3840) AND in the small
   dashboard preview iframe (320×568). Previously vertical had no layout CSS and
   inherited base landscape positions (mic bottom:30px, menu bottom:130px) which
   overlapped badly when the viewport was short. Now everything is anchored
   proportionally: brand top, menu in lower-middle band, mic at the very
   bottom, so the preview matches a real tall screen. */
/* R37.8.65 — Vertical topbar: centered stacked column. Brand/logo on top
   (vertical position via --brand-top slider), language switcher + Wira&Manja
   live pill on the row below, both centered. Visibility of language + live is
   toggled by body data-attrs (set by app.js from admin toggles). */
body[data-ms-mode='vertical'] .ms-topbar {
  position: absolute;
  top: var(--brand-top, 2.2vh);
  left: 2.5%;
  right: 2.5%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 1.2vh;
}
body[data-ms-mode='vertical'] .ms-brand {
  align-self: center;
}
/* Status group (language switcher + live pill), centered below brand */
body[data-ms-mode='vertical'] .ms-status-group {
  align-self: center;
  display: flex;
  align-items: center;
  gap: 2%;
  flex-wrap: wrap;
  justify-content: center;
}
/* Toggle: hide language switcher when admin turns it off */
body[data-ms-vertical-lang='off'] .ms-langpicker {
  display: none !important;
}
/* Toggle: hide Wira&Manja live pill when admin turns it off */
body[data-ms-vertical-live='off'] .ms-session {
  display: none !important;
}
body[data-ms-mode='vertical'] .ms-menu {
  bottom: var(--menu-bottom, 14vh);
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  align-items: stretch;
}
body[data-ms-mode='vertical'] .ms-menu-options {
  flex-direction: column;
  gap: calc(1.4vh * var(--menu-scale, 1));
  align-items: stretch;
}
body[data-ms-mode='vertical'] .ms-menu-opt {
  min-width: 0;
  width: 100%;
  padding: calc(1.6vh * var(--menu-scale, 1)) calc(4% * var(--menu-scale, 1));
  font-size: calc(2.0vh * var(--menu-scale, 1));
  border-radius: 999px;
}
body[data-ms-mode='vertical'] .ms-menu-title {
  font-size: calc(1.7vh * var(--menu-scale, 1));
  padding: calc(1.2vh * var(--menu-scale, 1)) calc(5% * var(--menu-scale, 1));
  align-self: center;
}
body[data-ms-mode='vertical'] .ms-mic-wrap {
  /* R37.8.62 — read --mic-bottom from the admin slider (set inline by app.js),
     fallback 4vh. Do NOT set transform here — app.js sets the inline transform
     including the horizontal verticalMicLeftPct offset, and we must not stomp
     it. left:50% + that inline translateX centres then offsets. */
  bottom: var(--mic-bottom, 4vh);
  left: 50%;
  gap: 1.2vh;
}
body[data-ms-mode='vertical'] .ms-mic {
  width: calc(9vh * var(--mic-scale, 1));
  height: calc(9vh * var(--mic-scale, 1));
}
body[data-ms-mode='vertical'] .ms-mic-label {
  font-size: 1.5vh;
}
/* R37.8.65 — Vertical bubble layout.
   - Position from bottom driven by --bubble-bottom (admin slider, realtime).
   - Wira (c1) bubbles align LEFT, Manja (c2) bubbles align RIGHT, so the two
     speakers sit on their own sides like a chat.
   - Width capped (not full-width) so boxes stay compact and readable. */
body[data-ms-mode='vertical'] .ms-bubbles {
  left: 4%;
  right: 4%;
  top: auto;
  bottom: var(--bubble-bottom, 35%);
  align-items: stretch;
}
body[data-ms-mode='vertical'] .ms-bubble {
  max-width: 78%;
  width: max-content;
}
/* Wira left, Manja right */
body[data-ms-mode='vertical'] .ms-bubble-c1 {
  align-self: flex-start;
  border-bottom-left-radius: 6px;
  border-bottom-right-radius: 18px;
}
body[data-ms-mode='vertical'] .ms-bubble-c2 {
  align-self: flex-end;
  border-bottom-right-radius: 6px;
  border-bottom-left-radius: 18px;
}
/* User + system bubbles stay centered-ish (left) */
body[data-ms-mode='vertical'] .ms-bubble-user,
body[data-ms-mode='vertical'] .ms-bubble-sys {
  align-self: flex-start;
}
/* R37.8.50 — MOBILE MODE — applied when isPhoneDevice() returns true
   (Android/iOS), regardless of orientation. Mobile mode uses kiosk-pylon-style
   layout in portrait, and a compact landscape variant when phone rotates.
   data-ms-orientation set by app.js on layoutMode change. */
body[data-ms-mode='mobile'] {
  background: #000;
}
body[data-ms-mode='mobile'][data-ms-orientation='portrait'] .ms-topbar {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
body[data-ms-mode='mobile'][data-ms-orientation='portrait'] .ms-brand,
body[data-ms-mode='mobile'][data-ms-orientation='portrait'] .ms-session {
  border-radius: 999px;
  padding: 6px 14px 6px 6px;
}
body[data-ms-mode='mobile'][data-ms-orientation='portrait'] .ms-brand-logo,
body[data-ms-mode='mobile'][data-ms-orientation='portrait'] .ms-brand-dot {
  width: var(--brand-logo-size, 32px);
  height: var(--brand-logo-size, 32px);
}
body[data-ms-mode='mobile'][data-ms-orientation='portrait'] .ms-brand-name { font-size: 11px; letter-spacing: 0.08em; }
body[data-ms-mode='mobile'][data-ms-orientation='portrait'] .ms-brand-sub { font-size: 8.5px; }
body[data-ms-mode='mobile'][data-ms-orientation='portrait'] .ms-session-av { width: 22px; height: 22px; }
body[data-ms-mode='mobile'][data-ms-orientation='portrait'] .ms-session-names { font-size: 10.5px; }
body[data-ms-mode='mobile'][data-ms-orientation='portrait'] .ms-session-live { font-size: 8.5px; }
/* Mic in mobile portrait — large enough for thumb, positioned in lower zone */
body[data-ms-mode='mobile'][data-ms-orientation='portrait'] .ms-mic-wrap {
  bottom: 4vh;
  left: 50%;
  transform: translateX(-50%);
  gap: 1.2vh;
}
body[data-ms-mode='mobile'][data-ms-orientation='portrait'] .ms-mic {
  width: calc(9.5vh * var(--mic-scale, 1));
  height: calc(9.5vh * var(--mic-scale, 1));
}
/* Menu in mobile portrait — full width row, like vertical kiosk */
body[data-ms-mode='mobile'][data-ms-orientation='portrait'] .ms-menu {
  bottom: 16vh;
  width: 92%;
  left: 4%;
  transform: none;
  align-items: stretch;
}
body[data-ms-mode='mobile'][data-ms-orientation='portrait'] .ms-menu-options {
  flex-direction: row;
  flex-wrap: wrap;
  gap: calc(8px * var(--menu-scale, 1));
  justify-content: center;
}
body[data-ms-mode='mobile'][data-ms-orientation='portrait'] .ms-menu-opt {
  min-width: 0;
  flex: 1 1 calc(50% - 4px);
  padding: calc(10px * var(--menu-scale, 1)) calc(12px * var(--menu-scale, 1));
  font-size: calc(12px * var(--menu-scale, 1));
  border-radius: 12px;
}
body[data-ms-mode='mobile'][data-ms-orientation='portrait'] .ms-menu-opt.ms-menu-back {
  flex: 1 1 100%;
}
body[data-ms-mode='mobile'][data-ms-orientation='portrait'] .ms-menu-title {
  font-size: calc(10.5px * var(--menu-scale, 1));
  padding: calc(8px * var(--menu-scale, 1)) calc(18px * var(--menu-scale, 1));
  align-self: center;
}
/* Bubbles in mobile portrait — anchored above menu */
body[data-ms-mode='mobile'][data-ms-orientation='portrait'] .ms-bubbles {
  left: 12px;
  right: 12px;
  gap: 8px;
}
/* Mobile landscape — phone rotated. Compact landscape layout, mic on side */
body[data-ms-mode='mobile'][data-ms-orientation='landscape'] .ms-topbar {
  top: 8px;
  left: 8px;
  right: 8px;
  gap: 8px;
}
body[data-ms-mode='mobile'][data-ms-orientation='landscape'] .ms-mic-wrap {
  bottom: 12px;
  left: 12px;
}
body[data-ms-mode='mobile'][data-ms-orientation='landscape'] .ms-mic {
  width: calc(56px * var(--mic-scale, 1));
  height: calc(56px * var(--mic-scale, 1));
}
body[data-ms-mode='mobile'][data-ms-orientation='landscape'] .ms-menu {
  bottom: 12px;
  right: 12px;
  left: auto;
  width: auto;
  max-width: 60%;
}
body[data-ms-mode='mobile'][data-ms-orientation='landscape'] .ms-menu-options {
  flex-direction: column;
  gap: calc(6px * var(--menu-scale, 1));
}
body[data-ms-mode='mobile'][data-ms-orientation='landscape'] .ms-menu-opt {
  font-size: calc(11px * var(--menu-scale, 1));
  padding: calc(8px * var(--menu-scale, 1)) calc(16px * var(--menu-scale, 1));
}
.ms-mode-vertical .ms-topbar {
  /* Stacked centered hero on top of the vertical canvas */
  position: absolute;
  top: 24px;
  left: 24px;
  right: 24px;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.ms-mode-vertical .ms-brand,
.ms-mode-vertical .ms-session {
  /* Round pills look more "kiosk" on vertical */
  border-radius: 999px;
  padding: 10px 22px 10px 10px;
}
.ms-mode-vertical .ms-brand-logo,
.ms-mode-vertical .ms-brand-dot {
  /* Use admin slider value; default 48 for vertical kiosk if unset */
  width: var(--brand-logo-size, 48px);
  height: var(--brand-logo-size, 48px);
}
.ms-mode-vertical .ms-brand-name { font-size: 15px; letter-spacing: 0.1em; }
.ms-mode-vertical .ms-brand-sub { font-size: 11px; }
.ms-mode-vertical .ms-session-av { width: 28px; height: 28px; }
.ms-mode-vertical .ms-session-names { font-size: 13px; }
.ms-mode-vertical .ms-session-live { font-size: 10.5px; }

/* Bubbles in vertical mode — bigger text, more breathing room.
   Position is controlled by --bubble-bottom CSS var (set per-instance
   from admin slider), so we DON'T override `bottom` here. Only override
   size, padding, and shape — those are inherent to vertical layout. */
.ms-mode-vertical .ms-bubbles {
  left: 24px;
  right: 24px;
  gap: 12px;
}
.ms-mode-vertical .ms-bubble {
  font-size: calc(16px * var(--bubble-size, 1));
  padding: calc(14px * var(--bubble-size, 1)) calc(20px * var(--bubble-size, 1));
  max-width: calc(420px * var(--bubble-size, 1));
  border-radius: 22px;
}
.ms-mode-vertical .ms-bubble-c1 { border-bottom-left-radius: 6px; }
.ms-mode-vertical .ms-bubble-c2,
.ms-mode-vertical .ms-bubble-user { border-bottom-right-radius: 6px; }
.ms-mode-vertical .ms-bubble-spk { font-size: calc(10.5px * var(--bubble-size, 1)); }

/* Menu options in vertical mode — wider, more touchable.
   Position now controlled by --menu-bottom CSS var (set per-instance from
   admin slider). Default 8% from bottom — sits below the mic in the
   lower zone so users can see all topic options at thumb-reach. */
.ms-mode-vertical .ms-menu {
  bottom: var(--menu-bottom, 8%);
  width: calc(100% - 48px);
  left: 24px;
  transform: none;
  align-items: stretch;
}
.ms-mode-vertical .ms-menu-options {
  flex-direction: row;
  flex-wrap: wrap;
  /* R37.8.40 — gap scales with menu-scale in vertical mode too. */
  gap: calc(10px * var(--menu-scale, 1));
  justify-content: center;
}
.ms-mode-vertical .ms-menu-opt {
  min-width: 0;
  flex: 1 1 calc(50% - 5px);
  /* R37.8.40 — vertical-mode size overrides also scale. */
  padding: calc(14px * var(--menu-scale, 1)) calc(18px * var(--menu-scale, 1));
  font-size: calc(15px * var(--menu-scale, 1));
  border-radius: 14px;
}
.ms-mode-vertical .ms-menu-opt.ms-menu-back {
  flex: 1 1 100%;
}
.ms-mode-vertical .ms-menu-title {
  font-size: calc(13px * var(--menu-scale, 1));
  padding: calc(12px * var(--menu-scale, 1)) calc(28px * var(--menu-scale, 1));
  align-self: center;
}

/* Mic — BIG in vertical for thumb reach.
   Position controlled by --mic-bottom CSS var (set per-instance from
   admin slider). Default 28% — chest-height for adult standing in front
   of a 4K vertical pylon kiosk. */
.ms-mode-vertical .ms-mic-wrap { bottom: var(--mic-bottom, 28%); gap: 14px; }
/* R37.8.28 — Mic scale slider. --mic-scale set inline from admin (50-200%).
   Applied to width/height/svg/halo so entire mic visually grows/shrinks
   without affecting layout positioning (transform on wrap would interfere
   with translateX positioning). */
.ms-mode-vertical .ms-mic { width: calc(120px * var(--mic-scale, 1)); height: calc(120px * var(--mic-scale, 1)); }
.ms-mode-vertical .ms-mic svg { width: calc(44px * var(--mic-scale, 1)); height: calc(44px * var(--mic-scale, 1)); }
.ms-mode-vertical .ms-mic-label {
  font-size: 13px;
  letter-spacing: 0.24em;
  font-weight: 700;
  /* Make label more visible against background */
  padding: 6px 14px;
  background: rgba(8, 12, 20, 0.7);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(92, 232, 255, 0.25);
  border-radius: 999px;
  color: var(--neon-cyan);
}

/* History pill — higher up to clear bigger menu */
.ms-mode-vertical .ms-history-pill { bottom: calc(var(--mic-bottom, 28%) + 100px); }

/* ════════════════════════════════════════════════════════════════════════
   MOBILE PORTRAIT — same bubble layout but tighter spacing
   ════════════════════════════════════════════════════════════════════════ */
.ms-mode-mobile .ms-topbar {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.ms-mode-mobile .ms-brand { padding: 6px 14px 6px 6px; }
.ms-mode-mobile .ms-brand-logo, .ms-mode-mobile .ms-brand-dot {
  /* Honor admin slider; fallback small for mobile screens */
  width: var(--brand-logo-size, 30px);
  height: var(--brand-logo-size, 30px);
}
.ms-mode-mobile .ms-brand-name { font-size: 11px; }
.ms-mode-mobile .ms-brand-sub { font-size: 8.5px; }
.ms-mode-mobile .ms-session { padding: 5px 12px 5px 7px; }
.ms-mode-mobile .ms-session-av { width: 22px; height: 22px; }
.ms-mode-mobile .ms-session-names { font-size: 10.5px; }
.ms-mode-mobile .ms-session-live { font-size: 8.5px; }

.ms-mode-mobile .ms-bubbles {
  left: 12px;
  right: 12px;
}
.ms-mode-mobile .ms-bubble {
  font-size: calc(12.5px * var(--bubble-size, 1));
  padding: calc(9px * var(--bubble-size, 1)) calc(13px * var(--bubble-size, 1));
  max-width: calc(280px * var(--bubble-size, 1));
}
.ms-mode-mobile .ms-bubble-spk { font-size: calc(8.5px * var(--bubble-size, 1)); }

.ms-mode-mobile .ms-menu { bottom: 130px; }
.ms-mode-mobile .ms-mic-wrap { bottom: 28px; }
/* R37.8.28 — Mobile mic scale slider. Independent of vertical scale so
   admins can tune kiosk-large + phone-comfortable separately. */
.ms-mode-mobile .ms-mic { width: calc(64px * var(--mic-scale, 1)); height: calc(64px * var(--mic-scale, 1)); }

.ms-mode-mobile .ms-history-pill { bottom: 126px; }


/* ════════════════════════════════════════════════════════════════════════
   ADMIN DASHBOARD STYLES — premium glass · teal heritage · Notion × Linear
   ════════════════════════════════════════════════════════════════════════ */

/* ───── Design tokens ───── */
:root {
  --ms-bg:        #07090C;
  --ms-bg-grad:   radial-gradient(1200px 600px at 20% -10%, rgba(20,184,166,0.10), transparent 60%),
                  radial-gradient(900px 500px at 100% 100%, rgba(167,139,250,0.06), transparent 60%),
                  #07090C;
  --ms-sidebar:   #0A0D11;
  --ms-card:      rgba(255,255,255,0.025);
  --ms-card-hi:   rgba(255,255,255,0.05);
  --ms-text:      #ECEEF2;
  --ms-muted:     #71808A;
  --ms-mint:      #5EEAD4;
  --ms-teal:      #14B8A6;
  --ms-blue:      #38BDF8;
  --ms-amber:     #FBBF24;
  --ms-purple:    #A78BFA;
  --ms-red:       #F87171;
  --ms-border:    rgba(255,255,255,0.08);
  --ms-border-hi: rgba(255,255,255,0.14);
}

* { box-sizing: border-box; }
html, body, #root { margin: 0; padding: 0; min-height: 100%; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--ms-bg);
  color: var(--ms-text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ───── Admin shell ───── */
.ms-adm-shell {
  background: var(--ms-bg-grad) !important;
  letter-spacing: -0.005em;
}

/* Subtle grain overlay on the whole shell */
.ms-adm-shell::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(255,255,255,0.018) 1px, transparent 0);
  background-size: 3px 3px;
  opacity: 0.6;
}
.ms-adm-shell > * { position: relative; z-index: 1; }

/* ───── Sidebar ───── */
.ms-adm-sidebar {
  position: relative;
}
.ms-adm-batik {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.06;
  background-image:
    radial-gradient(circle at 20px 20px, var(--ms-mint) 1.5px, transparent 2px),
    radial-gradient(circle at 60px 60px, var(--ms-teal) 1px, transparent 2px),
    radial-gradient(circle at 40px 80px, var(--ms-mint) 1px, transparent 2px);
  background-size: 80px 80px, 80px 80px, 80px 80px;
  background-position: 0 0, 0 0, 0 0;
}
.ms-adm-sidebar::after {
  /* faint vertical accent stripe at right edge */
  content: '';
  position: absolute;
  top: 0; bottom: 0; right: 0;
  width: 1px;
  background: linear-gradient(180deg, transparent, var(--ms-mint), transparent);
  opacity: 0.18;
  pointer-events: none;
}

.ms-adm-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, rgba(94,234,212,0.18), rgba(20,184,166,0.06));
  border: 1px solid var(--ms-border-hi);
  box-shadow: 0 4px 18px rgba(94,234,212,0.15);
  flex-shrink: 0;
}

/* Nav items */
.ms-adm-nav-item {
  position: relative;
}
.ms-adm-nav-item:hover {
  background: rgba(255,255,255,0.035) !important;
  color: var(--ms-text) !important;
}
.ms-adm-nav-item.is-active::before {
  content: '';
  position: absolute;
  left: -1px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px;
  background: var(--ms-mint);
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 10px var(--ms-mint);
}
.ms-adm-nav-item.is-active {
  font-weight: 600 !important;
}

/* ───── Topbar ───── */
.ms-adm-topbar {
  position: relative;
}
.ms-adm-topbar::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--ms-border-hi), transparent);
  pointer-events: none;
}

/* Buttons */
.ms-adm-btn {
  font-family: inherit;
  transition: all .18s ease;
}
.ms-adm-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: var(--ms-border-hi) !important;
}
.ms-adm-btn-primary:hover:not(:disabled) {
  box-shadow: 0 6px 22px rgba(94,234,212,0.18);
}
.ms-adm-btn-ghost:hover:not(:disabled) {
  background: rgba(94,234,212,0.14) !important;
}

/* Live pill */
.ms-adm-live-pill {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  text-transform: uppercase;
}

/* ───── KPI tile ───── */
.ms-adm-kpi {
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.ms-adm-kpi::after {
  /* glass top-edge highlight */
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12), transparent);
  pointer-events: none;
}
.ms-adm-kpi:hover {
  transform: translateY(-2px);
  border-color: var(--ms-border-hi) !important;
  box-shadow: 0 16px 40px rgba(0,0,0,0.35);
}
.ms-adm-kpi-value {
  font-feature-settings: 'tnum' 1, 'ss01' 1;
}

/* ───── Cards ───── */
.ms-adm-card {
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  position: relative;
}
.ms-adm-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  pointer-events: none;
  border-radius: inherit;
}
.ms-adm-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}
.ms-adm-card-title::before {
  content: '';
  width: 3px; height: 14px;
  background: var(--ms-mint);
  border-radius: 2px;
  display: inline-block;
  box-shadow: 0 0 8px var(--ms-mint);
}

/* ───── Content / page wrapper ───── */
.ms-adm-content {
  min-height: 100vh;
}
.ms-adm-page {
  max-width: 1400px;
}

/* ───── Scrollbar ───── */
.ms-adm-content::-webkit-scrollbar,
.ms-adm-sidebar::-webkit-scrollbar { width: 8px; height: 8px; }
.ms-adm-content::-webkit-scrollbar-thumb,
.ms-adm-sidebar::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
}
.ms-adm-content::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.12); }

/* ───── Tables (Users page) ───── */
.ms-adm-shell table {
  font-feature-settings: 'tnum' 1;
}
.ms-adm-shell input[type="text"],
.ms-adm-shell input:not([type]) {
  transition: border-color .15s ease, box-shadow .15s ease;
}
.ms-adm-shell input:focus {
  border-color: var(--ms-mint) !important;
  box-shadow: 0 0 0 3px rgba(94,234,212,0.12);
  outline: none;
}

/* ───── Animation ───── */
@keyframes msPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}
@keyframes msFadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.ms-adm-kpi, .ms-adm-card { animation: msFadeUp .35s ease both; }
.ms-adm-kpi:nth-child(2) { animation-delay: .05s; }
.ms-adm-kpi:nth-child(3) { animation-delay: .1s; }
.ms-adm-kpi:nth-child(4) { animation-delay: .15s; }

/* ───── Responsive ───── */
@media (max-width: 1100px) {
  .ms-adm-kpi-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .ms-adm-row { grid-template-columns: 1fr !important; }
}
@media (max-width: 720px) {
  .ms-adm-sidebar { width: 180px !important; }
  .ms-adm-content { padding: 18px !important; }
}

/* ─────────────────────────────────────────────────────────────────
   TYPING INPUT — text alternative to mic
   Sits below the mic button. Two states:
   - Collapsed: small "TYPE INSTEAD" pill with keyboard icon
   - Open: text input + send button + close button
   Always visible. Messages queue while AI is talking.
   ───────────────────────────────────────────────────────────────── */
.ms-typing-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
  width: 100%;
  max-width: 400px;
}
.ms-typing-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(15, 30, 45, 0.55);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid rgba(92, 232, 255, 0.22);
  border-radius: 999px;
  color: rgba(207, 232, 255, 0.7);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: all 0.18s ease;
  font-family: inherit;
}
.ms-typing-toggle:hover {
  background: rgba(20, 40, 60, 0.7);
  border-color: rgba(92, 232, 255, 0.4);
  color: rgba(207, 232, 255, 0.95);
  transform: translateY(-1px);
}
.ms-typing-toggle svg { opacity: 0.8; }

.ms-typing-form {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  max-width: 400px;
  padding: 6px 6px 6px 14px;
  background: rgba(15, 30, 45, 0.7);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid rgba(92, 232, 255, 0.3);
  border-radius: 999px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(92, 232, 255, 0.08);
  animation: ms-typing-expand 0.2s ease-out;
}
@keyframes ms-typing-expand {
  from { transform: scale(0.9); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
.ms-typing-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 13px;
  font-family: inherit;
  padding: 6px 4px;
  min-width: 0;
}
.ms-typing-input::placeholder {
  color: rgba(207, 232, 255, 0.4);
  font-style: italic;
}
.ms-typing-send,
.ms-typing-close {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.15s ease;
}
.ms-typing-send {
  background: linear-gradient(135deg, #5ce8ff, #ff5cd9);
  color: #02111B;
  box-shadow: 0 0 12px rgba(92, 232, 255, 0.4);
}
.ms-typing-send:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
}
.ms-typing-send:not(:disabled):hover {
  transform: scale(1.08);
  box-shadow: 0 0 18px rgba(92, 232, 255, 0.6);
}
.ms-typing-close {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(207, 232, 255, 0.6);
}
.ms-typing-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

/* Vertical mode — slightly more compact */
.ms-mode-vertical .ms-typing-form {
  max-width: 320px;
}
.ms-mode-vertical .ms-typing-input {
  font-size: 12px;
}

/* Mobile mode — full width minus padding */
.ms-mode-mobile .ms-typing-wrap {
  max-width: calc(100% - 28px);
}
.ms-mode-mobile .ms-typing-form {
  max-width: 100%;
}

/* ════════════════════════════════════════════════════════════════════════
   CHARACTER BOOT OVERLAY — Loading / Error states (Round 33)
   Replaces the old procedural-bear fallback. Covers the canvas while the
   kiosk's VRM characters load; switches to an error panel if boot fails.
   ════════════════════════════════════════════════════════════════════════ */
.ms-bootoverlay {
  position: absolute;
  inset: 0;
  z-index: 50;               /* above canvas + vignette + HUD frame */
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center,
              rgba(8, 12, 20, 0.82) 0%,
              rgba(4, 5, 10, 0.96) 100%);
  backdrop-filter: blur(12px) saturate(120%);
  -webkit-backdrop-filter: blur(12px) saturate(120%);
  animation: ms-bootfade 0.4s ease-out;
}
@keyframes ms-bootfade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.ms-bootoverlay-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px;
  max-width: 440px;
}

/* ── Loading spinner — three pulsing dots in brand cyan ──────────────── */
.ms-bootspinner {
  display: flex;
  gap: 10px;
  margin-bottom: 28px;
}
.ms-bootspinner span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--neon-cyan);
  box-shadow: 0 0 14px rgba(92, 232, 255, 0.7);
  animation: ms-bootpulse 1.2s ease-in-out infinite;
}
.ms-bootspinner span:nth-child(2) { animation-delay: 0.18s; }
.ms-bootspinner span:nth-child(3) { animation-delay: 0.36s; }
@keyframes ms-bootpulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40%           { transform: scale(1);   opacity: 1;   }
}

/* ── Error icon — amber warning disc ─────────────────────────────────── */
.ms-booticon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
  color: #1a1205;
  background: var(--neon-amber);
  box-shadow: 0 0 28px rgba(255, 208, 123, 0.5);
  margin-bottom: 24px;
}

.ms-boottitle {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #f0f4fa;
  margin-bottom: 10px;
}
.ms-bootsub {
  font-size: 14px;
  line-height: 1.6;
  color: #9bb0c8;
  max-width: 360px;
}

/* R37.3.6 — Live loading progress bar. Shows actual asset load progress
   (0-100%) instead of indefinite spinner. Three-tone gradient matches
   kiosk brand. */
.ms-bootprogress-wrap {
  margin-top: 26px;
  width: 320px;
  max-width: 80vw;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ms-bootprogress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.ms-bootprogress-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(120, 220, 255, 0.3) 50%,
    transparent 100%
  );
  animation: ms-bootprogress-shimmer 1.4s linear infinite;
  pointer-events: none;
}
@keyframes ms-bootprogress-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.ms-bootprogress-fill {
  height: 100%;
  background: linear-gradient(90deg, #5ce8ff 0%, #b794f4 60%, #ff9bd2 100%);
  border-radius: 999px;
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 0 10px rgba(120, 220, 255, 0.5);
}
.ms-bootprogress-pct {
  font-size: 12px;
  letter-spacing: 0.05em;
  color: #cfe5ff;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.ms-bootprogress-count {
  font-size: 10.5px;
  color: #6c84a3;
}

/* ── Retry button — shown only in the error state ────────────────────── */
.ms-bootretry {
  margin-top: 24px;
  padding: 11px 28px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #04050a;
  background: var(--neon-cyan);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 0 20px rgba(92, 232, 255, 0.4);
}
.ms-bootretry:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 28px rgba(92, 232, 255, 0.6);
}
.ms-bootretry:active {
  transform: translateY(0);
}

/* Vertical kiosk — slightly tighter padding on narrow portrait screens */
.ms-mode-vertical .ms-bootoverlay-inner,
.ms-mode-mobile .ms-bootoverlay-inner {
  padding: 28px;
  max-width: 90%;
}

/* ════════════════════════════════════════════════════════════════════════
   R37.8.70 — ATTRACT MODE (kiosk screensaver). Full-screen showcase video
   when idle > attractIdleSec. Any touch/click/voice exits (markActivity).
   ════════════════════════════════════════════════════════════════════════ */
.ms-attract {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  animation: ms-attract-in 0.4s ease;
}
@keyframes ms-attract-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.ms-attract-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ms-attract-hint {
  position: absolute;
  bottom: 6vh;
  left: 50%;
  transform: translateX(-50%);
  padding: 14px 32px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(92, 232, 255, 0.4);
  color: #fff;
  font-size: clamp(14px, 2.2vh, 22px);
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  animation: ms-attract-pulse 2s ease-in-out infinite;
}
@keyframes ms-attract-pulse {
  0%, 100% { opacity: 0.75; }
  50% { opacity: 1; }
}
