/**
 * apple-chat-redesign.css
 * ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 * Hypatia Chat — Apple Intelligence Design System
 * Goal: Apple HIG + ChatGPT Voice + VisionOS
 * 
 * Loaded LAST — overrides all other visual styles.
 * JS / layout / functionality are untouched.
 * 
 * Sections:
 *   §0  Font import + design tokens
 *   §1  Page base + background
 *   §2  Layout shell
 *   §3  Header — floating glass island
 *   §4  Messages scroll area
 *   §5  Chat bubbles — user + assistant
 *   §6  Rich text + code blocks
 *   §7  Input composer — floating glass pill
 *   §8  Voice FAB + tray
 *   §9  Thinking / activity indicators
 *   §10 Apple voice bottom sheet
 *   §11 Voice orb
 *   §12 Waveform canvas
 *   §13 Voice controls
 *   §14 Animations + keyframes
 *   §15 Scrollbar
 *   §16 Mobile (≤768px) overrides
 *   §17 Misc + utility
 * ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 * 2026-07-05
 */

/* ─── §0  Font + Design Tokens ──────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,300;0,14..32,400;0,14..32,500;0,14..32,600;0,14..32,700;1,14..32,400&display=swap');

:root {
  /* ── Palette ── */
  --ap-black:        #090909;
  --ap-bg:           #0c0c10;
  --ap-surface-1:    rgba(16, 16, 20, 0.97);
  --ap-surface-2:    rgba(24, 24, 30, 0.88);
  --ap-surface-3:    rgba(32, 32, 40, 0.75);
  --ap-glass:        rgba(255, 255, 255, 0.032);
  --ap-glass-2:      rgba(255, 255, 255, 0.055);
  --ap-border:       rgba(255, 255, 255, 0.07);
  --ap-border-2:     rgba(255, 255, 255, 0.12);
  --ap-blue:         #0A84FF;
  --ap-blue-2:       #0060DF;
  --ap-blue-3:       #004FC2;
  --ap-blue-glow:    rgba(10, 132, 255, 0.22);
  --ap-blue-dim:     rgba(10, 132, 255, 0.12);
  --ap-indigo:       #5856D6;
  --ap-purple:       #7B61FF;
  --ap-amber:        #FF9500;
  --ap-red:          #FF3B30;

  /* ── Text ── */
  --ap-text:         rgba(255, 255, 255, 0.92);
  --ap-text-2:       rgba(255, 255, 255, 0.52);
  --ap-text-3:       rgba(255, 255, 255, 0.30);
  --ap-text-4:       rgba(255, 255, 255, 0.16);

  /* ── Typography ── */
  --ap-font:         -apple-system, BlinkMacSystemFont, 'SF Pro Text',
                     'Inter', 'Helvetica Neue', system-ui, sans-serif;
  --ap-font-display: -apple-system, BlinkMacSystemFont, 'SF Pro Display',
                     'Inter', 'Helvetica Neue', system-ui, sans-serif;
  --ap-font-mono:    'SF Mono', 'Fira Code', 'JetBrains Mono',
                     'Roboto Mono', monospace;

  /* ── Geometry ── */
  --ap-r-xs:   8px;
  --ap-r-sm:   12px;
  --ap-r:      18px;
  --ap-r-lg:   22px;
  --ap-r-xl:   28px;
  --ap-r-pill: 999px;

  /* ── Shadow ── */
  --ap-shadow-sm:  0 2px 12px rgba(0, 0, 0, 0.35);
  --ap-shadow:     0 8px 32px rgba(0, 0, 0, 0.50);
  --ap-shadow-lg:  0 16px 64px rgba(0, 0, 0, 0.60);
  --ap-shadow-glow: 0 0 40px rgba(10, 132, 255, 0.18);

  /* ── Transitions ── */
  --ap-ease:       cubic-bezier(0.4, 0, 0.2, 1);
  --ap-spring:     cubic-bezier(0.34, 1.56, 0.64, 1);
  --ap-ease-out:   cubic-bezier(0, 0, 0.2, 1);
  --ap-t-fast:     0.15s;
  --ap-t:          0.28s;
  --ap-t-slow:     0.45s;
  --ap-t-voice:    0.52s;

  /* ── Blur ── */
  --ap-blur-sm:    blur(12px);
  --ap-blur:       blur(20px);
  --ap-blur-lg:    blur(40px);
  --ap-blur-xl:    blur(60px);
}


/* ─── §1  Page Base + Background ─────────────────────────────────────────── */

html {
  background: var(--ap-black) !important;
}

body {
  font-family: var(--ap-font) !important;
  font-size: 15px !important;
  font-weight: 400 !important;
  letter-spacing: -0.01em !important;
  line-height: 1.5 !important;
  background: var(--ap-black) !important;
  color: var(--ap-text) !important;
  -webkit-font-smoothing: antialiased !important;
  -moz-osx-font-smoothing: grayscale !important;
}

/* Ambient background gradient — very subtle, almost invisible */
body::before {
  content: '' !important;
  position: fixed !important;
  inset: 0 !important;
  z-index: 0 !important;
  pointer-events: none !important;
  background:
    radial-gradient(ellipse 70% 55% at 15% 10%, rgba(10, 132, 255, 0.035) 0%, transparent 70%),
    radial-gradient(ellipse 60% 60% at 85% 90%, rgba(88, 86, 214, 0.025) 0%, transparent 65%),
    radial-gradient(ellipse 40% 40% at 50% 50%, rgba(0, 0, 0, 0.5) 0%, transparent 100%) !important;
}

/* Ambient canvas (background particles — injected by apple-voice-sheet.js) */
#ap-ambient-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.4;
}


/* ─── §2  Layout Shell ────────────────────────────────────────────────────── */

.chat-layout {
  background: transparent !important;
  padding: 0 !important;
  margin: 0 !important;
  position: relative !important;
  z-index: 1 !important;
}

.chat-main {
  background: var(--ap-surface-1) !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  overflow: hidden !important;
  position: relative !important;
}

/* Desktop: give the chat main a subtle glass appearance with rounded edges */
@media (min-width: 769px) {
  .chat-layout {
    padding: 0 !important;
  }
  .chat-main {
    border-radius: var(--ap-r-lg) !important;
    margin: 10px 0 10px 0 !important;
    border: 1px solid var(--ap-border) !important;
    box-shadow: var(--ap-shadow-lg), 0 0 0 1px rgba(255,255,255,0.04) inset !important;
  }
}


/* ─── §3  Header — Floating Glass Island ─────────────────────────────────── */

/* The #hy-chat-banner (animated wordmark) — hide on all sizes, CMB handles it */
#hy-chat-banner {
  display: none !important;
}

/* Main header wrapper */
.ch-header {
  background: rgba(12, 12, 16, 0.88) !important;
  backdrop-filter: var(--ap-blur) saturate(180%) !important;
  -webkit-backdrop-filter: var(--ap-blur) saturate(180%) !important;
  border-bottom: 1px solid var(--ap-border) !important;
  border-radius: 0 !important;
  box-shadow: 0 1px 0 rgba(255,255,255,0.04),
              0 4px 20px rgba(0,0,0,0.25) !important;
  padding: 0 !important;
  flex-shrink: 0 !important;
  position: relative !important;
  z-index: 60 !important;
  overflow: visible !important;
}

/* ── Clean Mobile Bar (CMB) — the main header bar ── */
.cmb {
  min-height: 52px !important;
  padding: 6px 12px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  background: transparent !important;
  border-bottom: none !important;
  position: relative !important;
}

/* Centered wordmark */
.cmb-wordmark,
.hy-wordmark.cmb-wordmark {
  font-family: var(--ap-font-display) !important;
  font-size: 17px !important;
  font-weight: 600 !important;
  letter-spacing: 0.12em !important;
  background: var(--ap-text) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  color: transparent !important;
  animation: none !important;
  padding-left: 0 !important;
  text-transform: uppercase !important;
  opacity: 0.92 !important;
}

/* CMB left group */
.cmb-left {
  display: flex !important;
  align-items: center !important;
  gap: 2px !important;
  background: rgba(255,255,255,0.05) !important;
  border-radius: var(--ap-r-pill) !important;
  padding: 2px !important;
  border: 1px solid var(--ap-border) !important;
}

/* CMB right group */
.cmb-right {
  display: flex !important;
  align-items: center !important;
  gap: 2px !important;
  background: rgba(255,255,255,0.05) !important;
  border-radius: var(--ap-r-pill) !important;
  padding: 2px !important;
  border: 1px solid var(--ap-border) !important;
}

/* CMB buttons */
.cmb-btn {
  background: transparent !important;
  border: none !important;
  color: var(--ap-text-2) !important;
  width: 38px !important;
  height: 38px !important;
  border-radius: var(--ap-r-pill) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  transition: background var(--ap-t-fast) var(--ap-ease),
              color var(--ap-t-fast) var(--ap-ease),
              transform var(--ap-t-fast) var(--ap-ease) !important;
  -webkit-tap-highlight-color: transparent !important;
  touch-action: manipulation !important;
  cursor: pointer !important;
  min-height: 38px !important;
  min-width: 38px !important;
}

