/* ==========================================================================
   MANSEDER.AT & MANSEDER.COM • Valeria & Amadeus Reception + Smart Router CSS
   Compliant with modern-web-guidance (no *, no oklch neutral mixing, rem sizes,
   unitless line-heights, >=44px coarse touch targets, forced-colors, dialog
   modal overscroll lock, zero styles directly on [role="tabpanel"]).
   ========================================================================== */

#msReceptionDesk,
#msStageShell,
#fragMansederDialog {
  --ms-bg-deep: #040914;
  --ms-bg-panel: #0b1426;
  --ms-bg-card: #101d36;
  --ms-bg-elevated: #162646;
  --ms-cyan: #38bdf8;
  --ms-cyan-soft: #bae6fd;
  --ms-gold: #fbbf24;
  --ms-gold-soft: #fde68a;
  --ms-emerald: #10b981;
  --ms-emerald-soft: #a7f3d0;
  --ms-rose: #f43f5e;
  --ms-rose-soft: #fecdd3;
  --ms-text: #f8fafc;
  --ms-soft: #cbd5e1;
  --ms-muted: #94a3b8;
  --ms-border: rgba(148, 163, 184, 0.28);
  --ms-border-cyan: rgba(56, 189, 248, 0.44);
  --ms-border-gold: rgba(251, 191, 36, 0.44);
  --ms-border-emerald: rgba(16, 185, 129, 0.48);
  --ms-border-rose: rgba(244, 63, 94, 0.56);
  --ms-font-sans: var(--font-body, 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
  --ms-font-head: var(--font-heading, 'Poppins', system-ui, sans-serif);
  --ms-font-mono: var(--font-mono, 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
  box-sizing: border-box;
  font-family: var(--ms-font-sans);
  color: var(--ms-text);
  line-height: 1.5;
  min-inline-size: 0;
}

#msReceptionDesk,
#msReceptionDesk :where(div, section, article, form, search, input, button, a, p, h2, h3, span, label),
#msStageShell,
#msStageShell :where(div, section, article, form, search, input, button, a, p, h2, h3, span, label, canvas, img),
#fragMansederDialog,
#fragMansederDialog :where(div, section, article, form, search, input, button, a, p, h2, h3, span, label, canvas, img) {
  box-sizing: border-box;
}

/* Visually hidden utility (accessible labels without layout footprint) */
#msReceptionDesk .sr-only,
#msStageShell .sr-only,
#fragMansederDialog .sr-only,
#msReceptionDesk .visually-hidden,
#msStageShell .visually-hidden,
#fragMansederDialog .visually-hidden {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Accessible Focus Rings (>= 3:1 contrast) */
#msReceptionDesk :is(a, button, input, summary, [tabindex]):focus-visible,
#msStageShell :is(a, button, input, summary, [tabindex]):focus-visible,
#fragMansederDialog :is(a, button, input, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--ms-cyan);
  outline-offset: 2px;
}

/* ==========================================================================
   1. HERO RECEPTION DESK (#msReceptionDesk inside .bp-hero-copy)
   ========================================================================== */
#msReceptionDesk {
  margin-block-start: 0.35rem;
  padding: 0.875rem;
  border-radius: 1rem;
  border: 1px solid var(--ms-border-cyan);
  border-block-start: 3px solid var(--ms-gold);
  background: linear-gradient(165deg, rgba(13, 24, 44, 0.94) 0%, rgba(6, 12, 24, 0.96) 100%);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  box-shadow: 0 14px 36px -14px rgba(0, 0, 0, 0.78);
}

#msPassBanner {
  font-family: var(--ms-font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.45;
  padding: 0.625rem 0.75rem;
  border-radius: 0.65rem;
  border: 1px solid var(--ms-border);
  background: rgba(4, 9, 20, 0.82);
  color: var(--ms-soft);
}

#msPassBanner.approved,
#msPassBanner.is-approved {
  border-color: var(--ms-border-emerald);
  background: color-mix(in oklab, #10b981 16%, #040914);
  color: var(--ms-emerald-soft);
}

#msPassBanner.rejected,
#msPassBanner.is-rejected {
  border-color: var(--ms-border-rose);
  background: color-mix(in oklab, #f43f5e 18%, #040914);
  color: var(--ms-rose-soft);
}

