:root {
  color-scheme: light;
  --ink: #10110f;
  --paper: #f2f3ee;
  --card: #ffffff;
  --line: #d9dcd3;
  --line-dark: #30332d;
  --muted: #6f726a;
  --muted-dark: #969990;
  --accent: #b8ff45;
  --accent-ink: #172000;
  --sans: Montserrat, "Avenir Next", Avenir, "Helvetica Neue", Arial, sans-serif;
  --body: "Source Sans Pro", "Helvetica Neue", Arial, sans-serif;
  --shell: min(1220px, calc(100vw - 48px));
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}

button,
input {
  font: inherit;
}

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

button {
  color: inherit;
}

a {
  color: inherit;
}

.shell {
  width: var(--shell);
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  translate: 0 -150%;
  border-radius: 4px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--sans);
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus {
  translate: 0;
}

:focus-visible {
  outline: 2px solid #65a700;
  outline-offset: 3px;
}

.site-header {
  border-bottom: 1px solid #282a26;
  background: var(--ink);
  color: #f6f6f1;
}

.header-inner {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-decoration: none;
  text-transform: uppercase;
}

.wordmark-mark {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: Georgia, serif;
  font-size: 18px;
  font-style: italic;
  letter-spacing: 0;
}

.header-product {
  color: #a9aca3;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.app-shell {
  padding-block: 34px 28px;
}

.tool-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.tool-heading h1,
.tool-heading p,
.panel-heading h2,
.chart-heading h3 {
  margin: 0;
}

.tool-heading h1 {
  font-family: var(--sans);
  font-size: clamp(26px, 3vw, 36px);
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.tool-heading p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 14px;
}

.tool-heading > span,
.data-note {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.tool-grid {
  display: grid;
  grid-template-columns: minmax(330px, 0.62fr) minmax(560px, 1.38fr);
  overflow: hidden;
  border: 1px solid #cfd2ca;
  border-radius: 8px;
  background: var(--card);
  box-shadow: 0 18px 55px rgba(20, 24, 17, 0.09);
}

.control-panel {
  padding: 30px;
  border-right: 1px solid var(--line);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.panel-heading h2 {
  font-family: var(--sans);
  font-size: 16px;
  letter-spacing: -0.02em;
}

.panel-heading > span {
  font-family: var(--sans);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.light-heading > span {
  color: #84877f;
}

.control-group {
  min-width: 0;
  margin: 0 0 25px;
  padding: 0;
  border: 0;
}

.control-group legend,
.control-group > label,
.max-row label {
  display: block;
  margin-bottom: 8px;
  color: #55584f;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
  padding: 4px;
  border-radius: 5px;
  background: #eceee8;
}

.segmented-three {
  grid-template-columns: repeat(3, 1fr);
}

.segmented button {
  min-height: 42px;
  padding: 8px 10px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #65685f;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  transition: background-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.segmented button:hover {
  color: var(--ink);
}

.segmented button[aria-pressed="true"] {
  background: var(--ink);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.12);
  color: #fff;
}

.input-group {
  margin-top: 34px;
}

.number-field {
  display: flex;
  align-items: baseline;
  border-bottom: 2px solid #1c1d1a;
}

.number-field input {
  width: 100%;
  min-width: 0;
  padding: 0 8px 5px 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--sans);
  font-size: clamp(46px, 5vw, 66px);
  font-weight: 700;
  letter-spacing: -0.055em;
  line-height: 1;
  appearance: textfield;
}

.number-field input::-webkit-inner-spin-button,
.number-field input::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
}

.number-field:focus-within {
  border-color: #65a700;
}

.number-field span {
  flex: none;
  padding-bottom: 9px;
  color: #66685f;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 700;
}

.range {
  width: 100%;
  height: 26px;
  margin: 16px 0 0;
  background: transparent;
  cursor: pointer;
  appearance: none;
}

.range::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: #d2d5cc;
}

.range::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: #d2d5cc;
}

