/* ==========================================================================
   Stylish English — Voice Call UI (css/voice-ui.css)
   Loaded AFTER css/app.min.css; scoped to the voice panel (#vf-panel) so it
   cannot affect the rest of the site.

   Architecture
   1. Design tokens (custom properties) — change the look here, nowhere else.
   2. Panel state machine — ONE attribute, #vf-panel[data-vf-state], drives
      every state visual (idle / connecting / listening / hearing / thinking /
      speaking / paused / error). JS writes one attribute; CSS does the rest.
   3. Components (BEM-style: .vf-stage, .vf-stage__word, .vf-progress ...).

   Performance rules followed throughout
   - Animations use ONLY transform and opacity (compositor-only: no layout,
     no paint), so they can't block the main thread or the audio pipeline.
   - Elements that appear/disappear during a call keep their space reserved
     (visibility/opacity instead of display), so nothing jumps (CLS = 0).
   - prefers-reduced-motion disables all non-essential motion.
   ========================================================================== */

/* 1. TOKENS ----------------------------------------------------------------
   Moved to css/tokens.css (shared with curriculum.css). */

#vf-panel {
  --vf-state-color: var(--vf-text-3);
  --vf-state-glow: transparent;
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(139, 92, 246, 0.14), transparent 60%),
    var(--vf-bg);
  color: var(--vf-text);
  font-family: var(--vf-font-ar);
  line-height: var(--vf-lh);
}

/* 2. STATE MACHINE -------------------------------------------------------- */
#vf-panel[data-vf-state="connecting"] { --vf-state-color: var(--vf-warn); }
#vf-panel[data-vf-state="listening"]  { --vf-state-color: var(--vf-accent-2); }
#vf-panel[data-vf-state="hearing"]    { --vf-state-color: var(--vf-listen); --vf-state-glow: var(--vf-listen-glow); }
#vf-panel[data-vf-state="thinking"]   { --vf-state-color: var(--vf-accent-2); }
#vf-panel[data-vf-state="speaking"]   { --vf-state-color: var(--vf-accent); --vf-state-glow: var(--vf-accent-glow); }
#vf-panel[data-vf-state="paused"]     { --vf-state-color: var(--vf-meaning); }
#vf-panel[data-vf-state="error"]      { --vf-state-color: var(--vf-danger); }

/* Header status pill */
#vf-panel .vf-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--vf-surface-2);
  border: 1px solid var(--vf-border);
  color: var(--vf-text-2);
  font-size: 12px;
  font-weight: 700;
  transition: border-color var(--vf-med) var(--vf-ease);
}
#vf-panel .vf-st-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--vf-state-color);
  transition: background-color var(--vf-med) var(--vf-ease);
}
#vf-panel[data-vf-state="connecting"] .vf-st-dot,
#vf-panel[data-vf-state="hearing"] .vf-st-dot,
#vf-panel[data-vf-state="speaking"] .vf-st-dot {
  animation: vf-dot-pulse 1.1s var(--vf-ease) infinite;
}

/* 3. VISUALIZER (5 bars) --------------------------------------------------- */
#vf-panel .vf-voice-visualizer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 56px;          /* fixed: never shifts layout */
  margin: 28px 0 20px;
}
#vf-panel .vf-sw-bar {
  width: 6px;
  height: 100%;
  border-radius: 6px;
  background: var(--vf-state-color);
  transform: scaleY(0.12);
  transform-origin: center;
  opacity: 0.55;
  transition: background-color var(--vf-med) var(--vf-ease), opacity var(--vf-med) var(--vf-ease);
  will-change: transform;
}
#vf-panel[data-vf-state="speaking"] .vf-sw-bar,
#vf-panel[data-vf-state="hearing"] .vf-sw-bar {
  opacity: 1;
  animation: vf-bar 0.9s var(--vf-ease) infinite;
}
#vf-panel[data-vf-state="thinking"] .vf-sw-bar,
#vf-panel[data-vf-state="connecting"] .vf-sw-bar {
  opacity: 0.8;
  animation: vf-bar-soft 1.4s ease-in-out infinite;
}
#vf-panel .vf-sw-bar:nth-child(2) { animation-delay: -0.15s; }
#vf-panel .vf-sw-bar:nth-child(3) { animation-delay: -0.3s; }
#vf-panel .vf-sw-bar:nth-child(4) { animation-delay: -0.45s; }
#vf-panel .vf-sw-bar:nth-child(5) { animation-delay: -0.6s; }

