/* ============================================================
   MyBodyAI TOOLKIT — shared component layer for /tools/
   Token-native. Light mode works via tokens.css var flips,
   NO per-component html.light !important overrides.
   Direction: "Vivid & credible" (chosen 2026-06-08).
   ============================================================ */
@import url("../css/tokens.css?v=td1");

/* ── Base reset + body font ──────────────────────────────────
   Tools pages no longer load shared.css, so restore the reset and
   the body font HERE. Without it, body text and the nav links
   (font-family:inherit) fall back to the browser default serif. */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body.tk-body { font-family: var(--font-body); color: var(--color-text-primary); line-height: 1.6; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body.tk-body a { color: inherit; text-decoration: none; }

/* ── Score tiers ─────────────────────────────────────────────
   Every result surface (gauge, bar, badge, fill, delta) reads
   --tier. Set the tier on a wrapper via .tier-* and children
   inherit the colour. JS sets it for dynamic results. */
.tier-critical  { --tier: var(--color-score-critical);  --tier-soft: rgba(232,57,78,0.12); }
.tier-low       { --tier: var(--color-score-low);        --tier-soft: rgba(232,122,32,0.12); }
.tier-fair      { --tier: var(--color-score-fair);       --tier-soft: rgba(232,184,32,0.14); }
.tier-good      { --tier: var(--color-score-good);       --tier-soft: rgba(46,232,138,0.12); }
.tier-excellent { --tier: var(--color-score-excellent);  --tier-soft: rgba(26,216,230,0.12); }
html.light .tier-critical  { --tier-soft: rgba(192,16,48,0.08); }
html.light .tier-low       { --tier-soft: rgba(160,78,16,0.08); }
html.light .tier-fair      { --tier-soft: rgba(122,98,0,0.08); }
html.light .tier-good      { --tier-soft: rgba(3,104,48,0.08); }
html.light .tier-excellent { --tier-soft: rgba(8,95,109,0.08); }

/* ── Page shell ──────────────────────────────────────────────
   Wider than the legacy 720px column; two-column result grids
   become possible on desktop. */
.tk-page { max-width: 960px; margin: 0 auto; padding: 0 1.25rem 4rem; }
.tk-page--narrow { max-width: 760px; }

/* Soft animated mesh background, theme-aware, masked under navbar.
   Lifted from the compare-hub recipe (pure CSS, no Three.js). */
html.dark  { background: var(--color-bg-deep); }
html.light { background: var(--color-bg-deep); }
body.tk-body { background: transparent; }
body.tk-body::before {
  content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(1100px 760px at 90% 18%, rgba(123,47,247,0.13), transparent 60%),
    radial-gradient(960px 720px at 4% 42%, rgba(0,240,255,0.07), transparent 62%),
    radial-gradient(900px 820px at 50% 122%, rgba(255,45,138,0.06), transparent 64%);
  -webkit-mask-image: linear-gradient(180deg, transparent 0, rgba(0,0,0,1) 140px);
  mask-image: linear-gradient(180deg, transparent 0, rgba(0,0,0,1) 140px);
}
html.light body.tk-body::before {
  background:
    radial-gradient(1100px 760px at 90% 18%, rgba(92,31,184,0.07), transparent 60%),
    radial-gradient(960px 720px at 4% 42%, rgba(8,120,140,0.06), transparent 62%),
    radial-gradient(900px 820px at 50% 122%, rgba(181,4,96,0.045), transparent 64%);
}
body.tk-body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: radial-gradient(rgba(255,255,255,0.045) 1px, transparent 1.3px);
  background-size: 28px 28px;
  -webkit-mask-image: linear-gradient(180deg, transparent 60px, rgba(0,0,0,1) 220px, rgba(0,0,0,1) 70%, transparent 100%);
  mask-image: linear-gradient(180deg, transparent 60px, rgba(0,0,0,1) 220px, rgba(0,0,0,1) 70%, transparent 100%);
}
html.light body.tk-body::after { background-image: radial-gradient(rgba(40,50,60,0.05) 1px, transparent 1.3px); }

