:root {
  color-scheme: light;
  --bg: #f6f8f3;
  --surface: #ffffff;
  --ink: #18211d;
  --muted: #66736c;
  --line: #dce4dc;
  --accent: #147a63;
  --accent-dark: #0d5747;
  --blue: #2867b2;
  --warm: #f5b84b;
  --orange: #df6b35;
  --danger: #c8553d;
  font-family:
    Inter, "Microsoft YaHei", "PingFang SC", system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(20, 122, 99, 0.12), transparent 42%),
    linear-gradient(45deg, rgba(245, 184, 75, 0.18), transparent 48%),
    var(--bg);
  color: var(--ink);
  font-size: 16px;
}

.page-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 28px;
  align-items: stretch;
  min-height: 420px;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(28px, 6vw, 72px);
  border-radius: 8px;
  background:
    linear-gradient(rgba(12, 30, 25, 0.62), rgba(12, 30, 25, 0.62)),
    url("https://images.unsplash.com/photo-1498837167922-ddd27525d352?auto=format&fit=crop&w=1400&q=80")
      center/cover;
  color: #fff;
}

.eyebrow {
  margin: 0 0 14px;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow.dark {
  color: var(--accent-dark);
}

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

h1 {
  margin-bottom: 18px;
  max-width: 720px;
  font-size: clamp(2.6rem, 7vw, 5.6rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.lede {
  max-width: 560px;
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  line-height: 1.7;
}

.calculator,
.result-card,
.habit-card,
.tool-card,
.food-guide,
.insights article,
.info-card,
.fact,
.science-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 50px rgba(20, 40, 32, 0.1);
}

.calculator {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 28px;
}

.field-grid {
  display: grid;
  gap: 18px;
}

.unit-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 20px;
  border-radius: 8px;
  padding: 6px;
  background: #eef4f0;
}

.unit-option {
  margin: 0;
  border: 1px solid transparent;
  padding: 11px 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}

.unit-option:hover {
  transform: none;
  background: rgba(20, 122, 99, 0.08);
}

.unit-option.active {
  border-color: rgba(20, 122, 99, 0.18);
  background: #fff;
  color: var(--accent-dark);
  box-shadow: 0 8px 22px rgba(20, 40, 32, 0.08);
}

.height-imperial,
.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.hidden {
  display: none;
}

label span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-weight: 700;
}

.input-row {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

input {
  width: 100%;
  min-width: 0;
  border: 0;
  padding: 18px;
  color: var(--ink);
  font-size: 1.1rem;
  outline: 0;
}

select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  outline: 0;
}

select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(20, 122, 99, 0.12);
}

.input-row:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(20, 122, 99, 0.12);
}

.input-row strong {
  padding-right: 18px;
  color: var(--muted);
}

button {
  width: 100%;
  margin-top: 22px;
  border: 0;
  border-radius: 8px;
  padding: 16px 18px;
  background: var(--accent);
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    background 0.18s ease;
}

button:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.form-note {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

.result-panel {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  margin-top: 20px;
}

.result-card,
.habit-card {
  min-height: 150px;
  padding: 24px;
}

.label {
  margin-bottom: 8px;
  color: var(--muted);
  font-weight: 800;
}

#bmiValue {
  display: block;
  margin-bottom: 8px;
  font-size: 4rem;
  line-height: 1;
}

#bmiCategory {
  display: inline-flex;
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(20, 122, 99, 0.1);
  color: var(--accent-dark);
  font-weight: 800;
}

.bmi-scale {
  margin-top: 22px;
}

.scale-track {
  position: relative;
  display: grid;
  grid-template-columns: 38fr 27fr 15fr 20fr;
  height: 14px;
  border-radius: 999px;
  background: #e7ece7;
}

.segment:first-child {
  border-radius: 999px 0 0 999px;
}

.segment:last-of-type {
  border-radius: 0 999px 999px 0;
}

.segment.underweight {
  background: #6ea8d9;
}

.segment.normal {
  background: var(--accent);
}

.segment.overweight {
  background: var(--warm);
}

.segment.obese {
  background: var(--danger);
}

.scale-marker {
  position: absolute;
  top: 50%;
  left: 0;
  width: 18px;
  height: 18px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
  transform: translate(-50%, -50%);
  transition: left 0.25s ease;
}

.scale-labels {
  display: grid;
  grid-template-columns: 38fr 27fr 15fr 20fr;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.82rem;
}

.scale-labels span:nth-child(1) {
  grid-column: 2;
  justify-self: start;
}

.scale-labels span:nth-child(2) {
  grid-column: 3;
  justify-self: start;
}

.scale-labels span:nth-child(3) {
  grid-column: 4;
  justify-self: start;
}

.quick-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 20px;
}

.quick-stats article {
  border-radius: 8px;
  padding: 24px;
  color: #fff;
  background: var(--ink);
  box-shadow: 0 18px 50px rgba(20, 40, 32, 0.1);
}

