/* ═══════════════════════════════════════════════════════════════
   CLOTO WIZARD — Conversational UI
   Chat-bubble paradigm. Phases as pills. Spiral avatar.

   Architecture:
     #fbw-workspace-chat
       .wiz-chat-header             (logo + label)
       .wiz-conversation            (flex:1, overflow-y:auto)
       .wiz-input                   (sticky bottom)
       .wiz-drawer-overlay          (absolute overlay, z:50)
   ═══════════════════════════════════════════════════════════════ */


/* ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
   §3  CONVERSATION — scrollable column
   ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ */

.wiz-conversation {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 10px 24px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  z-index: 1;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}

/* ── Landing mode — centered like Claude/ChatGPT new chat ── */
.fbw-wizard-overlay:has(.wiz-conversation--landing) {
  justify-content: center;
}
.wiz-conversation--landing {
  flex: none;
  justify-content: center;
  align-items: center;
  gap: 0;
  padding-bottom: 0;
  overflow: visible;
}
.wiz-conversation--landing ~ .wiz-input {
  flex: none;
  margin-top: var(--space-8);
}

.wiz-landing {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  text-align: center;
  padding: 0 var(--space-10);
  animation: wiz-landing-in 0.8s var(--ease-sheet) both;
}

.wiz-landing__spiral {
  margin-bottom: var(--space-8);
}

.wiz-landing__greeting {
  font-family: var(--cloto-font-brand);
  font-size: 28px;
  font-weight: 400;
  color: var(--cloto-text-100);
  margin: 0 0 var(--space-4) 0;
  letter-spacing: 0.01em;
}

.wiz-landing__sub {
  font-family: var(--cloto-font-ui);
  font-size: var(--cloto-fs-md);
  color: var(--cloto-text-40);
  margin: 0;
  font-style: italic;
}

@keyframes wiz-landing-in {
  0% { opacity: 0; transform: translateY(12px) scale(0.97); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Minimal scrollbar */
.wiz-conversation::-webkit-scrollbar { width: 4px; }
.wiz-conversation::-webkit-scrollbar-track { background: transparent; }
.wiz-conversation::-webkit-scrollbar-thumb {
  background: var(--cloto-text-25);
  border-radius: 2px;
}

/* Scroll-to-bottom FAB — centered above input */
.wiz-scroll-bottom {
  position: absolute;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%) scale(0.8);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--cloto-text-15);
  background: var(--cloto-zone-chat);
  color: var(--cloto-text-60);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms, transform 200ms;
  z-index: 10;
  box-shadow: 0 2px 8px var(--cloto-black-a15);
  padding: 0;
}
.wiz-scroll-bottom.is-visible {
  opacity: 1;
  transform: translateX(-50%) scale(1);
  pointer-events: auto;
}
.wiz-scroll-bottom:hover {
  background: var(--cloto-surface-alt);
  color: var(--cloto-text-80);
}


/* ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
   §4  BUBBLES — cloto · user · system · loading
   ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ */

.wiz-bubble {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 2px;
}

/* Entrance animation */
.wiz-bubble--animate {
  opacity: 0;
  transform: translateY(10px);
  animation: wiz-bubble-in 0.45s var(--ease-sheet) forwards;
}

