:root {
  color-scheme: light;
  --page: #fafafa;
  --surface: #ffffff;
  --surface-alt: #f5f5f5;
  --ink: #1a1a1a;
  --muted: #6b6b6b;
  --subtle: #9e9e9e;
  --line: #e5e5e5;
  --line-strong: #d0d0d0;
  --accent: #3b6fb6;
  --accent-contrast: #ffffff;
  --accent-soft: #eef3fa;
  --mint: #2d8a6e;
  --teal: #2d8a6e;
  --blue: #3b6fb6;
  --green: #2d8a6e;
  --copper: #b08030;
  --red: #c45050;
  --topbar: rgb(250 250 250 / 94%);
  --shadow: 0 1px 3px rgb(0 0 0 / 4%);
  --sans: Inter, "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", "Noto Serif SC", "Source Han Serif SC", "Songti SC", Georgia, serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

html[data-theme="slate"] {
  color-scheme: light;
  --page: #f2f2f0;
  --surface: #ffffff;
  --surface-alt: #ececea;
  --ink: #1d1d1d;
  --muted: #5c5c5c;
  --subtle: #8f8f8f;
  --line: #dfdfdc;
  --line-strong: #c2c2be;
  --accent: #4a5a6a;
  --accent-contrast: #ffffff;
  --accent-soft: #eef1f4;
  --mint: #2d7a6a;
  --teal: #2d7a6a;
  --blue: #4a5a6a;
  --green: #456f54;
  --copper: #a08040;
  --red: #b04a44;
  --topbar: rgb(242 242 240 / 94%);
  --shadow: 0 1px 3px rgb(0 0 0 / 4%);
}

html[data-theme="night"] {
  color-scheme: dark;
  --page: #121212;
  --surface: #1a1a1a;
  --surface-alt: #222222;
  --ink: #f2f2f2;
  --muted: #a0a0a0;
  --subtle: #868686;
  --line: #333333;
  --line-strong: #474747;
  --accent: #8fa9d8;
  --accent-contrast: #121212;
  --accent-soft: #2a3240;
  --mint: #5bbfa8;
  --teal: #5bbfa8;
  --blue: #8fa9d8;
  --green: #5bbfa8;
  --copper: #d4a94e;
  --red: #e0706a;
  --topbar: rgb(18 18 18 / 92%);
  --shadow: 0 2px 6px rgb(0 0 0 / 16%);
}

* {
  box-sizing: border-box;
}

html {
  font-size: 17px;
  scroll-behavior: smooth;
  scroll-padding-top: 90px;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--page);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--accent-soft);
  color: var(--ink);
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

img,
canvas {
  max-width: 100%;
}

p,
h1,
h2,
h3,
h4 {
  margin-top: 0;
}

h1,
h2,
h3,
h4 {
  color: var(--ink);
  line-height: 1.18;
}

