/* ============================================================
   Project 90 — warm pastel light mode
   Data-series colors are the validated dataviz reference palette
   (re-validated 2026-08-08 against surface #FFFDFA — all checks pass).
   ============================================================ */
:root {
  color-scheme: light;
  /* warm chrome */
  --page: #fdf4ea;
  --surface: #fffdfa;
  --text: #38322c;
  --text-2: #6e655c;
  --muted: #9a9086;
  --grid: #f0e6da;
  --baseline: #dccfc0;
  --border: rgba(120, 85, 50, 0.10);
  /* pastels */
  --peach: #ffd9c0;
  --butter: #ffedb8;
  --mint: #cdeeda;
  --lavender: #e5dcff;
  --rose: #ffd6e2;
  /* UI accent (rose→peach, distinct from data series) */
  --accent: #e8688f;
  --accent-grad: linear-gradient(135deg, #f0759f 0%, #f79d72 100%);
  --good: #0ca30c;
  --good-text: #006300;
  --critical: #d03b3b;
  /* data series (validated — do not restyle) */
  --elio: #2a78d6;
  --jess: #eb6834;
  --luca: #1baf7a;
  --shadow: 0 10px 30px rgba(190, 130, 80, 0.13);
  --shadow-lift: 0 16px 40px rgba(190, 130, 80, 0.20);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--page); color: var(--text);
  font: 16px/1.6 "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: 100vh;
}
.loading { text-align: center; color: var(--muted); padding: 4rem 0; }

/* ---------- floating pastel blobs ---------- */
.blobs { position: fixed; inset: 0; overflow: hidden; z-index: -1; pointer-events: none; }
.blob {
  position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55;
  animation: drift 26s ease-in-out infinite alternate;
}
.b1 { width: 45vw; height: 45vw; background: var(--peach);    top: -12vw; left: -10vw; }
.b2 { width: 38vw; height: 38vw; background: var(--lavender); top: 20vh; right: -12vw; animation-duration: 32s; animation-delay: -8s; }
.b3 { width: 34vw; height: 34vw; background: var(--mint);     bottom: -10vw; left: 15vw; animation-duration: 29s; animation-delay: -15s; }
.b4 { width: 28vw; height: 28vw; background: var(--butter);   bottom: 18vh; right: 22vw; animation-duration: 35s; animation-delay: -4s; }
@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(4vw, -3vh) scale(1.08); }
  to   { transform: translate(-3vw, 4vh) scale(0.95); }
}

/* ---------- top bar ---------- */
#topbar[hidden] { display: none; }
#topbar {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  background: rgba(255, 253, 250, 0.8); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: .65rem 1.1rem; position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 900; font-size: 1.2rem; letter-spacing: .01em; }
.brand span {
  background: var(--accent-grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
#nav { display: flex; gap: .3rem; flex-wrap: wrap; }
#nav a {
  color: var(--text-2); text-decoration: none; font-weight: 800; font-size: .92rem;
  padding: .42rem 1rem; border-radius: 999px;
  transition: background .25s, color .25s, transform .2s;
}
#nav a.active { background: var(--accent-grad); color: #fff; box-shadow: 0 4px 14px rgba(232, 104, 143, .35); }
#nav a:not(.active):hover { background: var(--rose); color: var(--text); transform: translateY(-1px); }
.who { margin-left: auto; color: var(--muted); font-size: .9rem; font-weight: 700; }

main { max-width: 920px; margin: 1.5rem auto 4rem; padding: 0 1rem; }

/* ---------- cards (entrance animation, hover lift) ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 22px; padding: 1.25rem 1.5rem; margin-bottom: 1.1rem;
  box-shadow: var(--shadow);
  animation: fadeUp .55s cubic-bezier(.22, .9, .36, 1) both;
  transition: transform .25s ease, box-shadow .25s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.card:nth-child(2) { animation-delay: .07s; }
.card:nth-child(3) { animation-delay: .14s; }
.card:nth-child(4) { animation-delay: .21s; }
.card:nth-child(5) { animation-delay: .28s; }
.members .card:nth-child(1) { animation-delay: .07s; }
.members .card:nth-child(2) { animation-delay: .16s; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

h1 { font-size: 1.6rem; font-weight: 900; margin: .2rem 0 1rem; }
h2 { font-size: 1.12rem; font-weight: 800; margin: 0 0 .6rem; }
.sub { color: var(--muted); font-size: .88rem; }

/* ---------- controls ---------- */
button, .btn {
  font: inherit; font-weight: 800; border: 0; border-radius: 999px;
  padding: .55rem 1.3rem; cursor: pointer; color: #fff;
  background: var(--accent-grad);
  box-shadow: 0 4px 14px rgba(232, 104, 143, .3);
  transition: transform .18s ease, box-shadow .18s ease, filter .18s;
}
button:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 8px 20px rgba(232, 104, 143, .4); }
button:active { transform: scale(.97); }
button.ghost {
  background: transparent; color: var(--accent);
  border: 2px solid var(--rose); box-shadow: none;
}
button.ghost:hover { background: var(--rose); box-shadow: none; }
button.small { padding: .28rem .85rem; font-size: .85rem; }
button:disabled { opacity: .5; cursor: default; transform: none; }
input, select, textarea {
  font: inherit; color: var(--text); background: #fff;
  border: 2px solid var(--grid); border-radius: 14px; padding: .5rem .75rem;
  max-width: 100%; transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(232, 104, 143, .12);
}
textarea { resize: vertical; }
label { display: block; font-weight: 800; font-size: .9rem; margin: .7rem 0 .25rem; }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: end; }
.err { color: var(--critical); font-size: .9rem; margin-top: .5rem; font-weight: 700; }
.ok-msg { color: var(--good-text); font-size: .9rem; margin-top: .5rem; font-weight: 700; }