.quick-stats article:nth-child(2) {
  background: var(--accent-dark);
}

.quick-stats span {
  display: block;
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.72);
  font-weight: 900;
}

.quick-stats strong {
  display: block;
  margin-bottom: 8px;
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  line-height: 1.15;
}

.quick-stats p {
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.6;
}

.interactive-section {
  margin-top: 44px;
}

.interactive-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 18px;
}

.tool-card {
  padding: 22px;
}

.tool-card h3 {
  margin-bottom: 14px;
}

.daily-card,
.weekly-card {
  grid-column: span 3;
}

.water-card,
.waist-card,
.history-card {
  grid-column: span 2;
}

.daily-card {
  background:
    linear-gradient(135deg, rgba(20, 122, 99, 0.14), transparent 62%),
    #ffffff;
}

.weekly-card {
  background:
    linear-gradient(135deg, rgba(40, 103, 178, 0.13), transparent 62%),
    #ffffff;
}

.water-card {
  background:
    linear-gradient(135deg, rgba(110, 168, 217, 0.2), transparent 62%),
    #ffffff;
}

.waist-card {
  background:
    linear-gradient(135deg, rgba(223, 107, 53, 0.13), transparent 62%),
    #ffffff;
}

.history-card {
  background:
    linear-gradient(135deg, rgba(245, 184, 75, 0.18), transparent 62%),
    #ffffff;
}

.checklist {
  display: grid;
  gap: 10px;
}

.checklist label {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font-weight: 700;
}

.checklist input {
  width: 18px;
  height: 18px;
  min-width: 18px;
  accent-color: var(--accent);
}

.progress-line {
  margin-top: 16px;
}

.progress-line > span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-weight: 900;
}

.progress-line div {
  height: 12px;
  border-radius: 999px;
  background: rgba(20, 122, 99, 0.12);
  overflow: hidden;
}

.progress-line div span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.2s ease;
}

.day-tracker {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin: 18px 0;
}

.day-tracker button,
.secondary-button,
.icon-button {
  border: 0;
  cursor: pointer;
}

.day-tracker button {
  margin: 0;
  aspect-ratio: 1;
  border-radius: 8px;
  padding: 0;
  background: #eef4f0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 900;
}

.day-tracker button.done {
  background: var(--blue);
  color: #fff;
}

.secondary-button,
.icon-button {
  width: auto;
  margin-top: 12px;
  border-radius: 8px;
  padding: 11px 14px;
  background: var(--ink);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 900;
}

.secondary-button:hover,
.icon-button:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.water-card p,
.waist-card p,
.weekly-card p {
  color: var(--muted);
  line-height: 1.65;
}

#waterResult {
  display: block;
  margin-top: 14px;
  font-size: 1.3rem;
  line-height: 1.35;
}

.history-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.history-header h3 {
  margin-bottom: 0;
}

.icon-button {
  margin-top: 0;
  padding: 8px 10px;
  background: rgba(24, 33, 29, 0.1);
  color: var(--ink);
}

.history-list {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.history-list li {
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  line-height: 1.5;
}

.habit-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  background:
    linear-gradient(135deg, rgba(245, 184, 75, 0.22), transparent 60%),
    rgba(255, 255, 255, 0.9);
}

.habit-card span {
  color: var(--accent-dark);
  font-weight: 900;
}

.habit-card p {
  max-width: 640px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.food-guide {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 0;
  margin-top: 20px;
  overflow: hidden;
}

.food-photo {
  min-height: 100%;
}

.food-photo img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 360px;
  object-fit: cover;
}

.food-content {
  padding: 28px;
}

.food-content h2 {
  margin-bottom: 10px;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  line-height: 1.15;
}

.food-content > p {
  color: var(--muted);
  line-height: 1.7;
}

.food-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 18px;
}

.food-columns > div {
  border-radius: 8px;
  padding: 18px;
  background: #f8fbf8;
}

.food-columns > div:nth-child(2) {
  background: #fff8f3;
}

.insights {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 20px;
}

.insights article {
  position: relative;
  overflow: hidden;
  padding: 26px;
}

.insights article::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 7px;
  content: "";
}

.insights article:nth-child(1) {
  background:
    linear-gradient(135deg, rgba(20, 122, 99, 0.12), transparent 58%),
    #ffffff;
}

.insights article:nth-child(1)::before {
  background: var(--accent);
}

.insights article:nth-child(2) {
  background:
    linear-gradient(135deg, rgba(245, 184, 75, 0.2), transparent 58%),
    #ffffff;
}

.insights article:nth-child(2)::before {
  background: var(--warm);
}

.insights article:nth-child(3) {
  background:
    linear-gradient(135deg, rgba(40, 103, 178, 0.12), transparent 58%),
    #ffffff;
}

.insights article:nth-child(3)::before {
  background: var(--blue);
}

