:root {
  --bg: #f2f0eb;
  --card: #ffffff;
  --ink: #17191d;
  --muted: #8a8c94;
  --line: #e8e6e0;
  --grid: #efede8;
  --green: #2f8a63;
  --clay: #d0643b;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: radial-gradient(120% 90% at 50% 0%, #f7f6f2 0%, var(--bg) 60%);
  color: var(--ink);
  font-family: "Mona Sans Variable", "Mona Sans", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }

.stage {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: clamp(10px, 2.6vh, 28px) clamp(10px, 3vw, 28px);
}

/* ---- the card ---- */
.card {
  position: relative;
  width: min(600px, 100%);
  padding: clamp(12px, 2.8vh, 22px) clamp(13px, 3vw, 24px) clamp(12px, 2.6vh, 20px);
  border-radius: clamp(20px, 3vw, 28px);
  background: var(--card);
  box-shadow:
    0 0 0 1px var(--line),
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 1px 1px rgba(23, 25, 29, 0.04),
    0 12px 26px -14px rgba(23, 25, 29, 0.16),
    0 48px 80px -44px color-mix(in srgb, var(--green) 40%, rgba(23, 25, 29, 0.2));
}

/* ---- head ---- */
.head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.pet { display: flex; align-items: center; gap: 11px; min-width: 0; }
.pet__photo {
  position: relative;
  flex: none;
  width: clamp(34px, 6.4vh, 42px);
  height: clamp(34px, 6.4vh, 42px);
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--line), 0 6px 14px -6px rgba(23, 25, 29, 0.35);
}
.pet__photo img { width: 100%; height: 100%; object-fit: cover; object-position: 53% 42%; display: block; transform: scale(1.5); transform-origin: 53% 40%; }
.pet__text { display: grid; gap: 1px; min-width: 0; }
.pet__name { font-size: clamp(15px, 2.6vh, 17px); font-weight: 620; letter-spacing: -0.01em; }
.pet__breed { font-size: clamp(11.5px, 1.9vh, 13px); color: var(--muted); white-space: nowrap; }

.units {
  position: relative;
  display: flex;
  padding: 3px;
  border-radius: 999px;
  background: #f3f2ee;
  box-shadow: inset 0 0 0 1px #e9e7e1, inset 0 1px 2px rgba(23, 25, 29, 0.05);
}
.units__thumb {
  position: absolute;
  left: 3px;
  top: 3px;
  bottom: 3px;
  width: calc(50% - 3px);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(23, 25, 29, 0.06), 0 2px 6px -2px rgba(23, 25, 29, 0.22);
}
.units__btn {
  position: relative;
  width: clamp(34px, 6vh, 40px);
  padding: 4px 0;
  font-size: 12.5px;
  font-weight: 560;
  color: var(--muted);
  font-stretch: 100%;
  transition: color 0.25s ease, font-stretch 0.35s ease;
}
.units__btn.is-on { color: var(--ink); font-stretch: 112%; }

