@keyframes fluid-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.28); }
    45% { transform: scale(1.045); box-shadow: 0 0 0 10px rgba(249, 115, 22, 0.06); }
    70% { transform: scale(1.06); box-shadow: 0 0 0 16px rgba(249, 115, 22, 0); }
}
@keyframes flow-wave {
    0% { border-radius: 42% 58% 68% 32% / 42% 48% 58% 52%; transform: rotate(0deg); }
    50% { border-radius: 52% 48% 38% 62% / 48% 52% 48% 52%; }
    100% { border-radius: 58% 42% 32% 68% / 52% 58% 42% 48%; transform: rotate(360deg); }
}
.voice-active { animation: fluid-pulse 1.85s ease-in-out infinite; }
.fluid-wave { animation: flow-wave 5.25s ease-in-out infinite; }
.voice-waveform {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-left: 8px;
}
.wave-bar {
    width: 3px;
    height: 12px;
    background: #f97316;
    border-radius: 3px;
    transition: all 0.1s ease;
    animation: wave-bounce 0.6s infinite alternate;
}
.wave-bar:nth-child(2) { animation-delay: 0.1s; height: 18px; }
.wave-bar:nth-child(3) { animation-delay: 0.2s; height: 10px; }
.wave-bar:nth-child(4) { animation-delay: 0.3s; height: 20px; }
.wave-bar:nth-child(5) { animation-delay: 0.4s; height: 8px; }
@keyframes wave-bounce {
    0% { transform: scaleY(0.4); opacity: 0.6; }
    100% { transform: scaleY(1); opacity: 1; }
}
.speaking-ripple {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 70px;
    height: 70px;
    background: rgba(249,115,22,0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: ripple-pulse 1.35s cubic-bezier(0.22, 1, 0.36, 1) infinite;
    pointer-events: none;
    z-index: 20;
}
@keyframes ripple-pulse {
    0% { transform: translate(-50%, -50%) scale(0.72); opacity: 0.42; }
    55% { opacity: 0.18; }
    100% { transform: translate(-50%, -50%) scale(1.18); opacity: 0; }
}
.voice-status-badge {
    transition: all 0.2s;
    backdrop-filter: blur(12px);
    background: rgba(0,0,0,0.7);
    border-radius: 40px;
    padding: 6px 14px;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 0.3px;
}
/* VOICE SESSION V1 — dock transcript chip (non-modal; page stays visible) */
.dock-safe > #voiceTranscriptLayer.voice-transcript-layer--dock-anchor {
    position: relative;
    width: min(17.5rem, calc(100vw - 2.75rem));
    max-width: 17.5rem;
    margin: 0 auto 0.45rem;
    flex-shrink: 0;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(2px);
    transition:
        opacity 0.38s cubic-bezier(0.22, 1, 0.36, 1),
        visibility 0.38s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.38s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 1;
}
.dock-safe > #voiceTranscriptLayer.voice-transcript-layer--dock-anchor .voice-transcript-layer__panel {
    transition: opacity 0.32s ease, box-shadow 0.32s ease;
}
.dock-safe > #voiceTranscriptLayer.voice-transcript-layer--dock-anchor.voice-transcript-layer--visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.dock-safe > #voiceTranscriptLayer.voice-transcript-layer--dock-anchor.voice-transcript-layer--fading {
    opacity: 0;
    visibility: hidden;
    transform: translateY(2px);
}
.dock-safe > #voiceTranscriptLayer.voice-transcript-layer--dock-anchor .voice-transcript-layer__panel {
    padding: 0.35rem 0.75rem 0.32rem;
    border-radius: 9999px;
    text-align: center;
    background: rgba(15, 23, 42, 0.2);
    border: 1px solid rgba(148, 163, 184, 0.18);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
body:not(.dark-theme) .dock-safe > #voiceTranscriptLayer.voice-transcript-layer--dock-anchor .voice-transcript-layer__panel {
    background: rgba(255, 255, 255, 0.28);
    border-color: rgba(100, 116, 139, 0.18);
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.dock-safe > #voiceTranscriptLayer.voice-transcript-layer--dock-anchor .voice-transcript-layer__cue {
    display: none !important;
}
body.dark-theme .dock-safe > #voiceTranscriptLayer.voice-transcript-layer--dock-anchor .voice-transcript-layer__panel {
    background: rgba(15, 23, 42, 0.62);
    border-color: rgba(148, 163, 184, 0.14);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