p:last-child {
  margin-bottom: 0;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.site-shell {
  width: min(calc(100% - 48px), 1120px);
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  border-bottom: 1px solid var(--line);
  background: var(--topbar);
  backdrop-filter: blur(16px);
}

.topbar-inner {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) auto auto;
  align-items: center;
  min-height: 60px;
  gap: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  gap: 10px;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.brand small {
  display: block;
  margin-top: 1px;
  color: var(--subtle);
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 24px;
  white-space: nowrap;
}

.nav-links a {
  border-bottom: 1px solid transparent;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 550;
  text-decoration: none;
}

.nav-links a:hover,
.nav-links a:focus-visible {
  border-bottom-color: var(--line-strong);
  color: var(--ink);
}

.back-link::before {
  content: "←";
  margin-right: 0.4em;
}

.theme-switch {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.theme-switch button {
  min-width: 34px;
  height: 29px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.78rem;
  line-height: 1;
}

.theme-switch button[aria-pressed="true"] {
  border-radius: 7px;
  background: var(--ink);
  color: var(--page);
}

.eyebrow,
.section-index,
.project-meta,
.heading-en,
.title-en,
.inline-en,
.group-title {
  font-family: var(--mono);
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

/* Home */

.home-intro {
  padding: clamp(76px, 10vw, 122px) 0 clamp(68px, 9vw, 104px);
}

.personal-intro {
  display: block;
}

.intro-kicker {
  margin-bottom: 18px;
  color: var(--subtle);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.home-intro h1 {
  max-width: 880px;
  margin-bottom: 26px;
  font-family: var(--sans);
  font-size: clamp(2.6rem, 5.5vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.045em;
}

.intro-lead {
  max-width: 660px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(1.1rem, 2vw, 1.28rem);
  line-height: 1.8;
}

.directory-block,
.method-block,
.roadmap-block,
.about-block {
  padding: clamp(64px, 8vw, 96px) 0;
  border-top: 1px solid var(--line);
}

.home-section-head {
  margin-bottom: 38px;
}

.home-section-head h2,
.about-layout > h2 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.045em;
}

.home-section-head p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.section-head {
  display: grid;
  grid-template-columns: minmax(240px, 0.82fr) minmax(320px, 1fr);
  gap: clamp(40px, 7vw, 96px);
  align-items: end;
  margin-bottom: 44px;
}

.section-index {
  margin-bottom: 12px;
  color: var(--accent);
  font-size: 0.64rem;
}

.section-head h2,
.method-intro h2 {
  margin-bottom: 0;
  font-family: var(--sans);
  font-size: clamp(2rem, 4vw, 3.1rem);
  font-weight: 700;
  letter-spacing: -0.045em;
}

.section-head > p,
.method-intro > p:last-child {
  max-width: 640px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.8;
}

.project-grid {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.project-card {
  min-width: 0;
}

.tool-card-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 26px 24px 22px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 140ms ease, background 140ms ease;
}

.tool-card-link:hover {
  border-color: #c0c0c0;
  background: var(--surface-alt);
}

.project-meta {
  margin: 0 0 14px;
  color: var(--subtle);
  font-family: var(--mono);
  font-size: 0.73rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.project-grid {
  counter-reset: project;
}

.project-card {
  counter-increment: project;
}

.project-card .project-meta::before {
  content: counter(project, decimal-leading-zero);
  margin-right: 0.9em;
  color: #c2c2c2;
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
}

.project-copy {
  flex: 1 0 auto;
}

.project-card h3 {
  margin-bottom: 8px;
  font-family: var(--sans);
  font-size: 1.18rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.project-description {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.7;
}

.project-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
}

.project-action span {
  font-size: 1rem;
  transition: transform 140ms ease;
}

.tool-card-link:hover .project-action {
  color: var(--ink);
}

.tool-card-link:hover .project-action span {
  transform: translateX(3px);
}

.method-block {
  background: var(--surface);
}

.method-layout {
  display: grid;
  grid-template-columns: minmax(250px, 0.76fr) minmax(420px, 1.24fr);
  gap: clamp(48px, 9vw, 120px);
  align-items: start;
}

.method-intro {
  position: sticky;
  top: 112px;
}

.method-intro h2 {
  margin-bottom: 22px;
}

.principle-list {
  border-top: 1px solid var(--line-strong);
}

.principle-list li {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 18px;
  padding: 24px 0 25px;
  border-bottom: 1px solid var(--line);
}

.principle-list li > span,
.roadmap-list li > span {
  color: var(--subtle);
  font-family: var(--mono);
  font-size: 0.64rem;
}

.principle-list h3,
.roadmap-list h3 {
  margin-bottom: 8px;
  font-size: 1.12rem;
  font-weight: 650;
}

.principle-list p,
.roadmap-list p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.75;
}

.roadmap-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line-strong);
}

.roadmap-list li {
  min-height: 164px;
  padding: 26px 34px 28px 0;
  border-bottom: 1px solid var(--line);
}

.roadmap-list li:nth-child(odd) {
  padding-right: 40px;
  border-right: 1px solid var(--line);
}

.roadmap-list li:nth-child(even) {
  padding-left: 40px;
}

.roadmap-list li > span {
  display: block;
  margin-bottom: 32px;
}

.roadmap-list small {
  display: block;
  margin-top: 20px;
  color: var(--subtle);
  font-family: var(--mono);
  font-size: 0.61rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.about-block {
  background: var(--surface);
}

.about-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.72fr) minmax(0, 1.28fr);
  gap: clamp(40px, 8vw, 104px);
  align-items: start;
}

.about-layout > h2 {
  margin-bottom: 0;
}

.about-copy {
  max-width: 700px;
}

.about-copy p {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.85;
}

.simple-footer {
  margin-top: 0;
}

/* Interactive tools */

:where(.tool-hero, .tool-layout, .math-section) {
  width: min(calc(100% - 48px), 1120px);
  margin-inline: auto;
}

main.site-shell > :where(.tool-hero, .tool-layout, .math-section) {
  width: 100%;
}

.tool-hero {
  padding: clamp(56px, 7vw, 84px) 0 42px;
  border-bottom: 1px solid var(--line);
}

.tool-hero .eyebrow {
  margin-bottom: 15px;
  color: var(--accent);
  font-size: 0.64rem;
}

.tool-hero h1 {
  max-width: 870px;
  margin-bottom: 21px;
  font-family: var(--sans);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.04em;
}

.title-en {
  display: block;
  margin-top: 13px;
  color: var(--subtle);
  font-size: 0.66rem;
  line-height: 1.5;
}

.lead {
  max-width: 800px;
  margin-bottom: 27px;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.85;
}

.tool-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-top: 4px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.tool-summary span {
  padding: 10px 22px 10px 0;
  color: var(--subtle);
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.02em;
}

.tool-summary span + span::before {
  content: "/";
  margin-right: 22px;
  color: var(--line-strong);
}

.tool-layout {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  margin-top: 30px;
  margin-bottom: clamp(70px, 9vw, 110px);
}

.tool-layout.wide-controls {
  grid-template-columns: minmax(340px, 410px) minmax(0, 1fr);
}

.tool-layout > aside.panel {
  position: sticky;
  top: 92px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-header h2,
.panel-header h3 {
  margin: 0;
  font-size: 1.06rem;
  font-weight: 650;
}

.heading-en {
  margin-left: 0.35em;
  color: var(--subtle);
  font-size: 0.64rem;
}

.panel-body {
  padding: 20px 18px;
}

.control-stack {
  display: grid;
  gap: 22px;
}

.control-row {
  min-width: 0;
}

.label-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 11px;
  color: var(--muted);
  font-size: 0.88rem;
}

.value-pill {
  min-width: 58px;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--page);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.76rem;
  text-align: right;
}

