:root {
  --canvas: #eef3ee;
  --paper: #f8faf7;
  --surface: #ffffff;
  --surface-soft: #f2f6f1;
  --ink: #111c17;
  --muted: #69766f;
  --faint: #8c9992;
  --green: #1f8a5b;
  --green-deep: #0f4f35;
  --green-soft: #dcefe5;
  --mint: #7fd6a7;
  --gold: #c7a24a;
  --danger: #c93f3b;
  --line: rgba(17, 28, 23, 0.1);
  --line-strong: rgba(17, 28, 23, 0.16);
  --shadow: 0 22px 55px rgba(17, 28, 23, 0.14);
  --soft-shadow: 0 12px 30px rgba(17, 28, 23, 0.09);
  --radius: 8px;
  color-scheme: light;
  font-family: "DM Sans", Inter, system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 50% -12%, rgba(31, 138, 91, 0.2), transparent 31rem),
    linear-gradient(180deg, #e9f1ea 0%, #f6f8f6 50%, #e7eee8 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(31, 138, 91, 0.24);
  outline-offset: 2px;
}

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 430px;
  margin: 0 auto;
  overflow: hidden;
  padding-bottom: calc(82px + env(safe-area-inset-bottom, 0px));
  background: var(--paper);
  box-shadow: 0 28px 80px rgba(17, 28, 23, 0.18);
}

.screen {
  min-height: calc(100vh - 82px);
  min-height: calc(100dvh - 82px);
}

.garden {
  display: flex;
  min-height: calc(100vh - 82px);
  min-height: calc(100dvh - 82px);
  flex-direction: column;
  background: linear-gradient(180deg, #f8faf7 0%, #eff5ef 100%);
}

.landscape {
  position: relative;
  display: grid;
  min-height: 58vh;
  overflow: hidden;
  padding: calc(44px + env(safe-area-inset-top, 0px)) 18px 0;
  background:
    radial-gradient(circle at 82% 12%, rgba(127, 214, 167, 0.16), transparent 11rem),
    linear-gradient(180deg, #fbfdf8 0%, #eaf8f1 38%, #d8f0dc 62%, #badfbb 100%);
}

.landscape::before,
.landscape::after {
  position: absolute;
  content: "";
  pointer-events: none;
}

.landscape::before {
  inset: 43% -16% auto -16%;
  height: 36%;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 26% 62%, rgba(134, 197, 128, 0.5) 0 19%, transparent 20%),
    radial-gradient(ellipse at 70% 52%, rgba(103, 179, 119, 0.45) 0 25%, transparent 26%),
    linear-gradient(180deg, rgba(231, 246, 226, 0.82), rgba(111, 176, 95, 0.5));
}

.landscape::after {
  right: -34px;
  bottom: 78px;
  width: 160px;
  height: 190px;
  opacity: 0.65;
  border-radius: 56% 44% 0 0;
  background:
    radial-gradient(ellipse at 38% 78%, rgba(15, 79, 53, 0.2) 0 11%, transparent 12%),
    radial-gradient(ellipse at 57% 66%, rgba(15, 79, 53, 0.22) 0 12%, transparent 13%),
    linear-gradient(180deg, rgba(76, 139, 95, 0.48), rgba(53, 111, 72, 0.23));
  clip-path: polygon(38% 0, 48% 44%, 69% 5%, 65% 62%, 98% 24%, 74% 76%, 100% 100%, 0 100%, 30% 74%, 3% 31%, 34% 61%);
}

.sun {
  position: absolute;
  top: 68px;
  right: 34px;
  z-index: 1;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 36% 34%, #fff8bd 0 18%, transparent 19%),
    radial-gradient(circle, #ffd85c 0 44%, #ffb94a 70%);
  box-shadow:
    0 18px 38px rgba(219, 142, 44, 0.2),
    0 0 68px rgba(255, 199, 91, 0.42);
  animation: sunPulse 5.8s ease-in-out infinite;
}

.sun::before {
  position: absolute;
  inset: -34px;
  border-radius: inherit;
  background: radial-gradient(circle, rgba(255, 215, 116, 0.28), rgba(255, 215, 116, 0.1) 42%, transparent 68%);
  content: "";
}

.sun::after {
  position: absolute;
  top: 18px;
  left: 20px;
  width: 24px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  content: "";
  filter: blur(1px);
}

.cloud {
  position: absolute;
  z-index: 1;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 10px 24px rgba(87, 141, 105, 0.08);
  animation: cloudDrift 14s ease-in-out infinite;
}

.cloud::before,
.cloud::after {
  position: absolute;
  border-radius: inherit;
  background: inherit;
  content: "";
}

.cloud.one {
  top: 122px;
  right: 68px;
  width: 80px;
  height: 22px;
}

.cloud.one::before {
  top: -14px;
  left: 12px;
  width: 34px;
  height: 34px;
}

.cloud.one::after {
  top: -9px;
  right: 12px;
  width: 25px;
  height: 25px;
}

.cloud.two {
  top: 188px;
  left: 24px;
  width: 94px;
  height: 24px;
  opacity: 0.58;
  animation-delay: -4s;
}

.cloud.two::before {
  top: -16px;
  left: 18px;
  width: 36px;
  height: 36px;
}

.cloud.two::after {
  top: -10px;
  right: 16px;
  width: 28px;
  height: 28px;
}

.brand {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.brand h1 {
  margin: 0;
  color: var(--green-deep);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 46px;
  font-style: italic;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 0.95;
}

.brand p {
  display: inline-flex;
  margin: 10px 0 0;
  border: 1px solid rgba(15, 79, 53, 0.12);
  border-radius: 999px;
  padding: 5px 10px;
  background: rgba(255, 255, 255, 0.64);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  backdrop-filter: blur(14px);
}

.round-action {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--soft-shadow);
  color: var(--green-deep);
  font-size: 22px;
}

.hero-stats {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 22px;
}

.hero-card {
  min-height: 96px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius);
  padding: 14px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(18px);
}

.hero-card.warm {
  background: rgba(249, 251, 247, 0.82);
}

.hero-label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.hero-value {
  margin-top: 10px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
}

.bar {
  height: 7px;
  overflow: hidden;
  margin-top: 13px;
  border-radius: 999px;
  background: rgba(15, 79, 53, 0.1);
}

.bar span {
  display: block;
  width: var(--progress);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--mint), var(--green));
  box-shadow: 0 0 18px rgba(31, 138, 91, 0.28);
  transition: width 340ms ease;
}

