/* ===========================
   My Fitometer – Exact Output, De-duplicated
   =========================== */

/* Tokens & globals */
:root{
  --brand:#053170;
  --brand-light:#3296cd;
  --ink:#0E0E0F;
  --muted:#6b7280;
  --bg:#ffffff;
  --card:#ffffff;
  --shadow:0 10px 24px rgba(0,0,0,.08);
  --radius:16px;
  --max:1200px;
  --header-h:64px;
  --card-min-h:300px; /* last-wins from your sheet */
}
*{box-sizing:border-box}
html,body{margin:0;height:100%;overflow-x:hidden}
body{
  font-family:Inter,system-ui,Segoe UI,Roboto,Helvetica,Arial,sans-serif;
  background:#fafbff;
  color:var(--ink);
  padding-top:var(--header-h);
}
img,svg,video,canvas{max-width:100%;height:auto}

/* Basic layout */
.navbar{
  max-width:var(--max);
  margin:0 auto;
  display:flex;
  align-items:center;
  padding:10px 16px;
  gap:14px;
}
.brand{
  display:flex;
  align-items:center;
  gap:10px;
  text-decoration:none;
  color:var(--ink);
}
.brand img.icon{height:30px}
.brand img.word{height:24px}
.nav-actions{
  margin-left:auto;
  display:flex;
  align-items:center;
  gap:6px;
  position:relative;
}
.nav-link{
  padding:8px 12px;
  border-radius:12px;
  color:var(--ink);
  text-decoration:none;
  background:transparent;
  border:1px solid transparent;
  font-weight:600;
}
.nav-link:hover{
  border-color:#d5daf0;
  background:#eef2ff;
}
.dropdown{position:relative}
.menu{
  display:none;
  position:absolute;
  right:0;
  top:110%;
  min-width:240px;
  background:#fff;
  border:1px solid #e6e9f4;
  border-radius:14px;
  box-shadow:var(--shadow);
  padding:8px;
}
.dropdown:hover .menu{display:block}
.menu a{
  display:block;
  padding:10px 12px;
  border-radius:10px;
  color:var(--ink);
  text-decoration:none;
}
.menu a:hover{background:#f2f5ff}

main{
  max-width:var(--max);
  margin:24px auto;
  padding:0 16px;
  display:block;
  min-width:0;
}
.grid-cards{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:20px;
  align-items:stretch;
  min-width:0;
}
.card{
  background:var(--card);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:20px;
  display:flex;
  flex-direction:column;
  gap:10px;
  height:100%;
}
.card h3{margin:0 0 6px}
.card p{margin:0;color:var(--muted)}
.card .actions{
  margin-top:auto;
  display:flex;
  gap:8px;
}

.btn{
  padding:10px 14px;
  border-radius:12px;
  border:1px solid #dbe1f6;
  background:#f0f3ff;
  color:var(--brand);
  cursor:pointer;
  font-weight:700;
  text-decoration:none;
  display:inline-block;
}
.btn:hover{
  background:linear-gradient(90deg,var(--brand),var(--brand-light));
  color:#fff;
  border-color:transparent;
}
.btn-primary{
  background:linear-gradient(90deg,var(--brand),var(--brand-light));
  color:#fff;
  border:none;
}
.btn-primary:hover{filter:brightness(1.05)}

.field{
  display:flex;
  flex-direction:column;
  gap:6px;
}
.field input,
.field select{
  padding:10px;
  border:1px solid #dbe1f6;
  border-radius:12px;
  font:inherit;
}
.inline,
.actions{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
}
.result{
  margin-top:14px;
  padding:14px;
  border:1px dashed #d9defa;
  border-radius:12px;
  background:#f8f9ff;
}
.muted{color:var(--muted)}
.table{
  width:100%;
  border-collapse:collapse;
  margin-top:8px;
}
.table th,.table td{
  border-bottom:1px solid #eef1fb;
  padding:8px;
  text-align:right;
}
.table th:first-child,.table td:first-child{text-align:left}
.tabs{
  display:flex;
  gap:8px;
  margin:8px 0;
  flex-wrap:wrap;
}
.tab{
  padding:8px 12px;
  border-radius:10px;
  border:1px solid #dbe1f6;
  background:#f6f8ff;
  cursor:pointer;
}
.tab.active{
  background:#e9efff;
  border-color:#cfd8ff;
}
.tabpane{display:none}
.tabpane.active{display:block}
.segmented{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  background:#f3f6ff;
  border:1px solid #dbe1f6;
  padding:6px;
  border-radius:12px;
}
.segmented input{display:none}
.segmented label{
  padding:8px 10px;
  border-radius:10px;
  cursor:pointer;
  border:1px solid transparent;
}
/* Segmented controls (Energy status, Environment) – match Smart Activity highlight */
.segmented input:checked + label{
  background:#dbeafe;                           /* same blue as active tab */
  color:#053170;                                /* same text color as tabs */
  border-color:rgba(50,150,205,0.35);           /* subtle outline, optional */
  box-shadow:0 1px 0 rgba(255,255,255,.8) inset;/* soft highlight like tabs */
}

.switch{display:flex;gap:8px;align-items:center}
.scroll-row{
  display:flex;
  gap:12px;
  overflow:hidden;
  position:relative;
}
.scroll-row .pill{
  flex:0 0 auto;
  padding:10px 14px;
  border-radius:999px;
  border:1px solid #dbe1f6;
  background:#fff;
  color:var(--brand);
  white-space:nowrap;
  text-decoration:none;
}
@keyframes autoScroll{
  0%{transform:translateX(0)}
  100%{transform:translateX(-50%)}
}
.scroll-inner{
  display:flex;
  gap:12px;
  animation:autoScroll 28s linear infinite;
}
.site-footer{
  padding:30px 16px;
  text-align:center;
  color:var(--muted);
}

/* Responsive cards grid */
@media (max-width:960px){
  .grid-cards{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media (max-width:640px){
  .grid-cards{grid-template-columns:1fr}
}

/* ===== iOS-like fixed header ===== */
.site-header{
  position:fixed;
  top:0;left:0;right:0;
  z-index:2000;
  backdrop-filter:saturate(1.2) blur(12px);
  -webkit-backdrop-filter:saturate(1.2) blur(12px);
  background:linear-gradient(180deg,rgba(255,255,255,.85),rgba(255,255,255,.65));
  border-bottom:1px solid rgba(74,104,176,.18);
}
.mf-nav{
  max-width:var(--max);
  margin:0 auto;
  padding:10px 16px;
  display:flex;
  align-items:center;
  gap:14px;
  position:relative;
  min-width:0;
}
.mf-brand{
  display:flex;
  align-items:center;
  gap:10px;
  text-decoration:none;
  color:var(--ink);
}
.mf-logo{height:30px;width:auto}
.mf-wordmark{font-weight:800;letter-spacing:.2px}
.mf-right{
  margin-left:auto;
  display:flex;
  align-items:center;
  gap:14px;
}

/* Search pill */
.mf-search{
  position:relative;
  display:flex;
  align-items:center;
  min-width:260px;
  background:linear-gradient(180deg,#fff,#f8faff);
  border:1px solid #e5e9fb;
  border-radius:999px;
  padding:6px 12px;
  box-shadow:0 1px 0 rgba(255,255,255,.7) inset,
             0 6px 16px rgba(16,24,40,.05);
}
.mf-search:focus-within{
  border-color:rgba(74,104,176,.45);
  box-shadow:0 0 0 3px rgba(74,104,176,.12),
             0 10px 24px rgba(16,24,40,.08);
}
.mf-search input{
  border:0;
  outline:0;
  background:transparent;
  width:100%;
  font:inherit;
  color:var(--ink);
  padding:4px 0;
}
.mf-search input::placeholder{color:#9aa3bf}
.mf-search-clear{
  border:0;
  background:#eef2ff;
  color:#2A3A63;
  border-radius:999px;
  width:22px;
  height:22px;
  line-height:20px;
  font-size:14px;
  cursor:pointer;
}
.mf-results{
  position:absolute;
  top:calc(100% + 8px);
  left:0;right:0;
  z-index:1000;
  background:#fff;
  border:1px solid #e6e9f4;
  border-radius:14px;
  padding:6px;
  box-shadow:var(--shadow);
  max-height:280px;
  overflow:auto;
}
.mf-results a{
  display:flex;
  align-items:center;
  gap:8px;
  padding:10px 12px;
  border-radius:10px;
  text-decoration:none;
  color:var(--ink);
}
.mf-results a:hover{background:#f2f5ff}

/* Menu + states */
.mf-menu{
  display:flex;
  align-items:center;
  gap:6px;
  list-style:none;
  margin:0;
  padding:0;
}
.nav-link,
.drop-trigger{
  padding:6px 10px;
  border-radius:12px;
  background:transparent;
  border:1px solid transparent;
  font-weight:600;
  color:var(--ink);
  cursor:pointer;
  font-size:15px;
}
.nav-link:hover,
.drop-trigger:hover{
  border-color:#d5daf0;
  background:#eef2ff;
}
.mf-menu .nav-link[aria-current="page"],
.drop-trigger.is-active{
  background:#eef2ff;
  border-color:#d5daf0;
  color:#2A3A63;
  box-shadow:0 1px 0 rgba(255,255,255,.7) inset;
}
.dropdown{position:relative}
.drop-menu{
  position:absolute;
  top:95%;
  right:0;
  white-space:nowrap;
  padding:4px 6px;
  display:none;
  background:#fff;
  border:1px solid #e6e9f4;
  border-radius:10px;
  box-shadow:0 6px 18px rgba(0,0,0,.06);
}
.drop-menu a{
  display:block;
  padding:8px 10px;
  border-radius:8px;
  color:var(--ink);
  text-decoration:none;
  transition:background .2s ease;
}
.drop-menu a:hover{background:#f2f5ff}
@media (hover:hover){
  .dropdown:hover .drop-menu{display:block}
}

/* Active/tap overrides + focus */
.mf-nav .nav-link:active,
.mf-nav .drop-trigger:active{
  background:none!important;
  background-image:none!important;
  color:inherit!important;
  border-color:#d5daf0;
}
.mf-nav .nav-link:focus-visible,
.mf-nav .drop-trigger:focus-visible{
  outline:none;
  box-shadow:0 0 0 3px rgba(50,150,205,.28);
  border-radius:10px;
}
.mf-nav a,
.mf-nav button{-webkit-tap-highlight-color:transparent}

/* Burger + mobile flyout */
.mf-burger{
  display:none;
  width:42px;
  height:36px;
  border:1px solid #e5e9fb;
  border-radius:12px;
  background:linear-gradient(180deg,#fff,#f8faff);
  padding:0 8px;
  cursor:pointer;
  align-items:center;
  justify-content:center;
  gap:6px;
  flex-direction:column;
  box-shadow:0 1px 0 rgba(255,255,255,.7) inset;
  transition:box-shadow .2s,border-color .2s,transform .2s;
}
.mf-burger span{
  display:block;
  width:100%;
  height:2px;
  border-radius:2px;
  background:linear-gradient(90deg,var(--brand),var(--brand-light));
  transition:transform .28s cubic-bezier(.2,.7,.3,1),
             opacity .2s,
             width .2s,
             translate .28s;
}
.mf-burger.active span:nth-child(1){
  transform:translateY(8px) rotate(45deg);
}
.mf-burger.active span:nth-child(2){
  opacity:0;
  transform:scaleX(.4);
}
.mf-burger.active span:nth-child(3){
  transform:translateY(-8px) rotate(-45deg);
}

/* Mobile nav + search + menu */
@media (max-width:980px){
  .mf-burger{display:flex}
  .mf-right{position:relative}
  .mf-right .mf-search{
    display:flex !important;
    min-width:0;
    width:min(62vw,420px);
  }

  .mf-menu{
    position:fixed;
    top:calc(var(--header-h) + 6px);
    right:16px;
    width:auto;
    min-width:220px;
    max-width:260px;
    display:none;
    flex-direction:column;
    gap:6px;
    background:#fff;
    border:1px solid #e6e9f4;
    border-radius:14px;
    padding:10px 8px;
    box-shadow:0 20px 40px rgba(0,0,0,.10),
               0 1px 0 rgba(255,255,255,.7) inset;
    transform-origin:top right;
    transform:scale(.98) translateY(-6px);
    opacity:0;
    text-align:center;
    z-index:2100;
    align-items:flex-end;
  }
  .mf-menu.open{
    display:flex;
    transform:scale(1) translateY(0);
    opacity:1;
  }

  .mf-menu > li{
    width:100%;
  }

  .mf-menu .nav-link,
  .mf-menu .drop-trigger{
    display:flex;
    align-items:center;
    justify-content:center;
    width:100%;
    text-align:center;
    padding:8px 14px;
    border-radius:10px;
  }

  .dropdown .drop-menu{
    position:static;
    display:none;
    box-shadow:none;
    border:0;
    padding:0;
    margin:4px 0 0;
    background:#f7f8ff;
    border-radius:12px;
    border:1px dashed #d5daf0;
  }
  .dropdown.open .drop-menu{display:block}

  .drop-menu a{
    display:flex;
    justify-content:center;
    align-items:center;
    text-align:center;
    gap:6px;
    padding:8px 16px;
    font-size:14px;
    border-radius:8px;
    position:relative;
  }
  .drop-menu a:hover{background:#e9efff}
}

/* Hide wordmark on mobile */
@media (max-width:980px){
  .brand img.word{display:none;}
}

/* Make sure burger is always tappable above everything */
.mf-burger{position:relative;z-index:2200}

/* Flyout menu z-index polish */
@media (max-width:980px){
  .mf-menu{z-index:2100;}
}

/* Re-apply "active" pill look in mobile too */
@media (max-width:980px){
  .mf-menu .nav-link[aria-current="page"],
  .mf-menu .drop-trigger.is-active{
    background:#eef2ff;
    border-color:#d5daf0;
    color:#2A3A63;
    box-shadow:0 1px 0 rgba(255,255,255,.7) inset;
  }
}

/* ===== iOS-like card tiles ===== */
.card-link{
  position:relative;
  text-decoration:none;
  align-items:center;
  color:inherit;
  display:flex;
  flex-direction:column;
  justify-content:center;
  text-align:center;
  gap:10px;
  padding:20px;
  border-radius:var(--radius);
  background:linear-gradient(180deg,#ffffff,#f9faff);
  border:1px solid #eef1fb;
  box-shadow:0 1px 0 rgba(255,255,255,.6) inset,
             0 8px 20px rgba(16,24,40,.06);
  transition:transform 160ms cubic-bezier(.2,.7,.3,1),
             box-shadow 160ms cubic-bezier(.2,.7,.3,1),
             background 160ms cubic-bezier(.2,.7,.3,1),
             border-color 160ms cubic-bezier(.2,.7,.3,1);
  will-change:transform,box-shadow;
  isolation:isolate;
  min-height:var(--card-min-h);
  height:100%;
}
.card-link::before{
  content:"";
  position:absolute;
  inset:0;
  border-radius:inherit;
  background:radial-gradient(120% 60% at 50% -10%,rgba(255,255,255,.6),rgba(255,255,255,0) 60%);
  pointer-events:none;
  z-index:0;
}
.card-link:hover{
  transform:translateY(-3px);
  border-color:rgba(74,104,176,.35);
  background:linear-gradient(180deg,#ffffff,#f7f9ff),
             linear-gradient(90deg,rgba(42,58,99,0.07),rgba(74,104,176,0.07));
  background-blend-mode:overlay;
  box-shadow:0 3px 10px rgba(42,58,99,0.15),
             0 1px 3px rgba(42,58,99,0.08);
}
.card-link:active,
.card-link.press{
  transform:scale(.985);
  background:linear-gradient(180deg,#f4f6ff,#eef2ff),
             linear-gradient(90deg,rgba(42,58,99,0.12),rgba(74,104,176,0.12));
  background-blend-mode:overlay;
  box-shadow:0 1px 5px rgba(42,58,99,0.18),
             0 1px 2px rgba(0,0,0,0.08);
}
.card-link:focus-visible{
  outline:0;
  box-shadow:0 0 0 2px #fff,
             0 0 0 4px rgba(74,104,176,.35),
             0 14px 28px rgba(16,24,40,.10);
}
.grid-cards .card{
  padding:0;
  box-shadow:none;
}
.grid-cards .card h3,
.grid-cards .card p,
.grid-cards .card img{
  position:relative;
  z-index:1;
  padding:0 20px;
}
.grid-cards .card h3{margin:16px 20px 6px}
.grid-cards .card p{
  margin:0 20px 20px;
  color:var(--muted);
}
.grid-cards .card-link img{
  width:120px;
  height:120px;
  object-fit:contain;
  display:block;
  flex:0 0 auto;
}

/* ===== Featured Quizzes ===== */
.quizzes{
  max-width:var(--max);
  margin:8px auto 40px;
  padding:0 16px;
}
.quizzes-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:12px;
}
.quizzes-head h2{margin:0}
.quiz-controls{display:flex;gap:8px}
.quiz-controls button{
  width:36px;
  height:36px;
  border-radius:10px;
  border:1px solid #e6e9f4;
  background:linear-gradient(180deg,#fff,#f8faff);
  cursor:pointer;
  font-size:18px;
  line-height:1;
  display:grid;
  place-items:center;
  box-shadow:0 1px 0 rgba(255,255,255,.7) inset;
}
.quiz-controls button:hover{
  border-color:#d5daf0;
  background:#eef2ff;
}

/* Track */
.quiz-track{
  display:grid;
  grid-auto-flow:column;
  grid-auto-columns:minmax(280px,1fr);
  gap:16px;
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
  overscroll-behavior-inline:contain;
  scroll-snap-type:x mandatory;
  scroll-snap-stop:always;
  scrollbar-width:thin;
  padding:4px 2px 12px;
  scroll-padding-inline:12px;
  scrollbar-gutter:stable both-edges;
  touch-action:pan-x;
  min-width:0;
}
@media (min-width:720px){
  .quiz-track{grid-auto-columns:minmax(320px,1fr)}
}
@media (max-width:640px){
  .quiz-track{
    grid-auto-columns:88%;
    padding:2px 2px 10px;
    scroll-padding-inline:2px;
  }
}

.quiz-card{
  position:relative;
  border-radius:18px;
  overflow:hidden;
  text-decoration:none;
  color:inherit;
  box-shadow:0 10px 24px rgba(0,0,0,.08);
  scroll-snap-align:start;
  user-select:none;
  -webkit-user-drag:none;
  touch-action:pan-x;
  transform:translateZ(0);
}
.quiz-card::after{
  content:"";
  position:absolute;
  inset:0;
  border-radius:inherit;
  background:radial-gradient(120% 60% at 50% -10%,rgba(255,255,255,.35),transparent 60%);
  opacity:0;
  transition:opacity .2s ease;
}
.quiz-card:hover::after{opacity:1}
.quiz-card:active{transform:scale(.985)}

.quiz-hero{
  position:relative;
  margin:0;
  min-height:260px;
  display:grid;
  place-items:end;
  border-radius:18px;
  overflow:hidden;
}
.quiz-hero img{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  object-fit:cover;
  object-position:center;
  z-index:0;
  transition:transform .3s ease;
  pointer-events:none;
}
.quiz-hero::before{
  content:"";
  position:absolute;
  inset:0;
  z-index:1;
  background:linear-gradient(180deg,rgba(10,16,30,.35),rgba(10,16,30,.55));
}
.quiz-card:hover .quiz-hero img{transform:scale(1.05)}
.quiz-hero figcaption{
  position:relative;
  z-index:2;
  width:100%;
  padding:16px 16px 18px;
  color:#fff;
  text-shadow:0 1px 2px rgba(0,0,0,.35);
}
.quiz-hero h3{
  margin:6px 0 6px;
  font-size:18px;
  line-height:1.25;
}
.quiz-hero p{
  margin:0;
  opacity:.95;
  font-size:14px;
}
.quiz-tag{
  display:inline-block;
  font-size:12px;
  line-height:1;
  padding:7px 10px;
  border-radius:999px;
  background:linear-gradient(90deg,var(--brand),var(--brand-light));
  box-shadow:0 1px 0 rgba(255,255,255,.4) inset;
}
.quiz-track::-webkit-scrollbar{height:8px}
.quiz-track::-webkit-scrollbar-thumb{
  background:#e6e9f4;
  border-radius:999px;
}
@media (prefers-reduced-motion:reduce){
  .quiz-card,
  .quiz-card::after,
  .quiz-hero img{transition:none}
}

/* ===== Programs ===== */
.programs{
  max-width:var(--max);
  margin:8px auto 50px;
  padding:0 16px;
}
.programs-head{
  display:flex;
  align-items:end;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}
.programs-head h2{margin:0}
.program-grid{
  display:grid;
  gap:16px;
  grid-template-columns:repeat(2,minmax(0,1fr));
  min-width:0;
}
@media (max-width:820px){
  .program-grid{grid-template-columns:1fr}
}

/* Stack Programs heading and subline on mobile only */
@media (max-width:640px){
  .programs-head{
    flex-direction:column;
    align-items:flex-start;
    gap:4px;
  }
  .programs-head .muted{margin:2px 0 0;}
}

.program-card{
  position:relative;
  display:grid;
  grid-template-rows:auto auto auto;
  gap:10px;
  text-decoration:none;
  color:inherit;
  border-radius:18px;
  overflow:hidden;
  background:linear-gradient(180deg,#ffffff,#f9faff);
  border:1px solid #eef1fb;
  box-shadow:0 1px 0 rgba(255,255,255,.6) inset,
             0 10px 24px rgba(0,0,0,.08);
  transition:transform 160ms cubic-bezier(.2,.7,.3,1),
             box-shadow 160ms cubic-bezier(.2,.7,.3,1),
             border-color 160ms;
}
.program-card:hover{
  transform:translateY(-3px);
  border-color:rgba(74,104,176,.35);
  box-shadow:0 3px 10px rgba(42,58,99,.15),
             0 1px 3px rgba(42,58,99,.08);
}
.program-ribbon{
  position:absolute;
  top:12px;
  left:12px;
  z-index:3;
  font-size:12px;
  line-height:1;
  padding:7px 10px;
  border-radius:999px;
  background:linear-gradient(90deg,var(--brand),var(--brand-light));
  color:#fff;
  box-shadow:0 1px 0 rgba(255,255,255,.35) inset;
}
.program-hero{
  position:relative;
  margin:0;
  min-height:220px;
  display:grid;
  place-items:end;
  isolation:isolate;
}
.program-hero img{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  object-fit:cover;
  object-position:center;
  z-index:0;
  transition:transform .25s ease;
}
.program-card:hover .program-hero img{transform:scale(1.05)}
.program-hero::before{
  content:"";
  position:absolute;
  inset:0;
  z-index:1;
  background:linear-gradient(180deg,rgba(10,16,30,.30),rgba(10,16,30,.60));
}
.program-hero figcaption{
  position:relative;
  z-index:2;
  width:100%;
  padding:14px 14px 16px;
  color:#fff;
  text-shadow:0 1px 2px rgba(0,0,0,.35);
}
.program-hero h3{margin:6px 0 4px}
.program-hero p{
  margin:0;
  font-size:14px;
  opacity:.95;
}
.program-tag{
  display:inline-block;
  font-size:12px;
  line-height:1;
  padding:7px 10px;
  border-radius:999px;
  background:linear-gradient(90deg,var(--brand),var(--brand-light));
  box-shadow:0 1px 0 rgba(255,255,255,.4) inset;
}
.program-points{
  list-style:none;
  margin:6px 14px 0;
  padding:0;
  color:var(--ink);
}
.program-points li{
  padding:8px 0 8px 26px;
  border-bottom:1px solid #eef1fb;
  position:relative;
  font-size:14px;
}
.program-points li:last-child{border-bottom:0}
.program-points li::before{
  content:"";
  position:absolute;
  left:8px;
  top:12px;
  width:10px;
  height:10px;
  border-radius:50%;
  background:linear-gradient(90deg,var(--brand),var(--brand-light));
  box-shadow:0 0 0 2px #fff;
}
.program-cta{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:10px 14px 16px;
}
.price{
  display:flex;
  align-items:baseline;
  gap:4px;
  font-weight:800;
  color:var(--ink);
  font-size:22px;
}
.price span{font-size:14px;opacity:.85}
.program-card .btn,
.program-card .btn-primary{
  background:#2A3A63;
  color:#fff;
  border:none;
}
.program-card .btn:hover,
.program-card .btn-primary:hover{
  background:#243251;
  filter:none;
}
.program-card .btn:focus-visible,
.program-card .btn-primary:focus-visible{
  outline:0;
  box-shadow:0 0 0 3px rgba(42,58,99,.2);
}
.program-card .btn{pointer-events:none}
.program-card{width:100%;min-width:0}

/* ===== Calculators equal height ===== */
.grid-cards > .card{height:100%}
.grid-cards .card-link{
  display:flex;
  flex-direction:column;
  justify-content:center;
  align-self:stretch;
  min-height:var(--card-min-h);
  height:100%;
}
.grid-cards .card-link img{
  width:120px;
  height:120px;
  object-fit:contain;
  display:block;
}

/* ===== Calc row wrapper (arrows space) ===== */
.calc-wrap{
  position:relative;
  max-width:var(--max);
  margin:0 auto 24px;
  padding:0 16px;
}
@media (max-width:640px){
  .calc-wrap .grid-cards{padding:2px 44px 10px}
}

/* ===== Mobile carousels ===== */
/* Make quizzes behave like touch carousel on mobile */
@media (max-width:640px){
  .quiz-track{
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
    touch-action:pan-x;
    overscroll-behavior-inline:contain;
    scroll-snap-type:x mandatory;
    scroll-snap-stop:always;
  }
  .quiz-card{scroll-snap-align:start}
}

/* Calculators & Programs become horizontal ≤980px */
@media (max-width:980px){
  .grid-cards{
    grid-template-columns:none !important;
    grid-auto-columns:88%;
    grid-auto-flow:column;
    overflow-x:auto;
    gap:14px;
    padding:2px 2px 10px;
    scroll-snap-type:x mandatory;
    scroll-snap-stop:always;
    overscroll-behavior-inline:contain;
    scrollbar-width:thin;
  }
  .grid-cards .card{scroll-snap-align:start}

  .program-grid{
    grid-template-columns:none !important;
    grid-auto-flow:column;
    grid-auto-columns:85%;
    overflow-x:auto;
    gap:14px;
    padding:2px 2px 12px;
    scroll-snap-type:x mandatory;
    scroll-snap-stop:always;
    overscroll-behavior-inline:contain;
    scrollbar-width:thin;
  }
  .program-card{scroll-snap-align:start}
}

/* WebKit scrollbar polish */
.grid-cards::-webkit-scrollbar,
.program-grid::-webkit-scrollbar,
.quiz-track::-webkit-scrollbar{height:8px}
.grid-cards::-webkit-scrollbar-thumb,
.program-grid::-webkit-scrollbar-thumb,
.quiz-track::-webkit-scrollbar-thumb{
  background:#e6e9f4;
  border-radius:999px;
}

/* Search input cleanup */
.mf-search input[type="search"]{-webkit-appearance:none;appearance:none}
.mf-search input[type="search"]::-webkit-search-cancel-button,
.mf-search input[type="search"]::-webkit-search-decoration,
.mf-search input[type="search"]::-webkit-search-results-button,
.mf-search input[type="search"]::-webkit-search-results-decoration{display:none}
.mf-search input[type="search"]::-ms-clear{
  display:none;
  width:0;
  height:0;
}

/* =========================
   Search: icon-only -> expand to pill
   (paste AFTER existing .mf-search styles)
   ========================= */

/* Closed state: override your current pill visuals */
.mf-search.mf-search--toggle{
  position: relative;
  display: flex;
  align-items: center;

  width: 26px;
  min-width: 26px;
  padding: 0;

  background: transparent;
  border: 0;
  border-radius: 999px;
  box-shadow: none;

  overflow: hidden;
  transition: width .22s ease, padding .22s ease, background .22s ease, box-shadow .22s ease, border-color .22s ease;
  transform-origin: right center; /* expands left */
}

/* Open state: becomes your pill */
.mf-search.mf-search--toggle.is-open{
  width: clamp(220px, 28vw, 320px);
  padding: 6px 12px;

  background: linear-gradient(180deg,#fff,#f8faff);
  border: 1px solid #e5e9fb;
  box-shadow: 0 1px 0 rgba(255,255,255,.7) inset,
              0 6px 16px rgba(16,24,40,.05);
}

.mf-search.mf-search--toggle.is-open:focus-within{
  border-color: rgba(74,104,176,.45);
  box-shadow: 0 0 0 3px rgba(74,104,176,.12),
              0 10px 24px rgba(16,24,40,.08);
}

/* Icon: blue themed, no background */
.mf-search-toggle{
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  cursor: pointer;

  width: 26px;
  height: 26px;

  display: grid;
  place-items: center;

  color: #3296cd; /* MyFitometer blue */
}

.mf-search-toggle:focus-visible{
  outline: none;
  box-shadow: 0 0 0 3px rgba(50,150,205,.28);
  border-radius: 999px;
}

.mf-search-ico{
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* Hide input + clear when closed */
.mf-search.mf-search--toggle:not(.is-open) input{
  width: 0;
  padding: 0;
  opacity: 0;
  pointer-events: none;
}

.mf-search.mf-search--toggle:not(.is-open) .mf-search-clear{
  opacity: 0;
  pointer-events: none;
}

/* Smooth reveal */
.mf-search.mf-search--toggle input{
  transition: opacity .15s ease;
}

/* Never show dropdown results while closed */
.mf-search.mf-search--toggle:not(.is-open) .mf-results{
  display: none !important;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce){
  .mf-search.mf-search--toggle{
    transition: none;
  }
}


/* Hide wordmark on mobile (again, safe) */
@media (max-width:980px){
  .brand img.word{display:none;}
}

/* Ensure body padding equals real header height on mobile */
@media (max-width:980px){
  body{padding-top:var(--header-h);}
}

/* --- Explore other tools (desktop + mobile carousel) --- */
.tools-card{padding:18px}
.tool-track{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(160px,1fr));
  gap:12px;
  overflow:visible;
  scroll-snap-type:none;
  padding:6px 0 10px;
}
.tool-card{
  scroll-snap-align:start;
  user-select:none;
  text-decoration:none;
  color:inherit;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:flex-start;
  gap:10px;
  border-radius:16px;
  padding:16px 14px;
  text-align:center;
  background:linear-gradient(180deg,#ffffff,#f9faff);
  border:1px solid #eef1fb;
  box-shadow:0 1px 0 rgba(255,255,255,.6) inset,
             0 10px 24px rgba(0,0,0,.08);
  transition:transform .16s ease,
             box-shadow .16s ease,
             border-color .16s ease;
}
.tool-card:hover{
  transform:translateY(-3px);
  border-color:rgba(74,104,176,.35);
}
.tool-card h4{
  margin:0;
  font-size:16px;
}
.tool-card img{
  width:84px;
  height:84px;
  object-fit:contain;
  margin-top:6px;
  filter:drop-shadow(0 4px 10px rgba(0,0,0,.06));
}

/* Mobile: horizontal carousel squares */
@media (max-width:980px){
  .tool-track{
    display:flex;
    flex-direction:row;
    gap:12px;
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
    scroll-snap-type:x mandatory;
    scroll-snap-stop:always;
    touch-action:pan-x;
    padding:6px 12px 12px;
    scrollbar-width:thin;
    scroll-padding-inline:12px;
    overscroll-behavior-x:contain;
  }
  .tool-card{
    flex:0 0 clamp(180px,70vw,240px);
    scroll-snap-align:start;
    aspect-ratio:1/1;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    text-align:center;
    padding:14px 10px;
  }
  .tool-card h4{
    margin:6px 0 0;
    font-size:15px;
    line-height:1.2;
    max-width:95%;
    display:-webkit-box;
    -webkit-line-clamp:2;
    -webkit-box-orient:vertical;
    overflow:hidden;
  }
  .tool-card img{
    width:56%;
    height:auto;
    max-height:56%;
    object-fit:contain;
    margin:0;
  }
}
.tool-track::-webkit-scrollbar{height:8px}
.tool-track::-webkit-scrollbar-thumb{
  background:#e6e9f4;
  border-radius:999px;
}

/* ==== Fix: main layout so cards don't collapse on mobile ==== */
main{
  max-width:var(--max);
  margin:24px auto;
  padding:0 16px;
  display:block;
}

/* === Mobile nav: make whole row tappable & highlightable (re-affirm) === */
@media (max-width:980px){
  .mf-menu > li{width:100%}
}

/* ===========================
   Body Fat % page – final tweaks
   =========================== */

/* Narrow, centered calculator (more space for ads) */
.calc-card{
  max-width:min(620px,100%);   /* narrower than before */
  margin:32px auto 24px;
  padding:22px;
  border-radius:16px;
  box-shadow:var(--shadow);
  background:#ffffff;
  overflow:hidden; 
}
@media (max-width:640px){
  .calc-card{
    max-width:100%;
    width:100%;
    margin:20px auto;
    padding:16px;
  }

  .calc-card .calc-grid{
    width:100%;
    max-width:100%;
  }
}

/* Bordered chip tabs inside calc-card (no gradient) */
.calc-card .tabs{
  display:flex;
  flex-wrap:nowrap;        /* keep them on a single row on desktop */
  overflow-x:auto;         /* allow slight horizontal scroll if needed */
  gap:6px;
  padding:4px;
  border-radius:999px;
  border:1px solid #dbe1f6;
  background:#ffffff;
  box-shadow:none;
}

.calc-card .tab{
  padding:6px 12px;
  border-radius:999px;
  border:1px solid transparent;
  background:transparent;
  cursor:pointer;
  font-weight:600;
  font-size:14px;
  color:var(--ink);
}
/* Active calculator tab – match unit toggle style */
.calc-card .tab.active{
  background:#dbeafe;                            /* same as unit-btn.active */
  color:#053170;
  border-color:transparent;                      /* no border */
  box-shadow:0 1px 0 rgba(255,255,255,.8) inset; /* same soft highlight */
}


/* Units toggle buttons (cm / inches) */
.unit-toggle{
  display:inline-flex;
  align-items:center;
  gap:4px;
  padding:3px;
  border-radius:999px;
  background:#f6f8ff;
  border:1px solid #dbe1f6;
}
.unit-btn{
  border:none;
  background:transparent;
  padding:6px 12px;
  border-radius:999px;
  font:inherit;
  font-size:14px;
  cursor:pointer;
  color:#2A3A63;
}
.unit-btn.active{
  background:#dbeafe;
  color:#053170;
  box-shadow:0 1px 0 rgba(255,255,255,.8) inset;
}
.unit-btn:focus-visible{
  outline:none;
  box-shadow:0 0 0 2px rgba(50,150,205,.4);
}

.field select{
  background-color:#f6f8ff;
  border:1px solid #dbe1f6;
  border-radius:12px;
  padding:10px 36px 10px 10px;  /* extra right space for the arrow */
  font:inherit;
  color:var(--ink);
  appearance:none;
  -webkit-appearance:none;
  -moz-appearance:none;

  /* Single, crisp arrow icon */
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%239aa3bf' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat:no-repeat;
  background-position:right 12px center;
  background-size:12px 8px;
}

.field select:focus{
  border-color:var(--brand-light);
  box-shadow:0 0 0 2px rgba(50,150,205,.25);
  outline:none;
}

/* Calculator action buttons: solid blue, darker hover */
.calc-card .actions{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-top:8px;
}
/* Base style for both buttons inside calculator */
.calc-card .btn,
.calc-card .btn-primary{
  background:#f0f3ff;              /* same as your reset button style */
  color:var(--brand);
  border:1px solid #dbe1f6;
  border-radius:12px;
  padding:10px 14px;
  font-weight:700;
  cursor:pointer;
  text-decoration:none;
}

/* Hover: slightly darker blue, no gradient */
.calc-card .btn:hover,
.calc-card .btn-primary:hover{
  background:#e0e7ff;              /* a touch darker than base */
  border-color:#c5cff4;
  color:var(--brand);
  filter:none;                      /* kill any gradient/brightness effect */
}

/* Focus ring for accessibility */
.calc-card .btn:focus-visible,
.calc-card .btn-primary:focus-visible{
  outline:none;
  box-shadow:0 0 0 3px rgba(50,150,205,.25);
}

/* Result spacing / stability */
.calc-card .result{
  margin-top:20px;
  min-height:56px;
}

/* US Navy: make the units pill only as wide as its content */
.calc-card #pane-navy .unit-toggle{
  display:inline-flex;      /* already, but re-assert here */
  width:auto;               /* don't stretch to full column */
  align-self:flex-start;    /* hug the label, not stretch */
}

/* ===== Circumference Pro (US Navy) layout ===== */

/* Two-column grid for the Navy form */
.calc-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  column-gap:14px;
  row-gap:12px;
}

/* Full-width items inside the grid */
.calc-grid .span2{
  grid-column:1 / -1;
}

/* On small screens, stack everything in one column */
@media (max-width:640px){
  .calc-grid{
    grid-template-columns:1fr;
  }
}

/* Buttons: half-width left/right on larger screens, full-width stacked on mobile */
.calc-card #pane-navy .actions{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-top:8px;
}

/* Default: stacked full-width on narrow screens */
.calc-card #pane-navy .actions .btn,
.calc-card #pane-navy .actions .btn-primary{
  flex:1 1 100%;
}

/* ≥ 640px: neatly split left/right */
@media (min-width:640px){
  .calc-card #pane-navy .actions{
    flex-wrap:nowrap;
    justify-content:space-between;
  }

  .calc-card #pane-navy .actions .btn,
  .calc-card #pane-navy .actions .btn-primary{
    flex:0 0 calc(50% - 6px); /* reduced width so they sit nicely on each side */
  }
}
/* Make the kg / lb dropdown a bit wider in the body weight inline row */
#navy-wunit,
#sf-wunit{
  min-width: 55px;   /* adjust to taste: 80–110px works well */
}

/* Base style for buttons inside calculator */
.calc-card .btn,
.calc-card .btn-primary{
  border-radius:12px;
  padding:10px 14px;
  font-weight:700;
  cursor:pointer;
  text-decoration:none;
}

/* RESET – lighter look */
.calc-card .btn{
  background:#f4f6ff;        /* lighter */
  color:var(--brand);
  border:1px solid #dbe1f6;
}

/* CALCULATE – slightly darker, more “primary” */
.calc-card .btn-primary{
  background:#dbeafe;        /* stronger blue */
  color:#053170;
  border:1px solid #c5cff4;
}

/* Hover states: keep same relationship */
.calc-card .btn:hover{
  background:#e5ebff;
  border-color:#cfd8ff;
}

.calc-card .btn-primary:hover{
  background:#c7d8ff;
  border-color:#b4c6ff;
}

/* Focus ring for accessibility */
.calc-card .btn:focus-visible,
.calc-card .btn-primary:focus-visible{
  outline:none;
  box-shadow:0 0 0 3px rgba(50,150,205,.25);
}

/* Mobile fix: keep calculator tabs inside the main bubble */
@media (max-width:640px){
  .calc-card .tabs{
    flex-wrap:wrap;
    border-radius:16px;   /* softer rectangle instead of ultra pill */
    overflow:hidden;      /* clip the blue highlight so it stays inside */
    gap:4px;
  }

  .calc-card .tab{
    flex:1 1 100%;        /* each tab becomes a full-width row */
    text-align:center;
  }
}

/* === Calculator buttons: shared style for BOTH calculators === */
.calc-card .btn,
.calc-card .btn-primary{
  border-radius:12px;
  padding:10px 14px;
  font-weight:700;
  cursor:pointer;
  text-decoration:none;
  font:inherit;
}

/* RESET – lighter secondary */
.calc-card .btn{
  background:#f4f6ff;        /* lighter */
  color:var(--brand);
  border:1px solid #dbe1f6;
}

/* CALCULATE – primary */
.calc-card .btn-primary{
  background:#dbeafe;        /* stronger blue */
  color:#053170;
  border:1px solid #c5cff4;
}

/* Hover states */
.calc-card .btn:hover{
  background:#e5ebff;
  border-color:#cfd8ff;
}

.calc-card .btn-primary:hover{
  background:#c7d8ff;
  border-color:#b4c6ff;
}

/* Focus ring */
.calc-card .btn:focus-visible,
.calc-card .btn-primary:focus-visible{
  outline:none;
  box-shadow:0 0 0 3px rgba(50,150,205,.25);
}
/* === Calculator actions layout – apply to BOTH tabs === */
.calc-card .actions{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-top:8px;
}

/* Default (mobile): stack full width */
.calc-card .actions .btn,
.calc-card .actions .btn-primary{
  flex:1 1 100%;
}

/* ≥ 640px: two neat half-width buttons */
@media (min-width:640px){
  .calc-card .actions{
    flex-wrap:nowrap;
    justify-content:space-between;
  }

  .calc-card .actions .btn,
  .calc-card .actions .btn-primary{
    flex:0 0 calc(50% - 6px);
  }
}

/* Skinfold inputs layout + spacing */
#pane-skinfold .inner{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  column-gap:14px;   /* space BETWEEN left & right columns */
  row-gap:10px;      /* space ABOVE/BETWEEN/BELOW rows */
  margin-top:10px;   /* space below the label */
  margin-bottom:10px;/* space before the next field (Body Weight) */
}

#pane-skinfold .inner input{
  width:100%;
}

/* Make Home + dropdown titles use the exact same text styling */
.mf-nav .nav-link,
.mf-nav .drop-trigger{
  font-family: inherit;
  font-weight: 600 !important;  /* keep them equally bold */
  font-size: 15px;
  line-height: 1.2;
}

/* 1RM results table with % of 1RM */
.rm-table th:nth-child(2),
.rm-table td:nth-child(2) {
  text-align: center;
  white-space: nowrap;
}

.rm-table td:last-child {
  text-align: right;
}

/* Load–rep curve card */
.rm-chart {
  margin-top: 16px;
  padding: 12px 16px 16px;
  border-radius: 16px;
  border: 1px solid rgba(79,70,229,.12);
  background: #f9fbff;
}

.rm-chart figcaption {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 4px;
}

.rm-chart svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

.rm-chart line.axis {
  stroke: rgba(15,23,42,0.18);
  stroke-width: 1;
}

.rm-chart path.curve {
  fill: none;
  stroke: var(--brand, #053170);
  stroke-width: 2;
}

.rm-chart circle.point {
  fill: #ffffff;
  stroke: var(--brand, #053170);
  stroke-width: 1;
}

.rm-chart text.tick {
  font-size: 10px;
  fill: rgba(15,23,42,0.60);
}

/* 1RM RM points – mobile layout */
@media (max-width: 640px) {
  .rm-points {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .rm-points .row {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.5rem;
  }

  .rm-points .row input[type="number"] {
    flex: 1 1 0;
    min-width: 0;         /* prevent overflow */
  }

  .rm-points .row .btn {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 0.45rem 0.75rem;  /* small but tappable */
  }
}

/* 1RM curve chart – mobile scaling */
@media (max-width: 640px) {
  .rm-chart {
    margin-top: 1.25rem;
  }

  .rm-chart svg {
    width: 100%;
    height: 280px;   /* bump this up if you want it even larger */
    /* optional: slightly easier to tap */
    touch-action: manipulation;
  }
}

/* Body fat % calculator */
/* ===== What you will need sections ===== */
.what-you-need {
  padding: 10px 12px;
  border-radius: 14px;
  background: #f5f7ff;
  border: 1px solid #e1e6ff;
}

.what-you-need .need-head {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.what-you-need .need-list {
  margin: 0;
  padding-left: 18px;
  font-size: 0.9rem;
}

.what-you-need .need-list li {
  margin-bottom: 2px;
}

.what-you-need .need-tip {
  margin-top: 6px;
  font-size: 0.85rem;
}

/* ===== Labels with question-mark help icons ===== */
.label-row {
  display: inline-flex;        /* keeps label + ? together */
  align-items: center;
  justify-content: flex-start; /* no pushing apart */
  gap: 4px;                    /* small space so it reads as “Chest ?” */
}


.help-icon {
  border: none;
  padding: 0;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  background: #e5ecff;
  color: #053170;
  flex-shrink: 0;
}

.help-icon:hover {
  background: #d6e0ff;
}

.help-icon:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(50,150,205,.35);
}

/* Skinfold site cells */
.sf-site {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sf-site label {
  font-size: 0.9rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Ensure the two-column layout still works nicely */
#pane-skinfold .inner {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 14px;
  row-gap: 10px;
  margin-top: 10px;
  margin-bottom: 10px;
}

#pane-skinfold .inner input {
  width: 100%;
}

/* ===== Simple modal overlay for skinfold diagrams ===== */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2500;
}

.modal.open {
  display: flex;
}

.modal::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(15,23,42,0.45);
  backdrop-filter: blur(4px);
}

.modal-dialog {
  position: relative;
  z-index: 1;
  max-width: min(480px, 92vw);
  width: 100%;
  max-height: 80vh;
  overflow: auto;

  background: #ffffff;
  border-radius: 18px;
  padding: 16px 18px 18px;
  box-shadow: 0 18px 45px rgba(15,23,42,0.32);

  display: flex;              /* NEW */
  flex-direction: column;     /* NEW */
}



.modal-dialog h3 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 1.05rem;
}

.modal-dialog p {
  font-size: 0.9rem;
  margin: 4px 0;
}

.modal-dialog img {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 10px;
  border-radius: 10px;
}


.modal-close {
  position: sticky;           /* sticks when scrolling inside dialog */
  top: 0;                     /* stick to top of scroll area */
  align-self: flex-end;       /* push to the right edge */
  margin: 0 0 8px 0;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border: none;
  background: #ffffff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: #4b5563;

  border-radius: 999px;
  padding: 2px 8px 4px;
  box-shadow: 0 1px 4px rgba(15,23,42,0.16);
  z-index: 2;                 /* above content */
}

.modal-close:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(50,150,205,.35);
}

/* Make results always use full width in the calc card */
.calc-card .result {
  margin-top: 20px;
  min-height: 56px;
  width: 100%;
  box-sizing: border-box;
}

/* If a result is ever placed inside the 2-column calc grid, span both columns */
.calc-grid .result {
  grid-column: 1 / -1;
}

/* ===== Body fat result summary & bar ===== */
.bf-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.9rem;
}

.bf-main .big {
  display: block;
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 2px;
}

.bf-main .sub {
  font-size: 0.9rem;
  color: var(--muted);
}

/* Bar with low / healthy / high zones */
.bf-bar {
  position: relative;
  margin-top: 4px;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: #e5e7eb;
}

.bf-bar-inner {
  display: flex;
  width: 100%;
  height: 100%;
}

.bf-zone {
  height: 100%;
}

.bf-zone--low {
  background: #fef3c7;   /* soft amber */
}

.bf-zone--ok {
  background: #bbf7d0;   /* light green */
}

.bf-zone--high {
  background: #fee2e2;  /* light red */
}

/* Marker for user's value */
.bf-marker {
  position: absolute;
  top: -3px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid #053170;
  background: #ffffff;
  box-shadow: 0 4px 10px rgba(15,23,42,0.18);
  transform: translateX(-50%);
}

/* Labels under the bar */
.bf-labels {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  margin-top: 4px;
  font-size: 0.78rem;
}

.bf-labels span {
  flex: 1;
  text-align: center;
  color: var(--muted);
}

.bf-labels span.active {
  color: #053170;
  font-weight: 600;
}

.bf-text {
  font-size: 0.86rem;
  margin: 4px 0 0;
}

.bf-masses {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.bf-chip {
  flex: 1 1 140px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px dashed #dbe1f6;
  background: #f9fbff;
  font-size: 0.85rem;
}

.bf-chip .label {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
}

.bf-chip strong {
  font-size: 0.95rem;
}

.bf-tip {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 4px 0 0;
}

.bf-footnote {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 6px 0 0;
}


/* BMR result friendly layout */
.bmr-summary {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.95rem;
}

.bmr-summary .bmr-main {
  font-size: 1.2rem;
  margin: 4px 0;
}

.bmr-summary hr {
  border: 0;
  border-top: 1px dashed #dbe1f6;
  margin: 10px 0;
}

/* Slightly tighter env toggle */
.env-toggle label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.9rem;
  white-space: nowrap;
}

/* ===== Environment slider (BMR) ===== */
.env-slider{
  margin-top:6px;
  padding:8px 4px 0;
}

.env-slider input[type="range"]{
  width:100%;
  -webkit-appearance:none;
  appearance:none;
  height:6px;
  border-radius:999px;
  background:linear-gradient(
    90deg,
    #f97316,   /* very hot – orange */
    #facc15,   /* hot – yellow */
    #22c55e,   /* neutral – green */
    #38bdf8,   /* cold – light blue */
    #1d4ed8    /* very cold – deep blue */
  );
  outline:none;
}

/* WebKit thumb */
.env-slider input[type="range"]::-webkit-slider-thumb{
  -webkit-appearance:none;
  appearance:none;
  width:18px;
  height:18px;
  border-radius:50%;
  background:#ffffff;
  border:2px solid var(--brand);
  box-shadow:0 0 0 2px rgba(255,255,255,.9),
             0 4px 10px rgba(15,23,42,.25);
  margin-top:-6px; /* centers thumb on track */
}

/* Firefox thumb */
.env-slider input[type="range"]::-moz-range-thumb{
  width:18px;
  height:18px;
  border-radius:50%;
  background:#ffffff;
  border:2px solid var(--brand);
  box-shadow:0 0 0 2px rgba(255,255,255,.9),
             0 4px 10px rgba(15,23,42,.25);
}

/* Firefox track */
.env-slider input[type="range"]::-moz-range-track{
  height:6px;
  border-radius:999px;
  background:transparent; /* we already set via main rule */
}

/* Edge/IE (best-effort) */
.env-slider input[type="range"]::-ms-thumb{
  width:18px;
  height:18px;
  border-radius:50%;
  background:#ffffff;
  border:2px solid var(--brand);
}

/* Labels under the slider */
.env-labels{
  display:flex;
  justify-content:space-between;
  margin-top:6px;
  font-size:0.78rem;
  color:var(--muted);
  gap:2px;
}

.env-labels span{
  flex:1;
  text-align:center;
  padding:2px 2px;
  white-space:nowrap;
}

.env-labels span.active{
  color:var(--brand);
  font-weight:600;
}

/* ===== TDEE results summary ===== */
.tdee-summary{
  display:flex;
  flex-direction:column;
  gap:8px;
}

.tdee-main{
  font-size:0.95rem;
  font-weight:500;
}

.tdee-main .big{
  display:block;
  font-size:1.5rem;
  font-weight:800;
  margin-bottom:2px;
}

.tdee-maint{
  padding:8px 10px;
  border-radius:12px;
  background:#eef2ff;
  border:1px solid #dbe1f6;
  font-size:0.9rem;
}

.tdee-bar{
  margin-top:4px;
  height:12px;
  border-radius:999px;
  overflow:hidden;
  background:#e5e7eb;
}

.tdee-bar-inner{
  display:flex;
  height:100%;
  width:100%;
}

.tdee-seg{
  height:100%;
}

.tdee-seg--bmr{background:#bfdbfe;}
.tdee-seg--act{background:#60a5fa;}
.tdee-seg--tef{background:#1d4ed8;}

.tdee-legend{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:6px;
  font-size:0.78rem;
  color:var(--muted);
}

.tdee-legend span{
  display:flex;
  align-items:center;
  gap:4px;
}

.swatch{
  width:12px;
  height:8px;
  border-radius:999px;
  display:inline-block;
}

.swatch-bmr{background:#bfdbfe;}
.swatch-act{background:#60a5fa;}
.swatch-tef{background:#1d4ed8;}

.tdee-note{
  font-size:0.82rem;
  color:var(--muted);
  margin-top:2px;
}

/* ===== TDEE Athlete Mode – training blocks layout ===== */
#form-tdee-athlete .training-help {
  margin: 0 0 6px;
  font-size: 0.86rem;
}

/* Container for all rows */
#form-tdee-athlete .ath-blocks {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

/* Each training row */
#form-tdee-athlete .ath-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 0.9fr) minmax(0, 0.9fr) auto;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: #f6f8ff;
  border: 1px solid #dbe1f6;
}

#form-tdee-athlete .ath-cell small {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 2px;
}

#form-tdee-athlete .ath-row select,
#form-tdee-athlete .ath-row input {
  width: 100%;
}

/* Remove button style inside row */
#form-tdee-athlete .ath-remove {
  padding: 6px 10px;
  font-size: 0.8rem;
  white-space: nowrap;
}

/* Add block button – full width pill */
#form-tdee-athlete .add-block-btn {
  width: 100%;
  margin-top: 10px;
  text-align: center;
}

/* Mobile: stack nicely */
@media (max-width: 640px) {
  #form-tdee-athlete .ath-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: flex-start;
  }

  #form-tdee-athlete .ath-cell--activity {
    grid-column: 1 / -1;
  }

  #form-tdee-athlete .ath-remove {
    justify-self: flex-end;
    margin-top: 4px;
  }
}

/* Align "Effort (MET)" column with Activity & Hours per week */
#form-tdee-athlete .ath-row > :nth-child(3) {
  margin-top: -6px;        /* nudge the whole Effort (MET) cell up */
}

