:root {
  --bg: #fbf7f2;
  --bg-2: #f3ece2;
  --ink: #2a2018;
  --ink-soft: #5b4e42;
  --ink-muted: #8a7e70;
  --accent: #c96f4a;
  --accent-soft: #e8b49a;
  --sage: #7b9c8a;
  --lavender: #a89ab8;
  --card: #fffdf9;
  --border: #e8ddce;
  --shadow: 0 10px 40px -20px rgba(61, 39, 23, 0.25);
  --radius: 18px;
  --font-serif: "Fraunces", Georgia, serif;
  --font-sans: "Inter", -apple-system, system-ui, sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3 {
  font-family: var(--font-serif);
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
}

h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); line-height: 1.05; }
h2 { font-size: clamp(1.7rem, 3.5vw, 2.4rem); line-height: 1.15; }
h3 { font-size: 1.2rem; }

p { color: var(--ink-soft); }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 1rem;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.4rem clamp(1.2rem, 4vw, 3rem);
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(251, 247, 242, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--accent-soft), var(--accent) 70%);
  box-shadow: inset 0 0 8px rgba(255, 255, 255, 0.4);
}

.brand-name {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 600;
}

.site-header nav {
  display: flex;
  gap: 1.6rem;
  align-items: center;
}

.site-header nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.2s;
}

.site-header nav a:hover { color: var(--accent); }

.cta-link {
  padding: 0.55rem 1rem;
  background: var(--ink);
  color: var(--bg) !important;
  border-radius: 999px;
}

.cta-link:hover { background: var(--accent); color: #fff !important; }

.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: center;
  gap: 3rem;
  padding: clamp(3rem, 8vw, 6rem) clamp(1.2rem, 4vw, 3rem);
  max-width: 1200px;
  margin: 0 auto;
}

.hero-copy .lede {
  font-size: 1.15rem;
  margin-top: 1.2rem;
  max-width: 36em;
}

.hero-ctas {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.9rem 1.6rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 500;
  font-size: 1rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
}

.btn-primary {
  background: var(--ink);
  color: var(--bg);
}

.btn-primary:hover {
  background: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn-ghost {
  color: var(--ink);
  border-color: var(--border);
  background: transparent;
}

.btn-ghost:hover { background: var(--bg-2); }

.hero-orb {
  position: relative;
  aspect-ratio: 1;
  max-width: 460px;
  justify-self: center;
  width: 100%;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  animation: float 12s ease-in-out infinite;
}

.orb:nth-child(1) {
  inset: 10% 10% 10% 10%;
  background: radial-gradient(circle at 30% 30%, #fbd9c3, var(--accent) 85%);
  opacity: 0.85;
}

.orb-2 {
  inset: 30% -10% 30% 40%;
  background: radial-gradient(circle at 40% 40%, #e2e8da, var(--sage) 85%);
  opacity: 0.55;
  animation-delay: -4s;
}

.orb-3 {
  inset: 40% 40% -5% -5%;
  background: radial-gradient(circle at 50% 50%, #e8deee, var(--lavender) 85%);
  opacity: 0.5;
  animation-delay: -8s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(10px, -20px) scale(1.05); }
  66% { transform: translate(-15px, 10px) scale(0.97); }
}

section {
  padding: clamp(3rem, 7vw, 5rem) clamp(1.2rem, 4vw, 3rem);
  max-width: 1200px;
  margin: 0 auto;
}

.journey h2 {
  max-width: 18ch;
  margin-bottom: 2.5rem;
}

.journey-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.4rem;
}

.step {
  padding: 1.8rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform 0.25s, box-shadow 0.25s;
}

.step:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.step-num {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--accent);
  font-size: 0.95rem;
}

.step h3 {
  margin: 0.4rem 0 0.6rem;
}

.companion {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 3rem;
  align-items: center;
  background: var(--bg-2);
  border-radius: 28px;
  padding: clamp(2rem, 5vw, 4rem) !important;
  max-width: 1200px;
}

.companion h2 {
  margin-bottom: 1rem;
}

.feature-list {
  margin-top: 1.5rem;
  list-style: none;
}

.feature-list li {
  padding: 0.6rem 0 0.6rem 1.6rem;
  position: relative;
  color: var(--ink-soft);
  border-bottom: 1px dashed var(--border);
}

.feature-list li:last-child { border-bottom: none; }

.feature-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1.1rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.companion-card {
  background: var(--card);
  padding: 2rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  position: relative;
}

.companion-card blockquote {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.25rem;
  line-height: 1.5;
  color: var(--ink);
  margin-bottom: 1rem;
}

.companion-card cite {
  font-style: normal;
  color: var(--ink-muted);
  font-size: 0.9rem;
}

.tools h2 {
  text-align: center;
  margin-bottom: 2.5rem;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.tool-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.tool-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-soft);
  box-shadow: var(--shadow);
}

