:root {
  --ink: #0b0f0d;
  --deep: #11302a;
  --teal: #1b6f6a;
  --sea: #2e8c84;
  --sand: #f4efe5;
  --panel: #ffffff;
  --line: rgba(17, 48, 42, 0.16);
  --muted: rgba(11, 15, 13, 0.66);
  --shadow: 0 18px 44px rgba(11, 15, 13, 0.11);
  --radius-lg: 26px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% -4%, rgba(99, 165, 147, 0.18), transparent 40%),
    radial-gradient(circle at 95% 8%, rgba(196, 225, 213, 0.24), transparent 36%),
    var(--sand);
}

body.help-open {
  overflow: hidden;
}

.page-shell {
  max-width: 1220px;
  margin: 0 auto;
  padding: 28px 24px 44px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 34px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: 1.35rem;
  font-weight: 600;
}

.brand img {
  border-radius: 10px;
}

.topbar-links {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.topbar-links a {
  color: rgba(11, 15, 13, 0.76);
  text-decoration: none;
  font-size: 0.92rem;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.topbar-links a:hover {
  color: var(--deep);
  border-color: rgba(17, 48, 42, 0.2);
  background: rgba(255, 255, 255, 0.68);
}

.help-fab {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  border: 1px solid rgba(27, 111, 106, 0.45);
  background: linear-gradient(135deg, #1d736d, #165a55);
  color: #fff;
  border-radius: 999px;
  padding: 11px 16px;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.2px;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(17, 48, 42, 0.28);
}

.help-fab:hover {
  transform: translateY(-1px);
  box-shadow: 0 15px 28px rgba(17, 48, 42, 0.32);
}

.help-fab:focus-visible {
  outline: 2px solid rgba(46, 140, 132, 0.45);
  outline-offset: 2px;
}

.help-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: end;
  padding: 14px;
}

.help-modal[hidden] {
  display: none;
}

.help-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 14, 12, 0.45);
  backdrop-filter: blur(2px);
}

.help-panel {
  position: relative;
  width: min(680px, 100%);
  max-height: min(82vh, 760px);
  overflow: auto;
  border: 1px solid rgba(17, 48, 42, 0.2);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 24px 54px rgba(11, 15, 13, 0.28);
  padding: 18px;
}

.help-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.help-kicker {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 1.1px;
  color: rgba(17, 48, 42, 0.62);
  font-weight: 700;
}

.help-close {
  border: 1px solid rgba(17, 48, 42, 0.22);
  background: rgba(255, 255, 255, 0.88);
  color: var(--deep);
  border-radius: 999px;
  padding: 7px 11px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.help-close:hover {
  border-color: rgba(27, 111, 106, 0.48);
}

.help-panel h2 {
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: 1.42rem;
  line-height: 1.18;
  margin-bottom: 8px;
}

.help-intro {
  color: rgba(11, 15, 13, 0.76);
  line-height: 1.56;
}

.help-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.help-grid article {
  border: 1px solid rgba(17, 48, 42, 0.13);
  border-radius: var(--radius-md);
  padding: 12px;
  background: rgba(255, 255, 255, 0.88);
}

.help-grid h3 {
  font-size: 0.96rem;
  margin-bottom: 6px;
}

.help-grid ul {
  margin-left: 18px;
  display: grid;
  gap: 6px;
  color: rgba(11, 15, 13, 0.8);
  line-height: 1.5;
}

.help-jumps {
  margin-top: 12px;
  border: 1px solid rgba(17, 48, 42, 0.13);
  border-radius: var(--radius-md);
  padding: 12px;
  background: rgba(244, 251, 248, 0.7);
}

.help-jumps p {
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: rgba(17, 48, 42, 0.66);
  font-weight: 700;
  margin-bottom: 8px;
}

.help-jumps div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.help-jumps button {
  border: 1px solid rgba(17, 48, 42, 0.2);
  background: #fff;
  color: var(--deep);
  border-radius: 999px;
  padding: 7px 10px;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}

.help-jumps button:hover {
  border-color: rgba(27, 111, 106, 0.5);
}

.help-actions {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.help-actions .primary-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 700;
  background: var(--teal);
  color: #fff;
}

.help-actions .primary-link:hover {
  background: #155d57;
}

.help-actions p {
  font-size: 0.86rem;
  color: rgba(11, 15, 13, 0.7);
  line-height: 1.5;
}

.help-actions a {
  color: #184f49;
  text-underline-offset: 2px;
}

.hero {
  margin-bottom: 24px;
  max-width: 760px;
}

.beginner-banner {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  text-decoration: none;
  margin-bottom: 12px;
  border: 1px solid rgba(27, 111, 106, 0.3);
  border-radius: 999px;
  padding: 8px 14px;
  background: rgba(27, 111, 106, 0.1);
  color: #124641;
}

.beginner-banner strong {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.9px;
}

.beginner-banner span {
  font-size: 0.92rem;
  font-weight: 600;
}

.beginner-banner:hover {
  background: rgba(27, 111, 106, 0.16);
  border-color: rgba(27, 111, 106, 0.5);
}

.eyebrow {
  display: inline-flex;
  border: 1px solid rgba(27, 111, 106, 0.25);
  background: rgba(27, 111, 106, 0.08);
  color: var(--teal);
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 0.74rem;
  letter-spacing: 1.3px;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 10px;
}

.hero h1 {
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: clamp(1.95rem, 4.8vw, 3rem);
  line-height: 1.08;
  margin-bottom: 9px;
}

.hero p {
  color: var(--muted);
  line-height: 1.62;
}

.app-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.95fr) minmax(340px, 1.1fr);
  gap: 18px;
}

