/* Navi — a fairy-guide fantasy theme. Phone-first.
 *
 * Light: sunlit parchment with forest green and gold trim.
 * Dark:  a moonlit forest where the fairy's blue glow does the lighting.
 * Everything is CSS (no images or web fonts), so it works offline.
 */

:root {
  --bg: #efe5cc;
  --bg-glow: #f8f0db;
  --surface: #fbf5e6;
  --surface-2: #e9dcbb;
  --text: #2b2416;
  --muted: #6e6248;
  --border: #c9b27a;
  --gold: #b08a2e;
  --gold-soft: #d8bf74;
  --accent: #2f6b3f;          /* forest green */
  --accent-text: #fbf5e6;
  --fairy: #6fd3ff;           /* the guide's glow */
  --fairy-core: #ffffff;
  --alert: #ff7aa8;           /* glow while recording */
  --danger: #a8323e;
  --record: #c2364a;
  --ok: #2f8f46;
  --warn: #b85c12;
  --shadow: 0 1px 0 rgba(255, 255, 255, .6) inset, 0 2px 10px rgba(80, 60, 20, .12);
  --radius: 12px;
  --title-font: "Palatino Linotype", "Book Antiqua", Palatino, "URW Palladio L", Georgia, serif;
  --dialog-bg: rgba(14, 22, 40, .92);
  --dialog-text: #f3f6ff;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1420; --bg-glow: #12263a; --surface: #13202f; --surface-2: #1b2c3f;
    --text: #e7eef7; --muted: #93a4b8; --border: #2d4660; --gold: #d6b35a; --gold-soft: #8a7440;
    --accent: #6fd3ff; --accent-text: #06121d; --danger: #ff7a8a; --record: #ff5f7e;
    --ok: #7be495; --warn: #ffb057; --shadow: 0 4px 18px rgba(0, 0, 0, .35);
    --dialog-bg: rgba(8, 14, 28, .94); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1420; --bg-glow: #12263a; --surface: #13202f; --surface-2: #1b2c3f;
  --text: #e7eef7; --muted: #93a4b8; --border: #2d4660; --gold: #d6b35a; --gold-soft: #8a7440;
  --accent: #6fd3ff; --accent-text: #06121d; --danger: #ff7a8a; --record: #ff5f7e;
  --ok: #7be495; --warn: #ffb057; --shadow: 0 4px 18px rgba(0, 0, 0, .35);
  --dialog-bg: rgba(8, 14, 28, .94); color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 50% -10%, var(--bg-glow), transparent 70%),
    radial-gradient(800px 500px at 100% 100%, color-mix(in srgb, var(--fairy) 8%, transparent), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { font-family: var(--title-font); line-height: 1.25; margin: 0 0 .5rem; letter-spacing: .01em; }
h1 { font-size: 1.6rem; }
h2 {
  font-size: 1.12rem; color: var(--gold);
  display: flex; align-items: center; gap: .5rem;
}
h2::before { content: "◆"; font-size: .6em; color: var(--gold); opacity: .8; }
p { margin: 0 0 .75rem; }
[hidden] { display: none !important; }

.container { max-width: 760px; margin: 0 auto; padding: 1rem; position: relative; z-index: 1; }

/* -- Drifting motes of light (decorative) ------------------------------ */
.motes { position: fixed; inset: 0; display: none; pointer-events: none; z-index: 0; overflow: hidden; }
.motes span {
  position: absolute; bottom: -10px; width: 4px; height: 4px; border-radius: 50%;
  background: var(--fairy); box-shadow: 0 0 8px 2px color-mix(in srgb, var(--fairy) 70%, transparent);
  opacity: 0; animation: drift 18s linear infinite;
}
.motes span:nth-child(1) { left: 8%;  animation-delay: 0s; }
.motes span:nth-child(2) { left: 22%; animation-delay: 6s;  animation-duration: 22s; }
.motes span:nth-child(3) { left: 41%; animation-delay: 11s; }
.motes span:nth-child(4) { left: 63%; animation-delay: 3s;  animation-duration: 25s; }
.motes span:nth-child(5) { left: 79%; animation-delay: 14s; }
.motes span:nth-child(6) { left: 92%; animation-delay: 8s;  animation-duration: 20s; }
@keyframes drift {
  0%   { transform: translate(0, 0); opacity: 0; }
  10%  { opacity: .55; }
  50%  { transform: translate(30px, -50vh); }
  90%  { opacity: .4; }
  100% { transform: translate(-20px, -105vh); opacity: 0; }
}
/* Motes only drift at night. */
.motes { display: none; }
:root[data-theme="dark"] .motes { display: block; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .motes { display: block; } }

/* -- The fairy --------------------------------------------------------- */
.fairy {
  --size: 22px;
  position: relative; display: inline-block; width: var(--size); height: var(--size);
  animation: hover 3.2s ease-in-out infinite; vertical-align: middle;
}
.fairy .orb {
  position: absolute; inset: 22%; border-radius: 50%;
  background: radial-gradient(circle at 40% 38%, var(--fairy-core) 0 22%, var(--fairy) 55%, color-mix(in srgb, var(--fairy) 0%, transparent) 75%);
  box-shadow: 0 0 calc(var(--size) * .35) calc(var(--size) * .12) color-mix(in srgb, var(--fairy) 75%, transparent),
              0 0 calc(var(--size) * .9) calc(var(--size) * .2) color-mix(in srgb, var(--fairy) 35%, transparent);
  animation: glow 2.4s ease-in-out infinite;
}
.fairy .wing {
  position: absolute; top: 2%; width: 44%; height: 50%; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: linear-gradient(180deg, rgba(255, 255, 255, .85), color-mix(in srgb, var(--fairy) 45%, transparent));
  border: 1px solid rgba(255, 255, 255, .7); opacity: .8;
  animation: flap .22s ease-in-out infinite alternate;
}
.fairy .wing.l { left: -6%;  transform-origin: 100% 100%; transform: rotate(-28deg); }
.fairy .wing.r { right: -6%; transform-origin: 0% 100%;   transform: rotate(28deg); animation-name: flap-r; }
@keyframes flap   { from { transform: rotate(-28deg) scaleX(1); } to { transform: rotate(-12deg) scaleX(.55); } }
@keyframes flap-r { from { transform: rotate(28deg) scaleX(1); }  to { transform: rotate(12deg) scaleX(.55); } }
@keyframes hover  { 0%, 100% { transform: translate(0, 0); } 30% { transform: translate(2px, -3px); } 65% { transform: translate(-2px, 1px); } }
@keyframes glow   { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.25); } }