#form-tdee-athlete .ath-row > :nth-child(3) .label-row {
  position: relative;
  top: -1px;               /* tiny extra nudge for the "Effort (MET) ?" label */
}

/* ===== Generic hidden utility ===== */
.hidden {
  display: none !important;
}

/* ===== Macros calculator: goal slider & macro sliders ===== */

/* Goal slider (Cut / Maintain / Bulk) */
.goal-slider {
  margin-top: 4px;
}

/* Softer, low-contrast goal slider track */
.goal-slider input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    #ffffff 10%,
    #e7ebf8  60%,
    #d4dbf5 100%
  );
  outline: none;
}

/* Firefox track */
.goal-slider input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: #f5f7ff;
}


/* Protein preset slider – match protein segment in pie (#38bdf8) */
#protein-slider {
  background: linear-gradient(
    90deg,
    #e0f2fe 0%,
    #38bdf8 60%,
    #0ea5e9 100%
  );
}

/* Firefox track */
#protein-slider::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    #e0f2fe 0%,
    #38bdf8 60%,
    #0ea5e9 100%
  );
}

/* Fat preset slider – match fat segment in pie (#f97316) */
#fat-slider {
  background: linear-gradient(
    90deg,
    #ffedd5 0%,
    #f97316 60%,
    #ea580c 100%
  );
}