.tool-icon {
  display: inline-block;
  font-size: 1.4rem;
  color: var(--accent);
  margin-bottom: 0.6rem;
}

.tool-card h3 {
  margin-bottom: 0.3rem;
}

.tool-card p {
  font-size: 0.92rem;
}

/* Chat */
.chat-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: clamp(1.6rem, 4vw, 2.4rem) !important;
  box-shadow: var(--shadow);
  margin-bottom: 4rem;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
  flex-wrap: wrap;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.chat-sub {
  font-size: 0.9rem;
  margin-top: 0.3rem;
  color: var(--ink-muted);
}

.mood-picker {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-end;
}

.mood-label {
  font-size: 0.8rem;
  color: var(--ink-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mood-options {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.mood {
  border: 1px solid var(--border);
  background: transparent;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.15s;
}

.mood:hover { border-color: var(--accent); color: var(--accent); }
.mood.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.chat-window {
  min-height: 320px;
  max-height: 520px;
  overflow-y: auto;
  padding: 1.5rem 0.2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  scroll-behavior: smooth;
}

.message {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  max-width: 88%;
  animation: fadeUp 0.35s ease;
}

.message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.message.assistant .avatar {
  background: radial-gradient(circle at 30% 30%, var(--accent-soft), var(--accent));
  color: #fff;
}

.message.user .avatar {
  background: var(--bg-2);
  color: var(--ink-soft);
}

.bubble {
  padding: 0.9rem 1.1rem;
  border-radius: 18px;
  font-size: 1rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.message.assistant .bubble {
  background: var(--bg-2);
  color: var(--ink);
  border-top-left-radius: 6px;
}

.message.user .bubble {
  background: var(--ink);
  color: var(--bg);
  border-top-right-radius: 6px;
}

.bubble.typing {
  display: inline-flex;
  gap: 4px;
  padding: 1rem 1.2rem;
}

.bubble.typing span {
  width: 7px;
  height: 7px;
  background: var(--ink-muted);
  border-radius: 50%;
  animation: pulse 1.2s infinite ease-in-out;
}

.bubble.typing span:nth-child(2) { animation-delay: 0.15s; }
.bubble.typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes pulse {
  0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
  30% { opacity: 1; transform: scale(1.1); }
}

/* Voice & hardware bar */
.voice-bar {
  display: flex;
  gap: 0.5rem;
  padding: 0.8rem 0;
  justify-content: center;
}

.hw-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-muted);
  font-family: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s;
}

.hw-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.hw-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.hw-btn.recording {
  background: #c0392b;
  border-color: #c0392b;
  color: #fff;
  animation: micPulse 1.2s infinite;
}

@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(192, 57, 43, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(192, 57, 43, 0); }
}

.hw-label {
  font-weight: 500;
}

.mic-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.8rem;
  margin-bottom: 0.4rem;
}

.mic-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #c0392b;
  animation: micPulse 1.2s infinite;
}

.mic-text {
  font-size: 0.82rem;
  color: var(--accent);
  font-weight: 500;
}