.cmb-btn:hover {
  background: rgba(255,255,255,0.08) !important;
  color: var(--ap-text) !important;
}

.cmb-btn:active {
  background: rgba(255,255,255,0.12) !important;
  transform: scale(0.94) !important;
}

.cmb-btn svg {
  width: 18px !important;
  height: 18px !important;
  stroke: currentColor !important;
}

/* CMB dots menu (dropdown) */
.cmb-dots-menu {
  border-radius: var(--ap-r-lg) !important;
  background: rgba(28, 28, 34, 0.95) !important;
  backdrop-filter: var(--ap-blur-lg) saturate(200%) !important;
  -webkit-backdrop-filter: var(--ap-blur-lg) saturate(200%) !important;
  border: 1px solid var(--ap-border-2) !important;
  box-shadow: var(--ap-shadow-lg) !important;
  padding: 6px !important;
}

.cmb-dots-item {
  border-radius: var(--ap-r-sm) !important;
  color: var(--ap-text) !important;
  font-family: var(--ap-font) !important;
  font-size: 15px !important;
  font-weight: 400 !important;
  padding: 10px 14px !important;
  gap: 12px !important;
  min-height: 44px !important;
  background: transparent !important;
  border: none !important;
  transition: background var(--ap-t-fast) !important;
}

.cmb-dots-item:hover {
  background: rgba(255,255,255,0.08) !important;
}

.cmb-dots-danger {
  color: var(--ap-red) !important;
}


/* ─── §4  Messages Scroll Area ────────────────────────────────────────────── */

.ch-messages {
  background: transparent !important;
  padding: 20px 0 8px !important;
  gap: 4px !important;
  border-radius: 0 !important;
  overflow-x: hidden !important;
}

/* Date dividers / system messages */
.msg-system {
  color: var(--ap-text-3) !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  letter-spacing: 0.02em !important;
  font-family: var(--ap-font) !important;
  padding: 6px 0 !important;
  background: none !important;
  border: none !important;
}

/* Message row spacing */
.msg-row {
  padding: 2px 16px !important;
  gap: 10px !important;
  animation: apMsgEnter 0.38s var(--ap-ease-out) both !important;
}

.msg-row + .msg-row {
  margin-top: 0 !important;
}

/* Same-sender consecutive messages: tighter spacing */
.msg-row-user + .msg-row-user,
.msg-row-assistant + .msg-row-assistant {
  margin-top: -4px !important;
}

/* Avatar */
.msg-avatar {
  width: 30px !important;
  height: 30px !important;
  border: none !important;
  background: rgba(255,255,255,0.06) !important;
  border-radius: 50% !important;
  box-shadow: none !important;
  flex-shrink: 0 !important;
  font-size: 12px !important;
}

.msg-avatar-ai {
  background: linear-gradient(135deg,
    rgba(10, 132, 255, 0.3) 0%,
    rgba(88, 86, 214, 0.2) 100%
  ) !important;
  border: 1px solid rgba(10, 132, 255, 0.2) !important;
}

.msg-avatar-user {
  background: linear-gradient(135deg,
    rgba(10, 132, 255, 0.25),
    rgba(10, 96, 223, 0.15)
  ) !important;
  color: var(--ap-blue) !important;
}


/* ─── §5  Chat Bubbles ────────────────────────────────────────────────────── */

/* Base bubble */
.msg {
  padding: 11px 16px !important;
  border: none !important;
  max-width: min(72%, 540px) !important;
  width: auto !important;
  transition: box-shadow var(--ap-t-fast) var(--ap-ease) !important;
}

/* ── User bubble — Apple Intelligence blue ── */
.msg-user {
  background: linear-gradient(155deg,
    #0A84FF 0%,
    #0070F5 45%,
    #005AE0 100%
  ) !important;
  border-radius: 22px 22px 6px 22px !important;
  box-shadow:
    0 3px 16px rgba(10, 132, 255, 0.30),
    0 1px 4px rgba(10, 132, 255, 0.20) !important;
  border: none !important;
  color: #ffffff !important;
}

.msg-user:hover {
  box-shadow:
    0 4px 24px rgba(10, 132, 255, 0.40),
    0 2px 8px rgba(10, 132, 255, 0.28) !important;
}

.msg-user .msg-text {
  color: rgba(255, 255, 255, 0.96) !important;
  font-family: var(--ap-font) !important;
  font-size: 15px !important;
  line-height: 1.47 !important;
  font-weight: 400 !important;
  letter-spacing: -0.005em !important;
}

.msg-user .msg-role { display: none !important; }

/* ── Assistant bubble — dark glass ── */
.msg-assistant {
  background: rgba(26, 26, 32, 0.88) !important;
  backdrop-filter: var(--ap-blur-sm) !important;
  -webkit-backdrop-filter: var(--ap-blur-sm) !important;
  border: 1px solid rgba(255, 255, 255, 0.07) !important;
  border-radius: 6px 22px 22px 22px !important;
  box-shadow:
    0 2px 16px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
  color: var(--ap-text) !important;
}

.msg-assistant:hover {
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.40),
    inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
}

.msg-assistant .msg-text {
  color: var(--ap-text) !important;
  font-family: var(--ap-font) !important;
  font-size: 15px !important;
  line-height: 1.52 !important;
  font-weight: 400 !important;
  letter-spacing: -0.005em !important;
}

.msg-assistant .msg-role {
  color: var(--ap-text-3) !important;
  font-size: 10px !important;
  font-weight: 500 !important;
  letter-spacing: 0.06em !important;
  text-transform: uppercase !important;
  font-family: var(--ap-font) !important;
  margin-bottom: 4px !important;
  opacity: 1 !important;
}

/* Message timestamp */
.msg-ts {
  font-size: 10px !important;
  color: var(--ap-text-4) !important;
  font-family: var(--ap-font) !important;
  font-weight: 400 !important;
  letter-spacing: 0.01em !important;
  margin-top: 3px !important;
}

/* Message action buttons — only show on hover */
.msg-actions {
  gap: 2px !important;
  opacity: 0 !important;
  transition: opacity var(--ap-t-fast) !important;
}

.msg-row:hover .msg-actions,
.msg:focus-within .msg-actions {
  opacity: 1 !important;
}

