:root {
  --ink: #24352f;
  --muted: #708078;
  --cream: #fffaf1;
  --paper: #ffffff;
  --coral: #f07b63;
  --coral-soft: #fff0ea;
  --green: #4f9274;
  --green-soft: #eaf7ef;
  --yellow: #f5c84c;
  --line: #eee9df;
  --shadow: 0 14px 40px rgba(80, 70, 45, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  touch-action: pan-y;
  -webkit-text-size-adjust: 100%;
}

body {
  width: 100%;
  min-width: 0;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at top right, rgba(245, 200, 76, 0.2), transparent 28rem),
    var(--cream);
  color: var(--ink);
  font-family: Inter, ui-rounded, "Nunito Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[hidden] {
  display: none !important;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

.app-shell {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 18px 64px;
  overflow-x: hidden;
}

.topbar,
.section-heading,
.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  padding: 8px 4px 24px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.avatar-actions {
  display: flex;
  justify-content: center;
  margin: -5px 0 18px;
}

.change-avatar-button {
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 800;
}

.change-avatar-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.child-tab-avatar img,
.garden-avatar img {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.child-tab-avatar {
  display: grid;
  width: 46px;
  height: 46px;
  overflow: hidden;
  border-radius: 50%;
  place-items: center;
}

.account-button {
  display: grid;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  place-items: center;
  background: white;
  cursor: pointer;
  font-size: 1.25rem;
  box-shadow: 0 5px 18px rgba(62, 75, 67, 0.1);
}

.login-screen {
  display: grid;
  min-height: 100vh;
  padding: 24px;
  place-items: center;
}

.login-card {
  width: min(100%, 430px);
  padding: 34px 28px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.9);
  text-align: center;
  box-shadow: var(--shadow);
}

.login-card form {
  display: grid;
  gap: 16px;
  margin-top: 28px;
  text-align: left;
}

.login-flower {
  margin-bottom: 10px;
  font-size: 4rem;
  filter: drop-shadow(0 10px 16px rgba(245, 200, 76, 0.28));
}

.login-copy {
  max-width: 320px;
  margin: 10px auto 0;
  color: var(--muted);
  line-height: 1.55;
}

.form-error {
  margin: -4px 0 0;
  color: #b34735;
  font-size: 0.8rem;
  font-weight: 750;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 4px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.85rem, 7vw, 2.6rem);
  letter-spacing: -0.04em;
}

h2 {
  margin-bottom: 0;
  font-size: 1.18rem;
}

h3 {
  margin-bottom: 4px;
}

.eyebrow {
  margin-bottom: 5px;
  color: var(--coral);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.16em;
}

.date-label,
.progress-copy,
.task-meta,
.empty-state p {
  color: var(--muted);
}

.date-label,
.progress-copy {
  margin-bottom: 0;
  font-size: 0.9rem;
}

.round-button,
.icon-button {
  border: 0;
  cursor: pointer;
}

.round-button {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  font-size: 1.7rem;
  box-shadow: var(--shadow);
}

.child-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}

.child-page-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 70px;
  padding: 12px;
  border: 2px solid transparent;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  font-size: 1.05rem;
  box-shadow: 0 8px 24px rgba(80, 70, 45, 0.07);
}

.child-page-tab span {
  font-size: 2rem;
}

.child-page-tab.active {
  border-color: #f3c8b7;
  background: var(--coral-soft);
  color: #8f493a;
}

.family-card,
.leaderboard-card {
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.87);
  box-shadow: var(--shadow);
}

.family-card {
  padding: 22px;
}

.today-score {
  display: flex;
  align-items: baseline;
  gap: 4px;
  padding: 8px 13px;
  border-radius: 20px;
  background: var(--coral-soft);
  color: var(--coral);
}

.today-score strong {
  font-size: 1.35rem;
}

.today-score span {
  font-size: 0.78rem;
  font-weight: 750;
}

.member-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(52px, 1fr));
  gap: 7px;
  margin: 22px 0 18px;
}

.member-tab {
  padding: 8px 4px;
  border: 1px solid transparent;
  border-radius: 17px;
  background: transparent;
  cursor: pointer;
}

.member-tab.active {
  border-color: #f4d8c9;
  background: var(--coral-soft);
}

.member-avatar {
  display: grid;
  width: 40px;
  height: 40px;
  margin: 0 auto 5px;
  place-items: center;
  border-radius: 50%;
  background: white;
  font-size: 1.25rem;
  box-shadow: 0 4px 14px rgba(62, 75, 67, 0.08);
}

.member-tab span:last-child {
  display: block;
  overflow: hidden;
  font-size: 0.72rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf0ec;
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), #86bb8b);
  transition: width 350ms ease;
}

.progress-copy {
  margin-top: 9px;
}

.tasks-section,
.summary-section {
  padding-top: 34px;
}

.section-heading.compact {
  margin-bottom: 14px;
}

.soft-pill {
  padding: 6px 10px;
  border-radius: 99px;
  background: #f0eee8;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.task-list {
  display: grid;
  gap: 12px;
}

.task-card {
  display: grid;
  grid-template-columns: 64px 1fr 54px;
  align-items: center;
  gap: 13px;
  min-height: 88px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 21px;
  background: var(--paper);
  transition: transform 180ms ease, opacity 180ms ease;
}

