/* ---------- Header / identity ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.wordmark {
  display: inline-flex;
  align-items: center;
  font-size: 35px;
  font-weight: 650;
  letter-spacing: -2.3px;
  text-decoration: none;
  line-height: 1.2;
}
.wordmark-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  margin-left: 4px;
  flex-shrink: 0;
}
.connection {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  padding: 0 0 0 12px;
}
.network-mark {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

/* ---------- Eyebrow line ---------- */
.mode-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  margin-top: 15px;
  font-size: 10px;
  letter-spacing: .15em;
  color: var(--muted);
}

/* ---------- Voice presence: Signal-only, idle only (see voice-control.js) ---------- */
.voice-zone {
  position: relative;
  display: flex;
  align-items: center;
  flex-direction: column;
  padding-top: 10px;
}
.voice-key {
  width: 220px;
  height: 110px;
  min-height: 110px;
  border: 0;
  background: transparent;
  color: var(--voice-idle);
  border-radius: 20px;
  overflow: visible;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .18s;
}
.voice-key:active { transform: scale(.99); }
.voice-key:focus-visible {
  outline: 1px dotted var(--muted);
  outline-offset: 3px;
}
/*
 * Mobile ergonomics 01: the Signal should read as the primary action, not
 * be compressed between the header and secondary controls. This grows
 * only the button's own vertical box (its tap target + presentation
 * area) — .presence keeps its fixed 198x81 size and just recenters
 * within the taller box via the existing flex centering, so dot
 * geometry/animation and horizontal centering are pixel-identical to
 * before. Desktop/wider layouts are untouched (stay at 110px) — this is
 * a phone-only ergonomics change, not a redesign.
 */
@media (max-width: 600px) {
  .voice-zone { padding-top: 18px; }
  .voice-key { width: 220px; height: 156px; min-height: 156px; }
}
.presence {
  position: relative;
  display: block;
  width: 198px;
  height: 81px;
}
.presence-dot {
  position: absolute;
  left: calc(50% - 2px);
  top: calc(50% - 2px);
  width: 4px;
  height: 4px;
  transform: translateX(var(--x));
  opacity: .86;
}
/*
 * Height is driven by a single custom property --h, defaulting to each
 * type's accepted static idle height (4/8/12px). voice-control.js writes
 * --h directly in px every frame during Listening (an explicit target
 * height per HEIGHT_KEYFRAMES, not a multiplier) — silence/Idle/Saved/
 * Error simply never set --h, so they render at the unchanged static
 * geometry via the var() fallback. translateY is a pure function of --h
 * (half the delta from the 4px baseline, shifted up) so every dot stays
 * vertically centered on the same anchor point as its height changes,
 * whether that change is the old static idle value or a live reactive one.
 */
.presence-dot i {
  display: block;
  width: 4px;
  height: var(--h, 4px);
  border-radius: 50%;
  background: currentColor;
  transform: translateY(calc((4px - var(--h, 4px)) / 2));
}
.presence-dot--raised i { --h: 8px; border-radius: 2px; }
.presence-dot--center i { --h: 12px; border-radius: 2px; }

/*
 * Listening/Saved/Error: restrained state changes — no waveform, no
 * decorative/random loop. Idle/Saved/Error stay purely static. Listening
 * is color + (motion allowed) real audio-reactive per-dot height driven
 * by voice-control.js from actual microphone energy — see startAudioAnalysis.
 * A plain color swap between --voice-idle (#b9c899) and --accent
 * (#d9ed9a) alone is too close in hue/lightness to register as changed on
 * real hardware, so the label text also gets a matching color so the
 * state is legible even when the Signal itself is quiet.
 */
.voice-key[data-state="listening"] { color: var(--accent); }
.voice-key[data-state="listening"] .presence { opacity: 1; }
.voice-key[data-state="error"] { color: var(--danger); }
.voice-key[data-state="saved"] { color: var(--accent); }
/* Playing (Activity playback): same Signal family/color as Listening —
   the calmer feel comes from voice-control.js's gentler envelope
   constants, not a different visual treatment here. */
.voice-key[data-state="playing"] { color: var(--accent); }
.voice-key[data-state="playing"] .presence { opacity: 1; }

/* Reduced motion: no per-frame audio analysis/envelope-following runs at
   all (see JS, --h is never written), so this is the only visible
   difference for both Listening and Playing. */
@media (prefers-reduced-motion: reduce) {
  .voice-key[data-state="listening"] .presence,
  .voice-key[data-state="playing"] .presence {
    transform: scale(1.14);
  }
}

.voice-key[data-state="listening"] + .voice-label { color: var(--accent); font-weight: 650; }
.voice-key[data-state="saved"] + .voice-label { color: var(--accent); font-weight: 650; }
.voice-key[data-state="error"] + .voice-label { color: var(--danger); }
.voice-key[data-state="playing"] + .voice-label { color: var(--accent); font-weight: 650; }

.presence-check {
  position: absolute;
  width: 32px;
  height: 32px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
  opacity: 0;
}
.voice-key[data-state="saved"] .presence { opacity: 0; }
.voice-key[data-state="saved"] .presence-check { opacity: 1; }

