/* Tema claro com cabeçalho e barra de navegação azul-marinho */
:root {
  --bg: #eef2f7;
  --surface: #ffffff;
  --surface-2: #f2f5fa;
  --line: #dfe5ee;
  --text: #17202f;
  --muted: #687489;
  --accent: #1e7be6;
  --accent-ink: #ffffff;
  --accent-soft: #e6f0fd;
  --nav: #1d2b45;
  --nav-ink: #ffffff;
  --nav-muted: #9fb0cc;
  --nav-accent: #5fb0ff;
  --radius: 16px;
  --nav-h: calc(62px + env(safe-area-inset-bottom));
  color-scheme: light;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(var(--nav-h) + 96px);
}

button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }

.muted { color: var(--muted); }

/* Cabeçalho */
.top {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--nav);
  color: var(--nav-ink);
  text-align: center;
  padding: calc(14px + env(safe-area-inset-top)) 16px 16px;
  box-shadow: 0 2px 10px rgb(0 0 0 / .12);
}
.top h1 { margin: 0; font-size: 22px; letter-spacing: -0.01em; }
.top h1 span { color: var(--nav-accent); }
.top p { margin: 2px 0 0; font-size: 13px; color: var(--nav-muted); }

/* Barra de navegação inferior */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 8;
  display: grid; grid-template-columns: repeat(6, 1fr);
  height: var(--nav-h);
  padding: 6px max(4px, calc((100% - 640px) / 2)) env(safe-area-inset-bottom);
  background: var(--nav);
  box-shadow: 0 -2px 10px rgb(0 0 0 / .12);
}
.tab {
  border: 0;
  background: none;
  color: var(--nav-muted);
  min-width: 0;
  padding: 2px 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
}
.tab svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tab strong { font-size: 12px; font-weight: 600; }
.tab small { font-size: 10px; opacity: .8; white-space: nowrap; }
.tab[aria-selected="true"] { color: var(--nav-accent); }
.tab[aria-selected="true"] strong { color: var(--nav-ink); }

/* Lista */
.list { max-width: 640px; margin: 0 auto; padding: 16px; display: grid; gap: 14px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 3px rgb(23 32 47 / .06);
}

.primary {
  border: 0; border-radius: 12px;
  background: var(--accent); color: var(--accent-ink);
  padding: 12px 20px; font-weight: 700;
}
.primary:disabled { opacity: .4; cursor: default; }
.ghost {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  padding: 10px 14px;
}
.ghost:disabled { opacity: .4; cursor: default; }

/* Resumo do dia */
.summary { padding: 16px; display: grid; gap: 14px; }
.summary-stats { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; }
.summary-stats div + div { border-left: 1px solid var(--line); }
.summary-stats b { display: block; font-size: 22px; color: var(--accent); }
.summary-stats small { font-size: 12px; color: var(--muted); }
.start { width: 100%; padding: 14px; font-size: 16px; }

