/* =========================================
   COMING BACK TO ME — Design System
   ========================================= */

:root {
  --bg: #faf8f5;
  --primary: #9b8ec4;
  --primary-light: #c4b8e8;
  --primary-dark: #7a6fa0;
  --accent: #7a9e7e;
  --accent-light: #a8c9ab;
  --surface: #ffffff;
  --text: #3d3535;
  --muted: #a89d9d;
  --border: #e8e2d9;
  --danger: #e07070;
  --radius: 16px;
  --radius-sm: 8px;
  --shadow: 0 2px 16px rgba(155, 142, 196, 0.12);
  --shadow-lg: 0 8px 32px rgba(155, 142, 196, 0.18);
  --transition: 0.3s ease;
}

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

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

/* =========================================
   LAYOUT
   ========================================= */

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.view {
  display: none;
  flex: 1;
  padding: 24px 20px 100px;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
  animation: fadeIn 0.35s ease;
}

.view.active {
  display: block;
}

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

/* =========================================
   NAVIGATION
   ========================================= */

nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 10px 0 14px;
  z-index: 100;
  box-shadow: 0 -4px 20px rgba(61, 53, 53, 0.06);
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  transition: color var(--transition);
  text-decoration: none;
}

.nav-btn .nav-icon {
  font-size: 22px;
  line-height: 1;
}

.nav-btn.active,
.nav-btn:hover {
  color: var(--primary);
}

/* =========================================
   TYPOGRAPHY
   ========================================= */

h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
  line-height: 1.2;
}

h2 {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
}

h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}

p {
  color: var(--text);
  font-size: 15px;
}

.muted {
  color: var(--muted);
  font-size: 14px;
}

.page-header {
  margin-bottom: 28px;
}

.page-header h1 {
  margin-bottom: 6px;
}

/* =========================================
   CARDS & SURFACES
   ========================================= */

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.card-sm {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}

/* =========================================
   BUTTONS
   ========================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: 50px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  width: 100%;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(155, 142, 196, 0.35);
}

.btn-accent {
  background: var(--accent);
  color: white;
}

.btn-accent:hover:not(:disabled) {
  background: #628065;
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-outline:hover:not(:disabled) {
  background: var(--primary);
  color: white;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.btn-ghost:hover {
  color: var(--text);
}

.btn-sm {
  padding: 10px 18px;
  font-size: 14px;
  width: auto;
}

/* =========================================
   FORMS
   ========================================= */

label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

textarea, input[type="text"], input[type="date"], select {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition);
  outline: none;
  resize: vertical;
}

textarea:focus, input[type="text"]:focus, input[type="date"]:focus, select:focus {
  border-color: var(--primary);
}

textarea {
  min-height: 120px;
}

.form-group {
  margin-bottom: 20px;
}

/* =========================================
   HOME VIEW
   ========================================= */

.home-header {
  text-align: center;
  padding: 32px 0 24px;
}

.home-header .greeting {
  font-size: 15px;
  color: var(--muted);
  margin-bottom: 4px;
}

.streak-display {
  text-align: center;
  padding: 32px 24px;
  background: linear-gradient(135deg, #f3effa, #eef4ef);
  border-radius: var(--radius);
  margin-bottom: 24px;
}

.streak-number {
  font-size: 72px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
  letter-spacing: -2px;
}

.streak-label {
  font-size: 16px;
  color: var(--muted);
  margin-top: 4px;
  text-transform: lowercase;
  letter-spacing: 1px;
}

.streak-milestone {
  margin-top: 16px;
  font-size: 14px;
  color: var(--accent);
  font-style: italic;
  font-weight: 500;
}

.streak-setup {
  text-align: center;
}

.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.quick-action-btn {
  background: var(--surface);
  border: none;
  border-radius: var(--radius);
  padding: 20px 16px;
  cursor: pointer;
  text-align: center;
  box-shadow: var(--shadow);
  transition: all var(--transition);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.quick-action-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.quick-action-btn .icon {
  font-size: 28px;
}

.quick-action-btn .label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.dont-text-action {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #f9f0ff, #ffe8f0);
  border: 2px solid var(--primary-light);
}

/* =========================================
   PROGRESS BAR (Don't Text flow)
   ========================================= */

.progress-bar-wrap {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  margin-bottom: 32px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 3px;
  transition: width 0.5s ease;
}

.step-indicator {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  margin-bottom: 8px;
}

/* =========================================
   BREATHING ANIMATIONS
   ========================================= */

/* Box Breathing */
.box-breathing-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0;
}

.box-svg-wrap {
  width: 200px;
  height: 200px;
  margin: 20px auto;
}

.box-svg-wrap svg {
  width: 100%;
  height: 100%;
}

.breath-phase {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  text-align: center;
  min-height: 32px;
}

.breath-count {
  font-size: 48px;
  font-weight: 800;
  color: var(--primary);
  text-align: center;
  min-height: 64px;
  line-height: 1;
}

.breath-instruction {
  font-size: 15px;
  color: var(--muted);
  text-align: center;
  margin-top: 8px;
}

/* 4-7-8 Circle Breathing */
.circle-breathing-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0;
}