/* Firefox track */
#fat-slider::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    #ffedd5 0%,
    #f97316 60%,
    #ea580c 100%
  );
}


.goal-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--brand);
  box-shadow:
    0 0 0 2px rgba(255,255,255,.9),
    0 4px 10px rgba(15,23,42,.25);
  margin-top: -6px;
}

.goal-slider input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--brand);
  box-shadow:
    0 0 0 2px rgba(255,255,255,.9),
    0 4px 10px rgba(15,23,42,.25);
}

.goal-slider input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: transparent;
}

.goal-slider .goal-labels {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-top: 6px;
  font-size: 0.85rem;
}

.goal-slider .goal-labels button {
  flex: 1;
  border: none;
  border-radius: 999px;
  padding: 6px 8px;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  font-weight: 500;
}

.goal-slider .goal-labels button.active {
  background: #dbeafe;
  color: #053170;
  box-shadow: 0 1px 0 rgba(255,255,255,.8) inset;
}

/* Macro sliders (protein & fat) */
.macro-slider {
  margin-top: 4px;
}

.macro-slider input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(83,129,255,.15),
    rgba(83,129,255,.85)
  );
  outline: none;
}

.macro-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--brand);
  box-shadow:
    0 0 0 2px rgba(255,255,255,.9),
    0 3px 8px rgba(15,23,42,.25);
  margin-top: -5px;
}

