/* ── Voice notes (src/voice.js) ───────────────────────────────────────────────
   The microphone button sits beside the `/` button in the phone layout — the same
   size and radius, quieter colours so `/` stays the primary action — and the recording
   panel is a bottom sheet on phones, a small card above the status bar elsewhere. */

#fab-mic {
  display: none;
  position: fixed;
  right: calc(16px + 48px + 10px);
  bottom: calc(var(--status-height) + 16px);
  width: 48px;
  height: 48px;
  border-radius: 14px;
  border: 1px solid var(--accent-line);
  background: var(--bg-raised);
  color: var(--accent);
  box-shadow: 0 10px 30px color-mix(in srgb, var(--bg-page) 60%, transparent);
  z-index: 90;
  cursor: pointer;
  padding: 0;
}
#fab-mic svg { width: 20px; height: 20px; }
@media (hover: none), (max-width: 700px) {
  #fab-mic { display: grid; place-items: center; }
}
body.focus-mode #fab-mic { display: none; }

#voice-panel {
  position: fixed;
  right: 16px;
  bottom: calc(var(--status-height) + 16px);
  width: min(360px, calc(100vw - 32px));
  z-index: 120;
  padding: 14px 16px 12px;
  border-radius: 12px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .45);
  font-size: 12px;
  color: var(--fg-dim);
}
#voice-panel.hidden { display: none; }
@media (max-width: 700px) {
  #voice-panel { left: 0; right: 0; bottom: 0; width: auto; border-radius: 14px 14px 0 0; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
}

.vp-head { display: flex; align-items: center; gap: 8px; color: var(--fg); }
.vp-head svg { width: 16px; height: 16px; color: var(--accent); }
.vp-title { font-weight: 600; letter-spacing: .02em; }
.vp-time { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--fg-dim); }
.vp-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); display: none; }
#voice-panel[data-state="recording"] .vp-dot { display: inline-block; animation: vp-pulse 1.2s ease-in-out infinite; }
@keyframes vp-pulse { 50% { opacity: .3; } }

.vp-meter { height: 4px; margin: 12px 0 10px; border-radius: 2px; background: var(--border); overflow: hidden; }
.vp-meter i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .1s linear; }
#voice-panel:not([data-state="recording"]) .vp-meter { visibility: hidden; }
#voice-panel[data-state="transcribing"] .vp-meter { visibility: visible; }
#voice-panel[data-state="transcribing"] .vp-meter i { width: 40% !important; animation: vp-indeterminate 1.1s ease-in-out infinite; }
@keyframes vp-indeterminate { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }

.vp-msg { line-height: 1.5; min-height: 1.5em; }
/* What has been heard so far, arriving piece by piece while you speak. */
.vp-text {
  margin-top: 8px; max-height: 30vh; overflow-y: auto; line-height: 1.55;
  color: var(--fg); white-space: pre-wrap; overflow-wrap: anywhere;
}
.vp-text:empty { display: none; }
#voice-panel[data-state="error"] .vp-msg { color: var(--danger); }
.vp-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.vp-btn {
  font: inherit; font-size: 12px; padding: 7px 14px; border-radius: 6px; cursor: pointer;
  color: var(--fg-dim); background: transparent; border: 1px solid var(--border);
}
.vp-btn:hover { color: var(--fg); border-color: var(--fg-faint); }
.vp-btn.primary { color: var(--bg-page); background: var(--accent); border-color: var(--accent); }
.vp-btn:disabled { opacity: .45; cursor: default; }