/* ---- the reading ---- */
.read {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-top: clamp(8px, 2.2vh, 18px);
}
.read__label { display: block; font-size: clamp(11px, 1.8vh, 12.5px); color: var(--muted); font-weight: 500; }
.read__value { display: flex; align-items: baseline; gap: 5px; margin-top: 1px; }
.read__num {
  display: inline-block;
  font-size: clamp(28px, 6.4vh, 42px);
  font-weight: 640;
  font-stretch: 108%;
  letter-spacing: -0.035em;
  line-height: 1;
}
.read__unit { font-size: clamp(13px, 2.2vh, 15px); color: var(--muted); font-weight: 520; }
.read__side { display: grid; justify-items: end; gap: 5px; text-align: right; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px 3px 6px;
  border-radius: 999px;
  font-size: clamp(11px, 1.8vh, 12px);
  font-weight: 580;
  color: var(--green);
  background: color-mix(in srgb, var(--green) 10%, #fff);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--green) 16%, #fff);
  white-space: nowrap;
}
.chip.is-proj { color: #6d6f77; background: #f3f2ee; box-shadow: inset 0 0 0 1px #e9e7e1; }
.chip.is-due { color: var(--clay); background: color-mix(in srgb, var(--clay) 10%, #fff); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--clay) 18%, #fff); }
.chip__icon { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.range { font-size: clamp(10.5px, 1.7vh, 12px); color: var(--muted); white-space: nowrap; }

/* ---- the chart ---- */
.chart {
  position: relative;
  height: clamp(120px, 33vh, 230px);
  margin-top: clamp(8px, 2vh, 16px);
  margin-bottom: 18px;
  touch-action: pan-y;
}
.chart__svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.grid line { stroke: var(--grid); stroke-width: 1; }
.grid text { fill: #b2b3b8; font-size: 10px; font-weight: 500; }
.band-edge { fill: none; stroke: var(--green); stroke-opacity: 0.22; stroke-width: 1; stroke-dasharray: 2 3; }
.today { stroke: #cfcdc6; stroke-width: 1; }
.proj { fill: none; stroke: var(--green); stroke-opacity: 0.55; stroke-width: 2; stroke-dasharray: 1 5; stroke-linecap: round; }
.line { fill: none; stroke: var(--green); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.line-glow { fill: none; stroke: var(--green); stroke-width: 9; stroke-opacity: 0.12; stroke-linecap: round; stroke-linejoin: round; filter: blur(3px); }
.doses line { stroke-width: 1; stroke-dasharray: 2 3; }
.doses .done { stroke: #c9c7c0; }
.doses .due { stroke: var(--clay); stroke-opacity: 0.7; }
.points circle { fill: #fff; stroke: var(--green); stroke-width: 1.8; }
.points .is-dose { stroke: var(--ink); }
.hair { stroke: var(--ink); stroke-width: 1; opacity: 0; }
.mark { fill: var(--green); stroke: #fff; stroke-width: 2.5; opacity: 0; filter: drop-shadow(0 2px 4px rgba(23, 25, 29, 0.25)); }

.axis { position: absolute; left: 0; right: 0; top: 100%; height: 18px; }
.axis span {
  position: absolute;
  top: 5px;
  font-size: 10px;
  font-weight: 500;
  color: #a6a7ad;
  transform: translateX(-50%);
  white-space: nowrap;
}
.axis .is-today { color: var(--ink); font-weight: 600; }

.tags { position: absolute; inset: 0; pointer-events: none; }
.tag {
  position: absolute;
  top: 0;
  left: 0;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 18px;
  padding: 0 6px 0 4px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  color: #74767e;
  background: #fff;
  box-shadow: 0 0 0 1px var(--line), 0 2px 5px -2px rgba(23, 25, 29, 0.14);
}
.tag svg { width: 10px; height: 10px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tag.is-due { color: #fff; background: var(--clay); box-shadow: 0 0 0 1px color-mix(in srgb, var(--clay) 80%, #000), 0 6px 14px -6px color-mix(in srgb, var(--clay) 80%, transparent); }
.tags.is-tight .tag:not(.is-due) { padding: 0 4px; }
.tags.is-tight .tag__t { display: none; }

.tip {
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  gap: 1px;
  min-width: 112px;
  padding: 7px 10px 8px;
  border-radius: 12px;
  background: rgba(23, 25, 29, 0.92);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06) inset, 0 10px 24px -10px rgba(23, 25, 29, 0.55);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  white-space: nowrap;
}
.tip__top { font-size: 10.5px; color: rgba(255, 255, 255, 0.6); font-weight: 520; }
.tip__val { font-size: 15px; font-weight: 640; letter-spacing: -0.01em; font-stretch: 106%; }
.tip__sub { font-size: 10.5px; font-weight: 560; color: #8fd9b5; }
.tip__sub.is-due { color: #f3a585; }
.tip__sub.is-proj { color: rgba(255, 255, 255, 0.6); }

/* ---- the next booster ---- */
.next {
  display: flex;
  align-items: center;
  gap: clamp(9px, 2vw, 13px);
  padding: clamp(8px, 1.7vh, 11px) clamp(8px, 1.7vh, 11px) clamp(8px, 1.7vh, 11px) clamp(9px, 1.8vh, 12px);
  border-radius: 16px;
  background: linear-gradient(180deg, #fbfaf8, #f6f5f1);
  box-shadow: inset 0 0 0 1px #ebe9e3, inset 0 1px 0 #fff;
}
.next__icon {
  flex: none;
  display: grid;
  place-items: center;
  width: clamp(30px, 5.6vh, 36px);
  height: clamp(30px, 5.6vh, 36px);
  border-radius: 11px;
  color: var(--clay);
  background: color-mix(in srgb, var(--clay) 11%, #fff);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--clay) 18%, #fff);
}
.next__icon svg { width: 58%; height: 58%; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.next__text { flex: 1; display: grid; gap: 2px; min-width: 0; }
.next__title { font-size: clamp(12.5px, 2.1vh, 14px); font-weight: 600; letter-spacing: -0.005em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.next__when { font-size: clamp(11px, 1.8vh, 12px); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.next__track { position: relative; display: block; height: 3px; margin-top: 4px; border-radius: 3px; background: #e9e7e1; overflow: hidden; max-width: 180px; }
.next__fill { position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(90deg, color-mix(in srgb, var(--clay) 55%, #fff), var(--clay)); transform-origin: 0 50%; transform: scaleX(0.6); }

.remind { flex: none; position: relative; border-radius: 999px; }
.remind__face {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: clamp(32px, 6vh, 38px);
  padding: 0 14px 0 11px;
  border-radius: 999px;
  background: linear-gradient(180deg, #2a2d33, #16181c);
  color: #fff;
  font-size: clamp(12px, 2vh, 13px);
  font-weight: 580;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 0 0 1px #0f1013, 0 8px 16px -8px rgba(23, 25, 29, 0.6);
}
.remind.is-set .remind__face {
  background: linear-gradient(180deg, color-mix(in srgb, var(--green) 88%, #fff), var(--green));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 0 0 1px color-mix(in srgb, var(--green) 80%, #000), 0 10px 18px -8px color-mix(in srgb, var(--green) 70%, transparent);
}
.remind__icon { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.remind__check { stroke-width: 1.9; stroke-dasharray: 1; stroke-dashoffset: 1; }
.remind__spin {
  position: absolute;
  left: 11px;
  top: 50%;
  width: 15px;
  height: 15px;
  margin-top: -7.5px;
  border-radius: 50%;
  border: 1.6px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  opacity: 0;
}
.remind__words { display: inline-block; }
@media (hover: hover) {
  .remind:hover .remind__face { filter: brightness(1.12); }
  .units__btn:hover { color: var(--ink); }
}

.ghost {
  position: fixed;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  pointer-events: none;
  fill: #17191d;
  stroke: #ffffff;
  stroke-width: 1.4;
  stroke-linejoin: round;
  opacity: 0;
  filter: drop-shadow(0 3px 5px rgba(23, 25, 29, 0.3));
  z-index: 5;
}

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 440px) {
  .next__sep { display: none; }
  .range { display: none; }
  .tip { min-width: 0; }
}
@media (max-height: 470px) {
  .next__track { display: none; }
}