@keyframes wiz-bubble-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Cloto bubble ── */
.wiz-bubble--cloto {
  flex-direction: row;
}
.wiz-bubble--cloto .wiz-bubble__body {
  max-width: 78%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.wiz-bubble--cloto .wiz-bubble__content {
  background: var(--cloto-glass-bg);
  border: 1px solid var(--cloto-glass-border);
  border-radius: 2px 14px 14px 14px;
  padding: 13px 18px;
  color: var(--cloto-text-100);
  font-size: var(--cloto-fs-reading);
  font-family: var(--cloto-font-ui);
  line-height: 1.65;
}

/* ── User bubble ── */
.wiz-bubble--user {
  flex-direction: row-reverse;
}
.wiz-bubble--user .wiz-bubble__body {
  max-width: 78%;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.wiz-bubble--user .wiz-bubble__content {
  background: rgba(94, 198, 198, 0.05);
  border: 1px solid var(--cloto-teal-a10);
  border-radius: 14px 2px 14px 14px;
  padding: 13px 18px;
  color: var(--cloto-text-100);
  font-size: var(--cloto-fs-reading);
  font-family: var(--cloto-font-ui);
  line-height: 1.65;
}

/* ── System bubble (centered pill) ── */
.wiz-bubble--system {
  justify-content: center;
  padding: 8px 0 4px;
}
.wiz-bubble--system .wiz-bubble__content {
  font-size: 11px;
  font-family: var(--cloto-font-ui);
  letter-spacing: 0.5px;
  color: var(--cloto-gold);
  background: var(--cloto-surface-alt);
  padding: 3px 14px;
  border-radius: 10px;
  display: inline-block;
}

/* ── Loading bubble (Cloto's poetic voice) ── */
.wiz-bubble--loading {
  flex-direction: row;
  align-items: center;
}
.wiz-bubble--loading .wiz-spiral {
  margin-top: 0 !important;
}
.wiz-bubble--loading .wiz-bubble__body {
  max-width: 78%;
}
.wiz-bubble--loading .wiz-bubble__content {
  background: transparent;
  border: none;
  padding: 10px 0;
  color: var(--cloto-gold);
  font-size: 16px;
  font-family: var(--cloto-font-brand);
  font-style: italic;
  line-height: 1.65;
  letter-spacing: 1.5px;
}

/* ── Cloto voice — used for poetic phrases (brand font) ── */
.wiz-cloto-voice {
  font-family: var(--cloto-font-brand);
  font-style: italic;
  letter-spacing: 0.5px;
}

/* Animated ellipsis on loading */
.wiz-ellipsis::after {
  content: '...';
  animation: wiz-ellipsis 1.5s ease-in-out infinite;
}
@keyframes wiz-ellipsis {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}


/* ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
   §5  SPIRAL — avatar SVG, 5 states
   ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ */

.wiz-spiral {
  flex-shrink: 0;
}

/* ── idle / respira: center breathes (8s), wave propagates outward ── */
.wiz-spiral--idle .center    { animation: wiz-sp-breathe-center 8s ease-in-out infinite; }
.wiz-spiral--idle .arc-inner { animation: wiz-sp-breathe-inner  8s ease-in-out infinite 0.6s; }
.wiz-spiral--idle .arc-outer { animation: wiz-sp-breathe-outer  8s ease-in-out infinite 1.2s; }

/* ── listening / ascolta: center reactive (1.4s), inner arc pulses ── */
.wiz-spiral--listening .arc-inner { animation: wiz-sp-listen-inner 1.4s ease-in-out infinite; }
.wiz-spiral--listening .center    { animation: wiz-sp-listen 1.4s ease-in-out infinite; }

/* ── weaving / tesse: arcs draw in/out sequentially (4s, stagger 0.4s) ── */
.wiz-spiral--weaving .arc-outer { animation: wiz-sp-weave-outer 4s ease-in-out infinite; stroke-dasharray: 190; }
.wiz-spiral--weaving .arc-inner { animation: wiz-sp-weave-inner 4s ease-in-out infinite 0.4s; stroke-dasharray: 120; }
.wiz-spiral--weaving .center    { animation: wiz-sp-wcenter 4s ease-in-out infinite 0.8s; transform-origin: center; }

/* ── reflecting / riflette: slow rotation (16s), center oscillation (5s) ── */
.wiz-spiral--reflecting .center { animation: wiz-sp-reflect 5s ease-in-out infinite; }
.wiz-spiral--reflecting svg     { animation: wiz-sp-rot 16s linear infinite; }

/* ── past / spento: no animation, dimmed ── */
.wiz-spiral--past { opacity: 0.3; }
.wiz-spiral--past .center    { animation: none; }
.wiz-spiral--past .arc-inner { animation: none; }
.wiz-spiral--past .arc-outer { animation: none; }

/* ── celebrating / celebra: burst glow (3.5s), staggered arcs ── */
.wiz-spiral--celebrating svg        { animation: wiz-sp-celeb-glow 3.5s ease-out infinite; }
.wiz-spiral--celebrating .arc-outer { animation: wiz-sp-celeb-burst 3.5s ease-out infinite; }
.wiz-spiral--celebrating .arc-inner { animation: wiz-sp-celeb-burst 3.5s ease-out infinite 0.2s; }
.wiz-spiral--celebrating .center    { animation: wiz-sp-celeb-center 3.5s ease-out infinite; }

/* ── Keyframes — Respira (brand ref) ── */
@keyframes wiz-sp-breathe-center { 0%, 100% { r: 7; opacity: 1; }   50% { r: 8.5; opacity: 0.75; } }
@keyframes wiz-sp-breathe-inner  { 0%, 100% { opacity: 0.55; }      50% { opacity: 0.75; } }
@keyframes wiz-sp-breathe-outer  { 0%, 100% { opacity: 1; }         50% { opacity: 0.82; } }

/* ── Keyframes — Ascolta (brand ref) ── */
@keyframes wiz-sp-listen {
  0%, 100% { r: 7; } 30% { r: 6; } 60% { r: 8; }
}
@keyframes wiz-sp-listen-inner {
  0%, 100% { opacity: 0.55; } 50% { opacity: 0.75; }
}

/* ── Keyframes — Tesse (brand ref) ── */
@keyframes wiz-sp-weave-outer {
  0%, 10% { stroke-dashoffset: 190; opacity: 0; }
  30%, 70% { stroke-dashoffset: 0; opacity: 1; }
  90%, 100% { stroke-dashoffset: -190; opacity: 0; }
}
@keyframes wiz-sp-weave-inner {
  0%, 10% { stroke-dashoffset: 120; opacity: 0; }
  30%, 70% { stroke-dashoffset: 0; opacity: 0.55; }
  90%, 100% { stroke-dashoffset: -120; opacity: 0; }
}
@keyframes wiz-sp-wcenter {
  0%, 20% { opacity: 0; transform: scale(0.5); }
  40%, 60% { opacity: 1; transform: scale(1); }
  80%, 100% { opacity: 0; transform: scale(0.5); }
}

/* ── Keyframes — Riflette (brand ref) ── */
@keyframes wiz-sp-reflect {
  0%, 100% { r: 7; fill: #d4af5c; }
  50% { r: 9; fill: #c9a84c; }
}
@keyframes wiz-sp-rot {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ── Keyframes — Celebra (brand ref) ── */
@keyframes wiz-sp-celeb-burst {
  0%   { stroke-width: 8; opacity: 1; }
  40%  { stroke-width: 12; opacity: 1; }
  100% { stroke-width: 8; opacity: 0.15; }
}
@keyframes wiz-sp-celeb-center {
  0%   { r: 7; fill: #d4af5c; }
  30%  { r: 13; fill: #c9a84c; }
  60%  { r: 9; fill: #d4af5c; }
  100% { r: 7; fill: #d4af5c; }
}
@keyframes wiz-sp-celeb-glow {
  0%   { filter: drop-shadow(0 0 0 rgba(94,198,198,0)); }
  30%  { filter: drop-shadow(0 0 12px rgba(94,198,198,0.6)); }
  100% { filter: drop-shadow(0 0 0 rgba(94,198,198,0)); }
}

/* ── §5b  Brand spiral keyframes (accoglie, attende) ── */
@keyframes cloto-accoglie-scale {
  0%   { transform: scale(0.4); opacity: 0; }
  50%  { transform: scale(1.03); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes cloto-accoglie-arc {
  0%   { stroke-dashoffset: var(--arc-dash); opacity: 0; }
  100% { stroke-dashoffset: 0; opacity: var(--arc-opacity); }
}
@keyframes cloto-accoglie-center {
  0%   { r: 0; opacity: 0; }
  60%  { r: 9; opacity: 1; }
  100% { r: 7; opacity: 1; }
}
@keyframes cloto-await-center {
  0%, 100% { r: 7; fill: #d4af5c; opacity: 1; }
  50%      { r: 7; fill: #c9a84c; opacity: 0.5; }
}
@keyframes cloto-await-outer {
  0%, 100% { stroke-dashoffset: 0; }
  50%      { stroke-dashoffset: 15; }
}

/* ── §5c  Brand spiral classes ── */
.cloto-respira .center    { animation: wiz-sp-breathe-center 8s ease-in-out infinite; }
.cloto-respira .arc-inner { animation: wiz-sp-breathe-inner  8s ease-in-out infinite 0.6s; }
.cloto-respira .arc-outer { animation: wiz-sp-breathe-outer  8s ease-in-out infinite 1.2s; }

.cloto-attende .center    { animation: cloto-await-center 8s ease-in-out infinite; }
.cloto-attende .arc-outer { animation: cloto-await-outer  13s ease-in-out infinite; }

.cloto-tesse .arc-outer { animation: wiz-sp-weave-outer 4s ease-in-out infinite; stroke-dasharray: 190; }
.cloto-tesse .arc-inner { animation: wiz-sp-weave-inner 4s ease-in-out infinite 0.4s; stroke-dasharray: 120; }
.cloto-tesse .center    { animation: wiz-sp-wcenter 4s ease-in-out infinite 0.8s; transform-origin: center; }

.cloto-riflette svg     { animation: wiz-sp-rot 16s linear infinite; }
.cloto-riflette .center { animation: wiz-sp-reflect 5s ease-in-out infinite; }

.cloto-ascolta .center    { animation: wiz-sp-listen 1.4s ease-in-out infinite; }
.cloto-ascolta .arc-inner { animation: wiz-sp-listen-inner 1.4s ease-in-out infinite; }

.cloto-celebra svg        { animation: wiz-sp-celeb-glow 3.5s ease-out infinite; }
.cloto-celebra .arc-outer { animation: wiz-sp-celeb-burst 3.5s ease-out infinite; }
.cloto-celebra .arc-inner { animation: wiz-sp-celeb-burst 3.5s ease-out infinite 0.2s; }
.cloto-celebra .center    { animation: wiz-sp-celeb-center 3.5s ease-out infinite; }

.cloto-accoglie svg        { animation: cloto-accoglie-scale 2s var(--ease-sheet) forwards; }
.cloto-accoglie .arc-outer { --arc-dash: 190; --arc-opacity: 1;
                             stroke-dashoffset: 190; opacity: 0;
                             animation: cloto-accoglie-arc 1.3s ease-out 0.6s forwards; }
.cloto-accoglie .arc-inner { --arc-dash: 120; --arc-opacity: 0.55;
                             stroke-dashoffset: 120; opacity: 0;
                             animation: cloto-accoglie-arc 1.3s ease-out 1.1s forwards; }
.cloto-accoglie .center    { r: 0; opacity: 0;
                             animation: cloto-accoglie-center 1s ease-out 1.6s forwards; }


/* ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
   §6  REASONING — "perché questa domanda?"
   ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ */

.wiz-reasoning-trigger {
  background: none;
  border: none;
  color: var(--cloto-text-25);
  cursor: pointer;
  padding: 4px 0;
  font-size: 12px;
  font-family: var(--cloto-font-ui);
  font-style: italic;
  transition: color 0.2s;
}
.wiz-reasoning-trigger:hover {
  color: var(--cloto-text-40);
}

.wiz-reasoning-text {
  font-size: 13px;
  color: var(--cloto-text-40);
  font-style: italic;
  padding: 2px 16px 8px;
  line-height: 1.55;
  font-family: var(--cloto-font-ui);
}


/* ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
   §7  PHASE PILLS — separator with lines
   ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ */

.wiz-phase-separator {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 0 4px;
}
.wiz-phase-separator::before,
.wiz-phase-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--cloto-glass-border);
}

.wiz-phase-pill {
  background: transparent;
  border: 1px solid var(--cloto-text-25);
  border-radius: 20px;
  padding: 5px 16px;
  color: var(--cloto-text-40);
  font-size: 11px;
  font-family: var(--cloto-font-ui);
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.wiz-phase-pill--active {
  background: var(--cloto-teal-deep);
  border-color: var(--cloto-teal);
  color: var(--cloto-teal);
  cursor: default;
}

.wiz-phase-pill--collapsed {
  /* default: transparent bg, text-25 border */
}

.wiz-phase-chevron {
  font-size: 9px;
  display: inline-block;
  transition: transform 0.2s;
}
.wiz-phase-pill--expanded .wiz-phase-chevron {
  transform: rotate(90deg);
}

.wiz-phase-progress {
  font-size: var(--cloto-fs-2xs);
  opacity: 0.7;
  font-family: var(--cloto-font-ui);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

.wiz-phase-summary {
  font-size: 11px;
  color: var(--cloto-text-25);
  font-family: var(--cloto-font-ui);
  font-style: italic;
  text-align: center;
  margin-top: 4px;
}

/* Messages belonging to a collapsed phase */
.wiz-phase-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease;
}
.wiz-phase-messages--collapsed {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}

/* History divider — minimal past-phase summary */
.wiz-history {
  margin: 6px 0 10px;
}
.wiz-history__trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 0;
}
.wiz-history__line {
  flex: 1;
  height: 1px;
  background: var(--cloto-glass-border);
  opacity: 0.5;
}
.wiz-history__label {
  font-size: 11px;
  color: var(--cloto-text-25);
  font-family: var(--cloto-font-ui);
  white-space: nowrap;
  transition: color 0.2s;
}
.wiz-history__trigger:hover .wiz-history__label {
  color: var(--cloto-text-40);
}
.wiz-history__content {
  display: none;   /* collapsed by default */
  margin-top: 8px;
  padding: 8px 0;
  border-left: 1px solid var(--cloto-glass-border);
  margin-left: 12px;
  padding-left: 12px;
  flex-direction: column;
  gap: 8px;
}
.wiz-history--open .wiz-history__content {
  display: flex;   /* visible when expanded */
}
.wiz-history__content .wiz-bubble {
  opacity: 0.6;
  font-size: 0.92em;
}
.wiz-history--open .wiz-history__label::after {
  content: ' \2191';
}

/* ── Analysis card ─────────────────────────────────────────── */
.wiz-analysis-card {
  margin: 12px 0 16px;
  padding: 16px 20px;
  background: var(--cloto-glass-bg);
  border: 1px solid var(--cloto-glass-border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.wiz-analysis-scope {
  margin: 0;
  font-family: var(--cloto-font-brand);
  font-size: 1.15em;
  font-weight: 500;
  font-style: italic;
  color: var(--cloto-text-90);
  letter-spacing: 0.02em;
}
.wiz-analysis-themes,
.wiz-analysis-chars,
.wiz-analysis-conflict {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.wiz-analysis-label {
  font-size: 0.72em;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cloto-text-25);
}
.wiz-analysis-values {
  font-size: 0.92em;
  color: var(--cloto-text-70);
  line-height: 1.5;
}

/* ── Scope chips ───────────────────────────────────────────── */
.wiz-scope-chips {
  display: flex;
  gap: 8px;
  margin: 8px 0 16px;
  flex-wrap: wrap;
}
.wiz-scope-chip {
  background: transparent;
  border: 1px solid var(--cloto-glass-border);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 0.82em;
  color: var(--cloto-text-40);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}
.wiz-scope-chip:hover {
  border-color: var(--cloto-glass-border-active);
  color: var(--cloto-text-70);
}
.wiz-scope-chip--active {
  border-color: var(--cloto-teal);
  color: var(--cloto-teal);
  background: var(--cloto-teal-deep, rgba(0,210,190,0.08));
}
.wiz-scope-chip--subtle {
  font-style: italic;
  opacity: 0.6;
  border-style: dashed;
}
.wiz-scope-chip--subtle:hover {
  opacity: 1;
}


/* ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
   §8  INPUT AREA — sticky bottom, pill container
   ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ */

.wiz-input {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}

.wiz-input__bar {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  background: var(--cloto-surface);
  border: 1px solid var(--cloto-glass-border);
  border-radius: 20px;
  padding: 6px 6px 6px 18px;
  transition: border-color 0.3s;
}
.wiz-input__bar--focused {
  border-color: var(--cloto-glass-border-active);
}

.wiz-input__field {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  box-shadow: none;
  -webkit-appearance: none;
  color: var(--cloto-text-100);
  font-size: var(--cloto-fs-reading);
  line-height: 1.5;
  resize: none;
  font-family: var(--cloto-font-ui);
  padding: 7px 0;
  min-height: 24px;
  max-height: 180px;
  scrollbar-width: none;
}
.wiz-input__field::-webkit-scrollbar {
  display: none;
}
.wiz-input__field:focus {
  outline: none;
  border: none;
  box-shadow: none;
}
.wiz-input__field::placeholder {
  color: var(--cloto-text-40);
}

.wiz-input__send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.wiz-input__send--active {
  background: var(--cloto-teal);
  cursor: pointer;
}
.wiz-input__send--inactive {
  background: var(--cloto-surface-alt);
  cursor: default;
}

.wiz-input__send svg {
  transition: stroke 0.2s;
}

/* Disabled state */
.wiz-input--disabled .wiz-input__field {
  opacity: 0.4;
  pointer-events: none;
}
.wiz-input--disabled .wiz-input__send {
  opacity: 0.3;
  pointer-events: none;
}

/* ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
   §9  DRAWER — bottom sheet overlay
   ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ */

.wiz-drawer-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
}

.wiz-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: var(--cloto-black-a50);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.wiz-drawer-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 82%;
  background: var(--cloto-surface);
  border-radius: 16px 16px 0 0;
  border: 1px solid var(--cloto-glass-border);
  border-bottom: none;
  display: flex;
  flex-direction: column;
  padding: 14px 22px 16px;
  animation: wiz-drawer-slide 0.35s var(--ease-sheet);
}

@keyframes wiz-drawer-slide {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.wiz-drawer-handle {
  width: 32px;
  height: 3px;
  background: var(--cloto-text-25);
  border-radius: 2px;
  margin: 0 auto 14px;
}

.wiz-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.wiz-drawer-title {
  font-size: 11px;
  color: var(--cloto-gold);
  font-family: var(--cloto-font-ui);
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.wiz-drawer-close {
  background: none;
  border: none;
  color: var(--cloto-text-25);
  cursor: pointer;
  font-size: 14px;
}

.wiz-drawer-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.wiz-drawer-body::-webkit-scrollbar { width: 3px; }
.wiz-drawer-body::-webkit-scrollbar-track { background: transparent; }
.wiz-drawer-body::-webkit-scrollbar-thumb {
  background: var(--cloto-text-25);
  border-radius: 2px;
}

.wiz-drawer-footer {
  padding: 12px 0 0;
  border-top: 1px solid var(--cloto-glass-border);
}

/* Generic CTA button (used in drawers and conversation) */
.wiz-cta {
  background: transparent;
  border: 1px solid var(--cloto-glass-border-active);
  color: var(--cloto-teal);
  padding: 8px 20px;
  border-radius: 16px;
  font-size: 13px;
  font-family: var(--cloto-font-ui);
  cursor: pointer;
  transition: all 0.2s;
}
.wiz-cta:hover {
  background: var(--cloto-teal-deep);
  border-color: var(--cloto-teal);
}
.wiz-cta--full {
  width: 100%;
  padding: 14px;
  font-size: 14px;
}


/* ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
   §10  TOPBAR INTEGRATION — close · cost · breadcrumb · progress
   (used by FBW.wizard.renderTopbar → FBW.scaffold.updateTopbar)
   ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ */

.fbw-wizard-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--cloto-glass-border-hover);
  border-radius: 50%;
  background: transparent;
  color: var(--cloto-text-70);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.fbw-wizard-close:hover {
  color: var(--cloto-text-100);
  background: var(--cloto-danger-a8);
  border-color: var(--cloto-danger-a20);
}

.fbw-wizard-cost-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: var(--cloto-fs-xs);
  font-family: var(--cloto-font-mono);
  color: var(--cloto-text-25);
  background: var(--cloto-gold-a6);
  border: 1px solid var(--cloto-gold-a10);
  border-radius: 9999px;
  white-space: nowrap;
}

.fbw-wizard-phases-compact {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.fbw-wizard-phase-chip {
  font-size: var(--cloto-fs-xs);
  color: var(--cloto-text-25);
  padding: 1px 4px;
  border-radius: 4px;
}
.fbw-wizard-phase-chip.is-active {
  color: var(--cloto-text-100);
  font-weight: 600;
  background: var(--cloto-gold-a10);
}
.fbw-wizard-phase-chip.is-completed {
  color: var(--cloto-text-40);
}
.fbw-wizard-phases-compact .fbw-wizard-phase-sep {
  color: var(--cloto-text-15);
  font-size: var(--cloto-fs-2xs);
}

.fbw-wizard-progress-compact {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--cloto-fs-xs);
  font-family: var(--cloto-font-mono);
  color: var(--cloto-text-25);
}
.fbw-wizard-progress-compact progress {
  width: 60px;
  height: 4px;
  appearance: none;
  -webkit-appearance: none;
  border: none;
  border-radius: 2px;
  overflow: hidden;
  background: var(--cloto-glass-border);
}
.fbw-wizard-progress-compact progress::-webkit-progress-bar {
  background: var(--cloto-glass-border);
  border-radius: 2px;
}
.fbw-wizard-progress-compact progress::-webkit-progress-value {
  background: var(--cloto-teal);
  border-radius: 2px;
}
.fbw-wizard-progress-compact progress::-moz-progress-bar {
  background: var(--cloto-teal);
  border-radius: 2px;
}


/* ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
   §11  RESPONSIVE
   ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ */

@media (max-width: 768px) {
  .wiz-conversation {
    padding: 8px 16px 12px;
  }

  .wiz-bubble--cloto .wiz-bubble__body,
  .wiz-bubble--user .wiz-bubble__body,
  .wiz-bubble--loading .wiz-bubble__body {
    max-width: 90%;
  }

  .wiz-input__wrapper {
    padding: 8px 16px 14px;
  }

  .wiz-topbar {
    padding: 0 16px;
  }

  .wiz-drawer-panel {
    max-height: 90%;
    padding: 12px 16px 14px;
  }
}


/* ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
   §12  REDUCED MOTION
   ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ */

@media (prefers-reduced-motion: reduce) {
  .wiz-bubble--animate {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .wiz-spiral--idle .sp-c,
  .wiz-spiral--listening .sp-c,
  .wiz-spiral--weaving .sp-o,
  .wiz-spiral--weaving .sp-2,
  .wiz-spiral--weaving .sp-3,
  .wiz-spiral--weaving .sp-i,
  .wiz-spiral--weaving .sp-c,
  .wiz-spiral--reflecting .sp-c,
  .wiz-spiral--reflecting svg,
  .wiz-spiral--celebrating .sp-o,
  .wiz-spiral--celebrating .sp-2,
  .wiz-spiral--celebrating .sp-3,
  .wiz-spiral--celebrating .sp-i,
  .wiz-spiral--celebrating .sp-c,
  .wiz-spiral--celebrating svg {
    animation: none;
  }

  .wiz-ellipsis::after {
    animation: none;
  }

  .wiz-drawer-panel {
    animation: none;
  }

  .wiz-input--expanded {
    animation: none;
  }
}

/* ══════════════════════════════════════════════════════════════
   CARD DIVIDER — separator when switching cards in chat
   ══════════════════════════════════════════════════════════════ */

.wiz-card-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 8px;
}
.wiz-card-divider::before,
.wiz-card-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--cloto-glass-border);
}
.wiz-card-divider__label {
  font-size: 11px;
  font-family: var(--cloto-font-ui);
  color: var(--cloto-text-30);
  white-space: nowrap;
  letter-spacing: 0.02em;
}


/* ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
   §13  V2 WORKSPACE OVERRIDES — chat inside workspace panel
   ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ */

/* V2: landing mode in workspace chat */
#fbw-workspace-chat:has(.wiz-conversation--landing) {
  justify-content: center;
}
#fbw-workspace-chat .wiz-conversation--landing ~ .wiz-input {
  flex: none;
  margin-top: var(--space-8);
}
/* V2 landing: smaller greeting font */
#fbw-workspace-chat .wiz-landing__greeting {
  font-size: 22px;
}
#fbw-workspace-chat .wiz-landing__spiral {
  margin-bottom: var(--space-4);
}

/* ── Prefunnel: allow .wiz-conversation to scroll (parent overflow unlocked) ── */
.fbw-outline-v2.is-prefunnel .fbw-wizard-overlay {
  overflow: visible;
}

/* ── Prefunnel: constrain bubble width on desktop ── */
.is-prefunnel #fbw-workspace-chat .wiz-conversation {
  max-width: 700px;
  margin: 0 auto;
  width: 100%;
}
.is-prefunnel #fbw-workspace-chat .wiz-conversation::before {
  content: '';
  flex: 1;
}
.is-prefunnel #fbw-workspace-chat .wiz-input {
  max-width: 700px;
  margin: 0 auto;
  width: 100%;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-top: none;
}
.is-prefunnel #fbw-workspace-chat .wiz-input__bar {
  background: transparent;
}

/* ── Prefunnel: compact centered landing ── */
.is-prefunnel #fbw-workspace-chat .wiz-landing {
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
}
.is-prefunnel #fbw-workspace-chat .wiz-landing__greeting {
  font-size: 36px;
}
.is-prefunnel #fbw-workspace-chat .wiz-landing__spiral {
  margin-bottom: 20px;
}
/* Chat header (logo+label) stays hidden in prefunnel — qa-header replaces it */
/* Prefunnel landing: input becomes part of centered content */
.is-prefunnel #fbw-workspace-chat .wiz-conversation--landing ~ .wiz-input {
  max-width: 640px;
  width: 100%;
  margin: var(--space-6) auto 0;
  background: transparent;
  border-top: none;
  padding: 0;
}
.is-prefunnel #fbw-workspace-chat .wiz-conversation--landing ~ .wiz-input .wiz-input__bar {
  min-height: 120px;
  align-items: flex-start;
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4);
}
.is-prefunnel #fbw-workspace-chat .wiz-conversation--landing ~ .wiz-input .wiz-input__send {
  align-self: flex-end;
}
.is-prefunnel #fbw-workspace-chat .wiz-conversation--landing ~ .wiz-input .wiz-input__field {
  min-height: 80px;
  font-size: var(--cloto-fs-reading);
  resize: none;
}

