:root {
  --ink: #102a43;
  --ink-soft: #52677b;
  --teal: #0b6f78;
  --teal-dark: #07555e;
  --blue: #2367df;
  --blue-soft: #edf5ff;
  --aqua: #e8f8f6;
  --mint: #eaf8ef;
  --violet: #f1edff;
  --line: #dce8ef;
  --surface: rgba(255, 255, 255, 0.94);
  --surface-solid: #ffffff;
  --shadow: 0 20px 60px rgba(33, 72, 95, 0.12);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 18%, rgba(94, 182, 220, 0.13), transparent 24rem),
    radial-gradient(circle at 92% 16%, rgba(39, 162, 146, 0.12), transparent 28rem),
    linear-gradient(180deg, #f8fcff 0%, #f4fbfb 56%, #ffffff 100%);
  line-height: 1.5;
}
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button { margin: 0; }

.background-art { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: -1; }
.ripple { position: absolute; border: 1px solid rgba(47, 139, 173, 0.13); border-radius: 44% 56% 55% 45% / 47% 43% 57% 53%; transform: rotate(-10deg); }
.ripple-one { width: 500px; height: 360px; left: -190px; top: 120px; }
.ripple-two { width: 650px; height: 450px; right: -330px; top: 70px; border-color: rgba(15, 131, 119, 0.12); }
.ripple-three { width: 420px; height: 290px; left: 22%; bottom: -180px; }