.range::-webkit-slider-thumb {
  width: 19px;
  height: 19px;
  margin-top: -7px;
  border: 5px solid var(--ink);
  border-radius: 50%;
  background: var(--accent);
  appearance: none;
}

.range::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border: 5px solid var(--ink);
  border-radius: 50%;
  background: var(--accent);
}

.range-labels {
  display: flex;
  justify-content: space-between;
  color: #85887f;
  font-family: var(--sans);
  font-size: 9px;
  font-weight: 700;
}

.control-divider {
  height: 1px;
  margin-block: 28px;
  background: var(--line);
}

.max-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 18px;
}

.max-row label {
  margin-bottom: 2px;
}

.max-row label span {
  color: #92958d;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.max-row p {
  margin: 0;
  color: #81847c;
  font-size: 11px;
}

.max-inputs {
  display: flex;
  align-items: stretch;
  gap: 6px;
}

.max-inputs > input {
  width: 82px;
  min-height: 42px;
  border: 1px solid #c9ccc4;
  border-radius: 3px;
  background: #fff;
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 700;
  text-align: center;
}

.unit-toggle {
  display: flex;
  padding: 3px;
  border-radius: 3px;
  background: #eceee8;
}

.unit-toggle button {
  width: 34px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: #777a71;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.unit-toggle button[aria-pressed="true"] {
  background: #fff;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.12);
  color: var(--ink);
}

.output-panel {
  min-width: 0;
  background: var(--ink);
  color: #f6f6f1;
}

.result-panel {
  padding: 30px 34px 24px;
  border-bottom: 1px solid var(--line-dark);
}

.dark-heading > span {
  color: #c8cbc2;
}

.live-dot {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.live-dot i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(184, 255, 69, 0.1);
}

.result-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  column-gap: 24px;
  margin-bottom: 26px;
}

.result-main > span {
  grid-column: 1 / -1;
  margin-bottom: 4px;
  color: #9da097;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.result-main strong {
  font-family: var(--sans);
  font-size: clamp(68px, 8vw, 104px);
  font-weight: 700;
  letter-spacing: -0.075em;
  line-height: 0.9;
}

.result-main small {
  padding-bottom: 7px;
  color: var(--accent);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 700;
}

.result-details {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-block: 1px solid var(--line-dark);
}

.result-details > div {
  min-width: 0;
  padding: 14px 14px 14px 0;
}

.result-details > div + div {
  padding-left: 16px;
  border-left: 1px solid var(--line-dark);
}

.result-details span,
.result-details strong {
  display: block;
}

.result-details span {
  margin-bottom: 3px;
  color: #92958d;
  font-size: 10px;
}

.result-details strong {
  overflow: hidden;
  font-family: var(--sans);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.boundary-note {
  margin: 12px 0 0;
  color: #f1d886;
  font-size: 11px;
}

.copy-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 0 14px;
  border: 1px solid #50534b;
  border-radius: 3px;
  background: transparent;
  color: #efeee9;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
}

.copy-button:hover {
  border-color: var(--accent);
  background: rgba(184, 255, 69, 0.06);
}

.copy-button svg {
  width: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}

.copy-status {
  display: inline;
  margin-left: 10px;
  color: var(--accent);
  font-size: 11px;
}

.chart-panel {
  padding: 22px 24px 14px;
}

.chart-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-inline: 10px;
}

.chart-heading h3 {
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: -0.01em;
}

.chart-heading > div > span {
  color: #85887f;
  font-size: 10px;
}