.dock-safe > #voiceTranscriptLayer.voice-transcript-layer--dock-anchor .voice-transcript-layer__cue {
    display: block;
    font-size: 0.56rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(251, 146, 60, 0.72);
    margin-bottom: 0.15rem;
}
body:not(.dark-theme) .dock-safe > #voiceTranscriptLayer.voice-transcript-layer--dock-anchor .voice-transcript-layer__cue {
    color: rgba(194, 65, 12, 0.78);
}
.dock-safe > #voiceTranscriptLayer.voice-transcript-layer--dock-anchor .voice-transcript-layer__text {
    margin: 0;
    min-height: 1.25em;
    max-height: 3em;
    overflow-y: auto;
    font-family: 'Noto Sans Bengali', 'Plus Jakarta Sans', system-ui, sans-serif;
    font-size: clamp(0.78rem, 3vw, 0.9rem);
    font-weight: 500;
    line-height: 1.5;
    letter-spacing: 0.008em;
    color: rgba(241, 245, 249, 0.9);
    word-wrap: break-word;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
body:not(.dark-theme) .dock-safe > #voiceTranscriptLayer.voice-transcript-layer--dock-anchor .voice-transcript-layer__text {
    color: #1e293b;
    font-weight: 600;
}
.dock-safe > #voiceTranscriptLayer.voice-transcript-layer--dock-anchor .voice-transcript-layer__meta {
    display: block;
    margin-top: 0.18rem;
    font-size: 0.52rem;
    font-weight: 500;
    line-height: 1.32;
    color: rgba(148, 163, 184, 0.75);
}
body:not(.dark-theme) .dock-safe > #voiceTranscriptLayer.voice-transcript-layer--dock-anchor .voice-transcript-layer__meta {
    color: rgba(71, 85, 105, 0.9);
}
body.dark-theme .dock-safe > #voiceTranscriptLayer.voice-transcript-layer--dock-anchor .voice-transcript-layer__meta {
    color: rgba(203, 213, 225, 0.88);
}
@media (max-width: 639px) {
    .dock-safe > #voiceTranscriptLayer.voice-transcript-layer--dock-anchor {
        width: min(16.5rem, calc(100vw - 2.25rem));
        margin-bottom: 0.4rem;
    }
}
@media (prefers-reduced-motion: reduce) {
    .dock-safe > #voiceTranscriptLayer.voice-transcript-layer--dock-anchor {
        transition: opacity 0.18s ease, visibility 0.18s ease;
    }
    .dock-safe > #voiceTranscriptLayer.voice-transcript-layer--dock-anchor.voice-transcript-layer--visible,
    .dock-safe > #voiceTranscriptLayer.voice-transcript-layer--dock-anchor.voice-transcript-layer--fading {
        transform: none;
    }
}
/* T1-RC — legacy listening HUD retired (transcript capsule is sole surface) */
#voiceStateIndicator.voice-status-badge {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}
.voice-mic-state-badge {
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 56;
    max-width: min(11rem, 46vw);
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
    background: rgba(15, 23, 42, 0.82);
    color: rgba(251, 146, 60, 0.95);
    border: 1px solid rgba(249, 115, 22, 0.35);
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.2);
}
body:not(.dark-theme) .voice-mic-state-badge {
    background: rgba(255, 255, 255, 0.94);
    color: rgba(194, 65, 12, 0.9);
}
.voice-mic-state-badge[data-voice-state="listening"] { color: rgba(74, 222, 128, 0.95); border-color: rgba(34, 197, 94, 0.4); }
.voice-mic-state-badge[data-voice-state="paused"] { color: rgba(251, 191, 36, 0.95); border-color: rgba(245, 158, 11, 0.4); }
.voice-mic-state-badge[data-voice-state="processing"],
.voice-mic-state-badge[data-voice-state="recognized"] { color: rgba(56, 189, 248, 0.95); border-color: rgba(14, 165, 233, 0.35); }
.voice-mic-state-badge[data-voice-state="speaking"] { color: rgba(251, 146, 60, 0.98); border-color: rgba(249, 115, 22, 0.45); }