.site-header {
  width: min(1420px, calc(100% - 40px));
  margin: 0 auto;
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.brand { color: var(--ink); display: inline-flex; align-items: center; gap: 12px; text-decoration: none; font-size: 20px; font-weight: 800; letter-spacing: -0.03em; }
.brand img { border-radius: 12px; box-shadow: 0 8px 24px rgba(11, 111, 120, 0.16); }
.github-button {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink);
  background: rgba(255,255,255,.88); border: 1px solid var(--line); border-radius: 12px; padding: 9px 14px; font-weight: 750;
  box-shadow: 0 8px 24px rgba(33,72,95,.06); transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.github-button:hover { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(33,72,95,.12); border-color: #bfd3de; }
.github-button svg { width: 20px; height: 20px; fill: currentColor; }

main { width: min(1420px, calc(100% - 40px)); margin: 0 auto; }
.hero { padding: 42px 0 28px; }
.hero-copy { max-width: 840px; margin: 0 auto 30px; text-align: center; }
.eyebrow { margin: 0 0 6px; color: var(--teal); font-size: 12px; font-weight: 850; letter-spacing: .16em; }
.hero h1 { margin: 0; font-size: clamp(44px, 6vw, 72px); line-height: 1.02; letter-spacing: -0.055em; color: #0c2440; }
.hero-copy > p:last-child { margin: 14px auto 0; max-width: 700px; color: var(--ink-soft); font-size: clamp(16px, 2vw, 20px); }

.tool-grid { display: grid; grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr); gap: 18px; align-items: start; }
.panel { background: var(--surface); border: 1px solid rgba(197, 217, 228, .85); border-radius: var(--radius-lg); box-shadow: var(--shadow); backdrop-filter: blur(16px); }
.calculator-panel, .results-panel { padding: 24px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.panel-heading > div { display: flex; align-items: center; gap: 10px; }
.panel-heading h2 { font-size: 20px; margin: 0; letter-spacing: -.02em; }
.step-label { display: inline-grid; place-items: center; min-width: 34px; height: 28px; padding: 0 9px; border-radius: 999px; background: #e7f2ff; color: var(--blue); font-size: 11px; font-weight: 900; letter-spacing: .08em; }
.text-button { border: 0; background: transparent; color: var(--ink-soft); padding: 6px 2px; font-weight: 700; }
.text-button:hover { color: var(--blue); }

.field-block { margin-bottom: 18px; }
.control-label, .input-field > span:first-child, .dose-fields label > span:first-child { display: block; color: #304b61; font-size: 12px; font-weight: 800; margin-bottom: 7px; }
.segmented { display: grid; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: #f7fafc; }
.shape-selector { grid-template-columns: repeat(4, 1fr); }
.unit-selector { grid-template-columns: repeat(2, minmax(0, 1fr)); width: min(330px, 100%); }
.segment { min-height: 44px; border: 0; border-radius: 10px; background: transparent; color: #486277; font-weight: 750; display: flex; align-items: center; justify-content: center; gap: 8px; transition: background .18s ease, color .18s ease, box-shadow .18s ease; }
.segment.active { color: var(--blue); background: #fff; box-shadow: 0 3px 10px rgba(44, 93, 125, .11); }
.shape-icon { display: inline-block; width: 21px; height: 16px; border: 2px solid currentColor; }
.round-icon { width: 18px; height: 18px; border-radius: 50%; }
.oval-icon { border-radius: 50%; }
.irregular-icon { width: 20px; height: 18px; border-radius: 55% 45% 62% 38% / 41% 65% 35% 59%; transform: rotate(-12deg); }

.compact-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; }
.compact-row .control-label { margin-bottom: 12px; }
.dimension-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; margin: 4px 0 16px; }
.input-shell, .mini-input { display: flex; align-items: stretch; width: 100%; background: #fff; border: 1px solid #d5e2ea; border-radius: 12px; overflow: hidden; transition: border-color .18s ease, box-shadow .18s ease; }
.input-shell:focus-within, .mini-input:focus-within { border-color: #7ca8f4; box-shadow: 0 0 0 4px rgba(35, 103, 223, .09); }
.input-shell input, .mini-input input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--ink); background: transparent; padding: 12px 13px; font-weight: 720; }
.input-shell .unit, .mini-input b, .mini-input select { display: grid; place-items: center; min-width: 46px; padding: 0 10px; border-left: 1px solid #e4edf2; color: #60788c; background: #f8fbfc; font-size: 12px; font-weight: 800; }
.mini-input select { border-top: 0; border-right: 0; border-bottom: 0; outline: 0; min-width: 76px; }
.hidden { display: none !important; }

.helper-toggle { width: 100%; min-height: 48px; border: 1px dashed #8db6f4; border-radius: 12px; background: #f8fbff; color: var(--blue); display: flex; align-items: center; justify-content: center; gap: 9px; font-weight: 800; }
.helper-toggle:hover { background: #f1f7ff; }
.helper-plus { font-size: 21px; line-height: 1; }
.chevron { margin-left: 3px; transition: transform .2s ease; }
.helper-toggle[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.helper-panel, .irregular-builder { margin-top: 14px; border: 1px solid #dbe8f0; border-radius: 14px; padding: 15px; background: #fbfdff; }
.helper-panel-heading, .builder-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.helper-panel h3, .builder-heading h3 { margin: 0; font-size: 15px; }
.helper-panel p, .builder-heading p { margin: 3px 0 0; color: var(--ink-soft); font-size: 12px; }
.small-button { white-space: nowrap; border: 1px solid #d1e0e8; border-radius: 9px; background: #fff; color: #315269; padding: 7px 10px; font-size: 12px; font-weight: 800; }
.small-button:hover { border-color: #9fbdce; }
.primary-light { color: var(--blue); border-color: #aec9fa; background: #f5f9ff; }
.depth-measurements { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 13px 0; }
.depth-point { display: flex; align-items: center; background: #fff; border: 1px solid #d8e5ec; border-radius: 10px; overflow: hidden; }
.depth-point input { width: 100%; min-width: 0; border: 0; outline: 0; padding: 9px 10px; font-weight: 700; }
.depth-point span { padding: 0 9px; color: var(--ink-soft); font-size: 11px; }
.helper-result-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: #315269; font-size: 13px; font-weight: 800; }

.irregular-builder { margin-top: 14px; }
.section-list { display: grid; gap: 10px; margin-top: 12px; }
.section-card { border: 1px solid #deeaef; border-radius: 12px; background: #fff; padding: 12px; }
.section-card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.section-card-header strong { font-size: 13px; }
.remove-section { border: 0; background: transparent; color: #8b5c63; font-size: 12px; font-weight: 800; }
.section-fields { display: grid; grid-template-columns: 1.1fr repeat(3, minmax(0, 1fr)); gap: 8px; }
.section-fields select, .section-fields input { width: 100%; min-width: 0; border: 1px solid #d8e5ec; border-radius: 9px; padding: 9px 10px; background: #fff; color: var(--ink); outline: 0; font-weight: 650; }
.section-fields .section-diameter { grid-column: span 2; }
.inline-message { min-height: 22px; margin-top: 10px; color: #a13e45; font-size: 12px; font-weight: 700; }
.calculate-button, .copy-button { width: 100%; min-height: 52px; border: 0; border-radius: 13px; display: flex; align-items: center; justify-content: center; gap: 9px; font-weight: 850; }
.calculate-button { color: #fff; background: linear-gradient(135deg, #2674ef, #165bd5); box-shadow: 0 12px 28px rgba(31, 103, 222, .23); }
.calculate-button:hover { filter: brightness(1.03); transform: translateY(-1px); }
.calculate-button svg, .copy-button svg { width: 20px; height: 20px; fill: currentColor; }

.results-heading-row { margin-bottom: 16px; }
.live-indicator { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; background: #ebf9f0; color: #17764d; font-size: 11px; font-weight: 850; }
.live-indicator span { width: 7px; height: 7px; border-radius: 50%; background: #1ca863; box-shadow: 0 0 0 4px rgba(28, 168, 99, .09); }
.result-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.result-card { min-height: 126px; padding: 16px; border-radius: 16px; border: 1px solid #dce8ef; background: #fbfdff; display: flex; align-items: center; gap: 13px; }
.volume-card { background: linear-gradient(135deg, #f6faff, #eef7ff); border-color: #cfe2f6; }
.result-icon { flex: 0 0 auto; width: 45px; height: 45px; border-radius: 14px; display: grid; place-items: center; }
.result-icon svg { width: 26px; height: 26px; fill: currentColor; }
.water-icon { color: #2276e8; background: #e4efff; }
.area-icon { color: #138ba0; background: #e4f6f8; }
.liner-icon { color: #299455; background: #e7f7eb; }
.pump-icon { color: #7656ce; background: #eee9fd; }
.treatment-icon { color: #326bd9; background: #e7efff; }
.result-label { display: block; color: #557085; font-size: 12px; font-weight: 800; margin-bottom: 2px; }
.result-card strong { display: block; font-size: clamp(19px, 2vw, 24px); letter-spacing: -.035em; line-height: 1.18; }
.result-card small { display: block; margin-top: 3px; color: #60788c; font-size: 12px; }
.pump-targets { margin: 11px 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pump-targets > div { border: 1px solid #e0e9ef; background: #fff; border-radius: 12px; padding: 10px 11px; }
.pump-targets span { display: block; color: #688093; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.pump-targets strong { display: block; margin-top: 2px; font-size: 13px; }

.treatment-box { margin-top: 11px; padding: 15px; border: 1px solid #dbe5f4; border-radius: 16px; background: linear-gradient(135deg, #fbfdff, #f8f5ff); }
.treatment-title { display: flex; align-items: center; gap: 11px; }
.treatment-title h3 { margin: 0; font-size: 15px; }
.treatment-title p { margin: 2px 0 0; color: var(--ink-soft); font-size: 11px; }
.dose-fields { display: grid; grid-template-columns: .8fr 1.2fr; gap: 9px; margin-top: 12px; }
.dose-result { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-top: 1px solid #e4eaf4; margin-top: 12px; padding-top: 12px; color: #536b7f; font-size: 12px; font-weight: 750; }
.dose-result strong { color: var(--blue); font-size: 18px; }
.formula-box { margin-top: 11px; border: 1px solid #cddff7; background: #f6faff; border-radius: 14px; padding: 13px 14px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.formula-box span:first-child { display: block; color: #5d7790; font-size: 11px; font-weight: 800; }
.formula-box strong { display: block; margin-top: 2px; font-size: 12px; line-height: 1.35; }
.formula-mark { flex: 0 0 auto; display: grid; place-items: center; width: 24px; height: 24px; border: 2px solid #4082e8; color: #4082e8; border-radius: 50%; font-size: 12px; font-weight: 900; }
.copy-button { margin-top: 11px; color: #285170; background: #fff; border: 1px solid #d6e4ec; min-height: 46px; }
.copy-button:hover { background: #f8fbfc; border-color: #b8cfda; }

.feature-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding: 16px 0 44px; }
.feature-card { display: flex; align-items: center; gap: 15px; min-height: 134px; padding: 20px; border: 1px solid rgba(205,221,230,.85); border-radius: 19px; background: rgba(255,255,255,.82); box-shadow: 0 12px 34px rgba(33,72,95,.07); }
.feature-card h2 { margin: 0; font-size: 16px; letter-spacing: -.02em; }
.feature-card p { margin: 5px 0 0; color: var(--ink-soft); font-size: 13px; }
.feature-art { flex: 0 0 auto; width: 64px; height: 64px; border-radius: 17px; position: relative; overflow: hidden; }
.section-art { background: #e8f7f2; }
.section-art::before { content: ""; position: absolute; inset: 14px 12px; border: 2px solid #178f78; border-radius: 55% 45% 62% 38% / 45% 58% 42% 55%; transform: rotate(-8deg); }
.section-art span { position: absolute; inset: 10px; border: 1px dashed rgba(23,143,120,.35); border-radius: 12px; }
.depth-art { background: #eaf4ff; }
.depth-art::before { content: ""; position: absolute; left: 13px; right: 13px; bottom: 13px; height: 26px; background: linear-gradient(180deg, #77c9ee, #2f94d4); border-radius: 5px; clip-path: polygon(0 18%, 16% 28%, 34% 17%, 52% 31%, 70% 18%, 86% 29%, 100% 20%, 100% 100%, 0 100%); }
.depth-art span { position: absolute; top: 9px; bottom: 9px; width: 2px; background: #356e98; left: 16px; }
.depth-art span:nth-child(2){ left: 25px; height: 20px; }
.depth-art span:nth-child(3){ left: 34px; height: 13px; }
.dose-art { background: #f0ecff; }
.dose-art::before { content: ""; position: absolute; width: 20px; height: 32px; border-radius: 5px 5px 8px 8px; background: #7557c8; left: 17px; top: 20px; }
.dose-art::after { content: ""; position: absolute; width: 12px; height: 8px; background: #7557c8; left: 21px; top: 12px; border-radius: 3px 3px 0 0; }
.dose-art span { position: absolute; width: 12px; height: 16px; right: 10px; bottom: 12px; background: #9b85dd; clip-path: path('M6 0 C6 0 12 8 12 11 A6 6 0 1 1 0 11 C0 8 6 0 6 0'); }

.site-footer { width: min(1420px, calc(100% - 40px)); margin: 0 auto; border-top: 1px solid #dce7ec; padding: 22px 0 28px; color: #678094; font-size: 12px; text-align: center; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: #163548; color: #fff; border-radius: 999px; padding: 10px 16px; font-size: 12px; font-weight: 750; box-shadow: 0 12px 36px rgba(16,42,67,.23); transition: opacity .2s ease, transform .2s ease; z-index: 20; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1040px) {
  .tool-grid { grid-template-columns: 1fr; }
  .calculator-panel, .results-panel { padding: 22px; }
  .feature-strip { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .site-header, main, .site-footer { width: min(100% - 24px, 1420px); }
  .site-header { min-height: 66px; }
  .brand { font-size: 17px; }
  .brand img { width: 36px; height: 36px; }
  .github-button { padding: 8px 11px; font-size: 13px; }
  .hero { padding-top: 26px; }
  .hero-copy { margin-bottom: 22px; text-align: left; }
  .hero h1 { font-size: 44px; }
  .hero-copy > p:last-child { font-size: 16px; margin-left: 0; }
  .shape-selector { grid-template-columns: repeat(2, 1fr); gap: 3px; }
  .compact-row { display: block; }
  .compact-row .control-label { margin-bottom: 7px; }
  .unit-selector { width: 100%; }
  .dimension-grid { grid-template-columns: 1fr; }
  .depth-measurements { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .result-grid { grid-template-columns: 1fr; }
  .result-card { min-height: 104px; }
  .pump-targets { grid-template-columns: 1fr; }
  .dose-fields { grid-template-columns: 1fr; }
  .section-fields { grid-template-columns: 1fr 1fr; }
  .section-fields .section-shape { grid-column: span 2; }
  .feature-strip { padding-bottom: 30px; }
}

@media (max-width: 430px) {
  .calculator-panel, .results-panel { padding: 17px; border-radius: 19px; }
  .panel-heading { margin-bottom: 17px; }
  .hero h1 { font-size: 39px; }
  .shape-selector { grid-template-columns: 1fr 1fr; }
  .segment { font-size: 13px; min-height: 42px; }
  .helper-panel-heading, .builder-heading, .helper-result-row { align-items: stretch; flex-direction: column; }
  .depth-measurements { grid-template-columns: 1fr; }
  .section-fields { grid-template-columns: 1fr; }
  .section-fields .section-shape, .section-fields .section-diameter { grid-column: auto; }
  .github-button svg { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }
