:root {
  --bg: #f7f4ef;
  --bg-2: #efeae2;
  --surface: #ffffff;
  --surface-2: #faf7f1;
  --border: #e6e1d7;
  --border-strong: #d6cfbf;
  --text: #1c2230;
  --text-2: #424b5c;
  --muted: #7b8294;
  --accent: #0f766e;
  --accent-hover: #0c5d57;
  --accent-soft: #e6f1ef;
  --accent-line: #b9d8d4;
  --danger: #b91c1c;
  --ok: #15803d;
  --rec: #dc2626;
  --rec-hover: #b91c1c;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 1px rgba(15, 23, 42, .03);
  --shadow-md: 0 8px 24px -8px rgba(15, 23, 42, .12), 0 2px 6px -2px rgba(15, 23, 42, .06);
  --shadow-lg: 0 24px 48px -16px rgba(15, 23, 42, .16);
  --radius: 14px;
  --radius-sm: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, system-ui, sans-serif;
  --font-serif: "Iowan Old Style", "Charter", "Source Serif Pro", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background:
    radial-gradient(900px 500px at 80% -10%, rgba(15, 118, 110, 0.06), transparent 60%),
    radial-gradient(700px 400px at 0% 100%, rgba(220, 38, 38, 0.04), transparent 60%),
    var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.wrap { max-width: 720px; margin: 0 auto; padding: 0 1.25rem; }
.flex-between { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.75rem; }

.site-header {
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 0;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: saturate(140%) blur(10px);
  position: sticky; top: 0; z-index: 5;
}
.site-header-inner { align-items: flex-start; }
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 0.2rem; }
.logo {
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
  font-size: 1.05rem;
  display: inline-flex; align-items: center; gap: 0.55rem;
}
.logo::before {
  content: "";
  width: 22px; height: 22px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent), #2aa99d);
  box-shadow: inset 0 -6px 8px rgba(0,0,0,.08);
}
.logo-sub {
  margin: 0;
  padding-left: calc(22px + 0.55rem);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.25;
}
.admin-link { color: var(--muted); text-decoration: none; font-size: 0.9rem; margin-top: 0.15rem; }
.admin-link:hover { color: var(--accent); }
.site-footer { padding: 1.5rem 0 2rem; border-top: 1px solid var(--border); margin-top: 2.5rem; color: var(--muted); }

main { padding: 1.75rem 0 3rem; }

h1 {
  font-size: 2rem; font-weight: 700; margin: 0 0 0.4rem;
  letter-spacing: -0.025em; line-height: 1.2;
}
h2 {
  font-size: 1.35rem; margin: 0 0 0.65rem;
  color: var(--text); font-weight: 700; letter-spacing: -0.015em;
}
h3 { font-size: 1.05rem; margin: 1.25rem 0 0.5rem; color: var(--text); font-weight: 650; }
.lead { font-size: 1.08rem; color: var(--text-2); margin: 0.25rem 0 1rem; }
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }

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

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.6rem 1.7rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-md);
}
.big-card { padding: 1.75rem 1.85rem; }

label { display: block; margin: 0.65rem 0 0.35rem; font-size: 0.95rem; color: var(--text-2); font-weight: 500; }
input, select, textarea {
  width: 100%;
  padding: 0.75rem 0.95rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.78rem 1.4rem;
  border-radius: 12px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: transform .06s ease, background .15s ease, box-shadow .15s ease, color .15s ease, border-color .15s ease;
  user-select: none;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: var(--accent); color: #fff;
  box-shadow: 0 4px 10px -3px rgba(15, 118, 110, .35), inset 0 1px 0 rgba(255,255,255,.18);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost {
  background: var(--surface); color: var(--text-2);
  border-color: var(--border-strong);
}
.btn-ghost:hover { background: var(--bg-2); color: var(--text); border-color: var(--muted); }
.btn-block { display: flex; width: 100%; }
.btn-big { font-size: 1.08rem; padding: 1rem 1.7rem; min-height: 54px; border-radius: 14px; }
.btn-rec {
  background: var(--rec); color: #fff;
  border: none;
  font-size: 1.05rem; padding: 1rem 1.85rem; min-height: 56px; border-radius: 14px;
  box-shadow: 0 6px 14px -4px rgba(220, 38, 38, .35), inset 0 1px 0 rgba(255,255,255,.2);
}
.btn-rec:hover { background: var(--rec-hover); }
.btn-rec::before {
  content: ""; display: inline-block;
  width: 10px; height: 10px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,.25);
  margin-right: .35rem;
}

