:root {
  --bg-top: #e8f2ef;
  --bg-bottom: #f7f4ee;
  --ink: #1c2b28;
  --muted: #5a6b66;
  --line: #c5d4cf;
  --surface: rgba(255, 255, 255, 0.78);
  --accent: #0f7a6c;
  --accent-deep: #0a574d;
  --warn: #9a4a1a;
  --shadow: 0 18px 50px rgba(28, 43, 40, 0.08);
  --radius: 18px;
  --font: "DM Sans", sans-serif;
  --display: "Fraunces", Georgia, serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #d7ebe4 0%, transparent 55%),
    radial-gradient(900px 420px at 100% 0%, #f0e6d4 0%, transparent 50%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  line-height: 1.45;
}

.page {
  width: min(720px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.5rem 0 3rem;
}

.hero {
  margin-bottom: 1.75rem;
  animation: rise 0.7s ease both;
}

.brand {
  margin: 0 0 0.55rem;
  font-family: var(--display);
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--accent-deep);
}

.hero h1 {
  margin: 0 0 0.65rem;
  font-size: clamp(1.15rem, 2.6vw, 1.35rem);
  font-weight: 600;
  color: var(--ink);
}

.lede {
  margin: 0;
  max-width: 38rem;
  color: var(--muted);
  font-size: 1.02rem;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 1rem;
  animation: rise 0.7s ease 0.08s both;
}

.tab {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.75rem 1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease,
    transform 0.2s ease;
}

.tab:hover {
  transform: translateY(-1px);
}

.tab.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.panel {
  display: none;
  gap: 1rem;
  animation: rise 0.55s ease both;
}

.panel.is-active {
  display: grid;
}

.card,
.result {
  background: var(--surface);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(197, 212, 207, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}

.field {
  display: grid;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.field span {
  font-size: 0.92rem;
  font-weight: 600;
}

.field small {
  color: var(--muted);
  font-size: 0.82rem;
}

.field-group {
  margin: 0 0 1rem;
  padding: 0;
  border: 0;
}

.field-group legend {
  padding: 0;
  margin-bottom: 0.55rem;
  font-size: 0.92rem;
  font-weight: 600;
}

.field-group > small {
  display: block;
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.conc-row {
  display: grid;
  grid-template-columns: 1.2fr 0.85fr auto 1fr;
  gap: 0.55rem;
  align-items: end;
}

.conc-row .field {
  margin-bottom: 0;
}

.conc-sep {
  display: grid;
  place-items: center;
  height: 2.85rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--muted);
}

.syringe-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
}

.chip {
  position: relative;
  cursor: pointer;
}

.chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.chip span {
  display: block;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 0.75rem 0.4rem;
  font-weight: 700;
  line-height: 1.25;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.chip em {
  display: block;
  margin-top: 0.2rem;
  font-style: normal;
  font-weight: 500;
  font-size: 0.78rem;
  color: var(--muted);
}

.chip:has(input:checked) span {
  border-color: var(--accent);
  background: #e7f5f1;
  color: var(--accent-deep);
}

.chip:has(input:checked) em {
  color: var(--accent-deep);
}

.chip:has(input:focus-visible) span {
  box-shadow: 0 0 0 3px rgba(15, 122, 108, 0.15);
}

.result-sub {
  margin: -0.15rem 0 0.55rem;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 600;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  padding: 0.8rem 0.9rem;
  font: inherit;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 122, 108, 0.15);
}

.direction {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.radio {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  font-weight: 500;
}

.radio:has(input:checked) {
  border-color: var(--accent);
  background: #e7f5f1;
  color: var(--accent-deep);
}

.radio input {
  width: auto;
  accent-color: var(--accent);
}

.btn {
  appearance: none;
  width: 100%;
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  padding: 0.9rem 1rem;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.btn:hover {
  background: var(--accent-deep);
  transform: translateY(-1px);
}

.result {
  animation: rise 0.45s ease both;
}

.result-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.result-value {
  margin: 0.35rem 0 0.5rem;
  font-family: var(--display);
  font-size: clamp(1.8rem, 5vw, 2.35rem);
  letter-spacing: -0.02em;
  color: var(--accent-deep);
}

.result-formula {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.result.is-warn {
  border-color: #e4b89a;
  background: #fff7f1;
}

.result.is-warn .result-value {
  color: var(--warn);
}

.syringe {
  display: flex;
  align-items: center;
  gap: 0;
  margin-top: 1.1rem;
}

.syringe-barrel {
  position: relative;
  width: min(100%, 280px);
  height: 42px;
  border: 2px solid #6f8680;
  border-radius: 8px 4px 4px 8px;
  overflow: hidden;
  background: #f4faf8;
}

.syringe-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: linear-gradient(90deg, #7ec9bc, #0f7a6c);
  transition: width 0.45s ease;
}

.syringe-marks {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 8px;
  pointer-events: none;
}

.syringe-marks span {
  width: 1px;
  height: 100%;
  background: rgba(28, 43, 40, 0.18);
}

.syringe-tip {
  width: 28px;
  height: 14px;
  border-radius: 0 8px 8px 0;
  background: #6f8680;
}

.syringe-caption {
  margin: 0.55rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.disclaimer {
  margin-top: 1.75rem;
  color: var(--muted);
  font-size: 0.88rem;
  animation: rise 0.7s ease 0.14s both;
}

.disclaimer p {
  margin: 0;
  padding: 0.9rem 1rem;
  border-left: 3px solid var(--accent);
  background: rgba(255, 255, 255, 0.45);
  border-radius: 0 12px 12px 0;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 560px) {
  .page {
    width: min(100% - 1.25rem, 720px);
    padding-top: 1.5rem;
  }

  .tabs {
    grid-template-columns: 1fr;
  }

  .conc-row {
    grid-template-columns: 1fr 1fr;
  }

  .conc-sep {
    display: none;
  }
}
