:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --surface: #11161d;
  --surface-2: #161d25;
  --surface-3: #1d2731;
  --text: #e7edf3;
  --muted: #9ba8b5;
  --faint: #70808f;
  --border: #2b3540;
  --accent: #6ee7b7;
  --accent-2: #7dd3fc;
  --danger: #fb7185;
  --shadow: rgba(0, 0, 0, 0.34);
}

body.light {
  color-scheme: light;
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-2: #f0f3f7;
  --surface-3: #e6ebf1;
  --text: #18202a;
  --muted: #526170;
  --faint: #6b7a8a;
  --border: #d4dbe4;
  --accent: #057a55;
  --accent-2: #0369a1;
  --danger: #be123c;
  --shadow: rgba(20, 30, 45, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

a {
  color: var(--accent-2);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
input {
  font: inherit;
}

code,
input,
dd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

code {
  color: var(--accent);
  font-size: 0.92em;
}

.site-header {
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid var(--border);
}

.topbar {
  align-items: center;
  display: flex;
  gap: 18px;
  min-height: 58px;
  padding: 0 22px;
}

.brand {
  color: var(--text);
  font-weight: 800;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  gap: 14px;
}

.nav-links a {
  color: var(--muted);
  font-size: 14px;
}

.theme-toggle {
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  gap: 7px;
  height: 36px;
  padding: 0 12px;
  white-space: nowrap;
}

.theme-toggle:hover {
  border-color: var(--accent-2);
}

main {
  margin: 0 auto;
  max-width: 1160px;
  padding: 64px 22px 72px;
}

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

.eyebrow {
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 8px;
  text-transform: uppercase;
}

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

h1,
h2 {
  letter-spacing: 0;
  line-height: 1.1;
  margin-bottom: 0;
}

h1 {
  font-size: clamp(30px, 5vw, 54px);
  max-width: 820px;
}

h2 {
  font-size: 22px;
}

.lede {
  color: var(--muted);
  font-size: 17px;
  margin: 14px 0 0;
}

.precision-badge,
.whole-number-note,
.base-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.precision-badge {
  align-self: start;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px 10px;
  white-space: nowrap;
}

.converter-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 18px 50px var(--shadow);
  padding: 26px;
}

.section-title {
  align-items: baseline;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 22px;
}

.section-title p {
  color: var(--muted);
  margin: 8px 0 0;
}

.number-fields {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.number-field {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.number-field:focus-within {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2) 20%, transparent);
}

.number-field.invalid {
  border-color: var(--danger);
}

.field-heading {
  align-items: center;
  display: flex;
  gap: 9px;
  justify-content: space-between;
}

.field-title {
  align-items: center;
  display: inline-flex;
  font-weight: 800;
  gap: 8px;
}

.base-mark {
  align-items: center;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--accent);
  display: inline-flex;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  height: 25px;
  justify-content: center;
  width: 27px;
}

.number-field input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: clamp(18px, 2.4vw, 25px);
  letter-spacing: 0.04em;
  min-width: 0;
  outline: none;
  padding: 13px 12px;
  width: 100%;
}

.number-field input::placeholder {
  color: var(--faint);
  opacity: 0.75;
}

.number-field input:focus {
  border-color: var(--accent-2);
}

.number-field input[aria-invalid="true"] {
  border-color: var(--danger);
}

.field-help {
  color: var(--muted);
  font-size: 12px;
}

.status {
  color: var(--muted);
  margin: 20px 0 0;
}

.status.error {
  color: var(--danger);
}

.notes {
  border-top: 1px solid var(--border);
  margin-top: 42px;
  padding-top: 26px;
}

.notes dl {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 18px 0;
}

.notes dl div {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
}

.notes dt {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.notes dd {
  color: var(--text);
  margin: 0;
  overflow-wrap: anywhere;
}

.notes p {
  color: var(--muted);
  margin: 0;
}

@media (max-width: 820px) {
  main {
    padding: 44px 16px 54px;
  }

  .intro,
  .section-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .precision-badge {
    align-self: auto;
  }

  .number-fields,
  .notes dl {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 12px 16px 14px;
  }

  .nav-links {
    gap: 10px 14px;
  }

  .theme-toggle {
    align-self: flex-start;
  }

  .converter-card {
    padding: 18px;
  }
}