/* 4. WORD STAGE ------------------------------------------------------------ */
#vf-panel .vf-stage {
  position: relative;
  max-width: 560px;
  min-height: 176px;     /* reserved: showing/hiding a word never moves anything */
  margin: 12px auto 4px;
  padding: 16px 18px 14px;
  border-radius: var(--vf-radius-lg);
  background: linear-gradient(180deg, var(--vf-surface-2), var(--vf-surface));
  border: 1px solid var(--vf-border);
  text-align: center;
  transition: border-color var(--vf-med) var(--vf-ease), box-shadow var(--vf-med) var(--vf-ease);
}
#vf-panel .vf-stage.is-visible { border-color: var(--vf-border-strong); }
#vf-panel[data-vf-state="hearing"] .vf-stage.is-visible {
  border-color: var(--vf-listen);
  box-shadow: 0 0 0 1px var(--vf-listen-glow), 0 10px 30px -12px var(--vf-listen-glow);
}
#vf-panel .vf-stage__content {
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--vf-med) var(--vf-ease), visibility 0s linear var(--vf-med);
}
#vf-panel .vf-stage.is-visible .vf-stage__content {
  opacity: 1;
  visibility: visible;
  transition: opacity var(--vf-med) var(--vf-ease), visibility 0s;
}
/* Placeholder shown in the reserved space when there's no word yet */
#vf-panel .vf-stage::before {
  content: attr(data-placeholder);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--vf-text-3);
  font-size: 13px;
  transition: opacity var(--vf-med) var(--vf-ease);
  pointer-events: none;
}
#vf-panel .vf-stage.is-visible::before { opacity: 0; }

#vf-panel .vf-stage__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 26px;
}
#vf-panel .vf-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 12px;
  border-radius: 999px;
  background: rgba(139, 92, 246, 0.16);
  border: 1px solid var(--vf-border-strong);
  color: #e9e3ff;
  font-size: 11px;
  font-weight: 800;
}
#vf-panel .vf-stage__count {
  color: var(--vf-text-3);
  font-family: var(--vf-font-en);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
#vf-panel .vf-stage__word {
  margin: 10px 0 2px;
  min-height: 1.3em;
  color: var(--vf-text);
  font-family: var(--vf-font-en);
  font-size: clamp(26px, 6vw, 38px);
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: 0.01em;
  overflow-wrap: anywhere;
  direction: ltr;
}
/* Word-change entrance. JS alternates data-anim a/b so the animation
   restarts on every new word without a forced reflow. */
#vf-panel .vf-stage__word[data-anim="a"] { animation: vf-word-in-a var(--vf-med) var(--vf-ease); }
#vf-panel .vf-stage__word[data-anim="b"] { animation: vf-word-in-b var(--vf-med) var(--vf-ease); }

#vf-panel .vf-stage__meaning {
  min-height: 1.6em;     /* reserved even when empty */
  margin: 0;
  color: var(--vf-meaning);
  font-family: var(--vf-font-ar);
  font-size: clamp(16px, 4vw, 20px);
  font-weight: 700;
  opacity: 0;
  transition: opacity var(--vf-med) var(--vf-ease);
}
#vf-panel .vf-stage__meaning.is-visible { opacity: 1; }
#vf-panel .vf-stage__hint {
  margin: 6px 0 10px;
  color: var(--vf-text-2);
  font-size: 13px;
  font-weight: 500;
}

/* Drill progress — scaleX on a fixed-size track: zero layout cost */
#vf-panel .vf-progress {
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  opacity: 0;
  transition: opacity var(--vf-med) var(--vf-ease);
}
#vf-panel .vf-stage.has-progress .vf-progress { opacity: 1; }
#vf-panel .vf-progress__bar {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--vf-accent), var(--vf-listen));
  transform: scaleX(var(--vf-progress, 0));
  transform-origin: right center;   /* RTL: fills from the right */
  transition: transform 450ms var(--vf-ease);
}

/* 5. STATUS LINE ----------------------------------------------------------- */
#vf-panel .vf-sts {
  min-height: 3.2em;     /* two lines reserved: longer messages don't shift */
  margin: 8px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--vf-text-2);
  font-size: 13px;
  font-weight: 700;
  transition: color var(--vf-fast) linear;
}
#vf-panel .vf-sts.st-error { color: var(--vf-danger); }
/* Voice-only: a failed start (mic denied, no mic, no connection) shows a
   clear, persistent error card in the same reserved status space (no layout
   shift). It stays until the student taps the start button again. */
