:root {
  --ink: #2b2622;
  --paper: #faf7f4;
  --accent: #b3541e;
  --accent-dark: #8f4115;
  --muted: #6f675f;
  --card: #ffffff;
  --line: #e4dcd4;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
}
main {
  max-width: 40rem;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}
h1 { font-size: 1.6rem; margin: 0 0 0.25rem; }
h2 { font-size: 1.15rem; margin: 0 0 0.5rem; }
.tagline { margin: 0 0 0.5rem; color: var(--muted); }
.privacy-note {
  background: #eef4ea;
  border: 1px solid #cfdfc5;
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  font-size: 0.9rem;
}
section {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem;
  margin-top: 1rem;
}
.passage-picker { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.75rem; }
.passage-picker label { font-weight: 600; font-size: 0.9rem; }
select {
  flex: 1;
  font-size: 1rem;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
}
.passage-text { font-size: 1.15rem; margin: 0; }
.recorder-row { display: flex; align-items: center; gap: 1rem; }
#record-btn {
  font-size: 1.05rem;
  font-weight: 600;
  padding: 0.7rem 1.4rem;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  min-height: 48px;
}
#record-btn:hover { background: var(--accent-dark); }
#record-btn.recording { background: #b3261e; }
#timer { font-variant-numeric: tabular-nums; font-size: 1.1rem; }
.level-wrap {
  margin-top: 0.75rem;
  height: 8px;
  background: var(--line);
  border-radius: 4px;
  overflow: hidden;
}
#level-bar { height: 100%; width: 0%; background: var(--accent); transition: width 80ms linear; }
.status { min-height: 1.2em; color: var(--muted); font-size: 0.9rem; margin: 0.5rem 0 0; }
.hint { color: var(--muted); font-size: 0.9rem; }
#takes-list { list-style: none; margin: 0; padding: 0; }
.take {
  border-top: 1px solid var(--line);
  padding: 0.75rem 0;
}
.take:first-child { border-top: none; }
.take-name { font-weight: 600; font-size: 0.95rem; }
.take audio { width: 100%; margin: 0.5rem 0; }
.take textarea {
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.5rem;
  background: var(--paper);
  color: var(--ink);
  resize: vertical;
}
.take .row { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
button.delete {
  background: none;
  border: none;
  color: #b3261e;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.25rem 0.5rem;
  min-height: 44px;
}
button.secondary {
  background: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.6rem 1rem;
  font-size: 0.95rem;
  cursor: pointer;
  color: var(--muted);
  min-height: 48px;
}
footer { margin-top: 1.5rem; color: var(--muted); font-size: 0.85rem; }

/* upload */
#upload { margin: 1rem 0; }
.upload-label { display: block; font-weight: 600; margin-bottom: 0.35rem; }
#upload input[type="file"] { font-size: 0.95rem; }

/* experimental analysis */
button.analyze { margin-top: 0.4rem; font-size: 0.85rem; }
.analysis-panel { margin-top: 0.5rem; padding: 0.6rem 0.8rem; border: 1px dashed #b08968; border-radius: 8px; font-size: 0.9rem; }
.analysis-panel:empty { display: none; }
.analysis-disclaimer { font-style: italic; color: #6b5844; margin: 0 0 0.4rem; }
.analysis-panel ul { margin: 0; padding-left: 1.1rem; }

/* keep the passage picker inside its card on narrow screens */
.passage-picker { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.passage-picker label { flex: 0 0 auto; }
.passage-picker select { flex: 1 1 auto; min-width: 0; max-width: 100%; }
.take .row .take-name { overflow-wrap: anywhere; }
