:root {
  --primary: #159447;
  --primary-dark: #0e7135;
  --primary-soft: #eaf7ee;
  --text: #102238;
  --text-strong: #071a2f;
  --muted: #5d6978;
  --border: #d7dee6;
  --border-strong: #c6d0da;
  --surface: #ffffff;
  --surface-soft: #f7faf8;
  --result-bg: #f3faf5;
  --warning-bg: #fff8e8;
  --warning-border: #efd696;
  --danger: #b42318;
  --danger-bg: #fff4f2;
  --safety-bg: #f2f8ff;
  --safety-border: #bcd8f3;
  --shadow: 0 18px 50px rgba(16, 34, 56, 0.08);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 9px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: #fff;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: #fff; color: var(--text); line-height: 1.5; }
button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
svg { display: block; }

.site-header {
  min-height: 66px;
  padding: 0 28px;
  border-bottom: 1px solid #e5e9ee;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,255,255,.96);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px);
}

.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 760; color: var(--text-strong); }
.brand-icon { width: 28px; height: 28px; stroke: var(--primary); fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.header-link { display: inline-flex; align-items: center; gap: 7px; padding: 9px 10px; border-radius: 9px; text-decoration: none; color: #354252; font-size: .94rem; font-weight: 650; }
.header-link:hover { color: var(--primary-dark); background: var(--primary-soft); }
.header-link svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.github-button { min-height: 40px; padding: 8px 13px; border: 1px solid #172538; border-radius: 9px; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: #fff; background: #172538; font-size: .9rem; font-weight: 750; transition: transform .15s, background .15s, box-shadow .15s; }
.github-button:hover { transform: translateY(-1px); background: #071a2f; box-shadow: 0 8px 18px rgba(7,26,47,.18); }
.github-button svg { width: 20px; height: 20px; fill: currentColor; }

.hero { max-width: 1540px; margin: 0 auto; padding: 34px 30px 26px; }
.hero-copy { margin-bottom: 26px; }
.eyebrow { margin: 0 0 6px; color: var(--primary-dark); font-size: .76rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 800; }
h1 { margin: 0; color: var(--text-strong); font-size: clamp(2.05rem, 4vw, 3rem); line-height: 1.1; letter-spacing: -.035em; }
.hero-copy > p:last-child { margin: 10px 0 0; color: #465365; font-size: clamp(1rem, 1.5vw, 1.22rem); }

.calculator-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .96fr); gap: 22px; align-items: stretch; }
.card { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: 0 1px 1px rgba(16,34,56,.02); }
.calculator-card { padding: 22px; }
.card-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 24px; }
.heading-title { display: flex; align-items: center; gap: 11px; min-width: 0; }
.heading-title svg, .result-heading svg { width: 26px; height: 26px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
h2 { margin: 0; color: var(--text-strong); font-size: 1.34rem; line-height: 1.25; }

.unit-toggle { padding: 3px; display: inline-flex; border: 1px solid var(--border); border-radius: 11px; background: #f6f8fa; }
.unit-button { border: 0; border-radius: 8px; padding: 8px 15px; color: #44505e; background: transparent; font-weight: 700; font-size: .88rem; }
.unit-button.is-active { color: #fff; background: linear-gradient(135deg, #1da653, #12853f); box-shadow: 0 4px 10px rgba(21,148,71,.22); }

.field-group { margin-bottom: 20px; }
.field-row { display: grid; grid-template-columns: 1.2fr .9fr; gap: 18px; }
label { display: block; margin-bottom: 8px; color: #172538; font-weight: 720; font-size: .95rem; }
.label-note { color: var(--muted); font-weight: 500; }
.label-with-help { display: inline-flex; align-items: center; gap: 8px; }
.help-button { width: 19px; height: 19px; padding: 0; border: 1px solid #8894a2; border-radius: 50%; color: #536171; background: #fff; font-size: .72rem; font-weight: 800; line-height: 17px; position: relative; }
.help-button::after { content: attr(data-tooltip); position: absolute; left: 50%; bottom: calc(100% + 10px); width: 250px; transform: translateX(-50%) translateY(4px); padding: 9px 10px; border-radius: 8px; color: #fff; background: #14273c; box-shadow: var(--shadow); font-weight: 500; font-size: .78rem; line-height: 1.35; opacity: 0; visibility: hidden; pointer-events: none; transition: .15s ease; z-index: 5; }
.help-button:hover::after, .help-button:focus-visible::after { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }

.input-with-unit { min-height: 50px; display: grid; grid-template-columns: 1fr auto; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; background: #fff; transition: border-color .15s, box-shadow .15s; }
.input-with-unit:focus-within, .select-wrap:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(21,148,71,.12); }
.input-with-unit input { width: 100%; min-width: 0; border: 0; outline: 0; padding: 12px 14px; color: var(--text-strong); background: transparent; }
.input-with-unit span { min-width: 110px; padding: 12px 15px; border-left: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; color: #3f4a58; background: #fbfcfd; }
.compact-unit span { min-width: 96px; }
.select-wrap { position: relative; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: #fff; transition: border-color .15s, box-shadow .15s; }
.select-wrap::after { content: ""; position: absolute; right: 16px; top: 50%; width: 7px; height: 7px; border-right: 1.7px solid #546170; border-bottom: 1.7px solid #546170; transform: translateY(-70%) rotate(45deg); pointer-events: none; }
select { width: 100%; min-height: 50px; padding: 11px 42px 11px 14px; border: 0; outline: 0; appearance: none; color: var(--text-strong); background: transparent; }
.field-hint { margin: 6px 0 0; color: var(--muted); font-size: .82rem; }
.field-error { min-height: 0; margin: 5px 0 0; color: var(--danger); font-size: .8rem; font-weight: 650; }
.field-error:empty { display: none; }
.field-group.has-error .input-with-unit, .field-group.has-error .select-wrap { border-color: var(--danger); background: var(--danger-bg); }

.form-actions { display: grid; grid-template-columns: 1.5fr .82fr; gap: 14px; margin-top: 28px; }
.primary-button, .secondary-button { min-height: 54px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; font-weight: 780; transition: transform .15s, box-shadow .15s, background .15s; }
.primary-button { border: 1px solid var(--primary); color: #fff; background: linear-gradient(135deg, #1ba24f, #11803b); box-shadow: 0 8px 18px rgba(21,148,71,.2); }
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 11px 22px rgba(21,148,71,.24); }
.secondary-button { border: 1px solid var(--border-strong); color: #223044; background: #fff; }
.secondary-button:hover { background: #f7f9fb; }
.primary-button svg, .secondary-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.result-card { padding: 22px; border-color: #c7ddce; background: linear-gradient(145deg, var(--result-bg), #fbfdf9 68%); }
.result-heading { display: flex; align-items: center; gap: 11px; color: #356a2a; }
.result-main { padding: 14px 0 8px; text-align: center; }
.result-main strong { display: block; color: #159447; font-size: clamp(3.4rem, 6vw, 4.6rem); line-height: 1; letter-spacing: -.045em; }
.result-main span { display: block; margin-top: 6px; color: #2f3036; font-size: 1.7rem; font-weight: 600; }
.result-summary { margin: 4px 0 16px; padding: 12px 6px 0; border-top: 1px solid #9ab88d; text-align: center; color: #263226; font-size: .94rem; }
.result-notice { margin-bottom: 12px; padding: 10px 12px; border: 1px solid var(--warning-border); border-radius: 9px; color: #6b4d07; background: var(--warning-bg); font-size: .85rem; font-weight: 650; }
.result-notice.is-error { border-color: #f0b8b2; color: var(--danger); background: var(--danger-bg); }
.result-details { margin: 0; border: 1px solid #d9e2dc; border-radius: 11px; overflow: hidden; background: rgba(255,255,255,.8); }
.result-details div { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 10px 14px; border-bottom: 1px solid #dce4df; }
.result-details div:last-child { border-bottom: 0; }
.result-details dt { font-weight: 730; color: #1c2820; }
.result-details dd { margin: 0; color: #172019; }

.use-result { margin-top: 14px; padding: 15px; border: 1px solid var(--warning-border); border-radius: 11px; display: grid; grid-template-columns: 1fr 160px; align-items: end; background: linear-gradient(135deg, #fff9e9, #fff5d7); overflow: hidden; }
.use-result h3 { margin: 0 0 8px; display: flex; align-items: center; gap: 8px; color: #2d2a20; font-size: 1.02rem; }
.use-result h3 svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.use-result ol { margin: 0; padding-left: 24px; color: #272722; font-size: .86rem; }
.use-result li + li { margin-top: 3px; }
.mixing-illustration { width: 150px; height: 120px; fill: none; stroke: #896c32; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }

.safety-strip { margin-top: 22px; padding: 17px 20px; border: 1px solid var(--safety-border); border-radius: 14px; display: grid; grid-template-columns: .72fr 1fr 1fr 1fr; align-items: center; gap: 18px; background: linear-gradient(135deg, #f5faff, #edf7ff); }
.safety-title, .safety-item { display: flex; align-items: center; gap: 12px; min-width: 0; }
.safety-title svg { width: 34px; height: 34px; color: #215b96; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.safety-title h2 { color: #1a4777; font-size: 1.08rem; }
.safety-item { padding-left: 18px; border-left: 1px solid #cbddec; }
.safety-item svg { width: 30px; height: 30px; flex: 0 0 auto; color: #159447; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.safety-item:nth-child(3) svg, .safety-item:nth-child(4) svg { color: #225b97; }
.safety-item p { margin: 0; font-size: .86rem; }
.safety-item strong, .safety-item span { display: block; }
.safety-item span { color: #344c67; }

.content-section { max-width: 1180px; margin: 0 auto; padding: 78px 30px; }
.alt-section { max-width: none; padding-left: max(30px, calc((100vw - 1180px)/2 + 30px)); padding-right: max(30px, calc((100vw - 1180px)/2 + 30px)); background: #f7faf8; }
.section-heading { max-width: 760px; margin-bottom: 30px; }
.section-heading h2 { font-size: clamp(1.75rem, 3vw, 2.35rem); letter-spacing: -.025em; }
.section-heading > p:last-child { margin: 11px 0 0; color: var(--muted); font-size: 1.02rem; }
.compact-heading { margin-bottom: 24px; }
.process-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.process-grid article { padding: 24px; border: 1px solid var(--border); border-radius: 15px; background: #fff; box-shadow: 0 10px 30px rgba(16,34,56,.045); }
.process-grid article > span { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--primary); font-weight: 800; }
.process-grid h3 { margin: 17px 0 7px; color: var(--text-strong); }
.process-grid p { margin: 0; color: var(--muted); }
.table-wrap { border: 1px solid var(--border); border-radius: 15px; overflow-x: auto; background: #fff; }
table { width: 100%; border-collapse: collapse; min-width: 620px; }
th, td { padding: 14px 18px; border-bottom: 1px solid #e2e7eb; text-align: left; }
th { color: #2c3948; background: #eef5f0; font-size: .87rem; }
td { color: #344150; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:nth-child(even) { background: #fafcfb; }
.faq-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
details { padding: 18px 20px; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
summary { color: var(--text-strong); font-weight: 750; cursor: pointer; }
details p { margin: 11px 0 0; color: var(--muted); }
.site-footer { padding: 26px 30px; border-top: 1px solid #e5e9ee; display: flex; justify-content: center; text-align: center; color: #647080; font-size: .86rem; }
.site-footer p { margin: 0; }

button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid rgba(21,148,71,.25); outline-offset: 3px; }

@media (max-width: 1080px) {
  .calculator-layout { grid-template-columns: 1fr; }
  .safety-strip { grid-template-columns: 1fr 1fr; }
  .safety-item:nth-child(3) { border-left: 0; }
}

@media (max-width: 720px) {
  .site-header { min-height: 58px; padding: 0 16px; }
  .brand span { font-size: .92rem; }
  .header-actions { gap: 6px; }
  .header-link { padding: 8px; }
  .header-link span { display: none; }
  .header-link svg { width: 23px; height: 23px; }
  .github-button { min-height: 38px; padding: 7px 10px; }
  .hero { padding: 26px 14px 20px; }
  .calculator-card, .result-card { padding: 17px; border-radius: 14px; }
  .calculator-heading { align-items: flex-start; flex-direction: column; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .form-actions { grid-template-columns: 1fr; }
  .use-result { grid-template-columns: 1fr; }
  .mixing-illustration { display: none; }
  .safety-strip { grid-template-columns: 1fr; padding: 17px; }
  .safety-item { padding: 14px 0 0; border-left: 0; border-top: 1px solid #cbddec; }
  .content-section, .alt-section { padding: 58px 16px; }
  .process-grid, .faq-grid { grid-template-columns: 1fr; }
  .site-footer { padding: 22px 16px; }
}

@media (max-width: 420px) {
  .unit-button { padding: 7px 13px; }
  .input-with-unit span { min-width: 85px; padding-left: 11px; padding-right: 11px; }
  .result-details div { grid-template-columns: 1.1fr .9fr; gap: 8px; padding: 10px 11px; font-size: .86rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}


@media (max-width: 480px) {
  .site-header { gap: 10px; }
  .brand { min-width: 0; }
  .brand span { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .github-button span { display: none; }
  .github-button { width: 38px; padding: 7px; justify-content: center; }
}
