/* FitDocMed Daily Streak — shared styles
   Palette: deep navy ink, flame orange accents, cool light-grey canvas,
   colourful milestone tiers (bronze → diamond). Font: Inter. */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #F4F5FA;
  --card: #FFFFFF;
  --ink: #22224A;
  --muted: #7F81A3;
  --line: #E7E8F2;
  --track: #E4E6F3;
  --flame: #FF8A1F;
  --flame-deep: #F0630A;
  --flame-soft: #FFF2E3;
  --shadow: 0 1px 2px rgba(34, 34, 74, 0.05), 0 12px 30px rgba(34, 34, 74, 0.07);
  font-size: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); }
a { color: var(--ink); }

.wrap {
  max-width: 440px;
  margin: 0 auto;
  padding: 24px 18px 64px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- Entrance animation --- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.enter { animation: fadeUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) both; }
.enter-1 { animation-delay: 0.02s; }
.enter-2 { animation-delay: 0.10s; }
.enter-3 { animation-delay: 0.18s; }
.enter-4 { animation-delay: 0.26s; }
.enter-5 { animation-delay: 0.34s; }

/* --- Brand --- */
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px var(--line);
}
.brand-mark img { width: 100%; height: 100%; object-fit: cover; display: block; }

.brand-name { font-weight: 800; font-size: 18px; line-height: 1.15; letter-spacing: -0.01em; }
.brand-tag { font-size: 12px; color: var(--muted); margin-top: 1px; }

/* --- Cards / forms --- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.stack { display: flex; flex-direction: column; gap: 14px; }

.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }

.field input,
.field select {
  width: 100%;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: #fff;
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 4px rgba(34, 34, 74, 0.08);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 18px;
  border-radius: 14px;
  border: none;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.btn:active { transform: scale(0.98); }

.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: #33336B; box-shadow: 0 8px 20px rgba(34, 34, 74, 0.25); }
.btn-primary:disabled { background: #A9AAC4; cursor: not-allowed; box-shadow: none; }

.hint { font-size: 12.5px; color: var(--muted); line-height: 1.55; }

.msg { font-size: 13.5px; padding: 10px 12px; border-radius: 10px; display: none; }
.msg.show { display: block; animation: fadeUp 0.3s ease both; }
.msg.error { background: #FDE9E6; color: #A1301F; }
.msg.success { background: #E6F6EE; color: #17694A; }

.switch-line { text-align: center; font-size: 14px; color: var(--muted); margin-top: 18px; }
.switch-line a { font-weight: 700; text-decoration: none; color: var(--flame-deep); }

.foot-note {
  margin-top: 22px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

/* --- Login hero flame --- */
.hero-flame { margin: 26px 0 4px; height: 66px; }
.hero-flame svg { height: 66px; width: auto; animation: flicker 1.8s ease-in-out infinite; transform-origin: 50% 90%; filter: drop-shadow(0 8px 14px rgba(240, 99, 10, 0.35)); }

@keyframes flicker {
  0%, 100% { transform: scale(1) rotate(0deg); }
  30% { transform: scale(1.07) rotate(-2.5deg); }
  60% { transform: scale(0.97) rotate(2deg); }
}

/* ============ Dashboard ============ */
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.topbar .brand { margin-bottom: 0; }

.logout-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  border: 1.5px solid var(--line);
  background: #fff;
  padding: 8px 14px;
  border-radius: 20px;
}

