:root {
  color-scheme: light;
  --ink: #20241f;
  --muted: #626b64;
  --faint: #8d958e;
  --paper: #eef2ed;
  --paper-strong: #fffefd;
  --paper-soft: #f7f8f4;
  --accent: #526f66;
  --accent-deep: #284f48;
  --accent-soft: #e6efea;
  --warm: #8a6c5b;
  --rose-soft: #f5eee9;
  --line: rgba(32, 36, 31, 0.1);
  --line-strong: rgba(32, 36, 31, 0.18);
  --shadow: 0 14px 34px rgba(28, 42, 36, 0.07);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 254, 253, 0.92), rgba(238, 242, 237, 0.96)),
    var(--paper);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(90deg, transparent, rgba(82, 111, 102, 0.035), transparent),
    linear-gradient(rgba(32, 36, 31, 0.028) 1px, transparent 1px);
  background-size:
    100% 100%,
    100% 72px;
  mask-image: linear-gradient(180deg, #000 0%, transparent 72%);
}

button,
input,
select {
  font: inherit;
}

button,
select,
input[type="date"] {
  border: 1px solid var(--line);
  border-radius: 8px;
}

button {
  min-height: 42px;
  padding: 0 15px;
  color: var(--ink);
  background: rgba(255, 254, 253, 0.82);
  cursor: pointer;
  transition:
    border-color 160ms ease,
    color 160ms ease,
    background-color 160ms ease,
    transform 160ms ease;
}

button:hover {
  border-color: var(--line-strong);
  color: var(--accent-deep);
  background: var(--paper-strong);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(14, 116, 113, 0.28);
  outline-offset: 3px;
}

.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1220px, calc(100% - 44px));
  margin: 0 auto;
  padding: 26px 0 16px;
}

.brand,
.home-link {
  color: var(--ink);
  text-decoration: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 0.95rem;
  font-weight: 680;
}

.brand-mark {
  width: 18px;
  height: 18px;
  border: 2px solid var(--ink);
  border-right-color: var(--accent);
  border-bottom-color: var(--warm);
  transform: rotate(45deg);
}

.home-link {
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 254, 253, 0.54);
}

.planner {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(1220px, calc(100% - 44px));
  margin: 0 auto;
  padding: 28px 0 58px;
  grid-template-columns: minmax(300px, 342px) 1fr;
  gap: 46px;
}

.control-panel,
.info-card,
.sources {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 254, 253, 0.82);
}

.control-panel {
  align-self: start;
  position: sticky;
  top: 22px;
  padding: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 780;
  text-transform: uppercase;
}

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

h1 {
  max-width: none;
  margin-bottom: 16px;
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", ui-serif, Georgia, serif;
  font-size: 2.24rem;
  font-weight: 650;
  line-height: 1.15;
  text-wrap: balance;
}

h1 span {
  display: block;
}

.intro,
.summary,
.hint,
.medical-note,
.sources,
.metric-label {
  color: var(--muted);
}

.intro {
  margin-bottom: 24px;
  font-size: 1rem;
  line-height: 1.72;
}

.scope-panel {
  margin: 0 0 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(230, 239, 234, 0.58);
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.62;
}

.scope-panel summary,
.birthdate-panel summary,
.source-details summary {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  color: var(--ink);
  font-weight: 720;
  list-style: none;
}

.scope-panel summary {
  padding: 0 16px;
}

.details-symbol::before {
  color: var(--accent);
  content: "+";
  font-size: 1.08rem;
  font-weight: 500;
}

.scope-panel[open] .details-symbol::before,
.birthdate-panel[open] .details-symbol::before,
.source-details[open] .details-symbol::before {
  content: "−";
}

.scope-panel summary::-webkit-details-marker,
.birthdate-panel summary::-webkit-details-marker,
.source-details summary::-webkit-details-marker {
  display: none;
}

.scope-copy {
  display: grid;
  gap: 9px;
  padding: 0 16px 15px;
}

.scope-panel p {
  margin: 0;
}

.scope-panel strong {
  color: var(--ink);
  font-weight: 680;
}