/* Dock mic presence — idle breathe / listen expand / speak waveform (mic column only) */
.mic-dock-presence-anchor {
  isolation: isolate;
}
.mic-dock-caption {
  position: absolute;
  bottom: calc(100% + 1.65rem);
  left: 50%;
  transform: translateX(-50%);
  z-index: 55;
  max-width: min(10.5rem, 44vw);
  padding: 0.28rem 0.55rem;
  border-radius: 0.55rem;
  font-size: 0.58rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  color: #f8fafc;
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.18);
  pointer-events: none;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  white-space: normal;
}
body:not(.dark-theme) .mic-dock-caption {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.94);
  border-color: rgba(148, 163, 184, 0.28);
}
.mic-orb-presence--idle .mic-orb-atmosphere {
  animation: orb-atmo-breathe 5.2s ease-in-out infinite;
  opacity: 0.82;
}
.mic-orb-presence--listening .mic-orb-atmosphere {
  animation: mic-listen-breathe 2.1s ease-in-out infinite;
  opacity: 0.95;
  transform: scale(1.06);
}
.mic-orb-presence--listening .mic-orb-core {
  transform: scale(1.04);
  box-shadow: var(--btn-inner), 0 10px 26px rgba(34, 197, 94, 0.22), 0 8px 22px rgba(249, 115, 22, 0.2);
}
.mic-orb-presence--listening .mic-orb-fluid {
  opacity: 0.92;
}
.mic-orb-presence--speaking .mic-orb-atmosphere {
  animation: none;
  opacity: 0.5;
  transform: scale(1.02);
}
.mic-orb-presence--speaking .mic-orb-action-glow {
  opacity: 1;
  animation: mic-speak-glow 1.35s ease-in-out infinite;
}
.mic-orb-speak-waveform {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.2rem);
  transform: translateX(-50%);
  z-index: 12;
  display: inline-flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  height: 0.85rem;
  pointer-events: none;
}
.mic-orb-speak-waveform__bar {
  display: block;
  width: 3px;
  border-radius: 2px;
  background: rgba(251, 146, 60, 0.95);
  height: 0.35rem;
  animation: mic-orb-wave-bar 0.55s ease-in-out infinite alternate;
}
.mic-orb-speak-waveform__bar:nth-child(2) { animation-delay: 0.08s; }
.mic-orb-speak-waveform__bar:nth-child(3) { animation-delay: 0.16s; height: 0.55rem; }
.mic-orb-speak-waveform__bar:nth-child(4) { animation-delay: 0.24s; }
.mic-orb-speak-waveform__bar:nth-child(5) { animation-delay: 0.32s; height: 0.7rem; }
@keyframes mic-listen-breathe {
  0%, 100% { transform: scale(1.02); opacity: 0.88; }
  50% { transform: scale(1.1); opacity: 1; }
}
@keyframes mic-speak-glow {
  0%, 100% { transform: scale(1.22); opacity: 0.75; }
  50% { transform: scale(1.34); opacity: 1; }
}
@keyframes mic-orb-wave-bar {
  0% { transform: scaleY(0.45); opacity: 0.65; }
  100% { transform: scaleY(1); opacity: 1; }
}
/* VOICE SESSION V1 — center hear overlay retired (dock chip is sole live transcript) */
#voiceLiveHearOverlay.voice-live-hear-overlay,
#voiceLiveHearOverlay.voice-live-hear-overlay--visible,
#voiceLiveHearOverlay.voice-live-hear-overlay--fading {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}
/* C7.34 / C7.14 — legacy hear overlay rules (inactive while retired) */
#voiceLiveHearOverlay.voice-live-hear-overlay {
    position: fixed;
    left: 50%;
    right: auto;
    top: auto;
    bottom: max(7.25rem, calc(6.5rem + env(safe-area-inset-bottom, 0px)));
    width: min(92vw, 22rem);
    max-width: min(92vw, 22rem);
    height: auto;
    transform: translateX(-50%);
    z-index: 96;
    display: none;
    align-items: stretch;
    justify-content: center;
    padding: 0;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    background: transparent !important;
    box-shadow: none;
    transition: opacity 0.14s ease, visibility 0.14s ease;
}
#voiceLiveHearOverlay.voice-live-hear-overlay--visible {
    display: flex !important;
    opacity: 1;
    visibility: visible;
    background: transparent !important;
}
#voiceLiveHearOverlay.voice-live-hear-overlay--fading {
    opacity: 0;
    visibility: hidden;
}
/* C7.21 — bottom transcript on problem step (do not pin live-hear to top) */
@media (max-width: 639px) {
    body:has(#contentArea.problem-step-active) #voiceLiveHearOverlay.voice-live-hear-overlay--visible,
    html.aratt-hear-overlay-problem #voiceLiveHearOverlay.voice-live-hear-overlay--visible {
        bottom: max(20.5rem, calc(19.5rem + env(safe-area-inset-bottom, 0px)));
        align-items: stretch;
        justify-content: center;
        padding: 0;
    }
    body:has(#contentArea.problem-step-active) #voiceLiveHearOverlay .voice-live-hear-overlay__glass,
    html.aratt-hear-overlay-problem #voiceLiveHearOverlay .voice-live-hear-overlay__glass {
        max-height: min(28vh, 9.5rem);
    }
    body:has(#contentArea.problem-step-active) #voiceLiveHearOverlay #voiceLiveHearText.voice-live-hear-overlay__text,
    html.aratt-hear-overlay-problem #voiceLiveHearOverlay #voiceLiveHearText.voice-live-hear-overlay__text {
        font-size: clamp(1rem, 4.8vw, 1.45rem);
        max-height: 5.5rem;
    }
}
#voiceLiveHearOverlay .voice-live-hear-overlay__glass {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 0.65rem 1rem 0.55rem;
    text-align: center;
    border-radius: 1.15rem;
    background: rgba(15, 23, 42, 0.16);
    border: 1px solid rgba(148, 163, 184, 0.22);
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.1);
    backdrop-filter: blur(10px) saturate(1.15);
    -webkit-backdrop-filter: blur(10px) saturate(1.15);
}
body:not(.dark-theme) #voiceLiveHearOverlay .voice-live-hear-overlay__glass {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(100, 116, 139, 0.2);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}
#voiceLiveHearOverlay #voiceLiveHearText.voice-live-hear-overlay__text {
    display: block;
    margin: 0;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 2.75rem;
    box-sizing: border-box;
    font-family: 'Noto Sans Bengali', 'Plus Jakarta Sans', system-ui, sans-serif;
    font-size: clamp(1.85rem, 9.5vw, 2.85rem);
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: 0.01em;
    color: #f8fafc;
    text-shadow: 0 1px 2px rgba(15, 23, 42, 0.35);
    word-wrap: break-word;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: pre-wrap;
    max-height: 9rem;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
