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

body {
  background: linear-gradient(135deg, #c8e8ee 0%, #D4EEF2 50%, #cce9f0 100%);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: #2a5a62;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

#vig {
  position: fixed; inset: 0; pointer-events: none; z-index: 1;
  background: radial-gradient(ellipse 82% 78% at 50% 48%,
    transparent 28%,
    rgba(16, 34, 12, 0.10) 58%,
    rgba(8, 22, 6, 0.35) 100%);
}

#bloom {
  position: fixed; inset: 0; pointer-events: none; z-index: 1;
  background: radial-gradient(ellipse 60% 50% at 50% 45%,
    rgba(155, 205, 130, 0.07) 0%, transparent 68%);
}

#grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 2; opacity: 0.018;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 160px;
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
}

.status-panel {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(107, 188, 190, 0.35);
  border-radius: 16px;
  padding: 16px 20px;
  min-width: 220px;
  pointer-events: auto;
  box-shadow: 0 8px 32px rgba(107, 188, 190, 0.15);
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 12px;
}

.status-row:last-child {
  margin-bottom: 0;
}

.status-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6a9aa2;
  white-space: nowrap;
}

.status-badge {
  font-size: 15px;
  font-weight: 600;
  color: #2a5a62;
  background: rgba(141, 205, 212, 0.25);
  border: 1px solid rgba(107, 188, 190, 0.4);
  border-radius: 20px;
  padding: 3px 10px;
  transition: background 0.4s ease, color 0.4s ease, border-color 0.4s ease;
}

.status-badge.calm {
  background: rgba(136, 198, 90, 0.2);
  border-color: rgba(136, 198, 90, 0.45);
  color: #5a9c2a;
}

.status-badge.moderate {
  background: rgba(253, 234, 170, 0.5);
  border-color: rgba(245, 190, 80, 0.5);
  color: #b8820a;
}

.status-badge.high {
  background: rgba(245, 184, 122, 0.3);
  border-color: rgba(245, 184, 122, 0.55);
  color: #c0622a;
}

.stress-bar-container {
  flex: 1;
  height: 6px;
  background: rgba(107, 188, 190, 0.15);
  border-radius: 3px;
  overflow: hidden;
  min-width: 80px;
}

.stress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #88C65A, #FDEAAA, #F5B87A);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.session-status {
  position: absolute;
  top: 20px;
  left: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(107, 188, 190, 0.3);
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 12px;
  color: #5a8a92;
  pointer-events: auto;
}

.session-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8DCDD4;
  flex-shrink: 0;
  transition: background 0.4s ease;
}

.session-dot.active {
  background: #88C65A;
  box-shadow: 0 0 8px rgba(136, 198, 90, 0.6);
  animation: pulse-dot 2s infinite;
}

.session-dot.intervening {
  background: #6BBCBE;
  box-shadow: 0 0 10px rgba(107, 188, 190, 0.7);
  animation: pulse-dot 1s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.breathing-label {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
}

#breathing-text {
  font-size: 20px;
  font-weight: 300;
  letter-spacing: 0.15em;
  color: rgba(42, 90, 98, 0.85);
  text-shadow: 0 0 20px rgba(107, 188, 190, 0.5);
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.8s ease;
}

#breathing-text.visible {
  opacity: 1;
}

.intervention-container {
  position: absolute;
  bottom: 140px;
  left: 50%;
  transform: translateX(-50%);
  width: min(600px, 90vw);
  text-align: center;
  pointer-events: none;
}

.intervention-text {
  font-size: 18px;
  font-weight: 400;
  line-height: 1.6;
  color: #2a5a62;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(107, 188, 190, 0.35);
  border-radius: 16px;
  padding: 18px 24px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  box-shadow: 0 8px 32px rgba(107, 188, 190, 0.2);
}

.intervention-text.visible {
  opacity: 1;
  transform: translateY(0);
}

.start-screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(212, 238, 242, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: auto;
  transition: opacity 0.8s ease;
}

.start-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.start-card {
  text-align: center;
  padding: 48px 56px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(107, 188, 190, 0.4);
  border-radius: 24px;
  box-shadow: 0 24px 64px rgba(107, 188, 190, 0.2), 0 0 0 1px rgba(107, 188, 190, 0.1);
  max-width: 420px;
  width: 90vw;
}

.start-title {
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #6BBCBE, #5aa8aa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 16px;
}

.start-subtitle {
  font-size: 16px;
  color: #6a9aa2;
  line-height: 1.6;
  margin-bottom: 36px;
}

.start-btn {
  display: inline-block;
  padding: 14px 40px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #6BBCBE, #8DCDD4);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  box-shadow: 0 4px 20px rgba(107, 188, 190, 0.45);
  pointer-events: auto;
  letter-spacing: 0.02em;
}

.start-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(107, 188, 190, 0.6);
}

.start-btn:active {
  transform: translateY(0);
  opacity: 0.9;
}