.camera-preview {
  position: relative;
  margin: 0.5rem auto;
  width: 160px;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid var(--border);
}

.camera-preview video {
  width: 100%;
  display: block;
  border-radius: 10px;
  transform: scaleX(-1);
}

.camera-status {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  background: rgba(42, 32, 24, 0.6);
  color: #fff;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.chat-input {
  display: flex;
  gap: 0.6rem;
  margin-top: 1.2rem;
  border-top: 1px solid var(--border);
  padding-top: 1.2rem;
}

#chat-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.85rem 1rem;
  font-family: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--bg);
  resize: none;
  max-height: 200px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

#chat-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(201, 111, 74, 0.15);
}

#chat-send {
  background: var(--ink);
  color: var(--bg);
  border: none;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  flex-shrink: 0;
  align-self: flex-end;
}

#chat-send:hover:not(:disabled) { background: var(--accent); }
#chat-send:active { transform: scale(0.96); }
#chat-send:disabled { opacity: 0.4; cursor: not-allowed; }

.disclaimer {
  font-size: 0.82rem;
  color: var(--ink-muted);
  margin-top: 1rem;
  text-align: center;
  line-height: 1.5;
}

.disclaimer strong { color: var(--accent); }

.site-footer {
  text-align: center;
  padding: 2rem;
  color: var(--ink-muted);
  font-size: 0.9rem;
  border-top: 1px solid var(--border);
}

/* Settings gear button */
#settings-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--ink-soft);
  transition: color 0.2s, border-color 0.2s, transform 0.3s;
  flex-shrink: 0;
}

#settings-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: rotate(45deg);
}

/* Privacy choice overlay */
.privacy-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(42, 32, 24, 0.55);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s;
}

.privacy-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.privacy-card {
  background: var(--card);
  border-radius: 24px;
  padding: clamp(1.8rem, 4vw, 2.8rem);
  max-width: 600px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 80px -20px rgba(42, 32, 24, 0.4);
  animation: scaleIn 0.35s ease;
}

@keyframes scaleIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.privacy-mark {
  width: 48px;
  height: 48px;
  margin: 0 auto 1.2rem;
}

.privacy-card h2 {
  margin-bottom: 0.7rem;
}

.privacy-card > p {
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

.privacy-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.privacy-option {
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.2rem;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
}

.privacy-option:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.privacy-icon {
  font-size: 1.5rem;
  display: block;
  margin-bottom: 0.6rem;
  color: var(--accent);
}

.privacy-option h3 {
  font-size: 1.05rem;
  margin-bottom: 0.4rem;
}

.privacy-option p {
  font-size: 0.85rem;
  line-height: 1.45;
}

.privacy-fine {
  font-size: 0.82rem !important;
  color: var(--ink-muted) !important;
  margin-bottom: 0 !important;
}

/* Settings drawer */
.settings-drawer {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(42, 32, 24, 0.4);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.settings-drawer.open {
  opacity: 1;
  pointer-events: auto;
}

.settings-panel {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: min(400px, 90vw);
  background: var(--card);
  padding: 2rem 1.6rem;
  box-shadow: -10px 0 40px -10px rgba(42, 32, 24, 0.3);
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.3s ease;
}

.settings-drawer.open .settings-panel {
  transform: translateX(0);
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.6rem;
}

.settings-header h2 {
  font-size: 1.4rem;
}

#settings-close {
  background: none;
  border: none;
  font-size: 1.8rem;
  color: var(--ink-muted);
  cursor: pointer;
  line-height: 1;
  padding: 0.2rem;
}

#settings-close:hover { color: var(--ink); }

.settings-group {
  border: none;
  margin-bottom: 1.5rem;
}

.settings-group legend {
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-muted);
  margin-bottom: 0.8rem;
}

.radio-card {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  margin-bottom: 0.6rem;
  transition: border-color 0.15s;
}

.radio-card:hover { border-color: var(--accent-soft); }

.radio-card input[type="radio"] {
  accent-color: var(--accent);
  margin-top: 0.25rem;
  flex-shrink: 0;
}