/* ── Scope selector (landing dropdown) ── */
.wiz-scope-selector {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-4);
}
.wiz-scope-selector__label {
  font-size: 12px;
  font-family: var(--cloto-font-ui);
  color: var(--cloto-text-30);
  letter-spacing: 0.02em;
}
.wiz-scope-selector__select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--cloto-teal-a8);
  border: 1px solid var(--cloto-teal-a20);
  border-radius: 20px;
  color: var(--cloto-teal);
  font-family: var(--cloto-font-ui);
  font-size: 13px;
  padding: 5px 28px 5px 14px;
  cursor: pointer;
  transition: border-color var(--duration-fast) ease, background var(--duration-fast) ease;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%235ec6c6' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.wiz-scope-selector__select:hover {
  border-color: var(--cloto-teal-a40);
  background-color: var(--cloto-teal-a12);
}
.wiz-scope-selector__select:focus {
  outline: none;
  border-color: var(--cloto-teal);
  box-shadow: 0 0 0 2px var(--cloto-teal-a15);
}
.wiz-scope-selector__select option {
  background: var(--cloto-void);
  color: var(--cloto-text-70);
}
/* Light mode */
[data-theme="light"] .wiz-scope-selector__select {
  background-color: var(--cloto-teal-a6);
  border-color: var(--cloto-teal-a25);
  color: #2a7a7a;
}
[data-theme="light"] .wiz-scope-selector__select option {
  background: #fff;
  color: #1a1c28;
}