.panel {
  background: rgba(255, 255, 255, 0.87);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(4px);
}

.controls {
  padding: 22px;
  display: grid;
  gap: 18px;
}

.results {
  padding: 22px;
  display: grid;
  gap: 16px;
}

.panel h2 {
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: 1.28rem;
}

.input-group {
  display: grid;
  gap: 9px;
}

.input-group.compact {
  gap: 8px;
}

.group-label {
  font-size: 0.76rem;
  color: rgba(17, 48, 42, 0.74);
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 700;
}

input,
select {
  width: 100%;
  border: 1px solid rgba(17, 48, 42, 0.26);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  padding: 12px;
}

input:focus,
select:focus {
  outline: 2px solid rgba(46, 140, 132, 0.42);
  border-color: rgba(46, 140, 132, 0.62);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-row button {
  border: 1px solid rgba(17, 48, 42, 0.2);
  background: rgba(255, 255, 255, 0.86);
  color: #173a33;
  border-radius: 999px;
  padding: 8px 11px;
  font-size: 0.83rem;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.2s ease, background 0.2s ease;
}

.chip-row button:hover {
  transform: translateY(-1px);
  border-color: rgba(27, 111, 106, 0.54);
}

.chip-row button.is-active {
  border-color: rgba(27, 111, 106, 0.88);
  background: rgba(27, 111, 106, 0.12);
  color: #0f3f3a;
  font-weight: 600;
}

.ghost-btn {
  border: 1px solid rgba(17, 48, 42, 0.3);
  background: rgba(255, 255, 255, 0.88);
  color: var(--deep);
  border-radius: 10px;
  padding: 11px 12px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.ghost-btn:hover {
  border-color: rgba(27, 111, 106, 0.58);
  background: #fff;
}

.result-hero {
  background: linear-gradient(140deg, rgba(185, 227, 207, 0.5), rgba(255, 255, 255, 0.9));
  border: 1px solid rgba(17, 48, 42, 0.16);
  border-radius: var(--radius-md);
  padding: 16px;
}

.result-label {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: rgba(17, 48, 42, 0.66);
  margin-bottom: 8px;
  font-weight: 700;
}

.result-main {
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: clamp(1.9rem, 4vw, 2.8rem);
  line-height: 0.98;
}

.result-sub {
  color: rgba(17, 48, 42, 0.72);
  margin-top: 6px;
  font-weight: 500;
}

.syringe-stage {
  border: 1px solid rgba(17, 48, 42, 0.16);
  border-radius: var(--radius-md);
  padding: 14px;
  background: rgba(255, 255, 255, 0.86);
  transition: border-color 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

.syringe-stage[data-level="warn"] {
  border-color: rgba(180, 126, 39, 0.45);
  background: rgba(255, 247, 234, 0.96);
}

.syringe-stage[data-level="danger"] {
  border-color: rgba(181, 70, 70, 0.5);
  background: rgba(255, 239, 239, 0.94);
}

.syringe-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: rgba(17, 48, 42, 0.7);
  margin-bottom: 6px;
}

.syringe-scale-labels {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  font-size: 0.68rem;
  color: rgba(17, 48, 42, 0.56);
  margin-bottom: 6px;
  padding: 0 8px 0 14px;
  letter-spacing: 0.2px;
}

.syringe-scale-labels span {
  transform: translateX(-50%);
  text-align: center;
}

.syringe-scale-labels span:first-child {
  transform: translateX(0);
  text-align: left;
}

.syringe-scale-labels span:last-child {
  transform: translateX(0);
  text-align: right;
}

.syringe-shell {
  display: flex;
  align-items: center;
  gap: 0;
}

.syringe-flange {
  width: 12px;
  height: 44px;
  border: 2px solid #8aa9a1;
  border-right: 0;
  border-radius: 8px 0 0 8px;
  background: linear-gradient(180deg, #f8fffc 0%, #eaf4f0 100%);
}

.syringe-barrel {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 62px;
  border-top: 2px solid #8aa9a1;
  border-bottom: 2px solid #8aa9a1;
  border-left: 2px solid #8aa9a1;
  border-right: 1px solid rgba(138, 169, 161, 0.7);
  overflow: hidden;
  background: linear-gradient(180deg, rgba(251, 255, 253, 0.9), rgba(241, 248, 245, 0.96));
}

.syringe-barrel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(74, 106, 98, 0.26) 0,
      rgba(74, 106, 98, 0.26) 1px,
      transparent 1px,
      transparent 5%
    ),
    repeating-linear-gradient(
      90deg,
      rgba(53, 84, 76, 0.52) 0,
      rgba(53, 84, 76, 0.52) 2px,
      transparent 2px,
      transparent 20%
    );
  pointer-events: none;
  z-index: 2;
}

.syringe-barrel::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: rgba(62, 96, 88, 0.18);
  transform: translateY(-50%);
  z-index: 2;
}