.macro-slider input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--brand);
  box-shadow:
    0 0 0 2px rgba(255,255,255,.9),
    0 3px 8px rgba(15,23,42,.25);
}

.macro-slider input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: transparent;
}

.macro-slider .macro-slider-scale {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 4px;
}

.macro-slider .macro-slider-value {
  margin: 4px 0 0;
  font-size: 0.85rem;
}

/* Weekly goal segmented control inside macros */
.goal-rate {
  margin-top: 4px;
}

/* ===== Macros result layout + pie chart ===== */

.macros-summary {
  display: grid;
  gap: 14px;
}

@media (min-width: 640px) {
  .macros-summary {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.3fr);
    align-items: center;
  }
}

.macros-pie-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.macros-pie {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: #e5e7eb;
  box-shadow: 0 10px 24px rgba(15,23,42,0.18);
  position: relative;
}

.macros-pie-hole {
  position: absolute;
  inset: 26%;
  border-radius: 50%;
  background: #fafbff;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.9) inset;
}

.macros-legend {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.86rem;
}

.macros-legend div {
  display: flex;
  align-items: center;
  gap: 6px;
}

.macros-table-wrap h3 {
  margin-top: 0;
  margin-bottom: 6px;
}

.macros-note {
  margin-top: 6px;
}