.msg-act,
.msg-tts {
  width: 30px !important;
  height: 30px !important;
  min-width: 30px !important;
  min-height: 30px !important;
  border-radius: 50% !important;
  border: none !important;
  background: rgba(255,255,255,0.06) !important;
  color: var(--ap-text-3) !important;
  font-size: 13px !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  transition:
    background var(--ap-t-fast),
    color var(--ap-t-fast),
    transform var(--ap-t-fast) var(--ap-spring) !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.msg-act:hover,
.msg-tts:hover {
  background: rgba(255,255,255,0.12) !important;
  color: var(--ap-text) !important;
  transform: scale(1.08) !important;
}

.msg-act:active,
.msg-tts:active {
  transform: scale(0.94) !important;
  background: rgba(255,255,255,0.18) !important;
}

/* "Read more" expand button */
.msg-expand-btn {
  background: none !important;
  border: none !important;
  border-top: 1px solid rgba(255,255,255,0.06) !important;
  color: var(--ap-blue) !important;
  font-family: var(--ap-font) !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  min-height: 44px !important;
  padding: 12px 0 !important;
  width: 100% !important;
  cursor: pointer !important;
  transition: opacity var(--ap-t-fast) !important;
}

.msg-expand-btn:hover {
  opacity: 0.75 !important;
  background: none !important;
}

.msg-expand-btn .expand-arrow {
  color: var(--ap-blue) !important;
}


/* ─── §6  Rich Text + Code Blocks ─────────────────────────────────────────── */

.msg-text {
  overflow-wrap: break-word !important;
  word-break: break-word !important;
  overflow-x: hidden !important;
}

.msg-text h1, .msg-text h2, .msg-text h3, .msg-text h4 {
  font-family: var(--ap-font-display) !important;
  font-weight: 600 !important;
  color: var(--ap-text) !important;
  border: none !important;
  padding-bottom: 0 !important;
  margin: 8px 0 4px !important;
  letter-spacing: -0.01em !important;
}

.msg-text h1 { font-size: 20px !important; }
.msg-text h2 { font-size: 17px !important; }
.msg-text h3 { font-size: 15px !important; }
.msg-text h4 { font-size: 14px !important; }

.msg-text strong {
  color: var(--ap-text) !important;
  font-weight: 600 !important;
}

.msg-text em {
  color: var(--ap-text-2) !important;
  font-style: italic !important;
}

.msg-text a {
  color: var(--ap-blue) !important;
  border-bottom: 1px solid rgba(10, 132, 255, 0.3) !important;
  text-decoration: none !important;
  transition: border-color var(--ap-t-fast) !important;
}

.msg-text a:hover {
  border-bottom-color: var(--ap-blue) !important;
}

/* Inline code */
.msg-text code:not(pre code) {
  background: rgba(255,255,255,0.07) !important;
  border: 1px solid rgba(255,255,255,0.10) !important;
  border-radius: 5px !important;
  padding: 1px 6px !important;
  font-family: var(--ap-font-mono) !important;
  font-size: 13px !important;
  color: rgba(255,255,255,0.82) !important;
}

/* Code blocks */
.code-block {
  border-radius: var(--ap-r) !important;
  border: 1px solid rgba(255,255,255,0.07) !important;
  background: rgba(14, 14, 18, 0.9) !important;
  box-shadow: var(--ap-shadow-sm) !important;
  overflow: hidden !important;
  margin: 6px 0 !important;
}

.code-header {
  background: rgba(255,255,255,0.04) !important;
  border-bottom: 1px solid rgba(255,255,255,0.06) !important;
  padding: 7px 14px !important;
}

.code-lang {
  font-family: var(--ap-font-mono) !important;
  font-size: 10px !important;
  color: var(--ap-text-3) !important;
  text-transform: uppercase !important;
  font-weight: 500 !important;
  letter-spacing: 0.08em !important;
}

.code-block pre {
  background: transparent !important;
  font-family: var(--ap-font-mono) !important;
  font-size: 13px !important;
  line-height: 1.6 !important;
  padding: 14px 16px !important;
  color: rgba(255,255,255,0.85) !important;
  overflow-x: auto !important;
}

.code-btn {
  background: rgba(255,255,255,0.06) !important;
  border: none !important;
  border-radius: 6px !important;
  color: var(--ap-text-3) !important;
  font-size: 11px !important;
  font-family: var(--ap-font) !important;
  font-weight: 500 !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  padding: 3px 8px !important;
  transition: background var(--ap-t-fast), color var(--ap-t-fast) !important;
  cursor: pointer !important;
}

.code-btn:hover {
  background: rgba(255,255,255,0.12) !important;
  color: var(--ap-text) !important;
}

/* Callout blocks */
.msg-callout {
  background: rgba(255,255,255,0.04) !important;
  border: 1px solid rgba(255,255,255,0.08) !important;
  border-radius: var(--ap-r-sm) !important;
  padding: 10px 14px !important;
}

/* Quote / blockquote */
.msg-text blockquote {
  border-left: 2px solid rgba(255,255,255,0.2) !important;
  background: rgba(255,255,255,0.03) !important;
  border-radius: 0 var(--ap-r-xs) var(--ap-r-xs) 0 !important;
  padding: 8px 14px !important;
  color: var(--ap-text-2) !important;
}

/* PMID badges */
.pmid-badge,
.chat-kw-pmid {
  background: rgba(10, 132, 255, 0.1) !important;
  border: 1px solid rgba(10, 132, 255, 0.2) !important;
  color: var(--ap-blue) !important;
  border-radius: var(--ap-r-pill) !important;
  font-family: var(--ap-font) !important;
  font-size: 11px !important;
  font-weight: 500 !important;
  padding: 2px 8px !important;
}


/* ─── §7  Input Composer — Floating Glass Pill ────────────────────────────── */

/* Container */
.ch-composer {
  background: transparent !important;
  border-top: none !important;
  border-radius: 0 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  padding: 8px 12px 12px !important;
  gap: 8px !important;
  align-items: flex-end !important;
  display: flex !important;
  flex-shrink: 0 !important;
}

/* The input pill wrapper */
.ch-input-wrap,
.ch-composer .ch-input-wrap {
  flex: 1 !important;
  min-width: 0 !important;
  display: flex !important;
  align-items: flex-end !important;
  gap: 0 !important;
  background: rgba(28, 28, 34, 0.88) !important;
  backdrop-filter: var(--ap-blur) !important;
  -webkit-backdrop-filter: var(--ap-blur) !important;
  border: 1px solid rgba(255,255,255,0.10) !important;
  border-radius: var(--ap-r-xl) !important;
  padding: 4px 6px 4px 4px !important;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.04) inset,
    0 8px 32px rgba(0,0,0,0.35) !important;
  transition:
    border-color var(--ap-t) var(--ap-ease),
    box-shadow var(--ap-t) var(--ap-ease) !important;
}

.ch-input-wrap:focus-within,
.ch-composer .ch-input-wrap:focus-within {
  border-color: rgba(10, 132, 255, 0.40) !important;
  box-shadow:
    0 0 0 3px rgba(10, 132, 255, 0.10),
    0 0 0 1px rgba(255,255,255,0.04) inset,
    0 8px 32px rgba(0,0,0,0.35) !important;
}

/* Textarea */
.ch-input,
.ch-composer .ch-input {
  font-family: var(--ap-font) !important;
  font-size: 15px !important;
  font-weight: 400 !important;
  letter-spacing: -0.005em !important;
  color: var(--ap-text) !important;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 9px 8px 9px 10px !important;
  min-height: 40px !important;
  max-height: 160px !important;
  resize: none !important;
  outline: none !important;
  line-height: 1.45 !important;
}

.ch-input::placeholder {
  color: var(--ap-text-3) !important;
  font-weight: 400 !important;
}

/* Attach icon (paperclip) */
.ci-attach {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  min-height: 36px !important;
  border: none !important;
  background: transparent !important;
  color: var(--ap-text-3) !important;
  border-radius: 50% !important;
  cursor: pointer !important;
  padding: 0 !important;
  flex-shrink: 0 !important;
  transition:
    background var(--ap-t-fast),
    color var(--ap-t-fast),
    transform var(--ap-t-fast) var(--ap-spring) !important;
}

.ci-attach:hover {
  background: rgba(255,255,255,0.08) !important;
  color: var(--ap-text-2) !important;
  transform: scale(1.06) !important;
}

.ci-attach:active {
  transform: scale(0.94) !important;
}

/* Mic dictation icon (inside input) */
.ci-mic {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  min-height: 36px !important;
  border: none !important;
  background: transparent !important;
  color: var(--ap-text-3) !important;
  border-radius: 50% !important;
  cursor: pointer !important;
  padding: 0 !important;
  flex-shrink: 0 !important;
  transition:
    background var(--ap-t-fast),
    color var(--ap-t-fast),
    transform var(--ap-t-fast) var(--ap-spring) !important;
}

.ci-mic:hover {
  background: rgba(255,255,255,0.08) !important;
  color: var(--ap-text-2) !important;
  transform: scale(1.06) !important;
}

.ci-mic.dictating {
  background: rgba(255, 59, 48, 0.15) !important;
  color: var(--ap-red) !important;
}

/* Send button */
.ch-send,
#send-btn {
  width: 42px !important;
  height: 42px !important;
  min-width: 42px !important;
  min-height: 42px !important;
  border-radius: 50% !important;
  border: none !important;
  background: linear-gradient(155deg, #0A84FF 0%, #005AE0 100%) !important;
  color: #ffffff !important;
  box-shadow:
    0 3px 12px rgba(10, 132, 255, 0.40),
    0 1px 3px rgba(10, 132, 255, 0.25) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  flex-shrink: 0 !important;
  transition:
    transform var(--ap-t-fast) var(--ap-spring),
    box-shadow var(--ap-t-fast),
    background var(--ap-t-fast) !important;
  padding: 0 !important;
  animation: none !important;
}

.ch-send:hover {
  transform: scale(1.06) !important;
  box-shadow:
    0 4px 20px rgba(10, 132, 255, 0.55),
    0 2px 6px rgba(10, 132, 255, 0.35) !important;
}

.ch-send:active {
  transform: scale(0.94) !important;
  box-shadow:
    0 2px 8px rgba(10, 132, 255, 0.30) !important;
}

.ch-send:disabled {
  opacity: 0.3 !important;
  background: rgba(255,255,255,0.1) !important;
  box-shadow: none !important;
  transform: none !important;
}

.ch-send svg {
  width: 18px !important;
  height: 18px !important;
  fill: #ffffff !important;
}

/* Upload/import button — hide (use attach button instead) */
#import-btn,
.upload-btn {
  display: none !important;
}

/* Translator FAB — hide (voice covers it) */
.translate-fab {
  display: none !important;
}

/* Boomer + menu (+ button on clean layout) */
.boomer-plus-btn {
  width: 42px !important;
  height: 42px !important;
  min-width: 42px !important;
  min-height: 42px !important;
  border-radius: 50% !important;
  border: 1px solid rgba(255,255,255,0.10) !important;
  background: rgba(255,255,255,0.06) !important;
  color: var(--ap-text-2) !important;
  font-size: 24px !important;
  font-family: var(--ap-font) !important;
  font-weight: 300 !important;
  line-height: 1 !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: background var(--ap-t-fast), transform var(--ap-t-fast) var(--ap-spring) !important;
}

