/* Cary interviewer — participant UI.
   Design goals: warm, calm, readable for 50+ (large type, high contrast,
   generous spacing), one card per step, zero clutter. */

:root {
  --bg: #f4f1e9;
  --card: #fffdf9;
  --ink: #29281f;
  --muted: #6f6a5c;
  --line: #e4ddcc;
  --green: #3e6b48;
  --green-dark: #2f5238;
  --green-soft: #eef3ec;
  --blue: #41566e;
  --red: #96372f;
  --red-soft: #faeeec;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(60, 50, 30, 0.05), 0 10px 30px rgba(60, 50, 30, 0.07);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 18px;
  line-height: 1.6;
}

.wrap { max-width: 660px; margin: 0 auto; padding: 28px 18px 40px; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }

/* Brand header */
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 12px; background: var(--green); color: #fdfcf7;
  display: flex; align-items: center; justify-content: center;
  font-family: Georgia, "Times New Roman", serif; font-size: 26px; font-weight: 700;
}
.brand-name { font-family: Georgia, serif; font-weight: 700; font-size: 1.1rem; line-height: 1.15; }
.brand-sub { font-size: 0.82rem; color: var(--muted); letter-spacing: 0.02em; }

.foot { margin-top: 26px; text-align: center; font-size: 0.78rem; color: var(--muted); }