body:not(.dark-theme) #voiceLiveHearOverlay #voiceLiveHearText.voice-live-hear-overlay__text {
    color: #0f172a;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.65);
}
#voiceLiveHearOverlay.voice-live-hear-overlay--visible #voiceLiveHearText.voice-live-hear-overlay__text:empty::before {
    content: '…';
    opacity: 0.42;
    font-weight: 700;
}
#voiceLiveHearOverlay #voiceLiveHearHint.voice-live-hear-overlay__hint {
    display: block;
    margin-top: 0.5rem;
    font-size: clamp(0.72rem, 3.4vw, 0.88rem);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: none;
    color: rgba(251, 146, 60, 0.92);
}
body:not(.dark-theme) #voiceLiveHearOverlay #voiceLiveHearHint.voice-live-hear-overlay__hint {
    color: rgba(194, 65, 12, 0.88);
}
#voiceLiveHearOverlay.voice-live-hear-overlay--visible #voiceLiveHearText.voice-live-hear-overlay__text:not(:empty) + #voiceLiveHearHint.voice-live-hear-overlay__hint {
    margin-top: 0.35rem;
    font-size: clamp(0.58rem, 2.6vw, 0.72rem);
    font-weight: 600;
    opacity: 0.62;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
#voiceMicStateBadge.voice-mic-state-badge:not(.hidden) {
    z-index: 56;
}
@media (prefers-reduced-motion: reduce) {
    #voiceLiveHearOverlay.voice-live-hear-overlay {
        transition: opacity 0.1s ease, visibility 0.1s ease;
    }
    .mic-orb-presence--idle .mic-orb-atmosphere,
    .mic-orb-presence--listening .mic-orb-atmosphere,
    .mic-orb-presence--speaking .mic-orb-action-glow,
    .mic-orb-speak-waveform__bar,
    .voice-active {
        animation: none !important;
    }
}
.location-loader {
    display: inline-block;
    width: 14px; height: 14px;
    border: 2px solid #f97316;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.6s linear infinite;
    margin-right: 6px;
    vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }
.toast-soft { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); background: #1e293b; color: white; padding: 10px 20px; border-radius: 40px; font-size: 0.8rem; z-index: 2100; backdrop-filter: blur(8px); transition: opacity 0.2s; opacity: 0; visibility: hidden; }
.toast-soft.show { opacity: 1; visibility: visible; }
.brand-chip.selected { background: #f97316 !important; color: white !important; transform: scale(1.02); box-shadow: 0 0 0 2px rgba(249,115,22,0.3); }
.trust-badge { background: rgba(255,255,255,0.05); backdrop-filter: blur(4px); border-radius: 60px; padding: 4px 12px; font-size: 10px; display: inline-flex; align-items: center; gap: 6px; }
[data-lucide] { width: 1.5rem; height: 1.5rem; }
.microphone-status { font-size: 10px; font-weight: bold; transition: opacity 0.2s; background: rgba(0,0,0,0.82); backdrop-filter: blur(8px); border-radius: 20px; padding: 6px 12px; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: 0 2px 12px rgba(0,0,0,0.28); max-width: min(180px, 52vw); pointer-events: none; }
.mic-status-tooltip { position: absolute; bottom: calc(100% + 6px); left: auto; right: 0; transform: translate3d(0, 0, 0); margin-bottom: 0; z-index: 34; }
#voiceTraceConsole { position: fixed; right: max(8px, env(safe-area-inset-right, 0px)); bottom: calc(7.35rem + env(safe-area-inset-bottom, 0px)); z-index: 92; width: min(420px, calc(100vw - 16px)); max-height: min(58vh, 460px); display: flex; flex-direction: column; pointer-events: auto; font-size: 10px; line-height: 1.35; color: #e2e8f0; background: rgba(15,23,42,0.94); border: 1px solid rgba(249,115,22,0.35); border-radius: 12px; padding: 8px 10px; backdrop-filter: blur(10px); box-shadow: 0 6px 22px rgba(0,0,0,0.38); }
body.dark-theme #voiceTraceConsole { background: rgba(3,7,18,0.96); }
#voiceTraceConsole.hidden { display: none !important; }
.vtc-console-inner { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; overflow: hidden; }
#voiceTraceConsole #voiceTraceToolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; row-gap: 3px; margin-bottom: 3px; }
#voiceTraceConsole #voiceTraceToolbar .vtc-title { font-weight: 900; color: #fdba74; letter-spacing: 0.02em; flex: 1 1 auto; min-width: 0; line-height: 1.25; }
#voiceTraceConsole #voiceTraceJourneyHint.vtc-hint { margin: 0 0 3px; font-size: 9px; line-height: 1.35; color: rgba(226,232,240,0.72); }
#voiceTraceConsole #voiceTraceDetailLabel.vtc-detail-label { margin: 6px 0 4px; font-size: 10px; font-weight: 800; line-height: 1.35; letter-spacing: 0.05em; text-transform: uppercase; color: rgba(253,186,116,0.88); }
#voiceTraceConsole .vtc-detail-panel { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; margin-top: 5px; padding-top: 5px; border-top: 1px solid rgba(148,163,184,0.14); }
#voiceTraceConsole .vtc-detail-body { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; overflow: hidden; gap: 3px; }
#voiceTraceConsole .vtc-detail-toggle { display: none; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: 44px; padding: 5px 10px; margin: 0; border-radius: 8px; border: 1px solid rgba(148,163,184,0.28); background: rgba(148,163,184,0.07); color: rgba(226,232,240,0.9); font-size: 9px; font-weight: 700; letter-spacing: 0.03em; cursor: pointer; flex-shrink: 0; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.vtc-detail-toggle .vtc-toggle-text-expanded { display: none; }
#voiceTraceDetailPanel.vtc-detail-expanded .vtc-detail-toggle .vtc-toggle-text-collapsed { display: none; }
#voiceTraceDetailPanel.vtc-detail-expanded .vtc-detail-toggle .vtc-toggle-text-expanded { display: inline; }
@media (min-width: 640px) {
    #voiceTraceConsole .vtc-detail-toggle { display: none !important; }
    #voiceTraceConsole .vtc-detail-body { max-height: none !important; opacity: 1 !important; overflow: visible !important; flex: 1 1 auto; pointer-events: auto !important; }
}
#voiceTraceConsole #voiceTraceJourney { flex: 0 1 auto; max-height: 22vh; min-height: 72px; overflow-y: auto; margin: 0; padding: 6px 9px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 9px; line-height: 1.48; white-space: pre-wrap; word-break: break-word; -webkit-user-select: text; user-select: text; background: rgba(2,6,23,0.72); border-radius: 8px; border: 1px solid rgba(56,189,248,0.2); color: #e0f2fe; }
#voiceTraceConsole #voiceTraceToolbar button { pointer-events: auto; font-size: 10px; font-weight: 800; line-height: 1.25; min-height: 26px; padding: 3px 8px; border-radius: 7px; border: 1px solid rgba(249,115,22,0.38); background: rgba(249,115,22,0.12); color: #ffedd5; cursor: pointer; }
#voiceTraceConsole #voiceTraceToolbar button:active { transform: scale(0.98); }
#voiceTraceConsole #voiceTraceToolbar button:focus-visible { outline: 2px solid rgba(56,189,248,0.75); outline-offset: 2px; }
#voiceTraceConsole #voiceTraceToolbar button.vtc-btn-pressed { transform: scale(0.98); border-color: rgba(249,115,22,0.62); background: rgba(249,115,22,0.18); }

#voiceTraceConsole .vtc-action-status { 
    flex: 0 0 auto;
    display: inline-block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.01em;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(249,115,22,0.32);
    background: rgba(249,115,22,0.1);
    color: rgba(255,237,213,0.95);
    opacity: 0;
    transform: translateY(-2px);
    transition: opacity 0.18s ease, transform 0.18s ease;
    pointer-events: none;
}
.vtc-action-status.vtc-action-show { opacity: 1; transform: translateY(0); }
.vtc-action-status.vtc-action-kind-pending { border-color: rgba(249,115,22,0.55); background: rgba(249,115,22,0.18); }
.vtc-action-status.vtc-action-kind-success { border-color: rgba(34,197,94,0.45); background: rgba(34,197,94,0.10); }
.vtc-action-status.vtc-action-kind-error { border-color: rgba(239,68,68,0.50); background: rgba(239,68,68,0.10); }

