:root {
  --ink: #14261f;
  --ink-soft: #3d5248;
  --mist: #e7f0ea;
  --mist-deep: #d3e4da;
  --leaf: #1b3a2f;
  --leaf-mid: #2f6b55;
  --sun: #f0b429;
  --bloom: #e85d4c;
  --foam: rgba(255, 255, 255, 0.72);
  --line: rgba(20, 38, 31, 0.12);
  --shadow: 0 18px 50px rgba(20, 38, 31, 0.12);
  --radius: 22px;
  --font-display: "Syne", sans-serif;
  --font-body: "Figtree", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html,
body {
  min-height: 100%;
  min-height: 100svh;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-body);
  background-color: #e4efe8;
  background-image:
    radial-gradient(120% 80% at 10% -10%, #f7fbf8 0%, transparent 55%),
    radial-gradient(90% 70% at 100% 0%, #d8ebe0 0%, transparent 50%),
    linear-gradient(165deg, #f3f8f5 0%, #e4efe8 48%, #d7e8de 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

.atmosphere {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(20, 38, 31, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 38, 31, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 35%, transparent 80%);
  pointer-events: none;
  z-index: 0;
}

.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(40px);
  pointer-events: none;
  z-index: 0;
  animation: drift 14s var(--ease) infinite alternate;
}

.orb-a {
  width: 280px;
  height: 280px;
  top: -60px;
  right: -40px;
  background: rgba(240, 180, 41, 0.28);
}

.orb-b {
  width: 320px;
  height: 320px;
  bottom: 8%;
  left: -80px;
  background: rgba(47, 107, 85, 0.22);
  animation-delay: -4s;
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(18px, 24px, 0) scale(1.08); }
}

.app {
  position: relative;
  z-index: 1;
  width: min(480px, 100%);
  margin: 0 auto;
  padding: max(28px, env(safe-area-inset-top)) 22px max(36px, env(safe-area-inset-bottom));
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  animation: rise 0.55s var(--ease) both;
}

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

.brand {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 0.95;
  margin: 0;
}

.brand-lg {
  font-size: clamp(3.4rem, 14vw, 4.6rem);
  color: var(--leaf);
}

.brand-sm {
  font-size: 1.15rem;
  color: var(--leaf);
}

.lede {
  margin: 18px 0 0;
  font-size: 1.125rem;
  line-height: 1.45;
  color: var(--ink-soft);
  max-width: 22ch;
}

.hero-space {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 36px;
  padding-top: clamp(48px, 12vh, 120px);
  padding-bottom: 8px;
  min-height: min(72svh, 720px);
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1rem;
  border-radius: 999px;
  padding: 0.95rem 1.4rem;
  transition: transform 0.2s var(--ease), background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--leaf);
  color: #f4faf6;
  box-shadow: 0 10px 28px rgba(27, 58, 47, 0.28);
}

.btn-primary:hover {
  background: #23493b;
}

.btn-accent {
  background: var(--bloom);
  color: #fff7f5;
  box-shadow: 0 12px 30px rgba(232, 93, 76, 0.32);
}

.btn-accent:hover {
  background: #d64e3e;
}

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  padding-left: 0.6rem;
  padding-right: 0.6rem;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.section-head {
  margin-top: 8px;
}

.section-head h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 8vw, 2.6rem);
  letter-spacing: -0.03em;
  margin: 10px 0 0;
  line-height: 1.05;
}

.section-head p {
  margin: 12px 0 0;
  color: var(--ink-soft);
  line-height: 1.45;
}

.habit-list {
  list-style: none;
  margin: 28px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.habit-option {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--foam);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 14px 16px;
  font: inherit;
  color: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), transform 0.2s var(--ease);
}

.habit-option:hover {
  border-color: rgba(47, 107, 85, 0.35);
}

.habit-option.is-selected {
  border-color: var(--leaf-mid);
  background: rgba(47, 107, 85, 0.1);
  transform: translateX(2px);
}

.habit-option .check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(27, 58, 47, 0.25);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 0.75rem;
  color: transparent;
  transition: all 0.2s var(--ease);
}

.habit-option.is-selected .check {
  background: var(--leaf);
  border-color: var(--leaf);
  color: #fff;
}

.footer-actions {
  margin-top: auto;
  padding-top: 24px;
  display: flex;
  gap: 12px;
  align-items: center;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.streak-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  background: rgba(240, 180, 41, 0.18);
  color: #7a5608;
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  font-weight: 700;
  font-size: 0.92rem;
}

.streak-pill strong {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--ink);
}

.today-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
  padding: 28px 0 18px;
}

.kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--leaf-mid);
}

.challenge-title {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 9vw, 3rem);
  letter-spacing: -0.035em;
  line-height: 1.05;
  margin: 0;
  max-width: 11ch;
}

.challenge-meta {
  margin: 0;
  color: var(--ink-soft);
  font-size: 1.05rem;
}

.progress-ring {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(27, 58, 47, 0.1);
  overflow: hidden;
}

.progress-ring > span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--leaf-mid), var(--sun));
  border-radius: inherit;
  transition: width 0.6s var(--ease);
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.badge {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.4rem 0.7rem;
  background: rgba(255, 255, 255, 0.45);
}

.badge.is-earned {
  color: var(--leaf);
  border-color: rgba(47, 107, 85, 0.35);
  background: rgba(47, 107, 85, 0.1);
}

.done-burst {
  animation: burst 0.7s var(--ease) both;
}

@keyframes burst {
  0% { transform: scale(0.96); }
  40% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

.celebration {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.6rem;
  letter-spacing: -0.03em;
  color: var(--leaf);
}

.muted {
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.4;
}

.linkish {
  background: none;
  border: 0;
  color: var(--leaf-mid);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 0;
}

.account-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 58%;
  border: 0;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  padding: 4px 10px 4px 4px;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.account-chip img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.account-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.85rem;
  font-weight: 600;
}

.google-slot {
  min-height: 44px;
  display: flex;
  align-items: center;
}

.auth-note {
  margin: 10px 0 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
  max-width: 28ch;
}

.settings-card {
  margin-top: 24px;
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  font-weight: 700;
  font-size: 0.92rem;
}

.field input[type="time"] {
  font: inherit;
  border: 1px solid var(--line);
  background: var(--foam);
  border-radius: 14px;
  padding: 0.85rem 1rem;
  color: inherit;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.toggle-row input {
  width: 20px;
  height: 20px;
  accent-color: var(--leaf);
}

.user-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-block img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
}

.user-block strong {
  display: block;
  font-size: 1.05rem;
}

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

.error-text {
  color: #b42318;
  font-size: 0.92rem;
  margin: 0;
}

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