.plant-stage {
  position: relative;
  z-index: 2;
  width: min(79vw, 318px);
  margin: auto auto 6px;
  aspect-ratio: 1 / 1.05;
}

.plant-stage::before {
  position: absolute;
  right: 18%;
  bottom: 4%;
  width: 58%;
  height: 13%;
  border-radius: 50%;
  background: rgba(17, 28, 23, 0.16);
  content: "";
  filter: blur(8px);
}

.plant-stage svg {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 18px 18px rgba(17, 28, 23, 0.17)) saturate(1.08);
}

.plant-stage.celebrate svg {
  animation: plantCelebrate 680ms cubic-bezier(0.18, 0.82, 0.3, 1);
}

.plant {
  transform-origin: 50% 82%;
  animation: breathe 5.8s ease-in-out infinite;
}

.stem,
.leaf,
.bloom,
.bud,
.seed,
.sprout {
  transition: opacity 420ms ease, transform 560ms cubic-bezier(0.18, 0.82, 0.3, 1);
  transform-box: fill-box;
  transform-origin: center bottom;
}

.hidden-growth {
  opacity: 0;
  transform: scale(0.2) translateY(22px) rotate(-12deg);
}

.soft-growth {
  opacity: 0.45;
  transform: scale(0.72) translateY(8px) rotate(-5deg);
}

.full-growth {
  opacity: 1;
  transform: scale(1) translateY(0) rotate(0);
}

.ground-details {
  position: absolute;
  right: 0;
  bottom: 25px;
  left: 0;
  z-index: 1;
  height: 86px;
  pointer-events: none;
}