.boomer-plus-btn:hover {
  background: rgba(255,255,255,0.10) !important;
  transform: scale(1.06) !important;
}

.boomer-plus-btn:active {
  transform: scale(0.94) !important;
}

/* Boomer menu dropdown */
#boomer-menu {
  background: rgba(22, 22, 28, 0.96) !important;
  backdrop-filter: var(--ap-blur-lg) saturate(200%) !important;
  -webkit-backdrop-filter: var(--ap-blur-lg) saturate(200%) !important;
  border: 1px solid var(--ap-border-2) !important;
  border-radius: var(--ap-r-lg) !important;
  box-shadow: var(--ap-shadow-lg) !important;
  padding: 8px !important;
}

.boomer-menu-item {
  border-radius: var(--ap-r-sm) !important;
  color: var(--ap-text) !important;
  font-family: var(--ap-font) !important;
  font-size: 15px !important;
  font-weight: 400 !important;
  padding: 10px 14px !important;
  min-height: 44px !important;
  background: transparent !important;
  border: none !important;
  gap: 12px !important;
  cursor: pointer !important;
  transition: background var(--ap-t-fast) !important;
}

.boomer-menu-item:hover {
  background: rgba(255,255,255,0.07) !important;
}

/* Tag chips (image/doc/search intent chips above input) */
.clean-tag-chips {
  gap: 6px !important;
  padding: 0 4px 4px !important;
}

.tag-chip {
  background: rgba(10, 132, 255, 0.12) !important;
  border: 1px solid rgba(10, 132, 255, 0.22) !important;
  border-radius: var(--ap-r-pill) !important;
  color: var(--ap-blue) !important;
  font-size: 12px !important;
  font-family: var(--ap-font) !important;
  font-weight: 500 !important;
}


/* ─── §8  Voice FAB + Mode Tray ───────────────────────────────────────────── */

/* Voice waveform FAB button */
.voice-fab,
.ch-composer .voice-fab {
  width: 42px !important;
  height: 42px !important;
  min-width: 42px !important;
  min-height: 42px !important;
  border-radius: 50% !important;
  border: 1px solid rgba(10, 132, 255, 0.25) !important;
  background: rgba(10, 132, 255, 0.12) !important;
  color: var(--ap-blue) !important;
  box-shadow: 0 0 0 0 rgba(10, 132, 255, 0) !important;
  animation: none !important;
  opacity: 1 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  flex-shrink: 0 !important;
  transition:
    transform var(--ap-t-fast) var(--ap-spring),
    background var(--ap-t-fast),
    box-shadow var(--ap-t-fast) !important;
}

.voice-fab:hover,
.ch-composer .voice-fab:hover {
  background: rgba(10, 132, 255, 0.20) !important;
  border-color: rgba(10, 132, 255, 0.45) !important;
  transform: scale(1.06) !important;
  box-shadow: 0 0 20px rgba(10, 132, 255, 0.25) !important;
}

.voice-fab:active,
.ch-composer .voice-fab:active {
  transform: scale(0.94) !important;
}

.voice-fab svg,
.ch-composer .voice-fab svg {
  width: 20px !important;
  height: 20px !important;
}

/* Voice mode tray popup */
.voice-fab-wrap {
  position: relative !important;
  flex-shrink: 0 !important;
}

#voice-mode-tray {
  background: rgba(22, 22, 28, 0.96) !important;
  backdrop-filter: var(--ap-blur-lg) !important;
  -webkit-backdrop-filter: var(--ap-blur-lg) !important;
  border: 1px solid var(--ap-border-2) !important;
  border-radius: var(--ap-r-lg) !important;
  box-shadow: var(--ap-shadow-lg) !important;
  padding: 8px !important;
  right: 0 !important;
  left: auto !important;
  min-width: 100px !important;
}

.vmt-btn {
  background: rgba(255,255,255,0.04) !important;
  border: 1px solid rgba(255,255,255,0.08) !important;
  border-radius: var(--ap-r-sm) !important;
  color: var(--ap-text-2) !important;
  font-family: var(--ap-font) !important;
  font-size: 11px !important;
  font-weight: 500 !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  padding: 10px 12px !important;
  min-width: 80px !important;
  cursor: pointer !important;
  transition: background var(--ap-t-fast), color var(--ap-t-fast) !important;
}

.vmt-btn:hover {
  background: rgba(255,255,255,0.10) !important;
  color: var(--ap-text) !important;
}

.vmt-btn.active {
  background: var(--ap-blue-dim) !important;
  border-color: rgba(10, 132, 255, 0.28) !important;
  color: var(--ap-blue) !important;
}

.vmt-btn .vmt-em {
  font-size: 18px !important;
  margin-bottom: 2px !important;
}


/* ─── §9  Thinking / Activity Indicators ─────────────────────────────────── */

/* Thinking pill */
.thinking-pill {
  background: rgba(22, 22, 28, 0.88) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  border: 1px solid rgba(255,255,255,0.08) !important;
  border-radius: var(--ap-r-pill) !important;
  box-shadow: var(--ap-shadow-sm) !important;
  padding: 7px 14px !important;
  font-family: var(--ap-font) !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  color: var(--ap-text-2) !important;
  letter-spacing: 0 !important;
}

#tp-label {
  font-family: var(--ap-font) !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  color: var(--ap-text-2) !important;
}

.tp-dot {
  background: var(--ap-blue) !important;
  opacity: 0.5 !important;
}

/* Thought stream wrap */
#thought-stream-wrap {
  background: rgba(18, 18, 24, 0.72) !important;
  border-top: 1px solid rgba(255,255,255,0.05) !important;
  padding: 6px 16px 5px !important;
}

#thought-stream-wrap::before {
  font-family: var(--ap-font) !important;
  font-size: 9px !important;
  font-weight: 600 !important;
  letter-spacing: 0.1em !important;
  color: var(--ap-text-4) !important;
  content: 'THINKING' !important;
}

#thought-stream-text {
  font-family: var(--ap-font-mono) !important;
  font-size: 11px !important;
  color: rgba(255,255,255,0.38) !important;
  max-height: 60px !important;
  line-height: 1.5 !important;
}

/* Activity box — minimize */
#activity-box {
  display: none !important;
}

/* Sticky actions (choice buttons) */
.sticky-btn {
  background: rgba(255,255,255,0.06) !important;
  border: 1px solid rgba(255,255,255,0.10) !important;
  border-radius: var(--ap-r-pill) !important;
  color: var(--ap-text-2) !important;
  font-family: var(--ap-font) !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  text-shadow: none !important;
  padding: 10px 18px !important;
  min-height: 44px !important;
  cursor: pointer !important;
  transition:
    background var(--ap-t-fast),
    border-color var(--ap-t-fast),
    transform var(--ap-t-fast) var(--ap-spring) !important;
}

.sticky-btn:hover {
  background: rgba(10, 132, 255, 0.12) !important;
  border-color: rgba(10, 132, 255, 0.28) !important;
  color: var(--ap-blue) !important;
  transform: translateY(-1px) !important;
}

.sticky-btn:active {
  transform: scale(0.97) !important;
}

.sticky-btn::after {
  display: none !important;
}


/* ─── §10  Apple Voice Bottom Sheet ──────────────────────────────────────── */

/* #hv-dock — keep for engine compat but make it mostly invisible */
#hv-dock {
  opacity: 0 !important;
  pointer-events: none !important;
  z-index: 1 !important;
  display: none !important;
}

/* When voice is active via hy-voice-active class, dock can be show for engine */
body.hy-voice-active #hv-dock {
  display: flex !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Dim the composer when voice is active */
body.hy-voice-active .ch-composer {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translateY(8px) !important;
  transition: opacity var(--ap-t), transform var(--ap-t) !important;
}

/* Restore transition for normal state */
.ch-composer {
  transition: opacity var(--ap-t), transform var(--ap-t) !important;
}

/* Dim chat messages slightly when voice is active */
body.hy-voice-active .ch-messages {
  filter: brightness(0.6) !important;
  transition: filter var(--ap-t-voice) var(--ap-ease) !important;
}

.ch-messages {
  transition: filter var(--ap-t-voice) var(--ap-ease) !important;
}

/* ── The Apple Voice Sheet itself ── */
#apple-voice-sheet {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9800;

  /* Glass frosted background */
  background: rgba(10, 10, 14, 0.97);
  backdrop-filter: var(--ap-blur-xl) saturate(180%);
  -webkit-backdrop-filter: var(--ap-blur-xl) saturate(180%);
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 28px 28px 0 0;

  /* Layout */
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 max(32px, env(safe-area-inset-bottom, 32px)) 0;

  /* Height */
  height: 65vh;
  min-height: 380px;
  max-height: 700px;

  /* Shadow */
  box-shadow:
    0 -8px 80px rgba(0, 0, 0, 0.65),
    0 -1px 0 rgba(255, 255, 255, 0.05) inset;
}

