:root {
  color-scheme: dark;
  --ink: #f0f7f6;
  --muted: #92a5a8;
  --muted-strong: #b9c8c9;
  --bg: #080b10;
  --bg-raised: #0d1319;
  --bg-panel: #101920;
  --line: rgba(149, 183, 188, 0.18);
  --line-strong: rgba(149, 183, 188, 0.35);
  --cyan: #5de5ec;
  --cyan-soft: rgba(93, 229, 236, 0.13);
  --lime: #d0fa67;
  --lime-soft: rgba(208, 250, 103, 0.12);
  --orange: #ffb66b;
  --danger: #ff8b82;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  min-width: 0;
  margin: 0;
  background:
    radial-gradient(circle at 86% 4%, rgba(39, 103, 110, 0.15), transparent 28rem),
    var(--bg);
  color: var(--ink);
  line-height: 1.6;
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

button,
select,
input {
  min-height: 44px;
}

button,
select {
  cursor: pointer;
}

a {
  color: var(--cyan);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid var(--lime);
  outline-offset: 3px;
}

code,
.formula,
.eyebrow,
.card-index,
.panel-kicker {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.site-shell {
  width: min(100%, 1440px);
  margin: 0 auto;
  padding: 0 44px;
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-decoration: none;
  white-space: nowrap;
}

.brand-accent {
  color: var(--cyan);
}

.brand-mark {
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  width: 25px;
  height: 23px;
}

.brand-mark span {
  display: block;
  width: 5px;
  border-radius: 5px 5px 0 0;
  background: var(--cyan);
  transform: skew(-24deg);
}

.brand-mark span:nth-child(1) {
  height: 10px;
  opacity: 0.45;
}

.brand-mark span:nth-child(2) {
  height: 17px;
  opacity: 0.72;
}

.brand-mark span:nth-child(3) {
  height: 23px;
  background: var(--lime);
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 22px;
}

.top-nav a {
  color: var(--muted-strong);
  font-size: 13px;
  text-decoration: none;
}

.top-nav a:hover {
  color: var(--cyan);
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(300px, 0.96fr);
  gap: clamp(28px, 6vw, 90px);
  align-items: center;
  min-height: 420px;
  padding: 66px 0 72px;
  overflow: clip;
  isolation: isolate;
}

.hero::after {
  position: absolute;
  z-index: -1;
  top: 7%;
  right: -12%;
  width: 62%;
  height: 75%;
  border: 1px solid rgba(93, 229, 236, 0.11);
  border-radius: 48% 52% 45% 55%;
  content: "";
  transform: rotate(-12deg);
}

.hero-copy {
  max-width: 670px;
}

.eyebrow {
  margin: 0 0 13px;
  color: var(--lime);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  line-height: 1.4;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: -0.035em;
  line-height: 1.16;
}

h1 {
  max-width: 740px;
  font-size: clamp(2.6rem, 5.5vw, 5.3rem);
  font-weight: 850;
}

h1 span {
  color: var(--cyan);
}

h2 {
  font-size: clamp(1.65rem, 3vw, 2.4rem);
}

h3 {
  font-size: 1.2rem;
}

.hero-lead {
  max-width: 620px;
  margin: 25px 0 0;
  color: var(--muted-strong);
  font-size: 16px;
}

.hero-lead strong {
  color: var(--ink);
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 27px;
}

.hero-tags span {
  padding: 5px 10px;
  border: 1px solid rgba(208, 250, 103, 0.3);
  border-radius: 999px;
  color: var(--lime);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  letter-spacing: 0.02em;
}

.hero-art {
  position: relative;
  margin: 0;
}

.hero-art::before {
  position: absolute;
  z-index: -1;
  right: -14px;
  bottom: -14px;
  width: 72%;
  height: 62%;
  border: 1px solid rgba(208, 250, 103, 0.38);
  content: "";
}

.hero-art img {
  display: block;
  width: 100%;
  max-width: 610px;
  aspect-ratio: 1.45;
  margin-left: auto;
  border: 1px solid var(--line-strong);
  object-fit: cover;
  filter: saturate(0.92) contrast(1.06);
}

.hero-art figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.workspace,
.info-section,
.sources-section {
  padding-top: 46px;
}

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

.section-heading > p:last-child {
  max-width: 680px;
  margin: 12px 0 0;
  color: var(--muted);
}

.compact-heading {
  margin-bottom: 18px;
}

#calculator-form {
  display: block;
}

.workspace-grid,
.compare-grid,
.info-grid {
  display: grid;
  gap: 18px;
}

.workspace-grid {
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
}

.compare-grid {
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
}

.panel,
.action-strip,
.info-card {
  min-width: 0;
  border: 1px solid var(--line);
  background: linear-gradient(140deg, rgba(18, 28, 34, 0.96), rgba(10, 16, 21, 0.98));
  box-shadow: var(--shadow);
}

.input-panel {
  min-width: 0;
  margin: 0;
  padding: clamp(20px, 3vw, 34px);
}

fieldset {
  border-radius: 2px;
}

legend {
  padding: 0 9px 0 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 750;
}

.field + .field,
.field-grid + .field,
.field + .field-grid {
  margin-top: 19px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}

.field label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 700;
}