.ground-details span {
  position: absolute;
  display: block;
  border-radius: 50%;
}

.stone {
  background: rgba(17, 28, 23, 0.14);
}

.stone.one {
  right: 38px;
  bottom: 18px;
  width: 38px;
  height: 20px;
}

.stone.two {
  left: 28px;
  bottom: 8px;
  width: 48px;
  height: 24px;
}

.flower {
  width: 8px;
  height: 8px;
  background: rgba(199, 162, 74, 0.55);
  box-shadow: 12px -8px 0 rgba(255, 255, 255, 0.76), 20px 2px 0 rgba(199, 162, 74, 0.45);
}

.flower.one {
  left: 56px;
  bottom: 44px;
}

.flower.two {
  right: 82px;
  bottom: 38px;
}

.garden-card {
  position: relative;
  z-index: 4;
  margin: -18px 14px 18px;
  padding: 16px 14px 14px;
  border: 1px solid rgba(17, 28, 23, 0.09);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.93);
  box-shadow: var(--shadow);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  padding: 0 2px;
}

.section-head h2,
.page h2 {
  margin: 0;
  color: var(--ink);
  font-size: 21px;
  font-weight: 800;
  line-height: 1;
}

.section-head p,
.subtle {
  display: block;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.add-pill {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(15, 79, 53, 0.1);
  border-radius: 999px;
  padding: 9px 13px;
  background: var(--green-deep);
  color: white;
  box-shadow: 0 10px 22px rgba(15, 79, 53, 0.18);
  font-weight: 800;
}

.habit-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.habit-row {
  display: grid;
  width: 100%;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 61px;
  border: 0;
  padding: 0 12px;
  border-top: 1px solid var(--line);
  background: transparent;
  color: inherit;
  text-align: left;
}

.habit-row:hover {
  background: var(--surface-soft);
}

.habit-row:first-child {
  border-top: 0;
}

.habit-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid rgba(17, 28, 23, 0.07);
  border-radius: var(--radius);
  background: #f6f8f6;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  font-size: 18px;
}

.habit-copy {
  min-width: 0;
}

.habit-name {
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.habit-row.done .habit-name {
  color: var(--faint);
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.habit-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.check {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1.5px solid rgba(17, 28, 23, 0.28);
  border-radius: 50%;
  background: transparent;
  color: transparent;
  font-size: 15px;
  font-weight: 800;
}

.habit-row.done .check {
  border-color: var(--green);
  background: var(--green);
  color: white;
  box-shadow: 0 8px 18px rgba(31, 138, 91, 0.2);
}

.habit-row.celebrate .check {
  animation: checkPop 560ms cubic-bezier(0.18, 0.82, 0.3, 1);
}

.habit-row.celebrate .habit-icon {
  animation: iconLift 560ms cubic-bezier(0.18, 0.82, 0.3, 1);
}

.empty {
  padding: 34px 10px;
  color: var(--muted);
  text-align: center;
}

.page {
  padding: calc(44px + env(safe-area-inset-top, 0px)) 16px 18px;
  background:
    radial-gradient(circle at 50% -8%, rgba(31, 138, 91, 0.12), transparent 18rem),
    linear-gradient(180deg, #f8faf7 0%, #eef4ef 100%);
}

.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.back-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  box-shadow: var(--soft-shadow);
  font-size: 28px;
}

.primary,
.secondary,
.danger,
.icon-button {
  border: 0;
  border-radius: 999px;
  font-weight: 800;
}

.primary {
  padding: 12px 18px;
  background: linear-gradient(180deg, #259a66, var(--green-deep));
  color: white;
  box-shadow: 0 12px 24px rgba(15, 79, 53, 0.22);
}

.secondary {
  padding: 11px 16px;
  background: var(--green-soft);
  color: var(--green-deep);
}

.danger {
  padding: 11px 16px;
  background: #fff1f0;
  color: var(--danger);
}

.icon-button {
  width: 34px;
  height: 34px;
  background: #f2f5f2;
  color: var(--muted);
  font-size: 18px;
}

.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.danger-icon {
  background: #fff1f0;
  color: var(--danger);
}

.habit-card,
.stat-card,
.settings-block {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--soft-shadow);
}

.habit-card {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  margin-bottom: 9px;
  padding: 12px;
}

.habit-tools {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.habit-tools .icon-button {
  width: 100%;
}

.grid-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin-bottom: 18px;
}

.stat-card {
  padding: 14px 10px;
}

.stat-card strong {
  display: block;
  color: var(--green-deep);
  font-size: 27px;
  font-weight: 800;
  line-height: 1;
}

.stat-card span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
}

.calendar {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--soft-shadow);
}

