@import '../site-theme.css';
:root {
  --ink: var(--foreground);
  --line: var(--border);
  --paper: var(--card);
  --wash: var(--secondary);
  --teal: var(--primary);
  --soft: var(--primary-soft);
  --blue: var(--data-blue);
  --orange: var(--accent-strong);
  color: var(--ink);
  background: var(--paper);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  color: var(--text-body);
  font-size: 16px;
}
a {
  color: inherit;
  text-decoration: none;
}
button,
input,
select {
  font: inherit;
}
button,
a,
input,
select,
summary {
  -webkit-tap-highlight-color: transparent;
}
button,
a {
  touch-action: manipulation;
}
button {
  cursor: pointer;
}
a:focus-visible,
button:focus-visible,
summary:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 3px;
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
[hidden] {
  display: none !important;
}
.topbar {
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.bar-inner {
  max-width: var(--lesson-width);
  margin: auto;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px var(--lesson-gutter);
  gap: 12px;
}
.brand {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 750;
  color: var(--foreground);
  font-size: 18px;
  letter-spacing: -0.02em;
}
.top-link {
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--primary);
}
.page {
  max-width: var(--lesson-width);
  margin: auto;
  padding: 24px var(--lesson-gutter) 40px;
}
.lesson-heading {
  padding: 20px;
  border-radius: 12px;
  background: var(--card);
}
.lesson-heading .intro {
  margin-bottom: 0;
  color: var(--text-body);
}
.eyebrow {
  font-size: 13px;
  color: var(--teal);
  margin: 0 0 7px;
  font-weight: 650;
}
h1 {
  color: var(--foreground);
  font-size: var(--lesson-title-size);
  line-height: 1.35;
  letter-spacing: -0.035em;
  margin: 0;
  font-weight: 750;
}
h2 {
  color: var(--foreground);
  font-size: 19px;
  line-height: 1.45;
  margin: 0 0 10px;
  letter-spacing: -0.02em;
}
h3 {
  color: var(--foreground);
  font-size: 16px;
  margin: 0 0 6px;
}
p {
  line-height: 1.75;
  margin: 10px 0;
}
.muted {
  color: var(--muted-foreground);
}
.intro {
  margin-top: 10px;
  color: var(--muted-foreground);
}
.section {
  margin-top: 25px;
  padding-top: 21px;
  border-top: 1px solid var(--line);
}
.section-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted-foreground);
  margin: 0 0 8px;
}
.row-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 17px 0;
  border-bottom: 1px solid var(--line);
}
.row-link strong {
  display: block;
  font-size: 17px;
}
.row-link small {
  display: block;
  color: var(--muted-foreground);
  font-size: 14px;
  margin-top: 5px;
  line-height: 1.5;
}
.arrow {
  font-size: 22px;
  color: var(--teal);
}
.row-link:hover strong {
  color: var(--teal);
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 9px 15px;
  border: 1px solid var(--teal);
  border-radius: 7px;
  background: var(--brand);
  color: var(--brand-foreground);
  font-size: 15px;
  font-weight: 600;
}
.button.secondary {
  background: var(--paper);
  color: var(--teal);
  border-color: var(--line);
}
.text-button {
  background: none;
  border: 0;
  min-height: 44px;
  padding: 4px 7px;
  color: var(--teal);
  font-size: 14px;
}
.quiet-footer {
  font-size: 13px;
  color: var(--muted-foreground);
  margin-top: 30px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.condition {
  padding: 10px 12px;
  margin: 17px 0 14px;
  background: var(--brand-soft);
  font-size: 14px;
  line-height: 1.65;
  border-left: 3px solid var(--brand);
  border-radius: 0 6px 6px 0;
}
.condition small {
  display: block;
  font-size: 13px;
  color: var(--muted-foreground);
}
.formula {
  font-size: 18px;
  font-weight: 650;
  padding: 13px 0;
  color: var(--teal);
}
.example-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin: 15px 0;
}
.example {
  border-top: 3px solid var(--blue);
  padding-top: 10px;
}
.example.b {
  border-color: var(--data-principal);
}
.example p {
  font-size: 14px;
  line-height: 1.7;
  margin: 5px 0;
}
.amount {
  color: var(--result-value);
  font-size: 27px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  margin: 5px 0;
}
.amount small {
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
  margin-left: 3px;
  color: var(--muted-foreground);
}
.takeaway {
  padding: 11px 13px;
  background: var(--soft);
  line-height: 1.65;
  font-size: 15px;
  border-radius: 5px;
}
.tool-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--teal);
  border-radius: 7px;
  padding: 13px 14px;
  margin-top: 16px;
  color: var(--teal);
}
.tool-link strong {
  font-size: 16px;
}
.tool-link small {
  display: block;
  font-size: 13px;
  color: var(--muted-foreground);
  margin-top: 4px;
}
.bullet {
  padding-left: 20px;
  line-height: 1.8;
  margin: 8px 0;
}
.closing {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--line);
  margin-top: 24px;
  padding-top: 16px;
  gap: 12px;
}
.tool-page {
  padding-top: 18px;
}
.tool-heading {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}
.tool-heading h1 {
  font-size: 23px;
}
.tool-heading .text-button {
  white-space: nowrap;
}
.scope {
  font-size: 13px;
  color: var(--muted-foreground);
  line-height: 1.6;
  margin: 7px 0 14px;
}
.inputs {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 10px;
}
.input-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}
.input-wrap {
  position: relative;
}
.input-wrap input,
.input-wrap select {
  width: 100%;
  min-width: 0;
  height: 44px;
  border: 1px solid var(--input);
  border-radius: 6px;
  background: var(--paper);
  padding: 0 26px 0 10px;
  color: var(--ink);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}