.start-note {
  margin-top: 16px;
  font-size: 11px;
  color: #8ab0b8;
  letter-spacing: 0.05em;
}

.home-btn {
  position: absolute;
  top: 64px;
  left: 20px;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(107, 188, 190, 0.4);
  border-radius: 20px;
  padding: 7px 16px;
  font-size: 12px;
  font-weight: 600;
  color: #6BBCBE;
  cursor: pointer;
  pointer-events: auto;
  letter-spacing: 0.04em;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.home-btn:hover {
  background: rgba(107, 188, 190, 0.15);
  box-shadow: 0 4px 16px rgba(107, 188, 190, 0.25);
}

.calm-exit-modal {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: 20;
}

.calm-exit-modal.visible {
  opacity: 1;
  pointer-events: auto;
}

.calm-exit-card {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(107, 188, 190, 0.4);
  border-radius: 20px;
  padding: 32px 40px;
  text-align: center;
  max-width: 360px;
  width: 90vw;
  box-shadow: 0 16px 48px rgba(107, 188, 190, 0.2);
}

.calm-exit-card p {
  font-size: 16px;
  color: #2a5a62;
  line-height: 1.6;
  margin-bottom: 24px;
}

.calm-exit-btns {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.calm-exit-btns button {
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 50px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

#calm-exit-yes {
  background: linear-gradient(135deg, #6BBCBE, #8DCDD4);
  color: #fff;
  border: none;
  box-shadow: 0 4px 16px rgba(107, 188, 190, 0.4);
}

#calm-exit-yes:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(107, 188, 190, 0.55);
}

#calm-exit-no {
  background: transparent;
  color: #6a9aa2;
  border: 1px solid rgba(107, 188, 190, 0.4);
}

#calm-exit-no:hover {
  background: rgba(107, 188, 190, 0.1);
  transform: translateY(-1px);
}

/* ── Therapist Panel ─────────────────────────────────────────────── */

.therapist-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 30;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(107, 188, 190, 0.4);
  border-radius: 20px;
  padding: 32px 40px;
  text-align: center;
  max-width: 380px;
  width: 90vw;
  box-shadow: 0 16px 48px rgba(107, 188, 190, 0.2);
  pointer-events: auto;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.therapist-panel.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -48%);
}

.therapist-heading {
  font-size: 17px;
  font-weight: 600;
  color: #2a5a62;
  margin-bottom: 8px;
}

.therapist-subtext {
  font-size: 14px;
  color: #6a9aa2;
  line-height: 1.5;
  margin-bottom: 20px;
}

.therapist-status {
  font-size: 13px;
  font-style: italic;
  color: #8ab0b8;
  min-height: 20px;
  margin-bottom: 16px;
}

.therapist-status.speaking {
  animation: pulse-text 1.4s ease-in-out infinite;
}

@keyframes pulse-text {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

.therapist-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.therapist-btn {
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 50px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
  border: none;
}

.therapist-btn.hidden {
  display: none;
}

.therapist-btn.primary {
  background: linear-gradient(135deg, #6BBCBE, #8DCDD4);
  color: #fff;
  box-shadow: 0 4px 16px rgba(107, 188, 190, 0.4);
}

.therapist-btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(107, 188, 190, 0.55);
}

.therapist-btn.secondary {
  background: transparent;
  color: #6a9aa2;
  border: 1px solid rgba(107, 188, 190, 0.4);
}

.therapist-btn.secondary:hover {
  background: rgba(107, 188, 190, 0.1);
  transform: translateY(-1px);
}

.therapist-btn.danger {
  background: rgba(220, 100, 80, 0.12);
  color: #c0622a;
  border: 1px solid rgba(220, 100, 80, 0.3);
}

.therapist-btn.danger:hover {
  background: rgba(220, 100, 80, 0.22);
  transform: translateY(-1px);
}

/* ── Therapy View (full-screen overlay) ──────────────────────────── */

.therapy-view {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background: rgba(212, 238, 242, 0.72);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  transition: opacity 0.5s ease;
}

.therapy-view.hidden {
  opacity: 0;
  pointer-events: none;
}

.therapy-view-label {
  font-size: 20px;
  font-weight: 600;
  color: #2a5a62;
  letter-spacing: 0.01em;
}

.therapy-view-status {
  font-size: 14px;
  font-style: italic;
  color: #6a9aa2;
  min-height: 20px;
}

/* ── Quick Therapist Button (landing page) ───────────────────────── */

.quick-therapist-btn {
  position: absolute;
  bottom: 28px;
  left: 28px;
  padding: 9px 20px;
  font-size: 13px;
  font-weight: 600;
  color: #6BBCBE;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(107, 188, 190, 0.4);
  border-radius: 50px;
  cursor: pointer;
  pointer-events: auto;
  letter-spacing: 0.03em;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 16px rgba(107, 188, 190, 0.15);
}

.quick-therapist-btn:hover {
  background: rgba(107, 188, 190, 0.12);
  box-shadow: 0 6px 20px rgba(107, 188, 190, 0.3);
}
