:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  --green: #48bd32;
  --green-dark: #3daf28;
  --text: #111211;
  --muted: #767876;
  --line: #eef0ed;
  --page: #fbfcfb;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background: #eef1ee;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

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

.app-shell {
  position: relative;
  width: min(100%, 471px);
  min-height: 100svh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--page);
}

.hero {
  position: relative;
  display: flow-root;
  height: 136px;
  text-align: center;
}

.hero h1 {
  margin: 17px 0 9px;
  font-size: 21px;
  font-weight: 750;
  line-height: 1.35;
}

.hero p {
  margin: 0;
  color: #777a77;
  font-size: 13px;
  line-height: 1.6;
}

.back-button {
  position: absolute;
  top: 11px;
  left: 21px;
  z-index: 3;
  display: grid;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 6px 14px rgba(28, 46, 20, 0.08);
  cursor: pointer;
  place-items: center;
  transition: background-color 180ms ease, box-shadow 180ms ease;
}

.back-button svg {
  width: 26px;
  height: 26px;
  stroke-width: 3;
}

.back-button:hover {
  background: #f5f8f4;
  box-shadow: 0 7px 17px rgba(28, 46, 20, 0.12);
}

.header-mascot {
  position: absolute;
  right: 22px;
  bottom: -1px;
  z-index: 1;
  width: 110px;
  height: 87px;
  object-fit: cover;
  object-position: right bottom;
  pointer-events: none;
}

.sparkle {
  position: absolute;
  right: 134px;
  bottom: 38px;
  z-index: 2;
  width: 12px;
  height: 17px;
  background: #ffd64a;
  clip-path: polygon(50% 0, 65% 34%, 100% 50%, 65% 65%, 50% 100%, 35% 65%, 0 50%, 35% 34%);
}

.content {
  position: relative;
  z-index: 2;
  padding: 0 21px 18px;
}

.data-card {
  padding: 21px 18px 15px;
  border-radius: 19px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 10px 26px rgba(37, 60, 25, 0.075);
}

.data-card h2,
.metric h3,
.record-date h3 {
  display: flex;
  align-items: center;
  margin: 0;
}

.data-card h2 {
  gap: 12px;
  height: 28px;
  font-size: 16px;
  font-weight: 650;
}

.data-card h2 svg {
  width: 22px;
  height: 22px;
  color: var(--green);
  stroke-width: 2.5;
}

.data-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 2px 9px rgba(46, 70, 35, 0.025) inset;
}

.metrics-panel {
  display: grid;
  height: 171px;
  margin-top: 10px;
  grid-template-columns: 1fr 1fr;
}

.metric,
.record-date {
  position: relative;
  min-width: 0;
}

.metric + .metric,
.record-date {
  border-left: 1px solid #f1f2f0;
}

.metric h3,
.record-date h3 {
  gap: 11px;
  color: #4d4f4d;
  font-size: 14px;
  font-weight: 500;
}

.metric h3 {
  padding: 22px 22px 0;
}

.metric h3 svg,
.record-date h3 svg {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  color: var(--green);
  fill: none;
  stroke-width: 2.7;
}

.metric-value {
  display: flex;
  align-items: baseline;
  justify-content: center;
  margin: 12px 0 13px;
  white-space: nowrap;
}

.metric-input {
  min-width: 0;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  outline: 2px solid transparent;
  background: transparent;
  color: var(--text);
  font-size: 41px;
  font-weight: 500;
  line-height: 1;
  text-align: right;
  font-variant-numeric: tabular-nums;
  appearance: textfield;
  transition: background-color 180ms ease, outline-color 180ms ease;
}

[data-field="height"] .metric-input {
  width: 72px;
}

[data-field="currentWeight"] .metric-input,
[data-field="targetWeight"] .metric-input {
  width: 94px;
}

.metric-input::-webkit-inner-spin-button,
.metric-input::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
}

.metric-input:hover:not(:disabled) {
  background: #f7faf6;
}

.metric-input:focus-visible {
  outline-color: rgba(72, 189, 50, 0.42);
  background: #f7fbf6;
}

.metric-input:disabled {
  opacity: 0.68;
}

.metric-input.long-value {
  font-size: 34px;
}

.metric-value span {
  margin-left: 6px;
  color: #777a77;
  font-size: 13px;
}

.stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 31px;
}

.stepper button {
  display: grid;
  width: 37px;
  height: 37px;
  padding: 0;
  border: 1px solid #f0f2ef;
  border-radius: 50%;
  background: #fbfcfb;
  color: var(--green);
  box-shadow: 0 3px 10px rgba(45, 65, 37, 0.035);
  cursor: pointer;
  place-items: center;
  transition: background-color 180ms ease, border-color 180ms ease;
}