/* ── Narrative Q&A: chat header (fixed above scroll area) ── */
.wiz-qa-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--cloto-glass-border);
  background: var(--cloto-glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  flex-shrink: 0;
  z-index: 10;
}
.wiz-qa-header__close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--cloto-text-50);
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}
.wiz-qa-header__close:hover {
  color: var(--cloto-text-90);
  background: var(--cloto-white-a8);
}
.wiz-qa-header__title {
  flex: 1;
  font-family: var(--cloto-font-ui);
  font-size: var(--cloto-fs-sm);
  font-weight: 500;
  color: var(--cloto-text-70);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}
.wiz-qa-header__scope {
  flex-shrink: 0;
  font-family: var(--cloto-font-ui);
  font-size: 11px;
  font-weight: 500;
  color: var(--cloto-teal);
  background: var(--cloto-teal-a8);
  border: 1px solid var(--cloto-teal-a20);
  border-radius: var(--radius-full);
  padding: 2px 10px;
  letter-spacing: 0.02em;
}

/* ── V2: Input as integrated glass footer ── */
#fbw-workspace-chat .wiz-input {
  max-width: none;
  background: var(--cloto-zone-chat-input);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--cloto-zone-chat-border);
  padding: var(--space-3) var(--space-4);
  transition: background 600ms ease-out, border-color 600ms ease-out;
}
#fbw-workspace-chat .wiz-input__bar {
  border-radius: var(--radius-xl);
  padding: 4px 4px 4px 14px;
  gap: 6px;
  background: rgba(12, 11, 8, 0.6);
  border-color: var(--cloto-teal-a25);
  box-shadow: 0 0 6px var(--cloto-teal-a10);
  transition: background 600ms ease-out, border-color 600ms ease-out, box-shadow 600ms ease-out;
}
#fbw-workspace-chat .wiz-input__bar--focused {
  border-color: var(--cloto-teal-a50);
  box-shadow: 0 0 12px var(--cloto-teal-a25), 0 0 4px var(--cloto-teal-a15);
}