input[type="range"] {
  width: 100%;
  height: 20px;
  margin: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  accent-color: var(--accent);
  -webkit-appearance: none;
  appearance: none;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 3px;
  background: var(--line-strong);
}

input[type="range"]::-webkit-slider-thumb {
  width: 15px;
  height: 15px;
  margin-top: -6px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
  -webkit-appearance: none;
}

input[type="range"]::-moz-range-track {
  height: 3px;
  background: var(--line-strong);
}

input[type="range"]::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--accent);
}

.preset-row,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border: 1px solid var(--accent);
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-contrast);
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
}

.btn:hover:not(:disabled) {
  filter: brightness(0.94);
}

.btn.secondary {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--ink);
}

.btn.secondary:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
  filter: none;
}

.btn:disabled {
  border-color: var(--line);
  background: var(--surface-alt);
  color: var(--subtle);
  cursor: not-allowed;
  opacity: 1;
}

.notice {
  padding: 12px 14px;
  border-left: 2px solid var(--accent);
  background: var(--accent-soft);
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.65;
}

.notice.error {
  border-left-color: var(--red);
  color: var(--ink);
}

.group-title {
  margin: 24px 0 9px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line);
  color: var(--accent);
  font-size: 0.66rem;
}

.group-title:first-child {
  margin-top: 0;
}