/* Macro swatches – reuse global .swatch base */
.swatch-protein { background: #38bdf8; }
.swatch-fat     { background: #f97316; }
.swatch-carbs   { background: #22c55e; }

/* Make modal primary buttons match calc-card buttons */
.modal .btn{
  background:#dbeafe;        /* same light blue */
  color:#053170;
  border:1px solid #c5cff4;
}

.modal .btn:hover{
  background:#c7d8ff;        /* same hover color */
  border-color:#b4c6ff;
}



/* ===========================
   1RM & 5RM calculator tweaks
   =========================== */

/* Exercise cards (icons) */
/* Desktop / tablet: 5 per row */
.lift-grid{
  display:grid;
  grid-template-columns:repeat(5, minmax(0, 1fr));
  gap:10px;
  margin-top:4px;
}


.lift-card{
  border-radius:14px;
  scroll-snap-align:center;
  border:1px solid #e1e6ff;
  background:#f9fbff;
  padding:10px 8px;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:6px;
  cursor:pointer;
  text-align:center;
  font-size:0.85rem;
  color:var(--ink);
  transition:
    background 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 140ms ease;
}

.lift-card img{
  width:40px;
  height:40px;
  object-fit:contain;
}

.lift-card span{
  text-wrap:balance;
}

.lift-card.is-active{
  background:#dbeafe;
  border-color:#c5cff4;
  box-shadow:0 1px 0 rgba(255,255,255,.8) inset;
  color:#053170;
}

.lift-card:focus-visible{
  outline:none;
  box-shadow:0 0 0 3px rgba(50,150,205,.35);
}

/* Tip bubble */
.calc-tip{
  margin-top:4px;
  padding:10px 12px;
  border-radius:14px;
  border:1px dashed #dbe1f6;
  background:#f5f7ff;
  display:flex;
  gap:8px;
  align-items:flex-start;
  font-size:0.85rem;
  color:var(--muted);
}

.calc-tip-icon{
  width:20px;
  height:20px;
  border-radius:999px;
  background:#dbeafe;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:12px;
  color:#053170;
  flex-shrink:0;
}

/* RM input rows */
.rm-points{
  display:flex;
  flex-direction:column;
  gap:8px;
  margin:4px 0 8px;
}

.rm-points .row{
  display:grid;
  grid-template-columns:minmax(0,0.7fr) minmax(0,1.1fr) auto;
  gap:8px;
}

.rm-points .row input{
  padding:8px 10px;
  border-radius:12px;
  border:1px solid #dbe1f6;
  background:#f6f8ff;
}

.rm-points .row .rm-remove{
  white-space:nowrap;
}

/* Desktop / tablet results layout */
.rm-summary{
  margin-top:18px;
  padding:14px 14px 12px;
  border-radius:16px;
  border:1px solid #e1e6ff;
  background:#f9fbff;
  display:flex;
  flex-direction:column;
  gap:8px;
}

.rm-head{
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:flex-start;
  flex-wrap:wrap;
}

.rm-main-title{
  font-size:0.82rem;
  text-transform:uppercase;
  letter-spacing:.06em;
  color:var(--muted);
}

.rm-main-big{
  font-size:1.6rem;
  font-weight:800;
}

.rm-main-sub{
  font-size:0.9rem;
  color:var(--muted);
}

.rm-side{
  display:flex;
  flex-direction:column;
  gap:6px;
}

.rm-pill{
  min-width:120px;
  border-radius:999px;
  padding:6px 10px;
  background:#eef2ff;
  border:1px solid #dbe1f6;
  font-size:0.8rem;
  display:flex;
  justify-content:space-between;
  gap:8px;
}

.rm-pill .label{
  color:var(--muted);
}

.rm-pill-conf .value{
  font-weight:600;
}

.rm-explain{
  font-size:0.86rem;
  color:var(--muted);
  margin:4px 0 0;
}

/* 1RM results layout: table first, chart full-width below */
.rm-layout{
  display:flex;
  flex-direction:column;   /* always stacked */
  gap:16px;
  margin-top:14px;
}

.rm-table-wrap,
.rm-chart-wrap{
  width:100%;
}

/* Optional: a tiny bit more breathing room under the chart */
.rm-chart-wrap{
  margin-bottom:4px;
}

/* Line of text that updates when you tap/hover points */
.rm-chart-info{
  margin-top:8px;
  font-size:0.82rem;
  color:var(--muted);
}


.rm-subheading{
  margin:0 0 6px;
  font-size:0.95rem;
}

.rm-table-note,
.rm-chart-note{
  margin-top:6px;
  font-size:0.8rem;
  color:var(--muted);
}

.rm-chart-note{
  font-style:italic;
}

.rm-footnote{
  margin-top:12px;
  font-size:0.8rem;
}


/* Existing rm-chart styles already in your CSS – this just ensures axis class is us*

/* Mobile: horizontal swipe row */
@media (max-width:640px){
  .lift-grid{
    width:100%;
    max-width:100%;
    display:flex;
    flex-direction:row;
    flex-wrap:nowrap;
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
    scroll-snap-type:x mandatory;
    scroll-snap-stop:always;
    gap:10px;
    padding:2px 4px 8px;   /* small padding so cards never touch the edge */
    scrollbar-width:thin;
  }

  .lift-card{
    flex:0 0 32vw;         /* about 3 cards visible with a peek of the next */
    max-width:32vw;
    aspect-ratio:1 / 1;    /* perfect square */
    padding:10px;  }

  .lift-card img{
    width:55%;
    height:auto; 
  }

  .lift-grid::-webkit-scrollbar{
    height:6px;
  }
  .lift-grid::-webkit-scrollbar-thumb{
    background:#e6e9f4;
    border-radius:999px;
  }
}

/* Calculator card – mobile: never wider than screen */
@media (max-width:640px){
  .calc-card{
    max-width:100%;
    width:100%;
    margin:20px auto;
    padding:16px;
  }

  #form-onerm.calc-grid{
    width:100%;
    max-width:100%;
  }
}

/* --- Exercise icons --- */

/* Container that belongs to the card */
.lift-strip{
  width:100%;
  max-width:100%;
  overflow:hidden;            /* no bleed outside card */
}

/* Desktop / tablet: 5 icons in one row, no scrolling */
.lift-grid{
  display:grid;
  grid-template-columns:repeat(5, minmax(0, 1fr));
  gap:10px;
  margin-top:4px;
}

/* Base card style */
.lift-card{
  border-radius:14px;
  border:1px solid #e1e6ff;
  background:#f9fbff;
  padding:10px 8px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:6px;
  cursor:pointer;
  text-align:center;
  font-size:0.85rem;
  color:var(--ink);
  transition:
    background 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 140ms ease;
  scroll-snap-align:center;
}

.lift-card img{
  width:40px;
  height:40px;
  object-fit:contain;
}

.lift-card.is-active{
  background:#dbeafe;
  border-color:#c5cff4;
  box-shadow:0 1px 0 rgba(255,255,255,.8) inset;
  color:#053170;
}

/* --- Mobile: horizontal swipe INSIDE the card, big square buttons --- */
@media (max-width:640px){
  .lift-strip{
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
  }

  .lift-grid{
    /* contents can be wider, but only lift-strip scrolls, not the card */
    display:flex;
    flex-direction:row;
    flex-wrap:nowrap;
    gap:10px;
    padding:2px 4px 8px;
    width:max-content;       /* width is just as wide as the icons row */
    max-width:none;
    scroll-snap-type:x mandatory;
    scroll-snap-stop:always;
  }

  .lift-card{
    flex:0 0 32vw;           /* ~3 cards visible + peek of next */
    max-width:32vw;
    aspect-ratio:1 / 1;      /* perfect square */
    padding:10px;
  }

  .lift-card img{
    width:55%;
    height:auto;             /* nice big icon */
  }

  .lift-grid::-webkit-scrollbar{
    height:6px;
  }
  .lift-grid::-webkit-scrollbar-thumb{
    background:#e6e9f4;
    border-radius:999px;
  }
}

/* ============================
   1RM & 5RM – width + clipping fix
   ============================ */

/* Form and its rows can never be wider than the white card */
.calc-card #form-onerm,
.calc-card #form-onerm .field,
.calc-card #form-onerm .actions {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

@media (max-width: 640px) {

  /* Keep everything visually inside the rounded white box */
  .calc-card{
    max-width: 100%;
    width: 100%;
    margin: 20px auto;
    padding: 16px;
    overflow: hidden;   /* <-- important: no content sticks outside */
  }

  /* Extra safety so no child row forces horizontal overflow */
  .calc-card #form-onerm,
  .calc-card #form-onerm .rm-points,
  .calc-card #form-onerm .rm-points .row {
    max-width: 100%;
    min-width: 0;
  }

  /* Full-width buttons on mobile, still inside the card */
  .calc-card #form-onerm .actions {
    flex-wrap: wrap;
  }

  .calc-card #form-onerm .actions .btn,
  .calc-card #form-onerm .actions .btn-primary {
    flex: 1 1 100%;
  }

  /* Exercise strip: only this area scrolls horizontally */
  .lift-strip{
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
  }
}
/* ============================
   1RM & 5RM – equal left/right gap
   ============================ */