/* Light mode input contrast */
body.fd-light #fbw-workspace-chat .wiz-input__bar {
  background: var(--cloto-white-a80);
  border-color: rgba(154, 126, 48, 0.18);
  box-shadow: 0 0 6px rgba(154, 126, 48, 0.08);
}
body.fd-light #fbw-workspace-chat .wiz-input__bar--focused {
  border-color: rgba(154, 126, 48, 0.35);
  box-shadow: 0 0 12px rgba(154, 126, 48, 0.15), 0 0 4px rgba(154, 126, 48, 0.10);
}
#fbw-workspace-chat .wiz-input__field {
  font-size: var(--cloto-fs-md);
  padding: 5px 0;
  min-height: 22px;
}
#fbw-workspace-chat .wiz-input__send {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
}
#fbw-workspace-chat .wiz-input__send--inactive {
  background: var(--cloto-teal-a12) !important;
  color: var(--cloto-teal-mid) !important;
}
#fbw-workspace-chat .wiz-input__send--active {
  background: var(--cloto-teal) !important;
  color: #fff !important;
  box-shadow: 0 0 12px var(--cloto-teal-a50), 0 0 4px var(--cloto-teal-a30) !important;
}
#fbw-workspace-chat .wiz-input__send--active:hover {
  background: var(--cloto-teal-light) !important;
  box-shadow: 0 0 18px rgba(94, 198, 198, 0.6), 0 0 6px var(--cloto-teal-a40) !important;
}
body.fd-light #fbw-workspace-chat .wiz-input__send--inactive {
  background: rgba(14, 122, 122, 0.10) !important;
  color: var(--cloto-teal-mid) !important;
}
body.fd-light #fbw-workspace-chat .wiz-input__send--active {
  background: #0e7a7a !important;
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(14, 122, 122, 0.4) !important;
}
body.fd-light #fbw-workspace-chat .wiz-input__send--active:hover {
  background: #0a6565 !important;
  box-shadow: 0 2px 12px rgba(14, 122, 122, 0.5) !important;
}