.field-row {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) 92px 52px;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  border-bottom: 1px solid var(--line);
}

.field-row label {
  color: var(--muted);
  font-size: 0.85rem;
}

.field-row label small {
  display: block;
  color: var(--subtle);
  font-family: var(--mono);
  font-size: 0.64rem;
  line-height: 1.25;
}

.field-row input[type="number"] {
  width: 100%;
  height: 31px;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--page);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.78rem;
  text-align: right;
}

.unit {
  overflow: hidden;
  color: var(--subtle);
  font-family: var(--mono);
  font-size: 0.68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
}

.tab {
  min-height: 34px;
  padding: 6px 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.78rem;
}

.tab.active,
.tab[aria-selected="true"] {
  background: var(--ink);
  color: var(--page);
}

.chart-panel {
  overflow: hidden;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.metric {
  min-width: 0;
  padding: 17px 18px 18px;
}

.metric + .metric {
  border-left: 1px solid var(--line);
}

.metric-label {
  min-height: 2.8em;
  margin-bottom: 10px;
  color: var(--subtle);
  font-family: var(--mono);
  font-size: 0.65rem;
  line-height: 1.4;
  text-transform: uppercase;
}

.metric-value {
  overflow-wrap: anywhere;
  font-family: var(--mono);
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  font-weight: 600;
  line-height: 1.3;
}

.chart-stack {
  display: grid;
  gap: 0;
}

.subchart {
  min-width: 0;
  padding: 20px 18px 22px;
}

.subchart + .subchart {
  border-top: 1px solid var(--line);
}

.subchart-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.subchart-head h3 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 650;
}

.chart-axis-note {
  margin: 4px 0 12px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.55;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 18px;
  margin-bottom: 12px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--subtle);
  font-family: var(--mono);
  font-size: 0.64rem;
}

.swatch,
.band-swatch {
  display: inline-block;
  flex: 0 0 auto;
  width: 15px;
  height: 2px;
  background: var(--blue);
}

.swatch.dash,
.dash {
  height: 0;
  border-top: 2px dashed var(--green);
  background: transparent;
}

.band-swatch {
  height: 7px;
  background: var(--accent-soft);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--blue);
}

.canvas-wrap {
  overflow: hidden;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}

.canvas-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
}

