:root {
  --bg: #101214;
  --panel: #181b1f;
  --panel-2: #20242a;
  --inset: #12161b;
  --line: #343a43;
  --text: #f1f2f2;
  --muted: #aab1ba;
  --orange: #f59e0a;
  --orange-2: #ffbf4d;
  --orange-soft: rgba(245, 158, 10, .15);
  --green: #73d89a;
  --red: #ff7a7a;
  --blue: #84bfff;
  --shadow: 0 18px 50px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }

html {
  color-scheme: dark;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: inherit; text-decoration: none; }

button, input, select { font: inherit; }

header {
  border-bottom: 1px solid var(--line);
  background: rgba(16, 18, 20, .94);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(14px);
}

.topbar {
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  width: 174px;
  height: 58px;
  flex: 0 0 auto;
}

.brand img { display: block; width: 100%; height: auto; }

nav {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

nav a:hover { color: var(--text); }
nav a.active { color: var(--orange-2); }

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 34px 24px 56px;
}

.page-head { margin-bottom: 26px; }

.crumb {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 14px;
}

.crumb a { color: var(--orange-2); }
.crumb a:hover { text-decoration: underline; text-underline-offset: 3px; }

h1 {
  margin: 0;
  max-width: 820px;
  font-size: clamp(34px, 5.4vw, 62px);
  line-height: .96;
  font-weight: 720;
}

.lede {
  margin: 16px 0 0;
  max-width: 700px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.55;
}

.tool-grid {
  display: grid;
  grid-template-columns: 400px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.panel h2 {
  margin: 0 0 4px;
  font-size: 19px;
  line-height: 1.2;
}

.panel .sub {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.field-stack { display: grid; gap: 12px; }

.field-row { display: grid; gap: 6px; }

.field-row label {
  color: var(--muted);
  font-size: 13px;
}

.field-row input,
.field-row select {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  background: var(--inset);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
}

.field-row input:focus-visible,
.field-row select:focus-visible,
.button:focus-visible,
.seg button:focus-visible,
nav a:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

.field-row input[type="number"] {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

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

.seg {
  display: flex;
  gap: 6px;
  background: var(--inset);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
}

.seg button {
  flex: 1;
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

.seg button.on {
  background: var(--orange);
  color: #1b1303;
}

.result-list { display: grid; gap: 10px; }

.result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 13px 14px;
  background: var(--inset);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.result span { color: var(--muted); font-size: 13px; }

.result strong {
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.result.hero-result { border-color: rgba(245, 158, 10, .5); }
.result.hero-result strong { color: var(--orange-2); font-size: 20px; }

.result strong.good { color: var(--green); }
.result strong.bad { color: var(--red); }

.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }

.data-table th,
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.data-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.data-table td.num,
.data-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.data-table tr.hit td {
  background: var(--orange-soft);
  color: var(--orange-2);
  font-weight: 600;
}

.note {
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--inset);
  font-size: 13px;
  line-height: 1.5;
}

.note strong { color: var(--text); }

.note a {
  color: var(--orange-2);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.diagram-box {
  background: var(--inset);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 16px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--panel-2);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}

.button.primary {
  background: var(--orange);
  border-color: var(--orange);
  color: #1b1303;
}

footer {
  border-top: 1px solid var(--line);
  margin-top: 20px;
}

.footbar {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 24px 30px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

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

@media (max-width: 680px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  nav { width: 100%; overflow-x: auto; padding-bottom: 2px; }
  main { padding: 26px 16px 44px; }
  .brand { width: 150px; height: 50px; }
  .pair, .trio { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
