/* ===== RESET & BASE ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI',
    Roboto, 'Helvetica Neue', Arial, sans-serif;
  min-height: 100vh;
  min-height: 100dvh;
  background: linear-gradient(160deg, #fefaff 0%, #f5eeff 42%, #eef5ff 100%);
  color: #2d1b5e;
  overflow-x: hidden;
  position: relative;
}

/* ===== BACKGROUND BLOBS ===== */
.blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(72px);
  pointer-events: none;
  z-index: 0;
  will-change: transform;
}

.blob-1 {
  width: 380px;
  height: 380px;
  background: rgba(200, 162, 255, 0.32);
  top: -130px;
  right: -110px;
}

.blob-2 {
  width: 300px;
  height: 300px;
  background: rgba(255, 182, 210, 0.32);
  bottom: 60px;
  left: -100px;
}

.blob-3 {
  width: 240px;
  height: 240px;
  background: rgba(172, 216, 255, 0.28);
  top: 44%;
  right: -80px;
}

/* ===== HOME PAGE ===== */
.page-home {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding:
    max(52px, env(safe-area-inset-top, 52px))
    24px
    max(36px, env(safe-area-inset-bottom, 36px));
  max-width: 520px;
  margin: 0 auto;
}

/* ===== HEADER ===== */
.home-header {
  text-align: center;
  margin-bottom: 44px;
  animation: slideDown 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.header-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
  background: linear-gradient(
    135deg,
    rgba(210, 178, 255, 0.55),
    rgba(255, 178, 210, 0.55)
  );
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  box-shadow:
    0 4px 24px rgba(180, 140, 225, 0.22),
    0 0 0 6px rgba(210, 178, 255, 0.12);
  animation: breathe 4.5s ease-in-out infinite;
}

.home-title {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.8px;
  color: #2d1b5e;
  line-height: 1.1;
}

.home-subtitle {
  margin-top: 8px;
  font-size: 15px;
  color: #9580c0;
  font-weight: 400;
  letter-spacing: 0.08px;
}

/* ===== BUTTONS ===== */
.buttons-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  justify-content: center;
}

.help-btn {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 90px;
  padding: 20px 22px;
  border-radius: 24px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition:
    transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.18s ease;
  animation: slideUp 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  -webkit-user-select: none;
  user-select: none;
}

/* Top highlight shine */
.help-btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 45%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.28) 0%, transparent 100%);
  border-radius: 24px 24px 0 0;
  pointer-events: none;
}

.help-btn:active {
  transform: scale(0.975) translateY(2px);
  box-shadow: none !important;
}