.field-group {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.birthdate-panel {
  margin-top: 2px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.birthdate-panel summary {
  min-height: 48px;
}

.disclosure-body {
  display: grid;
  gap: 10px;
  padding: 4px 0 18px;
}

.field-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

label {
  font-size: 0.9rem;
  font-weight: 720;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

input[type="date"],
select {
  min-height: 44px;
  width: 100%;
  padding: 0 13px;
  color: var(--ink);
  background: rgba(255, 254, 253, 0.92);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

#age-select {
  min-height: 44px;
  width: auto;
  min-width: 112px;
  padding-right: 34px;
  font-weight: 680;
}

.range-meta {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  color: var(--faint);
  font-size: 0.78rem;
}

.range-meta strong {
  color: var(--accent-deep);
  font-size: 0.9rem;
}

.range-meta span:last-child {
  text-align: right;
}

.hint,
.medical-note {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.55;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 22px;
}

.action-row button {
  min-height: 44px;
}

.tool-status {
  margin: 10px 0 0;
  color: var(--accent-deep);
  font-size: 0.84rem;
  line-height: 1.5;
}

.tool-status:empty {
  display: none;
}

.privacy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.text-button {
  min-height: 44px;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: var(--accent-deep);
  background: transparent;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.text-button:hover {
  border: 0;
  background: transparent;
}

.medical-note {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.result-panel {
  min-width: 0;
}

.month-heading {
  display: grid;
  grid-template-columns: minmax(340px, 0.95fr) 1fr;
  gap: 34px;
  align-items: start;
  padding: 2px 0 26px;
  border-bottom: 1px solid var(--line);
}

.stage-badge {
  display: inline-flex;
  margin: 0 0 10px;
  padding: 0;
  color: var(--accent);
  background: transparent;
  font-size: 0.8rem;
  font-weight: 760;
}

h2 {
  margin-bottom: 0;
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", ui-serif, Georgia, serif;
  font-size: 1.84rem;
  font-weight: 650;
  line-height: 1.22;
  text-wrap: balance;
}

.summary {
  margin-bottom: 0;
  font-size: 1rem;
  line-height: 1.7;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 24px 0 18px;
}

.metric-strip div {
  min-height: 100px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 254, 253, 0.66);
}

.metric-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.78rem;
  font-weight: 760;
  color: var(--faint);
}

.metric-strip strong {
  display: block;
  font-size: 1rem;
  line-height: 1.35;
}

.guardrail-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 26px;
}

.guardrail-strip article {
  padding: 18px 19px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(230, 239, 234, 0.5);
}

.guardrail-strip h3 {
  margin-bottom: 8px;
}

.guardrail-strip p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.62;
}

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

.info-card {
  min-height: 218px;
  padding: 22px 23px;
  background: rgba(255, 254, 253, 0.72);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.62) inset;
}

.issue-card {
  grid-column: 1 / -1;
  min-height: 0;
  background: rgba(255, 254, 253, 0.78);
}

.safety-basics-card {
  background: rgba(245, 238, 233, 0.48);
}

.card-note,
.issue-note {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.65;
}

.accent-teal {
  border-top: 0;
}

.accent-clay {
  border-top: 0;
}

.accent-moss {
  border-top: 0;
}

.next-card {
  grid-column: 1 / -1;
  background: rgba(233, 241, 238, 0.52);
}

h3 {
  margin-bottom: 12px;
  font-size: 0.98rem;
  font-weight: 780;
}

ul {
  margin: 0;
  padding-left: 17px;
}

li {
  margin: 0 0 9px;
  line-height: 1.62;
}

li:last-child {
  margin-bottom: 0;
}

.sources {
  margin-top: 18px;
  padding: 20px 22px;
  background: rgba(255, 254, 253, 0.62);
}

.sources ul {
  columns: 2;
  column-gap: 34px;
}

.sources li {
  break-inside: avoid;
}

.source-meta {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.sources a {
  color: var(--accent-deep);
  font-weight: 660;
}

.source-details {
  border-top: 1px solid var(--line);
}

.source-details summary {
  color: var(--accent-deep);
}

.source-details ul {
  padding-top: 4px;
  padding-bottom: 4px;
}

.print-only {
  display: none;
}

@media (max-width: 980px) {
  .planner {
    grid-template-columns: 1fr;
  }

  .control-panel {
    position: static;
  }

  h1 {
    max-width: 100%;
  }
}

@media (max-width: 720px) {
  .topbar,
  .planner {
    width: min(100% - 28px, 1220px);
  }

  .topbar {
    padding-top: 18px;
  }

  .planner {
    padding-bottom: 28px;
  }

  .control-panel,
  .info-card,
  .sources {
    padding: 18px;
  }

  h1 {
    font-size: 2.05rem;
  }

  h2 {
    font-size: 1.55rem;
  }

  .month-heading,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .metric-strip,
  .guardrail-strip {
    grid-template-columns: 1fr;
  }

  .sources ul {
    columns: 1;
  }

  .input-row {
    grid-template-columns: 1fr;
  }

  .privacy-row {
    align-items: flex-start;
  }
}

@media print {
  body {
    background: #fff;
  }

  body::before,
  .topbar,
  .control-panel {
    display: none;
  }

  .planner {
    display: block;
    width: 100%;
    padding: 0;
  }

  .result-panel,
  .info-card {
    border-color: #aaa;
    box-shadow: none;
  }

  .sources {
    margin-top: 16px;
    padding: 12px 0 0;
    border: 0;
    border-top: 1px solid #aaa;
    background: #fff;
    font-size: 9pt;
  }

  .source-details {
    display: none;
  }

  .print-only {
    display: block;
    margin: 6px 0 0;
  }
}