/* Default: form fills card */
.calc-card #form-onerm {
  width: 100%;
  max-width: 100%;
  margin: 0;
}

/* Mobile: make form slightly narrower and center it
   so the gap on the right matches the gap on the left */
@media (max-width: 640px) {
  .calc-card {
    padding: 16px;          /* equal padding inside white box */
    overflow: hidden;       /* keep everything inside the rounded card */
  }

  .calc-card #form-onerm {
    width: calc(100% - 4px); /* 2px gutter on each side inside the card */
    max-width: calc(100% - 4px);
    margin: 0 auto;          /* centers the form */
  }

  /* Safety: no child row can force overflow */
  .calc-card #form-onerm .field,
  .calc-card #form-onerm .actions,
  .calc-card #form-onerm .rm-points,
  .calc-card #form-onerm .rm-points .row {
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }
}

/* 1RM page – keep Weight units pill shorter */
#form-onerm .field .unit-toggle {
  align-self: flex-start;   /* don't stretch to full field width */
  width: auto;
}

/* Optional: small cap on mobile so it looks nice and compact */
@media (max-width: 640px) {
  #form-onerm .field .unit-toggle {
    max-width: 220px;       /* adjust up/down to taste */
  }
}

/* ===== BMI result summary & traffic-light bar ===== */
.bmi-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.9rem;
}

.bmi-main .label {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.bmi-main .big {
  display: block;
  font-size: 1.7rem;
  font-weight: 800;
  margin: 2px 0 0;
}

.bmi-main .sub {
  font-size: 0.9rem;
  color: var(--muted);
}

/* Bar: yellow → green → red */
.bmi-bar {
  position: relative;
  margin-top: 4px;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: #e5e7eb;
}

.bmi-bar-inner {
  display: flex;
  width: 100%;
  height: 100%;
}

.bmi-zone {
  height: 100%;
}

.bmi-zone--low {
  background: #fef3c7;  /* yellow – underweight */
}

.bmi-zone--ok {
  background: #bbf7d0;   /* green – healthy */
}

.bmi-zone--high {
  background: #fee2e2;   /* red – higher BMI */
}

/* Marker for current BMI */
.bmi-marker {
  position: absolute;
  top: -3px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid #053170;
  background: #ffffff;
  box-shadow: 0 4px 10px rgba(15,23,42,0.18);
  transform: translateX(-50%);
}

/* Labels under the bar */
.bmi-labels {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  margin-top: 4px;
  font-size: 0.78rem;
}

.bmi-labels span {
  flex: 1;
  text-align: center;
  color: var(--muted);
}

.bmi-labels span.active {
  color: #053170;
  font-weight: 600;
}

.bmi-text {
  font-size: 0.86rem;
  margin: 4px 0 0;
}

.bmi-footnote {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 4px 0 0;
}

/* ===========================
   Strength Levels – Result UI
   =========================== */

.strength-summary {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.9rem;
}

.strength-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.strength-headline {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.strength-percentile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #dbeafe;
  color: #053170;
  font-weight: 700;
  font-size: 1.1rem;
}

.strength-tag {
  padding: 4px 10px;
  border-radius: 999px;
  background: #f3f4ff;
  border: 1px solid #dbe1f6;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
}

/* Bar with tier zones */
.strength-bar {
  position: relative;
  margin-top: 6px;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: #e5e7eb;
}

.strength-bar-inner {
  display: flex;
  width: 100%;
  height: 100%;
}

.strength-zone {
  height: 100%;
}

/* Colour for each tier band */
.strength-zone--beginner     { background: #fee2e2; } /* soft red */
.strength-zone--novice       { background: #fed7aa; } /* orange */
.strength-zone--intermediate { background: #fde68a; } /* amber */
.strength-zone--advanced     { background: #bbf7d0; } /* green */
.strength-zone--excellent    { background: #a5f3fc; } /* cyan */
.strength-zone--elite        { background: #e0e7ff; } /* pale blue */

.strength-marker {
  position: absolute;
  top: -3px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid #053170;
  background: #ffffff;
  box-shadow: 0 4px 10px rgba(15,23,42,0.18);
  transform: translateX(-50%);
}

.strength-labels {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  margin-top: 4px;
  font-size: 0.78rem;
}

.strength-labels span {
  flex: 1;
  text-align: center;
  color: var(--muted);
}

.strength-labels span.active {
  color: #053170;
  font-weight: 600;
}

/* Chips with detailed numbers */
.strength-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.strength-chip {
  flex: 1 1 140px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px dashed #dbe1f6;
  background: #f9fbff;
  font-size: 0.85rem;
}

.strength-chip .label {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
}

.strength-chip strong {
  font-size: 0.95rem;
}

.strength-note {
  margin-top: 4px;
  font-size: 0.86rem;
}

.strength-footnote {
  margin-top: 2px;
  font-size: 0.78rem;
  color: var(--muted);
}

/* Make the result breathe a little more on mobile */
@media (max-width: 640px) {
  .strength-summary {
    font-size: 0.88rem;
  }
  .strength-percentile {
    font-size: 1rem;
    min-width: 56px;
  }
}

/* ===========================
   Strength Levels – lift row
   One row + big arrows
   =========================== */

/* Wrapper: arrows + scrollable strip */
.strength-lift-row .lift-strip-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Scroll container – scrolls horizontally, scrollbar hidden */
.strength-lift-row .lift-strip {
  flex: 1;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;

  /* hide scrollbar (Firefox + WebKit) */
  scrollbar-width: none;
}
.strength-lift-row .lift-strip::-webkit-scrollbar {
  display: none;
}

/* Row of cards – always one horizontal row */
.strength-lift-row .lift-grid {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  width: max-content;               /* expand to fit all cards in one row */
}

/* Card sizing specific to this calculator */
.strength-lift-row .lift-card {
  min-width: 110px;
  padding: 10px 8px;
  scroll-snap-align: center;
}

/* Big plain arrows (no pill/shape) */
.lift-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  box-shadow: none;
  padding: 0;

  font-size: 34px;        /* make arrow big */
  line-height: 1;
  color: #9aa3bf;         /* soft grey by default */
  cursor: pointer;
  flex-shrink: 0;
}

.lift-arrow:hover {
  color: #053170;         /* dark blue on hover */
}

.lift-arrow:focus-visible {
  outline: none;
  color: #053170;
  text-shadow: 0 0 0 1px rgba(5,49,112,0.35);
}

/* Mobile: hide arrows, keep manual swipe */
@media (max-width: 640px) {
  .strength-lift-row .lift-arrow {
    display: none;
  }

  .strength-lift-row .lift-strip {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    scroll-snap-stop: always;
  }

  .strength-lift-row .lift-grid {
    padding: 2px 4px 8px;
  }

  .strength-lift-row .lift-card {
    flex: 0 0 32vw;      /* ~3 cards visible with peek of next */
    max-width: 32vw;
    aspect-ratio: 1 / 1; /* square buttons on mobile */
  }

  .strength-lift-row .lift-card img {
    width: 55%;
    height: auto;
  }
}

/* ===========================
   Strength Levels – mobile polish
   =========================== */
@media (max-width:640px){

  /* Make Strength calculator match Body Fat % card layout */
  .calc-card--strength{
    max-width:100%;
    width:100%;
    margin:20px auto;
    padding:16px;
    overflow:hidden;        /* nothing sticks outside the white box */
    font-size:0.9rem;       /* same general text size feel */
  }

  /* Ensure the Strength form sits cleanly inside the card */
  #form-strength.calc-grid{
    grid-template-columns:1fr;  /* single column like BF% on mobile */
    width:100%;
    max-width:100%;
  }

  #form-strength .field,
  #form-strength .actions{
    max-width:100%;
    min-width:0;
    box-sizing:border-box;
  }

  /* Smoother manual swipe for exercise cards on mobile */
  .strength-lift-row .lift-strip{
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;   /* momentum scrolling */
    scroll-behavior:smooth;             /* smooth programmatic scroll */
    scroll-snap-type:x proximity;       /* softer snap than "mandatory" */
    overscroll-behavior-inline:contain;
    touch-action:pan-x;
  }

  .strength-lift-row .lift-grid{
    display:flex;
    flex-wrap:nowrap;
    gap:10px;
    padding:2px 4px 8px;
    width:max-content;                  /* row is only as wide as its cards */
  }

  .strength-lift-row .lift-card{
    flex:0 0 32vw;                      /* ~3 cards + peek */
    max-width:32vw;
    aspect-ratio:1 / 1;
    padding:10px;
    scroll-snap-align:center;
  }

  .strength-lift-row .lift-card img{
    width:55%;
    height:auto;
  }
}

/* Strength Levels – keep Lift units pill compact (not full-width) */
#form-strength #liftUnitToggle {
  align-self: flex-start;
  width: auto;
}

@media (max-width: 640px) {
  #form-strength #liftUnitToggle {
    max-width: 220px; /* adjust if you want it a bit wider/narrower */
  }
}

/* === Strength results: progress bar + vertical legend (Option 1) === */

.strength-results-layout {
  display: flex;
  gap: 1.5rem;
  align-items: stretch;
  justify-content: space-between;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

.strength-main {
  flex: 1 1 280px;
  min-width: 0;
}

.strength-percentile-display {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 1rem;
}

.strength-percentile-number {
  font-size: 2.75rem;
  font-weight: 700;
  line-height: 1;
  color: #053170;
  display: flex;
  align-items: flex-end;
}

.strength-percentile-number span {
  font-size: 1rem;
  margin-left: 3px;
  color: #6b7280;
}

.strength-percentile-caption {
  font-size: 0.85rem;
  color: #6b7280;
}

.strength-tier-label {
  font-size: 0.95rem;
  color: #111827;
}

/* Progress bar */

.strength-progress-bar {
  margin-top: 0.75rem;
}

.strength-progress-track {
  position: relative;
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.strength-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3296cd, #053170);
  transition: width 0.35s ease-out;
}

.strength-progress-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.strength-progress-marker span {
  display: block;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #ffffff;
  border: 2px solid #053170;
  box-shadow: 0 0 0 2px rgba(5, 49, 112, 0.1);
}

.strength-progress-scale {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #9ca3af;
  margin-top: 0.25rem;
}

/* Legend */

.strength-legend {
  flex: 0 0 210px;
  background: #f9fafb;
  border-radius: 12px;
  padding: 0.9rem 1rem;
  border: 1px solid #e5e7eb;
}

.strength-legend-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 0.5rem;
}

.strength-legend-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.strength-legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.3rem;
  border-radius: 8px;
}

.strength-legend-item.is-current {
  border-left: 3px solid #053170;
  background: #eff6ff;
}

.strength-legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid #d1d5db;
  flex-shrink: 0;
}

.strength-legend-text {
  display: flex;
  flex-direction: column;
}

.strength-legend-label {
  font-size: 0.85rem;
  color: #111827;
}

.strength-legend-range {
  font-size: 0.7rem;
  color: #6b7280;
}

/* Placeholder text */

.strength-placeholder {
  font-size: 0.9rem;
  color: #6b7280;
}