/* -- Top bar ----------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .55rem 1rem; padding-top: calc(.55rem + env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--gold) 35%, transparent);
}
.brand {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--title-font); font-weight: 700; font-size: 1.35rem; letter-spacing: .06em;
  color: var(--text);
}
.brand .fairy { --size: 26px; }
.nav { display: flex; gap: .2rem; }
.nav a {
  padding: .35rem .7rem; border-radius: 999px; color: var(--muted); font-weight: 600; font-size: .95rem;
  border: 1px solid transparent;
}
.nav a.active {
  color: var(--text); background: var(--surface);
  border-color: color-mix(in srgb, var(--gold) 55%, transparent);
  box-shadow: 0 0 10px color-mix(in srgb, var(--fairy) 25%, transparent);
}

.banner { background: var(--warn); color: #fff; text-align: center; padding: .4rem 1rem; font-size: .9rem; position: relative; z-index: 2; }

/* -- Cards: framed panels with a thin gold inner line ------------------ */
.card {
  position: relative;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem; margin-bottom: 1rem;
  box-shadow: var(--shadow), inset 0 0 0 3px var(--surface), inset 0 0 0 4px color-mix(in srgb, var(--gold) 30%, transparent);
}
.stack > * + * { margin-top: .75rem; }
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .3rem; }
.hint { color: var(--muted); font-size: .85rem; }
input[type="text"], input[type="password"], input[type="search"], input[type="date"], select, textarea {
  width: 100%; font: inherit; color: var(--text);
  background: color-mix(in srgb, var(--surface) 70%, var(--bg));
  border: 1px solid var(--border); border-radius: 10px; padding: .65rem .8rem; min-height: 44px;
}
input:focus, select:focus, textarea:focus, button:focus-visible {
  outline: 2px solid var(--fairy); outline-offset: 1px;
  box-shadow: 0 0 12px color-mix(in srgb, var(--fairy) 45%, transparent);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: inherit; font-weight: 600; min-height: 44px; padding: .55rem 1rem;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  cursor: pointer; transition: box-shadow .15s, transform .05s;
}
.btn:hover:not(:disabled) { box-shadow: 0 0 0 1px var(--gold-soft), 0 0 12px color-mix(in srgb, var(--fairy) 25%, transparent); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 85%, #fff), var(--accent));
  border-color: color-mix(in srgb, var(--gold) 70%, var(--accent)); color: var(--accent-text);
}
.btn.danger { color: var(--danger); }
.btn.block { width: 100%; }
.btn.small { min-height: 36px; padding: .3rem .75rem; font-size: .9rem; }
.row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }
.error-text { color: var(--danger); font-size: .9rem; }