.ms-intent-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  min-inline-size: 0;
}

.ms-intent-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-block-size: 2.35rem;
  padding: 0.42rem 0.72rem;
  border-radius: 0.6rem;
  border: 1px solid var(--ms-border);
  background: rgba(16, 29, 54, 0.88);
  color: var(--ms-soft);
  font-family: var(--ms-font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
}

.ms-intent-btn:hover {
  border-color: var(--ms-cyan);
  background: var(--ms-bg-elevated);
  color: var(--ms-text);
}

.ms-intent-btn[data-intent="salon"]:hover {
  border-color: var(--ms-gold);
  color: var(--ms-gold-soft);
}

.ms-intent-btn[data-intent="pitch"] {
  border-color: rgba(244, 63, 94, 0.38);
  color: #fda4af;
}

.ms-intent-btn[data-intent="pitch"]:hover {
  border-color: var(--ms-rose);
  background: rgba(136, 19, 55, 0.34);
  color: #ffe4e6;
}

.ms-intent-btn.active,
.ms-intent-btn[aria-pressed="true"] {
  border-color: var(--ms-cyan);
  background: color-mix(in oklab, #38bdf8 22%, #0b1426);
  color: #ffffff;
}

.ms-intent-btn[data-intent="pitch"].active,
.ms-intent-btn[data-intent="pitch"][aria-pressed="true"] {
  border-color: var(--ms-rose);
  background: color-mix(in oklab, #f43f5e 24%, #0b1426);
  color: #ffe4e6;
}

.ms-intent-btn[data-intent="salon"].active,
.ms-intent-btn[data-intent="salon"][aria-pressed="true"] {
  border-color: var(--ms-gold);
  background: color-mix(in oklab, #fbbf24 20%, #0b1426);
  color: var(--ms-gold-soft);
}

/* Route Results Cards (1–3 Dynamic Destination Cards) */
#msRouteResults,
#fmRouteResults {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12.5rem), 1fr));
  gap: 0.55rem;
  min-inline-size: 0;
}

.ms-route-card,
#msRouteResults > a,
#msRouteResults > article,
#msRouteResults > div {
  background: rgba(7, 14, 28, 0.92);
  border: 1px solid var(--ms-border);
  border-inline-start: 3px solid var(--ms-cyan);
  border-radius: 0.7rem;
  padding: 0.625rem 0.75rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.35rem;
  min-inline-size: 0;
}

.ms-route-card[data-tone="gold"] { border-inline-start-color: var(--ms-gold); }
.ms-route-card[data-tone="emerald"] { border-inline-start-color: var(--ms-emerald); }
.ms-route-card[data-tone="rose"] { border-inline-start-color: var(--ms-rose); }

.ms-route-cat {
  font-family: var(--ms-font-mono);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ms-gold-soft);
  line-height: 1.2;
}

.ms-route-title {
  font-family: var(--ms-font-head);
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--ms-text);
  margin: 0;
}

.ms-route-reason {
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--ms-soft);
  margin: 0;
}

.ms-route-link {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  margin-block-start: 0.15rem;
  padding: 0.36rem 0.58rem;
  min-block-size: 2rem;
  border-radius: 0.48rem;
  border: 1px solid var(--ms-border-cyan);
  background: rgba(56, 189, 248, 0.14);
  color: var(--ms-cyan-soft);
  font-family: var(--ms-font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  text-decoration: none;
  width: fit-content;
  max-inline-size: 100%;
}

.ms-route-link:hover {
  background: rgba(56, 189, 248, 0.28);
  color: #ffffff;
  text-decoration: none;
}

/* Explicit Navigation Countdown Bar */
#msJumpCountdown[hidden] {
  display: none;
}

#msJumpCountdown:not([hidden]) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  padding: 0.6rem 0.75rem;
  border-radius: 0.65rem;
  border: 1.5px solid var(--ms-emerald);
  background: color-mix(in oklab, #10b981 18%, #040914);
}

#msJumpText {
  font-family: var(--ms-font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ms-emerald-soft);
  flex: 1 1 12rem;
  min-inline-size: 0;
}