.error { color: var(--danger); margin-bottom: 0.75rem; }
.ok { color: var(--ok); }

/* Welcome */
.welcome { text-align: center; padding: 1.5rem 0 2rem; }
.welcome h1 { font-size: 2.5rem; }
.welcome-org {
  margin: 0.35rem auto 0;
  max-width: 520px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.01em;
  line-height: 1.35;
}
.welcome .lead { font-size: 1.18rem; max-width: 580px; margin: 0.85rem auto 1.6rem; color: var(--text-2); }
.hero-badges {
  display: flex; justify-content: center; gap: 0.45rem; flex-wrap: wrap;
  margin-bottom: 1.1rem;
}
.hero-badge {
  display: inline-block;
  padding: 0.25rem 0.7rem;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  font-size: 0.78rem; font-weight: 600;
  letter-spacing: 0.02em;
}
.hero-badge-org {
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.12), rgba(15, 118, 110, 0.06));
  border-color: var(--accent);
  color: var(--accent-hover);
  font-weight: 700;
}
.card-eyebrow {
  margin: 0 0 0.85rem; padding: 0;
  font-size: 0.74rem; font-weight: 700;
  color: var(--accent); text-transform: uppercase;
  letter-spacing: 0.08em;
}
.welcome-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.85rem 1.9rem;
  text-align: left;
  max-width: 580px; margin: 0 auto 1.25rem;
  box-shadow: var(--shadow-md);
}
.welcome-card p strong { color: var(--text); }
.big-list {
  font-size: 1.04rem;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.big-list li {
  position: relative;
  padding: 0.45rem 0 0.45rem 2.6rem;
  counter-increment: step;
}
.big-list li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0.4rem;
  width: 1.85rem; height: 1.85rem;
  border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.92rem;
  border: 1px solid var(--accent-line);
}

/* Progress */
.progress-wrap { margin: 0 0 1.5rem; }
.progress-bar {
  height: 6px; width: 100%; background: var(--bg-2);
  border-radius: 999px; overflow: hidden;
  border: 1px solid var(--border);
}
.progress-bar > span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--accent), #2aa99d);
  width: 0%;
  transition: width 0.4s cubic-bezier(.2,.8,.2,1);
  border-radius: 999px;
}
#prog-label { margin: 0.45rem 0 0; font-weight: 500; }

/* Flow */
.flow { padding-bottom: 2rem; }
.actions {
  margin-top: 1.6rem;
  display: flex; gap: 0.6rem; flex-wrap: wrap; justify-content: flex-end;
  align-items: center;
}

/* Big checkbox (consent) */
.big-check {
  display: flex; align-items: center; gap: 0.85rem;
  padding: 1rem 1.1rem;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: 12px; cursor: pointer;
  font-size: 1.02rem; color: var(--text);
  transition: border-color .15s ease, background .15s ease;
}
.big-check:hover { border-color: var(--muted); }
.big-check input { width: 22px; height: 22px; accent-color: var(--accent); flex: 0 0 auto; }