#apple-voice-sheet.avs-visible {
  display: flex;
  animation: avSheetIn var(--ap-t-voice) var(--ap-ease-out) both;
}

#apple-voice-sheet.avs-hiding {
  animation: avSheetOut var(--ap-t) var(--ap-ease) forwards;
}

/* Voice sheet handle bar */
.avs-handle {
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  margin: 12px auto 0;
  flex-shrink: 0;
}

/* Voice sheet header row */
.avs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 20px 0;
  flex-shrink: 0;
}

/* Close button (X) — 44×44 for easy tapping */
.avs-close {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.10);
  color: var(--ap-text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  font-size: 16px;
  line-height: 1;
  transition: background var(--ap-t-fast), transform var(--ap-t-fast) var(--ap-spring);
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

.avs-close:hover { background: rgba(255,255,255,0.16); }
.avs-close:active { transform: scale(0.90); }

.avs-close svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2.5;
}

/* Mode label (center) */
.avs-mode-label {
  font-family: var(--ap-font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--ap-text-2);
  letter-spacing: 0.01em;
  text-align: center;
  flex: 1;
}

/* Spacer for symmetry */
.avs-header-spacer {
  width: 32px;
  flex-shrink: 0;
}


/* ─── §11  Voice Orb ──────────────────────────────────────────────────────── */

/* Orb container */
.avs-orb-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  position: relative;
  width: 100%;
}

/* Main orb */
.avs-orb {
  position: relative;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  flex-shrink: 0;

  /* Base sphere gradient */
  background: radial-gradient(circle at 38% 32%,
    rgba(120, 160, 255, 0.95) 0%,
    rgba(70, 110, 240, 0.90) 25%,
    rgba(35, 70, 210, 0.85) 55%,
    rgba(15, 40, 175, 0.80) 80%,
    rgba(5, 20, 140, 0.75) 100%
  );

  /* Specular highlight */
  box-shadow:
    0 0 40px rgba(60, 100, 255, 0.45),
    0 0 80px rgba(60, 100, 255, 0.22),
    0 0 120px rgba(60, 100, 255, 0.10),
    inset 0 -8px 30px rgba(0, 0, 30, 0.30),
    inset 0 8px 24px rgba(140, 180, 255, 0.18);

  animation: avOrbBreathe 3.8s ease-in-out infinite;
  transition:
    box-shadow 0.6s var(--ap-ease),
    background 0.6s var(--ap-ease);
}

/* Inner shimmer */
.avs-orb::before {
  content: '';
  position: absolute;
  top: 12%;
  left: 20%;
  width: 32%;
  height: 22%;
  background: radial-gradient(ellipse, rgba(255,255,255,0.50) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

/* Bottom shadow */
.avs-orb::after {
  content: '';
  position: absolute;
  bottom: -30px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 16px;
  background: radial-gradient(ellipse, rgba(60,100,255,0.35) 0%, transparent 70%);
  pointer-events: none;
  border-radius: 50%;
  filter: blur(4px);
}

/* Pulsing rings (expand outward) */
.avs-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  border-radius: 50%;
  border: 1.5px solid rgba(60, 100, 255, 0.28);
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: avRingPulse 2.8s ease-out infinite;
}

.avs-ring:nth-child(2) { animation-delay: 0.9s; }
.avs-ring:nth-child(3) { animation-delay: 1.8s; }

/* Orb states */
#apple-voice-sheet[data-state="listening"] .avs-orb {
  background: radial-gradient(circle at 38% 32%,
    rgba(100, 180, 255, 0.98) 0%,
    rgba(10, 132, 255, 0.92) 35%,
    rgba(0, 80, 200, 0.85) 70%,
    rgba(0, 50, 160, 0.80) 100%
  ) !important;
  box-shadow:
    0 0 50px rgba(10, 132, 255, 0.60),
    0 0 100px rgba(10, 132, 255, 0.30),
    0 0 150px rgba(10, 132, 255, 0.12),
    inset 0 -8px 30px rgba(0, 0, 30, 0.25),
    inset 0 8px 24px rgba(180, 220, 255, 0.22) !important;
  animation: avOrbListen 1.8s ease-in-out infinite !important;
}

#apple-voice-sheet[data-state="thinking"] .avs-orb {
  background: radial-gradient(circle at 38% 32%,
    rgba(255, 200, 100, 0.95) 0%,
    rgba(255, 149, 0, 0.88) 40%,
    rgba(220, 100, 0, 0.80) 75%,
    rgba(180, 60, 0, 0.72) 100%
  ) !important;
  box-shadow:
    0 0 40px rgba(255, 149, 0, 0.50),
    0 0 80px rgba(255, 149, 0, 0.22),
    inset 0 -8px 30px rgba(40, 0, 0, 0.25),
    inset 0 8px 24px rgba(255, 230, 150, 0.18) !important;
  animation: avOrbThink 2.5s ease-in-out infinite !important;
}

#apple-voice-sheet[data-state="speaking"] .avs-orb {
  background: radial-gradient(circle at 38% 32%,
    rgba(180, 160, 255, 0.96) 0%,
    rgba(120, 100, 240, 0.90) 35%,
    rgba(80, 60, 200, 0.82) 70%,
    rgba(50, 30, 160, 0.76) 100%
  ) !important;
  box-shadow:
    0 0 50px rgba(120, 100, 255, 0.55),
    0 0 100px rgba(120, 100, 255, 0.25),
    inset 0 -8px 30px rgba(10, 0, 30, 0.28),
    inset 0 8px 24px rgba(200, 190, 255, 0.20) !important;
  animation: avOrbSpeak 1.2s ease-in-out infinite !important;
}

#apple-voice-sheet[data-state="error"] .avs-orb {
  background: radial-gradient(circle at 38% 32%,
    rgba(255, 120, 100, 0.95) 0%,
    rgba(255, 59, 48, 0.88) 40%,
    rgba(200, 20, 10, 0.80) 100%
  ) !important;
  box-shadow: 0 0 40px rgba(255, 59, 48, 0.45) !important;
  animation: avOrbBreathe 3s ease-in-out infinite !important;
}


/* ─── §12  Waveform Canvas ─────────────────────────────────────────────────── */

.avs-waveform-wrap {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0 40px;
  height: 40px;
}

#apple-waveform-canvas {
  width: 100%;
  max-width: 280px;
  height: 36px;
  display: block;
  opacity: 0.72;
}

/* Status labels */
.avs-status {
  font-family: var(--ap-font-display);
  font-size: 17px;
  font-weight: 500;
  color: var(--ap-text);
  letter-spacing: -0.01em;
  text-align: center;
  flex-shrink: 0;
  margin: 0;
}

.avs-sub-status {
  font-family: var(--ap-font);
  font-size: 13px;
  font-weight: 400;
  color: var(--ap-text-3);
  text-align: center;
  flex-shrink: 0;
  margin: 2px 0 0;
}


/* ─── §13  Voice Controls ─────────────────────────────────────────────────── */

.avs-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 0 40px;
  flex-shrink: 0;
  width: 100%;
}

/* Base control button */
.avs-ctrl {
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform var(--ap-t-fast) var(--ap-spring),
    background var(--ap-t-fast),
    opacity var(--ap-t-fast);
  padding: 0;
  flex-shrink: 0;
}

.avs-ctrl:active {
  transform: scale(0.88) !important;
}

/* Secondary controls (mute, shazam) — small glass circles */
.avs-ctrl-secondary {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: var(--ap-text-2);
  font-size: 20px;
}

.avs-ctrl-secondary:hover {
  background: rgba(255,255,255,0.14);
  color: var(--ap-text);
  transform: scale(1.06);
}

.avs-ctrl-secondary.avs-muted {
  background: rgba(255, 59, 48, 0.15);
  border-color: rgba(255, 59, 48, 0.25);
  color: var(--ap-red);
}

/* Main stop button — large circle */
.avs-ctrl-stop {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  color: var(--ap-text);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.avs-ctrl-stop:hover {
  background: rgba(255,255,255,0.18);
  box-shadow: 0 6px 30px rgba(0,0,0,0.4);
  transform: scale(1.05);
}

/* Stop icon inside the button */
.avs-stop-icon {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.92);
  pointer-events: none;
}


/* ─── §14  Animations + Keyframes ─────────────────────────────────────────── */

