:root {
  --bg: #171310;
  --panel: #241e19;
  --panel-2: #2d2620;
  --text: #f2ece5;
  --muted: #a89a8c;
  --accent: #d67d5c;
  --accent-soft: #e8a87c;
  --error: #e06c5c;
  --radius: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.view {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 20px) 20px calc(env(safe-area-inset-bottom, 0px) + 20px);
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--error); font-size: 14px; margin-top: 10px; }

/* ---------- setup ---------- */
.setup-card {
  margin: auto;
  width: 100%;
  background: var(--panel);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
}
.setup-card h1 { margin-bottom: 8px; }
.setup-card p { margin-bottom: 18px; }
.setup-card input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--panel-2);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  margin-bottom: 14px;
}

/* ---------- buttons ---------- */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 12px 28px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary:active { opacity: 0.85; }

.btn-ghost {
  background: none;
  border: none;
  color: var(--accent-soft);
  font-size: 15px;
  cursor: pointer;
  padding: 6px 10px;
}

/* ---------- home ---------- */
.home-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}
.logo { font-weight: 700; font-size: 17px; letter-spacing: 0.3px; }

.sarah-card {
  display: flex;
  gap: 16px;
  align-items: center;
  background: var(--panel);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
}
.avatar {
  width: 64px;
  height: 64px;
  min-width: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-soft), var(--accent));
  color: #fff;
  font-weight: 700;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.small-avatar { width: 44px; height: 44px; min-width: 44px; font-size: 16px; }
.sarah-meta h2 { font-size: 20px; display: flex; align-items: center; gap: 8px; }
.day-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-soft);
  background: var(--panel-2);
  border-radius: 999px;
  padding: 3px 10px;
}
.tagline { color: var(--accent-soft); font-size: 13px; margin-top: 3px; }
.subtitle { color: var(--muted); font-size: 13px; margin-top: 3px; }

.panel {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 14px;
}
.panel h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 8px;
}
.panel ul { list-style: none; }
.panel li {
  font-size: 14px;
  padding: 5px 0 5px 16px;
  position: relative;
}
.panel li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.talk-wrap {
  margin-top: auto;
  text-align: center;
  padding: 26px 0 10px;
}
.btn-talk {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: none;
  background: radial-gradient(circle at 35% 30%, var(--accent-soft), var(--accent));
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 40px rgba(214, 125, 92, 0.35);
}
.btn-talk:disabled { opacity: 0.55; }
.talk-wrap p { margin-top: 14px; min-height: 18px; }

/* ---------- session ---------- */
.session-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.session-name { font-weight: 600; }
.btn-end {
  margin-left: auto;
  background: var(--panel-2);
  color: var(--error);
  border: none;
  border-radius: 10px;
  padding: 9px 18px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.catchup {
  font-style: italic;
  color: var(--accent-soft);
  background: var(--panel);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 12px;
  font-size: 15px;
}

.session-status {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
  min-height: 18px;
}
.session-status.speaking { color: var(--accent-soft); }
.session-status.speaking::before {
  content: "● ";
  animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.3; } }

.transcript {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 12px;
}
.bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 15px;
  line-height: 1.45;
  white-space: pre-wrap;
}
.bubble.user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.bubble.sarah {
  align-self: flex-start;
  background: var(--panel);
  border-bottom-left-radius: 4px;
}

/* ---------- debrief ---------- */
#view-debrief { justify-content: center; }
.debrief-card {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 32px 26px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.debrief-text {
  font-size: 17px;
  line-height: 1.6;
  white-space: pre-wrap;
}

/* ---------- history ---------- */
.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-item {
  background: var(--panel);
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
}
.history-item .h-date { font-size: 13px; color: var(--accent-soft); margin-bottom: 4px; }
.history-item .h-snippet { font-size: 14px; color: var(--muted); }