#vf-panel[data-vf-state="error"] .vf-sts.st-error {
  max-width: 460px;
  margin: 8px auto;
  padding: 10px 16px;
  border-radius: var(--vf-radius);
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.45);
  color: #fecaca;
  font-size: 14px;
  line-height: 1.6;
  animation: vf-fade-in var(--vf-med) var(--vf-ease);
}
#vf-panel[data-vf-state="error"] .vf-st-dot { background: var(--vf-danger); }
#vf-panel[data-vf-state="error"] .vf-sw-bar { opacity: 0.25; }
#vf-panel .vf-sts.st-warn { color: var(--vf-warn); }

/* 6. ACTION SLOT (start button <-> mic) ------------------------------------ */
#vf-panel .vf-action-slot {
  min-height: 132px;     /* fits the taller of the two: swapping never shifts */
  display: flex;
  align-items: center;
  justify-content: center;
}
#vf-panel .vf-start-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 30px;
  border: 0;
  border-radius: var(--vf-radius);
  background: linear-gradient(135deg, var(--vf-accent), #6d28d9);
  color: #fff;
  font-family: var(--vf-font-head);
  font-size: 16px;
  font-weight: 800;
  box-shadow: 0 10px 30px -10px var(--vf-accent-glow);
  cursor: pointer;
  transition: transform var(--vf-fast) var(--vf-ease), box-shadow var(--vf-med) var(--vf-ease);
}
#vf-panel .vf-start-btn:hover { transform: translateY(-1px); }
#vf-panel .vf-start-btn:active { transform: scale(0.97); }

#vf-panel .vf-mic-w { position: relative; flex-direction: column; align-items: center; }
#vf-panel .vf-mic {
  position: relative;
  z-index: 1;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 0;
  display: grid;
  place-items: center;
  color: #fff;
  background: radial-gradient(circle at 30% 30%, var(--vf-accent-2), var(--vf-accent));
  box-shadow: 0 8px 26px -8px var(--vf-accent-glow);
  cursor: pointer;
  transition: transform var(--vf-fast) var(--vf-ease), background-color var(--vf-med) var(--vf-ease);
}
#vf-panel .vf-mic:active { transform: scale(0.94); }
#vf-panel[data-vf-state="hearing"] .vf-mic {
  background: radial-gradient(circle at 30% 30%, #67e8f9, var(--vf-listen));
}
/* Ring pulse: a pseudo-element scaling outward — transform/opacity only */
#vf-panel .vf-mic::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--vf-state-color);
  opacity: 0;
  transform: scale(1);
  pointer-events: none;
}
#vf-panel[data-vf-state="hearing"] .vf-mic::after,
#vf-panel[data-vf-state="speaking"] .vf-mic::after {
  animation: vf-ring 1.4s var(--vf-ease) infinite;
}
#vf-panel .vf-mic-label {
  min-height: 1.6em;
  margin-top: 8px;
  color: var(--vf-text-2);
  font-size: 12px;
}

/* 7. LESSON BADGE ---------------------------------------------------------- */
#vf-panel .vf-lesson-badge {
  display: none;
  max-width: 600px;
  margin: 0 auto;
  padding: 8px 16px;
  border-radius: 12px;
  background: rgba(124, 77, 204, 0.12);
  border: 1px solid rgba(168, 132, 224, 0.25);
  color: var(--vf-text);
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}
#vf-panel .vf-lesson-badge.is-visible { display: block; }

/* 8. SECTIONS & LABELS ---------------------------------------------------- */
#vf-panel .vf-sec { padding: 12px 18px 4px; }
#vf-panel .vf-sec + .vf-sec { padding-top: 6px; }
#vf-panel .vf-lbl {
  margin: 0 0 8px;
  color: var(--vf-text-3);
  font-family: var(--vf-font-ar);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  text-align: center;
}

/* 9. SCENARIO CARDS --------------------------------------------------------
   app.min.css styles .vf-scenario with !important, so these overrides must
   use !important as well (scoped to #vf-panel so nothing else is affected). */
