:root {
  color-scheme: light;
  --page: #f5f5f7;
  --surface: #ffffff;
  --surface-subtle: #fbfbfd;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: #d2d2d7;
  --blue: #0071e3;
  --blue-dark: #0062c3;
  --blue-soft: #e8f2ff;
  --green: #248a3d;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.08);
  --calculator-bg: rgba(255, 255, 255, 0.9);
  --segmented: #ececf0;
  --brand-bg: #1d1d1f;
  --brand-fg: #ffffff;
  --result-bg: #1d1d1f;
  --result-text: #ffffff;
  --radius-lg: 28px;
  --radius-md: 18px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --page: #000000;
  --surface: #1c1c1e;
  --surface-subtle: #242426;
  --text: #f5f5f7;
  --muted: #a1a1a6;
  --line: #3a3a3c;
  --blue: #0a84ff;
  --blue-dark: #409cff;
  --blue-soft: rgba(10, 132, 255, 0.16);
  --green: #30d158;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.44);
  --calculator-bg: rgba(28, 28, 30, 0.9);
  --segmented: #2c2c2e;
  --brand-bg: #f5f5f7;
  --brand-fg: #1d1d1f;
  --result-bg: #2c2c2e;
  --result-text: #ffffff;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  font: inherit;
}

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

.site-header {
  width: min(1180px, calc(100% - 40px));
  height: 72px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.brand-mark {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--brand-bg);
  color: var(--brand-fg);
}