.ms-jump-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

#msJumpGoBtn,
#msJumpCancelBtn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-block-size: 2.15rem;
  padding: 0.35rem 0.72rem;
  border-radius: 0.5rem;
  font-family: var(--ms-font-mono);
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
}

#msJumpGoBtn {
  border: 1px solid var(--ms-emerald);
  background: var(--ms-emerald);
  color: #022c22;
}

#msJumpCancelBtn {
  border: 1px solid var(--ms-border-rose);
  background: rgba(244, 63, 94, 0.18);
  color: var(--ms-rose-soft);
}

/* ==========================================================================
   2. HERO STAGE SHELL (#msStageShell) & DUAL-HOST HUD
   ========================================================================== */
#msStageShell {
  background: linear-gradient(165deg, rgba(10, 19, 36, 0.96) 0%, rgba(4, 9, 18, 0.98) 100%);
  border: 1.5px solid var(--ms-border-cyan);
  border-radius: 1.25rem;
  padding: 0.85rem;
  box-shadow: 0 24px 60px -15px rgba(0, 0, 0, 0.92), 0 0 34px rgba(56, 189, 248, 0.16);
  display: flex;
  flex-direction: column;
  gap: 0.58rem;
  position: relative;
  overflow: hidden;
}

#msStageShell #bpCanvasStage[hidden]:not([hidden="until-found"]) {
  display: none;
}

#msStageShell.mood-reject {
  border-color: var(--ms-border-rose);
  box-shadow: 0 24px 60px -15px rgba(0, 0, 0, 0.92), 0 0 32px rgba(244, 63, 94, 0.24);
}

#msStageShell.mood-approve {
  border-color: var(--ms-border-emerald);
  box-shadow: 0 24px 60px -15px rgba(0, 0, 0, 0.92), 0 0 32px rgba(16, 185, 129, 0.24);
}

#msStageShell::before {
  content: "";
  position: absolute;
  inset-block-start: 0;
  inset-inline: 0;
  block-size: 3px;
  background: linear-gradient(90deg, var(--ms-rose), var(--ms-gold), var(--ms-cyan), var(--ms-emerald));
}

.ms-stage-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  padding-block-end: 0.5rem;
  border-block-end: 1px solid rgba(255, 255, 255, 0.1);
}

.ms-host-switch,
.ms-lang-switch,
#fmHostSwitch,
#fmLangSwitch {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem;
  border-radius: 999px;
  background: #040811;
  border: 1px solid var(--ms-border);
}

.ms-host-btn,
.ms-lang-btn,
.fm-host-btn,
.fm-lang-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ms-soft);
  font-family: var(--ms-font-mono);
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1.2;
  padding: 0.35rem 0.62rem;
  min-block-size: 2rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

.ms-host-btn:hover,
.ms-lang-btn:hover,
.fm-host-btn:hover,
.fm-lang-btn:hover {
  color: #ffffff;
  border-color: var(--ms-border-cyan);
}

.ms-host-btn.active[data-host="valeria"],
.ms-host-btn[aria-pressed="true"][data-host="valeria"],
.fm-host-btn.active[data-host="valeria"],
.fm-host-btn[aria-pressed="true"][data-host="valeria"] {
  background: linear-gradient(135deg, #f43f5e 0%, #fbbf24 100%);
  color: #040811;
}

.ms-host-btn.active[data-host="amadeus"],
.ms-host-btn[aria-pressed="true"][data-host="amadeus"],
.fm-host-btn.active[data-host="amadeus"],
.fm-host-btn[aria-pressed="true"][data-host="amadeus"] {
  background: linear-gradient(135deg, #38bdf8 0%, #10b981 100%);
  color: #030a14;
}

.ms-lang-btn.active,
.ms-lang-btn[aria-pressed="true"],
.fm-lang-btn.active,
.fm-lang-btn[aria-pressed="true"] {
  background: var(--ms-cyan);
  color: #040811;
}

.ms-stage-tools {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

#msScanModeBtn:not([hidden]),
#msHudMotionBtn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  min-block-size: 2rem;
  padding: 0.34rem 0.62rem;
  border-radius: 0.55rem;
  border: 1px solid var(--ms-border-gold);
  background: rgba(15, 26, 48, 0.9);
  color: var(--ms-gold-soft);
  font-family: var(--ms-font-mono);
  font-size: 0.69rem;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
}

#msScanModeBtn:not([hidden]) {
  border-color: var(--ms-border-cyan);
  color: var(--ms-cyan-soft);
}

#msScanModeBtn:hover,
#msHudMotionBtn:hover {
  background: var(--ms-bg-elevated);
  color: #ffffff;
}

/* Single-Row Stage Mode Tablist ([focusgroup="tablist nomemory"]) */
#msStageShell [focusgroup*="tablist"],
#msStageShell .bp-tablist,
#msStageShell .ms-tablist {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 0.38rem;
  min-inline-size: 0;
  scrollbar-width: none;
  padding-block-end: 0.15rem;
}

#msStageShell [focusgroup*="tablist"]::-webkit-scrollbar,
#msStageShell .bp-tablist::-webkit-scrollbar,
#msStageShell .ms-tablist::-webkit-scrollbar {
  display: none;
}

#msStageShell :is(#msTabConcierge, #bpTab0, #bpTab1, #bpTab2) {
  flex: none;
  position: relative;
  appearance: none;
  background: rgba(15, 26, 48, 0.78);
  border: 1px solid var(--ms-border);
  color: var(--ms-soft);
  font-family: var(--ms-font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.25;
  padding: 0.45rem 0.75rem 0.58rem;
  min-block-size: 2.35rem;
  border-radius: 0.55rem;
  cursor: pointer;
  white-space: nowrap;
}

#msStageShell :is(#msTabConcierge, #bpTab0, #bpTab1, #bpTab2):hover {
  color: #ffffff;
  border-color: var(--ms-cyan);
}

#msStageShell :is(#msTabConcierge, #bpTab0, #bpTab1, #bpTab2)[aria-selected="true"] {
  color: #ffffff;
  background: rgba(14, 42, 71, 0.94);
  border-color: var(--ms-cyan);
}

#msStageShell :is(#msTabConcierge, #bpTab0, #bpTab1, #bpTab2)[aria-selected="true"]::after {
  content: "";
  position: absolute;
  inset-block-end: 2px;
  inset-inline: 0.5rem;
  border-block-end: 3px solid var(--ms-cyan);
}

#msTabConcierge[aria-selected="true"]::after {
  border-block-end-color: var(--ms-gold);
}

#bpTab1[aria-selected="true"]::after {
  border-block-end-color: var(--ms-gold);
}

#bpTab2[aria-selected="true"]::after {
  border-block-end-color: var(--ms-emerald);
}

/* CRITICAL modern-web-guidance Rule:
   ZERO padding, margin, border, or background directly on [role="tabpanel"]!
   Do NOT set display:none/visibility:hidden on [hidden="until-found"]! */
#msStageShell [role="tabpanel"] {
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
}

.ms-panel-inner {
  display: flex;
  flex-direction: column;
  gap: 0.62rem;
  min-inline-size: 0;
}

/* Viewport inside #msPanelConcierge */
.ms-call-viewport,
#msPanelConcierge :has(> #msPortraitValeria) {
  position: relative;
  inline-size: 100%;
  aspect-ratio: 16 / 10;
  min-block-size: 16.25rem;
  border-radius: 0.85rem;
  overflow: hidden;
  background: radial-gradient(circle at 50% 40%, rgba(14, 165, 233, 0.16) 0%, #030712 74%);
  border: 1px solid rgba(56, 189, 248, 0.34);
}

.ms-portrait-img,
#msPortraitValeria,
#msPortraitAmadeus,
#fmPreviewImg {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
  object-position: center 22%;
  filter: contrast(1.04) saturate(1.05);
}

.ms-portrait-img:not([hidden]),
#msPortraitValeria:not([hidden]),
#msPortraitAmadeus:not([hidden]),
#fmPreviewImg:not([hidden]) {
  display: block;
}

