:root {
  --bg: #f3f5f4;
  --surface: #ffffff;
  --text: #1c2a2e;
  --muted: #5d6c70;
  --line: #d9e0de;
  --accent: #1f6b5c;
  --vote: #c0632b;
  --vote-soft: rgba(192, 99, 43, 0.08);
  --ok: #2d7a3e;
  --error: #a3341f;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121a1c;
    --surface: #1a2427;
    --text: #e4ecea;
    --muted: #93a4a6;
    --line: #2c3a3e;
    --accent: #7cc7b4;
    --vote: #f0a46f;
    --vote-soft: rgba(240, 164, 111, 0.1);
    --ok: #7fd18f;
    --error: #f39a82;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 "IBM Plex Sans", system-ui, sans-serif;
}
.wrap { max-width: 760px; margin: 0 auto; padding: 40px 16px 64px; }
h1, h2 { font-family: "Young Serif", Georgia, serif; font-weight: 400; margin: 0; }
h1 { font-size: clamp(1.7rem, 6vw, 2.4rem); line-height: 1.15; margin-bottom: 20px; }
h2 { font-size: 1.25rem; }
.eyebrow, .mono, .count, label, .section-head, .rank, .tabs button, .slot, .chip {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}
.eyebrow { font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 0.8rem; }
.intro { margin: 0 0 20px; max-width: 64ch; }
.hint { font-size: 0.85rem; color: var(--muted); margin: 6px 0 0; }
.hint:empty { display: none; }
.error { color: var(--error); font-size: 0.9rem; margin: 8px 0 0; }
.error:empty { display: none; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 24px;
}
.narrow { max-width: 420px; }

label { display: block; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 0 0 6px; }
label .muted { text-transform: none; letter-spacing: 0; font-family: "IBM Plex Sans", system-ui, sans-serif; }
label.spaced { margin-top: 14px; }
input, select, textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 11px;
}
input[type="file"] { padding: 7px; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { resize: vertical; line-height: 1.55; }
button { font: inherit; cursor: pointer; }
button.primary {
  margin-top: 14px;
  background: var(--accent);
  color: var(--bg);
  border: 0;
  border-radius: 6px;
  padding: 9px 18px;
  font-weight: 600;
}
button.primary:disabled { opacity: 0.55; cursor: default; }
button.secondary {
  background: none; color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 9px 14px;
}
button.link { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .row { grid-template-columns: 1fr; } }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.row-between select { width: auto; max-width: 100%; }
.row-between .primary { margin-top: 0; }

/* Tabs */
.tabs { display: flex; border-bottom: 1px solid var(--line); margin-bottom: 20px; gap: 4px; }
.tabs button {
  background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted);
  padding: 8px 12px; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: -1px;
}
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }

/* Persona chips */
.persona-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.chip {
  background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 12px; font-size: 0.8rem;
}
.chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--bg); }
.chip .mark { margin-left: 6px; }
.chip.done .mark { color: var(--ok); }
.chip[aria-pressed="true"] .mark { color: inherit; }
.chip.unsaved .mark { color: var(--vote); }

.persona-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.slots { display: flex; gap: 6px; flex-wrap: wrap; }
.slot { font-size: 0.72rem; border: 1px solid var(--vote); color: var(--vote); border-radius: 4px; padding: 2px 7px; }
.slot.on { background: var(--vote); color: var(--bg); }
#slot-hint { margin-bottom: 4px; }

/* Questions */
#sections { margin: 12px 0 32px; }
.section-head { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent); margin: 22px 0 8px; display: flex; justify-content: space-between; gap: 8px; }
.section-head .count { color: var(--muted); text-transform: none; letter-spacing: 0; }
.question {
  display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left; color: inherit;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 11px 14px; margin-bottom: 8px;
}
.question.voted { border-color: var(--vote); background: var(--vote-soft); }
.question:disabled { cursor: not-allowed; opacity: 0.5; }
.dot { flex: none; width: 18px; height: 18px; margin-top: 2px; border-radius: 50%; border: 2px solid var(--vote); }
.voted .dot { background: var(--vote); }

/* Sticky save bar */
#tab-vote { padding-bottom: 72px; }
.submit-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  max-width: 760px; margin: 0 auto; padding: 12px 16px;
  background: var(--surface); border: 1px solid var(--line); border-bottom: 0;
  border-radius: 10px 10px 0 0; box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
}
.submit-bar .mono { font-size: 0.82rem; }
.submit-bar .primary { margin-top: 0; flex: none; }

/* Results */
.progress-scroll { overflow-x: auto; margin-top: 12px; }
.progress { border-collapse: collapse; width: 100%; font-size: 0.85rem; }
.progress th, .progress td { padding: 6px 8px; text-align: center; border-top: 1px solid var(--line); }
.progress th { font-family: "IBM Plex Mono", monospace; font-weight: 400; color: var(--muted); font-size: 0.72rem; }
.progress td:first-child, .progress th:first-child { text-align: left; }
.progress .yes { color: var(--ok); font-weight: 600; }
.progress .no { color: var(--muted); }
.result-card h2 { margin-bottom: 12px; }
.top-list { list-style: none; margin: 0; padding: 0; }
.top-list li { padding: 10px 0; border-top: 1px solid var(--line); }
.top-list li:first-child { border-top: 0; }
.top-list .section-label { font-family: "IBM Plex Mono", monospace; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--accent); }
.top-list .q { display: block; margin: 2px 0; }
.top-list .count { font-size: 0.8rem; color: var(--vote); font-family: "IBM Plex Mono", monospace; }
.tie { font-size: 0.82rem; color: var(--muted); font-style: italic; margin-top: 4px; }
details.all-votes { margin-top: 12px; font-size: 0.9rem; }
details.all-votes summary { cursor: pointer; color: var(--accent); }
details.all-votes ul { padding-left: 18px; margin: 8px 0 0; }
details.all-votes li { margin-bottom: 6px; }
details.all-votes .who { color: var(--muted); font-size: 0.8rem; }

/* Interviews */
.audio-box { margin-top: 14px; padding: 12px; border: 1px dashed var(--line); border-radius: 8px; }
.progress-bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 10px; }
.progress-bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.3s; }
.form-actions { display: flex; gap: 8px; align-items: center; }
.form-actions .secondary { margin-top: 14px; }
#interview-list { margin-top: 20px; }
.interview h3 { font-family: "Young Serif", Georgia, serif; font-weight: 400; font-size: 1.1rem; margin: 2px 0 4px; }
.interview .persona-tag { font-family: "IBM Plex Mono", monospace; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--accent); }
.interview .meta { font-size: 0.85rem; color: var(--muted); }
.interview .transcript { white-space: pre-wrap; font-size: 0.92rem; margin: 10px 0 0; max-height: 9.5em; overflow: hidden; position: relative; }
.interview .transcript.open { max-height: none; }
.interview .actions { display: flex; gap: 14px; margin-top: 10px; font-size: 0.85rem; flex-wrap: wrap; }
.interview .actions .danger.confirm { color: var(--error); font-weight: 600; }
.empty { color: var(--muted); }

footer { font-size: 0.85rem; line-height: 1.7; margin-top: 24px; }
