/* ==========================================================================
   Healthy Man — tools.css
   Shared styles for the 24 tool pages (load after style.css).
   --------------------------------------------------------------------------
   01. Tool page layout (form panel + result panel)
   02. Form controls: segmented toggle, input with unit, choice cards, range
   03. Form actions
   04. Result card (empty state, value, status pills, stats, actions)
   05. Gauge (semi-circle) & scale bar
   06. Charts (donut/line containers + legend)
   07. Tables inside results, zones, comparison bars
   08. Timeline (pregnancy) & calendar (ovulation)
   09. Trackers: water glasses, logs, checklists, habit grid
   10. Breathing circle, timer ring, quiz
   11. Related tools & tool disclaimer
   12. Print
   ========================================================================== */

/* ==========================================================================
   01. Tool page layout
   ========================================================================== */
.tool-section { padding-bottom: clamp(2.5rem, 2rem + 3vw, 4rem); }

.tool-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: clamp(1.25rem, 1rem + 1vw, 1.75rem); align-items: start; }
.tool-layout > * { min-width: 0; }
@media (min-width: 992px) {
  .tool-layout { grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); }
  .tool-layout-wide { grid-template-columns: 1fr; }
}

.calc-panel,
.calc-result {
  position: relative;
  padding: clamp(1.25rem, 1rem + 1.2vw, 2rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-md);
}
.calc-panel::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--cat), color-mix(in srgb, var(--cat) 10%, transparent));
  border-radius: var(--r-xl) var(--r-xl) 0 0;
}
/* Result stays in view beside the form on wide screens */
@media (min-width: 992px) {
  .tool-layout:not(.tool-layout-wide) > .calc-result { position: sticky; top: calc(var(--header-h) + 1.25rem); }
}
.calc-head { display: flex; align-items: center; gap: 0.85rem; margin-bottom: 1.5rem; }
.calc-head .tool-card-icon { width: 48px; height: 48px; font-size: 1.45rem; }
.calc-title { margin: 0; font-size: var(--fs-xl); }
.calc-subtitle { margin: 0.15rem 0 0; font-size: var(--fs-sm); color: var(--text-muted); }

.calc-form { display: grid; gap: 1.35rem; }
.calc-form fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }

/* ==========================================================================
   02. Form controls
   ========================================================================== */

/* Segmented toggle (radio buttons styled as pills) */
.segmented {
  position: relative;
  display: inline-grid;
  grid-auto-columns: 1fr;
  grid-auto-flow: column;
  gap: 0.25rem;
  width: 100%;
  padding: 0.3rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
}
@media (min-width: 480px) { .segmented { width: auto; min-width: 280px; } }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 42px;
  padding: 0 1rem;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  border-radius: var(--r-full);
  cursor: pointer;
  transition: color 0.2s, background-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.segmented label:hover { color: var(--text); }
.segmented input:checked + label { color: var(--on-primary); background: var(--primary-bg); box-shadow: 0 6px 14px -6px var(--primary-glow); }
.segmented input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }
@media (max-width: 399.98px) { .segmented label { padding: 0 0.5rem; font-size: 0.8rem; white-space: nowrap; } }

/* Input with unit suffix */
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap input { padding-right: 3.6rem !important; }
.input-unit {
  position: absolute;
  right: 0.45rem;
  display: grid;
  place-items: center;
  min-width: 2.6rem;
  height: calc(100% - 0.9rem);
  padding: 0 0.55rem;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text-muted);
  background: var(--surface-2);
  border-radius: var(--r-sm);
  pointer-events: none;
}
.input-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }

/* Choice cards (radio / checkbox as cards: gender, goal, activity) */
.choice-group { display: grid; gap: 0.6rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)); }
.choice-group-list { grid-template-columns: 1fr; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice label {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  height: 100%;
  min-height: 52px;
  padding: 0.65rem 0.9rem;
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
  background: var(--input-bg);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r);
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s, transform 0.15s;
}
.choice label:hover { border-color: color-mix(in srgb, var(--brand) 55%, var(--border-strong)); }
.choice label small { display: block; font-weight: 500; color: var(--text-subtle); }
.choice-emoji { font-size: 1.3rem; line-height: 1; }
.choice-check {
  display: grid;
  place-items: center;
  flex: none;
  width: 20px;
  height: 20px;
  margin-left: auto;
  border: 2px solid var(--border-strong);
  border-radius: 50%;
  transition: border-color 0.2s, background-color 0.2s;
}
.choice input[type='checkbox'] + label .choice-check { border-radius: 6px; }
.choice input:checked + label { background: var(--brand-soft); border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.choice input:checked + label .choice-check { background: var(--brand-strong); border-color: var(--brand-strong); }
.choice input:checked + label .choice-check::after { content: ''; width: 8px; height: 5px; margin-top: -2px; border: solid #fff; border-width: 0 0 2px 2px; transform: rotate(-45deg); }
.choice input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }
.field.has-error .choice label { border-color: var(--danger-fill); }

/* Range slider */
.range-row { display: flex; align-items: center; gap: 1rem; }
.range-row output { min-width: 4.5rem; padding: 0.4rem 0.6rem; font-weight: 700; text-align: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); }
input[type='range'].range { flex: 1; height: 44px; background: transparent; cursor: pointer; }

/* Advanced options disclosure */
.advanced { border: 1px dashed var(--border-strong); border-radius: var(--r); }
.advanced summary { display: flex; align-items: center; gap: 0.5rem; min-height: 46px; padding: 0 1rem; font-size: var(--fs-sm); font-weight: 700; color: var(--link); cursor: pointer; list-style: none; }
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary::before { content: '+'; display: grid; place-items: center; width: 22px; height: 22px; background: var(--brand-soft); border-radius: 50%; transition: transform 0.2s; }
.advanced[open] summary::before { content: '–'; }
.advanced-body { display: grid; gap: 1.1rem; padding: 0 1rem 1rem; }

/* ==========================================================================
   03. Form actions
   ========================================================================== */
.form-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; padding-top: 0.25rem; }
.form-actions .btn-primary { flex: 1 1 220px; }
.form-note { display: flex; align-items: center; gap: 0.45rem; margin: 0; font-size: var(--fs-xs); color: var(--text-subtle); }
.form-note .icon { width: 15px; height: 15px; color: var(--brand); }

/* ==========================================================================
   04. Result card
   ========================================================================== */
.calc-result { overflow: hidden; }
.calc-result::after {
  content: '';
  position: absolute;
  z-index: 0;
  top: -140px;
  right: -140px;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, color-mix(in srgb, var(--cat) 14%, transparent), transparent 70%);
  pointer-events: none;
}
.calc-result > * { position: relative; z-index: 1; }
.calc-result:focus { outline: none; }

/* Empty state */
.result-empty { display: grid; place-items: center; gap: 0.75rem; min-height: 280px; padding: 1.5rem 1rem; text-align: center; color: var(--text-muted); }
.result-empty-icon {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  font-size: 2.4rem;
  background: color-mix(in srgb, var(--cat) 12%, transparent);
  border: 2px dashed color-mix(in srgb, var(--cat) 35%, transparent);
  border-radius: 50%;
  animation: empty-bob 3.2s ease-in-out infinite;
}
@keyframes empty-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.result-empty h2,
.result-empty h3 { margin: 0; font-size: var(--fs-lg); color: var(--text); }
.result-empty p { max-width: 34ch; margin: 0; font-size: var(--fs-sm); }
.result-empty .result-empty-title { margin: 0; font: 600 var(--fs-lg)/1.3 var(--font-head); color: var(--text); }
.result-section-title { margin: 0 0 0.6rem; font-size: var(--fs-sm); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-subtle); }

/* Reveal animation (class toggled by HM.utils.showResult) */
.calc-result.is-revealed .result-body > * { animation: result-in 0.55s var(--ease) both; }
.calc-result.is-revealed .result-body > *:nth-child(2) { animation-delay: 0.06s; }
.calc-result.is-revealed .result-body > *:nth-child(3) { animation-delay: 0.12s; }
.calc-result.is-revealed .result-body > *:nth-child(4) { animation-delay: 0.18s; }
.calc-result.is-revealed .result-body > *:nth-child(5) { animation-delay: 0.24s; }
.calc-result.is-revealed .result-body > *:nth-child(n + 6) { animation-delay: 0.3s; }
@keyframes result-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.result-body { display: grid; gap: 1.25rem; }
.result-head { display: grid; gap: 0.5rem; justify-items: start; }
.result-kicker { margin: 0; font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-subtle); }
.result-value {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.5rem;
  margin: 0;
  font: 800 clamp(2.75rem, 2rem + 3vw, 4rem)/1 var(--font-head);
  letter-spacing: -0.04em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.result-value-sm { font-size: clamp(2rem, 1.6rem + 1.6vw, 2.6rem); }
.result-unit { font-size: 1.05rem; font-weight: 600; letter-spacing: 0; color: var(--text-muted); }
.result-text { margin: 0; color: var(--text-muted); line-height: 1.7; }
.result-text strong { color: var(--text); }

/* Status pill: colour + icon + text (never colour-only) */
.status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  font-size: var(--fs-sm);
  font-weight: 700;
  line-height: 1.3;
  border: 1px solid transparent;
  border-radius: var(--r-full);
}
.status .icon { width: 16px; height: 16px; }
.status-good { color: var(--good-ink); background: var(--good-bg); border-color: var(--good-border); }
.status-info { color: var(--info-ink); background: var(--info-bg); border-color: var(--info-border); }
.status-caution { color: var(--caution-ink); background: var(--caution-bg); border-color: var(--caution-border); }
.status-warning { color: var(--warning-ink); background: var(--warning-bg); border-color: var(--warning-border); }
.status-danger { color: var(--danger-ink); background: var(--danger-bg); border-color: var(--danger-border); }

/* Mini stat grid */
.result-stats { display: grid; gap: 0.65rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)); }
.stat-box { padding: 0.85rem 1rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); }
.stat-box-label { display: block; font-size: var(--fs-xs); font-weight: 600; color: var(--text-subtle); }
.stat-box-value { display: block; margin-top: 0.2rem; font: 700 1.25rem/1.25 var(--font-head); color: var(--text); font-variant-numeric: tabular-nums; }
.stat-box-value small { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); }
.stat-box.is-highlight { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 40%, transparent); }

/* Result list (key → value rows) */
.result-list { display: grid; margin: 0; padding: 0; list-style: none; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.result-list li { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.75rem 1rem; font-size: var(--fs-sm); }
.result-list li + li { border-top: 1px solid var(--border); }
.result-list strong { font-family: var(--font-head); font-size: 1rem; font-variant-numeric: tabular-nums; }

/* Actions */
.result-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.result-actions .btn { flex: 1 1 auto; }
.result-note { margin: 0; font-size: var(--fs-xs); color: var(--text-subtle); }

/* ==========================================================================
   05. Gauge & scale bar
   ========================================================================== */
.gauge { width: 100%; max-width: 340px; margin-inline: auto; }
.gauge-svg { display: block; width: 100%; height: auto; overflow: visible; }
.gauge-track { fill: none; stroke: var(--surface-2); stroke-width: 18; stroke-linecap: round; }
.gauge-band { fill: none; stroke-width: 16; }
.gauge-band.level-good { stroke: var(--good-fill); }
.gauge-band.level-info { stroke: var(--info-fill); }
.gauge-band.level-caution { stroke: var(--caution-fill); }
.gauge-band.level-warning { stroke: var(--warning-fill); }
.gauge-band.level-danger { stroke: var(--danger-fill); }
.gauge-needle {
  fill: var(--text);
  transform-box: view-box;
  transform-origin: 100px 100px;
  transition: transform 1.2s var(--ease-spring);
}
.gauge-hub { fill: var(--surface); }
.gauge-tick { font: 600 7px var(--font-body); fill: var(--text-subtle); }
.gauge-end { font: 700 8px var(--font-body); fill: var(--text-subtle); }

.scale { position: relative; padding-top: 2.4rem; }
.scale-track { display: flex; height: 12px; overflow: hidden; border-radius: var(--r-full); }
.scale-seg + .scale-seg { border-left: 2px solid var(--surface); }
.level-good { background-color: var(--good-fill); }
.level-info { background-color: var(--info-fill); }
.level-caution { background-color: var(--caution-fill); }
.level-warning { background-color: var(--warning-fill); }
.level-danger { background-color: var(--danger-fill); }
.scale-marker {
  position: absolute;
  top: 0;
  left: var(--pos, 0%);
  height: calc(2.4rem + 12px);
  transition: left 1.1s var(--ease-spring);
}
.scale-marker::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: -2px;
  width: 4px;
  height: 22px;
  background: var(--text);
  border: 2px solid var(--surface);
  border-radius: 4px;
  box-sizing: content-box;
  transform: translateX(-2px);
}
.scale-bubble {
  position: absolute;
  top: 0;
  left: 0;
  padding: 0.2rem 0.55rem;
  font: 700 var(--fs-sm)/1.3 var(--font-head);
  white-space: nowrap;
  color: var(--bg);
  background: var(--text);
  border-radius: var(--r-sm);
  transform: translateX(calc(var(--pos, 0%) * -1));
}
.scale-ticks { position: relative; height: 1.6rem; }
.scale-tick { position: absolute; top: 0.35rem; font-size: var(--fs-xs); font-weight: 600; color: var(--text-subtle); transform: translateX(-50%); }
.scale-names { display: flex; font-size: 0.7rem; font-weight: 600; color: var(--text-muted); text-align: center; line-height: 1.25; }
.scale-names span { padding: 0 2px; }

/* Simple progress bar */
.progress { height: 12px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-full); }
.progress-bar { width: var(--value, 0%); height: 100%; background: var(--primary-bg); border-radius: inherit; transition: width 0.8s var(--ease); }
.progress-label { display: flex; justify-content: space-between; margin-bottom: 0.4rem; font-size: var(--fs-sm); font-weight: 600; color: var(--text-muted); }

/* ==========================================================================
   06. Charts (Chart.js canvases)
   ========================================================================== */
.chart-box { position: relative; width: 100%; min-height: 240px; }
.chart-box canvas { width: 100% !important; }
.chart-donut { position: relative; width: min(100%, 260px); aspect-ratio: 1; margin-inline: auto; }
.chart-donut canvas { position: relative; z-index: 1; }
/* CSS fallback donut when Chart.js cannot load (offline / blocked CDN) */
.donut-fallback {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--donut, conic-gradient(var(--surface-2) 0 100%));
  -webkit-mask: radial-gradient(farthest-side, transparent 64%, #000 65%);
  mask: radial-gradient(farthest-side, transparent 64%, #000 65%);
}
.result-split { display: grid; gap: 1.25rem; align-items: center; }
@media (min-width: 480px) { .result-split { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); } }
.input-trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem; }
.input-trio .input-wrap input { padding-right: 2.4rem !important; }
.input-trio .input-unit { min-width: 1.8rem; padding: 0 0.35rem; }
.mini-label { display: block; margin-bottom: 0.3rem; font-size: var(--fs-xs); font-weight: 700; color: var(--text-muted); }
.chart-donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.chart-donut-center strong { font: 800 1.8rem/1 var(--font-head); color: var(--text); }
.chart-donut-center span { font-size: var(--fs-xs); font-weight: 600; color: var(--text-subtle); }

.legend { display: grid; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.legend li { display: flex; align-items: center; gap: 0.65rem; padding: 0.6rem 0.85rem; font-size: var(--fs-sm); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); }
.legend-swatch { flex: none; width: 14px; height: 14px; background: var(--swatch, var(--brand)); border-radius: 4px; }
.legend-name { flex: 1; font-weight: 600; }
.legend-value { font-family: var(--font-head); font-weight: 700; font-variant-numeric: tabular-nums; }
.legend-value small { font-weight: 600; color: var(--text-subtle); }

/* ==========================================================================
   07. Result tables, heart-rate zones, comparison bars
   ========================================================================== */
.result-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.result-table th,
.result-table td { padding: 0.65rem 0.75rem; text-align: left; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.result-table th { font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-subtle); background: var(--surface-2); }
.result-table tr:last-child td { border-bottom: 0; }
.result-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r); }

