/* Listening Lab — Field Recorder
   Plain CSS. Mobile-first. */

:root {
  --bg: #faf8f4;
  --ink: #111;
  --ink-soft: #555;
  --line: #e6e1d8;
  --accent: #ff3b30;          /* record red */
  --accent-soft: #ffe5e3;
  --primary: #111;
  --primary-ink: #faf8f4;
  --radius: 14px;
  --shadow: 0 1px 0 rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font-family: var(--font); }
body { min-height: 100dvh; -webkit-font-smoothing: antialiased; }

/* Screens — only one visible at a time */
.screen { display: none; min-height: 100dvh; padding: env(safe-area-inset-top) 20px env(safe-area-inset-bottom); }
.screen[data-active] { display: block; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 0 10px; border-bottom: 1px solid var(--line); margin-bottom: 28px;
}
.brand { font-weight: 700; letter-spacing: -.01em; }
.step  { color: var(--ink-soft); font-size: 13px; }

.stack { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }

h1 { font-size: 28px; line-height: 1.15; letter-spacing: -.02em; margin: 4px 0 0; }
h2 { font-size: 18px; margin: 0 0 8px; letter-spacing: -.01em; }
.lede { font-size: 17px; color: var(--ink-soft); margin: 0; line-height: 1.5; }
.hint { font-size: 14px; color: var(--ink-soft); margin: 8px 0 0; }

.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.consent blockquote {
  margin: 10px 0 0; padding: 14px 16px; background: var(--bg);
  border-left: 3px solid var(--ink); border-radius: 6px;
  font-size: 16px; line-height: 1.55; font-style: normal;
}

/* Form bits */
.checkbox { display: flex; align-items: flex-start; gap: 10px; font-size: 15px; color: var(--ink-soft); cursor: pointer; }
.checkbox input { margin-top: 3px; transform: scale(1.2); accent-color: var(--ink); }

input[type="email"], input[type="text"] {
  width: 100%; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 16px; font-family: inherit; background: #fff;
}
input[type="email"]:focus, input[type="text"]:focus { outline: 2px solid var(--ink); outline-offset: 2px; }

.field { display: block; margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field-label { display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: 6px; font-weight: 600; }

.signed-in {
  font-size: 13px; color: var(--ink-soft); text-align: center;
  margin: 6px 0 0; padding-top: 14px; border-top: 1px solid var(--line);
}
.link.inline { display: inline; padding: 0; font-size: 13px; }

/* Buttons */
button { font-family: inherit; cursor: pointer; border: none; }
.primary {
  background: var(--primary); color: var(--primary-ink);
  padding: 16px 20px; border-radius: var(--radius);
  font-size: 17px; font-weight: 600; letter-spacing: -.005em;
  transition: transform .08s ease, opacity .15s ease;
}
.primary:disabled { opacity: .35; cursor: not-allowed; }
.primary:not(:disabled):active { transform: scale(.985); }

.ghost {
  background: transparent; color: var(--ink);
  padding: 12px 16px; border-radius: var(--radius);
  border: 1px solid var(--line); font-size: 15px;
}
.ghost:disabled { opacity: .4; cursor: not-allowed; }

.link {
  background: none; color: var(--ink); text-decoration: underline;
  text-underline-offset: 4px; padding: 8px 0; font-size: 15px; align-self: center;
}

.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

/* Recorder block */
.recorder {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 24px 0 8px;
}
.record-btn {
  width: 132px; height: 132px; border-radius: 50%;
  background: var(--accent-soft); color: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; font-size: 14px; font-weight: 600;
  transition: transform .1s ease, background .15s ease;
}
.record-btn .dot {
  width: 28px; height: 28px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 0 rgba(255,59,48,.5);
}
.record-btn.recording { background: var(--accent); color: #fff; }
.record-btn.recording .dot {
  background: #fff; border-radius: 4px; width: 22px; height: 22px;
  animation: pulse 1.4s ease-in-out infinite;
}
.record-btn:active { transform: scale(.96); }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .55; }
}
.timer { font-variant-numeric: tabular-nums; font-size: 22px; color: var(--ink-soft); }
.recorder.armed .timer { color: var(--accent); }

/* Pre-record placeholder (before they tap record) */
.pre-record {
  border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 28px 22px; text-align: center; background: transparent;
}
.pre-record[hidden] { display: none; }
.pre-record-text { margin: 0 0 6px; font-size: 17px; color: var(--ink); font-weight: 600; }
.pre-record-hint { margin: 0; font-size: 14px; color: var(--ink-soft); }

/* Question card */
.question-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow);
}
.question-card[hidden] { display: none; }
.q-meta {
  display: flex; justify-content: space-between; font-size: 12px;
  text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft);
  margin-bottom: 14px;
}
.q-text { font-size: 24px; line-height: 1.2; letter-spacing: -.015em; margin: 0 0 8px; }
.q-hint { font-size: 14px; color: var(--ink-soft); margin: 0 0 18px; line-height: 1.45; }
.q-nav { display: flex; gap: 10px; }
.q-nav > * { flex: 1; }

.optional-fields { margin-top: 4px; }

/* Centered status screens (upload / done / failed) */
.stack.center { text-align: center; align-items: center; padding-top: 40px; }
.stack.center .lede { max-width: 38ch; }
.stack.center .primary { min-width: 240px; }

.spinner {
  width: 48px; height: 48px; border-radius: 50%;
  border: 4px solid var(--line); border-top-color: var(--ink);
  animation: spin 1s linear infinite; margin-bottom: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.checkmark {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--ink); color: var(--primary-ink);
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; font-weight: 700; margin-bottom: 8px;
}

.status { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.status[hidden] { display: none; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--ink); color: var(--primary-ink);
  padding: 12px 16px; border-radius: 999px; font-size: 14px;
  box-shadow: var(--shadow); max-width: 90vw; text-align: center;
}