/* Responsive: legend drops under on mobile */

@media (max-width: 768px) {
  .strength-results-layout {
    flex-direction: column;
  }

  .strength-legend {
    width: 100%;
    flex: 1 1 auto;
  }
}

/* Progress bar */

.strength-progress-bar {
  margin-top: 0.75rem;
}

.strength-progress-track {
  position: relative;
  width: 100%;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: transparent;        /* colours come from segments */
  border: 1px solid #e5e7eb;
}

.strength-progress-segments {
  display: flex;
  width: 100%;
  height: 100%;
}

.strength-progress-segment {
  height: 100%;
}

/* marker stays the same */
.strength-progress-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.strength-progress-marker span {
  display: block;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #ffffff;
  border: 2px solid #053170;
  box-shadow: 0 0 0 2px rgba(5, 49, 112, 0.1);
}

/* left/right labels under the bar */
.strength-progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: #6b7280;
  margin-top: 4px;
}

.strength-progress-labels span:first-child {
  text-align: left;
}

.strength-progress-labels span:last-child {
  text-align: right;
}

.strength-next-tier {
  margin-top: 0.9rem;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px dashed #dbe1f6;
  background: #f9fbff;
  font-size: 0.85rem;
}

.strength-next-tier-label {
  font-weight: 600;
  margin-bottom: 2px;
}

.strength-next-tier-detail {
  font-size: 0.83rem;
  color: #4b5563;
}

.strength-next-tier--max .strength-next-tier-detail {
  font-style: italic;
}

/* Body Fat % – make all key inputs the same, narrower width */
#navy-sex,
#navy-height,
#navy-neck,
#navy-waist,
#navy-hip,
#sf-sex,
#sf-age,
#sf-chest,
#sf-midax,
#sf-triceps,
#sf-subscap,
#sf-abdom,
#navy-weight,
#sf-weight,
#sf-supra,
#sf-thigh {
  max-width: 150px;   /* adjust this value up/down to taste */
}

@media (max-width:640px){
#navy-weight,
#sf-weight {
  max-width:85px;
}
}

/* Body Fat % – keep two-column layout even on mobile */
@media (max-width:640px){
  #form-navy.calc-grid,
  #form-skinfold.calc-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  /* Full-width rows (already use .span2, just reaffirm) */
  #form-navy .span2,
  #form-skinfold .span2{
    grid-column: 1 / -1;
  }
}

/* Extra breathing room above key labels on Body Fat % calculator */
#form-navy label[for="navy-sex"],
#form-navy label[for="navy-weight"],
#form-navy label[for="navy-units"],
#form-navy label[for="navy-height"],
#form-navy label[for="navy-neck"],
#form-navy label[for="navy-waist"],
#form-navy label[for="navy-hip"],
#form-navy .field span2 > label,

#form-skinfold label[for="sf-sex"],
#form-skinfold label[for="sf-age"],
#form-skinfold label[for="sf-weight"],
#form-skinfold .span2 > .label-row > label,          /* Seven skinfolds (mm) */

#form-skinfold label[for="sf-triceps"],
#form-skinfold label[for="sf-subscap"],
#form-skinfold label[for="sf-abdom"],
#form-skinfold label[for="sf-supra"],
#form-skinfold label[for="sf-thigh"] {
  display: inline-block;      /* ensure margin applies as expected */
  margin-top: 0.75rem;        /* tweak this value up/down to taste */
}



/* === BMR & TDEE – fixed 150px width for key fields === */
#form-bmr input[name="bf"],              /* Body Fat % */

#form-tdee-smart input[name="bmr"],      /* BMR (kcal) - Smart mode */
#form-tdee-smart input[name="days"],     /* Exercise days / week */

#form-tdee-smart select[name="occ"],     /* Occupation baseline */
#form-tdee-smart select[name="dur"],     /* Session duration */
#form-tdee-smart select[name="int"],     /* Session intensity */
#form-tdee-smart select[name="steps"],   /* Daily steps */
#form-tdee-smart select[name="ttype"],   /* Training type */

#form-tdee-athlete input[name="bmr"],    /* BMR (kcal) - Athlete mode */
#form-tdee-athlete select[name="occAthlete"] /* Occupation baseline (athlete) */
{
  width: 150px;
  max-width: 150px;
}

#form-bmr input[name="weight"]
{
  width: 150px;
}

/* === BMR & TDEE: keep desktop-style 2-column layout on mobile === */
@media (max-width: 768px) {
  /* Force 2 columns for these specific forms even on phones */
  #form-bmr.calc-grid,
  #form-tdee-smart.calc-grid,
  #form-tdee-athlete.calc-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Anything marked span2 still stretches across both columns */
  #form-bmr .span2,
  #form-tdee-smart .span2,
  #form-tdee-athlete .span2 {
    grid-column: 1 / -1;
  }
}


@media (max-width:640px){
#form-bmr input[name="weight"]         /* Body Weight */
{
width: 85px;
}}

/* ==== Extra breathing room above key labels on BMR & TDEE ==== */

/* BMR form */
#form-bmr > .field:nth-of-type(1) > label,              /* Body Weight */
#form-bmr > .field:nth-of-type(2) .label-row > label,   /* Body Fat % */
#form-bmr > .field:nth-of-type(3) .label-row > label {  /* Environment */
  display: inline-block;
  margin-top: 0.75rem;  /* tweak value to taste */
}

/* TDEE – Smart Activity Mode */
#form-tdee-smart > .field:nth-of-type(1) > label,             /* BMR (kcal) */
#form-tdee-smart > .field:nth-of-type(2) .label-row > label,  /* Occupation baseline */
#form-tdee-smart > .field:nth-of-type(3) .label-row > label,  /* Exercise days / week */
#form-tdee-smart > .field:nth-of-type(4) .label-row > label,  /* Session duration */
#form-tdee-smart > .field:nth-of-type(5) .label-row > label,  /* Session intensity */
#form-tdee-smart > .field:nth-of-type(6) .label-row > label,  /* Daily steps */
#form-tdee-smart > .field:nth-of-type(7) .label-row > label { /* Training type */
  display: inline-block;
  margin-top: 0.75rem;
}

/* TDEE – Athlete Mode */
#form-tdee-athlete > .field.span2:nth-of-type(1) > label,            /* BMR (kcal) */
#form-tdee-athlete > .field.span2:nth-of-type(2) .label-row > label, /* Apart from your training... */
#form-tdee-athlete > .field.span2:nth-of-type(4) > label {           /* Training in a typical week */
  display: inline-block;
  margin-top: 0.75rem;
}

/* Macros calculator: narrow key number inputs */
.calc-card #mac-cal,
.calc-card #mac-bw {
  width: 150px;
  max-width: 100%;
  box-sizing: border-box;
}

/* Macros – add breathing room above each row title */
#form-macros .field + .field {
  margin-top: 0.75rem;
}

#form-macros .field {
  margin-top: 0.75rem;
}

/* Extra spacing above key field headings on 1RM & 5RM */
.field-heading {
  display: inline-block;
  margin-top: 0.75rem;
}

/* Layout for RM rows inside the 1RM calculator */
#rm-points .row {
  display: flex;
  align-items: center;
  gap: 0.4rem;          /* keeps reps, weight, Remove close together */
  margin-top: 0.4rem;
}

/* Narrower inputs */
#rm-points .row input[data-role="reps"] {
  max-width: 7rem;    /* tweak if you want even slimmer */
}

#rm-points .row input[data-role="weight"] {
  max-width: 150px;      /* tweak as needed */
}

/* Keep Remove button tight next to inputs */
#rm-points .row .rm-remove {
  flex: 0 0 auto;
  white-space: nowrap;
  margin-left: 0.25rem;
  /* optional: make it slightly more compact */
  padding-inline: 0.6rem;
  padding-block: 0.25rem;
  font-size: 0.85rem;
}

/* Layout for RM rows inside the 1RM calculator */
#rm-points .row {
  display: flex;
  align-items: center;
  justify-content: center;   /* ⬅️ center the whole group */
  gap: 0.4rem;
  margin-top: 0.4rem;
}

/* Narrower inputs */
#rm-points .row input[data-role="reps"],
#rm-points .row input[data-role="weight"] {
  max-width: 150px;         /* adjust weight below if you want wider */
  text-align: center;        /* center the numbers inside the boxes */
}

/* Keep Remove button tight next to inputs */
#rm-points .row .rm-remove {
  flex: 0 0 auto;
  white-space: nowrap;
  margin-left: 0.25rem;
  padding-inline: 0.6rem;
  padding-block: 0.25rem;
  font-size: 0.85rem;
}

/* Make "+ Add RM point" button narrower */
#add-rm {
  display: inline-flex;      /* shrink to content */
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.75rem;  /* smaller padding = smaller width */
  font-size: 0.9rem;         /* optional: slightly smaller text */
  margin-top: 0.5rem;        /* keep a bit of breathing room above */
  margin-left: auto;
  margin-right: auto;
}

  /* ---------- Strength Levels form spacing ---------- */

  /* 0.75rem margin-top for these titles */
  #form-strength .strength-lift-row > label,          /* Exercise */
  #form-strength label[for="sl-sex"],                 /* Sex */
  #form-strength label[for="sl-age"],                 /* Age */
  #form-strength label[for="sl-bw"],                  /* Body weight */
  #form-strength #liftUnitsField > label,             /* Lift units */
  #form-strength label[for="sl-rm"],                  /* RM type */
  #form-strength label[for="sl-val"] {                /* Lift input */
    margin-top: 0.75rem;
    display: block;
  }

  /* ---------- Narrower inputs/selects (150px) ---------- */

  #form-strength #sl-sex,
  #form-strength #sl-age,
  #form-strength #sl-bw,
  #form-strength #sl-rm,
  #form-strength #sl-val {
    width: min(150px, 100%);
  }

  /* ---------- Mobile layout: mirror desktop structure ---------- */
  /* Exercise on top, Sex left / Age right,
     Body weight full width below Sex,
     Lift units full width below Body weight,
     RM type left / Lift input right */

  @media (max-width: 720px) {
    /* Keep a 2-column grid on mobile for this form only */
    #form-strength.calc-grid {
      display: grid;
      grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
      column-gap: 1rem;
    }

    /* Make span2 fields (Exercise, BW, Lift units, buttons) full width */
    #form-strength .span2 {
      grid-column: 1 / -1;
    }

    /* Prevent weird shrinking / overflow on small screens */
    #form-strength .field {
      min-width: 0;
    }
  }

  /* =========================
   BMI – Layout + Inputs
   ========================= */

/* Put BMI form into a 2-column flex layout: Weight + Height side by side */
#form-bmi {
  display: flex;
  flex-wrap: wrap;
  column-gap: 1.5rem;
  row-gap: 1rem;
}

/* Weight + Height fields take ~50% each */
#form-bmi .field.span2 {
  flex: 1 1 calc(50% - 0.75rem);
  min-width: 0;
}

/* Actions row goes full width underneath */
#form-bmi .actions.span2 {
  flex: 0 0 100%;
  margin-top: 1rem;
}

/* Inline rows for inputs + dropdowns */
#form-bmi .inline {
  display: flex;
  align-items: center;     /* vertical alignment */
  flex-wrap: nowrap;       /* keep everything on ONE line, even on mobile */
  gap: 0.5rem;
  margin-top: 0.75rem;     /* requested top margin for weight/height row */
}

/* TEXTBOXES: Weight + Height inputs (85px wide) */
#form-bmi input[name="weight"],
#form-bmi input[name="h1"],
#form-bmi input[name="h2"] {
  width: 85px;             /* requested textbox width */
  box-sizing: border-box;
}

/* DROPDOWNS: kg + cm/in/ft+in – make them narrower */
#form-bmi select[name="wunit"],
#form-bmi select[name="hmode"] {
  width: 70px;             /* reduced dropdown width */
  box-sizing: border-box;
  flex: 0 0 auto;
}

/* HEIGHT ROW: swap order so textbox(es) come first, dropdown on the right */
#form-bmi .inline input[name="h1"],
#form-bmi .inline input[name="h2"] {
  order: 1;                /* textboxes left */
}

#form-bmi .inline select[name="hmode"] {
  order: 2;                /* dropdown right */
}

#form-bmi .field.span2 {
  margin-top: 0.75rem;   /* adds space above Weight & Height titles */
}

/* Mobile: stack Weight then Height (not side-by-side) */
@media (max-width: 680px){
  #form-bmi{
    column-gap: 0;              /* optional: remove horizontal gap */
  }
  #form-bmi .field.span2{
    flex: 0 0 100%;
  }
}



/* Three comparison views block */

.strength-multi-summary {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.84rem;
}

.strength-multi-title {
  margin: 0 0 0.1rem;
  font-weight: 600;
  color: #111827;
}

.strength-multi-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.strength-multi-list li {
  padding: 0.35rem 0.45rem;
  border-radius: 8px;
  border: 1px dashed #e5e7eb;
  background: #f9fafb;
}

.strength-multi-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  margin-bottom: 2px;
}