.stepper button svg {
  width: 17px;
  height: 17px;
  stroke-width: 2.4;
}

.stepper button:hover:not(:disabled) {
  border-color: #d6ebd1;
  background: #f1faef;
}

.stepper button:disabled {
  color: #b8c2b6;
  cursor: not-allowed;
}

.goal-data {
  margin-top: 19px;
  padding-top: 20px;
  padding-bottom: 14px;
}

.goal-panel {
  display: grid;
  height: 160px;
  margin-top: 10px;
  grid-template-columns: 1fr 1.08fr;
}

.compact h3 {
  padding: 22px 22px 0;
}

.compact .metric-value {
  margin-top: 14px;
  margin-bottom: 13px;
}

.record-date {
  padding: 22px 17px 0;
}

.record-date h3 {
  gap: 9px;
  white-space: nowrap;
}

.date-control {
  position: relative;
  display: flex;
  width: 204px;
  max-width: 100%;
  height: 70px;
  align-items: center;
  margin-top: 25px;
  padding: 0 22px 0 27px;
  overflow: hidden;
  border: 1px solid #e9ebe8;
  border-radius: 15px;
  background: #fff;
  color: #1f201f;
  font-size: 20px;
  white-space: nowrap;
}

.date-control span {
  flex: 1 1 auto;
  min-width: 0;
  padding-right: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.date-control svg {
  position: relative;
  z-index: 1;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  color: #a6a8a6;
  pointer-events: none;
  stroke-width: 2.5;
}

.date-control input {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  cursor: pointer;
  opacity: 0;
}

.health-tip {
  position: relative;
  display: flex;
  height: 50px;
  align-items: center;
  margin: 20px 4px 0;
  padding: 0 56px 0 18px;
  overflow: hidden;
  border: 1px solid #e5f0e1;
  border-radius: 14px;
  background: #f1f8ef;
  color: #498442;
}

.health-tip > svg {
  z-index: 2;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-right: 14px;
  color: var(--green-dark);
  fill: var(--green-dark);
  stroke: #fff;
  stroke-width: 2.5;
}

.health-tip p {
  z-index: 2;
  margin: 0;
  overflow: hidden;
  font-size: 11.5px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.health-tip img {
  position: absolute;
  right: -1px;
  bottom: -1px;
  z-index: 1;
  width: 95px;
  height: 71px;
  object-fit: cover;
  object-position: right bottom;
  pointer-events: none;
}

.save-button {
  display: grid;
  width: 100%;
  height: 54px;
  margin-top: 22px;
  padding: 0;
  border: 0;
  border-radius: 27px;
  background: linear-gradient(105deg, #46c32d 0%, #3aba27 100%);
  color: #fff;
  box-shadow: 0 9px 19px rgba(59, 178, 38, 0.18);
  cursor: pointer;
  font-size: 17px;
  font-weight: 650;
  place-items: center;
  transition: filter 180ms ease, box-shadow 180ms ease;
}

.save-button:hover:not(:disabled) {
  box-shadow: 0 10px 22px rgba(59, 178, 38, 0.25);
  filter: brightness(1.025);
}

.save-button:disabled {
  cursor: wait;
  opacity: 0.74;
}

.toast {
  position: fixed;
  right: 50%;
  bottom: max(28px, env(safe-area-inset-bottom));
  z-index: 20;
  width: max-content;
  max-width: calc(min(100vw, 471px) - 42px);
  padding: 10px 16px;
  border-radius: 8px;
  background: rgba(23, 31, 20, 0.92);
  color: #fff;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translate(50%, 10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translate(50%, 0);
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(72, 189, 50, 0.3);
  outline-offset: 3px;
}

@media (max-width: 410px) {
  .content {
    padding-right: 16px;
    padding-left: 16px;
  }

  .back-button {
    left: 16px;
  }

  .data-card {
    padding-right: 14px;
    padding-left: 14px;
  }

  .metric h3,
  .compact h3 {
    padding-left: 15px;
  }

  .metric h3,
  .record-date h3 {
    gap: 7px;
    font-size: 13px;
  }

  .record-date {
    padding-right: 11px;
    padding-left: 11px;
  }

  .metric-value strong {
    font-size: 36px;
  }

  .stepper {
    gap: 25px;
  }

  .date-control {
    padding-right: 22px;
    padding-left: 27px;
    font-size: 20px;
  }

  .health-tip {
    padding-left: 14px;
  }

  .health-tip > svg {
    margin-right: 9px;
  }

  .health-tip p {
    font-size: 10.5px;
  }
}

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