.syringe-liquid {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 10%;
  background: linear-gradient(270deg, rgba(58, 161, 148, 0.68) 0%, rgba(46, 140, 132, 0.82) 100%);
  box-shadow: inset 0 0 16px rgba(19, 95, 88, 0.2);
  transition: width 0.58s cubic-bezier(0.25, 0.8, 0.2, 1);
  overflow: hidden;
  z-index: 1;
}

.syringe-liquid::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    240deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.38) 42%,
    rgba(255, 255, 255, 0) 75%
  );
  transform: translateX(110%);
  animation: liquidSweep 2.4s linear infinite;
}

.syringe-plunger {
  position: absolute;
  left: 6px;
  top: 7px;
  bottom: 7px;
  width: 24px;
  border-radius: 8px;
  border: 1px solid rgba(60, 84, 78, 0.48);
  background: linear-gradient(180deg, #edf4f1 0%, #dce8e3 100%);
  transition: transform 0.58s cubic-bezier(0.25, 0.8, 0.2, 1);
  z-index: 3;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5) inset;
}

.syringe-readout {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 4;
  font-size: 0.78rem;
  font-weight: 700;
  color: rgba(17, 48, 42, 0.85);
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(17, 48, 42, 0.12);
  border-radius: 999px;
  padding: 4px 8px;
}

