/* Palette and type lifted from the Uizard "FeedBacker" template:
   warm sage ground, cream panels, olive accents, near-black controls.
   https://app.uizard.io/templates/rgRngJGJBocW9Jl5A8LZ/preview
   Philosopher for headings, Inter for everything else. */

:root {
  --sage: #c9c9b0;
  --sage-soft: #e2e2ce;
  --cream: #f4f4ec;
  --white: #fefefe;
  --khaki: #bcb78f;
  --olive: #6b6645;
  --olive-deep: #39361f;
  --ink: #030303;
  --muted: #7f7f7f;
  --danger: #8c3a2b;
  --danger-soft: #f2e2de;

  --r-card: 12px;
  --r-control: 10px;
  --r-pill: 999px;

  --shadow: 0 1px 2px rgba(57, 54, 31, 0.08), 0 8px 24px rgba(57, 54, 31, 0.06);
  --sidebar-w: 264px;

  color-scheme: light;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--sage);
  color: var(--ink);
  font: 400 14px/1.5 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0; }

button, input, textarea, select { font: inherit; color: inherit; }

a { color: var(--olive); }

.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;
}

/* ------------------------------------------------------------- shell */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--cream);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.nav { display: flex; flex-direction: column; gap: 4px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border: 0;
  border-radius: var(--r-control);
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.12s ease;
}

.nav-item:hover { background: var(--sage-soft); }

.nav-item[aria-current="true"] {
  background: var(--sage-soft);
  color: var(--olive-deep);
}

.nav-heading {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 14px;
  margin-bottom: 6px;
}

.book-links { display: flex; flex-direction: column; gap: 2px; }

.book-link {
  display: block;
  padding: 9px 14px;
  border-radius: var(--r-control);
  font-size: 13px;
  color: var(--olive-deep);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.book-link:hover { background: var(--sage-soft); }
.book-link[aria-current="true"] { background: var(--sage-soft); font-weight: 600; }

.sidebar-foot { margin-top: auto; font-size: 11px; color: var(--muted); }
.sidebar-foot p { margin-top: 12px; }

.btn-link {
  border: 0;
  background: none;
  padding: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--olive);
  cursor: pointer;
  text-decoration: underline;
}
.btn-link:hover { color: var(--olive-deep); }

.main { padding: 28px 32px 64px; min-width: 0; max-width: 1240px; width: 100%; }

.topbar { display: none; }

/* ------------------------------------------------------------- pieces */

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.page-head h1 {
  font-family: Philosopher, Georgia, serif;
  font-size: 23px;
  line-height: 1.2;
}

.page-head .sub { margin-top: 6px; font-size: 13px; color: var(--olive-deep); }

.card {
  background: var(--cream);
  border-radius: var(--r-card);
  padding: 20px;
  box-shadow: var(--shadow);
}

.card + .card,
.card + .panel,
.panel + .card,
.panel + .panel { margin-top: 16px; }

.card h2 {
  font-size: 16px;
  margin-bottom: 4px;
}

.card .hint { font-size: 12px; color: var(--muted); }

/* Every photo that failed, with what was tried -- one line each beats a single
   line standing in for the lot when only one of twenty is misbehaving. */
.card .reasons { list-style: none; margin: 4px 0 0; padding: 0; }

.card .reasons li {
  font-size: 12px;
  line-height: 1.5;
  color: var(--olive-deep);
  padding: 7px 10px;
  border-left: 3px solid var(--danger);
  background: var(--danger-soft);
  border-radius: 0 6px 6px 0;
  overflow-wrap: anywhere;
}

.card .reasons li + li { margin-top: 6px; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  background: var(--white);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.08s ease, background 0.12s ease, border-color 0.12s ease;
}

.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn:focus-visible { outline: 2px solid var(--olive); outline-offset: 2px; }

.btn-primary { background: var(--ink); color: var(--cream); }
.btn-primary:not(:disabled):hover { background: #232318; }

.btn-secondary { background: var(--white); border-color: var(--khaki); color: var(--olive-deep); }
.btn-secondary:not(:disabled):hover { background: var(--sage-soft); }

.btn-ghost { background: transparent; color: var(--olive); padding: 8px 12px; }
.btn-ghost:not(:disabled):hover { background: var(--sage-soft); }

.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:not(:disabled):hover { background: #ebd2cc; }

.btn-lg { padding: 14px 24px; font-size: 14px; }
.btn-sm { padding: 7px 12px; font-size: 12px; }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--olive);
  cursor: pointer;
}
.btn-icon:not(:disabled):hover { background: var(--sage-soft); }