.hello-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.hello-name { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.hello-date { font-size: 13.5px; color: var(--muted); margin-top: 3px; }

.chip {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 20px;
  white-space: nowrap;
}
.chip-target { background: #E9EAF7; color: var(--ink); }

/* Status card */
.status-card { padding: 22px 20px 20px; margin-top: 16px; }
.status-title { text-align: center; font-size: 17px; font-weight: 700; }

.ring-wrap { position: relative; width: 138px; height: 138px; margin: 16px auto 6px; }
.ring-wrap svg.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { stroke: var(--track); }
.ring-fill {
  stroke: url(#ringGrad);
  stroke-linecap: round;
  transition: stroke-dashoffset 1s cubic-bezier(0.22, 1, 0.36, 1);
}
.ring-wrap.done { filter: drop-shadow(0 6px 14px rgba(240, 99, 10, 0.3)); }
.ring-flame { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.ring-flame svg { width: 58px; height: auto; transform-origin: 50% 90%; }
.ring-flame.lit svg { animation: flicker 1.8s ease-in-out infinite; }
.ring-flame.ignite svg { animation: ignite 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
@keyframes ignite {
  0% { transform: scale(0.4); opacity: 0.2; }
  60% { transform: scale(1.35) rotate(-4deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); }
}

.goal-text { text-align: center; font-size: 14px; color: var(--muted); margin-top: 4px; min-height: 20px; }

.mark-btn {
  position: relative;
  overflow: hidden;
  margin-top: 16px;
  height: 56px;
  font-size: 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, #FFA53A, #F0630A);
  color: #fff;
  box-shadow: 0 12px 26px rgba(240, 99, 10, 0.33);
}
.mark-btn:hover { background: linear-gradient(135deg, #FFA53A, #F0630A); box-shadow: 0 14px 30px rgba(240, 99, 10, 0.4); }
.mark-btn::after {
  content: "";
  position: absolute;
  top: 0; left: -60%;
  width: 40%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  transform: skewX(-20deg);
  animation: shine 3.4s ease-in-out infinite;
}
@keyframes shine {
  0%, 60% { left: -60%; }
  100% { left: 130%; }
}
.mark-btn.marked {
  background: var(--flame-soft);
  color: #B85208;
  box-shadow: none;
  cursor: default;
}
.mark-btn.marked::after { display: none; }
.mark-btn:disabled { opacity: 0.75; cursor: wait; }

.reset-banner {
  margin-top: 12px;
  font-size: 12.5px;
  color: #B24A1E;
  text-align: center;
  line-height: 1.5;
}

.stat-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.stat-cell { display: flex; align-items: center; gap: 11px; min-width: 0; }
.stat-cell + .stat-cell { border-left: 1px solid var(--line); padding-left: 16px; }
.stat-icon {
  width: 50px; height: 50px;
  border-radius: 50%;
  background: var(--flame-soft);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { height: 30px; width: auto; }
.stat-label { font-size: 10.5px; font-weight: 700; letter-spacing: 0.07em; color: var(--muted); text-transform: uppercase; line-height: 1.3; }
.stat-value { font-size: 22px; font-weight: 800; margin-top: 1px; white-space: nowrap; letter-spacing: -0.02em; }
.stat-value small { font-size: 14px; font-weight: 700; color: var(--ink); margin-left: 2px; }
.stat-value.bump { animation: numberBump 0.5s ease; }
@keyframes numberBump {
  0% { transform: scale(1); }
  45% { transform: scale(1.22); color: var(--flame-deep); }
  100% { transform: scale(1); }
}

/* Milestones box */
.ms-box {
  margin-top: 18px;
  border: 1.5px solid var(--line);
  border-radius: 20px;
  padding: 16px 16px 14px;
}
.ms-title { font-size: 18px; font-weight: 800; }
.ms-sub { font-size: 14px; margin-top: 2px; color: var(--ink); }
.ms-sub b { color: var(--flame-deep); }
.ms-bar-row { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.ms-end { width: 38px; height: 38px; flex-shrink: 0; }
.ms-end > svg { width: 100%; height: 100%; display: block; }
.ms-bar { flex: 1; height: 12px; border-radius: 99px; background: var(--track); overflow: hidden; }
.ms-fill {
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, #FFB13B, #F0630A);
  transition: width 1.1s cubic-bezier(0.22, 1, 0.36, 1);
}
.ms-names { display: flex; justify-content: space-between; font-size: 11.5px; font-weight: 600; color: var(--muted); margin-top: 7px; }

.compliment {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--flame-soft);
  color: #9C4407;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.5;
  animation: fadeUp 0.5s ease both;
}
.compliment svg { height: 20px; width: auto; flex-shrink: 0; margin-top: 1px; }

/* Section headings */
.section-head { margin: 28px 2px 12px; }
.section-head h2 { font-size: 19px; font-weight: 800; }
.section-head p { margin: 3px 0 0; font-size: 13px; color: var(--muted); }

/* Calendar */
.cal-card { padding: 18px 14px 16px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px; }
.cal-label { font-size: 16.5px; font-weight: 700; }
.cal-nav {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease;
}
.cal-nav:hover:not(:disabled) { background: var(--bg); }
.cal-nav:disabled { opacity: 0.3; cursor: default; }
.cal-week { display: grid; grid-template-columns: repeat(7, 1fr); margin-top: 18px; text-align: center; font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em; color: var(--muted); }
.cal-week .today-wd { color: var(--ink); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px 4px; margin-top: 12px; justify-items: center; }
.cal-day {
  width: 100%;
  max-width: 40px;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: #fff;
  animation: calPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes calPop { from { opacity: 0; transform: scale(0.5); } to { opacity: 1; transform: scale(1); } }
.cal-day.marked {
  background: linear-gradient(135deg, #FFA53A, #F0630A);
  border-color: transparent;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 5px 12px rgba(240, 99, 10, 0.3);
}
.cal-day.today { border-color: var(--ink); color: var(--ink); font-weight: 800; }
.cal-day.today.marked { border-color: transparent; color: #fff; box-shadow: 0 0 0 3px rgba(34, 34, 74, 0.18), 0 5px 12px rgba(240, 99, 10, 0.3); }
.cal-day.future { border-style: dashed; color: #B7B9D0; }
.cal-blank { width: 100%; }
.cal-foot { margin-top: 16px; text-align: center; font-size: 13px; color: var(--muted); }
.cal-foot b { color: var(--flame-deep); }

/* Growth tree */
.tree-card { padding: 10px 0 10px; overflow: hidden; }
.tree-card > svg { display: block; width: 100%; height: auto; overflow: visible; }
.tree-card > svg text { font-family: 'Inter', system-ui, sans-serif; }

.t-track { fill: none; stroke: #E4E6F3; stroke-width: 13; stroke-linecap: round; }
.t-fill { fill: none; stroke: url(#pathGrad); stroke-width: 13; stroke-linecap: round; }
.t-fill.animate { transition: stroke-dashoffset 0.6s linear; }

.t-node { opacity: 0; }
.play .t-node { animation: nodeIn 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) both; transform-box: fill-box; transform-origin: center; }
@keyframes nodeIn { from { opacity: 0; transform: scale(0.2); } to { opacity: 1; transform: scale(1); } }

.t-label { opacity: 0; }
.play .t-label { animation: fadeUp 0.6s ease both; }

.t-halo { transform-box: fill-box; transform-origin: center; animation: breathe 2.8s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { transform: scale(1); opacity: 0.85; } 50% { transform: scale(1.14); opacity: 0.45; } }

.t-pulse { fill: none; stroke-width: 3; transform-box: fill-box; transform-origin: center; animation: pulseRing 2.2s ease-out infinite; }
@keyframes pulseRing { 0% { transform: scale(1); opacity: 0.85; } 100% { transform: scale(1.7); opacity: 0; } }

.t-leaf { opacity: 0; transform-box: fill-box; transform-origin: 0% 100%; }
.play .t-leaf { animation: leafIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
@keyframes leafIn { from { opacity: 0; transform: scale(0); } to { opacity: 1; transform: scale(1); } }

.t-spark { transform-box: fill-box; transform-origin: center; animation: twinkle 2.2s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { transform: scale(0.4); opacity: 0.2; } 50% { transform: scale(1.1); opacity: 1; } }

.t-you { opacity: 0; }
.play .t-you { animation: fadeUp 0.6s ease both; }
.t-bob { animation: bob 1.8s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

/* Celebration overlay */
.celebrate {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  background: radial-gradient(circle at 50% 42%, rgba(40, 40, 98, 0.985), rgba(16, 16, 40, 0.995));
  opacity: 0;
  transition: opacity 0.3s ease;
  cursor: pointer;
  overflow: hidden;
}
.celebrate.show { opacity: 1; }
.celebrate.hide { opacity: 0; transition: opacity 0.6s ease; }

.cel-rays {
  position: absolute;
  left: 50%; top: 42%;
  width: 640px; height: 640px;
  margin: -320px 0 0 -320px;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(255, 190, 70, 0.22) 0deg 7deg, transparent 7deg 22deg);
  -webkit-mask-image: radial-gradient(circle, #000 12%, transparent 62%);
  mask-image: radial-gradient(circle, #000 12%, transparent 62%);
  animation: spin 16s linear infinite, fadeIn 0.8s ease both;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.cel-stage { position: relative; width: min(64vw, 260px); aspect-ratio: 1; }
.cel-stage > svg { width: 100%; height: 100%; overflow: visible; }
.cel-title { position: relative; color: #fff; font-size: 30px; font-weight: 800; letter-spacing: -0.02em; margin-top: 8px; animation: fadeUp 0.55s 0.95s cubic-bezier(0.22, 1, 0.36, 1) both; }
.cel-title .fl { display: inline-block; vertical-align: -5px; margin-right: 6px; }
.cel-title .fl svg { height: 30px; width: auto; }
.cel-sub { position: relative; color: #D6D7F0; font-size: 15px; line-height: 1.55; max-width: 300px; margin-top: 8px; animation: fadeUp 0.55s 1.2s cubic-bezier(0.22, 1, 0.36, 1) both; }
.cel-tap { position: absolute; bottom: 28px; color: #9EA0C8; font-size: 12px; animation: fadeIn 0.6s 2s both; }

.cel-tree .ground { animation: fadeIn 0.4s 0.05s both; }
.cel-tree .trunk { transform-box: fill-box; transform-origin: 50% 100%; animation: growY 0.75s 0.2s cubic-bezier(0.22, 1, 0.36, 1) both; }
.cel-tree .leaf, .cel-tree .fruit { transform-box: fill-box; transform-origin: 50% 50%; animation: popIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.cel-tree .l1 { animation-delay: 0.85s; } .cel-tree .l2 { animation-delay: 1.0s; }
.cel-tree .l3 { animation-delay: 1.15s; } .cel-tree .l4 { animation-delay: 1.3s; }
.cel-tree .fruit { animation-delay: 1.55s; }
.cel-tree .f2 { animation-delay: 1.65s; } .cel-tree .f3 { animation-delay: 1.75s; } .cel-tree .f4 { animation-delay: 1.85s; }
.cel-tree .canopy-g { transform-box: fill-box; transform-origin: 50% 100%; animation: sway 1.8s 1.5s ease-in-out both; }
.cel-tree .spark { transform-box: fill-box; transform-origin: center; animation: twinkle 1.6s ease-in-out infinite; opacity: 0; }
@keyframes growY { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes popIn { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes sway { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-3deg); } 65% { transform: rotate(2.5deg); } }

.cel-medal-in { animation: medalDrop 1s 0.15s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
@keyframes medalDrop {
  from { opacity: 0; transform: translateY(-90px) scale(0.3) rotate(-25deg); }
  to { opacity: 1; transform: translateY(0) scale(1) rotate(0); }
}

.confetti {
  position: absolute;
  left: 50%; top: 42%;
  width: 10px; height: 16px;
  border-radius: 2px;
  opacity: 0;
  z-index: 2;
  animation: burst 1.9s cubic-bezier(0.15, 0.85, 0.3, 1) var(--d) both;
}
.confetti.round { width: 10px; height: 10px; border-radius: 50%; }
@keyframes burst {
  0% { opacity: 1; transform: translate(0, 0) rotate(0) scale(0.4); }
  40% { opacity: 1; transform: translate(var(--dx), var(--dy)) rotate(calc(var(--rot) * 0.5)) scale(1); }
  100% { opacity: 0; transform: translate(calc(var(--dx) * 1.15), calc(var(--dy) + 260px)) rotate(var(--rot)) scale(1); }
}

.toast {
  position: fixed;
  left: 50%; bottom: 28px;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  font-size: 13.5px;
  padding: 11px 16px;
  border-radius: 12px;
  z-index: 70;
  animation: fadeUp 0.3s ease both;
  max-width: 88vw;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .enter, .hero-flame svg, .ring-flame.lit svg, .mark-btn::after, .t-halo, .t-pulse, .t-spark, .t-bob, .cel-rays, .confetti, .cal-day { animation: none !important; }
  .t-node, .t-label, .t-leaf, .t-you { opacity: 1; animation: none !important; }
  .ring-fill, .ms-fill, .t-fill.animate { transition: none; }
}