.radio-body strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
  color: var(--ink);
}

.radio-body small {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.data-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.btn-sm {
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
}

.btn-danger {
  color: #c0392b;
  border-color: #e6c8c4;
  background: transparent;
}

.btn-danger:hover {
  background: #fdf0ee;
  border-color: #c0392b;
}

.settings-info {
  background: var(--bg-2);
  border-radius: 12px;
  padding: 1rem;
}

.settings-info p {
  font-size: 0.85rem;
  line-height: 1.5;
}

/* Journey stats */
.journey-stats {
  max-width: 1200px;
  margin: 0 auto 1.5rem;
  padding: 1.5rem clamp(1.2rem, 4vw, 3rem);
  display: grid;
  gap: 1rem;
}

.journey-stats h3 {
  font-size: 1rem;
  color: var(--ink-muted);
  font-family: var(--font-sans);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.stats-row {
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
}

.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem 1.4rem;
  text-align: center;
  min-width: 100px;
  flex: 1;
}

.stat-num {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--accent);
  line-height: 1.2;
}

.stat-lbl {
  font-size: 0.78rem;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.mood-timeline {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: flex-end;
  min-height: 40px;
}

.timeline-empty {
  font-size: 0.88rem;
  color: var(--ink-muted);
  font-style: italic;
}

.timeline-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform 0.15s;
  cursor: default;
}

.timeline-dot:hover { transform: scale(1.2); }