/* Cards & typography */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px 32px 34px;
}
h1 { font-family: Georgia, "Times New Roman", serif; font-size: 1.85rem; line-height: 1.25; margin: 0 0 14px; }
h1.small { font-size: 1.3rem; margin: 0; }
h2 { font-family: Georgia, serif; font-size: 1.15rem; margin: 0 0 8px; }
.lead { color: #4c483c; margin: 0 0 10px; }
.hint { color: var(--muted); font-size: 0.9rem; margin: 6px 0 0; }
.hint.center { text-align: center; }

/* Inputs */
label { display: block; margin: 22px 0 8px; font-weight: 650; }
input[type="text"], input[type="password"], textarea {
  width: 100%; padding: 14px 16px; font-size: 1.1rem; color: var(--ink);
  border: 1.5px solid #cdc6b4; border-radius: 12px; background: #fff;
  font-family: inherit;
}
input:focus-visible, textarea:focus-visible, button:focus-visible {
  outline: 3px solid #9dc3a2; outline-offset: 1px; border-color: var(--green);
}

/* Buttons */
button {
  font-family: inherit; font-size: 1.05rem; font-weight: 650;
  padding: 13px 24px; border-radius: 12px; border: none; cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
}
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.45; cursor: default; }
button.primary { background: var(--green); color: #fdfcf7; }
button.primary:hover:not(:disabled) { background: var(--green-dark); }
button.big { width: 100%; margin-top: 24px; padding: 16px; font-size: 1.15rem; }
button.danger { background: #fff; color: var(--red); border: 1.5px solid #dbb7b1; }
button.danger:hover { background: var(--red-soft); }
button.danger.subtle { font-size: 0.88rem; padding: 8px 14px; }

.error {
  color: var(--red); background: var(--red-soft); border: 1px solid #e8cbc6;
  border-radius: 10px; padding: 12px 15px; margin-top: 16px; font-size: 0.95rem;
}

/* Mode choice */
.mode-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 22px; }
.mode-card {
  display: flex; gap: 12px; align-items: flex-start; margin: 0; font-weight: 400;
  border: 1.5px solid var(--line); border-radius: 14px; padding: 15px 16px;
  cursor: pointer; background: #fff; transition: border-color 0.12s ease, background 0.12s ease;
}
.mode-card:hover { border-color: #b9cdbb; }
/* .selected is toggled in JS — :has() alone is not safe for older browsers */
.mode-card.selected,
.mode-card:has(input:checked) { border-color: var(--green); background: var(--green-soft); box-shadow: 0 0 0 1px var(--green); }
.mode-card input { position: absolute; opacity: 0; }
.mode-icon { font-size: 1.5rem; line-height: 1.2; }
.mode-text { display: flex; flex-direction: column; gap: 2px; font-size: 0.92rem; color: var(--muted); }
.mode-text strong { color: var(--ink); font-size: 1rem; }
.mode-card.disabled { opacity: 0.5; pointer-events: none; }

/* Preparing steps */
.steps { list-style: none; margin: 20px 0 4px; padding: 0; }
.steps li {
  display: flex; align-items: center; gap: 14px; padding: 9px 0;
  color: var(--muted); font-size: 1rem;
}
.steps .dot {
  width: 22px; height: 22px; border-radius: 50%; flex: 0 0 22px;
  border: 2.5px solid #cdc6b4; background: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: #fff;
}
.steps li.active { color: var(--ink); font-weight: 600; }
.steps li.active .dot { border-color: var(--green); animation: pulse-dot 1.3s ease-in-out infinite; }
.steps li.done { color: var(--ink); }
.steps li.done .dot { border-color: var(--green); background: var(--green); }
.steps li.done .dot::after { content: "✓"; }
@keyframes pulse-dot { 0%,100% { box-shadow: 0 0 0 0 rgba(62,107,72,0.35);} 50% { box-shadow: 0 0 0 7px rgba(62,107,72,0);} }

.consent-box {
  background: #fbf8f0; border: 1px solid var(--line); border-radius: 14px;
  padding: 20px 22px; margin-top: 26px;
}
.consent-box p { margin: 6px 0; font-size: 0.97rem; }
.consent-check {
  display: flex; gap: 12px; align-items: flex-start; font-weight: 650; margin: 16px 0 2px;
  cursor: pointer;
}
.consent-check input { width: 24px; height: 24px; margin-top: 2px; accent-color: var(--green); flex: 0 0 24px; }

/* Voice view */
.voice-stage { display: flex; flex-direction: column; align-items: center; padding: 18px 0 6px; }
.orb {
  width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #a9cbae, var(--green) 70%);
  box-shadow: 0 6px 24px rgba(62, 107, 72, 0.35);
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.orb.speaking { animation: pulse-orb 1.25s ease-in-out infinite; }
.orb.listening { transform: scale(0.9); opacity: 0.82; }
@keyframes pulse-orb { 0%,100% { transform: scale(1);} 50% { transform: scale(1.1);} }
@media (prefers-reduced-motion: reduce) {
  .orb.speaking, .steps li.active .dot { animation: none; }
}
.voice-state { margin: 18px 0 4px; font-size: 1.05rem; color: #4c483c; text-align: center; }

.captions-wrap { margin-top: 14px; }
.captions-label { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; color: var(--muted); text-transform: uppercase; margin-bottom: 6px; }
.captions {
  background: #fbf8f0; border: 1px solid var(--line); border-radius: 12px;
  min-height: 150px; max-height: 300px; overflow-y: auto; padding: 14px 16px; font-size: 0.95rem;
}
.caption { margin: 7px 0; }
.caption.user { color: var(--blue); }
.end-row { display: flex; justify-content: center; margin-top: 20px; }

/* Text chat */
.chat-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.chat {
  background: #fbf8f0; border: 1px solid var(--line); border-radius: 12px;
  height: 55vh; min-height: 320px; overflow-y: auto; padding: 18px;
  display: flex; flex-direction: column; gap: 12px;
}
.bubble { max-width: 86%; padding: 12px 16px; border-radius: 16px; white-space: pre-wrap; }
.bubble.user { align-self: flex-end; background: #e2eaf4; border-bottom-right-radius: 6px; }
.bubble.ai { align-self: flex-start; background: #e9efe6; border-bottom-left-radius: 6px; }
.bubble.typing { color: var(--muted); }
.composer { display: flex; gap: 10px; align-items: flex-end; margin-top: 12px; }
.composer textarea { flex: 1; resize: none; }
.composer button { margin: 0; padding: 13px 22px; }

/* Done */
.center-view { text-align: center; }
.done-mark {
  width: 74px; height: 74px; margin: 8px auto 18px; border-radius: 50%;
  background: var(--green); color: #fdfcf7; font-size: 2.1rem;
  display: flex; align-items: center; justify-content: center;
}
.code-box {
  margin: 22px auto 6px; padding: 14px 22px; display: inline-block;
  background: #fbf8f0; border: 1.5px dashed #b9ac8e; border-radius: 12px;
}
.code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 1.5rem; font-weight: 700; letter-spacing: 0.08em; }

@media (max-width: 560px) {
  .card { padding: 24px 20px 28px; }
  .mode-cards { grid-template-columns: 1fr; }
  h1 { font-size: 1.55rem; }
}