/* Heart-rate zones (5 colour-coded rows) */
.zone-list { display: grid; gap: 0.55rem; margin: 0; padding: 0; list-style: none; }
.zone {
  --zone: var(--info-fill);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 1rem;
  background: color-mix(in srgb, var(--zone) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--zone) 35%, transparent);
  border-left: 5px solid var(--zone);
  border-radius: var(--r);
}
.zone[data-zone='1'] { --zone: #94a3b8; }
.zone[data-zone='2'] { --zone: var(--info-fill); }
.zone[data-zone='3'] { --zone: var(--good-fill); }
.zone[data-zone='4'] { --zone: var(--warning-fill); }
.zone[data-zone='5'] { --zone: var(--danger-fill); }
.zone-num { display: grid; place-items: center; width: 34px; height: 34px; font: 800 0.95rem/1 var(--font-head); color: #fff; background: var(--zone); border-radius: 50%; }
.zone[data-zone='1'] .zone-num,
.zone[data-zone='3'] .zone-num { color: #0b1b33; }
.zone-name { font-weight: 700; }
.zone-name small { display: block; font-weight: 500; color: var(--text-muted); }
.zone-range { font: 700 1rem/1.2 var(--font-head); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.zone-range small { display: block; font: 600 0.7rem var(--font-body); color: var(--text-subtle); }
@media (max-width: 479.98px) {
  .zone { grid-template-columns: auto 1fr; row-gap: 0.35rem; }
  .zone-range { grid-column: 2; text-align: left; }
  .zone-range small { display: inline; margin-left: 0.4rem; }
}

/* Horizontal comparison bars (ideal weight formulas, 1RM formulas) */
.compare-list { display: grid; gap: 0.85rem; margin: 0; padding: 0; list-style: none; }
.compare-row { display: grid; gap: 0.35rem; }
.compare-meta { display: flex; justify-content: space-between; gap: 1rem; font-size: var(--fs-sm); }
.compare-meta span { font-weight: 600; }
.compare-meta strong { font-family: var(--font-head); font-variant-numeric: tabular-nums; }
.compare-bar { height: 10px; overflow: hidden; background: var(--surface-2); border-radius: var(--r-full); }
.compare-bar > span { display: block; width: var(--value, 0%); height: 100%; background: var(--bar, var(--brand)); border-radius: inherit; transition: width 0.9s var(--ease); }

/* ==========================================================================
   08. Timeline (pregnancy) & calendar (ovulation)
   ========================================================================== */
.timeline { position: relative; display: grid; gap: 0.25rem; margin: 0; padding: 0 0 0 1.75rem; list-style: none; }
.timeline::before { content: ''; position: absolute; top: 0.5rem; bottom: 0.5rem; left: 0.55rem; width: 2px; background: var(--border); }
.timeline-progress { position: absolute; top: 0.5rem; left: 0.55rem; width: 2px; height: var(--value, 0%); max-height: calc(100% - 1rem); background: var(--primary-bg); transition: height 1s var(--ease); }
.timeline-item { position: relative; padding: 0.55rem 0 0.55rem 0.5rem; }
.timeline-item::before {
  content: '';
  position: absolute;
  top: 0.9rem;
  left: -1.6rem;
  width: 14px;
  height: 14px;
  background: var(--surface);
  border: 2px solid var(--border-strong);
  border-radius: 50%;
}
.timeline-item.is-done::before { background: var(--brand); border-color: var(--brand); }
.timeline-item.is-current::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 25%, transparent); }
.timeline-week { font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-subtle); }
.timeline-title { display: block; font-weight: 700; color: var(--text); }
.timeline-text { display: block; font-size: var(--fs-sm); color: var(--text-muted); }
.timeline-item.is-current .timeline-title { color: var(--accent-ink); }
[data-theme='dark'] .timeline-item.is-current .timeline-title { color: #fda4af; }

.trimester-bar { display: grid; grid-template-columns: 13fr 14fr 13fr; gap: 3px; height: 14px; overflow: hidden; border-radius: var(--r-full); }
.trimester-bar span { background: var(--surface-2); }
.trimester-bar span.is-done { background: var(--brand); }
.trimester-bar span.is-current { background: linear-gradient(90deg, var(--brand) var(--value, 50%), var(--surface-2) var(--value, 50%)); }

.calendar-wrap { display: grid; gap: 1.25rem; }
@media (min-width: 768px) { .calendar-wrap-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); } }
.calendar { padding: 1rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); }
.calendar-title { margin: 0 0 0.75rem; font-size: var(--fs-md); text-align: center; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; margin: 0; padding: 0; list-style: none; text-align: center; }
.calendar-dow { padding: 0.25rem 0; font-size: 0.7rem; font-weight: 700; color: var(--text-subtle); text-transform: uppercase; }
.calendar-day {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
  border-radius: 10px;
  font-variant-numeric: tabular-nums;
}
.calendar-day.is-empty { visibility: hidden; }
.calendar-day.is-period { color: #fff; background: #e11d48; }
.calendar-day.is-fertile { color: var(--good-ink); background: var(--good-bg); box-shadow: inset 0 0 0 1.5px var(--good-border); }
.calendar-day.is-ovulation { color: #fff; background: var(--violet); box-shadow: 0 0 0 2px color-mix(in srgb, var(--violet) 35%, transparent); }
.calendar-day.is-ovulation::after { content: '★'; position: absolute; top: 1px; right: 3px; font-size: 0.55rem; }
.calendar-day.is-today { outline: 2px solid var(--text); outline-offset: 1px; }
[data-theme='dark'] .calendar-day.is-period { background: #be123c; }
[data-theme='dark'] .calendar-day.is-ovulation { background: #7c3aed; }
.calendar-legend { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; margin: 0; padding: 0; list-style: none; font-size: var(--fs-xs); font-weight: 600; color: var(--text-muted); }
.calendar-legend li { display: inline-flex; align-items: center; gap: 0.4rem; }
.calendar-legend i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; }

/* ==========================================================================
   09. Trackers: water glasses, logs, checklists, habit grid
   ========================================================================== */
.glass-tracker { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 0.5rem; }
.glass {
  position: relative;
  display: grid;
  place-items: end center;
  height: 64px;
  padding: 0;
  overflow: hidden;
  background: var(--surface-2);
  border: 2px solid var(--border-strong);
  border-radius: 6px 6px 14px 14px;
  transition: border-color 0.2s, transform 0.15s;
}
.glass::before { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: linear-gradient(180deg, #7dd3fc, #0ea5e9); transition: height 0.5s var(--ease); }
.glass span { position: relative; z-index: 1; padding-bottom: 0.3rem; font-size: 0.7rem; font-weight: 700; color: var(--text-subtle); }
.glass[aria-pressed='true'] { border-color: #0ea5e9; }
.glass[aria-pressed='true']::before { height: 82%; }
.glass[aria-pressed='true'] span { color: #062e4a; }
.glass:hover { transform: translateY(-2px); border-color: #0ea5e9; }

.log-list { display: grid; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.log-item { display: flex; align-items: center; gap: 0.85rem; padding: 0.75rem 0.9rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); }
.log-main { flex: 1; min-width: 0; }
.log-value { font: 700 1.05rem/1.3 var(--font-head); font-variant-numeric: tabular-nums; }
.log-meta { display: block; font-size: var(--fs-xs); color: var(--text-subtle); }
.log-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1rem; margin-bottom: 1.25rem; }
.log-head h2 { margin: 0; font-size: var(--fs-xl); }
.log-tools { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.log-item .status { flex: none; }
.log-delete {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  color: var(--text-subtle);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-full);
}
.log-delete:hover { color: var(--danger-ink); background: var(--danger-bg); border-color: var(--danger-border); }
.log-delete .icon { width: 18px; height: 18px; }
@media (max-width: 479.98px) {
  .log-item { flex-wrap: wrap; }
  .log-item .status { order: 3; }
}
.chart-box-sm { height: 260px; min-height: 0; }
.inline-check { display: flex; align-items: center; gap: 0.6rem; min-height: 44px; font-size: var(--fs-sm); font-weight: 600; cursor: pointer; }
.inline-check input { width: 20px; height: 20px; flex: none; }
.time-list { display: grid; gap: 0.6rem; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.reminder-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.85rem 1rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); }
.reminder-banner p { margin: 0; font-size: var(--fs-sm); }
.check-item .check-time { font: 700 1rem/1.2 var(--font-head); min-width: 4.5rem; font-variant-numeric: tabular-nums; }
.check-item.is-missed { background: var(--caution-bg); border-color: var(--caution-border); }
.breath-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem; }
.breath-label { position: absolute; inset: 0; display: grid; align-content: center; place-items: center; gap: 0.15rem; text-align: center; pointer-events: none; }
.breath-label .breath-phase,
.breath-label .breath-count { color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45), 0 0 14px rgba(0, 0, 0, 0.3); }
.log-empty { padding: 1.25rem; text-align: center; font-size: var(--fs-sm); color: var(--text-muted); background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: var(--r); }

.checklist { display: grid; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.check-item { display: flex; align-items: center; gap: 0.85rem; min-height: 56px; padding: 0.6rem 0.9rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); transition: background-color 0.2s, border-color 0.2s; }
.check-item input[type='checkbox'] { flex: none; width: 22px; height: 22px; cursor: pointer; }
.check-item label { flex: 1; cursor: pointer; font-weight: 600; }
.check-item label small { display: block; font-weight: 500; color: var(--text-subtle); }
.check-item.is-done { background: var(--good-bg); border-color: var(--good-border); }
.check-item.is-done label { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--good-ink) 60%, transparent); color: var(--text-muted); }

.habit-grid-wrap { overflow-x: auto; margin-inline: -0.25rem; padding: 0.25rem; }
.habit-grid { width: 100%; min-width: 520px; border-collapse: separate; border-spacing: 4px; font-size: var(--fs-sm); }
.habit-grid th { padding: 0.25rem; font-size: var(--fs-xs); font-weight: 700; color: var(--text-subtle); text-align: center; }
.habit-grid th[scope='row'] { min-width: 150px; font-size: var(--fs-sm); font-weight: 600; color: var(--text); text-align: left; }
.habit-grid th.is-today { color: var(--link); }
.habit-cell {
  display: grid;
  place-items: center;
  width: 100%;
  min-width: 40px;
  height: 44px;
  padding: 0;
  font-size: 1rem;
  color: transparent;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  transition: background-color 0.2s, border-color 0.2s, transform 0.15s var(--ease-spring);
}
.habit-cell:hover { border-color: var(--brand); }
.habit-cell[aria-pressed='true'] { color: #fff; background: var(--brand-strong); border-color: var(--brand-strong); transform: scale(1.03); }
[data-theme='dark'] .habit-cell[aria-pressed='true'] { color: #04271d; background: var(--brand); border-color: var(--brand); }
.streak { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.2rem 0.6rem; font-size: var(--fs-xs); font-weight: 700; color: var(--warning-ink); background: var(--warning-bg); border-radius: var(--r-full); }

/* ==========================================================================
   10. Breathing circle, timer ring, quiz
   ========================================================================== */
.breath-stage { display: grid; place-items: center; gap: 1.25rem; padding: 1rem 0; text-align: center; }
.breath-circle-wrap { position: relative; display: grid; place-items: center; width: min(78vw, 300px); aspect-ratio: 1; }
.breath-circle-wrap::before { content: ''; position: absolute; inset: 0; border: 2px dashed color-mix(in srgb, var(--cat) 35%, transparent); border-radius: 50%; }
.breath-circle {
  --scale: 0.55;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, #ffffff 40%, var(--cat)), var(--cat) 60%, color-mix(in srgb, var(--cat) 70%, #0b1b33));
  border-radius: 50%;
  box-shadow: 0 0 0 14px color-mix(in srgb, var(--cat) 12%, transparent), 0 30px 60px -20px color-mix(in srgb, var(--cat) 60%, transparent);
  transform: scale(var(--scale));
  transition: transform var(--phase-duration, 4s) cubic-bezier(0.45, 0, 0.55, 1);
}
.breath-phase { font: 700 var(--fs-xl)/1.2 var(--font-head); color: var(--text); }
.breath-count { font: 800 clamp(2.5rem, 2rem + 2vw, 3.5rem)/1 var(--font-head); color: var(--text); font-variant-numeric: tabular-nums; }
.breath-meta { font-size: var(--fs-sm); color: var(--text-muted); }

.timer-ring { position: relative; display: grid; place-items: center; width: min(76vw, 280px); aspect-ratio: 1; margin-inline: auto; }
.timer-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.timer-ring-track { fill: none; stroke: var(--surface-2); stroke-width: 10; }
.timer-ring-bar { fill: none; stroke: var(--cat); stroke-width: 10; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: calc(100 - var(--progress, 0)); transition: stroke-dashoffset 1s linear, stroke 0.3s; }
.timer-ring.is-break .timer-ring-bar { stroke: var(--good-fill); }
.timer-display { position: relative; display: grid; gap: 0.25rem; text-align: center; }
.timer-time { font: 800 clamp(2.5rem, 2rem + 2.5vw, 3.5rem)/1 var(--font-head); letter-spacing: -0.02em; color: var(--text); font-variant-numeric: tabular-nums; }
.timer-label { font-size: var(--fs-sm); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-subtle); }
.timer-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem; }
.stretch-card { display: flex; gap: 1rem; align-items: center; padding: 1rem 1.1rem; background: var(--good-bg); border: 1px solid var(--good-border); border-radius: var(--r-md); }
.stretch-card .choice-emoji { font-size: 2rem; }

.quiz-progress { display: grid; gap: 0.5rem; }
.quiz-progress-meta { display: flex; justify-content: space-between; font-size: var(--fs-sm); font-weight: 600; color: var(--text-muted); }
.quiz-question { margin: 0 0 1rem; font-size: var(--fs-lg); line-height: 1.4; }
.quiz-options { display: grid; gap: 0.6rem; }
.quiz-nav { display: flex; justify-content: space-between; gap: 0.75rem; }
.quiz-step { animation: result-in 0.4s var(--ease) both; }

/* Animatable score ring: --score is a registered <number> (0–100) */
@property --score { syntax: '<number>'; inherits: false; initial-value: 0; }
.score-ring {
  --score: 0;
  position: relative;
  display: grid;
  place-items: center;
  width: 168px;
  aspect-ratio: 1;
  margin-inline: auto;
  background: conic-gradient(var(--ring-color, var(--brand)) calc(var(--score) * 1%), var(--surface-2) 0);
  border-radius: 50%;
  transition: --score 1.1s var(--ease);
}
.score-ring::before { content: ''; position: absolute; inset: 14px; background: var(--surface); border-radius: 50%; }
.score-ring > * { position: relative; }
.score-ring strong { font: 800 2.4rem/1 var(--font-head); color: var(--text); font-variant-numeric: tabular-nums; }
.score-ring-inner { display: grid; justify-items: center; gap: 0.2rem; max-width: 110px; text-align: center; }
.score-ring-inner span { font-size: var(--fs-xs); font-weight: 600; line-height: 1.25; color: var(--text-subtle); }

/* ==========================================================================
   11. Related tools & tool disclaimer
   ========================================================================== */
.related-section .tool-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.tool-disclaimer { margin-top: 2rem; }
.tool-meta-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }

/* ==========================================================================
   12. Print — show the result card only (plus page title)
   ========================================================================== */
@media print {
  .calc-panel,
  .result-actions,
  .related-section,
  .faq-section,
  .breadcrumb,
  .tool-content { display: none !important; }
  .tool-layout { display: block; }
  .calc-result { position: static; border: 1px solid #ccc; box-shadow: none; break-inside: avoid; }
  .calc-result::after { display: none; }
  .calc-result.is-revealed .result-body > * { animation: none !important; }
  .status { border: 1px solid #999 !important; }
  .gauge-needle { transition: none !important; }
}

/* ==========================================================================
   13. Quiz, stress test, habit tracker & stretch timer additions
   ========================================================================== */
.result-stats-1 { grid-template-columns: 1fr; }
.quiz-question,
.field > .quiz-question { display: flex; gap: 0.6rem; margin-bottom: 0.4rem; font-size: var(--fs-lg); font-weight: 700; line-height: 1.4; color: var(--text); }
.field > .pss-q { font-size: var(--fs-base, 1rem); font-weight: 600; }
.quiz-question:focus { outline: none; }
.quiz-question:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; border-radius: 6px; }
.quiz-done { padding: 1rem 1.1rem; background: var(--good-bg); border: 1px solid var(--good-border); border-radius: var(--r-md); }
.quiz-done p { margin: 0; }
.quiz-done p + p { margin-top: 0.35rem; font-size: var(--fs-sm); color: var(--text-muted); }
.quiz-nav .btn-primary { margin-left: auto; }
#quiz-restart { justify-self: start; }

/* Personalised tip list (health age wins, stress tips) */
.tip-list { display: grid; gap: 0.6rem; margin: 0; padding: 0; list-style: none; }
.tip-list li { display: flex; gap: 0.85rem; padding: 0.85rem 1rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); }
.tip-list .tip-emoji { display: inline; flex: none; margin: 0; font-size: 1.4rem; line-height: 1.3; }

/* Contact page */
.hp-field { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.field-check { font-weight: 500; align-items: flex-start; line-height: 1.5; }
.field-check input { margin-top: 0.15rem; }
.contact-success { display: grid; justify-items: center; gap: 0.75rem; padding: 2rem 1rem; text-align: center; }
.contact-success:focus { outline: none; }
.contact-success p { max-width: 42ch; margin: 0; color: var(--text-muted); }
.contact-aside { display: grid; gap: 1.1rem; align-content: start; }
.contact-aside .result-list a { font-weight: 700; overflow-wrap: anywhere; }.tip-list strong { display: block; color: var(--text); }
.tip-list p { margin: 0.2rem 0 0; font-size: var(--fs-sm); color: var(--text-muted); line-height: 1.6; }
.tip-years { margin-left: 0.35rem; padding: 0.05rem 0.45rem; font-size: var(--fs-xs); font-weight: 700; color: var(--warning-ink); background: var(--warning-bg); border-radius: var(--r-full); white-space: nowrap; }

/* PSS-10 likert scale */
.pss-list { display: grid; gap: 0.75rem; }
.pss-item { min-width: 0; margin: 0; padding: 0.9rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); transition: border-color 0.2s; }
.pss-item.is-answered { border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); }
.pss-item.has-error { border-color: var(--danger-border); }
.pss-q { display: flex; gap: 0.6rem; margin-bottom: 0.75rem; padding: 0; font-weight: 600; line-height: 1.45; color: var(--text); }
.pss-num { display: grid; flex: none; place-items: center; width: 26px; height: 26px; font: 700 0.8rem/1 var(--font-head); color: var(--cat-ink); background: color-mix(in srgb, var(--cat) 16%, transparent); border-radius: 50%; }
.likert { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.3rem; }
.likert input { position: absolute; opacity: 0; pointer-events: none; }
.likert label {
  display: grid;
  place-items: center;
  min-height: 52px;
  padding: 0.35rem 0.2rem;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  color: var(--text-muted);
  hyphens: manual;
  overflow-wrap: anywhere;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.likert label:hover { color: var(--text); border-color: var(--brand); }
.likert input:checked + label { color: var(--on-primary); background: var(--primary-bg); border-color: transparent; }
.likert input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }
@media (min-width: 480px) { .likert label { font-size: var(--fs-xs); } }
.prose .small { font-size: var(--fs-sm); color: var(--text-subtle); }