/* A bare icon among four other bare icons is not something anyone finds. One
   that says what it does, in the colour of what it does, is. */
.btn-icon.labelled {
  width: auto;
  gap: 5px;
  padding: 7px 11px 7px 8px;
  font-size: 12px;
  font-weight: 600;
}

.btn-icon.danger { color: var(--danger); background: var(--danger-soft); }
.btn-icon.danger:not(:disabled):hover { background: var(--danger); color: var(--cream); }

/* ------------------------------------------------------------- forms */

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12px; font-weight: 600; margin-bottom: 6px; }

.input, .select, .textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--khaki);
  border-radius: var(--r-control);
  background: var(--white);
  font-size: 14px;
}

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--olive);
  box-shadow: 0 0 0 3px rgba(107, 102, 69, 0.15);
}

.textarea { min-height: 200px; resize: vertical; line-height: 1.6; }

/* ------------------------------------------------------------- library */

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.book-card {
  display: block;
  background: var(--cream);
  border-radius: var(--r-card);
  padding: 20px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform 0.1s ease;
}

.book-card:hover { transform: translateY(-2px); }

.book-card h3 {
  font-family: Philosopher, Georgia, serif;
  font-size: 17px;
  margin-bottom: 8px;
  overflow-wrap: anywhere;
}

.book-card .meta { font-size: 12px; color: var(--olive-deep); }

.bar {
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--sage-soft);
  overflow: hidden;
  margin-top: 12px;
}

.bar > i { display: block; height: 100%; background: var(--khaki); border-radius: inherit; }

/* ------------------------------------------------------------- pages */

.page-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.page-card {
  background: var(--cream);
  border-radius: var(--r-card);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.page-card .shot {
  position: relative;
  aspect-ratio: 3 / 4;
  background: var(--sage-soft);
  cursor: zoom-in;
  border: 0;
  padding: 0;
  display: block;
  width: 100%;
}

.page-card .shot img { width: 100%; height: 100%; object-fit: cover; display: block; }

.page-card .no { position: absolute; top: 8px; left: 8px; }

.page-card .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 10px; flex: 1; }

.page-card .chips { display: flex; flex-wrap: wrap; gap: 6px; }

.chip.printed {
  background: transparent;
  border: 1px solid var(--khaki);
  color: var(--olive);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
}

.page-card .preview {
  font-size: 12px;
  line-height: 1.55;
  color: var(--olive-deep);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.4em;
}

.page-card .preview.empty { color: var(--muted); font-style: italic; }
.page-card .row { display: flex; align-items: center; gap: 4px; row-gap: 8px; flex-wrap: wrap; margin-top: auto; }
.page-card .row .spacer { flex: 1; }

.chip {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: var(--sage-soft);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--olive-deep);
}