.required-mark {
  margin-left: 5px;
  color: var(--lime);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  font-weight: 500;
}

input,
select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: rgba(3, 7, 10, 0.75);
  color: var(--ink);
}

input {
  padding: 9px 12px;
}

select {
  padding: 8px 34px 8px 12px;
}

input[readonly] {
  border-color: rgba(93, 229, 236, 0.27);
  color: var(--cyan);
  cursor: not-allowed;
}

input[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px rgba(255, 139, 130, 0.11);
}

.input-with-unit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.input-with-unit > span {
  min-width: 46px;
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  text-align: right;
  white-space: nowrap;
}

.field-help {
  min-height: 1.3em;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.source-link {
  display: block;
  margin-top: 7px;
  overflow-wrap: anywhere;
  font-size: 11px;
  line-height: 1.45;
}

.condition-badge {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 28px;
  color: var(--muted-strong);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
}

.badge-dot,
.laser-dot {
  display: inline-block;
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 16px rgba(208, 250, 103, 0.9);
}

.result-panel,
.comparison-output {
  min-width: 0;
  padding: clamp(22px, 3vw, 38px);
  overflow: hidden;
  background:
    linear-gradient(155deg, rgba(14, 29, 36, 0.98), rgba(7, 12, 17, 0.99)),
    var(--bg-panel);
}

.result-panel {
  position: relative;
}

.result-panel::before,
.comparison-output::before {
  position: absolute;
  width: 300px;
  height: 1px;
  background: linear-gradient(90deg, var(--cyan), transparent);
  content: "";
  opacity: 0.55;
}

.result-panel::before {
  top: 0;
  left: 0;
}

.comparison-output {
  position: relative;
}

.comparison-output::before {
  top: 0;
  right: 0;
  transform: rotate(180deg);
}

.panel-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--cyan);
  font-size: 10px;
  letter-spacing: 0.15em;
}

.panel-kicker .laser-dot {
  width: 5px;
  height: 5px;
  background: var(--cyan);
  box-shadow: 0 0 12px rgba(93, 229, 236, 0.9);
}

.result-condition {
  margin: 10px 0 0;
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
}

.result-values {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) repeat(2, minmax(100px, 0.72fr));
  gap: 12px;
  align-items: stretch;
  margin-top: 29px;
}

.primary-result,
.secondary-result {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  border-left: 1px solid var(--line);
  padding: 10px 14px;
}

.primary-result {
  border-left: 3px solid var(--cyan);
  background: linear-gradient(90deg, rgba(93, 229, 236, 0.1), transparent);
}

.secondary-result:first-of-type {
  border-left-color: rgba(208, 250, 103, 0.55);
}

.result-label {
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  letter-spacing: 0.05em;
}

.primary-result strong {
  margin-top: 2px;
  color: var(--cyan);
  font-size: clamp(2.2rem, 5vw, 4.2rem);
  letter-spacing: -0.07em;
  line-height: 1.08;
}

