/* ============================================================
   FormuVet web calculators (/calculators/...)
   Loaded after style.css and built on its design tokens.

   Each calculator has its own colour. The key colours sit on [data-accent]
   (the page <body> and each calculator key) as:
     --a1   deep shade (text sits on it)     --a2   bright shade
     --a-rgb  the mid shade as r,g,b          --a-ink  accent text on the page
   ============================================================ */

:root { --a1: #047857; --a2: #34D399; --a-rgb: 16, 185, 129; --a-ink: #047857; --a-ink-dark: #6EE7B7; }
[data-accent="fluid"]       { --a1: #0369A1; --a2: #38BDF8; --a-rgb: 14, 165, 233;  --a-ink: #0369A1; --a-ink-dark: #7DD3FC; }
[data-accent="calories"]    { --a1: #C2410C; --a2: #FBBF24; --a-rgb: 234, 88, 12;   --a-ink: #C2410C; --a-ink-dark: #FDBA74; }
[data-accent="chocolate"]   { --a1: #3B1A0B; --a2: #B0643A; --a-rgb: 146, 64, 14;   --a-ink: #7C2D12; --a-ink-dark: #E8B48C; }
[data-accent="pregnancy"]   { --a1: #BE185D; --a2: #F9A8D4; --a-rgb: 236, 72, 153;  --a-ink: #BE185D; --a-ink-dark: #F9A8D4; }
[data-accent="aniongap"]    { --a1: #4C1D95; --a2: #A78BFA; --a-rgb: 124, 58, 237;  --a-ink: #6D28D9; --a-ink-dark: #C4B5FD; }
[data-accent="osmolality"]  { --a1: #115E59; --a2: #2DD4BF; --a-rgb: 20, 184, 166;  --a-ink: #0F766E; --a-ink-dark: #5EEAD4; }
[data-accent="bicarbonate"] { --a1: #365314; --a2: #A3E635; --a-rgb: 101, 163, 13;  --a-ink: #4D7C0F; --a-ink-dark: #BEF264; }
body.theme-dark, body.theme-dark [data-accent] { --a-ink: var(--a-ink-dark); }

.fvc-page {
  position: relative;
  z-index: 2;
  padding: 7.5rem var(--space-6) 0;
}
/* Tinted top of the page, faded out so it has no hard bottom edge. */
.fvc-page::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 0 auto 0;
  height: 680px;
  background:
    radial-gradient(900px 420px at 8% 0%, rgba(var(--a-rgb), 0.16), transparent 70%),
    var(--gradient-hero);
  -webkit-mask-image: linear-gradient(180deg, #000 55%, transparent);
  mask-image: linear-gradient(180deg, #000 55%, transparent);
  pointer-events: none;
}
.fvc-wrap { max-width: 1080px; margin: 0 auto; }

/* Calculator pages use plain links in the pill nav, with one marked current. */
.fvc-nav-current {
  color: var(--on-primary, #fff) !important;
  background: var(--gradient-primary) !important;
  box-shadow: var(--shadow-green) !important;
}

/* ---- Page head ---- */
.fvc-crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-5);
}
.fvc-crumbs a { color: var(--color-text-secondary); text-decoration: underline; text-underline-offset: 3px; }
.fvc-crumbs a:hover { color: var(--color-text); }

.fvc-head { display: flex; align-items: flex-start; gap: var(--space-5); }
.fvc-badge {
  flex: none;
  display: grid;
  place-items: center;
  width: 64px; height: 64px;
  border-radius: 20px;
  color: #fff;
  background: linear-gradient(160deg, var(--a2) -25%, var(--a1) 75%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.45), inset 0 -5px 0 rgba(0,0,0,0.22), 0 12px 22px -10px rgba(var(--a-rgb), 0.75);
}
.fvc-badge svg { width: 34px; height: 34px; filter: drop-shadow(0 2px 2px rgba(0,0,0,0.25)); }

.fvc-title {
  font-family: var(--font-family-title);
  font-size: clamp(1.6rem, 3.4vw, 2.35rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: var(--color-text);
  max-width: 24ch;
  text-wrap: balance;
}
.fvc-title--hub { font-size: clamp(1.9rem, 4.4vw, 3rem); max-width: 20ch; }
.fvc-lede {
  margin-top: var(--space-2);
  max-width: 60ch;
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--color-text-secondary);
}
.fvc-title--hub + .fvc-lede { margin-top: var(--space-3); font-size: var(--font-size-lg); }

/* ---- Calculator card ---- */
.fvc-card {
  margin-top: var(--space-8);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(var(--a-rgb), 0.06);
  overflow: hidden;
}
.fvc-form { padding: var(--space-8); }
.fvc-out {
  padding: var(--space-8);
  background: var(--color-bg-alt);
  border-left: 1px solid var(--color-border);
  scroll-margin-top: 6rem;
}

.fvc-group + .fvc-group { margin-top: var(--space-6); padding-top: var(--space-6); border-top: 1px solid var(--color-border); }
.fvc-group__title { font-family: var(--font-family-title); font-size: var(--font-size-base); font-weight: 700; color: var(--color-text); }
.fvc-group__hint { margin-top: 2px; font-size: var(--font-size-sm); color: var(--color-text-secondary); }
.fvc-group__title + .fvc-field, .fvc-group__hint + .fvc-field, .fvc-group__title + .fvc-row, .fvc-group__hint + .fvc-row { margin-top: var(--space-4); }

.fvc-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-4); }
.fvc-row + .fvc-row, .fvc-row + .fvc-field, .fvc-field + .fvc-row, .fvc-field + .fvc-field { margin-top: var(--space-4); }
.fvc-row > .fvc-field + .fvc-field { margin-top: 0; }
.fvc-field[hidden] { display: none; }

.fvc-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  min-height: 1.75rem;
  margin-bottom: var(--space-2);
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text);
}
.fvc-label small { font-weight: 500; color: var(--color-text-secondary); }

.fvc-input {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.fvc-input:focus-within { border-color: rgb(var(--a-rgb)); box-shadow: 0 0 0 3px rgba(var(--a-rgb), 0.2); }
.fvc-input input, .fvc-input select {
  flex: 1;
  min-width: 0;
  height: 48px;
  padding: 0 var(--space-4);
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--color-text);
  font: inherit;
  font-size: var(--font-size-base);
  font-variant-numeric: tabular-nums;
}
.fvc-input select { cursor: pointer; padding-right: var(--space-2); margin-right: var(--space-2); }
body.theme-dark .fvc-input select option { background: #0F172A; color: #F8FAFC; }
body.theme-dark .fvc-input input[type="date"] { color-scheme: dark; }
.fvc-input input::placeholder { color: var(--color-text-muted); }
.fvc-input__unit { padding-right: var(--space-4); font-size: var(--font-size-sm); font-weight: 600; color: var(--color-text-secondary); white-space: nowrap; }
.fvc-hint { margin-top: var(--space-2); font-size: var(--font-size-xs); line-height: 1.5; color: var(--color-text-secondary); }

/* Segmented control (species, units) */
.fvc-seg {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-bg-alt);
}
.fvc-seg label { position: relative; cursor: pointer; }
.fvc-seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.fvc-seg span {
  display: block;
  padding: 0.55rem 1.25rem;
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
  transition: background var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
}
.fvc-seg input:checked + span {
  background: linear-gradient(160deg, var(--a2) -60%, var(--a1) 85%);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.3), 0 4px 10px -4px rgba(var(--a-rgb), 0.7);
}
.fvc-seg input:focus-visible + span { outline: 2px solid rgb(var(--a-rgb)); outline-offset: 2px; }
.fvc-seg--sm span { padding: 0.2rem 0.7rem; font-size: var(--font-size-xs); }
.fvc-seg--wide { display: flex; }
.fvc-seg--wide label { flex: 1; text-align: center; }

/* Switch row (add potassium) */
.fvc-switch {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
}
.fvc-switch__text { flex: 1; }
.fvc-switch__text strong { display: block; font-size: var(--font-size-sm); color: var(--color-text); }
.fvc-switch__text span { display: block; font-size: var(--font-size-xs); color: var(--color-text-secondary); margin-top: 2px; }
.fvc-switch input { position: absolute; opacity: 0; }
.fvc-switch__track { position: relative; flex: none; width: 44px; height: 26px; border-radius: 13px; background: var(--color-border-hover); transition: background var(--transition-fast); }
.fvc-switch__track::after {
  content: "";
  position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  transition: transform var(--transition-fast);
}
.fvc-switch input:checked ~ .fvc-switch__track { background: var(--a1); }
.fvc-switch input:checked ~ .fvc-switch__track::after { transform: translateX(18px); }
.fvc-switch input:focus-visible ~ .fvc-switch__track { outline: 2px solid rgb(var(--a-rgb)); outline-offset: 2px; }

/* The Calculate button: a key that presses down. */
.fvc-submit {
  position: relative;
  width: 100%;
  margin-top: var(--space-6);
  height: 56px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(160deg, var(--a2) -70%, var(--a1) 70%);
  color: #fff;
  font: inherit;
  font-size: var(--font-size-base);
  font-weight: 700;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 1px rgba(0,0,0,0.25);
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.35), inset 0 -5px 0 rgba(0,0,0,0.22), 0 12px 24px -12px rgba(var(--a-rgb), 0.8);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.fvc-submit:hover { filter: brightness(1.06); }
.fvc-submit:active, .fvc-submit.is-pressed {
  transform: translateY(3px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.3), inset 0 -2px 0 rgba(0,0,0,0.22), 0 4px 10px -6px rgba(var(--a-rgb), 0.8);
}
.fvc-submit:focus-visible { outline: 3px solid rgb(var(--a-rgb)); outline-offset: 3px; }

.fvc-error {
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid #FCA5A5;
  background: #FEF2F2;
  color: #991B1B;
  font-size: var(--font-size-sm);
  font-weight: 500;
}
body.theme-dark .fvc-error { background: rgba(127, 29, 29, 0.35); border-color: #7F1D1D; color: #FECACA; }
.fvc-error[hidden] { display: none; }

/* ---- Results ---- */
.fvc-empty {
  display: grid;
  place-items: center;
  align-content: center;
  gap: var(--space-4);
  min-height: 100%;
  padding: var(--space-8) var(--space-4);
  text-align: center;
}
.fvc-empty[hidden] { display: none; }
.fvc-empty__icon { width: 72px; height: 72px; color: rgba(var(--a-rgb), 0.45); stroke-width: 1.5; }
.fvc-empty p { max-width: 30ch; font-size: var(--font-size-sm); line-height: 1.6; color: var(--color-text-secondary); }

.fvc-res > * + * { margin-top: var(--space-4); }
.fvc-res { animation: fvcIn 0.35s ease-out both; }
@keyframes fvcIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Headline result */
.fvc-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  border-radius: 18px;
  border: 1px solid rgba(var(--a-rgb), 0.28);
  background: linear-gradient(150deg, rgba(var(--a-rgb), 0.18), rgba(var(--a-rgb), 0.05));
  overflow: hidden;
}
.fvc-hero--single { grid-template-columns: minmax(0, 1fr); }
.fvc-hero > div { padding: var(--space-5); }
.fvc-hero > div + div { border-left: 1px solid rgba(var(--a-rgb), 0.22); }
.fvc-hero__label { display: block; font-size: var(--font-size-sm); font-weight: 600; color: var(--a-ink); }
.fvc-hero__value {
  display: block;
  margin-top: 2px;
  font-family: var(--font-family-title);
  font-size: 2.6rem;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.fvc-hero__value small { font-family: var(--font-family); font-size: var(--font-size-base); font-weight: 600; letter-spacing: 0; color: var(--color-text-secondary); margin-left: 5px; white-space: nowrap; }
.fvc-hero > div + div .fvc-hero__value { font-size: 1.7rem; }
.fvc-hero__help { display: block; margin-top: var(--space-2); font-size: var(--font-size-xs); line-height: 1.5; color: var(--color-text-secondary); }

.fvc-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  background: rgba(var(--a-rgb), 0.12);
  color: var(--a-ink);
  font-size: var(--font-size-xs);
  font-weight: 600;
}
.fvc-sec { margin-top: var(--space-5) !important; font-size: var(--font-size-sm); font-weight: 700; color: var(--color-text); }

.fvc-chips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-2); margin-top: var(--space-2) !important; }
.fvc-chip { padding: var(--space-2) var(--space-2); border: 1px solid var(--color-border); border-radius: 12px; background: var(--color-bg); text-align: center; }
.fvc-chip b { display: block; font-size: var(--font-size-xs); color: var(--color-text-secondary); font-weight: 600; }
.fvc-chip span { display: block; font-size: var(--font-size-base); font-weight: 700; color: var(--color-text); font-variant-numeric: tabular-nums; }

.fvc-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-2); margin-top: var(--space-2) !important; }
.fvc-pair--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fvc-tilecell { padding: var(--space-3) var(--space-4); border: 1px solid var(--color-border); border-radius: 14px; background: var(--color-bg); }
.fvc-tilecell b { display: block; font-size: var(--font-size-xs); font-weight: 600; color: var(--color-text-secondary); }
.fvc-tilecell strong { display: block; margin-top: 2px; font-family: var(--font-family-title); font-size: 1.35rem; font-weight: 800; color: var(--color-text); font-variant-numeric: tabular-nums; }
.fvc-tilecell strong small { font-family: var(--font-family); font-size: var(--font-size-xs); font-weight: 600; color: var(--color-text-secondary); margin-left: 3px; }
.fvc-tilecell span { display: block; margin-top: 2px; font-size: var(--font-size-xs); color: var(--color-text-secondary); }