/* Profile question + radio-card style */
.profile-form { display: flex; flex-direction: column; gap: 1.4rem; margin-top: 0.5rem; }
.profile-q .q-text {
  font-size: 1.05rem; margin-bottom: 0.65rem;
  color: var(--text); font-weight: 650;
  letter-spacing: -0.005em;
}
.q-opts { display: flex; flex-direction: column; gap: 0.55rem; }
.q-opts .opt {
  text-align: left;
  padding: 0.85rem 1.05rem 0.85rem 2.85rem;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 1rem;
  position: relative;
  transition: border-color .12s ease, background .12s ease, box-shadow .12s ease, transform .06s ease;
  line-height: 1.4;
}
.q-opts .opt::before {
  content: "";
  position: absolute; left: 1rem; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--border-strong);
  background: var(--surface);
  transition: border-color .12s ease, background .12s ease;
}
.q-opts .opt::after {
  content: "";
  position: absolute; left: 1.4rem; top: 50%; transform: translate(0, -50%) scale(0);
  width: 8px; height: 8px; border-radius: 50%;
  background: #fff;
  transition: transform .15s ease;
}
.q-opts .opt:hover { border-color: var(--muted); background: var(--surface-2); }
.q-opts .opt.selected {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .08);
}
.q-opts .opt.selected::before {
  background: var(--accent);
  border-color: var(--accent);
}
.q-opts .opt.selected::after { transform: translate(0, -50%) scale(1); }

/* Read box */
.read-box {
  font-family: var(--font-serif);
  font-size: 1.18rem;
  line-height: 1.75;
  padding: 1.3rem 1.5rem;
  background: var(--surface-2);
  border-radius: 12px;
  border-left: 4px solid var(--accent);
  margin: 0.65rem 0 0.85rem;
  color: var(--text);
}
.big-text { font-size: 1.45rem; line-height: 1.65; }

/* Recording */
.rec-area {
  margin-top: 1.4rem;
  padding: 1.2rem 1.25rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.rec-status {
  display: flex; align-items: center; gap: 0.55rem;
  margin-bottom: 0.85rem; color: var(--text-2); min-height: 1.5em;
  font-size: 0.98rem;
}
.rec-controls { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.rec-dot {
  display: inline-block; width: 12px; height: 12px;
  background: var(--rec); border-radius: 50%;
  animation: pulse 1.1s infinite;
}
@keyframes pulse {
  0%,100% { opacity: 0.55; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.18); }
}
.upload-fallback { margin-top: 0.85rem; }
.upload-fallback input[type="file"] {
  background: var(--surface); padding: 0.6rem;
  border: 1px dashed var(--border-strong); border-radius: 10px;
}
audio { filter: none; }

/* Save toast */
.save-toast {
  position: fixed; left: 50%; bottom: 1.25rem;
  transform: translateX(-50%);
  background: var(--ok); color: #fff;
  padding: 0.65rem 1.05rem; border-radius: 999px;
  font-weight: 600; font-size: 0.92rem;
  box-shadow: var(--shadow-lg);
  z-index: 50;
  display: inline-flex; align-items: center; gap: 0.4rem;
  animation: toast-in .25s ease;
}
.save-toast::before {
  content: "✓"; font-weight: 800;
}
.save-toast.err { background: var(--danger); }
.save-toast.err::before { content: "!"; }
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 6px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

.badge-ok {
  display: inline-block;
  background: rgba(21, 128, 61, .12);
  color: var(--ok);
  border: 1px solid rgba(21, 128, 61, .35);
  font-size: 0.74rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  margin-left: 0.55rem;
  vertical-align: middle;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

/* Mobile tweaks */
@media (max-width: 560px) {
  body { font-size: 16.5px; }
  main { padding: 1.25rem 0 2rem; }
  .wrap { padding: 0 1rem; }
  h1 { font-size: 1.7rem; }
  .welcome h1 { font-size: 1.95rem; }
  .welcome .lead { font-size: 1.05rem; }
  .big-text { font-size: 1.25rem; }
  .card, .big-card, .welcome-card { padding: 1.25rem 1.25rem; }
  .btn-big { width: 100%; }
  .actions { flex-direction: column-reverse; }
  .actions .btn { width: 100%; }
  .rec-controls .btn { flex: 1 1 auto; min-width: 130px; }
  .rec-controls .btn-rec { width: 100%; }
}