/* Message entrance */
@keyframes apMsgEnter {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Voice sheet slide up */
@keyframes avSheetIn {
  from {
    transform: translateY(100%);
    opacity: 0.6;
  }
  to {
    transform: translateY(0%);
    opacity: 1;
  }
}

@keyframes avSheetOut {
  from {
    transform: translateY(0%);
    opacity: 1;
  }
  to {
    transform: translateY(100%);
    opacity: 0;
  }
}

/* Orb breathing */
@keyframes avOrbBreathe {
  0%, 100% {
    transform: scale(1);
    filter: brightness(1);
  }
  50% {
    transform: scale(1.045);
    filter: brightness(1.08);
  }
}

/* Orb listening — faster pulse */
@keyframes avOrbListen {
  0%, 100% {
    transform: scale(1);
    filter: brightness(1);
  }
  40% {
    transform: scale(1.07);
    filter: brightness(1.15);
  }
}

/* Orb thinking — slow oscillation */
@keyframes avOrbThink {
  0%, 100% {
    transform: scale(0.97) rotate(0deg);
    filter: brightness(0.95);
  }
  33% {
    transform: scale(1.03) rotate(3deg);
    filter: brightness(1.05);
  }
  66% {
    transform: scale(1.01) rotate(-2deg);
    filter: brightness(1.02);
  }
}

/* Orb speaking — quick energetic pulse */
@keyframes avOrbSpeak {
  0%, 100% {
    transform: scale(1);
    filter: brightness(1);
  }
  25% {
    transform: scale(1.06);
    filter: brightness(1.12);
  }
  75% {
    transform: scale(0.97);
    filter: brightness(0.94);
  }
}

/* Ring pulse / expand */
@keyframes avRingPulse {
  0% {
    width: 140px;
    height: 140px;
    opacity: 0.5;
  }
  100% {
    width: 280px;
    height: 280px;
    opacity: 0;
  }
}

/* Ambient particle float */
@keyframes apParticleFloat {
  0%, 100% {
    transform: translateY(0) translateX(0);
    opacity: 0;
  }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% {
    transform: translateY(-120px) translateX(20px);
    opacity: 0;
  }
}

/* Shimmer override — remove cyberpunk shimmer on HYPATIA wordmark */
.hy-wordmark { animation: none !important; }

/* Reduce all cyberpunk pulse/glow animations */
.ch-status-dot { animation: none !important; }

/* General hover scale for primary action elements */
@keyframes apButtonPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}


/* ─── §15  Scrollbar ──────────────────────────────────────────────────────── */

.ch-messages::-webkit-scrollbar {
  width: 4px !important;
}

.ch-messages::-webkit-scrollbar-track {
  background: transparent !important;
}

.ch-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.10) !important;
  border-radius: 4px !important;
  border: none !important;
}

.ch-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.20) !important;
  box-shadow: none !important;
}

::-webkit-scrollbar {
  width: 4px !important;
}

::-webkit-scrollbar-track {
  background: transparent !important;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08) !important;
  border-radius: 4px !important;
}


/* ─── §16  Mobile (≤768px) Overrides ──────────────────────────────────────── */

@media screen and (max-width: 768px) {

  /* Slightly larger message text on phones */
  .msg-text { font-size: 16px !important; line-height: 1.50 !important; }
  .msg-user .msg-text { font-size: 16px !important; }
  .msg-assistant .msg-text { font-size: 16px !important; }

  /* Bubbles take more width on narrow screens */
  .msg {
    max-width: min(88%, 360px) !important;
    padding: 11px 15px !important;
  }

  /* Messages area padding */
  .ch-messages { padding: 16px 4px 8px !important; }

  /* Row padding — less on mobile */
  .msg-row { padding: 2px 10px !important; }

  /* Voice sheet — taller on phones */
  #apple-voice-sheet {
    height: 68vh !important;
    min-height: 360px !important;
  }

  /* Voice orb — slightly smaller on narrow phones */
  .avs-orb { width: 120px !important; height: 120px !important; }

  /* Status text */
  .avs-status { font-size: 16px !important; }

  /* CMB: balanced sizing */
  .cmb-btn { width: 40px !important; height: 40px !important; min-height: 40px !important; min-width: 40px !important; }

  /* Always show message actions on mobile (no hover) */
  .msg-row .msg-actions, .msg .msg-actions { opacity: 1 !important; }
}


/* ─── §17  Misc / Utility ─────────────────────────────────────────────────── */

/* Search bar */
#search-bar {
  background: rgba(15,15,18,0.92) !important;
  border-bottom: 1px solid var(--ap-border) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  padding: 8px 16px !important;
}

#search-input {
  background: rgba(255,255,255,0.06) !important;
  border: 1px solid rgba(255,255,255,0.10) !important;
  border-radius: var(--ap-r-pill) !important;
  color: var(--ap-text) !important;
  font-family: var(--ap-font) !important;
  font-size: 14px !important;
  padding: 7px 14px !important;
  box-shadow: none !important;
}

#search-input:focus {
  border-color: rgba(10, 132, 255, 0.40) !important;
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.10) !important;
}

/* Context bar pills */
.ch-ctx-bar { display: none !important; }

/* Link cards */
.link-card {
  background: rgba(255,255,255,0.04) !important;
  border: 1px solid rgba(255,255,255,0.08) !important;
  border-radius: var(--ap-r-sm) !important;
  transition: background var(--ap-t-fast) !important;
}

.link-card:hover {
  background: rgba(255,255,255,0.08) !important;
  border-color: rgba(255,255,255,0.14) !important;
}

/* Image thumbnails */
.msg-img-thumb {
  border: 1px solid rgba(255,255,255,0.10) !important;
  border-radius: var(--ap-r-sm) !important;
  box-shadow: var(--ap-shadow-sm) !important;
}

/* Toast */
.toast {
  background: rgba(28, 28, 34, 0.96) !important;
  backdrop-filter: var(--ap-blur) !important;
  -webkit-backdrop-filter: var(--ap-blur) !important;
  border: 1px solid rgba(255,255,255,0.10) !important;
  border-radius: var(--ap-r-pill) !important;
  box-shadow: var(--ap-shadow) !important;
  color: var(--ap-text) !important;
  font-family: var(--ap-font) !important;
  font-size: 13px !important;
  font-weight: 500 !important;
}

.toast::before { display: none !important; }
.toast.ok { color: #32D74B !important; }
.toast.err { color: var(--ap-red) !important; }

/* Sessions sidebar */
.sessions-panel {
  background: rgba(10, 10, 14, 0.98) !important;
  backdrop-filter: var(--ap-blur) !important;
  -webkit-backdrop-filter: var(--ap-blur) !important;
  border-right: 1px solid var(--ap-border) !important;
  border-radius: 0 !important;
}

.session-item {
  border: none !important;
  border-radius: var(--ap-r-sm) !important;
  font-family: var(--ap-font) !important;
  font-size: 14px !important;
  color: var(--ap-text-2) !important;
  transition: background var(--ap-t-fast) !important;
}

.session-item:hover {
  background: rgba(255,255,255,0.06) !important;
}

.session-item.active {
  background: rgba(10, 132, 255, 0.12) !important;
  color: var(--ap-text) !important;
  border: none !important;
}

.sess-title {
  font-family: var(--ap-font) !important;
  font-weight: 500 !important;
}

/* Side header */
.side-header {
  border-bottom: 1px solid var(--ap-border) !important;
  background: transparent !important;
  font-family: var(--ap-font-display) !important;
}

/* Mode indicator (hidden) */
#mode-indicator { display: none !important; }

/* Suggestion chips */
.sug-chip {
  background: rgba(255,255,255,0.05) !important;
  border: 1px solid rgba(255,255,255,0.09) !important;
  border-radius: var(--ap-r-pill) !important;
  color: var(--ap-text-2) !important;
  font-family: var(--ap-font) !important;
  font-size: 13px !important;
  font-weight: 400 !important;
  letter-spacing: 0 !important;
  transition: background var(--ap-t-fast), color var(--ap-t-fast) !important;
}

.sug-chip:hover {
  background: rgba(255,255,255,0.10) !important;
  color: var(--ap-text) !important;
  box-shadow: none !important;
}

/* Overlay / backdrop */
.mobile-backdrop,
.sessions-backdrop {
  background: rgba(0,0,0,0.55) !important;
  backdrop-filter: blur(4px) !important;
  -webkit-backdrop-filter: blur(4px) !important;
}

/* Welcome message styling */
.welcome-glow .msg-text h2 {
  font-family: var(--ap-font-display) !important;
  font-size: 26px !important;
  font-weight: 500 !important;
  letter-spacing: -0.02em !important;
  animation: none !important;
  background: var(--ap-text) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  color: transparent !important;
  border: none !important;
}

/* Boot overlay text */
.boot-line { font-family: var(--ap-font-mono) !important; }

/* Focus accessibility ring */
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(10, 132, 255, 0.70) !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.15) !important;
}


