:root {
  color-scheme: light;
  --bg: #f7fbf8;
  --surface: #ffffff;
  --surface-soft: #eef7f1;
  --ink: #1c2520;
  --muted: #657168;
  --line: #d9e5dd;
  --green: #15945b;
  --green-deep: #0f6f47;
  --mint: #bfe8d0;
  --blue: #2374ab;
  --amber: #c58115;
  --red: #d14a3a;
  --shadow: 0 20px 55px rgba(31, 68, 47, 0.12);
  font-family: "Noto Sans TC", "Microsoft JhengHei", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

.site-header,
.site-footer {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border: 2px solid var(--green);
  border-radius: 8px;
  background:
    linear-gradient(135deg, transparent 44%, var(--green) 45%, var(--green) 55%, transparent 56%),
    linear-gradient(#ffffff, #ffffff);
  box-shadow: inset 0 -7px 0 var(--mint);
}

.top-nav,
.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  color: var(--muted);
  font-size: 0.95rem;
}

.top-nav a,
.site-footer a {
  border-bottom: 1px solid transparent;
}

.top-nav a:hover,
.site-footer a:hover {
  border-color: currentColor;
}

main {
  overflow: hidden;
}

.tool-section {
  width: min(1120px, calc(100% - 32px));
  min-height: calc(100vh - 164px);
  margin: 0 auto;
  padding: 34px 0 58px;
  display: grid;
  grid-template-columns: minmax(0, 0.88fr) minmax(320px, 1fr);
  align-items: center;
  gap: 42px;
}

.tool-copy {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--green-deep);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 14px;
  font-size: clamp(2.6rem, 6vw, 5.8rem);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 14px;
  font-size: clamp(1.7rem, 3vw, 2.5rem);
  line-height: 1.18;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 1.05rem;
  letter-spacing: 0;
}

.lead {
  max-width: 620px;
  margin-bottom: 26px;
  color: var(--muted);
  font-size: 1.13rem;
}

.metric-visual {
  width: min(420px, 92%);
  height: auto;
  margin-top: 16px;
}

.calculator,
.note-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.calculator {
  padding: clamp(20px, 4vw, 30px);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.96rem;
  font-weight: 700;
}

.input-shell {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  min-height: 62px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.input-shell:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(21, 148, 91, 0.13);
}

input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 1.38rem;
  font-weight: 800;
  padding: 12px 8px 12px 15px;
}

input::placeholder {
  color: #9aaba1;
}

.unit {
  padding-right: 14px;
  color: var(--muted);
  font-weight: 800;
}

.action-row {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.primary-button {
  flex: 1;
  background: var(--green);
  color: #ffffff;
}

.primary-button:hover {
  background: var(--green-deep);
}

.ghost-button {
  padding-inline: 18px;
  background: #edf4ef;
  color: var(--green-deep);
}

.ghost-button:hover {
  background: #dfeee5;
}

.form-error {
  min-height: 26px;
  margin: 10px 0 0;
  color: var(--red);
  font-weight: 700;
}

.result-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 14px;
  margin-top: 18px;
  padding: 18px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.result-label {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.result-number,
.result-status {
  margin-bottom: 0;
  color: var(--ink);
  font-weight: 900;
  line-height: 1.1;
}

.result-number {
  font-size: clamp(2.3rem, 9vw, 4.6rem);
}

.result-status {
  font-size: clamp(1.3rem, 4vw, 2.2rem);
}

.range-track {
  grid-column: 1 / -1;
  position: relative;
  height: 14px;
  margin-top: 4px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--blue) 0 30%, var(--green) 30% 58%, var(--amber) 58% 75%, var(--red) 75% 100%);
}

.range-dot {
  position: absolute;
  top: 50%;
  left: 0;
  width: 24px;
  height: 24px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 2px 9px rgba(0, 0, 0, 0.24);
  transform: translate(-50%, -50%);
  transition: left 220ms ease;
}

.content-band {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 58px 0;
}

.section-heading {
  max-width: 700px;
}

.source-line {
  color: var(--muted);
}

.source-line a {
  color: var(--green-deep);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.standard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 22px;
}

.standard-card {
  min-height: 128px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.standard-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 800;
}

.standard-card.under {
  border-top: 5px solid var(--blue);
}

.standard-card.normal {
  border-top: 5px solid var(--green);
}

.standard-card.high {
  border-top: 5px solid var(--amber);
}

.standard-card.obese {
  border-top: 5px solid var(--red);
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.72fr);
  gap: 28px;
  align-items: start;
}

.two-column p {
  color: var(--muted);
}

.note-box {
  padding: 22px;
  box-shadow: none;
}

.note-box p {
  margin-bottom: 0;
}

.faq-list {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}

details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

summary {
  min-height: 58px;
  padding: 17px 18px;
  font-weight: 800;
  cursor: pointer;
}

details p {
  margin: 0;
  padding: 0 18px 18px;
  color: var(--muted);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 28px 0 40px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.site-footer p {
  margin: 0;
}

.plain-page {
  width: min(820px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 72px;
}

.plain-page p,
.plain-page li {
  color: var(--muted);
}

.plain-page a {
  color: var(--green-deep);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 820px) {
  .site-header,
  .site-footer {
    width: min(100% - 24px, 680px);
  }

  .site-header {
    align-items: flex-start;
    padding: 16px 0;
  }

  .top-nav {
    justify-content: flex-end;
    gap: 12px;
    font-size: 0.9rem;
  }

  .tool-section,
  .content-band {
    width: min(100% - 24px, 680px);
  }

  .tool-section {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 22px;
    padding: 20px 0 40px;
  }

  .metric-visual {
    width: min(340px, 86vw);
  }

  .field-grid,
  .result-panel,
  .standard-grid,
  .two-column {
    grid-template-columns: 1fr;
  }

  .site-footer {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .top-nav a:nth-child(2) {
    display: none;
  }

  h1 {
    font-size: 3.2rem;
  }

  .lead {
    font-size: 1rem;
  }

  .calculator {
    padding: 16px;
  }

  .action-row {
    flex-direction: column;
  }

  .ghost-button {
    width: 100%;
  }
}