.insights article:nth-child(4) {
  background:
    linear-gradient(135deg, rgba(223, 107, 53, 0.13), transparent 58%),
    #ffffff;
}

.insights article:nth-child(4)::before {
  background: var(--orange);
}

.insights article:nth-child(5) {
  background:
    linear-gradient(135deg, rgba(200, 85, 61, 0.12), transparent 58%),
    #ffffff;
}

.insights article:nth-child(5)::before {
  background: var(--danger);
}

.insights article:nth-child(6) {
  background:
    linear-gradient(135deg, rgba(24, 33, 29, 0.08), transparent 58%),
    #ffffff;
}

.insights article:nth-child(6)::before {
  background: var(--ink);
}

h2 {
  margin-bottom: 14px;
  font-size: 1.35rem;
}

#bmiAdvice {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.8;
}

#foodAdvice,
#maintainAdvice {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.8;
}

.advice-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.advice-list li {
  position: relative;
  padding-left: 24px;
  color: var(--muted);
  line-height: 1.65;
}

.advice-list li::before {
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  content: "";
}

.warning-list li::before {
  background: var(--orange);
}

.range-list {
  display: grid;
  gap: 10px;
}

.range-list div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.range-list div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.range-list span {
  color: var(--muted);
}

.learn-section {
  margin-top: 44px;
}

.section-heading {
  max-width: 720px;
  margin-bottom: 22px;
}

.section-heading h2 {
  margin-bottom: 10px;
  font-size: clamp(1.9rem, 3vw, 3rem);
  line-height: 1.1;
}

.section-heading p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.info-card {
  overflow: hidden;
}

.info-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.info-card div {
  padding: 20px;
}

.tag {
  display: inline-flex;
  margin-bottom: 12px;
  border-radius: 999px;
  padding: 6px 10px;
  color: #fff;
  font-size: 0.86rem;
  font-weight: 900;
}

.tag.green {
  background: var(--accent);
}

.tag.blue {
  background: var(--blue);
}

.tag.orange {
  background: var(--orange);
}

h3 {
  margin: 0 0 10px;
  font-size: 1.18rem;
  line-height: 1.35;
}

.info-card p,
.fact p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.7;
}

.facts-section {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.fact {
  padding: 20px;
  border-top: 5px solid var(--warm);
}

.fact:nth-child(2) {
  border-top-color: var(--blue);
}

.fact:nth-child(3) {
  border-top-color: var(--orange);
}

.fact strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1.05rem;
}

.science-section {
  margin-top: 44px;
}

.science-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.science-grid article {
  padding: 22px;
}

.number-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  margin-bottom: 18px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
}

.science-grid article:nth-child(2) .number-badge {
  background: var(--blue);
}

.science-grid article:nth-child(3) .number-badge {
  background: var(--accent);
}

.science-grid article:nth-child(4) .number-badge {
  background: var(--orange);
}

.science-grid p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.7;
}

.disclaimer {
  margin-top: 44px;
  border: 1px solid rgba(24, 33, 29, 0.14);
  border-radius: 8px;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(24, 33, 29, 0.08), transparent 60%),
    rgba(255, 255, 255, 0.86);
}

.disclaimer h2 {
  margin-bottom: 10px;
}

.disclaimer p {
  margin-bottom: 10px;
  color: var(--muted);
  line-height: 1.75;
}

.disclaimer p:last-child {
  margin-bottom: 0;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 22px;
  margin-top: 28px;
  border-top: 1px solid var(--line);
  padding: 24px 0 8px;
  color: var(--muted);
}

.site-footer strong {
  color: var(--ink);
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.site-footer a {
  color: var(--accent-dark);
  font-weight: 800;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

.site-footer p {
  width: 100%;
  margin-bottom: 0;
  font-size: 0.92rem;
}

@media (max-width: 860px) {
  .hero,
  .result-panel,
  .quick-stats,
  .interactive-grid,
  .food-guide,
  .food-columns,
  .insights,
  .image-grid,
  .facts-section,
  .science-grid {
    grid-template-columns: 1fr;
  }

  .food-photo img {
    min-height: 260px;
  }

  .daily-card,
  .weekly-card,
  .water-card,
  .waist-card,
  .history-card {
    grid-column: span 1;
  }

  .hero {
    min-height: auto;
  }

  .hero-copy {
    min-height: 380px;
  }
}

@media (max-width: 520px) {
  .page-shell {
    width: min(100% - 20px, 1120px);
    padding: 10px 0 24px;
  }

  .hero-copy,
  .calculator,
  .result-card,
  .habit-card,
  .food-content,
  .insights article {
    padding: 20px;
  }

  #bmiValue {
    font-size: 3.2rem;
  }

  .height-imperial,
  .profile-grid {
    grid-template-columns: 1fr;
  }

  .height-imperial label:nth-child(2) span {
    display: none;
  }
}
