/* Visitor page layout — full-viewport, two-column (desktop) / stacked (mobile) */

@layer layout {

  .visitor-body {
    padding: 0;
    overflow: hidden;
  }

  .visitor-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }
  .visitor-layout--wide-sidebar {
    grid-template-columns: 1fr 560px;
  }

  /* ---- Video panel (left) ---- */
  .visitor-video-panel {
    background: var(--surface-0);
    position: relative;
    overflow: hidden;
    min-height: 0;
  }

  .visitor-video-container {
    width: 100%;
    height: 100%;
  }

  .visitor-video-container video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
  }

  /* ---- Start overlay ---- */
  .visitor-start-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: var(--z-overlay);
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
  }

  .visitor-start-btn {
    padding: var(--space-4) var(--space-12);
    font-size: var(--text-xl);
    font-weight: var(--weight-bold);
    background: var(--color-primary);
    color: #fff;
    border-radius: var(--radius-lg);
    cursor: pointer;
    border: none;
    transition: background var(--transition-fast), transform 0.1s, box-shadow var(--transition-fast);
    box-shadow: 0 0 24px rgba(91, 91, 214, 0.3);
  }
  .visitor-start-btn:hover {
    background: var(--color-primary-hover);
    transform: scale(1.03);
    box-shadow: 0 0 32px rgba(91, 91, 214, 0.45);
  }
  .visitor-start-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
  }
  .visitor-start-btn .spinner {
    border-top-color: #fff;
    vertical-align: middle;
    margin-right: var(--space-2);
  }

  /* ---- Voice-activation waiting overlay ---- */
  .visitor-waiting-mic {
    animation: waiting-pulse 2s ease-in-out infinite;
    color: var(--color-primary);
  }

  @keyframes waiting-pulse {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.12); }
  }

  .visitor-waiting-label {
    margin-top: var(--space-3);
    font-size: var(--text-sm);
    color: var(--color-muted);
    letter-spacing: 0.03em;
  }

  /* ---- Sidebar (right) ---- */
  .visitor-sidebar {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: rgba(24, 24, 31, 0.85);
    backdrop-filter: blur(16px);
    border-left: 1px solid var(--border-subtle);
  }

  .visitor-sidebar-header {
    padding: var(--space-5);
    border-bottom: 1px solid var(--border-subtle);
  }
  .visitor-sidebar-header h1 {
    font-size: var(--text-2xl);
    margin-bottom: var(--space-1);
  }
  .visitor-sidebar-header p {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin: 0;
  }

  /* ---- Controls area ---- */
  .visitor-controls {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
  }

  /* ---- Transcript ----
     The wrappers (.visitor-transcript-wrap, .visitor-tx-column) are
     non-scrolling flex containers; the inner .transcript IS the scroll
     container — same shape as .visitor-visual-prompt-log on the other
     side. That keeps addTranscript()'s `el.scrollTop = el.scrollHeight`
     working as intended and matches the vp-log autoscroll. */
  .visitor-transcript-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
  }

  /* ---- Split columns (visuals type) ---- */
  .visitor-split-columns {
    flex: 1;
    display: flex;
    min-height: 0;
    overflow: hidden;
  }
  .visitor-vp-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    border-right: 1px solid var(--border-subtle);
  }
  .visitor-tx-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
  }
  .visitor-transcript-wrap > .transcript,
  .visitor-tx-column > .transcript {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: var(--space-2) var(--space-3);
  }

  /* ---- Visual Prompt Panel ---- */
  .visitor-visual-prompt-header {
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    color: #a78bfa;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: var(--space-3) var(--space-4) var(--space-2);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .vp-copy-buttons {
    display: flex;
    gap: 4px;
  }
  .vp-copy-btn {
    font-size: 0.65rem;
    padding: 2px 8px;
    border: 1px solid rgba(167, 139, 250, 0.3);
    border-radius: 4px;
    background: rgba(124, 58, 237, 0.1);
    color: #a78bfa;
    cursor: pointer;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 500;
    transition: background 0.15s, border-color 0.15s;
  }
  .vp-copy-btn:hover {
    background: rgba(124, 58, 237, 0.25);
    border-color: rgba(167, 139, 250, 0.5);
  }
  .visitor-visual-prompt-log {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-2) var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
  }
  .visual-prompt-entry {
    font-size: var(--text-xs);
    line-height: 1.4;
    color: #c4b5fd;
    padding: var(--space-1) var(--space-2);
    border-left: 2px solid #7c3aed;
    background: rgba(124, 58, 237, 0.08);
    border-radius: 0 4px 4px 0;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    align-items: baseline;
  }
  /* Newest entry is appended at the bottom — give it the brighter highlight
     so the eye lands there as autoscroll keeps it in view. */
  .visual-prompt-entry:last-child {
    color: #e9d5ff;
    background: rgba(124, 58, 237, 0.15);
  }
  .visual-prompt-time {
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
    color: #8b5cf6;
    opacity: 0.7;
  }
  .visual-prompt-text {
    flex: 1;
  }
  .visual-prompt-context {
    display: none;
    width: 100%;
    margin-top: var(--space-1);
    padding: var(--space-2);
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    font-size: 0.7rem;
    color: #a78bfa;
    white-space: pre-wrap;
    font-family: monospace;
    line-height: 1.5;
  }
  .visual-prompt-entry.expanded .visual-prompt-context {
    display: block;
  }

  /* Summary-origin entries — a warmer, rose-purple shift so the reflective
     close reads as its own beat, without breaking the visual language. */
  .visual-prompt-entry--summary {
    color: #f5d0fe;
    border-left-color: #d946ef;
    background: rgba(217, 70, 239, 0.10);
  }
  .visual-prompt-entry--summary.visual-prompt-entry:last-child {
    color: #fae8ff;
    background: rgba(217, 70, 239, 0.18);
  }
  .visual-prompt-entry--summary .visual-prompt-time {
    color: #c026d3;
  }
  .visual-prompt-entry--summary .visual-prompt-context {
    color: #e879f9;
  }

  /* Agent-sourced entries — a teal shift, distinct from the visitor's purple
     and the summary's magenta, so a "both"-mode stream reads at a glance as
     "the agent imagined this" vs "the visitor imagined that". */
  .visual-prompt-entry--agent {
    color: #99f6e4;
    border-left-color: #14b8a6;
    background: rgba(20, 184, 166, 0.08);
  }
  .visual-prompt-entry--agent.visual-prompt-entry:last-child {
    color: #ccfbf1;
    background: rgba(20, 184, 166, 0.16);
  }
  .visual-prompt-entry--agent .visual-prompt-time {
    color: #2dd4bf;
  }
  .visual-prompt-entry--agent .visual-prompt-context {
    color: #5eead4;
  }

  /* ---- Shared scrollbar treatment for the two visuals-profile panels ----
     Both the visual-descriptor log and the transcript autoscroll the same
     way; matching the scrollbar so the columns read as siblings rather
     than two unrelated widgets. */
  .visitor-visual-prompt-log,
  .visitor-transcript-wrap > .transcript,
  .visitor-tx-column > .transcript {
    scrollbar-width: thin;
    scrollbar-color: rgba(124, 58, 237, 0.45) transparent;
  }
  .visitor-visual-prompt-log::-webkit-scrollbar,
  .visitor-transcript-wrap > .transcript::-webkit-scrollbar,
  .visitor-tx-column > .transcript::-webkit-scrollbar {
    width: 8px;
  }
  .visitor-visual-prompt-log::-webkit-scrollbar-track,
  .visitor-transcript-wrap > .transcript::-webkit-scrollbar-track,
  .visitor-tx-column > .transcript::-webkit-scrollbar-track {
    background: transparent;
  }
  .visitor-visual-prompt-log::-webkit-scrollbar-thumb,
  .visitor-transcript-wrap > .transcript::-webkit-scrollbar-thumb,
  .visitor-tx-column > .transcript::-webkit-scrollbar-thumb {
    background: rgba(124, 58, 237, 0.45);
    border-radius: 4px;
  }
  .visitor-visual-prompt-log::-webkit-scrollbar-thumb:hover,
  .visitor-transcript-wrap > .transcript::-webkit-scrollbar-thumb:hover,
  .visitor-tx-column > .transcript::-webkit-scrollbar-thumb:hover {
    background: rgba(124, 58, 237, 0.65);
  }

  /* ---- Footer ---- */
  .visitor-sidebar-footer {
    padding: var(--space-3) var(--space-5);
    border-top: 1px solid var(--border-subtle);
  }

  .visitor-end-btn {
    display: block;
    width: 100%;
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: color var(--transition-fast), border-color var(--transition-fast);
  }
  .visitor-end-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-default);
  }

  /* ---- Wrap Up button (manual reflective-summary trigger) ---- */
  .visitor-wrap-up-btn {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    margin-bottom: var(--space-2);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    background: color-mix(in srgb, var(--color-primary, #5b5bd6) 18%, transparent);
    color: var(--color-primary);
    border: 1px solid color-mix(in srgb, var(--color-primary, #5b5bd6) 35%, transparent);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast);
  }
  .visitor-wrap-up-btn:hover:not(:disabled) {
    background: color-mix(in srgb, var(--color-primary, #5b5bd6) 26%, transparent);
    border-color: color-mix(in srgb, var(--color-primary, #5b5bd6) 50%, transparent);
  }
  .visitor-wrap-up-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }

  /* ---- Orb container (voice_agent) ---- */
  .visitor-orb-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
  }
  .visitor-orb-container canvas {
    width: 100%;
    height: 100%;
  }

  /* ---- TD status display (touchdesigner) ---- */
  .visitor-td-status {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--surface-0);
    color: var(--text-secondary);
    gap: var(--space-3);
  }
  .visitor-td-icon {
    color: var(--color-primary);
    opacity: 0.6;
  }
  .visitor-td-label {
    font-size: var(--text-xl);
    font-weight: var(--weight-medium);
    color: var(--text-primary);
  }
  .visitor-td-sublabel {
    font-size: var(--text-sm);
    color: var(--text-muted);
  }

  /* ---- Countdown timer ---- */
  .visitor-countdown {
    width: 100%;
    display: flex;
    align-items: center;
    gap: var(--space-2);
  }
  .countdown-bar {
    flex: 1;
    height: 4px;
    background: var(--surface-2);
    border-radius: var(--radius-full);
    overflow: hidden;
  }
  .countdown-fill {
    height: 100%;
    background: var(--color-primary);
    border-radius: var(--radius-full);
    transition: width 1s linear;
  }
  .countdown-time {
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    min-width: 3.5ch;
    text-align: right;
  }
  .visitor-countdown.countdown-warning .countdown-fill { background: var(--color-warning); }
  .visitor-countdown.countdown-warning .countdown-time { color: var(--color-warning); }
  .visitor-countdown.countdown-danger .countdown-fill { background: var(--color-danger); }
  .visitor-countdown.countdown-danger .countdown-time { color: var(--color-danger); }

  /* ---- Error state ---- */
  .visitor-error-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: var(--z-overlay);
    background: rgba(0, 0, 0, 0.85);
    text-align: center;
    padding: var(--space-8);
  }
  .visitor-error-overlay p {
    color: var(--color-danger);
    font-size: var(--text-lg);
    margin-bottom: var(--space-5);
  }

  /* ---- Mobile ---- */
  @media (max-width: 768px) {
    .visitor-layout {
      grid-template-columns: 1fr;
      grid-template-rows: 55vh 1fr;
    }

    .visitor-sidebar {
      border-left: none;
      border-top: 1px solid var(--border-subtle);
    }

    .visitor-sidebar-header {
      padding: var(--space-3) var(--space-4);
    }
    .visitor-sidebar-header h1 { font-size: var(--text-xl); }

    .visitor-controls {
      flex-direction: row;
      flex-wrap: wrap;
      padding: var(--space-2) var(--space-4);
    }
    .visitor-controls .voice-indicator {
      width: 44px;
      height: 44px;
    }
    .visitor-controls .voice-indicator-icon {
      width: 28px;
      height: 28px;
    }
    .visitor-controls .state-label {
      flex: 1;
      min-width: 100px;
      font-size: var(--text-xs);
      padding: var(--space-1) var(--space-2);
    }

    .visitor-transcript-wrap > .transcript,
    .visitor-tx-column > .transcript { padding: var(--space-2) var(--space-4); }
    .visitor-sidebar-footer { padding: var(--space-2) var(--space-4); }

    /* Stack columns vertically on mobile */
    .visitor-split-columns {
      flex-direction: column;
    }
    .visitor-vp-column {
      flex: 0 0 auto;
      max-height: 140px;
      border-right: none;
      border-bottom: 1px solid var(--border-subtle);
    }

    .latency-toggle { bottom: var(--space-3); left: var(--space-3); }
    .latency-panel { left: var(--space-3); bottom: 48px; max-width: calc(100vw - 24px); }
  }

  /* ---- Oracle: monitor-focused layout (desktop) ----
     The mic/camera/speaker controls are one-time setup, so compact them into a
     single horizontal strip and give the Sees / Imagines / Says panels the bulk
     of the screen. Scoped to .visitor-layout--oracle only — visuals/voice_agent
     are untouched. Guarded to desktop widths; mobile keeps its own treatment. */
  @media (min-width: 769px) {
    /* Sidebar takes ~70%; the ambient "watching" panel keeps a slim presence. */
    .visitor-layout--oracle {
      grid-template-columns: minmax(280px, 30%) 1fr;
    }

    /* Keep the ORIGINAL vertical stack — mic/camera/speaker device row on top,
       then countdown / state label / "Stop Speaking" below, where they were.
       Just tighten spacing and shrink the indicators. */
    .visitor-layout--oracle .visitor-controls {
      gap: var(--space-3);
      padding: var(--space-3) var(--space-4);
    }
    /* mic + camera + speaker share ONE line (the #device-columns row; the
       speaker column is inserted into it by oracle-audio-output.js). */
    .visitor-layout--oracle #device-columns {
      gap: var(--space-6) !important;
      align-items: flex-start !important;
      flex-wrap: wrap;
    }
    .visitor-layout--oracle .visitor-controls .voice-indicator {
      width: 40px;
      height: 40px;
    }
    .visitor-layout--oracle .visitor-controls .voice-indicator-icon {
      width: 22px;
      height: 22px;
    }
    .visitor-layout--oracle .mic-selector,
    .visitor-layout--oracle .camera-selector,
    .visitor-layout--oracle #oracle-output-selector {
      max-width: 170px;
    }
    .visitor-layout--oracle .mic-device-select { font-size: var(--text-xs); }
    /* Keep the self-view + "camera blocked" caption from blowing out the row. */
    .visitor-layout--oracle .camera-self-view {
      max-width: 96px !important;
      margin-top: var(--space-1) !important;
    }
    .visitor-layout--oracle .camera-caption { max-width: 150px; }
  }
}

/* ─── Latency Stats Panel ────────────────────────────────────────── */
@layer layout {

  .latency-toggle {
    position: absolute;
    bottom: var(--space-4);
    left: var(--space-4);
    z-index: var(--z-dropdown);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: rgba(24, 24, 31, 0.75);
    backdrop-filter: blur(12px);
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition-fast), border-color var(--transition-fast),
                background var(--transition-fast);
  }
  .latency-toggle:hover {
    color: var(--text-secondary);
    border-color: var(--border-default);
    background: rgba(24, 24, 31, 0.9);
  }
  .latency-toggle.active {
    color: #a78bfa;
    border-color: #7c3aed;
    background: rgba(124, 58, 237, 0.15);
  }

  .latency-panel {
    position: absolute;
    bottom: 56px;
    left: var(--space-4);
    z-index: var(--z-dropdown);
    width: 320px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    background: rgba(24, 24, 31, 0.92);
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity var(--transition-base), transform var(--transition-base);
  }
  .latency-panel.open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  .latency-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    color: #a78bfa;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  .latency-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: var(--text-lg);
    line-height: 1;
    padding: 0 2px;
    transition: color var(--transition-fast);
  }
  .latency-close:hover { color: var(--text-primary); }

  .latency-panel-body {
    padding: var(--space-3) var(--space-4) var(--space-4);
  }

  /* Config attribution line — provider/model + endpointing config so
     latency numbers can be read against the running config. */
  .latency-config {
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-align: center;
    padding: var(--space-1) 0 var(--space-2);
    font-variant-numeric: tabular-nums;
  }

  /* Hero metrics — two big numbers */
  .latency-hero {
    display: flex;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
  }
  .latency-hero-metric {
    flex: 1;
    text-align: center;
    padding: var(--space-2) var(--space-1);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.03);
  }
  .latency-hero-value {
    display: block;
    font-size: var(--text-2xl);
    font-weight: var(--weight-bold);
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    line-height: 1.2;
  }
  .latency-hero-label {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 2px;
  }

  /* Color states for hero metrics */
  .latency-good .latency-hero-value { color: var(--color-success); }
  .latency-warn .latency-hero-value { color: var(--color-warning); }
  .latency-bad .latency-hero-value { color: var(--color-danger); }

  /* Sparkline with legend */
  .latency-sparkline-wrap {
    position: relative;
    margin-bottom: var(--space-3);
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-sm);
    padding: var(--space-2);
  }
  .latency-sparkline-wrap canvas {
    display: block;
    width: 100%;
    height: 48px;
  }
  .latency-sparkline-legend {
    display: flex;
    gap: var(--space-3);
    justify-content: flex-end;
    padding-top: 4px;
  }
  .latency-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }
  .latency-legend-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
  }

  /* Pipeline segment breakdown */
  .latency-pipeline {
    margin-bottom: var(--space-3);
  }
  .latency-pipeline-label {
    font-size: 10px;
    font-weight: var(--weight-semibold);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: var(--space-2);
  }
  .latency-segments {
    display: flex;
    flex-direction: column;
    gap: 1px;
  }
  .latency-seg {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px var(--space-2);
    border-radius: 3px;
    transition: background var(--transition-fast);
  }
  .latency-seg:hover {
    background: rgba(255, 255, 255, 0.03);
  }
  .latency-seg-highlight {
    background: rgba(139, 92, 246, 0.08);
    border-left: 2px solid #8b5cf6;
  }
  .latency-seg-highlight:hover {
    background: rgba(139, 92, 246, 0.12);
  }
  .latency-seg-name {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    min-width: 90px;
  }
  .latency-seg-values {
    display: flex;
    gap: var(--space-3);
    align-items: baseline;
  }
  .latency-seg-last {
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    min-width: 52px;
    text-align: right;
  }
  .latency-seg-p50 {
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
    min-width: 48px;
    text-align: right;
  }
  .latency-seg-col-labels {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: 2px var(--space-2) 0;
  }
  .latency-seg-col-last-label,
  .latency-seg-col-p50-label {
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.5;
  }
  .latency-seg-col-last-label { min-width: 52px; text-align: right; }
  .latency-seg-col-p50-label  { min-width: 48px; text-align: right; }

  /* Counters row */
  .latency-counters {
    display: flex;
    gap: var(--space-2);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border-subtle);
  }
  .latency-counter {
    flex: 1;
    text-align: center;
    padding: var(--space-1) 0;
  }
  .latency-counter-value {
    display: block;
    font-size: var(--text-base);
    font-weight: var(--weight-bold);
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    line-height: 1.3;
  }
  .latency-counter-label {
    display: block;
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }
}