.syringe-tip {
  width: 26px;
  height: 24px;
  border-top: 2px solid #8aa9a1;
  border-bottom: 2px solid #8aa9a1;
  border-right: 2px solid #8aa9a1;
  border-radius: 0 8px 8px 0;
  background: linear-gradient(180deg, #f8fffc 0%, #ecf5f1 100%);
}

.syringe-needle {
  width: 96px;
  height: 2px;
  background: linear-gradient(90deg, #9eb8b1 0%, #b8cec8 100%);
  position: relative;
}

.syringe-needle::after {
  content: "";
  position: absolute;
  right: -5px;
  top: -3px;
  border-left: 6px solid #b8cec8;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
}

.syringe-caption {
  margin-top: 9px;
  font-size: 0.83rem;
  color: rgba(17, 48, 42, 0.72);
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.results-grid article {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(17, 48, 42, 0.14);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.tile-label {
  text-transform: uppercase;
  letter-spacing: 1.1px;
  color: rgba(17, 48, 42, 0.62);
  font-size: 0.72rem;
  margin-bottom: 7px;
  font-weight: 700;
}

.tile-value {
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: 1.17rem;
  font-weight: 600;
}

.tile-sub {
  color: rgba(17, 48, 42, 0.66);
  margin-top: 4px;
  font-size: 0.82rem;
}

.status-note {
  font-size: 0.87rem;
  border-radius: 11px;
  border: 1px solid rgba(17, 48, 42, 0.2);
  background: rgba(250, 253, 252, 0.92);
  color: rgba(17, 48, 42, 0.9);
  padding: 11px;
  min-height: 44px;
}

.status-note.warn {
  border-color: rgba(180, 126, 39, 0.42);
  background: rgba(255, 247, 234, 0.92);
  color: #7c4c13;
}

.status-note.danger {
  border-color: rgba(181, 70, 70, 0.46);
  background: rgba(255, 238, 238, 0.92);
  color: #842d2d;
}

.formula {
  border: 1px solid rgba(17, 48, 42, 0.17);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.8);
  padding: 10px;
}

.formula summary {
  cursor: pointer;
  color: #1f5c55;
  font-size: 0.88rem;
  font-weight: 600;
}

.formula pre {
  margin-top: 10px;
  color: #19443f;
  font-size: 0.82rem;
  line-height: 1.5;
  overflow-x: auto;
}

.disclaimer {
  margin-top: 14px;
  color: rgba(17, 48, 42, 0.74);
  font-size: 0.86rem;
  line-height: 1.5;
}

.disclaimer a {
  color: #184f49;
  text-underline-offset: 2px;
}

.disclaimer a:hover {
  color: #0f3e39;
}

.page-footer {
  margin-top: 12px;
  color: rgba(17, 48, 42, 0.68);
  font-size: 0.9rem;
}

.page-footer a {
  color: #184f49;
  text-underline-offset: 2px;
}

@keyframes liquidSweep {
  from {
    transform: translateX(110%);
  }

  to {
    transform: translateX(-110%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .help-fab,
  .syringe-liquid,
  .syringe-plunger {
    transition: none;
  }

  .syringe-liquid::after {
    animation: none;
  }
}

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

@media (max-width: 760px) {
  .page-shell {
    padding: 16px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 24px;
  }

  .topbar-links {
    width: 100%;
    justify-content: flex-start;
  }

  .results-grid {
    grid-template-columns: 1fr;
  }

  .syringe-needle {
    width: 54px;
  }

  .help-panel {
    max-height: min(86vh, 760px);
  }

  .help-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .controls,
  .results {
    padding: 16px;
  }

  .beginner-banner {
    display: grid;
    gap: 2px;
    border-radius: 14px;
    padding: 10px 12px;
  }

  .beginner-banner strong {
    font-size: 0.75rem;
  }

  .beginner-banner span {
    font-size: 0.88rem;
  }

  .syringe-shell {
    align-items: center;
  }

  .syringe-barrel {
    height: 54px;
  }

  .syringe-flange {
    height: 38px;
  }

  .syringe-tip {
    height: 20px;
    width: 18px;
  }

  .syringe-needle {
    width: 34px;
  }

  .syringe-readout {
    font-size: 0.72rem;
    padding: 3px 7px;
  }

  .help-fab {
    right: 12px;
    bottom: 12px;
    padding: 10px 14px;
    font-size: 0.88rem;
  }

  .help-modal {
    padding: 10px;
  }

  .help-panel {
    padding: 14px;
    width: 100%;
    max-height: 88vh;
  }

  .help-actions .primary-link {
    width: 100%;
  }
}