.breath-circle {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--primary-light), var(--primary));
  margin: 24px auto;
  transition: transform 0.5s ease, opacity 0.5s ease;
  box-shadow: 0 0 40px rgba(155, 142, 196, 0.4);
}

/* Grounding */
.grounding-step {
  text-align: center;
  padding: 20px 0;
}

.grounding-number {
  font-size: 80px;
  font-weight: 800;
  color: var(--primary-light);
  line-height: 1;
  margin-bottom: 8px;
}

.grounding-prompt {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 24px;
}

/* =========================================
   INTENTIONS
   ========================================= */

.affirmation-card {
  background: linear-gradient(135deg, #f3effa, #eef9f0);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-align: center;
  margin-bottom: 20px;
}

.affirmation-text {
  font-size: 19px;
  font-weight: 500;
  color: var(--text);
  font-style: italic;
  line-height: 1.5;
  margin-bottom: 16px;
}

/* =========================================
   JOURNAL
   ========================================= */

.journal-entry-preview {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  cursor: pointer;
  transition: all var(--transition);
  border-left: 3px solid var(--primary-light);
}

.journal-entry-preview:hover {
  transform: translateX(3px);
  border-left-color: var(--primary);
}

.entry-date {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.entry-prompt-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 6px;
}

.entry-preview-text {
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
}

.entry-full {
  display: none;
  font-size: 15px;
  color: var(--text);
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  line-height: 1.7;
  white-space: pre-wrap;
}

.entry-full.open {
  display: block;
}

/* =========================================
   DON'T TEXT — Step Styles
   ========================================= */

.dont-text-step {
  display: none;
}

.dont-text-step.active {
  display: block;
  animation: fadeIn 0.35s ease;
}

.step-emoji {
  font-size: 40px;
  text-align: center;
  margin-bottom: 16px;
}

.why-text {
  font-size: 18px;
  font-weight: 500;
  font-style: italic;
  color: var(--text);
  line-height: 1.6;
  padding: 20px;
  background: linear-gradient(135deg, #f3effa, #eef9f0);
  border-radius: var(--radius);
  text-align: center;
  margin-bottom: 20px;
}

.timer-display {
  font-size: 64px;
  font-weight: 800;
  color: var(--primary);
  text-align: center;
  min-height: 80px;
  line-height: 1;
}

.timer-ring {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 6px solid var(--border);
  margin: 20px auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.confetti-area {
  text-align: center;
  padding: 20px 0;
}

.confetti-emoji {
  font-size: 48px;
  display: block;
  margin-bottom: 12px;
  animation: bounce 0.8s ease infinite alternate;
}

@keyframes bounce {
  from { transform: translateY(0); }
  to   { transform: translateY(-10px); }
}

/* =========================================
   MINI BOX BREATHING (in Don't Text)
   ========================================= */

.mini-box-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
}

.mini-box-svg {
  width: 140px;
  height: 140px;
  margin: 12px auto;
}

/* =========================================
   BREATHE VIEW SELECTOR
   ========================================= */

.breathe-option {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px 20px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 16px;
  border: 2px solid transparent;
  transition: all var(--transition);
  text-decoration: none;
}

.breathe-option:hover {
  border-color: var(--primary-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.breathe-option-icon {
  font-size: 32px;
  flex-shrink: 0;
}

.breathe-option-text h3 {
  margin-bottom: 2px;
}

.breathe-option-text p {
  font-size: 13px;
  color: var(--muted);
}

/* =========================================
   BACK BUTTON
   ========================================= */

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-bottom: 20px;
  transition: color var(--transition);
}

.back-btn:hover {
  color: var(--primary);
}

/* =========================================
   DIVIDERS & MISC
   ========================================= */

.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

.tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 600;
  background: var(--primary-light);
  color: var(--primary-dark);
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}

.empty-state .empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

/* =========================================
   BOX BREATHING SVG ANIMATION
   ========================================= */

.box-path {
  fill: none;
  stroke: var(--primary);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.box-path-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 4;
}

.box-path-active {
  fill: none;
  stroke: var(--primary);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 600;
  stroke-dashoffset: 600;
  filter: drop-shadow(0 0 6px rgba(155, 142, 196, 0.6));
}

/* =========================================
   RESPONSIVE
   ========================================= */

@media (max-width: 360px) {
  .streak-number { font-size: 56px; }
  .quick-actions { grid-template-columns: 1fr 1fr; gap: 8px; }
  .view { padding: 20px 16px 96px; }
}