@media (prefers-reduced-motion: no-preference) {
  #msStageShell {
    transition: border-color 0.25s ease;
  }
  #msStageShell:not(.ms-motion-paused) :is(#msPortraitValeria, #msPortraitAmadeus) {
    transition: transform 0.55s ease, filter 0.3s ease;
    transform: scale(1.01);
  }
  #msStageShell.is-speaking:not(.ms-motion-paused) :is(#msPortraitValeria, #msPortraitAmadeus) {
    transform: scale(1.04);
    filter: contrast(1.08) saturate(1.08) brightness(1.03);
  }
}

#msStageShell.mood-reject :is(#msPortraitValeria, #msPortraitAmadeus) {
  filter: contrast(1.1) saturate(1.12) sepia(0.12) hue-rotate(-12deg);
}

#msPortraitVignette {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(4, 8, 17, 0.3) 0%, rgba(4, 8, 17, 0.05) 38%, rgba(4, 8, 17, 0.8) 100%);
  pointer-events: none;
  z-index: 1;
}

#msHudCanvas,
#fmPreviewCanvas {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  display: block;
  pointer-events: none;
  z-index: 2;
}

#msHudBadgeLeft,
#fmPreviewBadge {
  position: absolute;
  inset-block-start: 0.625rem;
  inset-inline-start: 0.75rem;
  z-index: 3;
  font-family: var(--ms-font-mono);
  font-size: 0.625rem;
  font-weight: 800;
  line-height: 1.2;
  color: var(--ms-gold-soft);
  background: rgba(4, 8, 17, 0.84);
  border: 1px solid rgba(251, 191, 36, 0.42);
  padding: 0.25rem 0.5rem;
  border-radius: 0.4rem;
  pointer-events: none;
}

#msHudStatusPill,
#fmPreviewStatus {
  position: absolute;
  inset-block-start: 0.625rem;
  inset-inline-end: 0.75rem;
  z-index: 3;
  font-family: var(--ms-font-mono);
  font-size: 0.625rem;
  font-weight: 800;
  line-height: 1.2;
  color: var(--ms-cyan-soft);
  background: rgba(4, 8, 17, 0.86);
  border: 1px solid rgba(56, 189, 248, 0.44);
  padding: 0.25rem 0.5rem;
  border-radius: 0.4rem;
  pointer-events: none;
}

#msStageShell.mood-reject #msHudStatusPill,
#fragMansederDialog.mood-reject #fmPreviewStatus {
  color: var(--ms-rose-soft);
  border-color: var(--ms-border-rose);
  background: rgba(136, 19, 55, 0.8);
}

#msStageShell.mood-approve #msHudStatusPill,
#fragMansederDialog.mood-approve #fmPreviewStatus {
  color: var(--ms-emerald-soft);
  border-color: var(--ms-border-emerald);
  background: rgba(6, 78, 59, 0.82);
}

/* Modal preview column uses flex-column badge flow so badge & status pill never overlap */
#fragMansederDialog #fmPreviewBadge,
#fragMansederDialog #fmPreviewStatus {
  position: relative;
  inset: auto;
  max-inline-size: 100%;
}

@media (max-width: 640px) {
  .ms-call-viewport,
  #msPanelConcierge :has(> #msPortraitValeria) {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.32rem;
    padding: 0.55rem;
    min-block-size: 17.5rem;
  }
  #msHudBadgeLeft,
  #msHudStatusPill {
    position: relative;
    inset: auto;
    font-size: 0.575rem;
    padding: 0.2rem 0.44rem;
    max-inline-size: 100%;
  }
  #fragMansederDialog #fmPreviewBadge,
  #fragMansederDialog #fmPreviewStatus {
    font-size: 0.575rem;
    padding: 0.2rem 0.44rem;
  }
}

#msCaptionBox {
  position: absolute;
  inset-inline: 0.75rem;
  inset-block-end: 0.625rem;
  z-index: 4;
  background: rgba(4, 8, 17, 0.9);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(56, 189, 248, 0.36);
  border-radius: 0.7rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--ms-text);
  max-block-size: 6.5rem;
  overflow-y: auto;
}

#msCaptionSpeaker,
#fmPreviewSpeaker {
  font-family: var(--ms-font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--ms-rose-soft);
  margin-inline-end: 0.4rem;
}

#msCaptionSpeaker.amadeus,
#fmPreviewSpeaker.amadeus {
  color: var(--ms-cyan);
}