/* ══════════════════════════════════════════════════════════════════════
 * §18  PHASE 2 — Reference Image Exact Match
 *
 * Loaded at end of file so it wins all same-file !important conflicts.
 * Matches the uploaded Apple chat design image precisely:
 *   • Deep blue-black page background with soft purple corner glow
 *   • Header: clean borderless buttons, crisp HYPATIA wordmark
 *   • AI bubbles: dark navy card (#141428) with iMessage-style flat corner
 *   • User bubbles: vivid blue→purple gradient
 *   • Message actions: always-visible glass pills below AI messages
 *   • “Today” date divider with extending lines
 *   • Liquid canvas orb (CSS side — canvas injected by apple-voice-sheet.js)
 * ══════════════════════════════════════════════════════════════════════ */

/* ── Background: deep blue-black with soft purple corner gradients ──────── */
html {
  background: #0a0a14 !important;
}

body {
  background: #0a0a14 !important;
}

body::before {
  background:
    radial-gradient(ellipse 65% 55% at  8% 10%, rgba(88, 80, 220, 0.22) 0%, transparent 55%),
    radial-gradient(ellipse 60% 55% at 92% 92%, rgba(60, 60, 200, 0.18) 0%, transparent 55%),
    radial-gradient(ellipse 55% 50% at 50% 50%, rgba(10, 10,  30, 0.60) 0%, transparent 70%) !important;
  animation: apBgDrift 16s ease-in-out infinite alternate !important;
}

@keyframes apBgDrift {
  0%   { opacity: 0.80; }
  50%  { opacity: 1.00; }
  100% { opacity: 0.85; }
}

/* ── Chat main: dark navy, nearly opaque ──────────────────────────────── */
.chat-main {
  background: rgba(10, 10, 22, 0.97) !important;
  backdrop-filter: blur(40px) saturate(140%) !important;
  -webkit-backdrop-filter: blur(40px) saturate(140%) !important;
}

/* ── Header: clean, no pill borders ───────────────────────────────────── */
.ch-header {
  background: rgba(10, 10, 22, 0.96) !important;
  backdrop-filter: blur(24px) !important;
  -webkit-backdrop-filter: blur(24px) !important;
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: none !important;
}

/* Remove glass pill borders from button groups — clean borderless look */
.cmb-left {
  background: none !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  gap: 2px !important;
}

.cmb-right {
  background: none !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  gap: 2px !important;
}

/* HYPATIA wordmark: crisp white, letter-spaced, no gradient shimmer */
.cmb-wordmark,
.hy-wordmark.cmb-wordmark {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', system-ui, sans-serif !important;
  font-size: 17px !important;
  font-weight: 600 !important;
  letter-spacing: 0.22em !important;
  padding-left: 0.22em !important;
  color: rgba(255, 255, 255, 0.96) !important;
  /* Strip the background-clip gradient shimmer */
  background: none !important;
  -webkit-background-clip: unset !important;
  background-clip: unset !important;
  -webkit-text-fill-color: rgba(255, 255, 255, 0.96) !important;
  animation: none !important;
  text-shadow: 0 0 20px rgba(140, 130, 255, 0.20) !important;
}

/* CMB icon buttons: bigger, cleaner */
.cmb-btn {
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  min-height: 44px !important;
  color: rgba(255, 255, 255, 0.55) !important;
  border-radius: 12px !important;
}

.cmb-btn:hover {
  background: rgba(255, 255, 255, 0.07) !important;
  color: rgba(255, 255, 255, 0.90) !important;
}

/* ── Messages area padding ───────────────────────────────────────────── */
.ch-messages {
  padding: 16px 0 8px !important;
  gap: 3px !important;
}

.msg-row {
  padding: 2px 14px !important;
}

/* ── Date “Today” separator — lines extending both sides ──────────────── */
.msg-system {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 10px 20px !important;
  background: none !important;
  border: none !important;
  font-family: -apple-system, 'SF Pro Text', 'Inter', system-ui, sans-serif !important;
  font-size: 11px !important;
  font-weight: 500 !important;
  color: rgba(255, 255, 255, 0.28) !important;
  letter-spacing: 0.03em !important;
}

.msg-system::before,
.msg-system::after {
  content: '' !important;
  flex: 1 !important;
  height: 0.5px !important;
  background: rgba(255, 255, 255, 0.10) !important;
}

/* ── AI bubble: dark navy card, iMessage flat-top-left corner ──────────── */
.msg-assistant {
  background: rgba(18, 18, 42, 0.95) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: 1px solid rgba(255, 255, 255, 0.07) !important;
  border-radius: 4px 20px 20px 20px !important; /* flat top-left = iMessage AI */
  box-shadow:
    0 2px 20px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
  color: rgba(255, 255, 255, 0.90) !important;
  padding: 12px 16px !important;
}

.msg-assistant .msg-text {
  font-size: 15px !important;
  line-height: 1.52 !important;
  color: rgba(255, 255, 255, 0.90) !important;
}

/* ── User bubble: vivid blue→purple gradient, flat-bottom-right corner ──── */
.msg-user {
  background: linear-gradient(
    145deg,
    #4E6CF5 0%,
    #7048ED 40%,
    #8E42E8 70%,
    #A040DE 100%
  ) !important;
  border-radius: 20px 20px 4px 20px !important; /* flat bottom-right = iMessage user */
  border: none !important;
  box-shadow:
    0 4px 24px rgba(100, 70, 240, 0.40),
    0 1px 6px  rgba(100, 70, 240, 0.25) !important;
  padding: 12px 16px !important;
}

.msg-user .msg-text {
  color: rgba(255, 255, 255, 0.97) !important;
  font-size: 15px !important;
  line-height: 1.47 !important;
}

/* ── Message actions: always visible as glass pills below AI messages ───── */
.msg-row-assistant .msg-actions {
  opacity: 1 !important;
  display: flex !important;
  flex-direction: row !important;
  gap: 6px !important;
  margin-top: 5px !important;
  padding-left: 40px !important; /* align with bubble past avatar */
  align-items: center !important;
}

.msg-row-assistant .msg-act,
.msg-row-assistant .msg-tts {
  width: auto !important;
  height: 30px !important;
  min-width: 34px !important;
  min-height: 30px !important;
  border-radius: 20px !important;
  padding: 0 10px !important;
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.10) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  color: rgba(255, 255, 255, 0.45) !important;
  font-size: 14px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  transition: background 0.15s, color 0.15s !important;
}

.msg-row-assistant .msg-act:hover,
.msg-row-assistant .msg-tts:hover {
  background: rgba(255, 255, 255, 0.12) !important;
  color: rgba(255, 255, 255, 0.80) !important;
  transform: none !important;
}

/* User message: hide action row (not shown in reference image) */
.msg-row-user .msg-actions {
  display: none !important;
}

/* ── Avatar: slightly smaller, cleaner ────────────────────────────── */
.msg-avatar {
  width: 28px !important;
  height: 28px !important;
  align-self: flex-start !important; /* top-align with first line of text */
  margin-top: 2px !important;
}

.msg-avatar-ai {
  background: linear-gradient(135deg,
    rgba(70, 80, 220, 0.45) 0%,
    rgba(110, 60, 200, 0.30) 100%
  ) !important;
  border: 1px solid rgba(100, 90, 230, 0.25) !important;
}

/* ── Message timestamps ───────────────────────────────────────────── */
.msg-ts {
  font-size: 10px !important;
  font-family: -apple-system, 'SF Pro Text', 'Inter', system-ui, sans-serif !important;
  color: rgba(255, 255, 255, 0.25) !important;
  letter-spacing: 0.01em !important;
  margin-top: 4px !important;
}

.msg-user .msg-ts {
  color: rgba(255, 255, 255, 0.45) !important;
}

/* Sparkle ✨ glyph on AI role label */
.msg-assistant .msg-role::before {
  content: '✨ ' !important;
  font-size: 10px !important;
}

.msg-assistant .msg-role {
  display: flex !important;
  align-items: center !important;
  font-size: 10px !important;
  color: rgba(255, 255, 255, 0.22) !important;
  margin-bottom: 3px !important;
  letter-spacing: 0.04em !important;
  font-weight: 500 !important;
}

/* ── Input composer: larger glass pill, more visible ──────────────────── */
.ch-composer {
  padding: 10px 14px 14px !important;
  background: rgba(10, 10, 22, 0.98) !important;
  border-top: 0.5px solid rgba(255, 255, 255, 0.07) !important;
}

.ch-input-wrap,
.ch-composer .ch-input-wrap {
  background: rgba(35, 35, 55, 0.80) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 26px !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 4px 20px rgba(0, 0, 0, 0.30) !important;
}

.ch-input-wrap:focus-within,
.ch-composer .ch-input-wrap:focus-within {
  border-color: rgba(78, 108, 245, 0.50) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 4px 20px rgba(0, 0, 0, 0.30),
    0 0 0 3px rgba(78, 108, 245, 0.12) !important;
}

.ch-input,
.ch-composer .ch-input {
  color: rgba(255, 255, 255, 0.90) !important;
  font-size: 15px !important;
  font-family: -apple-system, 'SF Pro Text', 'Inter', system-ui, sans-serif !important;
  min-height: 42px !important;
  padding: 10px 10px 10px 12px !important;
}