.strength-multi-main {
  font-size: 0.9rem;
}

.strength-multi-main strong {
  font-weight: 600;
}

.strength-multi-tier {
  font-size: 0.8rem;
  color: #4b5563;
  margin-left: 4px;
}

.strength-multi-desc {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: #6b7280;
}

@media (max-width: 640px) {
  .strength-multi-summary {
    font-size: 0.82rem;
  }
}

/* ✅ Stop the legend card from stretching tall (brings its bottom border higher up) */
.strength-results-layout {
  align-items: flex-start; /* was stretch */
}

.strength-legend {
  align-self: flex-start;
  height: fit-content;
}

/* ✅ Full-width row under BOTH columns */
.strength-wide-row {
  width: 100%;
  margin-top: 1rem;
  text-align: center;
}

/* Make Next tier box truly full width + centered text */
.strength-wide-row .strength-next-tier {
  width: 100%;
  text-align: center;
}

.strength-wide-row .strength-next-tier-detail {
  text-align: center;
}

/* Footnote full width + centered like next tier */
.strength-wide-row .strength-footnote {
  width: 100%;
  margin-top: 0.75rem;
  text-align: center;
}

.strength-percentile-explainer{
  margin-top: 0.5rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  font-size: 0.83rem;
  color: #374151;
  line-height: 1.35;
}

@media (max-width: 640px){
  .strength-percentile-explainer{
    font-size: 0.81rem;
  }
}

/* ✅ Right column wrapper: keeps Next tier directly under the legend */
.strength-side{
  flex: 0 0 210px;         /* same width as legend card */
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  align-self: flex-start;
}

/* Keep next tier centered and full width of the right column */
.strength-side .strength-next-tier{
  width: 100%;
  text-align: center;
}
.strength-side .strength-next-tier-detail{
  text-align: center;
}

/* Mobile: right column becomes full width like everything else */
@media (max-width: 768px){
  .strength-side{
    width: 100%;
    flex: 1 1 auto;
  }
}
.strength-legend{
    margin-left: 16px; /* tweak: 8px, 12px, 20px */
  }

/* Smooth momentum scrolling on iOS + clean swipe */
.tool-track{
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;     /* makes manual swipes land cleanly */
  scroll-padding-left: 12px;         /* optional: nicer snap alignment */
}

.tool-card{
  scroll-snap-align: start;
}

/* Hide number input spinners (Chrome, Edge, Safari) */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Hide number input spinners (Firefox) */
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* =========================
   MyFitometer – Copy Button
   ========================= */
.mf-copy {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.mf-copy-btn {
  border: 1px solid rgba(5,49,112,.25);
  background: #f5f7ff;
  color: #053170;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  transition: transform .05s ease, background .15s ease, border-color .15s ease, color .15s ease;
}

.mf-copy-btn:hover { background: #e5ecff; }
.mf-copy-btn:active { transform: translateY(1px); }

.mf-copy-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(50,150,205,.35);
}

.mf-copy-btn.copied {
  background: #053170;
  color: #ffffff;
  border-color: #053170;
}

.mf-copy-btn[disabled]{
  opacity: .8;
  cursor: default;
}

/* Force a clean magnifying glass (overrides any older fill-based icon rules) */
.mf-search-toggle{
  color: #0b4ead; /* dark blue */
}

.mf-search-ico{
  width: 20px !important;
  height: 20px !important;
  display: block;
  fill: none !important;        /* kills old fill rule */
  stroke: currentColor !important;
  stroke-width: 2.2 !important;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Push the whole nav group to the right */
.mf-nav{
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Right-side cluster: search + menu + burger */
.mf-right{
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* Ensure the search dropdown can escape the pill on the HOME (toggle) search */
.mf-search--toggle {
  position: relative;
  overflow: visible; /* critical: don't clip the dropdown */
}

.mf-search--toggle .mf-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 9999; /* keep it above nav/hero */
}

/* ✅ HOME search dropdown: stop it being clipped by the toggle wrapper */
.mf-search.mf-search--toggle{
  overflow: visible; /* overrides the earlier overflow:hidden */
}

/* keep results above everything */
.mf-search.mf-search--toggle .mf-results{
  z-index: 3000;
}

:root{
    --mf-blue:#053170;
    --mf-border:rgba(15,23,42,.10);
    --mf-shadow:0 12px 28px rgba(2,8,23,.10);
}

.pp-footer{
      margin-top: 14px;
      padding: 14px;
      border-radius: 18px;
      border: 1px solid var(--mf-border);
      background: rgba(255,255,255,.75);
      box-shadow: var(--mf-shadow2);
    }
    .pp-footer a{
      color: var(--mf-blue);
      text-decoration:none;
      font-weight:650;
    }
    .pp-footer a:hover{ text-decoration:underline; }

    /* =========================================================
   MyFitometer — Body Type (Frame Somatotype) Calculator CSS
   Paste into ../css/styles.css (or a page-specific css file)
   Designed to match the Body Fat % calculator look & layout.
   ========================================================= */

/* ---- Card layout (same feel as calc-card) ---- */
.calc-card.bodytype-card {
  max-width: 920px;
  margin: 0 auto;
}

.calc-card.bodytype-card .calc-head {
  display: flex;
  flex-direction: column;
  gap: .65rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid rgba(0,0,0,.08);
  margin-bottom: .75rem;
}

.calc-card.bodytype-card .calc-title {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.2;
}

.calc-card.bodytype-card .calc-subtitle {
  margin: 0;
  color: rgba(0,0,0,.65);
  font-size: .98rem;
}

/* ---- Grid (mirrors body fat calc “grid calc-grid”) ---- */
.calc-card.bodytype-card .grid.calc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .85rem .95rem;
  align-items: start;
}

.calc-card.bodytype-card .field {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.calc-card.bodytype-card .field label {
  font-weight: 750;
  letter-spacing: .1px;
}

.calc-card.bodytype-card .field select,
.calc-card.bodytype-card .field input {
  width: 100%;
}

/* Full-width row like .span2 in your BF page */
.calc-card.bodytype-card .field.span2 {
  grid-column: 1 / -1;
}

/* Responsive: single column like your calculators */
@media (max-width: 760px) {
  .calc-card.bodytype-card .grid.calc-grid {
    grid-template-columns: 1fr;
  }
  .calc-card.bodytype-card .field.span2 {
    grid-column: 1 / -1;
  }
}

/* ---- Inline input + select (like weight + unit row) ---- */
.calc-card.bodytype-card .inline {
  display: flex;
  gap: .55rem;
  align-items: center;
}

.calc-card.bodytype-card .inline > input {
  flex: 1 1 auto;
  min-width: 0;
}

.calc-card.bodytype-card .inline > select {
  width: 90px;
}

/* ---- Unit toggle (same as BF page look) ---- */
.calc-card.bodytype-card .unit-toggle {
  display: inline-flex;
  gap: .45rem;
  flex-wrap: wrap;
}

.calc-card.bodytype-card .unit-btn {
  border: 1px solid rgba(0,0,0,.14);
  background: rgba(0,0,0,.04);
  color: rgba(0,0,0,.78);
  padding: .45rem .8rem;
  border-radius: 999px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .06s ease, background .15s ease, border-color .15s ease;
}

.calc-card.bodytype-card .unit-btn:hover {
  transform: translateY(-1px);
}

.calc-card.bodytype-card .unit-btn.active,
.calc-card.bodytype-card .unit-btn[aria-pressed="true"] {
  background: rgba(5, 49, 112, .10);
  border-color: rgba(5, 49, 112, .35);
  color: #053170;
}

/* ---- “What you will need” panel (same vibe as BF) ---- */
.calc-card.bodytype-card .what-you-need {
  border: 1px solid rgba(0,0,0,.10);
  background: rgba(0,0,0,.03);
  border-radius: 16px;
  padding: .85rem .9rem;
}

.calc-card.bodytype-card .need-head {
  font-weight: 900;
  color: #053170;
  margin-bottom: .4rem;
}

.calc-card.bodytype-card .need-list {
  margin: .4rem 0 .55rem;
  padding-left: 1.1rem;
  color: rgba(0,0,0,.72);
}

.calc-card.bodytype-card .need-list li {
  margin: .25rem 0;
}

.calc-card.bodytype-card .need-tip {
  margin: 0;
  color: rgba(0,0,0,.58);
  font-size: .92rem;
}

/* ---- Help icons (match BF skinfold “?” style) ---- */
.calc-card.bodytype-card .label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .55rem;
}

.calc-card.bodytype-card .help-icon {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.12);
  background: rgba(0,0,0,.05);
  color: #053170;
  font-weight: 950;
  cursor: pointer;
  line-height: 1;
  display: inline-grid;
  place-items: center;
}

/* ---- Optional BF toggle row ---- */
.calc-card.bodytype-card .bf-toggle-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-top: .2rem;
  flex-wrap: wrap;
}

.calc-card.bodytype-card .bf-toggle-row label {
  font-weight: 800;
}

.calc-card.bodytype-card .bf-toggle-row input[type="checkbox"] {
  transform: scale(1.05);
}

/* ---- Actions (buttons like BF page) ---- */
.calc-card.bodytype-card .actions {
  grid-column: 1 / -1;
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  margin-top: .25rem;
}

.calc-card.bodytype-card .btn-primary {
  background: #053170;
  color: #fff;
  border: 0;
  border-radius: 14px;
  padding: .75rem 1rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(5,49,112,.18);
}

.calc-card.bodytype-card .btn-primary:hover {
  filter: brightness(1.05);
}

.calc-card.bodytype-card .btn {
  background: rgba(0,0,0,.06);
  color: rgba(0,0,0,.80);
  border: 1px solid rgba(0,0,0,.10);
  border-radius: 14px;
  padding: .75rem 1rem;
  font-weight: 900;
  cursor: pointer;
}

/* ---- Result card (like #navy-result style “result”) ---- */
.calc-card.bodytype-card .result {
  margin-top: .85rem;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,.10);
  background: rgba(255,255,255,.92);
  padding: .95rem;
}

.calc-card.bodytype-card .result .topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
}

.calc-card.bodytype-card .pill {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .38rem .7rem;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.12);
  background: rgba(0,0,0,.04);
  font-weight: 950;
}

.calc-card.bodytype-card .pill.primary {
  border-color: rgba(5,49,112,.25);
  background: rgba(5,49,112,.08);
  color: #053170;
}

.calc-card.bodytype-card .result .muted {
  color: rgba(0,0,0,.62);
}

.calc-card.bodytype-card .result .sub {
  margin-top: .55rem;
  color: rgba(0,0,0,.70);
}

/* Votes list */
.calc-card.bodytype-card .votes {
  margin: .55rem 0 0;
  padding-left: 1.1rem;
  color: rgba(0,0,0,.70);
}

.calc-card.bodytype-card .votes li {
  margin: .22rem 0;
}

/* Small two-up blocks inside result */
.calc-card.bodytype-card .mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .7rem .8rem;
  margin-top: .7rem;
}

.calc-card.bodytype-card .mini {
  border-radius: 14px;
  background: rgba(0,0,0,.035);
  padding: .7rem .75rem;
  border: 1px solid rgba(0,0,0,.06);
}

.calc-card.bodytype-card .mini .k {
  font-weight: 900;
  color: rgba(0,0,0,.78);
}

.calc-card.bodytype-card .mini .v {
  margin-top: .2rem;
  color: rgba(0,0,0,.65);
}

@media (max-width: 760px) {
  .calc-card.bodytype-card .mini-grid {
    grid-template-columns: 1fr;
  }
}

/* ---- Error text ---- */
.calc-card.bodytype-card .error {
  margin-top: .45rem;
  color: #b00020;
  font-weight: 750;
}

/* ---- Simple modal (same concept as your skinfold modal) ---- */
.bodytype-modal.modal {
  position: fixed;
  inset: 0;
  display: none;
  background: rgba(0,0,0,.45);
  padding: 1rem;
  z-index: 9999;
}

.bodytype-modal.modal.open {
  display: grid;
  place-items: center;
}

.bodytype-modal .modal-dialog {
  width: min(720px, 100%);
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 12px 40px rgba(0,0,0,.18);
  padding: 1rem 1rem .9rem;
  outline: none;
  position: relative;
}

.bodytype-modal .modal-close {
  position: absolute;
  right: .8rem;
  top: .7rem;
  border: 0;
  background: rgba(0,0,0,.06);
  border-radius: 12px;
  padding: .4rem .65rem;
  cursor: pointer;
  font-weight: 950;
}

.bodytype-modal h3 {
  margin: .1rem 0 .45rem;
}

.bodytype-modal p {
  margin: .35rem 0;
  color: rgba(0,0,0,.74);
}

.bodytype-modal img {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,.10);
  margin-top: .55rem;
}

/* ---- Tiny link style inside hints ---- */
.calc-card.bodytype-card .hint-link a {
  font-weight: 900;
  color: #053170;
  text-decoration: none;
}

.calc-card.bodytype-card .hint-link a:hover {
  text-decoration: underline;
}