/* Controls below viewport */
.ms-call-controls {
  background: rgba(8, 15, 30, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 0.8rem;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.ms-call-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

#msBtnSpeak,
#msBtnMute,
#msBtnMic,
#msBtnOpenExpanded {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-block-size: 2.35rem;
  padding: 0.45rem 0.8rem;
  border-radius: 0.6rem;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.2;
  cursor: pointer;
}

#msBtnSpeak {
  flex: 1 1 11rem;
  border: 1px solid rgba(251, 191, 36, 0.65);
  background: linear-gradient(135deg, #e11d48 0%, #f59e0b 100%);
  color: #08040b;
}

#msBtnSpeak.amadeus-mode {
  border-color: rgba(16, 185, 129, 0.65);
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  color: #03150e;
}

#msBtnMute {
  border: 1px solid var(--ms-border-rose);
  background: rgba(244, 63, 94, 0.16);
  color: var(--ms-rose-soft);
}

#msBtnMute.is-muted {
  border-color: var(--ms-border-gold);
  background: rgba(251, 191, 36, 0.18);
  color: var(--ms-gold-soft);
}

#msBtnMic:not([hidden]),
#fmMicBtn:not([hidden]) {
  border: 1px solid var(--ms-border-cyan);
  background: rgba(56, 189, 248, 0.14);
  color: var(--ms-cyan-soft);
}

#msBtnMic.is-listening,
#fmMicBtn.is-listening {
  border-color: var(--ms-rose);
  background: rgba(244, 63, 94, 0.28);
  color: #ffffff;
}

#msBtnOpenExpanded {
  border: 1px solid var(--ms-border-cyan);
  background: rgba(14, 165, 233, 0.18);
  color: var(--ms-cyan-soft);
}

#msBtnOpenExpanded:hover {
  background: rgba(14, 165, 233, 0.32);
  color: #ffffff;
}

.ms-topic-grid,
.ms-topic-pills {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.42rem;
}

@media (max-width: 520px) {
  .ms-topic-grid,
  .ms-topic-pills {
    grid-template-columns: 1fr;
  }
}

.ms-topic-btn {
  appearance: none;
  text-align: left;
  padding: 0.45rem 0.65rem;
  min-block-size: 2.25rem;
  border-radius: 0.55rem;
  border: 1px solid var(--ms-border);
  background: var(--ms-bg-card);
  color: var(--ms-soft);
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.3;
  cursor: pointer;
}

.ms-topic-btn:hover,
.ms-topic-btn.active {
  border-color: var(--ms-cyan);
  background: var(--ms-bg-elevated);
  color: #ffffff;
}

#msAskForm {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

#msAskInput {
  flex: 1 1 12rem;
  min-inline-size: 0;
  min-block-size: 2.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.55rem;
  border: 1px solid var(--ms-border);
  background: #040811;
  color: var(--ms-text);
  font-size: max(1rem, 1em);
  line-height: 1.35;
}

#msAskInput:focus {
  border-color: var(--ms-cyan);
}

#msAskSendBtn {
  appearance: none;
  min-block-size: 2.5rem;
  padding: 0.5rem 0.85rem;
  border-radius: 0.55rem;
  border: 1px solid var(--ms-border-cyan);
  background: rgba(56, 189, 248, 0.2);
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
}

#msAskSendBtn:hover {
  background: rgba(56, 189, 248, 0.34);
}

/* ==========================================================================
   3. UNIFIED EXPANDED MODAL (dialog#fragMansederDialog)
   ========================================================================== */
dialog#fragMansederDialog {
  margin: auto;
  inline-size: min(58rem, calc(100dvw - 1.5rem));
  max-block-size: calc(100dvh - 2rem);
  background: var(--ms-bg-panel);
  color: var(--ms-text);
  border: 1.5px solid var(--ms-border-cyan);
  border-radius: 1.25rem;
  padding: 0;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.88), 0 0 42px rgba(56, 189, 248, 0.22);
  overflow: hidden;
}

dialog#fragMansederDialog[open] {
  display: flex;
  flex-direction: column;
}

dialog#fragMansederDialog:modal {
  overscroll-behavior: contain;
}