.segmented { display: flex; background: var(--surface-2); border-radius: 10px; padding: 3px; border: 1px solid var(--border); }
.segmented button {
  flex: 1; font: inherit; border: 0; background: transparent; color: var(--muted);
  min-height: 38px; border-radius: 8px; cursor: pointer;
}
.segmented button[aria-pressed="true"] {
  background: var(--surface); color: var(--text); font-weight: 600;
  box-shadow: 0 0 0 1px var(--gold-soft), 0 0 10px color-mix(in srgb, var(--fairy) 25%, transparent);
}

/* -- Auth screens ------------------------------------------------------ */
.auth { max-width: 400px; margin: 8vh auto 0; }
.auth .crest { display: flex; justify-content: center; margin-bottom: .5rem; }
.auth .crest .fairy { --size: 64px; }
.auth h1 { text-align: center; font-size: 2.2rem; letter-spacing: .08em; }
.auth .lead { text-align: center; color: var(--muted); font-style: italic; }

/* -- Recorder: the fairy lives in the record button ------------------- */
.recorder { text-align: center; padding: 1.5rem 1rem 1.25rem; }
.record-btn {
  position: relative;
  width: 140px; height: 140px; border-radius: 50%; cursor: pointer;
  border: 2px solid color-mix(in srgb, var(--gold) 70%, transparent);
  background:
    radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--fairy) 30%, transparent), transparent 62%),
    radial-gradient(circle, #1a3350 0%, #0c1726 100%);
  color: #eaf6ff; font: inherit; font-weight: 700; font-size: 1rem; letter-spacing: .06em; text-transform: uppercase;
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--surface) 80%, transparent),
              0 0 0 6px color-mix(in srgb, var(--gold) 40%, transparent),
              0 8px 26px color-mix(in srgb, var(--fairy) 30%, transparent);
  display: inline-flex; align-items: center; justify-content: center; flex-direction: column; gap: .5rem;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: box-shadow .3s;
}
.record-btn:hover:not(:disabled) {
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--surface) 80%, transparent),
              0 0 0 6px var(--gold-soft),
              0 8px 34px color-mix(in srgb, var(--fairy) 50%, transparent);
}
.record-btn .dot { /* the fairy */
  --size: 52px; --fairy: #6fd3ff;
  position: relative; width: var(--size); height: var(--size);
  animation: hover 3.2s ease-in-out infinite;
}
.record-btn .dot::before { /* orb */
  content: ""; position: absolute; inset: 24%; border-radius: 50%;
  background: radial-gradient(circle at 40% 38%, #fff 0 22%, var(--fairy) 58%, transparent 76%);
  box-shadow: 0 0 18px 6px color-mix(in srgb, var(--fairy) 70%, transparent),
              0 0 44px 12px color-mix(in srgb, var(--fairy) 30%, transparent);
  animation: glow 2.4s ease-in-out infinite;
}
.record-btn .dot::after { /* wings */
  content: ""; position: absolute; inset: 0 -14% 40%;
  background:
    radial-gradient(ellipse 30% 46% at 24% 50%, rgba(255, 255, 255, .75), transparent 72%),
    radial-gradient(ellipse 30% 46% at 76% 50%, rgba(255, 255, 255, .75), transparent 72%);
  animation: wings .24s ease-in-out infinite alternate;
}
@keyframes wings { from { transform: scaleX(1); } to { transform: scaleX(.6); } }
.record-btn.recording { border-color: var(--alert); }
.record-btn.recording .dot { --fairy: var(--alert); }
.record-btn.recording .dot::after { animation-duration: .12s; }
.record-btn.recording { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--surface) 80%, transparent), 0 0 0 6px var(--alert), 0 0 0 6px color-mix(in srgb, var(--alert) 45%, transparent); }
  50%      { box-shadow: 0 0 0 5px color-mix(in srgb, var(--surface) 80%, transparent), 0 0 0 6px var(--alert), 0 0 0 24px color-mix(in srgb, var(--alert) 0%, transparent); }
}
.record-btn:disabled { opacity: .7; cursor: default; }
.timer { font-family: var(--title-font); font-variant-numeric: tabular-nums; font-size: 1.7rem; font-weight: 600; margin-top: .75rem; color: var(--gold); }
.recorder .hint { margin-top: .35rem; font-style: italic; }
.progress { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-top: .75rem; border: 1px solid var(--border); }
.progress > div {
  height: 100%; width: 0; transition: width .2s;
  background: linear-gradient(90deg, color-mix(in srgb, var(--fairy) 60%, var(--accent)), var(--fairy));
  box-shadow: 0 0 10px var(--fairy);
}