body.dark-theme #voiceTraceConsole .vtc-action-status { color: rgba(255,237,213,0.98); }
body.dark-theme #voiceTraceConsole .vtc-action-status.vtc-action-kind-success { border-color: rgba(74,222,128,0.55); }
body.dark-theme #voiceTraceConsole .vtc-action-status.vtc-action-kind-error { border-color: rgba(252,165,165,0.55); }

#voiceTraceConsole #voiceTraceMinimizeBtn.vtc-minimize-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 800;
    line-height: 1.25;
    min-height: 26px;
    padding: 3px 8px;
    border-radius: 7px;
    border: 1px solid rgba(148,163,184,0.45);
    background: rgba(148,163,184,0.12);
    color: #e2e8f0;
    cursor: pointer;
    touch-action: manipulation;
    position: relative;
    z-index: 2;
}
#voiceTraceRestoreBtn.vtc-gear-bubble {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    margin: 0;
    border-radius: 50%;
    border: 1px solid rgba(100,116,139,0.32);
    background: rgba(255,255,255,0.94);
    color: rgba(51,65,85,0.82);
    cursor: pointer;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    box-shadow: 0 2px 10px rgba(15,23,42,0.1);
}
body.dark-theme #voiceTraceRestoreBtn.vtc-gear-bubble {
    background: rgba(30,41,59,0.94);
    border-color: rgba(148,163,184,0.32);
    color: rgba(226,232,240,0.88);
    box-shadow: 0 2px 12px rgba(0,0,0,0.28);
}
#voiceTraceRestoreBtn.vtc-gear-bubble:hover {
    background: rgba(248,250,252,0.98);
    border-color: rgba(100,116,139,0.45);
}
body.dark-theme #voiceTraceRestoreBtn.vtc-gear-bubble:hover {
    background: rgba(51,65,85,0.96);
    border-color: rgba(148,163,184,0.45);
}
#voiceTraceRestoreBtn.vtc-gear-bubble:focus-visible {
    outline: 2px solid rgba(56,189,248,0.75);
    outline-offset: 2px;
}
.vtc-gear-icon { width: 20px; height: 20px; display: block; pointer-events: none; }
#voiceTraceConsole.vtc-console-minimized {
    width: auto;
    max-width: none;
    min-width: 0;
    max-height: none;
    padding: 0;
    background: transparent;
    background-color: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    overflow: visible;
    isolation: auto;
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    touch-action: manipulation;
}
body.dark-theme #voiceTraceConsole.vtc-console-minimized {
    background: transparent;
    background-color: transparent;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