.input-wrap select {
  padding-right: 6px;
}
.unit {
  position: absolute;
  right: 9px;
  top: 13px;
  font-size: 13px;
  color: var(--muted-foreground);
  pointer-events: none;
}
.preset-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding-top: 8px;
}
.chip {
  border: 1px solid var(--line);
  border-radius: 5px;
  min-height: 36px;
  padding: 5px 10px;
  background: var(--paper);
  font-size: 13px;
  color: var(--muted-foreground);
}
.chip[aria-pressed='true'] {
  border-color: var(--teal);
  color: var(--brand-foreground);
  background: var(--brand);
}
.error {
  font-size: 14px;
  color: var(--destructive);
  background: var(--destructive-soft);
  padding: 10px;
  border-radius: 5px;
}
.totals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 17px;
}
.total {
  padding: 10px 0 9px;
  border-top: 3px solid var(--blue);
}
.total.b {
  border-color: var(--data-principal);
}
.total-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 650;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue);
  display: inline-block;
}
.dot.b {
  background: var(--data-principal);
}
.total .amount {
  margin: 5px 0 2px;
  font-size: 29px;
}
.total .muted {
  font-size: 12px;
}
.difference {
  font-size: 14px;
  border-radius: 6px;
  background: var(--cost-highlight-surface);
  padding: 9px 10px;
  line-height: 1.6;
}
.difference strong {
  color: var(--teal);
}
.month-control {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  gap: 12px;
}
.month-control strong {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.month-buttons {
  display: flex;
  gap: 5px;
}
.month-buttons .chip {
  min-height: 34px;
  padding: 4px 9px;
}
.slider {
  display: block;
  width: 100%;
  height: 30px;
  accent-color: var(--teal);
  margin: 3px 0 0;
}
.chart-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  font-size: 13px;
}
.chart-title span {
  color: var(--muted-foreground);
  font-size: 12px;
}
.chart {
  height: 94px;
  display: grid;
  gap: 3px;
  align-items: end;
  margin-top: 10px;
  border-bottom: 1px solid var(--line);
}
.bar-pair {
  height: 100%;
  display: flex;
  align-items: end;
  gap: 2px;
  opacity: 0.28;
}
.bar-pair.selected {
  opacity: 1;
}
.bar {
  width: 50%;
  min-height: 1px;
  background: var(--blue);
  border-radius: 2px 2px 0 0;
  transition: height 0.15s;
}
.bar.b {
  background: var(--data-principal);
}
.axis {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted-foreground);
}
.comparison {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-top: 10px;
  table-layout: fixed;
}
.comparison th,
.comparison td {
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  text-align: right;
  font-variant-numeric: tabular-nums;
  vertical-align: middle;
}
.comparison th:first-child {
  width: 35%;
  text-align: left;
  font-size: 13px;
  color: var(--muted-foreground);
  font-weight: 400;
}
.comparison thead th {
  font-size: 13px;
  color: var(--data-blue-strong);
  font-weight: 600;
}
.comparison thead th:last-child {
  color: var(--teal);
}
.comparison td {
  font-weight: 600;
}
.explanation {
  font-size: 14px;
  line-height: 1.7;
  margin: 11px 0;
  background: var(--soft);
  padding: 10px 12px;
  border-radius: 5px;
}
.explanation strong {
  color: var(--teal);
}
details {
  border-top: 1px solid var(--line);
  margin-top: 16px;
}
summary {
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  min-height: 46px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
summary::after {
  content: '＋';
  color: var(--teal);
}
details[open] summary::after {
  content: '−';
}
.schedule-scroll {
  overflow: auto;
  max-height: 360px;
  border: 1px solid var(--line);
  border-radius: 5px;
}
.schedule {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
  white-space: nowrap;
}
.schedule th,
.schedule td {
  padding: 10px;
  text-align: right;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.schedule th {
  background: var(--wash);
  position: sticky;
  top: 0;
}
.schedule th:first-child,
.schedule td:first-child {
  text-align: left;
}
.fineprint {
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted-foreground);
}
.focus-label {
  display: none;
}
.focused .topbar,
.focused .scope,
.focused .detail-area,
.focused .closing {
  display: none;
}
.focused .focus-label {
  display: block;
  margin: 8px 0;
  font-size: 13px;
  color: var(--muted-foreground);
}
.focused .tool-page {
  max-width: 640px;
  padding-top: 12px;
}
.focused .chart {
  height: 145px;
}
.focused .totals {
  margin-top: 10px;
}
.focused .tool-heading h1 {
  font-size: 21px;
}
@media (min-width: 760px) {
  body {
    background: var(--background);
  }
  .topbar {
    background: var(--paper);
  }
  .page {
    background: var(--paper);
    min-height: calc(100dvh - 65px);
    padding: 32px var(--lesson-gutter) 50px;
  }
  .tool-page {
    padding-top: 24px;
  }
  .home-page {
    padding-top: 40px;
  }
  h1 {
    font-size: 32px;
  }
  .tool-heading h1 {
    font-size: 26px;
  }
  .chart {
    height: 112px;
  }
  .tool-page .comparison th,
  .tool-page .comparison td {
    padding: 11px 0;
  }
}
@media (max-width: 360px) {
  .page {
    padding-left: 16px;
    padding-right: 16px;
  }
  .bar-inner {
    padding-left: 16px;
    padding-right: 16px;
  }
  h1 {
    font-size: 25px;
  }
  .inputs {
    gap: 7px;
  }
  .tool-heading h1 {
    font-size: 21px;
  }
  .total .amount {
    font-size: 26px;
  }
  .preset-row {
    gap: 5px;
  }
  .chip {
    padding-left: 8px;
    padding-right: 8px;
  }
}
.input-wrap {
  display: block;
}
.example > p:first-of-type {
  min-height: 48px;
}
/* 独立还款工具：输入与核心结果优先，明细自然向下阅读。 */
.tool-page {
  padding-top: 10px;
  font-size: 16px;
}
.tool-page .input-area {
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--tool-surface);
}
.tool-page .inputs {
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.85fr) minmax(0, 1fr);
  gap: 8px;
}
.tool-page .inputs > label {
  min-width: 0;
}
.tool-page .input-label,
.tool-page .unit,
.tool-page .text-button,
.tool-page .chip,
.tool-page .total-name,
.tool-page .total .muted,
.tool-page .difference,
.tool-page summary,
.tool-page .fineprint,
.tool-page .explanation,
.tool-page .comparison,
.tool-page .comparison th,
.tool-page .schedule {
  font-size: 16px;
}
.tool-page .amount small,
.tool-page .month-control strong,
.tool-page .chart-title,
.tool-page .chart-title span,
.tool-page .axis,
.tool-page .error,
.tool-page .top-link {
  font-size: 16px;
}
.tool-page .input-label {
  margin-bottom: 4px;
}
.tool-page .unit {
  top: 10px;
}
.tool-page .preset-row {
  gap: 6px;
  padding-top: 4px;
}
.tool-page .chip {
  min-height: 44px;
  padding: 5px 8px;
}
.tool-page .totals {
  margin-top: 8px;
  gap: 12px;
}
.tool-page .total {
  min-width: 0;
  padding: 7px 0;
}
.tool-page .total .amount {
  overflow-wrap: anywhere;
}
.tool-page .difference {
  padding: 7px 10px;
}
.tool-page .month-control {
  gap: 6px;
}
.tool-page .month-buttons {
  gap: 4px;
}
.tool-page .month-buttons .chip {
  padding: 4px 6px;
}
.tool-page .slider {
  height: 44px;
}
.tool-page .comparison td {
  overflow-wrap: anywhere;
}
.focused .tool-page .input-area,
.focused .tool-page .detail-area {
  display: block;
}
.focused .tool-page .focus-label {
  display: none;
}
.focused .tool-page .chart {
  height: 94px;
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