.ch-input::placeholder {
  color: rgba(255, 255, 255, 0.28) !important;
  font-weight: 400 !important;
}

.ci-attach {
  color: rgba(255, 255, 255, 0.38) !important;
  width: 38px !important;
  height: 38px !important;
  min-width: 38px !important;
  min-height: 38px !important;
}

.ci-mic {
  color: rgba(255, 255, 255, 0.38) !important;
  width: 38px !important;
  height: 38px !important;
  min-width: 38px !important;
  min-height: 38px !important;
}

/* Send button: blue gradient, crisp */
.ch-send, #send-btn {
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  min-height: 44px !important;
  background: linear-gradient(155deg, #4E6CF5 0%, #7048ED 100%) !important;
  box-shadow:
    0 3px 14px rgba(78, 108, 245, 0.50),
    0 1px 4px  rgba(78, 108, 245, 0.30) !important;
}

.ch-send:hover, #send-btn:hover {
  box-shadow:
    0 4px 22px rgba(78, 108, 245, 0.65),
    0 2px 8px  rgba(78, 108, 245, 0.40) !important;
  transform: scale(1.06) !important;
}

/* Voice FAB: blue-to-purple gradient (matches user bubbles) */
.voice-fab,
.ch-composer .voice-fab {
  background: linear-gradient(145deg, #4E6CF5 0%, #8E42E8 100%) !important;
  border: none !important;
  box-shadow: 0 4px 18px rgba(100, 70, 240, 0.45) !important;
  color: #fff !important;
  animation: none !important;
}

.voice-fab:hover,
.ch-composer .voice-fab:hover {
  transform: scale(1.06) !important;
  box-shadow: 0 6px 26px rgba(100, 70, 240, 0.60) !important;
  background: linear-gradient(145deg, #5B7BFF 0%, #9B52F5 100%) !important;
}

/* ── Thinking pill: cleaner ───────────────────────────────────────── */
.thinking-pill {
  background: rgba(20, 20, 44, 0.90) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  font-family: -apple-system, 'SF Pro Text', 'Inter', system-ui, sans-serif !important;
  font-size: 12px !important;
  color: rgba(255, 255, 255, 0.45) !important;
  letter-spacing: 0 !important;
  font-weight: 500 !important;
}

.tp-dot {
  background: linear-gradient(90deg, #4E6CF5, #8E42E8) !important;
  opacity: 0.8 !important;
}

/* ── Voice sheet: dark frosted, exact match ──────────────────────── */
#apple-voice-sheet {
  background: rgba(8, 8, 18, 0.97) !important;
  backdrop-filter: blur(60px) saturate(160%) !important;
  -webkit-backdrop-filter: blur(60px) saturate(160%) !important;
  border-top: 1px solid rgba(255, 255, 255, 0.10) !important;
  border-radius: 32px 32px 0 0 !important;
}

.avs-handle {
  background: rgba(255, 255, 255, 0.22) !important;
  width: 36px !important;
  height: 4px !important;
}

.avs-mode-label {
  font-family: -apple-system, 'SF Pro Display', 'Inter', system-ui, sans-serif !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  color: rgba(255, 255, 255, 0.60) !important;
  letter-spacing: 0.01em !important;
}

.avs-status {
  font-family: -apple-system, 'SF Pro Display', 'Inter', system-ui, sans-serif !important;
  font-size: 22px !important;
  font-weight: 400 !important;
  color: rgba(255, 255, 255, 0.92) !important;
  letter-spacing: -0.02em !important;
}

.avs-sub-status {
  font-family: -apple-system, 'SF Pro Text', 'Inter', system-ui, sans-serif !important;
  font-size: 13px !important;
  color: rgba(255, 255, 255, 0.36) !important;
  margin-top: 4px !important;
}

/* ── Liquid canvas orb container ────────────────────────────────── */

/* Hide the old CSS orb div (replaced by canvas) */
.avs-orb {
  display: none !important;
}

/* Canvas orb container */
.avs-orb-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  width: 100%;
}

#avs-liquid-canvas {
  border-radius: 50%;
  box-shadow:
    0 0 60px rgba(80, 80, 255, 0.30),
    0 0 120px rgba(80, 80, 255, 0.15),
    0 0 180px rgba(80, 80, 255, 0.06);
  cursor: pointer;
  transition: box-shadow 0.8s ease;
  display: block;
}

#avs-liquid-canvas:hover {
  box-shadow:
    0 0 70px rgba(100, 80, 255, 0.45),
    0 0 140px rgba(100, 80, 255, 0.22);
}

/* State-specific canvas glow color */
#apple-voice-sheet[data-state="listening"] #avs-liquid-canvas {
  box-shadow:
    0 0 60px rgba(10, 132, 255, 0.45),
    0 0 120px rgba(10, 132, 255, 0.20) !important;
}

#apple-voice-sheet[data-state="speaking"] #avs-liquid-canvas {
  box-shadow:
    0 0 70px rgba(140, 60, 255, 0.55),
    0 0 140px rgba(200, 80, 255, 0.25),
    0 0 200px rgba(60, 120, 255, 0.12) !important;
}

#apple-voice-sheet[data-state="thinking"] #avs-liquid-canvas {
  box-shadow:
    0 0 60px rgba(255, 160, 20, 0.45),
    0 0 120px rgba(255, 120, 0, 0.20) !important;
}

/* Outer glow rings around canvas */
.avs-ring-outer,
.avs-ring-mid {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  border: 1px solid rgba(80, 80, 240, 0.18);
}

.avs-ring-outer {
  animation: avRingOut 3.0s ease-out infinite;
  width: 200px; height: 200px;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}

.avs-ring-mid {
  animation: avRingOut 3.0s ease-out infinite 1.5s;
  width: 200px; height: 200px;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}

@keyframes avRingOut {
  0%   { width: 160px; height: 160px; opacity: 0.40; }
  100% { width: 300px; height: 300px; opacity: 0;    }
}

/* When speaking, rings pulse faster and are more colorful */
#apple-voice-sheet[data-state="speaking"] .avs-ring-outer {
  border-color: rgba(140, 60, 255, 0.30) !important;
  animation-duration: 1.4s !important;
}

#apple-voice-sheet[data-state="speaking"] .avs-ring-mid {
  border-color: rgba(60, 120, 255, 0.25) !important;
  animation-duration: 1.4s !important;
  animation-delay: 0.7s !important;
}

#apple-voice-sheet[data-state="listening"] .avs-ring-outer {
  border-color: rgba(10, 132, 255, 0.28) !important;
  animation-duration: 2.0s !important;
}

#apple-voice-sheet[data-state="listening"] .avs-ring-mid {
  border-color: rgba(10, 132, 255, 0.18) !important;
  animation-duration: 2.0s !important;
  animation-delay: 1.0s !important;
}

/* ── Voice controls: more defined ───────────────────────────────── */
.avs-ctrl-stop {
  width: 72px !important;
  height: 72px !important;
  background: rgba(255, 255, 255, 0.14) !important;
  border: 1.5px solid rgba(255, 255, 255, 0.18) !important;
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.40),
    inset 0 1px 0 rgba(255, 255, 255, 0.14) !important;
}

.avs-stop-icon {
  width: 24px !important;
  height: 24px !important;
  border-radius: 6px !important;
  background: rgba(255, 255, 255, 0.90) !important;
}

.avs-ctrl-secondary {
  width: 54px !important;
  height: 54px !important;
  background: rgba(255, 255, 255, 0.07) !important;
  border: 1px solid rgba(255, 255, 255, 0.10) !important;
}

/* Waveform wrap */
.avs-waveform-wrap {
  height: 44px !important;
  padding: 0 50px !important;
}

/* ── Session sidebar: dark navy ──────────────────────────────────── */
.sessions-panel {
  background: rgba(8, 8, 20, 0.99) !important;
  border-right: 0.5px solid rgba(255, 255, 255, 0.07) !important;
}

.session-item {
  font-family: -apple-system, 'SF Pro Text', 'Inter', system-ui, sans-serif !important;
  color: rgba(255, 255, 255, 0.55) !important;
}

.session-item.active {
  background: linear-gradient(135deg, rgba(78, 108, 245, 0.15), rgba(142, 66, 232, 0.10)) !important;
  color: rgba(255, 255, 255, 0.90) !important;
}

/* ── Mobile specific ─────────────────────────────────────────────── */
@media screen and (max-width: 768px) {
  .msg-row-assistant .msg-actions {
    padding-left: 34px !important; /* smaller on mobile */
  }

  .msg-user .msg-text { font-size: 16px !important; }
  .msg-assistant .msg-text { font-size: 16px !important; }

  .avs-status { font-size: 20px !important; }

  /* Slightly wider bubbles on mobile */
  .msg { max-width: min(90%, 380px) !important; }
}