/* -- Note list --------------------------------------------------------- */
.search { position: sticky; top: 58px; z-index: 5; padding: .25rem 0 .75rem; background: transparent; }
.search input { backdrop-filter: blur(6px); background: color-mix(in srgb, var(--surface) 88%, transparent); }
.search-row { display: flex; gap: .5rem; align-items: center; }
.search-row input { flex: 1; min-width: 0; }
.filter-toggle { min-height: 44px; white-space: nowrap; }
.filter-toggle.active { border-color: var(--fairy); box-shadow: 0 0 10px color-mix(in srgb, var(--fairy) 35%, transparent); }
.filters {
  display: grid; grid-template-columns: 1fr 1fr; gap: .6rem .75rem; margin-top: .6rem; padding: .85rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.filters > div { min-width: 0; }
.filters label { font-size: .8rem; margin-bottom: .2rem; color: var(--muted); }
.filters select, .filters input { min-height: 40px; padding: .45rem .6rem; }
.filters-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
.note-list { list-style: none; padding: 0; margin: 0; }
.note-item a {
  position: relative; display: block; color: inherit; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .85rem 1rem .85rem 1.15rem; margin-bottom: .6rem; box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.note-item a::before { /* gold spine, like a bound page */
  content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--gold-soft), var(--gold));
}
.note-item a:hover {
  border-color: color-mix(in srgb, var(--fairy) 60%, var(--border));
  box-shadow: var(--shadow), 0 0 16px color-mix(in srgb, var(--fairy) 25%, transparent);
}
.note-item a:hover::after { /* the fairy hovers by whatever you point at */
  content: ""; position: absolute; right: 12px; top: 12px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--fairy); box-shadow: 0 0 10px 3px color-mix(in srgb, var(--fairy) 70%, transparent);
  animation: hover 2s ease-in-out infinite;
}
.note-item .title { font-family: var(--title-font); font-weight: 700; font-size: 1.05rem; }
.note-item .meta { color: var(--muted); font-size: .82rem; margin: .1rem 0 .35rem; }
.note-item .overview { color: var(--text); font-size: .93rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 0; }
.note-item .snippet { color: var(--muted); font-size: .85rem; font-style: italic; margin: .3rem 0 0; }
mark { /* search matches: a soft fairy-light highlight */
  color: inherit; padding: 0 .12em; border-radius: 3px;
  background: color-mix(in srgb, var(--fairy) 38%, transparent);
  box-shadow: 0 0 6px color-mix(in srgb, var(--fairy) 45%, transparent);
}
mark.current {
  background: color-mix(in srgb, var(--gold) 55%, transparent);
  box-shadow: 0 0 0 2px var(--gold), 0 0 10px color-mix(in srgb, var(--gold) 60%, transparent);
}
.note-item .overview.snippet { -webkit-line-clamp: 3; }
.preview-label { font-style: normal; font-weight: 600; color: var(--muted); }
.search.find-bar {
  display: flex; align-items: center; gap: .4rem;
  margin: 0 -1rem .75rem; padding: .5rem 1rem;
  background: var(--bg);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}
