:root {
  --bg: #faf7f2;
  --card: #ffffff;
  --text: #2b2622;
  --muted: #6b625a;
  --line: #e6dfd5;
  --accent: #2f6b4f;
  --accent-ink: #ffffff;
  --rec: #c0392b;
  --warn-bg: #fdf1e7;
  --warn: #9a4a12;
  --ok-bg: #eaf4ee;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 20px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

main { max-width: 640px; margin: 0 auto; padding: 24px 16px 64px; }
main.wide { max-width: 960px; }

h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 8px; }
h2 { font-size: 1.2rem; margin: 32px 0 12px; }
p { margin: 0 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  margin: 16px 0;
}

button, .button {
  font: inherit;
  border: 0;
  border-radius: 14px;
  padding: 14px 22px;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  min-height: 56px;
}
button.secondary { background: transparent; color: var(--accent); border: 2px solid var(--accent); }
button.link { background: none; color: var(--accent); padding: 8px 0; min-height: 0; text-decoration: underline; }
button:disabled { opacity: 0.5; cursor: default; }
button.small-btn { font-size: 0.85rem; padding: 6px 12px; min-height: 0; border-radius: 10px; }

input[type=text], input[type=password], textarea {
  font: inherit;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
}
form.row { display: flex; gap: 8px; }
form.row input { flex: 1; }

.notice { border-radius: 12px; padding: 14px 16px; margin: 16px 0; }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.ok { background: var(--ok-bg); }
.notice.info { background: var(--card); border: 1px solid var(--line); color: var(--muted); }

/* --- recorder --- */
.prompt {
  font-size: 1.5rem;
  line-height: 1.35;
  font-weight: 600;
  margin: 8px 0 4px;
}
.stage { text-align: center; padding: 16px 0; }
.big-btn {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  font-size: 1.4rem;
  font-weight: 700;
  margin: 12px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
}
.big-btn.rec { background: var(--rec); }
.dot { width: 22px; height: 22px; border-radius: 50%; background: #fff; margin-bottom: 8px; }
.square { width: 26px; height: 26px; border-radius: 4px; background: #fff; margin-bottom: 8px; }
.recording .dot { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }
.timer { font-size: 2.2rem; font-variant-numeric: tabular-nums; font-weight: 600; }
.actions { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.actions button { width: 100%; }
audio { width: 100%; margin: 12px 0; }
progress { width: 100%; height: 20px; }

/* --- admin --- */
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.8rem; background: var(--line); }
.badge.transcribed { background: var(--ok-bg); color: var(--accent); }
.badge.failed { background: var(--warn-bg); color: var(--warn); }
.badge.transcribing { background: #e8eef9; color: #2c4f8a; }
.rec-item { border-top: 1px solid var(--line); padding: 16px 0; }
.rec-item:first-child { border-top: 0; }
.rec-meta { font-size: 0.85rem; color: var(--muted); }
.transcript { white-space: pre-wrap; font-size: 0.95rem; background: var(--bg); border-radius: 10px; padding: 12px; margin-top: 8px; }
.link-box { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.75rem; word-break: break-all; }
header.bar { display: flex; justify-content: space-between; align-items: center; }
.story { margin-top: 12px; padding: 12px 14px; border-left: 3px solid var(--accent); }
.story h3 { margin: 0 0 6px; font-size: 1.1rem; }
.story p { line-height: 1.6; }
.badge.check { background: #fff3c4; color: #7a5a00; }
mark.flagged { background: #fff3c4; color: inherit; border-radius: 3px; padding: 0 2px; }
.flag-note { font-size: 0.8rem; color: #7a5a00; margin: -6px 0 10px; }

.answered { margin-top: 2.5rem; text-align: left; }
.answered h2 { font-size: 1.25rem; margin: 0 0 0.25rem; }
.answered ul { list-style: none; padding: 0; margin: 0.75rem 0 0; display: grid; gap: 0.75rem; }
.answered-item {
  display: flex; flex-direction: column; gap: 0.35rem; width: 100%; text-align: left;
  padding: 1rem 1.1rem; border-radius: 14px; border: 1px solid var(--line, #e3ddd3);
  background: var(--card, #fff); color: inherit; font: inherit; cursor: pointer;
}
.answered-item:active { transform: scale(0.99); }
.answered-text { font-size: 1.15rem; line-height: 1.35; }

#prompts li { display: flex; gap: 0.5rem; align-items: flex-start; justify-content: space-between; padding: 0.35rem 0; }
#prompts li.retired .prompt-text { color: var(--muted); text-decoration: line-through; }
.prompt-actions { display: flex; gap: 0.35rem; flex-shrink: 0; }
.small-btn { padding: 0.3rem 0.6rem; font-size: 0.85rem; min-height: 0; }
.prompt-edit { width: 100%; }
.prompt-edit input { flex: 1; }

/* interviewer */
.interviewer-actions { display: grid; gap: 0.6rem; margin-top: 1rem; }
.interviewer-actions button { width: 100%; font-size: 1.1rem; padding: 0.9rem 1rem; }
.read-btn { margin-top: 0.75rem; }
.thinking-line { display: flex; align-items: center; gap: 0.75rem; font-size: 1.2rem; margin-top: 1.5rem; }
.spinner {
  width: 1.4rem; height: 1.4rem; border-radius: 50%; flex-shrink: 0;
  border: 3px solid var(--line, #e6dfd5); border-top-color: var(--accent, #2f6b4f);
  animation: mb-spin 0.9s linear infinite;
}
@keyframes mb-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
/* admin memory panel */
.memory-panel h3 { margin: 1.2rem 0 0.4rem; text-transform: capitalize; }
.memory-item { padding: 0.5rem 0; border-top: 1px solid var(--line, #e6dfd5); }
.memory-item.rejected { opacity: 0.55; text-decoration: line-through; }
.memory-item .quote { font-style: italic; }
.memory-edit { display: grid; gap: 0.4rem; margin-top: 0.4rem; }
.turn { padding: 0.45rem 0; border-top: 1px solid var(--line, #e6dfd5); }
.turn .who { font-weight: 600; }
