:root {
  --bg: #14161a;
  --panel: #1e2127;
  --ink: #e8e9ec;
  --muted: #9aa0aa;
  --accent: #6ea8fe;
  --ok: #4ec38a;
  --fail: #e06c75;
  --border: #2b2f37;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

header, main { max-width: 820px; margin: 0 auto; padding: 0 20px; }
header { padding-top: 32px; padding-bottom: 8px; }
header h1 { margin: 8px 0 4px; font-size: 28px; }
.tagline { color: var(--muted); margin: 0 0 8px; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  margin: 16px 0;
}
.card h2 { margin: 0 0 12px; font-size: 18px; }

.submit-form { display: flex; gap: 8px; flex-wrap: wrap; }
.submit-form input[type=url] {
  flex: 1 1 320px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
}
button {
  padding: 10px 16px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #10131a;
  font-weight: 600;
  cursor: pointer;
}
button.secondary { background: var(--border); color: var(--ink); }
button:hover { filter: brightness(1.08); }

.hint, .empty { color: var(--muted); font-size: 14px; }

.submissions { list-style: none; padding: 0; margin: 0; }
.submissions li {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.submissions li:last-child { border-bottom: 0; }
.submissions .title { display: block; font-weight: 600; }
.submissions .url { display: block; color: var(--muted); font-size: 13px; word-break: break-all; }
.submitted-at { display: block; color: var(--muted); font-size: 13px; }
.failure-reason { border-color: var(--fail); }

.status {
  font-size: 12px; padding: 2px 8px; border-radius: 999px;
  background: var(--border); color: var(--muted); white-space: nowrap;
}
.status-extracted, .status-ok { background: rgba(78,195,138,.15); color: var(--ok); }
.status-extracting { background: rgba(110,168,254,.15); color: var(--accent); }
.status-failed { background: rgba(224,108,117,.15); color: var(--fail); }

.pipeline { margin: 0; padding-left: 20px; }
.pipeline li { margin: 6px 0; }

.readable {
  white-space: pre-wrap; word-wrap: break-word;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 14px; max-height: 340px; overflow: auto; font-size: 14px;
}

/* Freeform submission notes. */
.note-input {
  width: 100%; box-sizing: border-box; resize: vertical;
  padding: 10px 12px; font: inherit; font-size: 14px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--ink);
}
.note-form { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.notes { list-style: none; padding: 0; margin: 0 0 14px; }
.notes li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.notes li:last-child { border-bottom: 0; }
.note-when { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.note-body {
  margin: 0; white-space: pre-wrap; word-wrap: break-word; font: inherit; font-size: 14px;
}

.voice-form { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.voice-form select {
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--ink);
}

.renditions { list-style: none; padding: 0; margin: 0; }
.renditions li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.renditions li:last-child { border-bottom: 0; }
.rendition-head { display: flex; justify-content: space-between; margin-bottom: 6px; }
.rendition-head .voice { font-weight: 600; }
.rendition-head .engine { color: var(--muted); font-size: 13px; }
.rendition-stats { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.audio-total { color: var(--muted); font-size: 14px; margin: 0 0 12px; }
.renditions audio { width: 100%; }

.rendition-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}
.rendition-controls .control-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}
.speed-buttons {
  display: flex;
  gap: 6px;
}
.speed-btn {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  background: var(--border);
  color: var(--ink);
  border: 1px solid transparent;
  transition: all 0.2s ease;
}
.speed-btn:hover {
  background: var(--border);
  border-color: var(--muted);
  filter: none;
}
.speed-btn.active {
  background: var(--accent);
  color: #10131a;
  border-color: var(--accent);
}


.attempts { width: 100%; border-collapse: collapse; font-size: 14px; }
.attempts th, .attempts td { text-align: left; padding: 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.attempts th { color: var(--muted); font-weight: 600; }

/* Transcript revisions, share links, and inline editor. Colors come from the
   dark-theme variables at the top of this file, not hard-coded hex. */
.revision-meta { color: var(--muted); font-size: 13px; margin: 0 0 8px; }

.share-line { font-size: 13px; margin: 8px 0 0; }

.link-btn {
  background: none;
  border: none;
  padding: 0 0 0 8px;
  color: var(--accent);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
}
.link-btn:hover { opacity: .8; }
.link-btn.danger { color: var(--fail); }

.inline-form { display: inline; }

details.synth-disclosure { margin-top: 4px; }
details.synth-disclosure > summary { cursor: pointer; color: var(--muted); font-size: 14px; }

.editor { border-top: 1px solid var(--border); margin-top: 16px; }
.editor h3 { font-size: 15px; margin: 14px 0 6px; }
.cancel-edit { margin-left: 12px; font-size: 13px; }
.edit-link { font-size: 14px; }

.transcript-editor {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  width: 100%;
  margin-bottom: 8px;
}

.revisions { width: 100%; border-collapse: collapse; font-size: 14px; }
.revisions th, .revisions td {
  text-align: left;
  padding: 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.revisions th { color: var(--muted); font-weight: 600; }
.revisions tr.current-revision { background: rgba(110, 168, 254, .06); }
.revision-actions a { margin-right: 10px; }

/* Read-along ("karaoke") player: the transcript's words highlighted in time
   with the recording. Collapsed by default so it never competes with the plain
   transcript above it. */
details.read-along { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
details.read-along > summary { cursor: pointer; color: var(--accent); font-size: 14px; }

.read-along-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 12px 0 8px;
}
.read-along-controls audio { flex: 1 1 260px; min-width: 220px; }
.read-along-follow { color: var(--muted); font-size: 13px; white-space: nowrap; }
.read-along-status { color: var(--muted); font-size: 13px; margin: 0 0 8px; }

.read-along-words {
  max-height: 320px;
  overflow-y: auto;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  line-height: 1.9;
}

.ra-word {
  border-radius: 3px;
  padding: 1px 2px;
  cursor: pointer;
  transition: background-color .12s ease, color .12s ease;
}
.ra-word:hover { background: rgba(110, 168, 254, .15); }
.ra-word:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ra-word.ra-current { background: var(--accent); color: #10131a; }

/* Motion-sensitive readers get the highlight without the crossfade. */
@media (prefers-reduced-motion: reduce) {
  .ra-word { transition: none; }
}

/* Kinetic typography links */
.kinetic-links-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0 12px;
  padding: 8px 12px;
  background: rgba(110, 168, 254, .06);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.kinetic-links-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.kinetic-link-btn {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: var(--card-bg, #1a1e28);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  color: var(--fg, #e6edf3);
  text-decoration: none;
  transition: border-color .15s ease, background-color .15s ease;
}
.kinetic-link-btn:hover {
  border-color: var(--accent);
  background: rgba(110, 168, 254, .12);
  text-decoration: none;
}
.kinetic-link-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.kinetic-callout {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
}
.kinetic-callout a {
  color: var(--accent);
}