.voice-label { font-size: 14px; font-weight: 450; margin-top: 4px; }
.voice-help { color: var(--muted); font-size: 13px; margin-top: 7px; text-align: center; min-height: 1em; }

/* ---------- Home action grid ---------- */
.home-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 13px;
}
.capture-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 2px;
}
.capture-actions button {
  width: 48px;
  height: 44px;
  min-height: 44px;
  border-radius: 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
}
.capture-actions svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ask-entry, .today-entry {
  margin: 0;
  min-height: 66px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 9px;
  text-align: left;
  width: 100%;
}
.ask-entry { justify-content: center; }
.ask-entry > span:last-child { color: var(--text); font-size: 16px; margin: 0; }
.today-entry strong { font-size: 16px; font-weight: 450; display: block; }
.today-entry small { font-size: 10px; white-space: nowrap; margin-top: 4px; color: var(--muted); display: block; }
#today-count { font-size: 14px; font-variant-numeric: tabular-nums; color: var(--muted); margin-left: auto; }

/* ---------- Activity ---------- */
.recent { margin-top: 19px; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.section-head h2 { font-size: 18px; font-weight: 500; }
.quiet { font-size: 13px; color: var(--muted); padding: 0; min-width: 44px; }

.recent-row {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 12px;
  min-height: 78px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 12px 0;
}
.item-icon {
  width: 36px;
  height: 40px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--detail);
}
.item-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.row-content { flex: 1; min-width: 0; }
.row-title {
  display: block;
  font-size: 16px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.5;
}
.row-play {
  margin-top: 6px;
  min-height: 32px;
  padding: 0 12px 0 0;
  font-size: 14px;
  color: var(--accent);
}
.row-meta {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  margin-top: 5px;
}
/* LOCAL (on-device, verified) is the normal successful terminal state for
   this slice — it gets no status marker at all (see activity-list.js);
   only non-trivial states (queued for sync, failed) are worth a badge. */
.status { display: inline-flex; align-items: center; gap: 4px; }
.status[data-state="QUEUED"] { color: var(--warning); }
.status[data-state="FAILED"] { color: var(--danger); }
.routing {
  display: block;
  margin-top: 5px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--detail);
}
.empty-state {
  color: var(--muted);
  font-size: 13px;
  padding: 18px 0;
}

/* ---------- Bottom sheet (capture composer, placeholders) ---------- */
dialog {
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 24px;
  max-width: 430px;
  width: calc(100% - 24px);
  padding: 20px 24px 24px;
  max-height: 90dvh;
  overflow: auto;
}
dialog::backdrop { background: #080a0bba; backdrop-filter: blur(5px); }
.sheet-top { display: flex; align-items: center; justify-content: space-between; }
.sheet-top > span { font-size: 10px; letter-spacing: .15em; color: var(--muted); }
.sheet-top button { font-size: 27px; min-width: 44px; margin-right: -10px; }
dialog h2 { font-size: 25px; letter-spacing: -.5px; line-height: 1.3; margin: 12px 0 16px; }
dialog p { font-size: 15px; line-height: 1.6; color: var(--muted); }
dialog textarea {
  width: 100%;
  min-height: 160px;
  resize: vertical;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 14px;
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 16px;
}
.sheet-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 16px; }
.primary {
  background: var(--accent);
  color: var(--ink);
  border-radius: 14px;
  padding: 13px 20px;
  font-weight: 550;
  font-size: 16px;
}
.secondary {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 14px;
}
.full { width: 100%; }

@media (max-width: 600px) {
  dialog {
    position: fixed;
    top: auto;
    bottom: 0;
    margin: 0 auto;
    border-bottom: 0;
    border-radius: 24px 24px 0 0;
    width: 100%;
    max-width: 456px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }
}

/*
 * ---------- Appearance control (Theme + Daylight Readability 01) ----------
 * Deliberately placed after Activity, well below the primary voice
 * action, and deliberately compact/quiet — a fieldset/radio group, not a
 * button row, so it gets native grouping, keyboard nav, and screen-reader
 * semantics for free. The radio inputs stay visible (not hidden behind a
 * custom-styled pseudo-control): --accent tints the native checked dot
 * via accent-color, which alone makes the selected state legible in both
 * themes with zero custom-selector risk; the :has() pill highlight below
 * is a enhancement on top of that guaranteed baseline, not a replacement
 * for it.
 */
.appearance { margin-top: 24px; }
.appearance-group {
  border: 0;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.appearance-legend {
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0;
  margin: 0 0 8px;
  flex-basis: 100%;
}
.appearance-option {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 20px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
}
.appearance-option input {
  width: 16px;
  height: 16px;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--accent);
}
.appearance-option:has(input:checked) {
  border-color: var(--accent);
  color: var(--text);
  font-weight: 550;
}
.appearance-option:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Footer ---------- */
.maker-footer {
  display: block;
  text-align: center;
  font-size: 10px;
  letter-spacing: .12em;
  font-weight: 400;
  color: var(--muted);
  opacity: .65;
  margin: 28px 0 0;
  padding: 8px 0 calc(16px + env(safe-area-inset-bottom));
}
dialog .maker-footer { margin-top: 16px; padding-bottom: 0; }