.task-card:active {
  transform: scale(0.99);
}

.task-card.completed {
  opacity: 0.72;
  background: #f7fbf8;
}

.task-card.completed .task-title {
  text-decoration: line-through;
  text-decoration-color: var(--green);
}

.task-illustration {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(145deg, #fff8dc, #ffeeca);
  font-size: 2rem;
}

.task-content {
  min-width: 0;
}

.task-title {
  margin-bottom: 6px;
  overflow: hidden;
  font-size: 1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-meta {
  margin-bottom: 0;
  font-size: 0.76rem;
}

.flower-button {
  display: grid;
  width: 50px;
  height: 50px;
  border: 0;
  border-radius: 50%;
  place-items: center;
  background: #f6f2eb;
  cursor: pointer;
  font-size: 1.75rem;
}

.flower-full,
.completed .flower-empty {
  display: none;
}

.completed .flower-full {
  display: inline;
  animation: bloom 320ms ease-out;
}

@keyframes bloom {
  0% {
    transform: scale(0.4) rotate(-20deg);
  }
  70% {
    transform: scale(1.18) rotate(8deg);
  }
  100% {
    transform: scale(1);
  }
}

.empty-state {
  padding: 34px 20px;
  border: 2px dashed #dfd9ce;
  border-radius: 22px;
  text-align: center;
}

.empty-illustration {
  margin-bottom: 10px;
  font-size: 2.4rem;
}

.period-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 16px 0;
  padding: 5px;
  border-radius: 16px;
  background: #eceae4;
}

.period-tab {
  padding: 9px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 800;
}

.period-tab.active {
  background: white;
  box-shadow: 0 3px 12px rgba(55, 60, 50, 0.08);
}

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

.stat-card {
  display: grid;
  min-height: 135px;
  padding: 18px;
  border-radius: 22px;
}

.stat-card.coral {
  background: var(--coral-soft);
  color: #914b3c;
}

.stat-card.green {
  background: var(--green-soft);
  color: #32654e;
}

.stat-card .stat-icon {
  font-size: 1.6rem;
}

.stat-card strong {
  align-self: end;
  font-size: 1.8rem;
}

.stat-card span:last-child {
  font-size: 0.78rem;
  font-weight: 750;
}

.leaderboard-card {
  margin-top: 12px;
  padding: 20px;
}

.garden-total {
  display: flex;
  align-items: center;
  gap: 16px;
}

.garden-avatar {
  display: grid;
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
  border-radius: 20px;
  place-items: center;
  background: linear-gradient(145deg, #fff8dc, #ffeeca);
  font-size: 2.1rem;
  overflow: hidden;
}

.garden-total p {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 750;
}

.garden-total strong {
  color: var(--coral);
  font-size: 1.6rem;
}

.task-owner {
  margin: -4px 0 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--coral-soft);
  color: #914b3c;
  font-size: 0.86rem;
}

.leaderboard {
  display: grid;
  gap: 13px;
  margin-top: 18px;
}

.leader-row {
  display: grid;
  grid-template-columns: minmax(80px, 120px) 1fr 44px;
  align-items: center;
  gap: 10px;
}

.leader-name {
  overflow: hidden;
  font-size: 0.82rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leader-track {
  height: 9px;
  overflow: hidden;
  border-radius: 99px;
  background: #efede8;
}

.leader-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--coral), var(--yellow));
}

.leader-score {
  color: var(--coral);
  font-size: 0.78rem;
  font-weight: 850;
  text-align: right;
}

dialog {
  width: min(calc(100% - 28px), 520px);
  max-height: 90vh;
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 26px;
  background: var(--cream);
  color: var(--ink);
  box-shadow: 0 30px 90px rgba(20, 30, 25, 0.3);
}

dialog::backdrop {
  background: rgba(32, 43, 37, 0.55);
  backdrop-filter: blur(4px);
}

#task-form {
  display: grid;
  gap: 18px;
  padding: 24px;
}

.dialog-header h2 {
  margin: 0;
}

.icon-button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #eeeae1;
  font-size: 1.6rem;
}

label,
fieldset {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 0.8rem;
  font-weight: 800;
}

input,
select {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid #ddd8cd;
  border-radius: 14px;
  outline: 0;
  background: white;
  color: var(--ink);
}

input:focus,
select:focus {
  border-color: var(--coral);
  box-shadow: 0 0 0 3px rgba(240, 123, 99, 0.14);
}

.illustration-picker {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 7px;
}

.illustration-option {
  display: grid;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 13px;
  place-items: center;
  background: white;
  cursor: pointer;
  font-size: 1.45rem;
}

.illustration-option.active {
  border-color: var(--coral);
  background: var(--coral-soft);
}

.primary-button {
  padding: 14px 18px;
  border: 0;
  border-radius: 15px;
  background: var(--ink);
  color: white;
  cursor: pointer;
  font-weight: 850;
}

@media (max-width: 420px) {
  .app-shell {
    padding-inline: 13px;
  }

  .family-card {
    padding: 18px 14px;
  }

  .member-tabs {
    gap: 2px;
  }

  .member-avatar {
    width: 36px;
    height: 36px;
  }

  .task-card {
    grid-template-columns: 56px 1fr 48px;
    gap: 10px;
  }

  .task-illustration {
    width: 56px;
    height: 56px;
  }
}

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