@font-face {
  font-family: "Noto Sans SC";
  src: url("fonts/NotoSansSC-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --brand: #7060c0;
  --brand-dark: #56489a;
  --paper: #f3efe6;
  --card: #fffdf8;
  --ink: #1d1a17;
  --muted: #5f584e;
  --line: #e3dacb;
  --pine: #1c5c4a;
  --pine-soft: #e7f2ec;
  --warn: #8a4b12;
  --warn-soft: #fbf1e4;
  --bad: #8e2e2e;
  --bad-soft: #f8e8e4;
  --shadow: 0 16px 40px rgba(55, 42, 24, 0.06);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(112, 96, 192, 0.08), transparent 28%),
    var(--paper);
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.55;
}

button, input, select { font-family: inherit; font-size: inherit; }

button { cursor: pointer; }

a { color: var(--brand-dark); }

.topbar, .nav, .wrap { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 0 8px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--brand);
  color: white;
  font-size: 18px;
}

.brand strong { display: block; font-size: 20px; font-weight: 400; letter-spacing: 0.04em; }
.brand small { color: var(--muted); }

.team {
  color: var(--brand-dark);
  letter-spacing: 0.12em;
}

.nav {
  display: flex;
  gap: 6px;
  padding: 8px 0 18px;
  border-bottom: 1px solid var(--line);
}

.nav a {
  text-decoration: none;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 999px;
}

.nav a[aria-current="page"] {
  color: white;
  background: var(--brand);
}

.wrap { padding: 22px 0 48px; }

.lead {
  margin: 0 0 16px;
  color: var(--muted);
  max-width: 78ch;
}

.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.steps span {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 13px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 16px;
  align-items: start;
}

.card, .result-card, .sheet, .lib-card, .method-block {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.card { padding: 8px 18px 18px; }

fieldset {
  border: 0;
  margin: 0;
  padding: 14px 0 4px;
  border-top: 1px solid var(--line);
}

legend {
  padding: 0;
  font-size: 16px;
  letter-spacing: 0.06em;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
}

.field { display: flex; flex-direction: column; gap: 4px; }
.field.wide { grid-column: 1 / -1; }
.field span, .check span { color: var(--muted); font-size: 13px; }

input, select {
  width: 100%;
  border: 1px solid #d9d0c2;
  background: white;
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--ink);
}

input:focus, select:focus {
  outline: 2px solid rgba(112, 96, 192, 0.35);
  border-color: var(--brand);
}

.note {
  margin: 10px 0 0;
  padding: 10px 12px;
  background: #f7f4ee;
  border-radius: 10px;
  color: var(--muted);
  font-size: 13px;
}

.note strong { color: var(--ink); font-weight: 400; }

.checks { display: grid; gap: 6px; margin-top: 8px; }
.check { display: flex; gap: 8px; align-items: flex-start; }
.check input { width: auto; margin-top: 4px; }

.rep-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.rep-table th, .rep-table td { padding: 6px 4px; text-align: left; font-weight: 400; }
.rep-table th { color: var(--muted); font-size: 13px; }

.row-actions, .actions, .lib-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

button.primary, button.ghost, button.linkish {
  border-radius: 999px;
  padding: 8px 14px;
}

button.primary { background: var(--pine); color: white; border: 0; }
button.ghost, button.linkish { background: transparent; border: 1px solid var(--line); color: var(--ink); }
button.linkish { padding: 4px 8px; border: 0; color: var(--brand-dark); }

.result-card {
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 24px);
  overflow: auto;
  padding: 16px;
}

.result-kicker, .eyebrow {
  margin: 0;
  color: var(--muted);
  letter-spacing: 0.08em;
  font-size: 12px;
}

.result-value {
  margin: 4px 0;
  font-size: 42px;
  line-height: 1.1;
  color: var(--pine);
  font-variant-numeric: tabular-nums;
}

.result-u { margin: 0 0 8px; }

.flash {
  background: var(--pine-soft);
  color: var(--pine);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
}

.warn-list, .quiet-list { margin: 8px 0; padding-left: 18px; }
.warn-list li { color: var(--bad); margin: 4px 0; }
.quiet-list li { color: var(--warn); margin: 4px 0; }

.trace {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--muted);
}

.trace p { margin: 4px 0; }

.sheet { margin-top: 16px; padding: 22px; }
.sheet h2 { margin: 0; font-weight: 400; letter-spacing: 0.08em; }
.sheet-rule { height: 3px; margin: 8px 0 14px; background: linear-gradient(90deg, var(--ink), var(--ink) 40%, var(--brand) 40%, var(--brand)); }
.sheet h3 { margin: 16px 0 6px; font-size: 15px; font-weight: 400; }
.meta-table, .plain { width: 100%; border-collapse: collapse; }
.meta-table th, .meta-table td, .plain th, .plain td {
  border-bottom: 1px solid var(--line);
  padding: 6px 4px;
  text-align: left;
  vertical-align: top;
  font-weight: 400;
}
.meta-table th { width: 28%; color: var(--muted); }
.watermark {
  display: inline-block;
  margin-bottom: 8px;
  padding: 2px 8px;
  border: 1px solid var(--warn);
  color: var(--warn);
  border-radius: 999px;
}
.sheet-foot { margin-top: 16px; color: var(--muted); font-size: 13px; }

.lib-tools input { max-width: 320px; }
.lib-group { margin: 18px 0 8px; font-size: 16px; }
.lib-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.lib-card { padding: 14px; }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--brand);
  color: white;
  font-size: 12px;
}
.badge.alt { background: var(--pine); }
.lib-card h3 { margin: 8px 0 4px; font-weight: 400; }
.lib-card p { margin: 4px 0; color: var(--muted); font-size: 13px; }
.purity { color: var(--ink); font-size: 18px; }

.method-block { padding: 16px 18px; margin-bottom: 12px; }
.method-block h2 { margin: 0 0 8px; font-weight: 400; }
.formula {
  background: #f7f4ee;
  border-radius: 10px;
  padding: 10px 12px;
  overflow-x: auto;
}
.brand-figure { margin: 12px 0 0; }
.brand-figure img { display: block; width: 376px; max-width: 100%; height: auto; background: var(--brand); }
.brand-figure figcaption { color: var(--muted); font-size: 13px; }

.site-footer {
  background: #7060c0;
  color: white;
  text-align: center;
  padding: 18px 16px 28px;
}

.site-footer img {
  display: block;
  width: 376px;
  max-width: 100%;
  height: auto;
  margin: 0 auto 6px;
}

.footer-copy { width: min(760px, 100%); margin: 0 auto; }
.footer-copy p { margin: 0; font-size: 16px; line-height: 1.8; }
.footer-copy a { color: white; }

.empty { color: var(--muted); }

@media (max-width: 900px) {
  .layout, .steps, .lib-grid, .grid { grid-template-columns: 1fr; }
  .result-card { position: static; max-height: none; }
  .topbar { align-items: flex-start; }
}

@media print {
  body { background: white; }
  .topbar, .nav, .site-footer, .no-print, .result-card { display: none !important; }
  .wrap { width: auto; padding: 0; }
  .sheet { box-shadow: none; border: 0; margin: 0; }
}
