:root {
  --bg: #f6f3ec; --ink: #22211d; --soft: #6b675e; --line: #cfcabc; --box: #fffdf8;
  --accent: #3f5a73; --accent-ink: #fff; --ok: #2f6b3a; --warn: #8a5a14; --bad: #9b2c2c;
  --mark: #fbe9b7; --radius: 10px; --gap: 16px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1a17; --ink: #ece8de; --soft: #a9a397; --line: #45423b; --box: #24231f;
    --accent: #9fbbd4; --accent-ink: #12202c; --ok: #8fcf9a; --warn: #e0b066; --bad: #f19a9a; --mark: #4d4220;
  }
}
:root[data-theme="dark"] {
  --bg: #1b1a17; --ink: #ece8de; --soft: #a9a397; --line: #45423b; --box: #24231f;
  --accent: #9fbbd4; --accent-ink: #12202c; --ok: #8fcf9a; --warn: #e0b066; --bad: #f19a9a; --mark: #4d4220;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.5 var(--sans); }
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; }
h2 { font-size: 22px; margin: 28px 0 10px; }
h3 { font-size: 18px; margin: 18px 0 8px; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 5; }
.brand { text-decoration: none; color: inherit; }
.brand h1 { margin: 0; font-size: 22px; }
.chip { font-size: 13px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--soft); white-space: nowrap; }
body[data-offline="ready"] .chip { color: var(--ok); border-color: var(--ok); }

main { max-width: 860px; margin: 0 auto; padding: 16px 16px 48px; outline: none; }
.lead { font-size: 19px; margin: 8px 0 20px; }
.promise { color: var(--soft); font-size: 15px; margin-top: 28px; }
.foot { max-width: 860px; margin: 0 auto; padding: 16px; font-size: 14px; color: var(--soft); border-top: 1px solid var(--line); }

.choices { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.choice { display: block; text-align: left; background: var(--box); border: 2px solid var(--ink); border-radius: var(--radius); padding: 18px; cursor: pointer; min-height: 120px; }
.choice b { display: block; font-family: var(--serif); font-size: 21px; margin-bottom: 6px; }
.choice span { color: var(--soft); }
.choice:hover, .choice:focus-visible { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }

.list { list-style: none; padding: 0; margin: 0; }
.list li { border-bottom: 1px solid var(--line); }
.list a, .list button.row { display: flex; justify-content: space-between; gap: 12px; padding: 12px 4px; width: 100%; background: none; border: 0; text-align: left; color: inherit; text-decoration: none; cursor: pointer; }
.list .meta { color: var(--soft); font-size: 14px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 16px; border-radius: 8px; border: 1.5px solid var(--ink); background: var(--box); cursor: pointer; font-weight: 600; text-decoration: none; color: var(--ink); }
.btn.main { background: var(--ink); color: var(--bg); }
.btn.quiet { border-color: var(--line); font-weight: 500; }
.btn:disabled { opacity: .5; cursor: default; }
.row-btns { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }

.field { display: grid; gap: 4px; margin: 10px 0; }
.field label { font-weight: 600; font-size: 15px; }
.field input, .field select, .field textarea { padding: 10px; border: 1.5px solid var(--line); border-radius: 8px; background: var(--box); }
.hint { color: var(--soft); font-size: 14px; }

.tabs { display: flex; gap: 4px; border-bottom: 1.5px solid var(--line); margin: 12px 0 16px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 14px; font-weight: 600; color: var(--soft); border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }

.busy { display: grid; gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--box); margin: 12px 0; }
.busy progress { width: 100%; height: 8px; }

.card { background: var(--box); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 12px 0; }
.note { border-left: 4px solid var(--warn); padding: 8px 12px; background: var(--box); border-radius: 4px; }

@media (max-width: 640px) {
  body { font-size: 16px; }
  .choices { grid-template-columns: 1fr; }
}