#voiceTraceConsole.vtc-console-minimized .vtc-console-inner { display: none !important; }
#voiceTraceConsole.vtc-console-minimized #voiceTraceRestoreBtn.vtc-gear-bubble {
    display: flex;
    overflow: hidden;
    border-radius: 50%;
}
body.dark-theme #voiceTraceConsole.vtc-console-minimized #voiceTraceRestoreBtn.vtc-gear-bubble {
    background: rgba(30,41,59,0.94);
    border-color: rgba(148,163,184,0.32);
    color: rgba(226,232,240,0.88);
    box-shadow: 0 2px 12px rgba(0,0,0,0.28);
}
body.dark-theme #voiceTraceConsole.vtc-console-minimized #voiceTraceRestoreBtn.vtc-gear-bubble:hover {
    background: rgba(51,65,85,0.96);
    border-color: rgba(148,163,184,0.45);
}
#voiceTraceConsole.vtc-drag-positioned { right: auto !important; bottom: auto !important; }
#voiceTraceConsole:not(.vtc-console-minimized) #voiceTraceToolbar .vtc-drag-handle,
#voiceTraceConsole:not(.vtc-console-minimized) #voiceTraceJourneyHint.vtc-drag-handle {
    cursor: grab;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}
#voiceTraceConsole.vtc-is-dragging {
    -webkit-user-select: none;
    user-select: none;
}
#voiceTraceConsole.vtc-is-dragging #voiceTraceToolbar .vtc-drag-handle,
#voiceTraceConsole.vtc-is-dragging #voiceTraceJourneyHint.vtc-drag-handle { cursor: grabbing; }
#voiceTraceConsole.vtc-is-dragging #voiceTraceJourney,
#voiceTraceConsole.vtc-is-dragging #voiceTraceLog,
#voiceTraceConsole.vtc-is-dragging #voiceTraceToolbar button {
    -webkit-user-select: text;
    user-select: text;
}
#voiceTraceConsole.vtc-console-minimized.vtc-drag-positioned { left: auto !important; top: auto !important; }
#voiceTraceConsole #voiceTraceLog {
    flex: 1 1 auto;
    overflow-y: auto;
    margin: 0;
    padding: 9px 11px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11px;
    line-height: 1.56;
    letter-spacing: 0.01em;
    white-space: pre-wrap;
    word-break: break-word;
    -webkit-user-select: text;
    user-select: text;
    background: rgba(2,6,23,0.82);
    border-radius: 9px;
    border: 1px solid rgba(148,163,184,0.32);
    min-height: 112px;
    max-height: min(32vh, 280px);
    outline: none;
    resize: vertical;
    width: 100%;
    box-sizing: border-box;
    border-style: solid;
    color: #e8eef6;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
}
body.dark-theme #voiceTraceConsole #voiceTraceLog { color: #f1f5f9; background: rgba(2,6,23,0.9); border-color: rgba(148,163,184,0.34); }
body:not(.dark-theme) #voiceTraceConsole #voiceTraceLog { color: #e2e8f0; }