/* ── Hero ────────────────────────────────────────────────────*/
.tk-hero { position: relative; text-align: center; padding: 116px 0 8px; }
.tk-hero-eyebrow {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 14px;
  border-radius: 50px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em;
  color: var(--color-cyan); background: rgba(0,240,255,0.08);
  border: 1px solid var(--color-border-glass); margin-bottom: 1.1rem;
}
html.light .tk-hero-eyebrow { background: rgba(8,95,109,0.07); }
.tk-hero-eyebrow svg { width: 14px; height: 14px; }
.tk-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 5.2vw, 2.9rem); font-weight: 800; line-height: 1.08;
  background: var(--gradient-hero); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; margin: 0 auto 0.6rem; max-width: 18ch;
}
.tk-hero-sub { color: var(--color-text-secondary); font-size: 1rem; max-width: 56ch; margin: 0 auto; line-height: 1.55; }

/* Trust chips */
.tk-trust { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 1.2rem; }
.tk-trust-item {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
  border-radius: 50px; font-size: 0.74rem; font-weight: 600; color: var(--color-text-secondary);
  background: var(--color-bg-card); border: 1px solid var(--color-border-medium);
}
.tk-trust-item svg { width: 13px; height: 13px; color: var(--color-green); }
.tk-topiclink { margin: 0.9rem 0 0; font-size: 0.85rem; }
.tk-topiclink a { color: var(--color-cyan); text-decoration: none; font-weight: 600; }
.tk-topiclink a:hover { text-decoration: underline; }

/* ── Cards ───────────────────────────────────────────────────*/
.tk-card {
  position: relative; background: var(--color-bg-card); border: 1px solid var(--color-border-glass);
  border-radius: var(--radius-lg); padding: 1.5rem; margin-bottom: 1.1rem;
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.tk-card-h {
  font-size: 0.72rem; font-weight: 700; color: var(--color-text-muted);
  text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 1rem;
  display: flex; align-items: center; gap: 8px;
}
.tk-card-h svg { width: 15px; height: 15px; color: var(--color-cyan); }
.tk-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; align-items: start; }
@media (max-width: 760px) { .tk-grid-2 { grid-template-columns: 1fr; } }
.tk-field { margin-bottom: 1.2rem; }
.tk-field:last-child { margin-bottom: 0; }
.tk-label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--color-text-secondary); margin-bottom: 0.55rem; }
.tk-hint { font-size: 0.72rem; color: var(--color-text-muted); font-weight: 400; }

/* ── Segmented control ───────────────────────────────────────
   Replaces every radio-button grid / .btn-group across tools. */
.tk-seg { display: flex; gap: 4px; padding: 4px; border-radius: 14px;
  background: var(--color-bg-input); border: 1px solid var(--color-border-medium); }
.tk-seg.tk-seg--wrap { flex-wrap: wrap; }
.tk-seg button {
  flex: 1 1 0; min-width: max-content; padding: 9px 12px; border-radius: 10px; border: none;
  background: transparent; color: var(--color-text-secondary); font-family: inherit;
  font-size: 0.82rem; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: color var(--transition-fast), background var(--transition-fast); position: relative;
}
.tk-seg button:hover { color: var(--color-text-primary); }
.tk-seg button[aria-pressed="true"] {
  color: var(--color-cyan); background: rgba(0,240,255,0.12);
  box-shadow: inset 0 0 0 1px var(--color-border-glass-hover);
}
html.light .tk-seg button[aria-pressed="true"] { background: rgba(8,95,109,0.10); }
.tk-seg button:focus-visible { outline: 2px solid var(--color-cyan); outline-offset: 1px; }
.tk-seg-sub { display: block; font-size: 0.68rem; font-weight: 400; color: var(--color-text-muted); margin-top: 2px; }