.chip.done { background: var(--khaki); color: #2c2a15; }
.chip.working { background: var(--ink); color: var(--cream); }
.chip.error { background: var(--danger-soft); color: var(--danger); }
.chip.solid { background: var(--white); }

.chip .dot {
  width: 6px; height: 6px; border-radius: 50%; background: currentColor;
  animation: pulse 1.1s ease-in-out infinite;
}

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

@media (prefers-reduced-motion: reduce) {
  .chip .dot { animation: none; }
  .book-card:hover { transform: none; }
}

.page-error { font-size: 12px; color: var(--danger); }

/* ------------------------------------------------------------- reader */

.reader {
  background: var(--white);
  border-radius: var(--r-card);
  padding: 28px 30px;
  box-shadow: var(--shadow);
  max-width: 74ch;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 1.7;
  color: var(--olive-deep);
}

.reader .page-rule {
  margin: 26px 0 18px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  border-top: 1px solid var(--sage-soft);
  padding-top: 12px;
}

.reader .page-rule:first-child { margin-top: 0; border-top: 0; padding-top: 0; }

/* ------------------------------------------------------------- empty */

.empty {
  background: var(--cream);
  border-radius: var(--r-card);
  padding: 48px 28px;
  text-align: center;
  box-shadow: var(--shadow);
}

.empty h2 { font-family: Philosopher, Georgia, serif; font-size: 20px; margin-bottom: 8px; }
.empty p { color: var(--olive-deep); max-width: 46ch; margin: 0 auto 20px; }

/* ------------------------------------------------------------- overlays */

.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(57, 54, 31, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

.modal {
  background: var(--cream);
  border-radius: 16px;
  padding: 26px;
  width: min(440px, 100%);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

.modal h2 { font-family: Philosopher, Georgia, serif; font-size: 19px; margin-bottom: 10px; }
.modal p { font-size: 13px; color: var(--olive-deep); margin-bottom: 18px; }
.modal .actions { justify-content: flex-end; }

/* What to actually do about it, set apart from what went wrong. */
.modal .notice-fix {
  background: var(--sage-soft);
  border-left: 3px solid var(--khaki);
  border-radius: 0 8px 8px 0;
  padding: 10px 12px;
  margin-bottom: 18px;
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(3, 3, 3, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 60;
  cursor: zoom-out;
}

.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }

.toast-tray {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 70;
  pointer-events: none;
  width: min(420px, calc(100vw - 32px));
}

.toast {
  background: var(--ink);
  color: var(--cream);
  padding: 12px 18px;
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.toast.bad { background: var(--danger); }

/* ------------------------------------------------------------- mobile */

@media (max-width: 820px) {
  /* The sidebar is hidden here, so the grid is left with two auto rows -- the
     top bar and the content. min-height:100vh then shares the spare height
     between them, which stretched the top bar to several times its size on any
     page short enough to leave space. Pin it to its content and give the rest
     to the page. */
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .sidebar { display: none; }

  .topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--cream);
    padding: 14px 16px;
    position: sticky;
    top: 0;
    z-index: 20;
  }

  .topbar .nav { flex-direction: row; gap: 2px; }
  .topbar .nav-item { padding: 8px 12px; font-size: 13px; }

  .main { padding: 18px 16px 56px; }

  .page-head h1 { font-size: 21px; }
  .page-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

  /* On a phone the cards are too narrow for a labelled button to share a line
     with the arrows, so Delete takes one of its own -- which also makes it a
     good deal easier to hit with a thumb. The spacer goes with it: there is no
     width left to spread, and leaving it in pushes an arrow onto a third line. */
  .page-card .row .spacer { display: none; }

  .page-card .row .btn-icon.labelled {
    flex: 1 0 100%;
    justify-content: center;
    height: 34px;
  }
  .book-grid { grid-template-columns: 1fr; }
  .reader { padding: 20px 18px; }

  .actions .btn { flex: 1 1 auto; }
}

/* ------------------------------------------------------------- sign in */

.gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.gate-card {
  background: var(--cream);
  border-radius: 16px;
  padding: 34px 32px;
  width: min(400px, 100%);
  box-shadow: var(--shadow);
}

.gate-card h1 {
  font-family: Philosopher, Georgia, serif;
  font-size: 24px;
  margin-bottom: 8px;
}

.gate-card > p {
  font-size: 13px;
  color: var(--olive-deep);
  margin-bottom: 22px;
}

.gate-card .btn { width: 100%; }

.gate-error {
  font-size: 13px;
  color: var(--danger);
  background: var(--danger-soft);
  padding: 10px 14px;
  border-radius: var(--r-control);
  margin-bottom: 14px;
}

/* ------------------------------------------------------------- listening */

.player-card {
  background: var(--cream);
  border: 1px solid var(--khaki);
}

.player-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.player-top h2 { font-size: 16px; }
.player-top .hint { margin-top: 4px; }

/* The one control that matters, sized so it is obvious and easy to hit. */
.play {
  flex: none;
  width: 62px;
  height: 62px;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  color: var(--cream);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease;
}

.play svg { width: 26px; height: 26px; }
.play:hover { background: #232318; }
.play:active { transform: scale(0.94); }
.play:focus-visible { outline: 3px solid var(--olive); outline-offset: 3px; }
.play.playing { background: var(--olive); }

/* Play in the middle, ten seconds either way beside it. */
.transport {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.skip {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--olive-deep);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease;
}

.skip svg { width: 28px; height: 28px; }
.skip:hover { background: var(--sage-soft); }
.skip:active { transform: scale(0.92); }
.skip:disabled { opacity: 0.45; cursor: default; }
.skip:focus-visible { outline: 2px solid var(--olive); outline-offset: 2px; }

/* The progress bar is a slider, so it can be dragged as well as watched. The
   played part is painted by --p, which the script keeps up to date. */
.scrub { margin: 16px 0 12px; }

.scrub-bar {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 24px;
  margin: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  touch-action: none;
}

.scrub-bar:focus { outline: none; }

.scrub-bar::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: var(--r-pill);
  background: linear-gradient(to right, var(--khaki) var(--p, 0%), var(--sage-soft) var(--p, 0%));
}

.scrub-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -5px;
  border-radius: 50%;
  border: 2px solid var(--cream);
  background: var(--olive-deep);
  box-shadow: 0 1px 3px rgba(57, 54, 31, 0.3);
  transition: transform 0.1s ease;
}

.scrub-bar::-moz-range-track {
  height: 8px;
  border-radius: var(--r-pill);
  background: linear-gradient(to right, var(--khaki) var(--p, 0%), var(--sage-soft) var(--p, 0%));
}

.scrub-bar::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--cream);
  background: var(--olive-deep);
  box-shadow: 0 1px 3px rgba(57, 54, 31, 0.3);
}