.primary-result strong small,
.secondary-result strong small,
.comparison-number small {
  font-size: 0.38em;
  font-weight: 500;
  letter-spacing: 0;
}

.secondary-result strong {
  margin-top: 8px;
  color: var(--lime);
  font-size: clamp(1.35rem, 3vw, 2.1rem);
  letter-spacing: -0.06em;
  line-height: 1;
}

.result-caption {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
}

.ruler {
  margin-top: 34px;
}

.ruler-track {
  position: relative;
  height: 31px;
  border-top: 1px solid rgba(93, 229, 236, 0.8);
  border-bottom: 1px solid var(--line-strong);
  background: repeating-linear-gradient(90deg, rgba(149, 183, 188, 0.27) 0 1px, transparent 1px 8.333%);
}

.ruler-track::before,
.ruler-track::after {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--cyan);
  content: "";
}

.ruler-track::before {
  left: 0;
}

.ruler-track::after {
  right: 0;
}

.ruler-progress {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--distance-progress, 45%);
  background: linear-gradient(90deg, rgba(93, 229, 236, 0.07), rgba(93, 229, 236, 0.3));
  transition: width 180ms ease;
}

.ruler-laser {
  position: absolute;
  top: -2px;
  right: 0;
  width: 2px;
  height: 35px;
  background: var(--lime);
  box-shadow: 0 0 11px rgba(208, 250, 103, 0.92);
}

.ruler-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(149, 183, 188, 0.62);
}

.tick-start { left: 0; }
.tick-quarter { left: 25%; }
.tick-half { left: 50%; }
.tick-three-quarter { left: 75%; }
.tick-end { right: 0; }

.ruler-labels {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 9px;
  color: var(--muted-strong);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
}

.ruler-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.notice {
  margin: 18px 0 0;
  padding: 10px 12px;
  border-left: 2px solid var(--line-strong);
  color: var(--muted-strong);
  font-size: 11px;
  line-height: 1.55;
}

.notice strong {
  color: var(--ink);
}

.notice-warning {
  border-color: var(--orange);
  background: rgba(255, 182, 107, 0.06);
}

.notice-verified {
  border-color: var(--cyan);
  background: var(--cyan-soft);
}

.notice-caution {
  border-color: var(--lime);
  background: var(--lime-soft);
}

.calculation-error {
  margin: 14px 0 0;
  color: var(--danger);
  font-size: 12px;
}

.action-strip {
  display: grid;
  grid-template-columns: minmax(170px, 0.74fr) minmax(0, 1.4fr);
  gap: 18px 25px;
  align-items: center;
  margin-top: 18px;
  padding: 17px 21px;
  border-left: 2px solid var(--lime);
  background: rgba(14, 23, 26, 0.76);
  box-shadow: none;
}

.action-title,
.action-help {
  margin: 0;
}

.action-title {
  font-size: 13px;
  font-weight: 750;
}