.chart-legend {
  display: flex;
  justify-content: flex-end;
  gap: 20px;
  color: #9da097;
  font-size: 10px;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.chart-legend b {
  color: #d8dad3;
  font-weight: 500;
}

.legend-line {
  display: inline-block;
  width: 22px;
  height: 2px;
}

.legend-line.current {
  background: var(--accent);
}

.legend-line.comparison {
  height: 1px;
  background: repeating-linear-gradient(90deg, #7d8077 0 5px, transparent 5px 9px);
}

.chart-card {
  margin-top: 6px;
}

#curve-chart {
  display: block;
  width: 100%;
  height: auto;
  min-height: 240px;
  overflow: visible;
}

.zone-bands rect {
  opacity: 0.62;
}

.zone-one { fill: #111b17; }
.zone-two { fill: #172018; }
.zone-three { fill: #1d1e17; }
.zone-four { fill: #211a16; }
.zone-five { fill: #211515; }

.grid-lines line {
  stroke: #30332e;
  stroke-width: 1;
}

.grid-lines text {
  fill: #7d8077;
  font-family: var(--sans);
  font-size: 10px;
}

.curve {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.current-curve {
  stroke: var(--accent);
  stroke-width: 3;
}

.comparison-curve {
  stroke: #70736c;
  stroke-dasharray: 7 7;
  stroke-width: 1.5;
}

.point-guide {
  stroke: rgba(184, 255, 69, 0.5);
  stroke-dasharray: 3 4;
}

.point-halo {
  fill: rgba(184, 255, 69, 0.2);
}

.selected-point {
  fill: var(--accent);
  stroke: var(--ink);
  stroke-width: 2;
}

.point-label rect {
  fill: #f0f1eb;
}

.point-label text {
  fill: var(--ink);
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
}

.data-note {
  margin: 14px 2px 0;
  letter-spacing: 0.04em;
  text-transform: none;
}

@media (max-width: 980px) {
  :root {
    --shell: min(100% - 36px, 820px);
  }

  .tool-grid {
    grid-template-columns: 1fr;
  }

  .control-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 620px) {
  :root {
    --shell: calc(100% - 24px);
  }

  .header-inner {
    min-height: 58px;
  }

  .wordmark {
    font-size: 10px;
    letter-spacing: 0.1em;
  }

  .wordmark-mark {
    width: 28px;
    height: 28px;
  }

  .header-product {
    display: none;
  }

  .app-shell {
    padding-block: 22px 18px;
  }

  .tool-heading {
    align-items: flex-start;
    margin-bottom: 14px;
  }

  .tool-heading h1 {
    font-size: 26px;
  }

  .tool-heading > span {
    display: none;
  }

  .tool-grid {
    border-radius: 6px;
  }

  .control-panel,
  .result-panel {
    padding: 24px 20px;
  }

  .panel-heading {
    margin-bottom: 24px;
  }

  .segmented-three button {
    padding-inline: 4px;
    font-size: 10px;
  }

  .input-group {
    margin-top: 28px;
  }

  .number-field input {
    font-size: 52px;
  }

  .range {
    height: 38px;
    margin-top: 12px;
  }

  .range::-webkit-slider-thumb {
    width: 28px;
    height: 28px;
    margin-top: -12px;
    border-width: 6px;
  }

  .range::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-width: 6px;
  }

  .max-row {
    grid-template-columns: 1fr;
  }

  .max-inputs > input {
    width: 100%;
  }

  .result-main {
    grid-template-columns: 1fr;
    margin-bottom: 22px;
  }

  .result-main strong {
    font-size: 70px;
  }

  .result-main small {
    margin-top: 8px;
    padding: 0;
  }

  .result-details {
    grid-template-columns: 1fr;
  }

  .result-details > div {
    padding: 11px 0;
  }

  .result-details > div + div {
    padding-left: 0;
    border-top: 1px solid var(--line-dark);
    border-left: 0;
  }

  .copy-status {
    display: block;
    min-height: 16px;
    margin: 6px 0 0;
  }

  .chart-panel {
    padding: 20px 8px 8px;
  }

  .chart-heading {
    align-items: flex-start;
    padding-inline: 12px;
  }

  .chart-legend {
    flex-direction: column;
    gap: 5px;
  }

  #curve-chart {
    width: 100%;
    min-height: 0;
  }

  .grid-lines text,
  .point-label text {
    font-size: 13px;
  }

  .data-note {
    padding-inline: 2px;
    line-height: 1.45;
  }
}

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

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