/* ── Smart slider ────────────────────────────────────────────*/
.tk-slider-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 0.4rem; }
.tk-slider-val { font-family: var(--font-mono); font-size: 1.5rem; font-weight: 800; color: var(--color-cyan); line-height: 1; }
.tk-slider-unit { font-size: 0.8rem; color: var(--color-text-muted); margin-left: 2px; }
.tk-range { -webkit-appearance: none; appearance: none; width: 100%; height: 8px; border-radius: 50px;
  outline: none; cursor: pointer;
  background: linear-gradient(90deg, var(--color-cyan) 0%, var(--color-cyan) var(--pct,50%), var(--color-bg-input) var(--pct,50%), var(--color-bg-input) 100%); }
.tk-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 22px; height: 22px;
  border-radius: 50%; background: var(--color-cyan); cursor: pointer; border: 3px solid var(--color-bg-surface);
  box-shadow: 0 0 0 1px var(--color-border-glass-hover), 0 0 14px rgba(0,240,255,0.4); transition: transform var(--transition-fast); }
.tk-range::-webkit-slider-thumb:hover { transform: scale(1.12); }
.tk-range::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--color-cyan);
  cursor: pointer; border: 3px solid var(--color-bg-surface); box-shadow: 0 0 14px rgba(0,240,255,0.4); }
.tk-range:focus-visible { box-shadow: 0 0 0 3px rgba(0,240,255,0.25); }
.tk-range-scale { display: flex; justify-content: space-between; font-family: var(--font-mono);
  font-size: 0.68rem; color: var(--color-text-muted); margin-top: 0.4rem; }

/* Stepper (dial) — number with +/- */
.tk-stepper { display: inline-flex; align-items: center; gap: 0; border-radius: 12px;
  border: 1px solid var(--color-border-medium); background: var(--color-bg-input); overflow: hidden; }
.tk-stepper button { width: 42px; height: 44px; border: none; background: transparent; color: var(--color-cyan);
  font-size: 1.3rem; font-weight: 700; cursor: pointer; line-height: 1; transition: background var(--transition-fast); }
.tk-stepper button:hover { background: var(--color-bg-hover); }
.tk-stepper .tk-stepper-val { min-width: 64px; text-align: center; font-family: var(--font-mono);
  font-size: 1.25rem; font-weight: 800; color: var(--color-text-primary); }

/* ── Radial gauge ────────────────────────────────────────────*/
.tk-gauge-wrap { display: flex; justify-content: center; margin: 0.5rem 0 1rem; }
.tk-gauge { position: relative; width: 220px; height: 220px; }
.tk-gauge svg { transform: rotate(-90deg); display: block; }
.tk-gauge-track { fill: none; stroke: var(--color-bg-input); stroke-width: 12; }
.tk-gauge-fill { fill: none; stroke: var(--tier, var(--color-cyan)); stroke-width: 12; stroke-linecap: round;
  transition: stroke-dashoffset 1.1s cubic-bezier(0.16,1,0.3,1), stroke 0.5s; filter: drop-shadow(0 0 6px var(--tier, var(--color-cyan))); }
html.light .tk-gauge-fill { filter: none; }
.tk-gauge-center { position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; }
.tk-gauge-num { font-family: var(--font-mono); font-size: 3rem; font-weight: 800; line-height: 1; color: var(--tier, var(--color-text-primary)); }
.tk-gauge-state { font-size: 0.8rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase;
  margin-top: 5px; color: var(--tier, var(--color-text-secondary)); }
.tk-gauge-cap { font-size: 0.7rem; color: var(--color-text-muted); margin-top: 3px; }