/* Keyboard shortcut hint — fades in on focus */
#fbw-workspace-chat .wiz-input__hint {
  font-size: var(--cloto-fs-2xs);
  color: var(--cloto-text-25);
  font-family: var(--cloto-font-ui);
  text-align: right;
  padding: 2px 6px 0;
  opacity: 0;
  transition: opacity 0.15s;
}
#fbw-workspace-chat .wiz-input__hint.is-visible {
  opacity: 1;
}
#fbw-workspace-chat .wiz-input__disclaimer {
  font-size: 11px;
  color: var(--cloto-text-25);
  font-family: var(--cloto-font-ui);
  text-align: center;
  padding: 4px 6px 0;
  line-height: 1.3;
}
.wiz-scope-selector__select option:disabled {
  color: var(--cloto-text-20);
  font-style: italic;
}

/* ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
   §14  V2 MOBILE — input + landing adjustments
   ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ */

@media (max-width: 768px) {
  /* V2: input bar full-width, larger touch targets */
  #fbw-workspace-chat .wiz-input__field {
    font-size: 16px; /* prevents iOS zoom */
    min-height: 28px;
  }

  #fbw-workspace-chat .wiz-input__send {
    width: 40px;
    height: 40px;
  }

  /* Landing mode mobile: smaller spiral + greeting */
  #fbw-workspace-chat .wiz-landing__greeting {
    font-size: 18px;
  }
  #fbw-workspace-chat .wiz-landing__spiral {
    margin-bottom: var(--space-2);
  }
}


/* ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
   §15  ANALYSIS MODAL (wam- prefix)
   ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ */

/* Backdrop */
.wam-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: var(--cloto-black-a50);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}
.wam-backdrop.is-open { opacity: 1; }

/* Modal — desktop */
.wam-modal {
  background: var(--cloto-zone-content, #1e2030);
  border-radius: var(--radius-lg, 12px);
  width: 90%;
  max-width: 680px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 80px var(--cloto-black-a50);
  transform: translateY(20px);
  transition: transform 0.2s;
}
.wam-backdrop.is-open .wam-modal {
  transform: translateY(0);
}

/* Modal — mobile bottom sheet */
.wam-modal--mobile {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 100%;
  max-height: 90vh;
  border-radius: var(--radius-lg, 12px) var(--radius-lg, 12px) 0 0;
  transform: translateY(100%);
}
.wam-backdrop.is-open .wam-modal--mobile {
  transform: translateY(0);
}

/* Drag handle (mobile) */
.wam-modal__drag {
  display: flex;
  justify-content: center;
  padding: 10px 0 4px;
}
.wam-modal__drag-bar {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--cloto-text-20, rgba(255, 255, 255, 0.2));
}

/* Header */
.wam-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 24px 12px;
  flex-shrink: 0;
}
.wam-modal__header-text {
  flex: 1;
  min-width: 0;
}
.wam-modal__title {
  font-family: var(--cloto-font-display, 'Cormorant Garamond', serif);
  font-size: 22px;
  font-weight: 400;
  color: var(--cloto-text-70, rgba(255, 255, 255, 0.7));
  margin: 0;
}
.wam-modal__subtitle {
  font-family: var(--cloto-font-ui);
  font-size: 12px;
  font-style: italic;
  color: var(--cloto-text-40);
  margin: 4px 0 0;
}
.wam-modal__close {
  background: none;
  border: none;
  color: var(--cloto-text-40, rgba(255, 255, 255, 0.4));
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  transition: color 0.15s;
}
.wam-modal__close:hover {
  color: var(--cloto-text-70);
}

/* Body (scrollable) */
.wam-modal__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0 24px 16px;
}

/* Footer */
.wam-modal__footer {
  flex-shrink: 0;
  padding: 12px 24px 20px;
  border-top: 1px solid var(--cloto-text-08, rgba(255, 255, 255, 0.08));
}
.wam-modal__confirm {
  width: 100%;
  padding: 12px 24px;
  background: var(--cloto-teal, #5ec6c6);
  color: #fff;
  border: none;
  border-radius: var(--radius-md, 8px);
  font-family: var(--cloto-font-ui);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.wam-modal__confirm:hover {
  background: var(--cloto-teal-mid);
}

/* Sections */
.wam-section {
  margin-bottom: 20px;
}
.wam-section__title {
  font-family: var(--cloto-font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--cloto-text-40, rgba(255, 255, 255, 0.4));
  margin: 0 0 10px;
  text-transform: uppercase;
}
.wam-section__subtitle {
  font-family: var(--cloto-font-ui);
  font-size: 12px;
  font-weight: 400;
  color: var(--cloto-text-30, rgba(255, 255, 255, 0.3));
  margin: -6px 0 10px;
  font-style: italic;
}

/* Fields */
.wam-field {
  margin-bottom: 10px;
}
.wam-field__label {
  display: block;
  font-family: var(--cloto-font-ui);
  font-size: 12px;
  color: var(--cloto-text-40);
  margin-bottom: 4px;
}

/* Form elements */
.wam-select,
.wam-input,
.wam-textarea {
  width: 100%;
  background: var(--cloto-glass-bg);
  border: 1px solid var(--cloto-glass-border);
  border-radius: var(--radius-sm, 6px);
  color: var(--cloto-text-70, rgba(255, 255, 255, 0.7));
  font-family: var(--cloto-font-ui);
  font-size: 13px;
  padding: 8px 10px;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.wam-select:focus,
.wam-input:focus,
.wam-textarea:focus {
  outline: none;
  border-color: var(--cloto-glass-border-active);
}
.wam-select {
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' fill='none' stroke='%235ec6c6' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 28px;
}
.wam-textarea {
  resize: vertical;
  min-height: 60px;
}
.wam-textarea--readonly {
  opacity: 0.6;
  cursor: default;
}

/* Chips */
.wam-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.wam-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--cloto-text-08, rgba(255, 255, 255, 0.08));
  color: var(--cloto-text-70);
  font-family: var(--cloto-font-ui);
  font-size: 12px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}
.wam-chip__remove {
  background: none;
  border: none;
  color: var(--cloto-text-30);
  font-size: 14px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}
.wam-chip__remove:hover {
  color: var(--cloto-danger);
}
.wam-chip-add {
  background: none;
  border: 1px dashed var(--cloto-text-15, rgba(255, 255, 255, 0.15));
  color: var(--cloto-text-40);
  font-family: var(--cloto-font-ui);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.wam-chip-add:hover {
  border-color: var(--cloto-teal-mid);
  color: var(--cloto-teal);
}
.wam-chip-input {
  background: var(--cloto-text-05);
  border: 1px solid var(--cloto-teal-mid, var(--cloto-teal-a40));
  border-radius: var(--radius-sm);
  color: var(--cloto-text-70);
  font-family: var(--cloto-font-ui);
  font-size: 12px;
  padding: 4px 8px;
  width: 120px;
  outline: none;
}

/* Character cards */
.wam-characters {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.wam-char-card {
  border: 1px solid var(--cloto-text-08);
  border-radius: var(--radius-md, 8px);
  overflow: hidden;
  transition: border-color 0.15s;
}
.wam-char-card.is-expanded {
  border-color: var(--cloto-text-15);
}
.wam-char-card__header {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.wam-char-card__header:hover {
  background: var(--cloto-text-05);
}
.wam-char-card__name {
  font-family: var(--cloto-font-ui);
  font-size: 13px;
  font-weight: 500;
  color: var(--cloto-text-70);
}
.wam-char-card__role {
  font-family: var(--cloto-font-ui);
  font-size: 12px;
  color: var(--cloto-text-40);
  margin-left: 4px;
}
.wam-char-card__toggle {
  background: none;
  border: none;
  color: var(--cloto-text-30);
  font-size: 12px;
  margin-left: auto;
  cursor: pointer;
  padding: 2px 4px;
}
.wam-char-card__remove {
  background: none;
  border: none;
  color: var(--cloto-text-20);
  font-size: 16px;
  cursor: pointer;
  padding: 2px 4px;
  margin-left: 4px;
  transition: color 0.15s;
}
.wam-char-card__remove:hover {
  color: var(--cloto-danger);
}
.wam-char-card__body {
  padding: 0 12px 12px;
}
.wam-char-add {
  background: none;
  border: 1px dashed var(--cloto-text-15);
  color: var(--cloto-text-40);
  font-family: var(--cloto-font-ui);
  font-size: 12px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  text-align: center;
}
.wam-char-add:hover {
  border-color: var(--cloto-teal-mid);
  color: var(--cloto-teal);
}

/* Scope chips in modal */
.wam-scope-chips {
  display: flex;
  gap: 8px;
}
.wam-scope-chip {
  flex: 1;
  padding: 8px 12px;
  background: var(--cloto-text-05);
  border: 1px solid var(--cloto-text-08);
  border-radius: var(--radius-md);
  color: var(--cloto-text-50);
  font-family: var(--cloto-font-ui);
  font-size: 13px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}
.wam-scope-chip:hover {
  border-color: var(--cloto-text-20);
  color: var(--cloto-text-70);
}
.wam-scope-chip--active {
  background: var(--cloto-teal);
  border-color: var(--cloto-teal);
  color: #fff;
}
.wam-scope-chip--active:hover {
  background: var(--cloto-teal-mid);
  border-color: var(--cloto-teal-mid);
}
.wam-scope-chip--disabled,
.wam-scope-chip--disabled:hover {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: auto;
  color: var(--cloto-text-30);
  border-color: var(--cloto-text-08);
  background: var(--cloto-text-05);
}

/* Scope AI hint */
.wam-scope-hint {
  font-family: var(--cloto-font-ui);
  font-size: 12px;
  font-style: italic;
  color: var(--cloto-text-40);
  margin-top: 8px;
}

/* Question rows */
.wam-question-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}
.wam-question-num {
  color: var(--cloto-text-30);
  font-family: var(--cloto-font-ui);
  font-size: 12px;
  flex-shrink: 0;
  width: 20px;
  text-align: right;
  padding-top: 7px;
}
.wam-question-row .wam-input {
  flex: 1;
}
.wam-question-textarea {
  resize: vertical;
  min-height: 44px;
  line-height: 1.4;
}
.wam-question-remove {
  background: none;
  border: none;
  color: var(--cloto-text-20);
  font-size: 16px;
  cursor: pointer;
  padding: 2px 4px;
  flex-shrink: 0;
  transition: color 0.15s;
}
.wam-question-remove:hover {
  color: var(--cloto-danger);
}

/* Secondary CTA */
.wiz-cta--ghost {
  background: transparent;
  border: none;
  color: var(--cloto-text-40);
  padding: 6px 16px;
  font-size: 12px;
  cursor: pointer;
  transition: color 0.15s;
}
.wiz-cta--ghost:hover {
  color: var(--cloto-text-60);
}

/* ── Light mode CTA button ── */
body.fd-light .wiz-cta {
  border-color: var(--cloto-glass-border-active);
  color: var(--cloto-teal);
}
body.fd-light .wiz-cta:hover {
  background: var(--cloto-teal);
  border-color: var(--cloto-teal);
  color: #fff;
}
body.fd-light .wiz-cta--ghost {
  color: var(--cloto-text-40);
}
body.fd-light .wiz-cta--ghost:hover {
  background: transparent;
  border-color: transparent;
  color: var(--cloto-text-70);
}

/* ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
   §  SYNOPSIS REVEAL + NAV BUTTONS
   ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ */

/* Synopsis reveal: simple fade-in via inline style (no chunk animation) */

/* Navigation buttons */
.wiz-nav-buttons {
  display: flex;
  justify-content: center;
  padding: var(--space-3, 12px) 0;
}
.wiz-nav-btn {
  background: var(--cloto-gold, #c9a84c);
  color: var(--cloto-bg, #0d0f17);
  border: none;
  padding: 10px 28px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s;
}
.wiz-nav-btn:hover { opacity: 0.85; }
.wiz-nav-btn:disabled { opacity: 0.5; cursor: default; }
.wiz-nav-btn--final {
  background: transparent;
  border: 1px solid var(--cloto-gold, #c9a84c);
  color: var(--cloto-gold, #c9a84c);
}
.wiz-nav-btn--pulse {
  animation: wiz-pulse-gold 2s ease-in-out infinite;
  border-color: var(--cloto-gold, #c9a84c);
}
@keyframes wiz-pulse-gold {
  0%, 100% { box-shadow: 0 0 0 0 rgba(212,175,55, 0.4); }
  50% { box-shadow: 0 0 12px 4px rgba(212,175,55, 0.15); }
}

/* Provisional synopsis (root card before real synopsis) */
.fbw-ws-body-provisional {
  color: var(--cloto-text-40);
  font-style: italic;
}

/* Light mode */
body.fd-light .wiz-nav-btn { color: #fff; }
body.fd-light .wiz-nav-btn--final { color: var(--cloto-gold); }

/* ── Light mode overrides ── */
body.fd-light .wam-backdrop {
  background: rgba(0, 0, 0, 0.3);
}
body.fd-light .wam-modal__confirm {
  background: var(--cloto-teal);
}
body.fd-light .wam-modal__confirm:hover {
  background: var(--cloto-teal-mid);
}
body.fd-light .wam-scope-chip--active {
  background: var(--cloto-teal);
  border-color: var(--cloto-teal);
}
body.fd-light .wam-scope-chip--active:hover {
  background: var(--cloto-teal-mid);
  border-color: var(--cloto-teal-mid);
}