.fvc-foot { font-size: var(--font-size-xs); line-height: 1.5; color: var(--color-text-secondary); }

/* Plain stats (calories, lab calculators) */
.fvc-stats { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-2); }
.fvc-stat { padding: var(--space-3) var(--space-4); border: 1px solid var(--color-border); border-radius: 14px; background: var(--color-bg); }
.fvc-stat--wide { grid-column: 1 / -1; }
.fvc-stat__label { display: block; font-size: var(--font-size-xs); font-weight: 600; color: var(--color-text-secondary); }
.fvc-stat__value { display: block; margin-top: 2px; font-family: var(--font-family-title); font-size: 1.35rem; font-weight: 800; line-height: 1.2; color: var(--color-text); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.fvc-stat__value small { font-family: var(--font-family); font-size: var(--font-size-xs); font-weight: 600; color: var(--color-text-secondary); margin-left: 3px; }
.fvc-stat--text .fvc-stat__value { font-size: 1.05rem; line-height: 1.35; }
.fvc-stat__help { display: block; margin-top: var(--space-1); font-size: var(--font-size-xs); line-height: 1.45; color: var(--color-text-secondary); }

/* Collapsible extras inside the results */
.fvc-more { border: 1px solid var(--color-border); border-radius: 14px; background: var(--color-bg); }
.fvc-more summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text);
  cursor: pointer;
}
.fvc-more summary::-webkit-details-marker { display: none; }
.fvc-more summary svg { width: 18px; height: 18px; color: var(--a-ink); transition: transform 0.2s ease; }
.fvc-more[open] summary svg { transform: rotate(180deg); }
.fvc-more summary:focus-visible { outline: 2px solid rgb(var(--a-rgb)); outline-offset: 2px; border-radius: 14px; }
.fvc-more__body { padding: 0 var(--space-4) var(--space-4); }
.fvc-more .fvc-table { margin-top: 0; }