.scrub-bar:hover::-webkit-slider-thumb,
.scrub-bar:active::-webkit-slider-thumb { transform: scale(1.15); }
.scrub-bar:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--olive); outline-offset: 2px; }
.scrub-bar:focus-visible::-moz-range-thumb { outline: 2px solid var(--olive); outline-offset: 2px; }

.scrub-times {
  display: flex;
  justify-content: space-between;
  margin-top: 2px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--olive);
}

/* The passage being spoken, so it can be followed on the page. */
.player-line {
  font-size: 15px;
  line-height: 1.65;
  color: var(--olive-deep);
  min-height: 3.3em;
  margin-bottom: 16px;
  overflow-wrap: anywhere;
}

.player-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.speeds {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--sage-soft);
  border-radius: var(--r-pill);
}

.speed {
  border: 0;
  background: transparent;
  border-radius: var(--r-pill);
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 600;
  color: var(--olive-deep);
  cursor: pointer;
  white-space: nowrap;
}

.speed:hover { background: rgba(254, 254, 254, 0.6); }
.speed.on { background: var(--ink); color: var(--cream); }
.speed:focus-visible { outline: 2px solid var(--olive); outline-offset: 1px; }

.resume {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding: 11px 14px;
  border-radius: var(--r-control);
  background: var(--white);
  font-size: 13px;
  color: var(--olive-deep);
}

/* ------------------------------------------------------------- disclosures */

.panel {
  background: var(--cream);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  list-style: none;
  user-select: none;
}

.panel > summary::-webkit-details-marker { display: none; }
.panel > summary:hover { background: var(--sage-soft); }
.panel > summary:focus-visible { outline: 2px solid var(--olive); outline-offset: -2px; }

.panel > summary > span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.panel > summary .count {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

/* A chevron that turns as the panel opens. */
.panel > summary::after {
  content: '';
  width: 8px;
  height: 8px;
  margin-left: 4px;
  border-right: 2px solid var(--olive);
  border-bottom: 2px solid var(--olive);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
  flex: none;
}

.panel[open] > summary::after { transform: rotate(-135deg); }

.panel-body { padding: 4px 20px 20px; }

@media (prefers-reduced-motion: reduce) {
  .panel > summary::after, .play, .skip, .scrub-bar::-webkit-slider-thumb { transition: none; }
}

@media (max-width: 820px) {
  .play { width: 66px; height: 66px; }
  .skip { width: 48px; height: 48px; }
  .scrub-bar::-webkit-slider-thumb { width: 22px; height: 22px; margin-top: -7px; }
  .scrub-bar::-moz-range-thumb { width: 18px; height: 18px; }
  .player-controls { justify-content: center; }
  .speeds { width: 100%; justify-content: space-between; }
  .speed { flex: 1; padding: 8px 6px; text-align: center; }
  .panel > summary { padding: 14px 16px; }
  .panel-body { padding: 4px 16px 18px; }
}

.book-card .listening {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: var(--sage-soft);
  font-size: 11px;
  font-weight: 600;
  color: var(--olive-deep);
}

.book-card .listening svg { width: 12px; height: 12px; }

/* ------------------------------------------------------------- devices */

.gate-or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--muted);
  font-size: 12px;
}

.gate-or::before, .gate-or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--sage-soft);
}

.devices { list-style: none; margin: 0; padding: 0; }

.devices li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--r-control);
  background: var(--white);
  font-size: 13px;
}