.brand-mark svg {
  width: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.header-link {
  color: var(--blue);
  font-size: 14px;
  text-decoration: none;
}

.header-link:hover {
  text-decoration: underline;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.theme-toggle {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.theme-toggle:hover {
  border-color: var(--muted);
  transform: translateY(-1px);
}

.theme-toggle:focus-visible {
  outline: 3px solid rgba(0, 113, 227, 0.25);
  outline-offset: 2px;
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sun-icon,
html[data-theme="dark"] .moon-icon {
  display: none;
}

html[data-theme="dark"] .sun-icon {
  display: block;
}

main {
  overflow: hidden;
}

.hero {
  position: relative;
  padding: 88px 20px 104px;
  text-align: center;
}

.hero::before {
  content: "";
  position: absolute;
  top: -280px;
  left: 50%;
  z-index: -1;
  width: 900px;
  height: 700px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(0, 113, 227, 0.14) 0, rgba(0, 113, 227, 0) 66%);
  pointer-events: none;
}

.eyebrow,
.section-kicker {
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  max-width: 900px;
  margin: 14px auto 18px;
  font-size: clamp(46px, 7vw, 78px);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.hero-copy {
  max-width: 690px;
  margin: 0 auto 42px;
  color: var(--muted);
  font-size: clamp(18px, 2.2vw, 22px);
  line-height: 1.5;
  letter-spacing: -0.018em;
}

.calculator {
  width: min(900px, 100%);
  margin: 0 auto;
  padding: 16px;
  border: 1px solid rgba(0, 0, 0, 0.04);
  border-radius: var(--radius-lg);
  background: var(--calculator-bg);
  box-shadow: var(--shadow);
  text-align: left;
  backdrop-filter: blur(20px);
}

.mode-switch {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
  margin-bottom: 14px;
  padding: 4px;
  border-radius: 14px;
  background: var(--segmented);
}

.mode-button {
  min-height: 44px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.mode-button.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.input-panel {
  padding: 18px 4px 6px;
}

.input-panel > label,
.speed-fieldset legend {
  display: block;
  margin-bottom: 10px;
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
}

textarea,
.number-field {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  color: var(--text);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

textarea {
  min-height: 190px;
  padding: 18px;
  line-height: 1.55;
  resize: vertical;
}

textarea::placeholder,
input::placeholder {
  color: #98989d;
}

textarea:focus,
.number-field:focus-within {
  border-color: var(--blue);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.13);
}

.number-field {
  display: flex;
  align-items: center;
  padding-right: 18px;
}

.number-field input {
  width: 100%;
  min-width: 0;
  padding: 22px 18px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 24px;
  font-weight: 650;
  outline: 0;
}

.number-field span {
  color: var(--muted);
  white-space: nowrap;
}

.field-note {
  margin: 9px 2px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.speed-fieldset {
  margin: 22px 4px 0;
  padding: 0;
  border: 0;
}

.speed-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.speed-card {
  position: relative;
  min-height: 78px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface-subtle);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.speed-card:hover {
  transform: translateY(-1px);
  border-color: #a8a8ad;
}

.speed-card:has(input:checked) {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.speed-card:has(input:focus-visible) {
  outline: 3px solid rgba(0, 113, 227, 0.25);
  outline-offset: 2px;
}

.speed-card > input[type="radio"],
.custom-speed-choice > input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.custom-speed-card {
  gap: 6px;
  cursor: default;
}

.custom-speed-choice {
  cursor: pointer;
}

.custom-speed-field {
  display: flex;
  align-items: center;
  gap: 4px;
}

.custom-speed-field input {
  width: 52px;
  padding: 3px 5px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  outline: none;
}

.custom-speed-field input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(0, 113, 227, 0.14);
}

.custom-speed-field span {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.speed-name {
  color: var(--text);
  font-size: 15px;
  font-weight: 650;
}

.speed-rate {
  color: var(--muted);
  font-size: 12px;
}

.results {
  display: grid;
  grid-template-columns: 1.35fr repeat(2, 1fr);
  gap: 1px;
  margin-top: 24px;
  overflow: hidden;
  border-radius: 18px;
  background: var(--line);
}

.result-item {
  min-height: 142px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px;
  background: var(--result-bg);
  color: var(--result-text);
}

.result-item strong {
  margin: 7px 0 5px;
  font-size: clamp(26px, 4vw, 38px);
  line-height: 1;
  letter-spacing: -0.04em;
}

.primary-result {
  background: var(--blue);
}

.result-label {
  color: rgba(255, 255, 255, 0.74);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.result-meta {
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
}

.content-section {
  width: min(1080px, calc(100% - 40px));
  margin: 0 auto;
  padding: 96px 0;
  border-top: 1px solid var(--line);
}

.content-section h2 {
  max-width: 650px;
  margin: 10px 0 42px;
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1.05;
  letter-spacing: -0.045em;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.steps article {
  padding: 30px;
  border-radius: 22px;
  background: var(--surface);
}

.steps article > span {
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
}

.steps h3 {
  margin: 30px 0 9px;
  font-size: 21px;
  letter-spacing: -0.02em;
}

.steps p,
.prose p,
.faq-list p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
}

.split-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
}

.split-section h2 {
  margin-bottom: 0;
}

.prose {
  padding-top: 28px;
}

.prose p + p {
  margin-top: 20px;
}

.faq-section {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 80px;
}

.faq-section h2 {
  margin-bottom: 0;
}

.faq-list {
  border-top: 1px solid var(--line);
}

.faq-list details {
  border-bottom: 1px solid var(--line);
}

.faq-list summary {
  position: relative;
  padding: 24px 34px 24px 0;
  font-weight: 650;
  line-height: 1.4;
  list-style: none;
  cursor: pointer;
}

.faq-list summary::-webkit-details-marker {
  display: none;
}

.faq-list summary::after {
  content: "+";
  position: absolute;
  top: 21px;
  right: 4px;
  color: var(--blue);
  font-size: 22px;
  font-weight: 400;
}

.faq-list details[open] summary::after {
  content: "−";
}

.faq-list p {
  padding: 0 34px 24px 0;
}

footer {
  width: min(1080px, calc(100% - 40px));
  margin: 0 auto;
  padding: 32px 0 44px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

footer p {
  margin: 0;
}

@media (max-width: 760px) {
  .site-header {
    width: min(100% - 32px, 1180px);
    height: 64px;
  }

  .brand {
    font-size: 14px;
  }

  .header-link {
    display: none;
  }

  .hero {
    padding: 62px 16px 78px;
  }

  h1 {
    font-size: clamp(43px, 14vw, 62px);
  }

  .hero-copy {
    margin-bottom: 30px;
    font-size: 18px;
  }

  .calculator {
    padding: 11px;
    border-radius: 22px;
  }

  .input-panel {
    padding: 16px 2px 4px;
  }

  textarea {
    min-height: 170px;
  }

  .speed-fieldset {
    margin-right: 2px;
    margin-left: 2px;
  }

  .speed-options {
    grid-template-columns: repeat(2, 1fr);
    gap: 7px;
  }

  .speed-card {
    min-height: 72px;
    padding: 11px 10px;
  }

  .speed-name {
    font-size: 14px;
  }

  .speed-rate {
    font-size: 10px;
  }

  .results {
    grid-template-columns: repeat(2, 1fr);
  }

  .primary-result {
    grid-column: 1 / -1;
  }

  .result-item {
    min-height: 118px;
    padding: 19px;
  }

  .primary-result {
    min-height: 132px;
  }

  .content-section {
    width: min(100% - 32px, 1080px);
    padding: 72px 0;
  }

  .content-section h2 {
    margin-bottom: 30px;
  }

  .steps,
  .split-section,
  .faq-section {
    grid-template-columns: 1fr;
  }

  .steps,
  .split-section,
  .faq-section {
    gap: 14px;
  }

  .steps article {
    padding: 25px;
  }

  .steps h3 {
    margin-top: 22px;
  }

  .split-section h2,
  .faq-section h2 {
    margin-bottom: 20px;
  }

  .prose {
    padding-top: 0;
  }

  footer {
    width: min(100% - 32px, 1080px);
  }
}

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

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