.fvc-table { width: 100%; border-collapse: collapse; font-size: var(--font-size-sm); background: var(--color-bg); }
.fvc-table th, .fvc-table td { padding: var(--space-2) var(--space-3); text-align: left; border-bottom: 1px solid var(--color-border); }
.fvc-table tr:last-child td { border-bottom: 0; }
.fvc-table th { font-size: var(--font-size-xs); font-weight: 600; color: var(--color-text-secondary); background: var(--color-bg-alt); }
.fvc-table td { color: var(--color-text); font-variant-numeric: tabular-nums; }
.fvc-table td:not(:first-child), .fvc-table th:not(:first-child) { text-align: right; font-weight: 600; white-space: nowrap; }
.fvc-table td small { display: block; font-weight: 400; color: var(--color-text-secondary); }
.fvc-tablewrap { overflow-x: auto; border: 1px solid var(--color-border); border-radius: 12px; }
.fvc-tablewrap .fvc-table { border: 0; }

.fvc-note {
  padding: var(--space-3) var(--space-4);
  border-radius: 14px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  font-size: var(--font-size-sm);
  line-height: 1.55;
  color: var(--color-text);
}
.fvc-note strong { display: block; margin-bottom: 2px; }
.fvc-note--info { border-color: #BFDBFE; background: #EFF6FF; }
.fvc-note--warning { border-color: #FDE68A; background: #FFFBEB; }
.fvc-note--critical { border-color: #FCA5A5; background: #FEF2F2; }
body.theme-dark .fvc-note--info { border-color: #1E3A8A; background: rgba(30, 58, 138, 0.3); }
body.theme-dark .fvc-note--warning { border-color: #78350F; background: rgba(120, 53, 15, 0.3); }
body.theme-dark .fvc-note--critical { border-color: #7F1D1D; background: rgba(127, 29, 29, 0.35); }

.fvc-list { padding-left: 1.1rem; font-size: var(--font-size-sm); line-height: 1.55; color: var(--color-text-secondary); }
.fvc-list li + li { margin-top: var(--space-2); }

/* Chocolate: risk card with a dose gauge */
.fvc-risk { padding: var(--space-5); border-radius: 18px; border: 1px solid; }
.fvc-risk__band { display: flex; align-items: center; gap: var(--space-2); font-size: var(--font-size-sm); font-weight: 700; }
.fvc-risk__band::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.fvc-risk__dose { margin-top: var(--space-1); font-family: var(--font-family-title); font-size: 2.6rem; font-weight: 800; line-height: 1.05; letter-spacing: -0.03em; color: var(--color-text); font-variant-numeric: tabular-nums; }
.fvc-risk__dose small { font-family: var(--font-family); font-size: var(--font-size-base); font-weight: 600; letter-spacing: 0; margin-left: 6px; }
.fvc-risk__text { margin-top: var(--space-2); font-size: var(--font-size-sm); line-height: 1.5; color: var(--color-text); }
.fvc-risk--none { border-color: #A7F3D0; background: #ECFDF5; color: #047857; }
.fvc-risk--mild { border-color: #FDE68A; background: #FFFBEB; color: #92400E; }
.fvc-risk--moderate { border-color: #FED7AA; background: #FFF7ED; color: #9A3412; }
.fvc-risk--severe { border-color: #FCA5A5; background: #FEF2F2; color: #B91C1C; }
.fvc-risk--lethal { border-color: #F87171; background: #FEE2E2; color: #991B1B; }
body.theme-dark .fvc-risk--none { border-color: #065F46; background: rgba(6, 95, 70, 0.3); color: #6EE7B7; }
body.theme-dark .fvc-risk--mild { border-color: #78350F; background: rgba(120, 53, 15, 0.3); color: #FCD34D; }
body.theme-dark .fvc-risk--moderate { border-color: #7C2D12; background: rgba(124, 45, 18, 0.35); color: #FDBA74; }
body.theme-dark .fvc-risk--severe, body.theme-dark .fvc-risk--lethal { border-color: #7F1D1D; background: rgba(127, 29, 29, 0.4); color: #FCA5A5; }

.fvc-gauge { position: relative; margin: var(--space-4) 0 var(--space-5); }
.fvc-gauge__track {
  height: 10px;
  border-radius: 999px;
  /* 0-150 mg/kg: low, mild (20), moderate (40), severe (60), lethal (100+) */
  background: linear-gradient(90deg, #10B981 0 13.33%, #F59E0B 13.33% 26.67%, #F97316 26.67% 40%, #EF4444 40% 66.67%, #7F1D1D 66.67% 100%);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.2);
}
.fvc-gauge__mark {
  position: absolute;
  top: -5px;
  left: var(--pos);
  width: 20px; height: 20px;
  margin-left: -10px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--color-text);
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  animation: fvcSlide 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes fvcSlide { from { left: 0; } }
.fvc-gauge__ticks { position: relative; height: 14px; margin-top: 6px; font-size: 0.68rem; font-weight: 600; color: var(--color-text-secondary); }
.fvc-gauge__ticks span { position: absolute; transform: translateX(-50%); }
.fvc-gauge__ticks span:first-child { transform: none; }
.fvc-gauge__ticks span:last-child { transform: translateX(-100%); }

/* Pregnancy: a timeline from mating to the due window */
.fvc-gantt { display: grid; grid-template-columns: minmax(0, 8.5rem) minmax(0, 1fr); column-gap: var(--space-3); margin-top: 1.6rem !important; }
.fvc-gantt__label { display: flex; align-items: center; min-height: 30px; font-size: var(--font-size-xs); font-weight: 600; color: var(--color-text-secondary); line-height: 1.25; }
.fvc-gantt__track { position: relative; min-height: 30px; }
.fvc-gantt__track::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 6px; margin-top: -3px; border-radius: 999px; background: var(--color-border); opacity: 0.6; }
.fvc-gantt__bar {
  position: absolute;
  top: 50%;
  height: 10px;
  margin-top: -5px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--a2), rgb(var(--a-rgb)));
}
.fvc-gantt__bar--open { background: linear-gradient(90deg, rgb(var(--a-rgb)), rgba(var(--a-rgb), 0.15)); }
.fvc-gantt__bar--due { height: 14px; margin-top: -7px; background: repeating-linear-gradient(135deg, var(--a1) 0 5px, rgb(var(--a-rgb)) 5px 10px); }
.fvc-gantt__likely { position: absolute; top: 50%; width: 4px; height: 22px; margin-top: -11px; border-radius: 2px; background: var(--color-text); }
.fvc-gantt__today { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--color-text); }
.fvc-gantt__today--first::after {
  content: attr(data-label);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 2px;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--color-text);
  color: var(--color-bg);
  font-size: 0.65rem;
  font-weight: 700;
  white-space: nowrap;
}
.fvc-gantt__axis { position: relative; height: 16px; font-size: 0.65rem; font-weight: 600; color: var(--color-text-muted); }
.fvc-gantt__axis span { position: absolute; transform: translateX(-50%); white-space: nowrap; }

/* ---- Reviewer line and the sources button ---- */
.fvc-meta { position: relative; display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); margin-top: var(--space-4); }
.fvc-meta__line { display: flex; align-items: flex-start; gap: var(--space-2); font-size: var(--font-size-xs); line-height: 1.5; color: var(--color-text-secondary); }
.fvc-meta__line svg { flex: none; width: 16px; height: 16px; margin-top: 1px; color: var(--a-ink); }
.fvc-src { flex: none; }
.fvc-src__btn {
  list-style: none;
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}
.fvc-src__btn::-webkit-details-marker { display: none; }
.fvc-src__btn svg { width: 18px; height: 18px; }
.fvc-src__btn:hover, .fvc-src[open] .fvc-src__btn { color: #fff; border-color: transparent; background: linear-gradient(160deg, var(--a2) -60%, var(--a1) 85%); }
.fvc-src__btn:focus-visible { outline: 2px solid rgb(var(--a-rgb)); outline-offset: 2px; }
.fvc-src__panel {
  position: absolute;
  z-index: 30;
  right: 0;
  top: calc(100% + 8px);
  width: min(480px, calc(100vw - 2rem));
  padding: var(--space-5);
  border: 1px solid var(--color-border);
  border-radius: 18px;
  background: var(--color-bg);
  box-shadow: var(--shadow-xl);
  font-size: var(--font-size-sm);
  line-height: 1.55;
  color: var(--color-text-secondary);
  animation: fvcIn 0.18s ease-out both;
}
.fvc-src__title { font-family: var(--font-family-title); font-weight: 700; color: var(--color-text); }
.fvc-src__panel p + p, .fvc-src__panel p + ol, .fvc-src__panel ol + p { margin-top: var(--space-3); }
.fvc-src__panel ol { padding-left: 1.2rem; }
.fvc-src__panel li + li { margin-top: var(--space-2); }
.fvc-src__panel a { color: var(--a-ink); text-decoration: underline; text-underline-offset: 3px; }
.fvc-src__small { font-size: var(--font-size-xs); }

.fvc-owner {
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-radius: 14px;
  border: 1px solid #FDE68A;
  background: #FFFBEB;
  font-size: var(--font-size-sm);
  line-height: 1.55;
  color: var(--color-text);
}
body.theme-dark .fvc-owner { border-color: #78350F; background: rgba(120, 53, 15, 0.3); }

/* ---- Collapsible write-up under the calculator ---- */
.fvc-accs { max-width: 820px; margin-top: var(--space-10); border-top: 1px solid var(--color-border); }
.fvc-acc { border-bottom: 1px solid var(--color-border); }
.fvc-acc > summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-1);
  cursor: pointer;
}
.fvc-acc > summary::-webkit-details-marker { display: none; }
.fvc-acc > summary:focus-visible { outline: 2px solid rgb(var(--a-rgb)); outline-offset: 2px; border-radius: 8px; }
.fvc-acc > summary h2 { font-family: var(--font-family-title); font-size: var(--font-size-lg); font-weight: 700; line-height: 1.3; color: var(--color-text); }
.fvc-acc__chev {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(var(--a-rgb), 0.12);
  color: var(--a-ink);
  transition: transform 0.2s ease, background 0.2s ease;
}
.fvc-acc__chev svg { width: 18px; height: 18px; }
.fvc-acc > summary:hover .fvc-acc__chev { background: rgba(var(--a-rgb), 0.22); }
.fvc-acc[open] .fvc-acc__chev { transform: rotate(180deg); }
.fvc-acc__body { padding: 0 var(--space-1) var(--space-6); animation: fvcIn 0.22s ease-out both; }
.fvc-acc__body h3 { margin-top: var(--space-5); font-size: var(--font-size-base); font-weight: 700; color: var(--color-text); }
.fvc-acc__body h3:first-child { margin-top: 0; }
.fvc-acc__body p, .fvc-acc__body li { font-size: var(--font-size-sm); line-height: 1.7; color: var(--color-text-secondary); }
.fvc-acc__body p { margin-top: var(--space-3); }
.fvc-acc__body p:first-child { margin-top: 0; }
.fvc-acc__body h3 + p { margin-top: var(--space-1); }
.fvc-acc__body ul { margin-top: var(--space-3); padding-left: 1.2rem; }
.fvc-acc__body li + li { margin-top: var(--space-2); }
.fvc-acc__body strong { color: var(--color-text); }
.fvc-acc__body a { color: var(--a-ink); text-decoration: underline; text-underline-offset: 3px; }
.fvc-acc__body .fvc-tablewrap { margin-top: var(--space-3); }
.fvc-formula {
  margin-top: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-left: 4px solid rgb(var(--a-rgb));
  border-radius: 0 12px 12px 0;
  background: rgba(var(--a-rgb), 0.07);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--color-text);
  overflow-x: auto;
}
.fvc-example { margin-top: var(--space-1); padding: var(--space-4) var(--space-5); border-radius: 14px; background: var(--color-bg-alt); border: 1px solid var(--color-border); }

/* ---- Calculator keys (hub and "More calculators") ---- */
/* One key per row: easy to scan and tap on a phone, full width on a desktop. */
.fvc-keys { margin-top: var(--space-8); display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.fvc-key {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--space-5);
  min-height: 96px;
  padding: 16px 22px 20px 16px;
  border-radius: 24px;
  overflow: hidden;
  color: #fff;
  text-decoration: none;
  background:
    radial-gradient(120% 90% at 100% 0%, var(--a2) 0%, transparent 62%),
    linear-gradient(165deg, var(--a2) -35%, var(--a1) 72%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.45),
    inset 0 -7px 0 rgba(0,0,0,0.22),
    0 16px 28px -14px rgba(var(--a-rgb), 0.75),
    0 2px 5px rgba(15,23,42,0.12);
  transform: perspective(1200px) rotateX(var(--rx, 0deg)) rotateY(calc(var(--ry, 0deg) * 0.35)) translateY(var(--ty, 0px));
  transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.18s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}
/* Gloss on the top half, and a light sweep on hover. */
.fvc-key::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 52%;
  z-index: -1;
  background: linear-gradient(180deg, rgba(255,255,255,0.26), rgba(255,255,255,0));
  pointer-events: none;
}
.fvc-key::after {
  content: "";
  position: absolute;
  top: -60%;
  left: -40%;
  width: 34%;
  height: 220%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.32), transparent);
  transform: rotate(18deg) translateX(-150%);
  pointer-events: none;
}
.fvc-key:hover { --ty: -3px; box-shadow: inset 0 1px 0 rgba(255,255,255,0.45), inset 0 -7px 0 rgba(0,0,0,0.22), 0 24px 34px -16px rgba(var(--a-rgb), 0.85), 0 2px 5px rgba(15,23,42,0.12); }
.fvc-key:hover::after { transform: rotate(18deg) translateX(560%); transition: transform 0.7s ease; }
.fvc-key:active, .fvc-key.is-launch {
  --ty: 5px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.35), inset 0 -2px 0 rgba(0,0,0,0.22), 0 6px 12px -8px rgba(var(--a-rgb), 0.8);
  transition-duration: 0.08s;
}
.fvc-key:focus-visible { outline: 3px solid rgb(var(--a-rgb)); outline-offset: 3px; }

.fvc-key__icon {
  display: grid;
  place-items: center;
  width: 58px; height: 58px;
  border-radius: 18px;
  background: rgba(255,255,255,0.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.45), inset 0 -2px 0 rgba(0,0,0,0.12), 0 8px 16px -8px rgba(0,0,0,0.45);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.fvc-key__icon svg { width: 31px; height: 31px; filter: drop-shadow(0 2px 2px rgba(0,0,0,0.28)); }
.fvc-key:hover .fvc-key__icon { transform: translateY(-2px) rotate(-6deg) scale(1.04); }
.fvc-key.is-launch .fvc-key__icon { transform: scale(0.9); }
.fvc-key__mark { position: absolute; z-index: -1; right: 28px; top: 50%; width: 120px; height: 120px; margin-top: -60px; opacity: 0.17; transform: rotate(-12deg); }
.fvc-key__mark svg { width: 100%; height: 100%; stroke-width: 1.4; }
.fvc-key__name {
  font-family: var(--font-family-title);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-shadow: 0 1px 2px rgba(0,0,0,0.28);
  font-size: 1.3rem;
}

.fvc-related { margin-top: var(--space-16); }
.fvc-related h2 { font-family: var(--font-family-title); font-size: var(--font-size-xl); font-weight: 700; color: var(--color-text); }
.fvc-keys--small { margin-top: var(--space-4); }
.fvc-keys--small .fvc-key { min-height: 76px; border-radius: 20px; padding: 12px 18px 16px 12px; gap: var(--space-4); }
.fvc-keys--small .fvc-key__icon { width: 46px; height: 46px; border-radius: 14px; }
.fvc-keys--small .fvc-key__icon svg { width: 25px; height: 25px; }
.fvc-keys--small .fvc-key__name { font-size: 1.1rem; }
.fvc-keys--small .fvc-key__mark { width: 90px; height: 90px; margin-top: -45px; }

/* Tap particles. Drawn in a layer above the page; gone in under a second. */
.fvc-fx { position: fixed; left: 0; top: 0; width: 0; height: 0; z-index: 400; pointer-events: none; }
.fvc-p {
  position: absolute;
  left: 0; top: 0;
  will-change: transform, opacity;
  animation: fvcFly var(--d, 560ms) cubic-bezier(0.12, 0.75, 0.3, 1) var(--delay, 0ms) both;
}
@keyframes fvcFly {
  0%   { transform: translate(-50%, -50%) translate(0, 0) rotate(0deg) scale(var(--s0, 1)); opacity: 1; }
  70%  { opacity: 1; }
  100% { transform: translate(-50%, -50%) translate(var(--x), var(--y)) rotate(var(--r, 0deg)) scale(var(--s1, 0.5)); opacity: 0; }
}
.fvc-p--ring {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 3px solid var(--c, rgba(56, 189, 248, 0.9));
  animation-name: fvcRing;
  animation-timing-function: cubic-bezier(0.1, 0.7, 0.3, 1);
}
@keyframes fvcRing {
  0%   { transform: translate(-50%, -50%) scale(0.4); opacity: 0.95; }
  100% { transform: translate(-50%, -50%) scale(var(--grow, 7)); opacity: 0; border-width: 1px; }
}
.fvc-p--drop { width: 13px; height: 17px; border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%; background: linear-gradient(180deg, #E0F2FE, #0EA5E9 75%); box-shadow: inset 0 -2px 2px rgba(3, 105, 161, 0.45), 0 0 0 1.5px rgba(255,255,255,0.75); }
.fvc-p--kib { width: 16px; height: 13px; border-radius: 46% 54% 50% 50%; background: radial-gradient(circle at 35% 30%, #F0BE84, #9A6332 72%); box-shadow: inset -1px -2px 0 rgba(0,0,0,0.25), 0 0 0 1.5px rgba(255,255,255,0.75), 0 3px 6px rgba(0,0,0,0.25); }
.fvc-p--choc { width: 16px; height: 16px; border-radius: 3px; background: #5B2A14; box-shadow: inset 2px 2px 0 rgba(255,255,255,0.2), inset -2px -2px 0 rgba(0,0,0,0.4), 0 0 0 1.5px rgba(255,255,255,0.7), 0 3px 6px rgba(0,0,0,0.25); }
.fvc-p--heart { width: 20px; height: 20px; color: #F472B6; filter: drop-shadow(0 0 1.5px #fff) drop-shadow(0 2px 3px rgba(0,0,0,0.2)); }
.fvc-p--heart svg { display: block; width: 100%; height: 100%; }
.fvc-p--ion { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #fff; color: #6D28D9; font: 800 14px/1 var(--font-family); box-shadow: 0 2px 6px rgba(76, 29, 149, 0.35); }
.fvc-p--ion.is-neg { background: #4C1D95; color: #fff; }
.fvc-p--dot { width: 10px; height: 10px; border-radius: 50%; background: #2DD4BF; box-shadow: 0 0 0 1.5px rgba(255,255,255,0.8), 0 0 8px rgba(45, 212, 191, 0.8); }
.fvc-p--bub { width: 17px; height: 17px; border-radius: 50%; border: 2.5px solid #A3E635; box-shadow: 0 0 0 1px rgba(255,255,255,0.7); background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.8) 0 2px, rgba(255,255,255,0.15) 3px); }

/* ---- Static "get the app" block ---- */
.fvc-get {
  max-width: 1080px;
  margin: var(--space-16) auto 0;
  padding: var(--space-10) var(--space-8);
  border-radius: var(--radius-xl);
  background: #0F172A;
  color: #fff;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: var(--space-8);
  align-items: center;
}
body.theme-dark .fvc-get { background: #1E293B; }
.fvc-get h2 { font-family: var(--font-family-title); font-size: var(--font-size-2xl); font-weight: 700; line-height: 1.2; }
.fvc-get p { margin-top: var(--space-3); font-size: var(--font-size-base); line-height: 1.6; color: #CBD5E1; }
.fvc-get__btns { display: flex; flex-wrap: wrap; gap: var(--space-3); justify-content: flex-end; }
.fvc-get .btn-store { border: 1px solid rgba(255,255,255,0.18); }

/* ---- Download banner (after each calculation) ---- */
.fvc-banner {
  position: fixed;
  z-index: 150;
  left: 50%;
  bottom: var(--space-5);
  width: min(760px, calc(100vw - 2rem));
  transform: translate(-50%, calc(100% + 2rem));
  opacity: 0;
  visibility: hidden;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: var(--space-4);
  align-items: center;
  padding: var(--space-5) 3.25rem var(--space-5) var(--space-5);
  border-radius: var(--radius-xl);
  background: #0F172A;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 24px 70px rgba(2, 6, 23, 0.45);
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease, visibility 0s linear 0.45s;
}
.fvc-banner--open { transform: translate(-50%, 0); opacity: 1; visibility: visible; transition-delay: 0s; }
.fvc-banner__icon { width: 56px; height: 56px; border-radius: 14px; }
.fvc-banner__title { font-family: var(--font-family-title); font-size: var(--font-size-lg); font-weight: 700; line-height: 1.25; }
.fvc-banner__text { margin-top: 4px; font-size: var(--font-size-sm); line-height: 1.5; color: #CBD5E1; }
.fvc-banner__btns { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }
.fvc-banner .btn-store { padding: 0.5rem 0.9rem; gap: 0.5rem; border-radius: 0.75rem; border: 1px solid rgba(255,255,255,0.2); box-shadow: none; }
.fvc-banner .btn-store svg { width: 22px; height: 22px; }
.fvc-banner .btn-store__label { font-size: 0.62rem; }
.fvc-banner .btn-store__name { font-size: 0.9rem; }
.fvc-banner__qr { text-align: center; }
.fvc-banner__qr svg { display: block; width: 92px; height: 92px; padding: 6px; border-radius: 10px; background: #fff; }
.fvc-banner__qr span { display: block; margin-top: 6px; font-size: 0.68rem; color: #CBD5E1; }
.fvc-banner__close {
  position: absolute; top: 10px; right: 10px;
  width: 34px; height: 34px;
  border: 0; border-radius: 50%;
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 1.25rem; line-height: 1;
  cursor: pointer;
}
.fvc-banner__close:hover { background: rgba(255,255,255,0.22); }
.fvc-banner__close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.fvc-footer-links { display: flex; flex-wrap: wrap; gap: var(--space-6); }

/* ---- Responsive ---- */
@media (max-width: 900px) {
  /* minmax(0, ...) so a wide field can never push the card past the screen. */
  .fvc-card { grid-template-columns: minmax(0, 1fr); }
  .fvc-out { border-left: 0; border-top: 1px solid var(--color-border); }
  .fvc-empty { padding: var(--space-5) var(--space-4); }
  .fvc-empty__icon { width: 52px; height: 52px; }
  .fvc-get { grid-template-columns: 1fr; }
  .fvc-get__btns { justify-content: flex-start; }
}
@media (max-width: 640px) {
  .fvc-page { padding: 5.5rem var(--space-4) 0; }
  .fvc-head { gap: var(--space-4); }
  .fvc-badge { width: 52px; height: 52px; border-radius: 16px; }
  .fvc-badge svg { width: 28px; height: 28px; }
  .fvc-form, .fvc-out { padding: var(--space-5); }
  /* One field per line on a phone, so a typed value is never cut short. */
  .fvc-row { grid-template-columns: minmax(0, 1fr); }
  .fvc-hero__value, .fvc-risk__dose { font-size: 2.2rem; }
  .fvc-hero > div { padding: var(--space-4); }
  .fvc-hero > div + div .fvc-hero__value { font-size: 1.35rem; }
  .fvc-hero > div + div .fvc-hero__value small { font-size: var(--font-size-xs); margin-left: 3px; }
  .fvc-chips { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fvc-gantt { grid-template-columns: minmax(0, 6.5rem) minmax(0, 1fr); }
  .fvc-keys { gap: 10px; }
  .fvc-key { min-height: 84px; padding: 13px 18px 17px 13px; border-radius: 22px; gap: var(--space-4); }
  .fvc-key__icon { width: 52px; height: 52px; border-radius: 16px; }
  .fvc-key__icon svg { width: 28px; height: 28px; }
  .fvc-key__name { font-size: 1.15rem; }
  .fvc-key__mark { right: 10px; width: 96px; height: 96px; margin-top: -48px; }
  .fvc-keys--small { gap: 8px; }
  .fvc-keys--small .fvc-key { min-height: 70px; }
  .fvc-keys--small .fvc-key__icon { width: 44px; height: 44px; border-radius: 13px; }
  .fvc-keys--small .fvc-key__icon svg { width: 24px; height: 24px; }
  .fvc-keys--small .fvc-key__name { font-size: 1.02rem; }
  .fvc-get { padding: var(--space-8) var(--space-5); }
  .fvc-banner {
    left: 0; bottom: 0; width: 100%;
    transform: translateY(100%);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    grid-template-columns: auto minmax(0, 1fr);
    padding: var(--space-5) 3rem calc(var(--space-5) + env(safe-area-inset-bottom)) var(--space-4);
  }
  .fvc-banner--open { transform: translateY(0); }
  .fvc-banner__icon { width: 48px; height: 48px; }
  .fvc-banner__qr { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .fvc-banner, .fvc-res, .fvc-key, .fvc-key__icon, .fvc-submit, .fvc-acc__body, .fvc-src__panel, .fvc-gauge__mark { transition: none; animation: none; }
  .fvc-key::after { display: none; }
  .fvc-key { transform: none; }
}