/* ===== Oracle vision monitor (/p/{oracle}) =====
   Reuses the standard visitor layout (media panel + sidebar) and the visuals
   "Visual Descriptors" section (.visitor-vp-column / -log). These add only the
   new bits: the live beat badge, the idle line, and the read chips. */
.oracle-beat-badge {
  font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text-muted, #8a93a6);
  background: var(--surface-1, rgba(255,255,255,0.04));
  border: 1px solid var(--border, rgba(255,255,255,0.12));
  border-radius: 999px; padding: 2px 10px;
}
.oracle-beat-badge[data-live="true"] {
  color: var(--color-success, #9ece6a);
  border-color: var(--color-success, #9ece6a);
}
.oracle-vision-empty {
  color: var(--text-muted, #8a93a6); font-style: italic;
  font-size: var(--text-sm, 13px); padding: var(--space-3, 12px);
}
.oracle-vision-chips {
  display: flex; flex-wrap: wrap; gap: var(--space-2, 8px); margin-top: 4px;
}
.oracle-vision-chip {
  background: var(--surface-1, rgba(255,255,255,0.04));
  border: 1px solid var(--border, rgba(255,255,255,0.12));
  border-radius: 999px; padding: 5px 12px; font-size: var(--text-sm, 13px);
}
.oracle-vision-chip .k {
  color: var(--text-muted, #8a93a6); text-transform: uppercase;
  font-size: 11px; letter-spacing: 0.04em; margin-right: 7px;
}
.oracle-vision-chip .v { color: var(--text-primary, #e6eaf2); }
.oracle-vision-chip.standout { border-color: var(--color-warning, #e0af68); }

/* ---- Oracle stacked sidebar (vision feed + transcript) ----
   Mirrors the visuals page's two-panel split, but stacked vertically so the
   "What the Oracle Sees" feed sits above a real `.transcript` panel. Each
   column is its own scroll container (the inner -log / .transcript scroll),
   so the two sections never fight for the sidebar's height. */
.oracle-stacked-columns {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.oracle-stacked-col {
  flex: 1 1 0;
  min-height: 0;
  /* Reset the vp-column's right border (used in the horizontal visuals split)
     — here the columns stack, so the divider belongs on the bottom edge. */
  border-right: none;
}
.oracle-stacked-col + .oracle-stacked-col {
  border-top: 1px solid var(--border-subtle);
}
/* The transcript column's inner `.transcript` is the scroll container, exactly
   like the visuals page's `.visitor-tx-column > .transcript`. */
.oracle-stacked-col.visitor-tx-column > .transcript {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-2) var(--space-3);
  scrollbar-width: thin;
  scrollbar-color: rgba(124, 58, 237, 0.45) transparent;
}
.oracle-stacked-col.visitor-tx-column > .transcript::-webkit-scrollbar { width: 8px; }
.oracle-stacked-col.visitor-tx-column > .transcript::-webkit-scrollbar-track { background: transparent; }
.oracle-stacked-col.visitor-tx-column > .transcript::-webkit-scrollbar-thumb {
  background: rgba(124, 58, 237, 0.45);
  border-radius: 4px;
}
.oracle-stacked-col.visitor-tx-column > .transcript::-webkit-scrollbar-thumb:hover {
  background: rgba(124, 58, 237, 0.65);
}