.action-help {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.button {
  min-width: 92px;
  padding: 8px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 750;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.button:hover {
  border-color: var(--cyan);
}

.button-primary {
  border-color: var(--lime);
  background: var(--lime);
  color: #10180b;
}

.button-primary:hover {
  border-color: var(--cyan);
  background: var(--cyan);
}

.button-secondary {
  background: var(--cyan-soft);
  color: var(--cyan);
}

.button-quiet {
  background: transparent;
  color: var(--muted-strong);
}

.storage-status {
  grid-column: 1 / -1;
  min-height: 1.35em;
  margin: -5px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.storage-status[data-state="success"] {
  color: var(--lime);
}

.storage-status[data-state="error"] {
  color: var(--danger);
}

.compare-section {
  margin-top: 74px;
}

.target-panel {
  box-shadow: none;
}

.comparison-output {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  justify-content: center;
}

.comparison-number {
  margin-top: 21px;
  color: var(--lime);
  font-size: clamp(2.8rem, 7vw, 5.3rem);
  font-weight: 800;
  letter-spacing: -0.08em;
  line-height: 1;
}

.comparison-output > p:not(.calculation-error) {
  margin: 13px 0 0;
  color: var(--muted-strong);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
}

.info-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.info-card {
  padding: 24px;
  box-shadow: none;
}

.card-index {
  margin: 0 0 17px;
  color: var(--cyan);
  font-size: 10px;
  letter-spacing: 0.15em;
}

.info-card p:last-child {
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.formula {
  overflow-wrap: anywhere;
  margin: 17px 0 0;
  color: var(--lime);
  font-size: clamp(1rem, 2vw, 1.35rem);
  letter-spacing: -0.04em;
}

.sources-section {
  padding-bottom: 68px;
}

.source-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.source-list a {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 5px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  color: var(--muted-strong);
  text-decoration: none;
}

.source-list a:hover {
  border-color: var(--cyan);
  background: var(--cyan-soft);
}

.source-list span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.source-list code {
  overflow-wrap: anywhere;
  color: var(--cyan);
  font-size: 11px;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 19px 0 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.site-footer p {
  margin: 0;
}

.footer-mark {
  color: var(--lime);
  font-size: 18px;
  font-weight: 800;
}

[hidden] {
  display: none !important;
}

@media (max-width: 980px) {
  .site-shell {
    padding: 0 25px;
  }

  .hero {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 0.8fr);
    gap: 30px;
  }

  .workspace-grid,
  .compare-grid {
    grid-template-columns: 1fr;
  }

  .result-values {
    grid-template-columns: minmax(0, 1.2fr) repeat(2, minmax(110px, 0.8fr));
  }
}

@media (max-width: 680px) {
  .site-shell {
    padding: 0 16px;
  }

  .hero::after,
  .hero-art::before {
    display: none;
  }

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

  .top-nav {
    gap: 11px;
  }

  .top-nav a {
    font-size: 11px;
  }

  .hero {
    display: block;
    min-height: auto;
    padding: 47px 0 44px;
  }

  .hero-art {
    max-width: 590px;
    margin: 32px 0 0;
  }

  .hero-art figcaption {
    text-align: left;
  }

  .workspace,
  .info-section,
  .sources-section {
    padding-top: 35px;
  }

  .field-grid,
  .info-grid,
  .source-list {
    grid-template-columns: 1fr;
  }

  .result-values {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

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

  .action-strip {
    grid-template-columns: 1fr;
  }

  .button-row {
    justify-content: flex-start;
  }

  .compare-section {
    margin-top: 52px;
  }
}

@media (max-width: 390px) {
  .site-shell {
    padding: 0 12px;
  }

  .site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 9px;
    padding: 16px 0 13px;
  }

  .top-nav {
    width: 100%;
    justify-content: space-between;
  }

  h1 {
    font-size: clamp(2.35rem, 12vw, 3.4rem);
  }

  .hero-lead {
    font-size: 15px;
  }

  .input-panel,
  .result-panel,
  .comparison-output,
  .info-card {
    padding: 18px 15px;
  }

  .primary-result strong {
    font-size: clamp(2.15rem, 14vw, 3.5rem);
  }

  .button {
    flex: 1 1 calc(50% - 8px);
    min-width: 0;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }
}

@media print {
  :root {
    color-scheme: light;
  }

  body {
    background: #fff;
    color: #101417;
  }

  .site-shell {
    width: 100%;
    padding: 0;
  }

  .site-header,
  .hero,
  .input-panel,
  .action-strip,
  .info-section,
  .sources-section,
  .site-footer,
  .compare-section {
    display: none;
  }

  .workspace {
    padding: 0;
  }

  .workspace-grid {
    display: block;
  }

  .result-panel {
    min-height: 100vh;
    border: 0;
    background: #fff;
    box-shadow: none;
    color: #101417;
  }

  .result-panel::before,
  .ruler-progress,
  .ruler-laser {
    display: none;
  }

  .result-panel h2,
  .primary-result strong,
  .secondary-result strong,
  .result-condition,
  .ruler-labels,
  .notice,
  .ruler-note {
    color: #101417;
  }
}