.calendar-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 9px;
  color: var(--ink);
  font-weight: 800;
}

.legend {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.calendar-head,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.calendar-head span {
  padding: 10px 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.day {
  display: grid;
  min-height: 42px;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.day span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
}

.day.empty-cell {
  visibility: hidden;
}

.day.partial span {
  background: #e6e9e4;
}

.day.complete span {
  background: var(--green);
  color: white;
  box-shadow: 0 8px 16px rgba(31, 138, 91, 0.18);
}

.settings-block {
  display: grid;
  gap: 14px;
  margin-bottom: 13px;
  padding: 14px;
}

.backup-actions {
  display: flex;
  flex-shrink: 0;
  gap: 8px;
}

.file-input {
  display: none;
}

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

.field label {
  color: var(--green-deep);
  font-size: 12px;
  font-weight: 800;
}

.field input,
.field select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 12px;
  background: #fff;
  color: var(--ink);
}

.icon-picker {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
}

.icon-choice {
  display: grid;
  min-height: 48px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92);
  font-size: 23px;
}

.icon-choice.active {
  border-color: rgba(15, 79, 53, 0.34);
  background: var(--green-soft);
  box-shadow: 0 9px 18px rgba(15, 79, 53, 0.12);
}

.field-error {
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
}

.toggle-row,
.action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

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

.nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
  display: grid;
  max-width: 430px;
  margin: 0 auto;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid rgba(17, 28, 23, 0.09);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 -16px 38px rgba(17, 28, 23, 0.1);
  backdrop-filter: blur(18px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.nav button {
  display: grid;
  gap: 3px;
  place-items: center;
  border: 0;
  padding: 10px 4px 11px;
  background: transparent;
  color: var(--faint);
  font-size: 11px;
  font-weight: 800;
}

.nav button.active {
  color: var(--green-deep);
}

.nav button.active svg {
  padding: 6px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green-deep);
}

.nav svg {
  width: 28px;
  height: 28px;
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  align-items: end;
  background: rgba(17, 28, 23, 0.34);
  backdrop-filter: blur(6px);
}

.sheet {
  width: min(430px, 100%);
  margin: 0 auto;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 18px 18px 0 0;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.sheet h3 {
  margin: 0 0 18px;
  font-size: 22px;
  font-weight: 800;
}

.sheet-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.sheet-actions button {
  flex: 1;
}

@keyframes breathe {
  0%,
  100% {
    transform: rotate(-0.7deg) translateY(0);
  }
  50% {
    transform: rotate(0.9deg) translateY(-2px);
  }
}

@keyframes sunPulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.92;
  }
  50% {
    transform: scale(1.06);
    opacity: 1;
  }
}

@keyframes cloudDrift {
  0%,
  100% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(-14px);
  }
}

@keyframes checkPop {
  0% {
    transform: scale(0.82);
  }
  55% {
    transform: scale(1.14);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes iconLift {
  0%,
  100% {
    transform: translateY(0);
  }
  45% {
    transform: translateY(-3px);
  }
}

@keyframes plantCelebrate {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  45% {
    transform: translateY(-5px) scale(1.025);
  }
}

@media (min-width: 520px) {
  body {
    padding: 18px 0;
  }

  .app-shell {
    min-height: calc(100vh - 36px);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 22px;
  }

  .nav {
    bottom: 18px;
    border-radius: 0 0 22px 22px;
  }
}
