:root {
  --paper: #ffffff;
  --surface: #f7f8fa;
  --ink: #12161f;
  --muted: #5b6474;
  --line: #e3e6ec;
  --accent: #2f4bce;
  --orange: #e8590c;
  --teal: #0f9d8f;
  --purple: #8b5cf6;
  --radius: 12px;
  --space: 16px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.55 -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-variant-numeric: tabular-nums;
}
h1, h2, h3, p, dl, dd { margin: 0; }
h1 { font-size: clamp(28px, 4vw, 40px); line-height: 1.2; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
a { color: var(--accent); }
button, input { font: inherit; font-variant-numeric: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }
.shell { width: min(calc(100% - 2 * var(--space)), 1120px); margin: 0 auto; }
.page-header { padding: 36px 0 24px; }
.page-header nav { margin-bottom: var(--space); }
.page-header p { color: var(--muted); margin-top: 8px; }
.tool-grid, .calculator, .results, .inputs, .method { display: grid; gap: var(--space); }
.tool-card, .panel, details {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space);
}
.tool-card { min-height: 155px; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
a.tool-card:hover { border-color: var(--accent); }
.tool-card p { color: var(--muted); margin-top: 6px; }
.tool-link { display: block; margin-top: 14px; color: var(--accent); font-weight: 600; }
.planned { background: var(--surface); color: var(--muted); }
.badge { display: inline-block; margin-bottom: 8px; padding: 2px 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.footer { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 28px 0; padding-top: var(--space); border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.results, .inputs { min-width: 0; align-self: start; }
.panel { background: var(--surface); }
.total { display: block; margin: 4px 0; color: var(--accent); font-size: clamp(33px, 5vw, 48px); font-weight: 700; line-height: 1.2; }
#anchor, .hint { color: var(--muted); font-size: 14px; }
.total, dd, #monthly, .scene strong, #anchor, .warning { overflow-wrap: anywhere; }
.stack { display: flex; height: 10px; border-radius: 10px; overflow: hidden; margin: var(--space) 0 10px; background: var(--line); }
.stack span { flex: 0 0 auto; }
[data-part="core"] { background: var(--accent); }
[data-part="kid"] { background: var(--orange); }
[data-part="health"] { background: var(--teal); }
[data-part="house"] { background: var(--purple); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.breakdown > div, .field-line { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.breakdown > div { padding: 4px 0; font-size: 14px; }
.breakdown dt { flex: 0 0 auto; }
.breakdown dd { min-width: 0; text-align: right; }
button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 9px;
  background: var(--paper);
  color: var(--ink);
}
button:hover:not(:disabled), button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--paper); margin-top: 12px; }
button.primary:hover { color: var(--paper); text-decoration: underline; }
#copy-status { font-size: 13px; color: var(--muted); }
.scenes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.scene { text-align: left; display: grid; align-content: start; gap: 3px; padding: 9px; }
.scene span { color: var(--muted); font-size: 13px; }
.scene strong { color: var(--accent); font-size: 15px; }
.field { margin-top: var(--space); padding: var(--space) 0 0; border: 0; border-top: 1px solid var(--line); min-width: 0; }
.field-line label { font-weight: 600; }
#reverse-heading + .field-line { margin-top: 10px; }
input[type="number"] {
  width: 7ch;
  min-width: 0;
  flex: 0 0 105px;
  border: 1px solid #aeb6c6;
  border-radius: 8px;
  padding: 5px 8px;
  color: var(--ink);
  background: var(--paper);
}
input[type="range"] { display: block; width: 100%; margin: 12px 0; }
input[type="range"], input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
.quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.quick button { font-size: 13px; }
.kids-line, .switch-line { margin-top: 12px; }
.stepper, .switch-line, .rates > div { display: flex; align-items: center; gap: 7px; }
.stepper input { appearance: textfield; width: 42px; flex: none; text-align: center; }
.stepper input::-webkit-inner-spin-button { appearance: none; }
.stepper button { min-width: 36px; }
.stepper button:disabled { color: var(--muted); background: var(--surface); }
#discount {
  appearance: none;
  width: 39px;
  height: 23px;
  flex: none;
  margin: 0;
  border: 1px solid var(--muted);
  border-radius: 20px;
  background: var(--paper);
  cursor: pointer;
}
#discount::before {
  display: block;
  width: 15px;
  height: 15px;
  margin: 3px;
  border-radius: 50%;
  background: var(--muted);
  content: "";
}
#discount:checked { background: var(--accent); border-color: var(--accent); }
#discount:checked::before { margin-left: 19px; background: var(--paper); }
.hint { margin-top: 5px; }
.rates { margin-inline: 0; padding-top: 5px; }
.rates legend { padding: 0 8px 0 0; font-weight: 600; }
.rates > div { min-height: 34px; }
.monthly-line { margin-top: 12px; }
#monthly { font-weight: 700; color: var(--accent); margin-left: 6px; }
.warning { color: var(--ink); border-left: 3px solid var(--orange); padding-left: 8px; margin-top: 8px; }
.method { margin: var(--space) 0 36px; }
summary { font-weight: 700; cursor: pointer; }
.method-body { color: var(--muted); }
.method-body h3 { margin-top: 16px; color: var(--ink); }
.method-body p { margin-top: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (min-width: 960px) {
  .tool-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .calculator { grid-template-columns: minmax(0, 1.18fr) minmax(0, 1fr); grid-template-areas: "inputs results"; }
  .inputs { grid-area: inputs; }
  .results { grid-area: results; position: sticky; top: 16px; }
}
@media (forced-colors: active) {
  #discount { appearance: auto; width: auto; height: auto; }
  #discount::before { display: none; }
}