.devices li + li { margin-top: 8px; }
.devices li > span:first-child { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.devices .when { flex: 1; color: var(--muted); font-size: 12px; }

/* ------------------------------------------------------------- speakers */

.speaker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
}

.speaker-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.speaker-row .initials {
  flex: none;
  min-width: 74px;
  font-size: 13px;
  font-weight: 700;
  color: var(--olive-deep);
  font-variant-numeric: tabular-nums;
}

.speaker-row .input { padding: 8px 12px; font-size: 13px; }

.speaker-row .times {
  flex: none;
  min-width: 30px;
  text-align: right;
  font-size: 11px;
  color: var(--muted);
}

.voice-note {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--sage-soft);
  white-space: nowrap;
}

.voice-note:hover { background: var(--sage-soft); color: var(--olive-deep); }

button.voice-note { cursor: pointer; background: var(--white); font-family: inherit; }
button.voice-note:hover { background: var(--sage-soft); color: var(--olive-deep); }
.voice-note.saved { border-color: var(--khaki); color: var(--olive-deep); }
.voice-note svg { width: 11px; height: 11px; vertical-align: -1px; margin-right: 3px; }

.recording {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding: 11px 14px;
  border-radius: var(--r-control);
  background: var(--white);
  font-size: 13px;
  color: var(--olive-deep);
}

.recording > span:first-child { display: inline-flex; align-items: center; gap: 8px; }
.recording svg { flex: none; }
.recording .btn { margin-left: auto; }

/* ------------------------------------------------------------- rapid capture */

/* The camera, full screen and dark, with the shots so far along the bottom. */
.capture {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: #000;
  color: #fff;
  display: flex;
  flex-direction: column;
  font-family: Inter, system-ui, sans-serif;
}

.capture-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
}

.capture-count { font-size: 14px; font-weight: 600; opacity: 0.9; }

.capture-btn {
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-radius: var(--r-pill);
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  min-height: 40px;
}

.capture-btn:disabled { opacity: 0.4; cursor: default; }
.capture-btn.primary { background: var(--cream); color: var(--ink); border-color: var(--cream); }
.capture-btn.danger { background: var(--danger); border-color: var(--danger); }
.capture-btn:focus-visible { outline: 2px solid var(--cream); outline-offset: 2px; }

.capture-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Shown whole rather than cropped: what is on screen is what gets saved. */
.capture-stage video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
}

.capture-flash {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}

.capture-flash.on { animation: capture-flash 0.25s ease-out; }

@keyframes capture-flash {
  from { opacity: 0.85; }
  to { opacity: 0; }
}

.capture-hint {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  margin: 0;
  padding: 7px 14px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.62);
  text-align: center;
  font-size: 14px;
  line-height: 1.4;
  color: #fff;
  pointer-events: none;
}

.capture-hint:empty { display: none; }

.capture-strip {
  display: flex;
  gap: 8px;
  padding: 10px 14px 0;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.capture-strip::-webkit-scrollbar { display: none; }

.capture-thumb {
  position: relative;
  flex: none;
  width: 54px;
  height: 72px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  overflow: hidden;
  background: #222;
  cursor: pointer;
}

.capture-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.capture-thumb span {
  position: absolute;
  left: 4px;
  bottom: 4px;
  min-width: 18px;
  padding: 1px 5px;
  border-radius: var(--r-pill);
  background: rgba(0, 0, 0, 0.7);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.capture-bottom {
  display: flex;
  justify-content: center;
  padding: 14px 0 calc(18px + env(safe-area-inset-bottom));
}

/* The shutter: big, round, unmistakable. */
.capture-shutter {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  border: 4px solid #fff;
  background: transparent;
  padding: 5px;
  cursor: pointer;
  display: flex;
}

.capture-shutter i {
  flex: 1;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.08s ease;
}

.capture-shutter:active i { transform: scale(0.85); }
.capture-shutter:focus-visible { outline: 3px solid var(--cream); outline-offset: 4px; }

.capture-review {
  position: absolute;
  inset: 0;
  background: #000;
  display: flex;
  flex-direction: column;
}

.capture-review img {
  flex: 1;
  min-height: 0;
  width: 100%;
  object-fit: contain;
  padding-top: env(safe-area-inset-top);
}

.capture-review-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px calc(14px + env(safe-area-inset-bottom));
  font-size: 14px;
  font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
  .capture-flash.on { animation: none; }
  .capture-shutter i { transition: none; }
}
