:root {
  --bg: #ffffff;
  --panel: #f7f8fa;
  --line: #e3e6ea;
  --text: #14181d;
  --muted: #626b76;
  --accent: #0b62c4;
  --accent-soft: #eaf2fc;
  --radius: 10px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}

.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;
}

h1 {
  font-size: 26px;
  line-height: 1.25;
  margin: 0 0 16px;
  letter-spacing: -0.01em;
}

/* ---------- tool ---------- */

.tool {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

.inputs,
.results {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

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

.field { display: flex; flex-direction: column; }

.field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 5px;
}

.field select,
.field input {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.field select:focus,
.field input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}

.with-unit { position: relative; }

.with-unit input { padding-right: 46px; }

.with-unit .unit {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: var(--muted);
  pointer-events: none;
}

.chips { display: flex; gap: 6px; margin-top: 6px; }

.chips button {
  flex: 1;
  min-height: 30px;
  font: inherit;
  font-size: 13px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
}

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

.hint {
  margin: 6px 0 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--muted);
}

.hint.strong { color: var(--text); font-weight: 500; }

/* ---------- results ---------- */

.results {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #fff;
}

.result {
  display: flex;
  flex-direction: column;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.result.hero {
  background: var(--accent-soft);
  border-color: #cfe1f7;
}

.rlabel {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.rvalue {
  font-size: 20px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}

.result.hero .rvalue { font-size: 30px; letter-spacing: -0.01em; }

.rnote {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
}

.copy {
  margin-top: 4px;
  min-height: 44px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.copy:hover { background: #0952a6; }
.copy:disabled { background: #b9c2cc; cursor: not-allowed; }

/* ---------- prose ---------- */

.prose {
  margin-top: 40px;
  max-width: 720px;
}

.prose h2 {
  font-size: 20px;
  margin: 0 0 12px;
}

.prose h3 {
  font-size: 16px;
  margin: 22px 0 6px;
}

.prose p,
.prose li {
  color: #2b323a;
}

.prose ul,
.prose ol {
  padding-left: 22px;
  margin: 10px 0;
}

.prose li { margin-bottom: 6px; }

.foot {
  margin-top: 44px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}

.footnav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-bottom: 8px;
}

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

.footnav a:hover,
.footnav a:focus { text-decoration: underline; }

.foot p { margin: 6px 0 0; }

.foot a { color: var(--accent); text-decoration: none; }
.foot a:hover { text-decoration: underline; }

/* ---------- responsive ---------- */

@media (max-width: 860px) {
  .tool { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .wrap { padding: 16px 12px 48px; }
  h1 { font-size: 22px; }
  .inputs { grid-template-columns: 1fr; }
  .result.hero .rvalue { font-size: 26px; }
}
