:root {
  color-scheme: dark;
  --bg: #06101f;
  --surface: #0b1a2e;
  --surface-raised: #10233b;
  --border: #27405d;
  --border-strong: #567596;
  --text: #f4f7fb;
  --muted: #aebdd0;
  --muted-strong: #ccd6e3;
  --accent: #ff8a35;
  --accent-strong: #ff9f5b;
  --accent-ink: #201006;
  --focus: #79c8ff;
  --success: #63d6b2;
  --warning: #ffd166;
  --danger: #ff8e8e;
  --max-width: 1180px;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

a {
  color: inherit;
  text-underline-offset: 0.22em;
  text-decoration-thickness: 1px;
}

a:hover {
  color: var(--accent-strong);
}

button,
input {
  font: inherit;
}

button,
a,
input {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 10;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  background: var(--text);
  color: var(--bg);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header,
main,
footer {
  width: min(calc(100% - 40px), var(--max-width));
  margin-inline: auto;
}

.site-header {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-size: 0.96rem;
  font-weight: 750;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand small {
  display: block;
  margin-top: -3px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--accent);
  color: var(--accent-strong);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}

nav {
  display: flex;
  gap: 28px;
}

nav a {
  color: var(--muted-strong);
  font-size: 0.9rem;
  font-weight: 650;
  text-decoration: none;
}

.hero {
  min-height: 440px;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.7fr);
  gap: clamp(42px, 8vw, 96px);
  align-items: end;
  padding: 88px 0 76px;
}

.eyebrow,
.section-label {
  margin: 0 0 14px;
  color: var(--accent-strong);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 840px;
  margin-bottom: 24px;
  font-size: clamp(2.65rem, 6.6vw, 5.6rem);
  line-height: 0.97;
  letter-spacing: -0.055em;
}

.lede {
  max-width: 710px;
  margin-bottom: 0;
  color: var(--muted-strong);
  font-size: clamp(1.05rem, 1.8vw, 1.3rem);
}

.hero-proof {
  margin: 0;
  border-top: 1px solid var(--border-strong);
}

.hero-proof div {
  display: grid;
  grid-template-columns: 92px 1fr;
  align-items: baseline;
  gap: 18px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}

.hero-proof dt {
  color: var(--text);
  font-size: 1.6rem;
  font-weight: 760;
  letter-spacing: -0.03em;
}

.hero-proof dd {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.calculator-shell {
  margin-bottom: 96px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.calculator-heading {
  max-width: 760px;
  padding: clamp(28px, 5vw, 54px);
  border-bottom: 1px solid var(--border);
}

.calculator-heading h2,
.method h2,
.notes h2 {
  margin-bottom: 14px;
  font-size: clamp(1.9rem, 3.6vw, 3rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.calculator-heading > p:last-child,
.method-intro > p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

.calculator-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.16fr) minmax(330px, 0.84fr);
}

.factor-panel {
  padding: clamp(24px, 4vw, 48px);
}

.factor {
  padding: 22px 0 26px;
  border-bottom: 1px solid var(--border);
}

.factor:first-child {
  padding-top: 0;
}

.factor:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.factor-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.factor label {
  font-size: 1rem;
  font-weight: 750;
}

.factor output {
  min-width: 42px;
  color: var(--accent-strong);
  font-size: 1.2rem;
  font-weight: 800;
  text-align: right;
}

.factor p {
  margin: 4px 0 16px;
  color: var(--muted);
  font-size: 0.87rem;
}

input[type="range"] {
  width: 100%;
  height: 44px;
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  background: var(--border-strong);
}

input[type="range"]::-webkit-slider-thumb {
  width: 20px;
  height: 20px;
  margin-top: -8px;
  appearance: none;
  border: 3px solid var(--surface);
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

input[type="range"]::-moz-range-track {
  height: 4px;
  background: var(--border-strong);
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 3px solid var(--surface);
  border-radius: 0;
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.scale {
  display: flex;
  justify-content: space-between;
  margin-top: -10px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.result-panel {
  padding: clamp(28px, 4vw, 48px);
  border-left: 1px solid var(--border);
  background: var(--surface-raised);
}

.score-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 8px 0 16px;
}

.score-row strong {
  font-size: clamp(4.5rem, 9vw, 7.6rem);
  font-variant-numeric: tabular-nums;
  font-weight: 780;
  letter-spacing: -0.07em;
  line-height: 0.9;
}

.score-row span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  text-transform: uppercase;
}

.priority-label {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  padding: 7px 12px;
  border: 1px solid currentColor;
  color: var(--warning);
}

.priority-label[data-priority="p0"] {
  color: var(--success);
}

.priority-label[data-priority="p2"] {
  color: var(--accent-strong);
}

.priority-label[data-priority="p3"] {
  color: var(--danger);
}

.priority-label span {
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.09em;
}

.priority-label strong {
  font-size: 0.92rem;
}

.result-summary {
  min-height: 78px;
  margin: 22px 0 28px;
  color: var(--muted-strong);
}

.formula-box {
  padding: 18px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.formula-box h3 {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.formula-box p {
  margin-bottom: 0;
  overflow-wrap: anywhere;
  color: var(--muted-strong);
  font-size: 0.82rem;
}

.formula-box .formula-note {
  margin-top: 10px;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.76rem;
}

code {
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

.breakdown {
  margin: 26px 0;
}

.breakdown div {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 8px 0;
  border-bottom: 1px dotted var(--border-strong);
}

.breakdown dt {
  color: var(--muted);
  font-size: 0.83rem;
}

.breakdown dd {
  margin: 0;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

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

button {
  min-height: 48px;
  border: 1px solid var(--accent);
  padding: 11px 16px;
  font-weight: 760;
  cursor: pointer;
}

.primary-button {
  background: var(--accent);
  color: var(--accent-ink);
}

.primary-button:hover {
  background: var(--accent-strong);
}

.secondary-button {
  background: transparent;
  color: var(--text);
}

.secondary-button:hover {
  border-color: var(--accent-strong);
  color: var(--accent-strong);
}

.action-status {
  min-height: 24px;
  margin: 10px 0 0;
  color: var(--success);
  font-size: 0.8rem;
}

.method {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.2fr);
  gap: clamp(50px, 8vw, 110px);
  padding: 70px 0 92px;
  border-top: 1px solid var(--border);
}

.method-steps {
  margin: 0;
  padding: 0;
  list-style: none;
}

.method-steps li {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 18px;
  padding: 24px 0;
  border-top: 1px solid var(--border);
}

.method-steps li:last-child {
  border-bottom: 1px solid var(--border);
}

.method-steps > li > span {
  color: var(--accent-strong);
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 0.82rem;
  font-weight: 750;
}

.method-steps h3 {
  margin-bottom: 5px;
  font-size: 1.06rem;
}

.method-steps p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.notes {
  margin-bottom: 96px;
  padding: clamp(28px, 5vw, 54px);
  border: 1px solid var(--border);
}

.band-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 34px 0 28px;
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}

.band-list p {
  min-height: 118px;
  margin: 0;
  padding: 20px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.band-list strong,
.band-list span {
  display: block;
}

.band-list strong {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.03em;
}

.band-list span {
  font-weight: 760;
}

.limitation {
  max-width: 870px;
  margin-bottom: 0;
  color: var(--muted-strong);
}

footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  min-height: 120px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
}

footer p {
  margin-bottom: 0;
}

footer div {
  display: flex;
  gap: 22px;
}

noscript {
  display: block;
  padding: 16px;
  background: var(--danger);
  color: #180606;
  text-align: center;
  font-weight: 800;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f5f7fa;
    --surface: #ffffff;
    --surface-raised: #edf2f7;
    --border: #c7d1dd;
    --border-strong: #6f849b;
    --text: #0c1b2d;
    --muted: #52647a;
    --muted-strong: #31465e;
    --accent: #c74f0d;
    --accent-strong: #a43b05;
    --accent-ink: #ffffff;
    --focus: #0065a8;
    --success: #087b5c;
    --warning: #8a5b00;
    --danger: #b4232f;
    --shadow: 0 22px 70px rgba(23, 45, 72, 0.1);
  }
}

@media (max-width: 880px) {
  .hero,
  .calculator-grid,
  .method {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
    padding: 68px 0 60px;
  }

  .hero-proof {
    max-width: 520px;
  }

  .result-panel {
    border-top: 1px solid var(--border);
    border-left: 0;
  }

  .band-list {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .site-header,
  main,
  footer {
    width: min(calc(100% - 28px), var(--max-width));
  }

  .site-header {
    min-height: 76px;
  }

  nav {
    gap: 14px;
  }

  nav a:first-child {
    display: none;
  }

  h1 {
    font-size: clamp(2.55rem, 14vw, 4.25rem);
  }

  .calculator-heading,
  .factor-panel,
  .result-panel,
  .notes {
    padding: 24px 20px;
  }

  .actions,
  .band-list {
    grid-template-columns: 1fr;
  }

  .band-list p {
    min-height: 0;
  }

  footer {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    padding: 26px 0;
  }

  footer div {
    flex-wrap: wrap;
  }
}

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