/* Habit tracker */
.check-item .streak { flex: none; }
.streak-none { color: var(--text-subtle); background: var(--surface); border: 1px dashed var(--border-strong); }
.manage-habits { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); }
.manage-habits > summary { display: flex; align-items: center; justify-content: space-between; min-height: 48px; padding: 0.6rem 1rem; font-weight: 700; cursor: pointer; list-style: none; }
.manage-habits > summary::-webkit-details-marker { display: none; }
.manage-habits > summary::after { content: '+'; font: 700 1.25rem/1 var(--font-head); color: var(--text-subtle); }
.manage-habits[open] > summary::after { content: '−'; }
.manage-habits > summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: var(--r-md); }
.manage-body { display: grid; gap: 1rem; padding: 0 1rem 1rem; }
.manage-body .log-item { background: var(--surface); padding-block: 0.35rem; }
.manage-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
@media (min-width: 480px) { .habit-add-grid { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.6fr); } }
.week-nav { display: flex; align-items: center; gap: 0.5rem; }
.week-label { min-width: 7.5rem; font-weight: 700; text-align: center; }
.habit-grid thead td { min-width: 150px; }
.habit-date { display: block; font: 700 0.95rem/1.2 var(--font-head); color: var(--text); }
.habit-grid th.is-today .habit-date { color: var(--link); }
.habit-cell:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.habit-cell.is-future { opacity: 0.4; cursor: not-allowed; }
.habit-cell.is-future:hover { border-color: var(--border); }
.habit-total { padding: 0.3rem 0.1rem; font-size: var(--fs-xs); font-weight: 700; text-align: center; color: var(--text-subtle); font-variant-numeric: tabular-nums; }
.habit-total.is-perfect { color: var(--good-ink); }
.habit-total-row th[scope='row'] { font-size: var(--fs-xs); color: var(--text-subtle); }
.streak-best { font-family: var(--font-body); font-size: var(--fs-xs); font-weight: 600; color: var(--text-subtle); }