dialog#fragMansederDialog::backdrop {
  background: rgba(3, 6, 14, 0.8);
  backdrop-filter: blur(6px);
  overflow: hidden;
  overscroll-behavior: contain;
}

#fragMansederDialog .fm-header {
  background: linear-gradient(135deg, #0b1426 0%, #172554 100%);
  padding: 0.9rem 1.15rem;
  border-block-end: 1px solid var(--ms-border);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.65rem;
}

#fragMansederDialog .fm-title {
  font-family: var(--ms-font-head);
  font-size: clamp(1rem, 1.5vw, 1.18rem);
  font-weight: 800;
  line-height: 1.25;
  color: #ffffff;
  margin: 0;
}

#fragMansederDialog .fm-sub {
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--ms-soft);
  margin-block-start: 0.15rem;
}

#fragMansederDialog .fm-header-controls,
#fragMansederDialog .fm-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

#fragMansederDialog .fm-close {
  appearance: none;
  min-block-size: 2.25rem;
  padding: 0.4rem 0.8rem;
  border-radius: 0.6rem;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
}

#fragMansederDialog .fm-close:hover {
  background: rgba(244, 63, 94, 0.28);
  border-color: var(--ms-rose);
}

#fragMansederDialog .fm-body {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.25fr);
  gap: 0.85rem;
  padding: 0.9rem 1.15rem;
  overflow-y: auto;
  min-block-size: 0;
  flex: 1 1 auto;
  background: #060b16;
}

@media (max-width: 780px) {
  #fragMansederDialog .fm-body {
    grid-template-columns: 1fr;
  }
}

#fragMansederDialog .fm-left-col,
#fragMansederDialog .fm-right-col {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-inline-size: 0;
}

#fragMansederDialog .fm-preview-stage,
#fragMansederDialog :has(> #fmPreviewImg) {
  position: relative;
  inline-size: 100%;
  aspect-ratio: 16 / 10;
  min-block-size: 12.5rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.32rem;
  padding: 0.55rem;
  border-radius: 0.85rem;
  overflow: hidden;
  border: 1px solid var(--ms-border-cyan);
  background: radial-gradient(circle at 50% 40%, rgba(14, 165, 233, 0.16) 0%, #030712 75%);
}

#fmPreviewSpeakerBar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.42rem 0.7rem;
  border-radius: 0.55rem;
  border: 1px solid var(--ms-border);
  background: rgba(11, 20, 38, 0.88);
  font-size: 0.75rem;
}

#fmChatArea {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  overflow-y: auto;
  min-block-size: 10rem;
  max-block-size: 18rem;
  border-radius: 0.8rem;
  border: 1px solid var(--ms-border);
  background: #040812;
}

#fragMansederDialog .fm-msg {
  padding: 0.65rem 0.85rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  line-height: 1.5;
  max-inline-size: 92%;
  overflow-wrap: anywhere;
}

#fragMansederDialog .fm-msg.bot {
  background: #132038;
  border: 1px solid #283a5e;
  border-inline-start: 4px solid var(--ms-emerald);
  color: #f1f5f9;
  align-self: flex-start;
}

#fragMansederDialog .fm-msg.bot.is-reject {
  border-inline-start-color: var(--ms-rose);
  background: #231120;
}

#fragMansederDialog .fm-msg.user {
  background: #0284c7;
  color: #ffffff;
  font-weight: 600;
  align-self: flex-end;
}

#fmPresets {
  padding: 0.65rem 1.15rem;
  background: #0d1629;
  border-block-start: 1px solid var(--ms-border);
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

#fragMansederDialog .fm-preset-btn {
  appearance: none;
  background: #1a2742;
  color: #e2e8f0;
  border: 1px solid #334155;
  padding: 0.42rem 0.72rem;
  min-block-size: 2.15rem;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.25;
  cursor: pointer;
  text-align: left;
}

#fragMansederDialog .fm-preset-btn:hover {
  background: #0284c7;
  border-color: var(--ms-cyan);
  color: #ffffff;
}

#fmAskForm {
  padding: 0.75rem 1.15rem;
  background: #0b1324;
  border-block-start: 1px solid var(--ms-border);
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}