.timeline-dot[data-mood-type="tender"]  { background: #f5d0c5; }
.timeline-dot[data-mood-type="anxious"] { background: #e8c9a0; }
.timeline-dot[data-mood-type="numb"]    { background: #d4d0cc; }
.timeline-dot[data-mood-type="hopeful"] { background: #c5dfc8; }
.timeline-dot[data-mood-type="grieving"]{ background: #d3c4e0; }
.timeline-dot[data-mood-type="tired"]   { background: #c8d5e0; }

.timeline-label {
  font-size: 0;
  position: absolute;
  bottom: -18px;
  white-space: nowrap;
  color: var(--ink-muted);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}

.timeline-dot:hover .timeline-label {
  font-size: 0.7rem;
  opacity: 1;
}

@media (max-width: 820px) {
  .site-header nav { gap: 1rem; }
  .site-header nav a:not(.cta-link) { display: none; }
  .hero, .companion {
    grid-template-columns: 1fr;
  }
  .hero-orb { max-width: 300px; }
  .chat-header { flex-direction: column; }
  .mood-picker { align-items: flex-start; }
  .mood-options { justify-content: flex-start; }
  .privacy-options { grid-template-columns: 1fr; }
  .stats-row { gap: 0.6rem; }
  .stat { min-width: 70px; padding: 0.7rem 0.8rem; }
  .stat-num { font-size: 1.4rem; }
  .emergency-btn { bottom: 1rem; right: 1rem; font-size: 0.8rem; padding: 0.6rem 1rem; }
  .crisis-card { padding: 1.6rem; }
  .soundscape-options { gap: 0.5rem; }
  .soundscape-btn { padding: 0.5rem 0.8rem; font-size: 0.82rem; }
  .toolkit-grid { grid-template-columns: 1fr; }
  .session-actions { flex-direction: column; }
}

/* ============================
   New features
   ============================ */

/* PIN overlay */
.pin-overlay {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: rgba(42, 32, 24, 0.6);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s;
}

.pin-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.pin-card {
  background: var(--card);
  border-radius: 24px;
  padding: clamp(1.8rem, 4vw, 2.8rem);
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 80px -20px rgba(42, 32, 24, 0.4);
  animation: scaleIn 0.35s ease;
}

.pin-card h2 { margin-bottom: 0.5rem; }
.pin-card > p { margin-bottom: 1.2rem; font-size: 0.95rem; }

.pin-input-group {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 0.8rem;
}

.pin-input-group input {
  width: 120px;
  text-align: center;
  font-size: 1.3rem;
  letter-spacing: 0.3em;
  padding: 0.7rem;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-family: inherit;
  background: var(--bg);
  color: var(--ink);
}

.pin-input-group input:focus {
  outline: none;
  border-color: var(--accent);
}

.pin-error {
  color: #c0392b;
  font-size: 0.85rem;
  margin-bottom: 0.8rem;
}

#pin-skip {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--ink-muted);
}

/* PIN settings */
.pin-setup {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.pin-setup input {
  flex: 1;
  min-width: 140px;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.95rem;
  background: var(--bg);
  color: var(--ink);
}

.pin-setup input:focus {
  outline: none;
  border-color: var(--accent);
}

/* Voice selector */
.voice-select {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.95rem;
  background: var(--bg);
  color: var(--ink);
  margin-bottom: 0.6rem;
  cursor: pointer;
}

.voice-select:focus {
  outline: none;
  border-color: var(--accent);
}

.voice-preview-row {
  display: flex;
  justify-content: flex-end;
}

/* Check-in reminders */
.checkbox-card {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--ink-soft);
  transition: border-color 0.15s;
}

.checkbox-card:hover { border-color: var(--accent-soft); }

.checkbox-card input[type="checkbox"] {
  accent-color: var(--accent);
  flex-shrink: 0;
}

.reminder-config {
  margin-top: 0.8rem;
  padding: 0.8rem;
  background: var(--bg-2);
  border-radius: 10px;
}

.reminder-time-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.reminder-time-label input[type="time"] {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  background: var(--card);
  color: var(--ink);
}

.settings-note {
  font-size: 0.82rem;
  color: var(--ink-muted);
  margin-top: 0.5rem;
  line-height: 1.4;
}

/* Ambient soundscapes */
.soundscape-bar {
  margin-top: 2rem;
  padding: 1.5rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.soundscape-bar h3 {
  font-size: 1rem;
  margin-bottom: 0.8rem;
  color: var(--ink-soft);
  font-family: var(--font-sans);
  font-weight: 500;
}

.soundscape-options {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.8rem;
}

.soundscape-btn {
  padding: 0.6rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.2s;
}

.soundscape-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.soundscape-btn.active {
  background: var(--sage);
  border-color: var(--sage);
  color: #fff;
}

.soundscape-icon {
  margin-right: 0.2rem;
}

.soundscape-vol {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.soundscape-vol label {
  font-size: 0.82rem;
  color: var(--ink-muted);
  flex-shrink: 0;
}

.soundscape-vol input[type="range"] {
  flex: 1;
  max-width: 200px;
  accent-color: var(--sage);
  height: 4px;
}

/* Personal healing toolkit */
.toolkit {
  max-width: 1200px;
  margin: 0 auto 1.5rem;
  padding: 1.5rem clamp(1.2rem, 4vw, 3rem) !important;
}

.toolkit h2 {
  font-size: 1.3rem;
  margin-bottom: 0.3rem;
}

.toolkit-sub {
  font-size: 0.9rem;
  color: var(--ink-muted);
  margin-bottom: 1.2rem;
}

.toolkit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.toolkit-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem 1.2rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.toolkit-item-text {
  font-size: 0.95rem;
  color: var(--ink);
  line-height: 1.4;
}

.toolkit-remove {
  background: none;
  border: none;
  color: var(--ink-muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.15s;
}

.toolkit-remove:hover { color: #c0392b; }

.toolkit-add {
  display: flex;
  gap: 0.5rem;
}

.toolkit-add input {
  flex: 1;
  padding: 0.6rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.95rem;
  background: var(--bg);
  color: var(--ink);
}

.toolkit-add input:focus {
  outline: none;
  border-color: var(--accent);
}

/* Session actions */
.session-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  margin-top: 0.8rem;
  flex-wrap: wrap;
}

/* Emergency button */
.emergency-btn {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.2rem;
  background: #c0392b;
  color: #fff;
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 20px -4px rgba(192, 57, 43, 0.5);
  transition: transform 0.15s, box-shadow 0.2s;
}

.emergency-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px -4px rgba(192, 57, 43, 0.6);
}

/* Crisis overlay */
.crisis-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(42, 32, 24, 0.7);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.crisis-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.crisis-card {
  background: #fffdf9;
  border-radius: 24px;
  padding: clamp(1.8rem, 4vw, 2.8rem);
  max-width: 520px;
  width: 100%;
  position: relative;
  box-shadow: 0 24px 80px -20px rgba(42, 32, 24, 0.4);
  animation: scaleIn 0.3s ease;
}

.crisis-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.8rem;
  color: var(--ink-muted);
  cursor: pointer;
  line-height: 1;
}

.crisis-close:hover { color: var(--ink); }

.crisis-card h2 {
  margin-bottom: 0.6rem;
  color: var(--ink);
}

.crisis-card > p {
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.crisis-resources {
  display: grid;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.crisis-resource {
  display: block;
  padding: 1rem 1.2rem;
  background: #fdf0ee;
  border: 1px solid #e6c8c4;
  border-radius: 14px;
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.15s, transform 0.1s;
}

a.crisis-resource:hover {
  border-color: #c0392b;
  transform: translateY(-1px);
}

.crisis-resource strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 0.2rem;
  color: #c0392b;
}

.crisis-resource span {
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.crisis-grounding {
  background: var(--bg-2);
  border-radius: 14px;
  padding: 1.2rem;
}

.crisis-grounding h3 {
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  color: var(--ink);
}

.crisis-grounding p {
  font-size: 0.9rem;
  line-height: 1.6;
}

/* Toast notifications */
.toast-container {
  position: fixed;
  top: 5rem;
  right: 1.5rem;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  pointer-events: none;
}

.toast {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem 1.4rem;
  box-shadow: 0 8px 30px -8px rgba(42, 32, 24, 0.3);
  min-width: 260px;
  max-width: 360px;
  animation: toastIn 0.4s ease;
  pointer-events: auto;
}

.toast.celebration {
  border-color: var(--accent-soft);
  background: linear-gradient(135deg, #fffdf9 0%, #fef3ec 100%);
}

.toast-title {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1rem;
  color: var(--ink);
  margin-bottom: 0.2rem;
}

.toast-body {
  font-size: 0.88rem;
  color: var(--ink-soft);
  line-height: 1.4;
}

.toast.leaving {
  animation: toastOut 0.3s ease forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(40px); }
}

/* Mood trend chart (SVG) */
.mood-chart-wrap {
  margin-top: 0.5rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
  overflow-x: auto;
}

.mood-chart-wrap svg {
  display: block;
  width: 100%;
  height: auto;
}

/* Therapist handoff display */
.handoff-display {
  background: var(--bg-2);
  border-radius: 14px;
  padding: 1.2rem 1.4rem;
  margin-top: 0.8rem;
  white-space: pre-wrap;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--ink);
}

.handoff-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.6rem;
  justify-content: flex-end;
}

/* ============================
   Dark / comfort / night mode
   ============================ */
:root[data-theme="dark"] {
  --bg: #1a1612;
  --bg-2: #252019;
  --ink: #e8ddd0;
  --ink-soft: #bfb3a3;
  --ink-muted: #8a7e70;
  --accent: #e8926a;
  --accent-soft: #a0654a;
  --card: #221e18;
  --border: #3a3228;
  --shadow: 0 10px 40px -20px rgba(0, 0, 0, 0.5);
}

:root[data-theme="dark"] .site-header {
  background: rgba(26, 22, 18, 0.9);
}

:root[data-theme="dark"] .cta-link {
  background: var(--accent);
}

:root[data-theme="dark"] #chat-input {
  background: var(--bg-2);
  color: var(--ink);
}

:root[data-theme="dark"] .crisis-card,
:root[data-theme="dark"] .pin-card {
  background: var(--card);
}

:root[data-theme="dark"] .crisis-resource {
  background: #2a1f1a;
  border-color: #3d2e24;
}

:root[data-theme="dark"] .btn-danger {
  color: #e87060;
  border-color: #3d2e24;
}

/* ============================
   Breathing animation guide
   ============================ */
.breath-guide {
  position: fixed;
  inset: 0;
  z-index: 250;
  background: rgba(42, 32, 24, 0.85);
  backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s;
}

:root[data-theme="dark"] .breath-guide {
  background: rgba(10, 8, 6, 0.9);
}

.breath-guide.visible {
  opacity: 1;
  pointer-events: auto;
}

.breath-guide-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: none;
  border: none;
  font-size: 2rem;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  line-height: 1;
}

.breath-guide-close:hover { color: #fff; }

.breath-circle {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fbd9c3, var(--accent) 80%);
  opacity: 0.8;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.breath-circle.inhale {
  animation: breathInhale 4s ease-in-out forwards;
}

.breath-circle.hold {
  transform: scale(1.6);
  opacity: 1;
}

.breath-circle.exhale {
  animation: breathExhale 8s ease-in-out forwards;
}

@keyframes breathInhale {
  from { transform: scale(1); opacity: 0.8; }
  to { transform: scale(1.6); opacity: 1; }
}

@keyframes breathExhale {
  from { transform: scale(1.6); opacity: 1; }
  to { transform: scale(1); opacity: 0.8; }
}

.breath-phase {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  color: #fff;
  text-align: center;
}

.breath-counter {
  font-size: 2.5rem;
  font-family: var(--font-serif);
  font-weight: 600;
  color: var(--accent-soft);
  min-height: 3rem;
}

.breath-cycles {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.5);
}

/* ============================
   Daily affirmation
   ============================ */
.daily-affirmation {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--accent);
  margin-top: 1rem;
  opacity: 0;
  animation: affirmFadeIn 1.5s 0.5s ease forwards;
  min-height: 1.4em;
}

@keyframes affirmFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================
   State-of-the-art visual effects
   ============================ */

/* Hidden SVG defs */
.svg-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* Gooey morphing orbs */
.hero-orb {
  filter: url(#gooey);
}

/* Film grain noise overlay for warmth */
.noise-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  mix-blend-mode: overlay;
}

:root[data-theme="dark"] .noise-overlay {
  opacity: 0.06;
}

/* Hero particles canvas */
.hero-particles {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.hero {
  position: relative;
  overflow: hidden;
}

.hero-copy, .hero-orb {
  position: relative;
  z-index: 1;
}

/* Animated gradient text for headings */
.gradient-text {
  background: linear-gradient(
    135deg,
    var(--ink) 0%,
    var(--accent) 40%,
    var(--sage) 60%,
    var(--lavender) 80%,
    var(--ink) 100%
  );
  background-size: 300% 300%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientShift 8s ease-in-out infinite;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

:root[data-theme="dark"] .gradient-text {
  background: linear-gradient(
    135deg,
    var(--ink) 0%,
    var(--accent) 35%,
    #a89ab8 55%,
    #7b9c8a 75%,
    var(--ink) 100%
  );
  background-size: 300% 300%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientShift 8s ease-in-out infinite;
}

/* Scroll-triggered reveal animations */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal .step,
.reveal .tool-card,
.reveal .companion-card {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.visible .step,
.reveal.visible .tool-card,
.reveal.visible .companion-card {
  opacity: 1;
  transform: translateY(0);
}

.reveal.visible .step:nth-child(1),
.reveal.visible .tool-card:nth-child(1) { transition-delay: 0.1s; }
.reveal.visible .step:nth-child(2),
.reveal.visible .tool-card:nth-child(2) { transition-delay: 0.2s; }
.reveal.visible .step:nth-child(3),
.reveal.visible .tool-card:nth-child(3) { transition-delay: 0.3s; }
.reveal.visible .tool-card:nth-child(4) { transition-delay: 0.4s; }

/* 3D perspective card tilt on hover */
.step,
.tool-card,
.companion-card,
.stat {
  transform-style: preserve-3d;
  perspective: 800px;
}

.step:hover,
.tool-card:hover {
  transform: translateY(-4px) rotateX(2deg) rotateY(-2deg);
  box-shadow: 0 20px 60px -20px rgba(61, 39, 23, 0.3),
              0 0 0 1px var(--accent-soft);
}

/* Button ripple effect */
.btn {
  position: relative;
  overflow: hidden;
}

.btn .ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  transform: scale(0);
  animation: rippleAnim 0.6s ease-out;
  pointer-events: none;
}

@keyframes rippleAnim {
  to { transform: scale(4); opacity: 0; }
}

/* Enhanced glassmorphism on overlays */
.privacy-card,
.pin-card,
.crisis-card {
  background: rgba(255, 253, 249, 0.85);
  backdrop-filter: blur(20px) saturate(1.8);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  border: 1px solid rgba(232, 221, 206, 0.6);
}

:root[data-theme="dark"] .privacy-card,
:root[data-theme="dark"] .pin-card {
  background: rgba(34, 30, 24, 0.85);
  border-color: rgba(58, 50, 40, 0.6);
}

.settings-panel {
  backdrop-filter: blur(16px) saturate(1.5);
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
}

/* Shimmer loading effect for typing indicator */
.bubble.typing {
  background: linear-gradient(90deg, var(--bg-2) 25%, var(--border) 50%, var(--bg-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.bubble.typing span {
  animation: pulse 1.2s infinite ease-in-out;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Glowing accent on chat input focus */
#chat-input:focus {
  box-shadow: 0 0 0 3px rgba(201, 111, 74, 0.15),
              0 0 20px -4px rgba(201, 111, 74, 0.2);
}

/* Pulsing glow on emergency button */
.emergency-btn {
  animation: emergencyPulse 3s ease-in-out infinite;
}

@keyframes emergencyPulse {
  0%, 100% { box-shadow: 0 4px 20px -4px rgba(192, 57, 43, 0.5); }
  50% { box-shadow: 0 4px 30px -2px rgba(192, 57, 43, 0.7), 0 0 60px -10px rgba(192, 57, 43, 0.3); }
}

/* Smooth hover glow on mood buttons */
.mood:hover {
  box-shadow: 0 0 12px -2px var(--accent-soft);
}

.mood.active {
  box-shadow: 0 0 16px -2px var(--accent);
}

/* Soundscape button active glow */
.soundscape-btn.active {
  box-shadow: 0 0 14px -2px var(--sage);
}

/* Chat message entrance with spring effect */
@keyframes fadeUp {
  0% { opacity: 0; transform: translateY(16px) scale(0.97); }
  60% { transform: translateY(-2px) scale(1.01); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Smooth orb animations — slower, more organic */
@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1) rotate(0deg); }
  25% { transform: translate(12px, -18px) scale(1.06) rotate(2deg); }
  50% { transform: translate(-8px, 14px) scale(0.96) rotate(-1deg); }
  75% { transform: translate(-16px, -6px) scale(1.03) rotate(1deg); }
}

.orb:nth-child(1) { animation-duration: 18s; }
.orb-2 { animation-duration: 22s; }
.orb-3 { animation-duration: 15s; }

/* Hover lift on stat cards */
.stat {
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.25s;
}

.stat:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 30px -10px rgba(61, 39, 23, 0.25);
}

/* Toolkit item hover */
.toolkit-item {
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.toolkit-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--accent-soft);
}

/* Toast slide-in with spring */
@keyframes toastIn {
  0% { opacity: 0; transform: translateX(60px) scale(0.9); }
  60% { transform: translateX(-4px) scale(1.02); }
  100% { opacity: 1; transform: translateX(0) scale(1); }
}

/* Smooth page load */
body {
  animation: pageIn 0.6s ease;
}

@keyframes pageIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