/* ---------- plan header / progress ---------- */
.plan-head { display: flex; align-items: baseline; gap: .8rem; flex-wrap: wrap; }
.plan-day { font-size: 2.1rem; font-weight: 900; }
.progress {
  height: 14px; background: var(--grid); border-radius: 999px;
  margin-top: .7rem; overflow: hidden;
}
.progress > div {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #f0759f, #f79d72, #f0759f);
  background-size: 200% 100%;
  animation: shimmer 3s linear infinite, grow 1.2s cubic-bezier(.22, .9, .36, 1) both;
  transform-origin: left;
}
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---------- family cards ---------- */
.members { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 1.1rem; margin-bottom: 1.1rem; }
.member-card h2 { display: flex; align-items: center; gap: .5rem; font-size: 1.25rem; }
.dot { width: 13px; height: 13px; border-radius: 50%; display: inline-block; }
.stats { display: flex; gap: 1.4rem; flex-wrap: wrap; margin: .6rem 0 .9rem; }
.stat .v { font-size: 1.55rem; font-weight: 900; animation: pop .5s cubic-bezier(.22, 1.4, .36, 1) both .3s; }
.stat .l { color: var(--muted); font-size: .78rem; font-weight: 700; }
@keyframes pop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: scale(1); } }
.flame { display: inline-block; animation: flame 1.6s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes flame { 0%, 100% { transform: scale(1) rotate(-2deg); } 50% { transform: scale(1.14) rotate(2deg); } }
.delta-good { color: var(--good-text); font-size: .85rem; font-weight: 800; }
.delta-plain { color: var(--muted); font-size: .85rem; font-weight: 700; }
.today-yes { color: var(--good-text); font-weight: 800; }
.today-no { color: var(--muted); font-weight: 700; }

/* ---------- charts ---------- */
.chart-wrap { position: relative; }
.chart-wrap svg { display: block; width: 100%; }
.chart-wrap path { animation: drawin 1s ease both; }
@keyframes drawin { from { opacity: 0; } to { opacity: 1; } }
.chart-tip {
  position: absolute; pointer-events: none; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px; padding: .3rem .7rem;
  font-size: .82rem; box-shadow: var(--shadow); white-space: nowrap;
  transform: translate(-50%, -120%); display: none;
}
.chart-tip .d { color: var(--muted); }
details.datatable { margin-top: .5rem; }
details.datatable summary { color: var(--muted); font-size: .85rem; cursor: pointer; font-weight: 700; }
table { border-collapse: collapse; width: 100%; margin-top: .5rem; font-size: .9rem; }
th, td { border: 1px solid var(--grid); padding: .38rem .65rem; text-align: left; }
th { color: var(--text-2); font-weight: 800; background: #fff9f2; }

/* ---------- training ---------- */
details.week {
  border: 1px solid var(--border); border-radius: 18px; margin-bottom: .7rem;
  background: var(--surface); box-shadow: var(--shadow); overflow: hidden;
  animation: fadeUp .55s ease both;
}
details.week summary {
  cursor: pointer; font-weight: 900; padding: .8rem 1.2rem; list-style: none;
  display: flex; gap: .7rem; align-items: baseline; flex-wrap: wrap;
  transition: background .2s;
}
details.week summary:hover { background: #fff7ef; }
details.week summary .sub { font-weight: 600; }
.day-row {
  display: flex; gap: .9rem; padding: .8rem 1.2rem; border-top: 1px solid var(--grid);
  align-items: flex-start; flex-wrap: wrap;
}
.day-row.today { background: linear-gradient(90deg, var(--rose), transparent 60%); }
.day-row .num { font-weight: 900; color: var(--muted); min-width: 4.6rem; }
.day-row .body { flex: 1 1 240px; }
.day-row .title { font-weight: 800; }
.day-row .details { color: var(--text-2); font-size: .9rem; }
.chips { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .35rem; }
.chip {
  font-size: .76rem; font-weight: 800; color: #fff; border-radius: 999px;
  padding: .12rem .6rem; animation: pop .4s cubic-bezier(.22, 1.4, .36, 1) both;
}

/* ---------- meals ---------- */
.meal-row {
  display: flex; gap: .9rem; padding: .65rem 0; border-bottom: 1px solid var(--grid);
  align-items: flex-start;
}
.meal-row:last-child { border-bottom: 0; }
.meal-row .memoji {
  width: 46px; height: 46px; border-radius: 14px; flex: 0 0 46px;
  display: flex; align-items: center; justify-content: center; font-size: 1.5rem;
  background: linear-gradient(135deg, var(--butter), var(--peach));
}
.meal-row .date { min-width: 6.5rem; color: var(--muted); font-size: .88rem; font-weight: 700; padding-top: .35rem; }
.shop-row { display: flex; align-items: center; gap: .6rem; padding: .32rem 0; }
.shop-row .item { font-weight: 700; transition: color .25s; }
.shop-row.done .item { text-decoration: line-through; color: var(--muted); }
.shop-row .qty { color: var(--muted); font-size: .85rem; }
.shop-row .del { margin-left: auto; }
input[type="checkbox"] { width: 1.25rem; height: 1.25rem; accent-color: var(--accent); cursor: pointer; }

/* ---------- login ---------- */
.login-box { max-width: 440px; margin: 3rem auto; text-align: center; }
.login-box .brand { font-size: 2rem; }
.user-cards { display: grid; gap: .9rem; margin-top: 1.3rem; }
.user-cards button {
  background: var(--surface); color: var(--text); border: 2px solid transparent;
  padding: 1rem 1.2rem; font-size: 1.1rem; border-radius: 20px; text-align: left;
  display: flex; align-items: center; gap: .9rem; box-shadow: var(--shadow);
}
.user-cards button:hover { border-color: var(--accent); transform: translateY(-2px) scale(1.01); }
.avatar {
  width: 46px; height: 46px; border-radius: 50%; color: #fff; font-weight: 900;
  font-size: 1.2rem; display: inline-flex; align-items: center; justify-content: center;
}
.pin-form input { text-align: center; font-size: 1.4rem; letter-spacing: .35em; width: 12rem; }

/* ---------- questionnaire ---------- */
.q-card { max-width: 580px; margin: 0 auto; }
.q-section {
  margin: 1.9rem 0 .2rem; padding-top: 1.3rem;
  border-top: 2px dashed var(--grid); color: var(--accent); font-size: 1.05rem;
}
.q-help { margin: .5rem 0 0; }

/* ---------- profile ---------- */
.chart-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.1rem; margin-bottom: 1.1rem;
}
.chart-grid .card { margin-bottom: 0; }
.hist-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* ---------- training ticks ---------- */
.done-toggle {
  display: flex; align-items: center; gap: .45rem; font-weight: 800;
  font-size: .9rem; cursor: pointer; margin: 0; padding-top: .15rem;
  color: var(--text-2); white-space: nowrap;
}
details.week summary .week-count { margin-left: auto; }
details.week summary .week-tick { flex: 0 0 auto; }

/* ---------- plan document ---------- */
.plan-doc { line-height: 1.7; }
.plan-doc h1 { font-size: 1.5rem; margin: 2rem 0 .8rem; }
.plan-doc h1:first-child { margin-top: 0; }
.plan-doc h2 { font-size: 1.15rem; margin: 1.6rem 0 .5rem; color: var(--accent); }
.plan-doc table { margin: .6rem 0 1rem; }
.plan-doc blockquote {
  margin: 1rem 0; padding: .6rem 1rem; border-left: 4px solid var(--critical);
  background: #fff5f0; border-radius: 0 12px 12px 0;
}
.plan-doc li { margin: .2rem 0; }
.plan-doc hr { border: 0; border-top: 2px dashed var(--grid); margin: 2rem 0; }

/* ---------- scorecard ---------- */
.score-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 0 1.2rem; margin-bottom: .6rem; }
.score-row { cursor: pointer; }

/* ---------- shopping categories ---------- */
.cat-head {
  font-weight: 900; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--accent); margin: .9rem 0 .2rem;
}
.cat-head:first-child { margin-top: 0; }

/* ---------- watch sync quick entry ---------- */
.watch-row { padding: .9rem 1.3rem; }
.watch-row label { margin: 0 0 .3rem; font-size: 1.05rem; }
.watch-row input {
  font-size: 1.6rem; font-weight: 800; width: 9rem; text-align: center;
  padding: .5rem;
}
#wform { max-width: 480px; margin: 0 auto; }
.btn { display: inline-block; }

/* ---------- kid mode ---------- */
.kid-hero {
  background: linear-gradient(135deg, var(--mint) 0%, var(--butter) 55%, var(--peach) 100%);
  border: 0;
}
.kid-hero h1 { font-size: 1.9rem; }

/* ---------- confetti ---------- */
.confetti {
  position: fixed; top: -12px; width: 10px; height: 14px; z-index: 999;
  border-radius: 3px; pointer-events: none;
  animation: confetti-fall linear both;
}
@keyframes confetti-fall {
  to { transform: translateY(105vh) rotate(720deg); opacity: .9; }
}

/* ---------- respect reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .blob { animation: none; }
}