/* ── Score-band legend ───────────────────────────────────────*/
.tk-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; margin-top: 0.5rem; }
.tk-legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 0.7rem; color: var(--color-text-muted); }
.tk-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ── Score bar (breakdowns / percentile tracks) ──────────────*/
.tk-bar-row { display: grid; grid-template-columns: 96px 1fr 38px; align-items: center; gap: 10px; margin-bottom: 10px; }
.tk-bar-label { font-size: 0.78rem; font-weight: 600; color: var(--color-text-secondary); text-align: right; }
.tk-bar-track { height: 10px; border-radius: 50px; background: var(--color-bg-input); overflow: hidden; position: relative; }
.tk-bar-fill { height: 100%; border-radius: 50px; background: var(--tier, var(--color-cyan)); width: 0;
  transition: width 0.9s cubic-bezier(0.16,1,0.3,1); }
.tk-bar-val { font-family: var(--font-mono); font-size: 0.8rem; font-weight: 700; color: var(--tier, var(--color-cyan)); text-align: right; }
@media (max-width: 480px) { .tk-bar-row { grid-template-columns: 74px 1fr 32px; } .tk-bar-label { font-size: 0.7rem; } }

/* Marker track (position-on-spectrum, e.g. body-fat / RHR zone) */
.tk-spectrum { position: relative; height: 14px; border-radius: 50px; margin: 1.4rem 0 0.6rem; }
.tk-spectrum-marker { position: absolute; top: 50%; width: 18px; height: 18px; border-radius: 50%;
  background: var(--color-text-primary); border: 3px solid var(--color-bg-surface);
  transform: translate(-50%,-50%); box-shadow: 0 0 0 1px var(--color-border-glass-hover); transition: left 0.8s cubic-bezier(0.16,1,0.3,1); }

/* ── Result reveal ───────────────────────────────────────────*/
.tk-result { padding: 1.75rem 1.5rem; border-radius: var(--radius-lg);
  background: var(--tier-soft, rgba(0,240,255,0.05)); border: 1px solid var(--color-border-glass);
  text-align: center; }
.tk-reveal { opacity: 0; transform: translateY(14px); }
.tk-reveal.tk-in { opacity: 1; transform: none; transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.16,1,0.3,1); }
.tk-result-desc { font-size: 0.9rem; color: var(--color-text-secondary); max-width: 46ch; margin: 0.75rem auto 0; line-height: 1.6; }

/* ── Stat cards ──────────────────────────────────────────────*/
.tk-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.75rem; }
.tk-stat { padding: 1.1rem; border-radius: var(--radius-md); background: var(--color-bg-input); border: 1px solid var(--color-border-subtle); }
.tk-stat-val { font-family: var(--font-mono); font-size: 1.7rem; font-weight: 800; line-height: 1; color: var(--color-text-primary); }
.tk-stat-label { font-size: 0.7rem; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 0.4rem; }
.tk-badge { display: inline-block; margin-top: 0.5rem; padding: 3px 10px; border-radius: 50px; font-size: 0.7rem;
  font-weight: 700; color: var(--tier, var(--color-cyan)); background: var(--tier-soft, rgba(0,240,255,0.1)); }

/* Delta badge (younger/older style) */
.tk-delta { display: inline-block; padding: 6px 16px; border-radius: 50px; font-family: var(--font-mono);
  font-size: 0.95rem; font-weight: 700; margin-top: 0.5rem; color: var(--tier); background: var(--tier-soft); }

/* ── Tip cards ───────────────────────────────────────────────*/
.tk-tip { display: flex; gap: 12px; padding: 1rem; border-radius: var(--radius-md);
  background: var(--color-bg-input); border: 1px solid var(--color-border-subtle); margin-bottom: 0.6rem; text-align: left; }
.tk-tip-icon { flex: 0 0 36px; width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  background: var(--tier-soft, rgba(0,240,255,0.1)); color: var(--tier, var(--color-cyan)); }
.tk-tip-icon svg { width: 18px; height: 18px; }
.tk-tip-body h4 { font-size: 0.88rem; font-weight: 700; color: var(--color-text-primary); margin-bottom: 2px; }
.tk-tip-body p { font-size: 0.8rem; color: var(--color-text-secondary); line-height: 1.5; }