.find-bar input { flex: 1; min-width: 0; }
.find-bar .btn.small { min-width: 40px; padding: .3rem .5rem; }
.find-count { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; font-style: italic; }

.tags { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .45rem; }
.tag {
  font-size: .78rem; padding: .12rem .55rem; border-radius: 999px;
  background: color-mix(in srgb, var(--gold) 12%, var(--surface)); color: var(--muted);
  border: 1px solid color-mix(in srgb, var(--gold) 35%, transparent); font-family: inherit;
}
button.tag { cursor: pointer; }

.badge { display: inline-block; font-family: system-ui, sans-serif; font-size: .7rem; font-weight: 700; padding: .1rem .5rem; border-radius: 999px; vertical-align: middle; margin-left: .35rem; letter-spacing: .02em; }
.badge.queued { background: var(--surface-2); color: var(--muted); }
.badge.transcribing, .badge.summarizing, .badge.timing {
  background: color-mix(in srgb, var(--fairy) 22%, transparent); color: var(--text);
  box-shadow: 0 0 8px color-mix(in srgb, var(--fairy) 40%, transparent);
  animation: glow 1.6s ease-in-out infinite;
}
.badge.error { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }

/* -- Note detail ------------------------------------------------------- */
.back { display: inline-block; margin-bottom: .5rem; font-weight: 600; }
.detail-title { word-break: break-word; }
audio { width: 100%; margin: .5rem 0; }
.transcript { white-space: pre-wrap; font-size: .97rem; }
.transcript p { margin: 0 0 .8rem; }
/* Timed transcript: one line per spoken segment, its time on the left. */
.transcript.lines { white-space: normal; }
.transcript .line {
  display: grid; grid-template-columns: 3.4rem 1fr; gap: .4rem; align-items: baseline;
  padding: .2rem .4rem; margin: 0 -.4rem; border-radius: 8px; cursor: pointer;
  transition: background-color .2s;
}
.transcript .line.para, .line-edit.para { margin-top: .8rem; }
.transcript .line p { margin: 0; }
@media (hover: hover) { .transcript .line:hover { background: color-mix(in srgb, var(--gold) 10%, transparent); } }
.transcript .line.playing {
  background: color-mix(in srgb, var(--fairy) 20%, transparent);
  box-shadow: inset 3px 0 0 var(--fairy);
}
.ts {
  font: 600 .75rem/1.6 system-ui, sans-serif; font-variant-numeric: tabular-nums; color: var(--muted);
  background: none; border: 0; padding: 0; text-align: left; cursor: pointer; min-height: 0;
}
.transcript .line.playing .ts { color: var(--text); }
.lines-editor { display: flex; flex-direction: column; gap: .3rem; }
.line-edit { display: grid; grid-template-columns: 3.4rem 1fr; gap: .4rem; align-items: start; }
.line-edit .ts { padding-top: .55rem; }
textarea.line-input { resize: none; overflow: hidden; min-height: 0; line-height: 1.5; font-size: .97rem; padding: .35rem .5rem; }
.find-bar .play-toggle { min-width: 40px; }