@media (min-width: 901px) {
  .simulator-page .tool-hero {
    display: none;
  }

  .adrc-page .adrc-chart-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .adrc-page .adrc-chart-stack > .subchart:first-child {
    grid-column: 1 / -1;
  }

  .adrc-page .adrc-chart-stack > .subchart:nth-child(3) {
    border-left: 1px solid var(--line);
  }

  .adrc-page .panel-body {
    padding: 16px 18px;
  }

  .adrc-page .control-stack {
    gap: 14px;
  }

  .adrc-page .label-line {
    margin-bottom: 6px;
  }

  .adrc-page .metric {
    padding: 13px 16px 14px;
  }

  .adrc-page .metric-label {
    min-height: 2.4em;
    margin-bottom: 6px;
  }

  .adrc-page .subchart {
    padding: 12px 14px 14px;
  }

  .adrc-page .subchart-head {
    margin-bottom: 5px;
  }

  .adrc-page .legend {
    margin-bottom: 7px;
  }
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.result-tile {
  min-width: 0;
  min-height: 116px;
  padding: 15px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.result-tile span,
.result-tile small {
  display: block;
  color: var(--subtle);
  font-family: var(--mono);
  font-size: 0.64rem;
  line-height: 1.45;
}

.result-tile strong {
  display: block;
  margin: 8px 0 5px;
  overflow-wrap: anywhere;
  font-family: var(--mono);
  font-size: 1.2rem;
  line-height: 1.25;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.data-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.data-table td:nth-child(n + 2) {
  font-family: var(--mono);
  text-align: right;
}

.math-section {
  padding: 0 0 clamp(80px, 10vw, 130px);
}

.math-section > .section-head {
  margin-bottom: 0;
  padding: 0 0 28px;
  border-bottom: 1px solid var(--line-strong);
}

.math-section > .section-head h2 {
  font-family: var(--sans);
  font-size: clamp(1.9rem, 3.5vw, 2.8rem);
  font-weight: 700;
  letter-spacing: -0.04em;
}

.math-card {
  padding: 32px 0 36px;
  border-bottom: 1px solid var(--line);
}

.math-card h3 {
  margin-bottom: 16px;
  font-family: var(--sans);
  font-size: 1.5rem;
  font-weight: 680;
  letter-spacing: -0.025em;
}

.math-card h4 {
  margin-bottom: 8px;
  font-size: 0.92rem;
}

.math-card p,
.math-card li {
  max-width: 900px;
  color: var(--muted);
  font-size: 0.97rem;
  line-height: 1.85;
}

.math-card ul,
.math-card ol {
  margin-bottom: 0;
  padding-left: 1.3em;
}

.math-card li + li {
  margin-top: 8px;
}

code {
  padding: 0.1em 0.3em;
  background: var(--surface-alt);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.92em;
}

.math-block {
  overflow-x: auto;
  margin: 22px 0;
  padding: 20px 22px;
  border-left: 2px solid var(--accent);
  border-radius: 0 8px 8px 0;
  background: var(--surface);
  color: var(--ink);
  -webkit-overflow-scrolling: touch;
}

.math-block .katex-display {
  margin: 0;
}

.learning-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 22px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.learning-note {
  min-width: 0;
  padding: 20px 22px 21px 0;
}

.learning-note + .learning-note {
  padding-left: 22px;
  border-left: 1px solid var(--line);
}

.learning-note p {
  margin-bottom: 0;
  font-size: 0.88rem;
}

.motor-gateway {
  display: grid;
  width: min(calc(100% - 48px), 1120px);
  margin: 30px auto clamp(70px, 9vw, 110px);
  gap: 24px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.launch-status {
  display: inline-flex;
  min-height: 27px;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line));
  border-radius: 6px;
  background: var(--accent-soft);
  padding: 0 8px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.59rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.launch-intro {
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 0.93rem;
}

.launch-steps {
  margin: 0 0 22px;
  padding: 0;
  border-top: 1px solid var(--line);
  list-style: none;
}

.launch-steps li {
  display: grid;
  grid-template-columns: 35px 1fr;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.launch-steps li > span {
  padding-top: 2px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.61rem;
}

.launch-steps p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.7;
}

.launch-actions {
  margin-bottom: 15px;
}

.capability-list {
  display: grid;
  gap: 0;
}

.capability-list > div {
  display: grid;
  grid-template-columns: 50px 1fr;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.capability-list > div:first-child {
  padding-top: 0;
}

.capability-list > div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.capability-list > div > span {
  display: grid;
  width: 42px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-alt);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.58rem;
  font-weight: 700;
}

.capability-list p {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.55;
}

.capability-list strong {
  display: block;
  margin-bottom: 3px;
  color: var(--ink);
  font-size: 0.9rem;
}

.motor-safety-block {
  padding: clamp(64px, 8vw, 96px) 0;
  border-top: 1px solid var(--line);
  background: var(--surface-alt);
}

.safety-rules {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.safety-rules p {
  margin: 0;
  padding: 22px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.65;
}

.safety-rules p + p {
  border-left: 1px solid var(--line);
}

.safety-rules span,
.safety-rules strong {
  display: block;
}

.safety-rules span {
  margin-bottom: 20px;
  color: var(--red);
  font-family: var(--mono);
  font-size: 0.62rem;
}

.safety-rules strong {
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 0.95rem;
}

.footer {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
  align-items: start;
  padding-top: 26px;
  padding-bottom: 34px;
  border-top: 1px solid var(--line);
  color: var(--subtle);
  font-family: var(--mono);
  font-size: 0.68rem;
  line-height: 1.7;
}

.footer p {
  margin: 0;
}

.footer p:nth-child(2) {
  text-align: center;
}

.footer p:last-child {
  text-align: right;
}

.footer strong {
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.85rem;
}

.footer a:hover {
  color: var(--ink);
}

@media (max-width: 900px) {
  .topbar-inner {
    grid-template-columns: 1fr auto;
    gap: 0 18px;
    padding: 11px 0 10px;
  }

  .nav-links {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    gap: 20px;
    margin-top: 9px;
    padding-top: 8px;
    border-top: 1px solid var(--line);
  }

  .theme-switch {
    grid-column: 2;
    grid-row: 1;
  }

  .section-head,
  .method-layout,
  .intro-layout,
  .about-layout {
    grid-template-columns: 1fr;
    gap: 26px;
  }

  .intro-summary {
    max-width: 540px;
  }

  .method-intro {
    position: static;
  }

  .tool-card-link {
    padding: 24px 22px 20px;
  }

  .project-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tool-layout,
  .tool-layout.wide-controls {
    grid-template-columns: 1fr;
  }

  .motor-gateway {
    grid-template-columns: 1fr;
  }

  .tool-layout > aside.panel {
    position: static;
  }

  .learning-grid {
    grid-template-columns: 1fr;
  }

  .learning-note {
    padding: 18px 0;
  }

  .learning-note + .learning-note {
    padding-left: 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

@media (max-width: 640px) {
  .site-shell,
  :where(.tool-hero, .tool-layout, .math-section) {
    width: min(calc(100% - 32px), 1120px);
  }

  .topbar-inner {
    width: calc(100% - 32px);
  }

  .brand {
    font-size: 0.82rem;
  }

  .brand small {
    font-size: 0.54rem;
  }

  .nav-links {
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .nav-links a {
    font-size: 0.72rem;
  }

  .theme-switch button {
    min-width: 31px;
    padding-inline: 6px;
  }

  .home-intro {
    padding: 66px 0 62px;
  }

  .home-intro h1 {
    margin-bottom: 22px;
    font-size: clamp(2.9rem, 15vw, 4.2rem);
  }

  .directory-block,
  .method-block,
  .roadmap-block,
  .about-block {
    padding: 56px 0;
  }

  .section-head {
    margin-bottom: 30px;
  }

  .tool-card-link {
    padding: 22px 20px 20px;
  }

  .project-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .roadmap-list {
    grid-template-columns: 1fr;
  }

  .roadmap-list li,
  .roadmap-list li:nth-child(odd),
  .roadmap-list li:nth-child(even) {
    min-height: 0;
    padding: 24px 0 26px;
    border-right: 0;
  }

  .roadmap-list li > span {
    margin-bottom: 18px;
  }

  .tool-hero {
    padding: 46px 0 32px;
  }

  .tool-hero h1 {
    font-size: clamp(2.25rem, 12vw, 3.2rem);
  }

  .tool-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .tool-summary span {
    padding: 8px 10px 8px 0;
    border-bottom: 1px solid var(--line);
  }

  .tool-summary span + span::before {
    display: none;
  }

  .tool-layout {
    width: calc(100% - 32px);
    gap: 16px;
    margin-top: 18px;
    margin-bottom: 64px;
  }

  .motor-gateway {
    width: calc(100% - 32px);
    gap: 16px;
    margin-top: 18px;
    margin-bottom: 64px;
  }

  .safety-rules {
    grid-template-columns: 1fr;
  }

  .safety-rules p + p {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .panel-header {
    flex-wrap: wrap;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .metric + .metric {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .metric-label {
    min-height: 0;
    margin-bottom: 6px;
  }

  .subchart {
    padding: 17px 12px 18px;
  }

  .results-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .field-row {
    grid-template-columns: minmax(90px, 1fr) 82px 44px;
  }

  .math-section > .section-head {
    padding-bottom: 22px;
  }

  .math-card {
    padding: 27px 0 30px;
  }

  .math-block {
    margin: 18px 0;
    padding: 17px 14px;
  }

  .math-block .katex {
    font-size: 0.92em;
  }

  .footer {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .footer p:nth-child(2),
  .footer p:last-child {
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