/* Mobile-only: voice trace containment — dock/safe-area clearance, balanced journey + routing scroll */
@media (max-width: 639px) {
    #voiceTraceConsole {
        bottom: calc(10.5rem + env(safe-area-inset-bottom, 0px));
        width: min(calc(100vw - 12px), 400px);
        max-height: min(44vh, 44dvh, 304px);
        z-index: 49;
        overflow: hidden;
        overscroll-behavior: contain;
        touch-action: manipulation;
        isolation: isolate;
    }
    #voiceTraceConsole:not(.vtc-console-minimized) {
        padding: 6px 8px 8px;
    }
    #voiceTraceConsole:not(.vtc-console-minimized) #voiceTraceToolbar {
        margin-bottom: 2px;
        gap: 3px;
        row-gap: 2px;
    }
    #voiceTraceConsole:not(.vtc-console-minimized) #voiceTraceToolbar button,
    #voiceTraceConsole:not(.vtc-console-minimized) #voiceTraceMinimizeBtn.vtc-minimize-btn {
        min-height: 28px;
        padding: 3px 7px;
        font-size: 9px;
    }
    #voiceTraceConsole:not(.vtc-console-minimized) .vtc-console-inner {
        flex: 1 1 auto;
        min-height: 0;
        overflow: hidden;
        gap: 2px;
    }
    #voiceTraceJourneyHint.vtc-hint {
        margin: 0 0 4px;
        font-size: 9px;
        line-height: 1.35;
    }
    #voiceTraceConsole:not(.vtc-console-minimized) .vtc-detail-panel {
        margin-top: 4px;
        padding-top: 4px;
    }
    #voiceTraceConsole:not(.vtc-console-minimized) #voiceTraceDetailLabel.vtc-detail-label {
        margin: 5px 0 3px;
        font-size: 9px;
    }
    #voiceTraceConsole .vtc-detail-toggle {
        display: flex;
        flex-shrink: 0;
        min-height: 44px;
        padding: 4px 8px;
        margin-top: 1px;
        border-radius: 7px;
        border-color: rgba(148,163,184,0.24);
        background: rgba(148,163,184,0.06);
        font-size: 9px;
        font-weight: 700;
    }
    #voiceTraceDetailPanel:not(.vtc-detail-expanded) .vtc-detail-body {
        max-height: 0;
        min-height: 0;
        flex: 0 0 auto;
        opacity: 0;
        overflow: hidden;
        margin: 0;
        padding: 0;
        pointer-events: none;
        visibility: hidden;
        transition: max-height 0.22s ease, opacity 0.18s ease;
    }
    #voiceTraceDetailPanel.vtc-detail-expanded {
        flex: 1 1 auto;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }
    #voiceTraceDetailPanel.vtc-detail-expanded .vtc-detail-body {
        max-height: none;
        opacity: 1;
        flex: 1 1 auto;
        min-height: 76px;
        overflow: hidden;
        pointer-events: auto;
        visibility: visible;
        transition: max-height 0.22s ease, opacity 0.18s ease;
        gap: 2px;
    }
    #voiceTraceDetailPanel.vtc-detail-expanded #voiceTraceLog {
        max-height: none;
        min-height: 76px;
        flex: 1 1 auto;
        font-size: 11px;
        line-height: 1.52;
        padding: 8px 10px;
        resize: none;
        touch-action: pan-y;
    }
    #voiceTraceConsole #voiceTraceJourney {
        flex: 0 1 auto;
        min-height: 54px;
        max-height: min(10.5vh, 10.5dvh, 94px);
        padding: 5px 8px;
        font-size: 10px;
        line-height: 1.46;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
        scrollbar-width: thin;
    }
    #voiceTraceConsole:has(#voiceTraceDetailPanel:not(.vtc-detail-expanded)) {
        max-height: min(38vh, 38dvh, 284px);
    }
    #voiceTraceConsole:has(#voiceTraceDetailPanel:not(.vtc-detail-expanded)) #voiceTraceJourney {
        flex: 1 1 auto;
        min-height: 64px;
        max-height: min(20vh, 20dvh, 188px);
    }
    #voiceTraceConsole:has(#voiceTraceDetailPanel.vtc-detail-expanded) {
        max-height: min(44vh, 44dvh, 304px);
    }
    #voiceTraceConsole:has(#voiceTraceDetailPanel.vtc-detail-expanded) #voiceTraceJourney {
        flex: 0 1 39%;
        min-height: 52px;
        max-height: min(10vh, 10dvh, 92px);
    }
    #voiceTraceConsole:has(#voiceTraceDetailPanel.vtc-detail-expanded) #voiceTraceDetailPanel {
        flex: 1 1 61%;
        min-height: 0;
    }
    #voiceTraceConsole:has(#voiceTraceDetailPanel.vtc-detail-expanded) #voiceTraceLog {
        min-height: 76px;
        line-height: 1.5;
        padding: 7px 9px;
    }
    #voiceTraceConsole:has(#voiceTraceDetailPanel.vtc-detail-expanded) .vtc-detail-body {
        min-height: 74px;
        gap: 2px;
    }
    #voiceTraceConsole.vtc-console-minimized {
        isolation: auto;
    }
    body.dark-theme #voiceTraceConsole.vtc-console-minimized {
        background: transparent;
        background-color: transparent;
    }
    #voiceTraceConsole.vtc-console-minimized .vtc-console-inner {
        pointer-events: none !important;
    }
    #voiceTraceConsole #voiceTraceLog {
        resize: none;
        touch-action: pan-y;
    }
}