/* Bible reference chips */
.refs { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .5rem; }
.ref-chip {
  display: inline-flex; align-items: center; gap: .35rem; min-height: 0;
  font: 600 .8rem/1.2 system-ui, sans-serif; color: var(--text); cursor: pointer;
  padding: .3rem .65rem .3rem .5rem; border-radius: 999px;
  background: color-mix(in srgb, var(--fairy) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--fairy) 45%, transparent);
  transition: box-shadow .2s, transform .1s;
}
.ref-chip::before {
  content: ""; width: 15px; height: 15px; flex: none; background: currentColor; opacity: .7;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M2 5.5C5 4.3 8.6 4.6 11 6.6v13c-2.4-1.8-6-2.1-9-.9zM22 5.5c-3-1.2-6.6-.9-9 1.1v13c2.4-1.8 6-2.1 9-.9z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M2 5.5C5 4.3 8.6 4.6 11 6.6v13c-2.4-1.8-6-2.1-9-.9zM22 5.5c-3-1.2-6.6-.9-9 1.1v13c2.4-1.8 6-2.1 9-.9z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.ref-chip:active { transform: scale(.97); }
@media (hover: hover) { .ref-chip:hover { box-shadow: 0 0 10px color-mix(in srgb, var(--fairy) 45%, transparent); } }
.ref-count { font-weight: 500; color: var(--muted); font-size: .72rem; }
.transcript .flash, .transcript p.flash { animation: flash 1.6s ease-out; border-radius: 8px; }
.transcript .ref-spot.flash { animation-duration: 2.4s; border-radius: 4px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
@keyframes flash {
  0%, 30% { background: color-mix(in srgb, var(--gold) 30%, transparent); }
  100% { background: transparent; }
}
.view-toggle {
  display: inline-flex; margin-top: .6rem; padding: 3px; gap: 3px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid color-mix(in srgb, var(--gold) 35%, transparent);
}
.view-toggle button {
  font: 600 .8rem/1 system-ui, sans-serif; padding: .45rem .85rem; min-height: 0; border: 0;
  border-radius: 999px; background: none; color: var(--muted); cursor: pointer;
}
.view-toggle button[aria-pressed="true"] {
  background: var(--surface); color: var(--text);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--gold) 45%, transparent), 0 1px 3px rgb(0 0 0 / .12);
}
textarea.transcript-editor { min-height: 45vh; resize: vertical; line-height: 1.6; font-size: .97rem; }
label.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; cursor: pointer; }
label.check input { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
@media (min-width: 560px) { .actions:not(.two) { grid-template-columns: repeat(4, 1fr); } }
details summary { cursor: pointer; color: var(--muted); font-size: .9rem; }

/* -- Trash ------------------------------------------------------------- */
.trash-item { display: flex; gap: .75rem; align-items: center; }
.trash-item .info { flex: 1; min-width: 0; }
.trash-item .title { font-weight: 600; overflow-wrap: anywhere; }

/* -- Toast: a fairy-guide dialogue box --------------------------------- */
.toast {
  position: fixed; left: 50%; bottom: calc(1.25rem + env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; align-items: center; gap: .65rem;
  background: var(--dialog-bg); color: var(--dialog-text);
  padding: .7rem 1.1rem .7rem .8rem; border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, .85);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .4), 0 6px 24px rgba(0, 0, 0, .35), 0 0 18px color-mix(in srgb, #6fd3ff 30%, transparent);
  max-width: calc(100% - 2rem); z-index: 50; font-size: .95rem;
  animation: toast-in .22s ease-out;
}
.toast::before {
  content: ""; flex: none; width: 12px; height: 12px; border-radius: 50%;
  background: radial-gradient(circle at 40% 38%, #fff 0 25%, #6fd3ff 70%);
  box-shadow: 0 0 10px 3px rgba(111, 211, 255, .7);
  animation: glow 1.4s ease-in-out infinite;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

dl.kv { display: grid; grid-template-columns: auto 1fr; gap: .3rem .9rem; margin: 0; font-size: .92rem; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }
.dot-status { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; margin-right: .35rem; background: var(--muted); }
.dot-status.ok { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.dot-status.bad { background: var(--danger); box-shadow: 0 0 6px var(--danger); }

/* Calm everything down for people who prefer less motion. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .motes { display: none; }
}

/* -- Bible passages ------------------------------------------------------ */
.passage-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .6rem; }
.passage-head h1, .passage-head h2 { margin: 0; }
.passage-panel .btn { margin-top: .75rem; }
.passage-section + .passage-section { margin-top: 1rem; }
.passage-section h3 { margin: 0 0 .4rem; font-family: var(--title-font); font-size: 1.05rem; }
.passage-grid {
  display: grid;
  grid-template-columns: 2.6rem repeat(var(--cols, 1), minmax(12rem, 1fr));
  gap: .35rem .9rem;
  overflow-x: auto;
  font-family: var(--title-font);
  line-height: 1.6;
}
.pg-head { font-weight: 700; color: var(--gold); font-family: system-ui, sans-serif; font-size: .85rem; letter-spacing: .04em;
  border-bottom: 1px solid var(--border); padding-bottom: .2rem; }
.pg-num { color: var(--gold); font-size: .8rem; font-weight: 700; padding-top: .2rem; text-align: right; font-family: system-ui, sans-serif; }
.pg-text.missing, .passage .missing { color: var(--muted); font-style: italic; font-size: .9rem; }
.passage .native { color: var(--muted); font-size: .78rem; font-family: system-ui, sans-serif; }
.passage.stacked .passage-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem 1rem; }
.passage-text { margin: 0 0 .4rem; font-family: var(--title-font); line-height: 1.7; }
.passage-text .vn { color: var(--gold); font-weight: 700; font-size: .68rem; font-family: system-ui, sans-serif; }
.abbr { display: inline-block; font: 700 .72rem/1 system-ui, sans-serif; letter-spacing: .05em; color: var(--accent-text);
  background: var(--accent); border-radius: 6px; padding: .22rem .4rem; vertical-align: .1em; }
.passage-notes-head { margin-top: 1.6rem; font-family: var(--title-font); }
@media (max-width: 560px) {
  .passage-grid { grid-template-columns: 2rem repeat(var(--cols, 1), minmax(78vw, 1fr)); }
  .passage-grid[style="--cols:1"] { grid-template-columns: 2rem 1fr; }
}

/* -- Settings: Bibles ----------------------------------------------------- */
.bible-list { display: grid; gap: .5rem; }
.bible-item { display: flex; gap: .75rem; align-items: center; padding: .5rem 0; border-bottom: 1px dashed var(--border); }
.bible-item:last-child { border-bottom: 0; }
.bible-item .info { flex: 1; min-width: 0; }
.bible-item .title { font-weight: 600; overflow-wrap: anywhere; }
.dropzone {
  display: grid; place-items: center; gap: .2rem; text-align: center; cursor: pointer;
  padding: 1.4rem 1rem; border: 2px dashed var(--gold-soft); border-radius: var(--radius); background: var(--surface-2);
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone:focus-visible, .dropzone.over { border-color: var(--accent); outline: none; }
.dropzone.over { background: color-mix(in srgb, var(--fairy) 14%, var(--surface-2)); }
.dropzone.busy { opacity: .6; cursor: progress; }
.check-box { border: 1px solid var(--border); border-left: 4px solid var(--ok); border-radius: var(--radius); padding: .8rem 1rem; background: var(--surface); }
.check-box.bad { border-left-color: var(--danger); }
.check-box p { margin: .4rem 0; }
.check-box .warn { color: var(--warn); }
.check-box dl.kv { margin: .6rem 0; }
.check-list summary { cursor: pointer; color: var(--muted); font-size: .9rem; }
.check-list p { font-size: .88rem; max-height: 12rem; overflow: auto; }
.bible-fields { display: grid; grid-template-columns: 1fr 9rem; gap: .6rem; }
@media (max-width: 480px) { .bible-fields { grid-template-columns: 1fr; } }
.view-toggle button { white-space: nowrap; }

/* A verse the translation leaves out (Matthew 17:21 in the ESV) */
.passage .omitted { color: var(--muted); font-style: italic; font-size: .92rem; }
.passage .omitted-note { font-style: normal; font-size: .85rem; }
dd.warn { color: var(--warn); font-weight: 600; }
