/* VeraPoint Voice Notes. Same tokens as the interpreter (call-assets/app.css). */
:root {
  --vp-bg: #100f0e;
  --vp-surface: #211d17;
  --vp-surface-2: #1a1713;
  --vp-ink: #f1e5ce;
  --vp-muted: #b5a68a;
  --vp-dim: #8d7c62;
  --vp-line: #3c3222;
  --vp-gold: #d0a34b;
  --vp-gold-ink: #dbb86c;
  --vp-gold-wash: #2a2215;
  --vp-button: #cba04d;
  --vp-button-ink: #1b1409;
  --vp-danger: #eea18f;
  --vp-danger-bg: #39201c;
  --vp-rec: #e0735c;
  --vp-out: #3a2a1c;
  --vp-shadow: #00000066;
  --oct: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
  --gutter: 16px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--vp-bg); color: var(--vp-ink); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px; line-height: 1.45; font-weight: 500;
  -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%;
  overflow: hidden; overscroll-behavior: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; }
p, h1, h2 { margin: 0; }
a { color: var(--vp-gold-ink); }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
:focus-visible { outline: 2px solid var(--vp-gold); outline-offset: 2px; }
.title:focus, .bar-title:focus { outline: none; }

/* App column: full width on a phone, a centred column on a desktop. */
.app {
  position: relative; max-width: 560px; margin: 0 auto;
  height: 100vh; height: 100dvh; display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
  background: var(--vp-bg);
}
@media (min-width: 600px) { .app { border-inline: 1px solid var(--vp-line); } }
.screen { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.scroll { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.pad { padding: 14px var(--gutter) calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; }

/* ---------- shared bits ---------- */
.muted { color: var(--vp-muted); font-size: 14px; }
.hint { color: var(--vp-dim); font-size: 13px; }
.big { font-size: 20px; font-weight: 700; }
.field-label { display: block; font-size: 13px; font-weight: 650; color: var(--vp-muted); margin: 14px 0 7px; }
.input {
  width: 100%; min-width: 0; min-height: 52px; padding: 13px 14px;
  background: var(--vp-surface-2); border: 1px solid var(--vp-line); border-radius: 14px;
  font-size: 16px; /* 16px stops iOS zooming on focus */
}
.input:focus { border-color: var(--vp-gold); outline: none; }
textarea.input { resize: none; line-height: 1.45; }
.select-wrap { position: relative; }
.select-wrap::after {
  content: ""; position: absolute; right: 18px; top: 50%; width: 9px; height: 9px; margin-top: -7px;
  border-right: 2px solid var(--vp-gold-ink); border-bottom: 2px solid var(--vp-gold-ink); transform: rotate(45deg); pointer-events: none;
}
select.input { appearance: none; -webkit-appearance: none; padding-right: 44px; }
.primary {
  width: 100%; min-height: 54px; display: flex; align-items: center; justify-content: center; gap: 10px;
  border: 0; border-radius: 16px; background: var(--vp-button); color: var(--vp-button-ink);
  font-size: 17px; font-weight: 750;
}
.primary svg { width: 19px; height: 19px; }
.primary:disabled { background: var(--vp-gold-wash); color: var(--vp-dim); }
.secondary {
  width: 100%; min-height: 50px; display: flex; align-items: center; justify-content: center; gap: 9px;
  border: 1px solid var(--vp-gold); border-radius: 16px; background: transparent; color: var(--vp-gold-ink); font-weight: 700;
}
.secondary svg { width: 18px; height: 18px; }
.text-btn { min-height: 44px; padding: 8px 12px; border: 0; background: transparent; color: var(--vp-muted); font-weight: 650; font-size: 15px; }
.text-btn.danger { color: var(--vp-danger); }
.card { background: var(--vp-surface); border: 1px solid var(--vp-line); border-radius: 20px; padding: 18px; }
.card-title { font-size: 19px; font-weight: 750; margin-bottom: 6px; }
.form-error { color: var(--vp-danger); font-size: 14px; min-height: 20px; margin-top: 10px; }
.oct { clip-path: var(--oct); }
.chip {
  display: inline-flex; align-items: center; min-height: 24px; padding: 2px 9px; border-radius: 8px;
  background: var(--vp-gold-wash); color: var(--vp-gold-ink); font-size: 12px; font-weight: 700; letter-spacing: .02em; white-space: nowrap;
}
.chip-btn { border: 1px solid var(--vp-line); min-height: 44px; padding: 4px 12px; font-size: 13px; }
.chip-empty { background: var(--vp-danger-bg); color: var(--vp-danger); }

/* ---------- sign in ---------- */
.signin { overflow-y: auto; padding: 0 var(--gutter) 24px; }
.signin .brand { margin-top: auto; }
.signin-card { margin-bottom: auto; }
.brand { display: flex; flex-direction: column; align-items: center; padding: 28px 0 22px; }
.brand-logo { width: 96px; height: 96px; object-fit: contain; }
.wordmark { font-family: "Chakra Petch", "Arial Black", sans-serif; font-weight: 700; font-size: 30px; line-height: 1; letter-spacing: -.7px; color: var(--vp-gold-ink); margin-top: 4px; }
.brand-sub { font-size: 11px; font-weight: 650; letter-spacing: .085em; text-transform: uppercase; color: var(--vp-muted); margin-top: 5px; }
.signin-card .title { font-size: 24px; font-weight: 750; letter-spacing: -.4px; margin-bottom: 6px; }
.signin-card .primary { margin-top: 16px; }

/* ---------- top bar ---------- */
.bar {
  display: flex; align-items: center; gap: 8px; min-height: 64px; padding: 8px 10px 8px var(--gutter);
  border-bottom: 1px solid var(--vp-line); background: var(--vp-bg); flex: none;
}
.bar-brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.mini-mark { width: 26px; height: 26px; background: var(--vp-button); clip-path: var(--oct); flex: none; }
.bar-title { font-size: 20px; font-weight: 750; letter-spacing: -.3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center; padding: 0;
  border: 1px solid var(--vp-line); border-radius: 14px; background: var(--vp-surface); color: var(--vp-ink);
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.spin svg { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.settings .bar { padding-left: 10px; }
.settings .bar .bar-title { flex: 1; }

/* ---------- inbox ---------- */
.inbox .scroll { padding: 6px 0 calc(24px + env(safe-area-inset-bottom)); }
.inbox .hint { padding: 10px var(--gutter) 4px; }
.rows { list-style: none; margin: 0; padding: 0; }
.row {
  width: 100%; display: flex; align-items: center; gap: 13px; min-height: 72px; padding: 10px var(--gutter);
  border: 0; border-bottom: 1px solid #2a231a; background: transparent; text-align: left;
}
.row:active { background: var(--vp-gold-wash); }
.avatar {
  width: 46px; height: 46px; flex: none; display: grid; place-items: center;
  background: var(--vp-button); color: var(--vp-button-ink); font-weight: 800; font-size: 18px;
}
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.row-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.row-name { font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.row-meta { color: var(--vp-muted); font-size: 13px; }
.row-dot { width: 10px; height: 10px; flex: none; background: var(--vp-gold); clip-path: var(--oct); }
.rows-muted .row { opacity: .9; }
.rows-muted .avatar { background: var(--vp-surface); color: var(--vp-dim); border: 0; }
.rows-muted .row-name { font-variant-numeric: tabular-nums; letter-spacing: .02em; color: var(--vp-muted); font-weight: 650; }
.add-btn {
  flex: none; min-height: 44px; padding: 6px 12px; border-radius: 12px; border: 1px solid var(--vp-gold);
  background: transparent; color: var(--vp-gold-ink); font-size: 14px; font-weight: 700;
}
.others { margin-top: 18px; }
.section-title { padding: 6px var(--gutter) 0; font-size: 12px; letter-spacing: .085em; text-transform: uppercase; color: var(--vp-dim); font-weight: 700; }
.others .hint { padding-top: 4px; }
.empty { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 56px var(--gutter) 28px; color: var(--vp-muted); text-align: center; }
.empty svg { width: 40px; height: 40px; color: var(--vp-gold); }
.foot-link { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; margin: 22px var(--gutter) 0; color: var(--vp-muted); font-size: 14px; font-weight: 650; text-decoration: none; }
.foot-link svg { width: 18px; height: 18px; }

/* ---------- thread ---------- */
.thread-bar { padding-left: 8px; gap: 10px; }
.thread-bar .avatar { width: 38px; height: 38px; font-size: 15px; }
.thread-meta { flex: 1; min-width: 0; }
.thread-meta .bar-title { font-size: 17px; display: block; }
.window {
  flex: none; display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 6px var(--gutter);
  border-bottom: 1px solid var(--vp-line); background: var(--vp-surface-2); font-size: 13px; font-weight: 650; color: var(--vp-muted);
}
.window::before { content: ""; flex: none; width: 9px; height: 9px; clip-path: var(--oct); background: var(--vp-dim); }
.window.open { color: #b9dcae; }
.window.open::before { background: #8fc77f; }
.window.closed { color: var(--vp-danger); background: #241614; }
.window.closed::before { background: var(--vp-danger); }
.msgs { padding: 12px var(--gutter) 16px; display: flex; flex-direction: column; gap: 10px; }
.day { align-self: center; margin: 6px 0 2px; padding: 3px 10px; border-radius: 8px; background: var(--vp-surface); color: var(--vp-muted); font-size: 12px; font-weight: 650; }
.bub {
  max-width: 88%; padding: 10px 12px 8px; border-radius: 16px; display: flex; flex-direction: column; gap: 7px;
  background: var(--vp-surface); border: 1px solid var(--vp-line);
}
.bub.in { align-self: flex-start; border-top-left-radius: 6px; }
.bub.out { align-self: flex-end; border-top-right-radius: 6px; background: var(--vp-out); border-color: #4d3a26; }
.bub-head { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--vp-muted); font-weight: 650; }
.player { display: flex; align-items: center; gap: 10px; min-width: 210px; }
.play-btn {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center; padding: 0;
  border: 0; border-radius: 50%; background: var(--vp-button); color: var(--vp-button-ink);
}
.play-btn svg { width: 18px; height: 18px; }
.play-btn.loading { opacity: .6; }
.progress { flex: 1; height: 6px; border-radius: 3px; background: #ffffff1c; overflow: hidden; min-width: 60px; }
.progress-fill { display: block; height: 100%; width: 0; background: var(--vp-gold); border-radius: 3px; }
.dur { font-size: 12.5px; color: var(--vp-muted); font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }
.orig { font-size: 13.5px; color: var(--vp-muted); line-height: 1.4; }
.en { font-size: 15.5px; line-height: 1.45; }
.en b, .src b { font-size: 11px; letter-spacing: .06em; color: var(--vp-gold-ink); margin-right: 5px; }
.src { font-size: 15.5px; line-height: 1.45; }
.bub details { font-size: 13.5px; color: var(--vp-muted); }
.bub summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--vp-gold-ink); font-weight: 650; list-style: none; }
.bub summary::-webkit-details-marker { display: none; }
.bub summary::before { content: "+"; display: inline-block; width: 16px; font-weight: 800; }
.bub details[open] summary::before { content: "\2013"; }
.bub-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.mini-btn {
  min-height: 44px; padding: 5px 11px; display: inline-flex; align-items: center; gap: 6px;
  border-radius: 10px; border: 1px solid var(--vp-line); background: var(--vp-surface-2); color: var(--vp-gold-ink); font-size: 13px; font-weight: 700;
}
.mini-btn svg { width: 15px; height: 15px; }
.mini-btn[aria-pressed="true"] { background: var(--vp-gold-wash); border-color: var(--vp-gold); }
.mini-select { min-height: 44px; padding: 4px 30px 4px 10px; font-size: 13px; border-radius: 10px; }
.bub-foot { display: flex; justify-content: flex-end; align-items: center; gap: 6px; font-size: 11.5px; color: var(--vp-muted); font-variant-numeric: tabular-nums; }
.tick-read { color: #7fc3ff; font-weight: 800; }
.tick { color: var(--vp-gold-ink); font-weight: 800; }
.failed { color: var(--vp-danger); font-weight: 650; }
.thread-empty { margin: auto; text-align: center; color: var(--vp-muted); padding: 24px; font-size: 14px; }

/* ---------- composer ---------- */
.composer {
  flex: none; border-top: 1px solid var(--vp-line); background: var(--vp-surface-2);
  padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom));
}
.rec-zone { display: flex; align-items: center; gap: 16px; }
.rec-btn {
  position: relative; width: 76px; height: 76px; flex: none; display: grid; place-items: center; padding: 0;
  border: 0; border-radius: 50%; background: var(--vp-button); color: var(--vp-button-ink);
  box-shadow: inset 0 1px 0 #ffffff38, 0 6px 18px var(--vp-shadow);
  touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  transition: transform .15s ease, background .2s ease;
}
.rec-btn:active { transform: scale(.96); }
.rec-btn:disabled { background: var(--vp-gold-wash); color: var(--vp-dim); box-shadow: none; }
.rec-icon { width: 30px; height: 30px; position: relative; }
.rec-ring { position: absolute; inset: -6px; border-radius: 50%; border: 3px solid transparent; }
.rec-btn.recording { background: var(--vp-rec); color: #fff; }
.rec-btn.recording .rec-ring { border-color: var(--vp-rec); animation: pulse 1.4s ease-out infinite; }
.rec-btn.working .rec-ring { border-color: var(--vp-gold) transparent transparent transparent; animation: spin 1s linear infinite; }
@keyframes pulse { 0% { transform: scale(1); opacity: .9; } 100% { transform: scale(1.28); opacity: 0; } }
.rec-text { flex: 1; min-width: 0; }
.rec-caption { font-size: 17px; font-weight: 750; }
.rec-sub { font-size: 13.5px; color: var(--vp-muted); margin-top: 2px; }
.rec-sub.warn { color: var(--vp-danger); }
.rec-time { font-variant-numeric: tabular-nums; }

.review { display: flex; flex-direction: column; gap: 10px; max-height: min(64dvh, 560px); }
.review-scroll { overflow-y: auto; min-height: 0; flex: 1; padding-bottom: 2px; }
.review .field-label:first-child { margin-top: 0; }
.rv-source { min-height: 84px; }
.rv-lang-label { margin-top: 12px; }
.rv-translation {
  padding: 12px 14px; border-radius: 14px; background: var(--vp-surface); border: 1px solid var(--vp-line);
  font-size: 17px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere;
}
.back-check {
  margin-top: 8px; padding: 8px 11px; border-left: 3px solid var(--vp-gold); border-radius: 0 10px 10px 0;
  background: rgba(208, 163, 75, .08); color: #eed9a8; font-size: 14px; font-style: italic; line-height: 1.45;
}
.back-check b { font-style: normal; font-size: 11px; letter-spacing: .06em; color: var(--vp-gold-ink); }
.back-check:empty { display: none; }
.rv-status { font-size: 13.5px; color: var(--vp-muted); text-align: center; }
#enrol-status { text-align: left; margin-top: 10px; }
.rv-status:empty { display: none; }
.rv-status.err { color: var(--vp-danger); }
.preview { display: flex; align-items: center; gap: 10px; margin-top: 4px; padding: 8px 12px; border-radius: 14px; background: var(--vp-out); border: 1px solid #4d3a26; }
.review-actions { display: flex; flex-direction: column; gap: 8px; flex: none; }
.send-reason { font-size: 13px; color: var(--vp-danger); text-align: center; }
.send-reason:empty { display: none; }
.review-actions .text-btn { align-self: center; }

/* ---------- settings ---------- */
.voice-state { margin-top: 10px; display: flex; align-items: center; gap: 8px; font-weight: 650; }
.voice-state::before { content: ""; width: 12px; height: 12px; clip-path: var(--oct); background: var(--vp-dim); }
.voice-state.ready::before { background: #a9d39b; }
#st-mode { margin-top: 8px; }
#st-mode:empty { display: none; }
.passage {
  margin: 12px 0 0; padding: 14px 16px; border-radius: 14px; background: var(--vp-surface-2); border: 1px solid var(--vp-line);
  font-size: 18px; line-height: 1.6; font-weight: 500; color: var(--vp-ink);
}
.consent { display: flex; gap: 12px; align-items: flex-start; margin: 16px 0 14px; font-size: 14.5px; line-height: 1.45; cursor: pointer; }
.consent input { appearance: none; -webkit-appearance: none; flex: none; width: 26px; height: 26px; margin: 0; border: 2px solid var(--vp-gold); border-radius: 7px; background: var(--vp-surface-2); display: grid; place-items: center; }
.consent input:checked { background: var(--vp-button); }
.consent input:checked::after { content: ""; width: 7px; height: 13px; border: solid var(--vp-button-ink); border-width: 0 3px 3px 0; transform: translateY(-2px) rotate(45deg); }
/* The record button stays in reach while the passage scrolls past. */
.rec-zone-card {
  position: sticky; bottom: calc(-24px - env(safe-area-inset-bottom)); z-index: 2; /* the .pad bottom padding */
  margin: 14px -18px 0; padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
  background: var(--vp-surface); border-top: 1px solid var(--vp-line);
}
#enrol-go { margin-top: 12px; }
.settings .text-btn.danger { align-self: center; }

/* ---------- sheet ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 30; background: #000000a6; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto;
  background: var(--vp-surface); border: 1px solid var(--vp-line); border-bottom: 0; border-radius: 22px 22px 0 0;
  padding: 10px var(--gutter) calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column;
  animation: rise .2s ease-out;
}
.sheet .primary { margin-top: 6px; }
.sheet .text-btn { align-self: center; }
.sheet-grip { width: 44px; height: 5px; border-radius: 3px; background: var(--vp-line); align-self: center; margin-bottom: 12px; }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 600px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 22px; border-bottom: 1px solid var(--vp-line); } }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; top: calc(12px + env(safe-area-inset-top)); transform: translateX(-50%); z-index: 40;
  width: calc(100% - 2 * var(--gutter)); max-width: 528px; padding: 13px 16px; border-radius: 14px;
  background: #2d261d; border: 1px solid var(--vp-frame, #544633); color: var(--vp-ink); font-size: 14.5px; font-weight: 600;
  box-shadow: 0 10px 28px var(--vp-shadow);
  pointer-events: none; /* sits over the header: never swallow a tap on Back */
}
.toast.err { background: var(--vp-danger-bg); border-color: #6b3a30; color: #ffd9cf; }

@media (hover: hover) {
  .row:hover { background: #1b1712; }
  .icon-btn:hover, .mini-btn:hover { background: var(--vp-gold-wash); color: var(--vp-gold-ink); }
  .primary:not(:disabled):hover { background: var(--vp-gold-ink); }
  .add-btn:hover, .secondary:hover { background: var(--vp-gold-wash); }
  .text-btn:hover { color: var(--vp-gold-ink); }
}
@media (max-width: 360px) {
  :root { --gutter: 14px; }
  .rec-btn { width: 66px; height: 66px; }
  .bub { max-width: 94%; }
  .player { min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .rec-btn.recording .rec-ring { border-color: var(--vp-rec); }
}

/* Read by screen readers only (announces new notes without re-reading the thread). */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