#fmUserInput {
  flex: 1 1 14rem;
  min-inline-size: 0;
  min-block-size: 2.65rem;
  background: #050912;
  border: 1px solid #334155;
  color: #ffffff;
  padding: 0.55rem 0.85rem;
  border-radius: 0.6rem;
  font-size: max(1rem, 1em);
  line-height: 1.35;
}

#fmUserInput:focus {
  border-color: var(--ms-cyan);
}

#fmSendBtn {
  appearance: none;
  min-block-size: 2.65rem;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #022c22;
  border: 1px solid var(--ms-emerald);
  padding: 0.55rem 1rem;
  border-radius: 0.6rem;
  font-weight: 800;
  font-size: 0.84rem;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
}

#fmSendBtn:hover {
  filter: brightness(1.08);
}

#fmMicBtn:not([hidden]) {
  appearance: none;
  min-block-size: 2.65rem;
  padding: 0.55rem 0.8rem;
  border-radius: 0.6rem;
  font-size: 0.84rem;
  font-weight: 800;
  cursor: pointer;
}

/* ==========================================================================
   4. COARSE POINTER TOUCH TARGETS (WCAG 2.5.8 / 2.5.5 >= 2.75rem / 44px)
   ========================================================================== */
@media (pointer: coarse) {
  .ms-intent-btn,
  .ms-host-btn,
  .ms-lang-btn,
  .ms-topic-btn,
  .ms-route-link,
  #msScanModeBtn:not([hidden]),
  #msHudMotionBtn,
  #msBtnSpeak,
  #msBtnMute,
  #msBtnMic:not([hidden]),
  #msBtnOpenExpanded,
  #msAskSendBtn,
  #msJumpGoBtn,
  #msJumpCancelBtn,
  #msStageShell :is(#msTabConcierge, #bpTab0, #bpTab1, #bpTab2),
  #fragMansederDialog :is(.fm-host-btn, .fm-lang-btn, .fm-preset-btn, .fm-close, #fmMicBtn:not([hidden]), #fmSendBtn) {
    min-block-size: 2.75rem;
  }
}

/* ==========================================================================
   5. REDUCED MOTION & FORCED COLORS (High Contrast Accessibility)
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  #msStageShell,
  #msStageShell :where(.ms-portrait-img, .ms-intent-btn, .ms-host-btn, .ms-lang-btn, .ms-topic-btn),
  #fragMansederDialog {
    transition: none;
    animation: none;
  }
}

.ms-motion-paused :where(.ms-portrait-img, .pulse-dot, .fab-pulse) {
  animation-play-state: paused;
  transition: none;
}

@media (forced-colors: active) {
  #msReceptionDesk,
  #msPassBanner,
  #msStageShell,
  .ms-intent-btn,
  .ms-route-card,
  .ms-route-link,
  .ms-host-btn,
  .ms-lang-btn,
  .ms-topic-btn,
  #msScanModeBtn,
  #msHudMotionBtn,
  #msBtnSpeak,
  #msBtnMute,
  #msBtnMic,
  #msBtnOpenExpanded,
  #msAskInput,
  #msAskSendBtn,
  #msCaptionBox,
  #msJumpCountdown,
  #msStageShell :is(#msTabConcierge, #bpTab0, #bpTab1, #bpTab2),
  dialog#fragMansederDialog,
  #fragMansederDialog :is(.fm-host-btn, .fm-lang-btn, .fm-preset-btn, .fm-close, .fm-msg, #fmUserInput, #fmSendBtn, #fmMicBtn) {
    border: 2px solid ButtonText !important;
    forced-color-adjust: auto;
  }

  #msStageShell :is(#msTabConcierge, #bpTab0, #bpTab1, #bpTab2)[aria-selected="true"]::after {
    border-block-end: 4px solid Highlight !important;
  }

  .ms-intent-btn.active,
  .ms-intent-btn[aria-pressed="true"],
  .ms-host-btn.active,
  .ms-lang-btn.active,
  .fm-host-btn.active,
  .fm-lang-btn.active,
  #msPassBanner.approved,
  #msPassBanner.rejected {
    border: 3px solid Highlight !important;
  }
}