#vf-panel .vf-scenario-grid {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 8px !important;
}
#vf-panel .vf-scenario {
  position: relative;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  min-height: 72px;
  padding: 10px 6px !important;
  border-radius: var(--vf-radius) !important;
  border: 1px solid var(--vf-border) !important;
  background: var(--vf-surface-2) !important;
  color: var(--vf-text-2) !important;
  font-family: var(--vf-font-ar) !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  line-height: 1.3 !important;
  box-shadow: none !important;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transform: none !important;
  transition:
    transform var(--vf-fast) var(--vf-ease),
    border-color var(--vf-med) var(--vf-ease),
    background-color var(--vf-med) var(--vf-ease),
    color var(--vf-med) var(--vf-ease) !important;
}
#vf-panel .vf-scenario .ic,
#vf-panel .vf-scenario__emoji {
  font-size: 22px;
  line-height: 1;
  transition: transform var(--vf-med) var(--vf-ease);
}
/* Per-scenario icon colors (were inline style="color:..." before) */
#vf-panel .vf-scenario[data-scenario="free"] .ic,
#vf-panel .vf-scenario[data-scenario="directions"] .ic { color: #38bdf8; }
#vf-panel .vf-scenario[data-scenario="coffee"] .ic { color: #fcd34d; }
#vf-panel .vf-scenario[data-scenario="interview"] .ic { color: #c084fc; }
#vf-panel .vf-scenario[data-scenario="airport"] .ic { color: #60a5fa; }
#vf-panel .vf-scenario[data-scenario="hotel"] .ic { color: #34d399; }
#vf-panel .vf-scenario[data-scenario="doctor"] .ic { color: #f87171; }
#vf-panel .vf-scenario[data-scenario="routine"] .ic { color: #fbbf24; }
#vf-panel .vf-scenario[data-scenario="past_experiences"] .ic { color: #a78bfa; }
#vf-panel .vf-scenario[data-scenario="casual_chat"] .ic { color: #fb7185; }

@media (hover: hover) {
  #vf-panel .vf-scenario:hover {
    border-color: var(--vf-border-strong) !important;
    background: var(--vf-surface-3) !important;
    color: var(--vf-text) !important;
  }
  #vf-panel .vf-scenario:hover .ic,
  #vf-panel .vf-scenario:hover .vf-scenario__emoji { transform: translateY(-2px); }
}
#vf-panel .vf-scenario:active { transform: scale(0.96) !important; }

/* Selected: accent border + soft glow layer + check badge (all opacity/transform) */
#vf-panel .vf-scenario.vf-scenario-on {
  border-color: var(--vf-accent) !important;
  background: var(--vf-surface-3) !important;
  color: var(--vf-text) !important;
}
#vf-panel .vf-scenario::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(120% 90% at 50% 0%, var(--vf-accent-glow), transparent 70%);
  opacity: 0;
  transition: opacity var(--vf-med) var(--vf-ease);
  pointer-events: none;
}
#vf-panel .vf-scenario.vf-scenario-on::before { opacity: 0.55; }
#vf-panel .vf-scenario::after {
  content: "✓";
  position: absolute;
  top: 6px;
  inset-inline-end: 6px;
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--vf-accent);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  opacity: 0;
  transform: scale(0.4);
  transition: opacity var(--vf-fast) var(--vf-ease), transform var(--vf-med) var(--vf-ease);
  pointer-events: none;
}
#vf-panel .vf-scenario.vf-scenario-on::after { opacity: 1; transform: scale(1); }
#vf-panel .vf-scenario > * { position: relative; } /* content above the glow layer */

/* 10. TONE SEGMENTED CONTROL ------------------------------------------------
   A single highlight pill slides under the selected tone. Its position comes
   from pure CSS (:has) — zero JavaScript. Browsers without :has simply show
   the selected button's own highlight instead. */
#vf-panel .vf-tone-grid {
  --vf-tone-i: 0;
  --vf-tone-c: var(--vf-accent);
  position: relative;
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 0 !important;
  max-width: 360px;
  margin: 0 auto;
  padding: 4px;
  border-radius: 999px;
  background: var(--vf-surface-2);
  border: 1px solid var(--vf-border);
}
#vf-panel .vf-tone {
  position: relative;
  z-index: 1;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 6px 10px !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--vf-text-2) !important;
  font-family: var(--vf-font-ar) !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--vf-med) var(--vf-ease), transform var(--vf-fast) var(--vf-ease) !important;
}
#vf-panel .vf-tone .ic { font-size: 15px; }
#vf-panel .vf-tone:active { transform: scale(0.95); }
#vf-panel .vf-tone.vf-tone-on { color: #fff !important; }
/* Fallback highlight (no :has support): the button itself */
#vf-panel .vf-tone.vf-tone-on { background: var(--vf-tone-c) !important; }