/* Button 1 — Calm (lavender) */
.btn-calm {
  background: linear-gradient(135deg, #ede3f8 0%, #e0d2f5 100%);
  box-shadow:
    0 10px 32px rgba(158, 118, 220, 0.22),
    0 2px 8px rgba(158, 118, 220, 0.12);
  animation-delay: 0.06s;
}

/* Button 2 — Call (rose) */
.btn-call {
  background: linear-gradient(135deg, #fde6ee 0%, #fbd1e2 100%);
  box-shadow:
    0 10px 32px rgba(228, 126, 168, 0.22),
    0 2px 8px rgba(228, 126, 168, 0.12);
  animation-delay: 0.14s;
}

/* Button 3 — I (sky) */
.btn-i {
  background: linear-gradient(135deg, #e0edf8 0%, #cce2f5 100%);
  box-shadow:
    0 10px 32px rgba(112, 168, 228, 0.22),
    0 2px 8px rgba(112, 168, 228, 0.12);
  animation-delay: 0.22s;
}

/* Icon pill */
.btn-icon-wrap {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
}

.btn-calm .btn-icon-wrap {
  background: rgba(170, 130, 238, 0.18);
}

.btn-call .btn-icon-wrap {
  background: rgba(238, 130, 170, 0.18);
}

.btn-i .btn-icon-wrap {
  background: rgba(130, 185, 238, 0.18);
}

/* Text */
.btn-content {
  flex: 1;
  min-width: 0;
}

.btn-label {
  display: block;
  font-size: 20px;
  font-weight: 700;
  color: #2d1b5e;
  line-height: 1.28;
  letter-spacing: -0.25px;
}

/* Arrow */
.btn-arrow {
  font-size: 22px;
  font-weight: 300;
  color: rgba(45, 27, 94, 0.3);
  flex-shrink: 0;
  line-height: 1;
  margin-right: 2px;
}

/* ===== INSTALL BANNER ===== */
.install-banner {
  margin-top: 28px;
  text-align: center;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.35s ease, transform 0.35s ease;
  pointer-events: none;
}

.install-banner.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.install-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1.5px solid rgba(196, 168, 248, 0.4);
  border-radius: 22px;
  font-size: 14px;
  font-weight: 600;
  color: #6244b8;
  cursor: pointer;
  box-shadow: 0 2px 14px rgba(150, 110, 220, 0.14);
  transition: transform 0.15s ease;
  font-family: inherit;
}

.install-btn:active {
  transform: scale(0.96);
}

/* ===== SUB-PAGE ===== */
.page-sub {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 520px;
  margin: 0 auto;
  padding:
    max(12px, env(safe-area-inset-top, 12px))
    16px
    max(28px, env(safe-area-inset-bottom, 28px));
}

.sub-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 8px 20px;
  animation: slideDown 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.back-btn {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1.5px solid rgba(196, 168, 248, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-shadow: 0 2px 14px rgba(150, 110, 220, 0.12);
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
  color: #2d1b5e;
}

.back-btn:active {
  transform: scale(0.9);
}

.back-btn svg {
  width: 20px;
  height: 20px;
}

.sub-page-title {
  font-size: 18px;
  font-weight: 700;
  color: #2d1b5e;
  line-height: 1.3;
  letter-spacing: -0.2px;
}

.sub-content {
  flex: 1;
  padding: 8px 8px 0;
  animation: fadeIn 0.4s ease 0.1s both;
}

/* ===== ANIMATIONS ===== */
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-18px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

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

@keyframes breathe {
  0%, 100% {
    transform: scale(1);
    box-shadow:
      0 4px 24px rgba(180, 140, 225, 0.22),
      0 0 0 6px rgba(210, 178, 255, 0.12);
  }
  50% {
    transform: scale(1.05);
    box-shadow:
      0 8px 36px rgba(180, 140, 225, 0.38),
      0 0 0 10px rgba(210, 178, 255, 0.08);
  }
}

/* ===== SPA VIEWS ===== */
.view {
  position: fixed;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
  will-change: opacity;
}

.view.active {
  opacity: 1;
  pointer-events: auto;
}

/* Fade out home content when call overlay takes over */
.page-home {
  transition: opacity 0.3s ease;
}

.page-home.faded {
  opacity: 0;
  pointer-events: none;
}

/* ===== CALL OVERLAY ===== */
.call-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 32px max(48px, env(safe-area-inset-bottom, 48px));
  background: linear-gradient(160deg, #fefaff 0%, #f5eeff 42%, #eef5ff 100%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

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

.call-emoji {
  font-size: 84px;
  margin-bottom: 24px;
  animation: callPulse 2s ease-in-out infinite;
  filter: drop-shadow(0 8px 24px rgba(228, 126, 168, 0.35));
}

.call-title {
  font-size: 52px;
  font-weight: 800;
  color: #2d1b5e;
  letter-spacing: -2px;
  line-height: 1;
  margin-bottom: 14px;
}

.call-subtitle {
  font-size: 17px;
  color: #9580c0;
  line-height: 1.6;
  max-width: 260px;
}

.call-heart {
  font-size: 32px;
  margin-top: 8px;
  animation: breathe 3.5s ease-in-out infinite;
}

.call-back-btn {
  appearance: none;
  -webkit-appearance: none;
  margin-top: 48px;
  padding: 14px 34px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1.5px solid rgba(196, 168, 248, 0.4);
  font-size: 15px;
  font-weight: 600;
  color: #6244b8;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 2px 14px rgba(150, 110, 220, 0.14);
  transition: transform 0.15s ease;
}

.call-back-btn:active {
  transform: scale(0.96);
}

@keyframes callPulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.08); }
}

/* ===== UPDATE BANNER ===== */
.update-banner {
  position: fixed;
  bottom: max(24px, env(safe-area-inset-bottom, 24px));
  left: 50%;
  transform: translateX(-50%) translateY(140%);
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px 12px 20px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1.5px solid rgba(196, 168, 248, 0.45);
  border-radius: 22px;
  box-shadow: 0 8px 32px rgba(150, 110, 220, 0.18);
  white-space: nowrap;
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.update-banner.visible {
  transform: translateX(-50%) translateY(0);
}

.update-banner-text {
  font-size: 14px;
  font-weight: 600;
  color: #2d1b5e;
}

.update-refresh-btn {
  appearance: none;
  -webkit-appearance: none;
  padding: 8px 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, #ede3f8, #e0d2f5);
  border: none;
  font-size: 13px;
  font-weight: 700;
  color: #6244b8;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.15s ease;
}

.update-refresh-btn:active {
  transform: scale(0.95);
}

/* Reset <button> appearance for nav buttons */
.help-btn {
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
}

.back-btn {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  font-family: inherit;
}

/* ===== RESPONSIVE — larger screens ===== */
@media (min-width: 480px) {
  .home-title { font-size: 40px; }
  .btn-label  { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