/* Interview screen */
.person { margin: 4px 0 10px; }
details.card summary { cursor: pointer; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.player { width: 100%; margin: 6px 0; }
.wave { width: 100%; height: 90px; display: block; cursor: pointer; background: var(--box); border: 1px solid var(--line); border-radius: 8px; }
.transcript { margin-top: 12px; }
.para { margin: 0 0 14px; }
.para-head { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.speaker { border: 0; background: none; font-weight: 700; padding: 2px 0; color: var(--ink); max-width: 60%; }
.time { border: 0; background: none; color: var(--soft); font: 13px/1 var(--sans); cursor: pointer; padding: 4px; font-variant-numeric: tabular-nums; }
.time:hover { color: var(--accent); }
.words { margin: 0; font-family: var(--serif); font-size: 18px; line-height: 1.6; }
.seg { border-radius: 3px; outline: none; }
.seg:focus { background: var(--mark); }
.tools { position: sticky; top: 54px; background: var(--bg); padding: 6px 0; z-index: 3; }
.tools .btn[aria-pressed="true"] { border-color: var(--accent); }
.changes { list-style: none; padding: 0; max-height: 40vh; overflow: auto; }
.changes li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.changes label { display: flex; gap: 10px; align-items: flex-start; }
.changes del { color: var(--bad); }
.name-row { display: grid; grid-template-columns: 1fr 2fr; gap: 8px; margin: 6px 0; }
.name-row input, .chapter input, .time-in { padding: 8px; border: 1.5px solid var(--line); border-radius: 8px; background: var(--box); }
.chapters { padding-left: 22px; }
.chapter { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; margin: 6px 0; }
.time-in { width: 7.5em; font-variant-numeric: tabular-nums; }
.check { display: flex; gap: 10px; align-items: center; margin: 8px 0; }
.check input { width: 20px; height: 20px; }
.done { border-color: var(--ok); }

/* The services offer */
.offer { background: var(--box); border: 2px solid var(--ink); border-radius: var(--radius); padding: 18px; margin: 18px 0; }
.offer h3 { font-size: 22px; margin: 0 0 6px; }
.offer .lead { font-size: 17px; margin: 0 0 14px; }
.offer-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.offer-card { border: 1.5px solid var(--line); border-radius: 8px; padding: 12px; }
.offer-card p { margin: 6px 0 0; color: var(--soft); font-size: 15px; }
.offer-card .price { color: var(--ink); font-weight: 700; }
.offer .row-btns .btn { flex: 1 1 200px; }

@media (max-width: 640px) {
  .grid2, .name-row { grid-template-columns: 1fr; }
  .words { font-size: 17px; }
}
.suggestion ins { background: color-mix(in srgb, var(--ok) 20%, transparent); text-decoration: none; }
.suggestion del { color: var(--bad); }

/* Interview mode */
.btn.big { min-height: 56px; font-size: 19px; padding: 10px 28px; }
.rec-bar { display: flex; align-items: center; gap: 14px; position: sticky; top: 54px; background: var(--bg); padding: 8px 0; z-index: 4; }
.rec-dot { color: var(--bad); font-weight: 700; }
.rec-dot::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--bad); margin-right: 6px; animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .rec-dot::before { animation: none; } }
.rec-clock { font-variant-numeric: tabular-nums; font-size: 22px; font-weight: 700; margin-right: auto; }
.qcard { background: var(--box); border: 2px solid var(--ink); border-radius: var(--radius); padding: 16px; margin: 10px 0; }
.qcard .q { font-family: var(--serif); font-size: 24px; line-height: 1.3; margin: 6px 0; }
.qcount { color: var(--soft); font-size: 14px; }
.meters { display: grid; gap: 6px; margin: 10px 0; }
.meter { display: grid; grid-template-columns: 9em 1fr; align-items: center; gap: 8px; font-size: 14px; }
.meter-track { height: 12px; background: var(--line); border-radius: 6px; overflow: hidden; }
.meter-bar { display: block; height: 100%; width: 0; background: var(--ok); transition: width .1s; }
.meter.clip .meter-bar { background: var(--bad); }
.live-words { max-height: 45vh; overflow: auto; font-family: var(--serif); font-size: 18px; line-height: 1.55; border-top: 1px solid var(--line); padding-top: 8px; }
.live-words p { margin: 0 0 8px; }
textarea { width: 100%; padding: 10px; border: 1.5px solid var(--line); border-radius: 8px; background: var(--box); font: inherit; }

/* One page per interview: the big button, the sections, the package */
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.go-box { margin: 14px 0; }
.btn.go { width: 100%; min-height: 64px; font-size: 21px; border-radius: 12px; }
.go-box .hint { margin: 8px 2px 0; }
.run { display: grid; gap: 6px; margin-top: 10px; }
.run:empty { display: none; }
.run progress { width: 100%; height: 10px; }
.run .btn { justify-self: start; }
.package-box { background: var(--box); border: 2px solid var(--ink); border-radius: var(--radius); padding: 14px 16px; margin: 16px 0; }
.package-box h3 { margin: 0 0 8px; }
.package { list-style: none; padding: 0; margin: 0; }
.package li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.package li:last-child { border-bottom: 0; }
.package .file { overflow-wrap: anywhere; }
.package .meta { color: var(--soft); font-size: 14px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sections { display: grid; gap: 8px; margin: 16px 0; }
details.section { background: var(--box); border: 1.5px solid var(--line); border-radius: var(--radius); }
details.section > summary { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 12px 14px; cursor: pointer; list-style: none; min-height: 48px; }
details.section > summary::-webkit-details-marker { display: none; }
details.section > summary b::before { content: "▸"; display: inline-block; width: 1.1em; color: var(--soft); transition: transform .15s; }
details.section[open] > summary b::before { transform: rotate(90deg); }
details.section .sum { color: var(--soft); font-size: 14px; text-align: right; }
.section-body { padding: 0 14px 14px; }
.transcript-box { margin-top: 16px; }
.transcript-box .transcript { padding: 0 14px 14px; }
@media (max-width: 640px) {
  .package li { flex-direction: column; gap: 0; }
  .package .meta { white-space: normal; }
  details.section > summary { flex-wrap: wrap; }
}
details.section, .section-body, .grid2 > *, .field { min-width: 0; }
.field input, .field select, .field textarea { width: 100%; max-width: 100%; min-width: 0; }
.name-row input, .chapter input { min-width: 0; width: 100%; }