@supports selector(:has(*)) {
  #vf-panel .vf-tone.vf-tone-on { background: transparent !important; }
  #vf-panel .vf-tone-grid::before {
    content: "";
    position: absolute;
    top: 4px;
    bottom: 4px;
    inset-inline-start: 4px;
    width: calc((100% - 8px) / 3);
    border-radius: 999px;
    background: var(--vf-tone-c);
    box-shadow: 0 6px 18px -8px var(--vf-tone-c);
    transform: translateX(calc(var(--vf-tone-i) * -100%)); /* RTL: moves left */
    transition: transform var(--vf-med) var(--vf-ease), background-color var(--vf-med) var(--vf-ease);
  }
  html[dir="ltr"] #vf-panel .vf-tone-grid::before { transform: translateX(calc(var(--vf-tone-i) * 100%)); }
  #vf-panel .vf-tone-grid:has(.vf-tone-on[data-tone="normal"]) { --vf-tone-i: 0; --vf-tone-c: var(--vf-accent); }
  #vf-panel .vf-tone-grid:has(.vf-tone-on[data-tone="angry"])  { --vf-tone-i: 1; --vf-tone-c: #ef4444; }
  #vf-panel .vf-tone-grid:has(.vf-tone-on[data-tone="caring"]) { --vf-tone-i: 2; --vf-tone-c: #ec4899; }
}
#vf-panel .vf-tone[data-tone="angry"].vf-tone-on  { --vf-tone-c: #ef4444; }
#vf-panel .vf-tone[data-tone="caring"].vf-tone-on { --vf-tone-c: #ec4899; }

/* 11. FLOATING MINI-BAR (call minimized) ------------------------------------
   Shown/hidden only by the .vf-floating-open class (opacity + transform +
   visibility), state colors driven by the vf-fb-* classes app.js sets. */
#vf-floating-bar {
  --vf-fb-color: var(--vf-accent-2);
  position: fixed;
  z-index: 9999;
  bottom: calc(20px + env(safe-area-inset-bottom));
  inset-inline-end: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(340px, calc(100vw - 32px));
  padding: 8px 8px 8px 10px;
  border-radius: 999px;
  background: rgba(18, 18, 30, 0.88);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid var(--vf-border);
  box-shadow: 0 14px 40px -12px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(139, 92, 246, 0.08);
  color: var(--vf-text);
  font-family: var(--vf-font-ar);
  line-height: 1.3;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.96);
  transition:
    opacity var(--vf-med) var(--vf-ease),
    transform var(--vf-med) var(--vf-ease),
    visibility 0s linear var(--vf-med),
    border-color var(--vf-med) var(--vf-ease);
}
#vf-floating-bar.vf-floating-open {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition:
    opacity var(--vf-med) var(--vf-ease),
    transform var(--vf-med) var(--vf-ease),
    visibility 0s,
    border-color var(--vf-med) var(--vf-ease);
}
#vf-floating-bar:active { transform: scale(0.98); }
#vf-floating-bar.vf-fb-speaking  { --vf-fb-color: var(--vf-accent);  border-color: rgba(139, 92, 246, 0.55); }
#vf-floating-bar.vf-fb-recording { --vf-fb-color: var(--vf-listen);  border-color: rgba(34, 211, 238, 0.5); }
#vf-floating-bar.vf-fb-waiting   { --vf-fb-color: var(--vf-accent-2); }
#vf-floating-bar.vf-fb-idle      { --vf-fb-color: var(--vf-text-3); }

#vf-floating-bar .vf-fb-avatar {
  position: relative;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  padding: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1.5px solid var(--vf-fb-color);
  background: radial-gradient(circle at 35% 30%, #241238 0%, #120620 55%, #0a0212 100%);
  transition: border-color var(--vf-med) var(--vf-ease);
}
#vf-floating-bar .mascot-wave-line { stroke: var(--vf-fb-color); transition: stroke var(--vf-med) var(--vf-ease); }
#vf-floating-bar.vf-fb-waiting .vf-fb-avatar { animation: vf-dot-pulse 1s var(--vf-ease) infinite; }