/* Lista de exercícios */
.list-title { margin: 0; padding: 14px 16px 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.ex-row {
  display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: 12px;
  width: 100%;
  border: 0; border-top: 1px solid var(--line);
  background: none;
  padding: 10px 12px 10px 16px;
  text-align: left;
}
.ex-row:first-of-type { border-top: 0; }
button.ex-row:hover { background: var(--surface-2); }
.thumb {
  width: 64px; height: 64px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  overflow: hidden;
  display: grid; place-items: center;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.emoji { font-size: 30px; background: var(--accent-soft); border-color: transparent; }
.ex-info { display: grid; gap: 1px; min-width: 0; }
.ex-info b { font-size: 16px; }
.ex-meta { font-size: 14px; color: var(--accent); font-weight: 600; }
.ex-muscles { font-size: 13px; color: var(--muted); }
.chev { font-size: 26px; color: var(--muted); line-height: 1; }
.cardio-row { grid-template-columns: 64px 1fr; }

/* Animação: as duas fotos empilhadas, a segunda pisca por cima */
.anim {
  position: relative;
  aspect-ratio: 3 / 2;
  background: #000;
}
.anim img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
}
.anim img + img { animation: flip 1.8s steps(1) infinite; }
@keyframes flip { 0% { opacity: 0; } 50% { opacity: 1; } }

/* GIF quadrado de fundo branco: centralizado numa faixa branca */
.anim.gif { background: #fff; aspect-ratio: 4 / 3; border-bottom: 1px solid var(--line); }
/* tela larga: o GIF é pequeno (180 px), então não deixa crescer demais */
@media (min-width: 560px) { .anim.gif { aspect-ratio: 16 / 9; } }
.anim.gif img,
.anim.gif video { position: static; display: block; width: 100%; height: 100%; object-fit: contain; }

@media (prefers-reduced-motion: reduce) {
  .anim:not(.gif) { display: grid; grid-template-columns: 1fr 1fr; aspect-ratio: 3 / 1; }
  .anim img { position: static; }
  .anim img + img { animation: none; }
}

.noimg { margin: auto; padding: 16px; text-align: center; color: var(--muted); font-size: 14px; }
.anim:has(.noimg) { display: flex; aspect-ratio: auto; min-height: 120px; background: var(--surface-2); }

.body { padding: 16px; }
.body h2 { margin: 0; font-size: 20px; letter-spacing: -0.01em; }
.body .muscles { margin: 2px 0 14px; font-size: 14px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; text-align: center; }
.stat small { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.stat b { font-size: 18px; }
.stat.rest { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.stat.rest small { color: var(--accent-ink); opacity: .85; }

.how { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; }
.how h3 { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.how ol { margin: 8px 0 0; padding-left: 20px; font-size: 15px; }
.how li + li { margin-top: 4px; }

/* Opções do exercício: lista de linhas numeradas, a escolhida em destaque */
.options { display: grid; gap: 6px; margin-top: 10px; }
.option {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  padding: 8px 12px 8px 8px;
  font-size: 15px;
  text-align: left;
}
.option .n {
  display: grid; place-items: center; flex: none;
  width: 26px; height: 26px;
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 12px; font-weight: 700; color: var(--muted);
}
.option:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.option[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.option[aria-pressed="true"] .n { background: var(--accent); color: var(--accent-ink); }

/* Tela de detalhe do exercício: troca a barra de abas por Anterior / Próximo */
.top-back {
  position: absolute; left: 6px; bottom: 12px;
  border: 0; background: none;
  color: var(--nav-ink); font-size: 16px;
  padding: 10px;
}
.top-back[hidden] { display: none; }
.in-detail .top { padding-inline: 88px; }
.in-detail .tabs, .in-detail .credits { display: none; }
.detail .body { padding-bottom: 20px; }

.detail-foot {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 8;
  display: grid; grid-template-columns: 1fr 2fr; gap: 10px; align-items: center;
  height: var(--nav-h);
  padding: 8px max(16px, calc((100% - 608px) / 2)) calc(8px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: 0 -2px 10px rgb(23 32 47 / .08);
}
.detail-foot[hidden] { display: none; }
.detail-foot button { height: 100%; }

/* Guia */
.body > h2 + .muted, .group .muted { margin: 4px 0 0; font-size: 14px; }
.rules { margin: 10px 0 0; padding-left: 20px; font-size: 15px; }
.rules li + li { margin-top: 6px; }
.presets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.preset { padding: 8px 14px; font-size: 14px; }

.group-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stepper { display: flex; align-items: center; gap: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 4px; flex: none; }
.stepper b { min-width: 28px; text-align: center; font-size: 18px; font-variant-numeric: tabular-nums; }
.step {
  width: 36px; height: 36px;
  border: 0; border-radius: 9px;
  background: var(--accent); color: var(--accent-ink);
  font-size: 20px; line-height: 1;
}
.step:disabled { opacity: .3; cursor: default; }

.picks { list-style: none; counter-reset: pick; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.picks li {
  counter-increment: pick;
  display: grid; grid-template-columns: 28px 1fr; column-gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.picks li::before {
  content: counter(pick);
  grid-row: span 2;
  display: grid; place-items: center;
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 13px; font-weight: 700;
}
.picks li b { font-size: 15px; color: var(--text); font-weight: 600; }
.picks li span { font-size: 13px; }
.picks li.in { border-color: var(--accent); background: var(--accent-soft); }
.picks li.in::before { background: var(--accent); color: var(--accent-ink); }

.build-bar {
  position: fixed; left: 0; right: 0; bottom: var(--nav-h); z-index: 7;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px max(16px, calc((100% - 608px) / 2));
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: 0 -2px 10px rgb(23 32 47 / .08);
}
.build-bar b { font-size: 22px; margin-right: 4px; color: var(--accent); }
.build-bar small { display: block; color: var(--muted); font-size: 12px; }

.back {
  justify-self: start;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface);
  padding: 10px 14px;
  color: var(--accent); font-weight: 600;
}

.credits { max-width: 640px; margin: 8px auto 0; padding: 0 16px; font-size: 12px; }
.credits a { color: var(--muted); }

/* Cronômetro de descanso: fica acima da barra de navegação e do rodapé do detalhe */
.timer {
  position: fixed; left: 0; right: 0; bottom: var(--nav-h); z-index: 30;
  background: var(--nav);
  color: var(--nav-ink);
  padding: 0 16px 10px;
  box-shadow: 0 -2px 12px rgb(0 0 0 / .2);
}
.timer[hidden] { display: none; }
.timer-bar { height: 4px; margin: 0 -16px 10px; background: rgb(255 255 255 / .15); }
.timer-bar div { height: 100%; width: 100%; background: var(--nav-accent); transform-origin: left; }
.timer-row { max-width: 608px; margin: 0 auto; display: flex; align-items: center; gap: 10px; }
.timer-label { color: var(--nav-muted); font-size: 14px; }
.timer-time { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; margin-right: auto; }
.timer.over .timer-time { color: var(--nav-accent); }
.timer .ghost { background: rgb(255 255 255 / .08); border-color: rgb(255 255 255 / .2); color: var(--nav-ink); }