/* Stretch break timer */
.timer-stage { display: grid; justify-items: center; gap: 1.25rem; }
.timer-ring.is-jump .timer-ring-bar { transition: none; }
.option-list { display: grid; gap: 0.15rem; }
.session-dots { display: flex; justify-content: center; gap: 0.4rem; margin: 0.35rem 0 0; padding: 0; list-style: none; }
.session-dots[hidden] { display: none; }
.session-dots li { width: 10px; height: 10px; background: var(--surface-2); border: 2px solid var(--border-strong); border-radius: 50%; }
.session-dots li.is-done { background: var(--cat); border-color: var(--cat); }
.timer-ring.is-break .timer-label { color: var(--good-ink); }
.stretch-card { width: 100%; align-items: flex-start; }
.timer-ring:not(.is-break) ~ .stretch-card { background: var(--surface-2); border-color: var(--border); }
.stretch-body { min-width: 0; }
.stretch-kicker { margin: 0; font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-subtle); }
.stretch-name { margin: 0.15rem 0 0.25rem; font: 700 var(--fs-lg)/1.3 var(--font-head); color: var(--text); }
.stretch-text { margin: 0; font-size: var(--fs-sm); line-height: 1.6; color: var(--text-muted); }
@media print {
  .timer-controls, #stretch-next, .manage-habits, .week-nav { display: none !important; }
}