#vf-floating-bar .vf-fb-wave {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 3px;
  height: 22px;
}
#vf-floating-bar .vf-fb-wave i {
  display: block;
  width: 3px;
  height: 18px;
  border-radius: 3px;
  background: var(--vf-fb-color);
  transform: scaleY(0.25);
  opacity: 0.4;
  animation: none;
  transition: opacity var(--vf-med) var(--vf-ease), background-color var(--vf-med) var(--vf-ease);
}
#vf-floating-bar.vf-fb-speaking .vf-fb-wave i,
#vf-floating-bar.vf-fb-recording .vf-fb-wave i {
  opacity: 1;
  animation: vf-bar 0.9s var(--vf-ease) infinite;
}
#vf-floating-bar .vf-fb-wave i:nth-child(2) { animation-delay: -0.2s; }
#vf-floating-bar .vf-fb-wave i:nth-child(3) { animation-delay: -0.4s; }
#vf-floating-bar .vf-fb-wave i:nth-child(4) { animation-delay: -0.6s; }

#vf-floating-bar .vf-fb-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
#vf-floating-bar .vf-fb-name {
  font-family: var(--vf-font-en);
  font-size: 13px;
  font-weight: 800;
}
#vf-floating-bar .vf-fb-status {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--vf-text-2);
  font-size: 11px;
  font-weight: 600;
}
#vf-floating-bar .vf-fb-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  transition: transform var(--vf-fast) var(--vf-ease), background-color var(--vf-med) var(--vf-ease);
}
#vf-floating-bar .vf-fb-btn .ic { font-size: 17px; }
#vf-floating-bar .vf-fb-mute { background: var(--vf-surface-3); }
#vf-floating-bar .vf-fb-mute.vf-fb-muted { background: var(--vf-warn); color: #1a1205; }
#vf-floating-bar .vf-fb-end { background: #dc2626; }
#vf-floating-bar .vf-fb-btn:active { transform: scale(0.9); }
#vf-floating-bar:focus-visible,
#vf-floating-bar .vf-fb-btn:focus-visible {
  outline: 2px solid var(--vf-listen);
  outline-offset: 3px;
}

/* Focus rings for the panel controls */
#vf-panel .vf-scenario:focus-visible,
#vf-panel .vf-tone:focus-visible,
#vf-panel .vf-mic:focus-visible,
#vf-panel .vf-start-btn:focus-visible {
  outline: 2px solid var(--vf-listen);
  outline-offset: 3px;
}

/* 12. TRANSCRIPT lines fade in (new nodes only; no layout animation) --------- */
#vf-panel .vf-tr-l { animation: vf-fade-in var(--vf-med) var(--vf-ease); }

/* 13. RESPONSIVE ------------------------------------------------------------ */
@media (max-width: 480px) {
  #vf-panel .vf-voice-visualizer { margin: 18px 0 12px; height: 44px; }
  #vf-panel .vf-stage { min-height: 164px; padding: 14px 14px 12px; }
  #vf-panel .vf-mic { width: 64px; height: 64px; }
  #vf-panel .vf-action-slot { min-height: 120px; }
  #vf-panel .vf-scenario { min-height: 66px; font-size: 11px !important; }
  #vf-floating-bar {
    inset-inline: 12px;
    max-width: none;
    bottom: calc(12px + env(safe-area-inset-bottom));
  }
}

/* KEYFRAMES ----------------------------------------------------------------- */
@keyframes vf-dot-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes vf-bar { 0%,100% { transform: scaleY(0.2); } 50% { transform: scaleY(1); } }
@keyframes vf-bar-soft { 0%,100% { transform: scaleY(0.15); } 50% { transform: scaleY(0.4); } }
@keyframes vf-ring { 0% { opacity: 0.7; transform: scale(1); } 100% { opacity: 0; transform: scale(1.6); } }
@keyframes vf-word-in-a { from { opacity: 0; transform: translateY(6px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes vf-word-in-b { from { opacity: 0; transform: translateY(6px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes vf-fade-in { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  #vf-panel *,
  #vf-panel *::before,
  #vf-panel *::after,
  #vf-floating-bar,
  #vf-floating-bar *,
  #vf-floating-bar *::before,
  #vf-floating-bar *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
  #vf-panel .vf-sw-bar { transform: scaleY(0.3); }
}