/* ── Primary button ──────────────────────────────────────────*/
.tk-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  padding: 15px 24px; border-radius: 14px; border: none; font-family: inherit; font-size: 0.95rem;
  font-weight: 700; cursor: pointer; color: #081019; background: var(--gradient-primary);
  box-shadow: 0 6px 20px rgba(0,240,255,0.18); transition: transform var(--transition-fast), box-shadow var(--transition-fast); }
.tk-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(0,240,255,0.28); }
.tk-btn:active { transform: translateY(0); }
html.light .tk-btn { color: #f7faff; }
.tk-btn-ghost { background: transparent; color: var(--color-cyan); border: 1px solid var(--color-border-glass-hover); box-shadow: none; }
.tk-btn-ghost:hover { background: var(--color-bg-hover); box-shadow: none; }

/* ── Related-tools rail ──────────────────────────────────────*/
.tk-rail { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.85rem; }
.tk-rail a { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius-md);
  background: var(--color-bg-card); border: 1px solid var(--color-border-medium); text-decoration: none;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast); }
.tk-rail a:hover { transform: translateY(-3px); border-color: var(--color-border-glass-hover); box-shadow: 0 10px 26px rgba(0,0,0,0.18); }
html.light .tk-rail a:hover { box-shadow: 0 10px 26px rgba(0,0,0,0.07); }
.tk-rail-icon { flex: 0 0 38px; width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  background: rgba(0,240,255,0.1); color: var(--color-cyan); }
html.light .tk-rail-icon { background: rgba(8,95,109,0.09); }
.tk-rail-icon svg { width: 19px; height: 19px; }
.tk-rail-text { min-width: 0; }
.tk-rail-name { font-size: 0.88rem; font-weight: 700; color: var(--color-text-primary); }
.tk-rail-desc { font-size: 0.74rem; color: var(--color-text-muted); margin-top: 1px; }

/* Inline contextual cross-link pill (inside results) */
.tk-pill { display: inline-flex; align-items: center; gap: 5px; padding: 5px 12px; border-radius: 50px;
  font-size: 0.76rem; font-weight: 600; color: var(--color-cyan); background: rgba(0,240,255,0.08);
  border: 1px solid var(--color-border-glass); text-decoration: none; transition: border-color var(--transition-fast); }
html.light .tk-pill { background: rgba(8,95,109,0.07); }
.tk-pill:hover { border-color: var(--color-border-glass-hover); }
.tk-pill svg { width: 13px; height: 13px; }

/* ── Learn-more list ─────────────────────────────────────────*/
.tk-learn { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.tk-learn a { display: flex; align-items: center; gap: 8px; font-size: 0.88rem; color: var(--color-cyan); text-decoration: none; font-weight: 600; }
.tk-learn a:hover { text-decoration: underline; }
.tk-learn svg { width: 14px; height: 14px; flex: 0 0 14px; }

/* ── References ──────────────────────────────────────────────*/
.tk-refs { list-style: none; padding: 0; margin: 0; font-size: 0.76rem; color: var(--color-text-muted); line-height: 1.75; }
.tk-refs a { color: var(--color-cyan); }

/* ── FAQ accordion ───────────────────────────────────────────*/
.tk-faq details { border: 1px solid var(--color-border-glass); border-radius: var(--radius-md);
  margin-bottom: 10px; background: var(--color-bg-card); overflow: hidden; }
.tk-faq summary { padding: 15px 18px; cursor: pointer; font-weight: 600; font-size: 0.92rem; color: var(--color-text-primary);
  list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.tk-faq summary::-webkit-details-marker { display: none; }
.tk-faq summary::after { content: "+"; font-size: 1.3rem; font-weight: 400; color: var(--color-cyan); transition: transform var(--transition-fast); }
.tk-faq details[open] summary::after { transform: rotate(45deg); }
.tk-faq summary:focus-visible { outline: 2px solid var(--color-cyan); outline-offset: -2px; }
.tk-faq-body { padding: 0 18px 16px; color: var(--color-text-secondary); font-size: 0.85rem; line-height: 1.7; }

/* ── CTA card (animated gradient border) ─────────────────────*/
.tk-cta { position: relative; text-align: center; padding: 2rem 1.5rem; border-radius: var(--radius-lg);
  background: var(--color-bg-card); border: 1px solid var(--color-border-glass);
  margin-top: 2rem; animation: borderGlow 4s ease-in-out infinite; }
.tk-cta p { color: var(--color-text-secondary); font-size: 0.9rem; margin-bottom: 1.1rem; max-width: 50ch; margin-inline: auto; }
.tk-cta-btn { display: inline-flex; align-items: center; gap: 8px; padding: 13px 30px; border-radius: 14px;
  font-weight: 700; font-size: 0.92rem; color: #081019; background: var(--gradient-primary);
  text-decoration: none; box-shadow: 0 6px 20px rgba(0,240,255,0.18); transition: transform var(--transition-fast), box-shadow var(--transition-fast); }
html.light .tk-cta-btn { color: #f7faff; }
.tk-cta-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(0,240,255,0.28); }
.tk-cta-learn { display: inline-block; margin-top: 0.85rem; font-size: 0.82rem; color: var(--color-cyan); text-decoration: underline; }

/* ── Section headings used outside cards ─────────────────────*/
.tk-section-h { font-family: var(--font-display); font-size: 1.35rem; font-weight: 700; color: var(--color-text-primary);
  margin: 2.5rem 0 1rem; }
.tk-section-h--sm { font-size: 1.05rem; margin: 2rem 0 0.8rem; }

/* ── Animations ──────────────────────────────────────────────*/
@keyframes tkFadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.tk-anim-up { animation: tkFadeUp 0.5s cubic-bezier(0.16,1,0.3,1) both; }
@keyframes tkPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.04); } }
.tk-pulse { animation: tkPulse 2.4s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  .tk-gauge-fill, .tk-bar-fill, .tk-spectrum-marker { transition: none !important; }
  .tk-reveal { opacity: 1 !important; transform: none !important; }
  .tk-anim-up, .tk-pulse, .tk-cta { animation: none !important; }
}

/* ── App-signature canvas gauge (TK.appGauge) ────────────────
   The center overlay sits on top of the canvas ring. The big
   number + state word colour is set inline by JS to the score's
   end-cap colour so the verdict reads in its tier hue. */
.tk-appgauge { position: relative; margin: 0 auto; }
.tk-appgauge canvas { display: block; }
.tk-ag-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; pointer-events: none; padding-bottom: 15%; }
.tk-ag-num { font-family: var(--font-mono); font-size: clamp(2rem, 8vw, 2.7rem); font-weight: 800; line-height: 1; letter-spacing: -0.02em; color: var(--color-text-primary); }
html.light .tk-ag-num { text-shadow: 0 1px 2px rgba(0,0,0,0.12); }
.tk-ag-state { font-size: 0.78rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.1em; margin-top: 6px; max-width: 92%; line-height: 1.2; }
.tk-ag-cap { font-size: 0.66rem; color: var(--color-text-muted); margin-top: 4px; white-space: nowrap; }
.tk-ag-label { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.18em; color: var(--color-text-muted); margin-top: 6px; white-space: nowrap; }

/* ── Per-page colour accent ──────────────────────────────────
   Each tool/category sets a distinct chrome accent (hero eyebrow,
   section icons, segmented active, slider, links) while RESULTS
   keep the universal red->cyan score scale. Adds colour without
   breaking the scoring semantics. Default = cyan. */
:root, html.dark { --tk-accent: var(--color-cyan); --tk-accent-soft: rgba(0,240,255,0.10); --tk-accent-2: var(--color-purple); }
.tk-accent-heart    { --tk-accent: #ff2d8a; --tk-accent-soft: rgba(255,45,138,0.12); --tk-accent-2: #ff5470; }
.tk-accent-sleep    { --tk-accent: #a78bfa; --tk-accent-soft: rgba(167,139,250,0.14); --tk-accent-2: #7b2ff7; }
.tk-accent-recovery { --tk-accent: #1ad8e6; --tk-accent-soft: rgba(26,216,230,0.12); --tk-accent-2: #00f0ff; }
.tk-accent-body     { --tk-accent: #2ee88a; --tk-accent-soft: rgba(46,232,138,0.12); --tk-accent-2: #00ff88; }
html.light .tk-accent-heart    { --tk-accent: #b50460; --tk-accent-soft: rgba(181,4,96,0.08); --tk-accent-2: #c01030; }
html.light .tk-accent-sleep    { --tk-accent: #5c1fb8; --tk-accent-soft: rgba(92,31,184,0.08); --tk-accent-2: #5c1fb8; }
html.light .tk-accent-recovery { --tk-accent: #085f6d; --tk-accent-soft: rgba(8,95,109,0.08); --tk-accent-2: #085f6d; }
html.light .tk-accent-body     { --tk-accent: #036830; --tk-accent-soft: rgba(3,104,48,0.08); --tk-accent-2: #036830; }

/* Route accent into the existing chrome (was hardcoded cyan). */
[class*="tk-accent-"] .tk-hero-eyebrow { color: var(--tk-accent); background: var(--tk-accent-soft); }
[class*="tk-accent-"] .tk-card-h svg,
[class*="tk-accent-"] .tk-topiclink a,
[class*="tk-accent-"] .tk-learn a,
[class*="tk-accent-"] .tk-pill,
[class*="tk-accent-"] .tk-rail-icon { color: var(--tk-accent); }
[class*="tk-accent-"] .tk-rail-icon,
[class*="tk-accent-"] .tk-pill { background: var(--tk-accent-soft); }
[class*="tk-accent-"] .tk-seg button[aria-pressed="true"] { color: var(--tk-accent); background: var(--tk-accent-soft); }
[class*="tk-accent-"] .tk-range { background: linear-gradient(90deg, var(--tk-accent) 0%, var(--tk-accent) var(--pct,50%), var(--color-bg-input) var(--pct,50%), var(--color-bg-input) 100%); }
[class*="tk-accent-"] .tk-range::-webkit-slider-thumb { background: var(--tk-accent); box-shadow: 0 0 0 1px var(--color-border-glass-hover), 0 0 14px var(--tk-accent-soft); }
[class*="tk-accent-"] .tk-range::-moz-range-thumb { background: var(--tk-accent); }
[class*="tk-accent-"] .tk-slider-val { color: var(--tk-accent); }
[class*="tk-accent-"] .tk-faq summary::after { color: var(--tk-accent); }

/* Accent-tinted soft glow behind the hero headline (adds page colour). */
[class*="tk-accent-"] .tk-hero { position: relative; }
[class*="tk-accent-"] .tk-hero::after {
  content: ""; position: absolute; left: 50%; top: 30%; width: min(560px, 90%); height: 220px;
  transform: translate(-50%, -50%); z-index: -1; pointer-events: none; border-radius: 50%;
  background: radial-gradient(closest-side, var(--tk-accent-soft), transparent 72%);
  filter: blur(8px);
}

/* ── Night timeline (sleep-calculator signature viz) ─────────*/
.tk-timeline { position: relative; height: 78px; margin: 1.4rem 0 0.4rem; border-radius: 14px; overflow: hidden;
  background: linear-gradient(90deg, #f5b942 0%, #7b6cff 14%, #2a2a6e 32%, #14143a 50%, #2a2a6e 70%, #7b6cff 88%, #f5b942 100%);
  border: 1px solid var(--color-border-glass); }
html.light .tk-timeline { filter: saturate(0.85) brightness(0.96); }
.tk-timeline-seg { position: absolute; top: 0; bottom: 0; background: rgba(255,255,255,0.10); border-left: 1px solid rgba(255,255,255,0.22); border-right: 1px solid rgba(255,255,255,0.22); }
.tk-timeline-marker { position: absolute; top: -4px; bottom: -4px; width: 2px; background: rgba(255,255,255,0.85); box-shadow: 0 0 8px rgba(255,255,255,0.6); }
.tk-timeline-axis { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 0.64rem; color: var(--color-text-muted); margin-top: 6px; }
.tk-cycles { display: flex; gap: 6px; margin-top: 1rem; }
.tk-cycle { flex: 1; height: 8px; border-radius: 50px; background: var(--color-bg-input); position: relative; overflow: hidden; }
.tk-cycle-fill { position: absolute; inset: 0; border-radius: 50px; background: var(--tk-accent, var(--color-cyan)); transform-origin: left; transform: scaleX(0); transition: transform 0.7s cubic-bezier(0.16,1,0.3,1); }

/* ── Training-zone bars (heart-rate-zones signature viz) ─────*/
.tk-zones { display: flex; flex-direction: column; gap: 9px; }
.tk-zone { display: grid; grid-template-columns: 158px 1fr auto; align-items: center; gap: 12px; }
.tk-zone-tag { display: flex; flex-direction: column; }
.tk-zone-tag b { font-size: 0.82rem; font-weight: 700; color: var(--color-text-primary); }
.tk-zone-tag small { font-size: 0.66rem; color: var(--color-text-muted); }
.tk-zone-bar { height: 30px; border-radius: 9px; position: relative; overflow: hidden; background: var(--color-bg-input); }
.tk-zone-bar i { position: absolute; inset: 0; transform-origin: left; transform: scaleX(0); transition: transform 0.8s cubic-bezier(0.16,1,0.3,1); border-radius: 9px; }
.tk-zone-bpm { font-family: var(--font-mono); font-size: 0.82rem; font-weight: 700; color: var(--color-text-secondary); white-space: nowrap; }
.tk-zone.is-active .tk-zone-bar { box-shadow: 0 0 0 2px var(--color-border-glass-hover); }
.tk-zone.is-active .tk-zone-tag b { color: var(--tk-accent, var(--color-cyan)); }
@media (max-width: 480px) { .tk-zone { grid-template-columns: 74px 1fr auto; gap: 8px; } .tk-zone-bpm { font-size: 0.72rem; } }

/* ── Domain breakdown rows (biological-age signature) ────────*/
.tk-domains { display: flex; flex-direction: column; gap: 11px; margin-top: 0.4rem; }
.tk-domain { display: grid; grid-template-columns: 122px 1fr 56px; align-items: center; gap: 11px; text-decoration: none; color: inherit; border-radius: 8px; }
a.tk-domain { cursor: pointer; }
.tk-domain-name { font-size: 0.8rem; font-weight: 600; color: var(--color-text-secondary); display: flex; align-items: center; gap: 6px; }
.tk-domain-name svg { width: 13px; height: 13px; opacity: 0.7; flex: 0 0 13px; }
a.tk-domain:hover .tk-domain-name { color: var(--tk-accent, var(--color-cyan)); }
a.tk-domain:hover .tk-domain-name svg { opacity: 1; }
.tk-domain-track { height: 12px; border-radius: 50px; background: var(--color-bg-input); overflow: hidden; position: relative; }
.tk-domain-fill { display: block; height: 100%; border-radius: 50px; background: var(--tier, var(--color-cyan)); width: 0; transition: width 0.9s cubic-bezier(0.16,1,0.3,1); }
.tk-domain-delta { font-family: var(--font-mono); font-size: 0.78rem; font-weight: 700; text-align: right; color: var(--tier, var(--color-text-secondary)); }
@media (max-width: 480px) { .tk-domain { grid-template-columns: 96px 1fr 44px; } }

@media (prefers-reduced-motion: reduce) {
  .tk-cycle-fill, .tk-zone-bar i, .tk-domain-fill { transition: none !important; }
}
