@font-face {
  font-family: 'Fraktur';
  src: url('fonts/Fraktur.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #191315;
  --surface: #241b1e;
  --surface-2: #2e2327;
    --border: #44333a;
  --text: #f0e8e9;
  --muted: #a1909a;
  --accent: #9a1420;          /* vermelho sangue escuro (botões) */
  --accent-ink: #ffffff;
  --accent-text: #e4565f;     /* vermelho mais claro para texto/ícones em fundo escuro */
  --good: #4cc38a;
  --bad: #ff7b7b;
  --glow: #3a1d23;
  --nav-bg: rgba(36,27,30,.96);
  --pop-bg: linear-gradient(135deg, #3d1219 0%, #241b1e 75%);
  --shadow: rgba(0,0,0,.6);
  color-scheme: dark;
  --radius: 14px;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

/* Tema claro (escolhido no Perfil; "auto" segue o telemóvel) */
:root[data-theme="light"] {
  --bg: #f7f0f1; --surface: #ffffff; --surface-2: #f3e9eb; --border: #e0cfd4;
  --text: #2b1d21; --muted: #7a666e; --accent: #9a1420; --accent-text: #a3131f;
  --good: #1d8a5a; --bad: #c23a43; --glow: #f0d6db;
  --nav-bg: rgba(255,255,255,.96); --pop-bg: linear-gradient(135deg, #fbe3e6 0%, #ffffff 75%); --shadow: rgba(60,20,30,.3);
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] {
    --bg: #f7f0f1; --surface: #ffffff; --surface-2: #f3e9eb; --border: #e0cfd4;
    --text: #2b1d21; --muted: #7a666e; --accent: #9a1420; --accent-text: #a3131f;
    --good: #1d8a5a; --bad: #c23a43; --glow: #f0d6db;
    --nav-bg: rgba(255,255,255,.96); --pop-bg: linear-gradient(135deg, #fbe3e6 0%, #ffffff 75%); --shadow: rgba(60,20,30,.3);
    color-scheme: light;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
html, body { margin: 0; color: var(--text); }
body { background: radial-gradient(900px 420px at 50% -8%, var(--glow) 0%, transparent 100%), var(--bg); background-attachment: fixed; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

.app { min-height: 100vh; min-height: 100dvh; max-width: 640px; margin: 0 auto; position: relative; }

.splash { display: grid; place-items: center; min-height: 100dvh; }
.logo {
  width: 88px; height: 88px; border-radius: 24px;
  background: radial-gradient(circle at 50% 42%, #5f424a 0%, #30222a 78%);
  border: 1px solid var(--border);
  display: grid; place-items: center;
  font-family: 'Fraktur', 'UnifrakturCook', serif; font-weight: 700; font-size: 46px; line-height: 1;
  color: #8f0e18; -webkit-text-stroke: 5px #000; paint-order: stroke fill; letter-spacing: -0.02em;
}
h1, .fk { font-family: 'Fraktur', 'UnifrakturCook', serif; font-weight: 700; }

/* Layout */
.screen { padding: calc(16px + var(--safe-t)) 16px calc(var(--nav-h) + var(--safe-b) + 24px); }
.screen.no-nav { padding-bottom: 32px; }
.topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.topbar h1 { font-size: 32px; margin: 0; flex: 1; line-height: 1.1; }
.topbar .back { background: none; border: 0; color: var(--muted); font-size: 15px; padding: 8px 4px; cursor: pointer; }
h2 { font-size: 17px; margin: 24px 0 10px; }
.sub { color: var(--muted); font-size: 14px; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* Bottom nav */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: var(--nav-bg); backdrop-filter: blur(10px); border-top: 1px solid var(--border);
  padding-bottom: var(--safe-b);
}
.nav-inner { max-width: 640px; margin: 0 auto; display: flex; height: var(--nav-h); }
.nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 600;
}
.nav a .ico { font-size: 22px; line-height: 1; }
.nav a.active { color: var(--accent-text); }

/* Cards & lists */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 10px; }
.card.tap { cursor: pointer; }
.card.tap:active { background: var(--surface-2); }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.title { font-weight: 700; }
.pill {
  display: inline-block; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
  border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600;
}
.pill.accent { color: var(--accent); border-color: rgba(200,40,50,.4); background: rgba(200,40,50,.1); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; text-align: center; }
.stat b { display: block; font-size: 22px; letter-spacing: -0.02em; }
.stat span { color: var(--muted); font-size: 12px; line-height: 1.35; display: block; }

/* Forms */
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; font-weight: 600; }
input, select, textarea {
  width: 100%; background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 14px; font: inherit; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent-text); }
textarea { min-height: 80px; resize: vertical; }
.check { display: flex; align-items: center; gap: 10px; margin-top: 14px; color: var(--text); font-size: 15px; }
.check input { width: 22px; height: 22px; padding: 0; accent-color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 12px;
  padding: 13px 18px; font: inherit; font-weight: 700; cursor: pointer; width: 100%;
}
.btn:active { filter: brightness(.92); }
.btn[disabled] { opacity: .5; cursor: default; }
.btn.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn.danger { background: transparent; color: var(--bad); border: 1px solid rgba(255,123,123,.4); }
.btn.small { width: auto; padding: 8px 14px; font-size: 14px; border-radius: 10px; }
.btn.ghost { background: none; color: var(--muted); border: 0; width: auto; padding: 8px 10px; font-weight: 600; }
.stack > * + * { margin-top: 10px; }

/* Auth */
.auth { padding: calc(40px + var(--safe-t)) 20px 40px; max-width: 420px; margin: 0 auto; }
.auth .logo { margin: 0 auto 16px; }
.auth h1 { text-align: center; margin: 0 0 6px; font-size: 40px; line-height: 1.1; }
.auth .auth-title { text-align: center; font-weight: 700; font-size: 18px; }
.auth .sub { text-align: center; margin-bottom: 24px; }
.msg { border-radius: 12px; padding: 10px 12px; font-size: 14px; margin-top: 12px; }
.msg.err { background: rgba(255,93,93,.1); color: var(--bad); border: 1px solid rgba(255,93,93,.3); }
.msg.ok { background: rgba(62,207,142,.1); color: var(--good); border: 1px solid rgba(62,207,142,.3); }

/* Workout */
.set-row { display: grid; grid-template-columns: 28px 1fr 1fr 36px; gap: 8px; align-items: center; margin-top: 8px; }
.set-row.time { grid-template-columns: 28px 1fr 1fr 36px; }
.set-row .n { color: var(--muted); font-weight: 700; text-align: center; }
.set-row input { padding: 10px; text-align: center; }
.set-head { display: grid; grid-template-columns: 28px 1fr 1fr 36px; gap: 8px; color: var(--muted); font-size: 12px; margin-top: 10px; text-align: center; }
.icon-btn { background: none; border: 0; color: var(--muted); font-size: 18px; cursor: pointer; padding: 6px; }
.ex-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cat-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin: 0 -16px 8px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tabs button {
  flex: none; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
  border-radius: 999px; padding: 8px 14px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.cat-tabs button.on { background: var(--accent); color: var(--accent-ink); border-color: #c0303c; }
.fab-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; padding: 12px 16px calc(12px + var(--safe-b));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}
.fab-bar .in { max-width: 640px; margin: 0 auto; display: flex; gap: 10px; }

/* Ranking */
.rank { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.rank .pos { width: 28px; text-align: center; font-weight: 800; font-size: 18px; color: var(--muted); }
.rank.me { border-color: rgba(200,40,50,.5); }
.rank .pts { font-weight: 800; font-variant-numeric: tabular-nums; }
.weekbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 22px; letter-spacing: .12em; font-weight: 800; color: var(--accent-text); }

/* Achievements */
.ach-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.ach { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.ach .i { font-size: 28px; }
.ach b { display: block; margin-top: 4px; font-size: 14px; }
.ach span { color: var(--muted); font-size: 12px; }
.ach.locked { background: transparent; }
.ach.locked .i { opacity: .4; filter: grayscale(1); }
.ach.locked b, .ach.locked > span { opacity: .5; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: var(--shadow); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.modal {
  background: var(--surface); border-top-left-radius: 20px; border-top-right-radius: 20px; width: 100%; max-width: 640px;
  max-height: 88dvh; overflow: auto; padding: 18px 16px calc(18px + var(--safe-b)); border: 1px solid var(--border);
}
.modal h3 { margin: 0 0 12px; font-size: 18px; }
.list-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text); border-radius: 12px;
  padding: 12px 14px; margin-bottom: 8px; font: inherit; text-align: left; cursor: pointer;
}
.list-item:active { background: var(--border); }
.list-item small { color: var(--muted); }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 16px); transform: translate(-50%, 20px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-weight: 600; font-size: 14px;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 80; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--bad); color: #fff; }

.empty { text-align: center; color: var(--muted); padding: 32px 16px; }
.empty .big { font-size: 40px; }
.install-hint { background: rgba(200,40,50,.1); border: 1px solid rgba(200,40,50,.35); border-radius: var(--radius); padding: 12px 14px; font-size: 14px; margin-bottom: 14px; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--border); border-top-color: var(--accent-text); border-radius: 50%; animation: spin .8s linear infinite; margin: 32px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Lista de treinos: seta para expandir */
.wk-main { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; cursor: pointer; }
.chev {
  flex: none; width: 38px; height: 38px; margin-left: 10px; border-radius: 10px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); font-size: 16px; line-height: 1;
  transition: transform .2s, color .2s;
}
.chev.open { transform: rotate(180deg); color: var(--accent-text); }
.wk-detail { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.sum-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 5px 0; font-size: 14px; }
.sum-row .sub { text-align: right; font-size: 13px; }
.fab-bar .in .btn { width: auto; flex: 1 1 auto; white-space: nowrap; padding-left: 14px; padding-right: 14px; }
.fab-bar .in .btn.finish { flex: 0 0 auto; }
.wk-notes { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.wk-notes .sub { margin-bottom: 2px; font-weight: 600; }
.done {
  display: inline-block; margin-left: 6px; padding: 2px 10px; border-radius: 999px;
  background: rgba(76,195,138,.14); border: 1px solid rgba(76,195,138,.5); color: var(--good);
  font-size: 12px; font-weight: 700; line-height: 1.5; vertical-align: 1px; white-space: nowrap;
}

/* Pop-up de conquista: aparece no centro do ecrã visível, com confettis */
#ach-root { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 0 20px; pointer-events: none; }
.ach-pop {
  position: relative; pointer-events: auto; cursor: pointer; width: 100%; max-width: 340px; text-align: center; overflow: visible;
  padding: 30px 20px 22px; border-radius: 24px;
  background: radial-gradient(120% 90% at 50% 0%, rgba(214,60,72,.35), transparent 60%), var(--pop-bg);
  border: 1px solid rgba(240,90,100,.85);
  box-shadow: 0 0 0 1px rgba(255,255,255,.05) inset, 0 0 46px rgba(214,60,72,.55), 0 18px 48px var(--shadow);
  transform: scale(.2) rotate(-6deg); opacity: 0;
}
.ach-pop.show { animation: ach-in .7s cubic-bezier(.2,1.4,.35,1) forwards; }
.ach-pop.out { animation: ach-out .36s ease-in forwards; }
@keyframes ach-in { 0% { transform: scale(.2) rotate(-6deg); opacity: 0; } 55% { transform: scale(1.09) rotate(1.5deg); opacity: 1; } 100% { transform: scale(1) rotate(0); opacity: 1; } }
@keyframes ach-out { to { transform: scale(.85) translateY(24px); opacity: 0; } }
.ach-rays {
  position: absolute; left: 50%; top: 62px; width: 280px; height: 280px; margin: -140px 0 0 -140px; border-radius: 50%; pointer-events: none; z-index: -1;
  background: repeating-conic-gradient(from 0deg, rgba(255,214,102,.30) 0 8deg, transparent 8deg 24deg);
  -webkit-mask: radial-gradient(circle, #000 0 28%, transparent 70%); mask: radial-gradient(circle, #000 0 28%, transparent 70%);
  animation: ach-spin 9s linear infinite; opacity: .9;
}
@keyframes ach-spin { to { transform: rotate(360deg); } }
.ach-pop-icon { font-size: 68px; line-height: 1; display: inline-block; filter: drop-shadow(0 4px 14px rgba(255,200,80,.55)); }
.ach-pop.show .ach-pop-icon { animation: ach-icon 1s .25s cubic-bezier(.3,1.6,.4,1) both; }
@keyframes ach-icon { 0% { transform: scale(.3) rotate(-25deg); } 60% { transform: scale(1.35) rotate(8deg); } 100% { transform: scale(1) rotate(0); } }
.ach-pop-kicker { margin-top: 12px; font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: #ffd166; }
.ach-pop-name { font-family: 'Fraktur', 'UnifrakturCook', serif; font-weight: 700; font-size: 32px; line-height: 1.1; margin-top: 6px; color: #fff; text-shadow: 0 2px 14px rgba(214,60,72,.7); }
.ach-pop-desc { font-size: 14px; color: var(--muted); margin-top: 8px; line-height: 1.4; }
.ach-shine { position: absolute; inset: 0; border-radius: inherit; overflow: hidden; pointer-events: none; }
.ach-shine::after { content: ''; position: absolute; top: 0; bottom: 0; width: 40%; left: -60%; background: linear-gradient(100deg, transparent, rgba(255,255,255,.28), transparent); transform: skewX(-18deg); }
.ach-pop.show .ach-shine::after { animation: ach-shine 1.1s .6s ease-out both; }
@keyframes ach-shine { to { left: 130%; } }
.ach-conf { position: absolute; left: 50%; top: 62px; border-radius: 2px; opacity: 0; pointer-events: none; }
.ach-pop.show .ach-conf { animation: ach-conf 1.9s var(--d) cubic-bezier(.15,.7,.3,1) forwards; }
@keyframes ach-conf {
  0% { transform: translate(-50%, 0) rotate(0) scale(.4); opacity: 1; }
  35% { transform: translate(calc(-50% + var(--dx)), var(--dy)) rotate(calc(var(--rot) * .5)) scale(1); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx) * 1.15), calc(var(--dy) + var(--fall))) rotate(var(--rot)) scale(.9); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .ach-pop.show { animation: none; transform: none; opacity: 1; }
  .ach-rays, .ach-shine { display: none; }
}
.goals .wk-notes { border: 0; margin: 4px 0 0; padding: 0; }

/* Última vez / recordes / gráficos */
.last { margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); border: 1px dashed var(--border); font-size: 13px; color: var(--muted); }
.last div { margin-top: 2px; color: var(--text); line-height: 1.5; }
.last b { font-variant-numeric: tabular-nums; }
.rec { display: flex; align-items: center; gap: 10px; }
.rec-val { font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 12px; padding: 0 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 8px 14px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.chips button.on { background: var(--accent); color: var(--accent-ink); border-color: #c0303c; }
.chart-card { padding: 10px 8px 12px; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 4; }
.chart .axis { fill: var(--muted); font-size: 10px; font-family: inherit; }
.chart .line { fill: none; stroke: var(--accent-text); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--accent-text); opacity: .12; }
.chart .dot { fill: var(--surface); stroke: var(--accent-text); stroke-width: 2; }
.chart .dot.pr { fill: #e8b84a; stroke: #b8860b; }
.chart .dot.sel { fill: var(--accent-text); stroke: var(--text); }
.chart .hit { fill: transparent; cursor: pointer; }

/* Reações e comentários */
.reacts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.react { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 999px; padding: 7px 12px; font: inherit; font-size: 17px; line-height: 1; cursor: pointer; }
.react span { font-size: 13px; font-weight: 700; color: var(--muted); }
.react.on { border-color: var(--accent-text); background: rgba(200,40,50,.14); }
.react.on span { color: var(--accent-text); }
.react.ro { cursor: default; }
.cmt { padding: 10px 0; border-top: 1px solid var(--border); }
.cmt-body { margin-top: 2px; word-break: break-word; white-space: pre-wrap; }
.comment-form { display: flex; gap: 8px; margin-top: 12px; align-items: center; }
.comment-form input { flex: 1; }
.comment-form .btn { flex: none; }
.goals { margin-top: 12px; }

/* botão sol/lua do perfil */
.theme-btn { background: var(--card, transparent); border: 1px solid var(--border); border-radius: 999px; width: 44px; height: 44px; font-size: 22px; line-height: 1; cursor: pointer; display: grid; place-items: center; padding: 0; }
.theme-btn:active { transform: scale(.92); }

/* modelos de treino */
.tpl-row { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.tpl-main {
  flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text); border-radius: 12px; padding: 12px 14px; font: inherit;
}
.tpl-main:active { background: var(--border); }
.tpl-main small { color: var(--muted); }
.tpl-main > span:last-child { color: var(--accent-text); }

/* calendário */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 4px 0 10px; }
.cal-dow { text-align: center; font-size: 11px; color: var(--muted); padding-bottom: 2px; }
.cal-day {
  position: relative; aspect-ratio: 1; display: grid; place-items: center; padding: 0; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); color: var(--text); border-radius: 12px; font: inherit; font-size: 15px;
}
.cal-day.empty { visibility: hidden; pointer-events: none; }
.cal-day.w { background: var(--accent); color: var(--accent-ink); border-color: #c0303c; font-weight: 700; }
.cal-day.today { outline: 2px solid var(--accent-text); outline-offset: 1px; }
.cal-day.sel { box-shadow: 0 0 0 2px var(--text); }
.cal-day i { position: absolute; top: 1px; right: 2px; font-size: 11px; font-style: normal; line-height: 1; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.cal-legend i { font-style: normal; }
.cal-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--accent); vertical-align: -1px; }
.cal-ach { font-size: 28px; margin-right: 12px; line-height: 1; }

/* idioma no ecrã de entrada */
.auth { position: relative; }
.auth-lang { position: absolute; top: calc(10px + var(--safe-t)); right: 16px; }

.upd-banner { position: fixed; left: 12px; right: 12px; bottom: calc(76px + var(--safe-b, 0px)); z-index: 60; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px 10px 16px; border-radius: 14px; background: var(--card, #241d20); border: 1px solid var(--accent, #c1121f); box-shadow: 0 8px 24px rgba(0,0,0,.4); font-weight: 600; }
.upd-banner .btn { width: auto; }

/* progresso das conquistas */
.ach .ach-left { display: block; margin-top: 8px; font-size: 11px; font-style: normal; font-weight: 700; color: var(--accent-text); }
.ach .ach-bar { height: 4px; margin-top: 5px; border-radius: 3px; background: var(--surface-2, rgba(255,255,255,.08)); overflow: hidden; }
.ach .ach-bar i { display: block; height: 100%; border-radius: 3px; background: var(--accent-text, #e63946); }

/* seletor de exercícios + ficha */
.eq-tabs { margin-top: 6px; }
.eq-tabs button { font-size: 12px; padding: 5px 10px; }
.pick-row { display: flex; align-items: stretch; padding: 0; }
.pick-main { flex: 1; min-width: 0; display: flex; justify-content: space-between; align-items: center; gap: 8px; background: none; border: 0; color: inherit; font: inherit; text-align: left; padding: 12px 0 12px 14px; cursor: pointer; }
.pick-info { flex: none; width: 48px; background: none; border: 0; border-left: 1px solid var(--border); color: var(--muted); font-size: 20px; cursor: pointer; }
.pick-h { margin: 14px 2px 6px; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.exi-tags { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.exi-img { position: relative; width: 100%; aspect-ratio: 4/3; border-radius: 12px; overflow: hidden; background: #fff; margin-bottom: 12px; }
.exi-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.exi-img img + img { animation: exiFlip 1.8s steps(1) infinite; }
@keyframes exiFlip { 0%, 49% { opacity: 0; } 50%, 100% { opacity: 1; } }
.exi-img.fail { display: none; }
@media (prefers-reduced-motion: reduce) { .exi-img img + img { animation: none; opacity: 0; } }
.exi-muscles { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.exi-muscles span { background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 600; }
.exi-desc { font-size: 14px; line-height: 1.5; margin: 0 0 8px; }
.exi-credit { font-size: 11px; color: var(--muted); }
.exi-muscles .exi-ml { flex-basis: 100%; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

/* exercícios fechados, drop sets, aviso de pontos */
.card.ex-closed { cursor: pointer; padding-top: 12px; padding-bottom: 12px; }
.ex-closed .ex-title { align-items: center; }
.ex-closed .ex-chev { color: var(--muted); font-size: 18px; padding: 0 6px; }
.ex-sum { margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.set-row.drop, .set-head.drop { grid-template-columns: 28px 1fr 1fr 40px 36px; }
.drop-btn { height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); font: inherit; font-size: 18px; font-weight: 800; cursor: pointer; }
.drop-btn.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.set-row.is-drop .n { color: var(--accent-text, var(--accent)); font-size: 18px; }
.set-row.is-drop { position: relative; }
.pts-hint { margin-top: 10px; font-size: 12px; color: var(--muted); line-height: 1.4; }
.pts-hint[hidden] { display: none; }

/* cardio: km, velocidade, inclinação */
.set-row.cardio { row-gap: 6px; }
.cardio-extra { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding-left: 36px; }
.cardio-extra label { display: block; margin: 0; }
.cardio-extra span { display: block; margin-bottom: 3px; font-size: 11px; color: var(--muted); text-align: center; }
.cardio-extra input { padding: 8px; }
.last.sugg { border-style: solid; border-color: var(--accent, #7c5cff); color: var(--text); }
.info-btn { flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; margin-top: 4px; }
.info-btn[aria-expanded="true"] { color: var(--text); border-color: var(--muted); }
[hidden] { display: none !important; }
.card.buddy { border-color: var(--accent, #7c5cff); margin-top: 14px; }
.buddy-btn { flex: none; white-space: nowrap; }
.buddy-pill { flex: none; margin-top: 6px; }
/* botão "Novo treino" fixo por cima da barra de navegação */
.fab-new { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-b)); z-index: 15; padding: 24px 16px 12px; background: linear-gradient(to top, var(--bg) 55%, transparent); pointer-events: none; }
.fab-new .in { max-width: 640px; margin: 0 auto; }
.fab-new .btn { pointer-events: auto; box-shadow: 0 6px 18px rgba(0,0,0,.35); }
.screen.has-fab { padding-bottom: calc(var(--nav-h) + var(--safe-b) + 96px); }
/* seta (e ⓘ) dos exercícios: caixa com rebordo, como na lista de treinos */
.ex-arrow {
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 10px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); font-size: 16px; line-height: 1; padding: 0;
}
.ex-arrow.info { font-size: 18px; }
.ex-closed .ex-arrow { pointer-events: none; }
/* Tutorial guiado */
html.tour-on, html.tour-on body { overflow: hidden; }
#tour { position: fixed; inset: 0; z-index: 1000; pointer-events: none; }
#tour .tour-block, #tour .tour-card { pointer-events: auto; }
.tour-block { position: absolute; inset: 0; background: transparent; }
#tour.centered .tour-block { background: rgba(0,0,0,.78); }
.tour-spot { position: absolute; border-radius: 14px; box-shadow: 0 0 0 9999px rgba(0,0,0,.78); border: 2px solid var(--accent-text); pointer-events: none; transition: left .25s, top .25s, width .25s, height .25s, opacity .2s; }
#tour.centered .tour-spot { box-shadow: none; border-color: transparent; }
.tour-card { position: absolute; left: 0; right: 0; margin: 0 auto; width: calc(100% - 32px); max-width: 420px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 16px; padding: 16px; box-shadow: 0 14px 44px rgba(0,0,0,.55); }
.tour-card h3 { margin: 6px 0 6px; font-size: 18px; }
.tour-card p { margin: 0 0 12px; color: var(--muted); line-height: 1.45; font-size: 15px; }
.tour-top { display: flex; justify-content: space-between; align-items: center; min-height: 24px; }
.tour-count { font-size: 12px; color: var(--muted); }
.tour-skip { background: none; border: 0; color: var(--muted); font-size: 14px; cursor: pointer; padding: 4px 0 4px 12px; }
.tour-dots { display: flex; gap: 5px; justify-content: center; margin: 4px 0 12px; }
.tour-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--border); }
.tour-dots i.on { background: var(--accent-text); }
.tour-btns { display: flex; justify-content: space-between; gap: 10px; }
.tour-btns .btn { width: auto; min-width: 110px; }
/* deslizar entre separadores */
@keyframes tabInR { from { transform: translateX(56px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes tabInL { from { transform: translateX(-56px); opacity: 0; } to { transform: none; opacity: 1; } }
.in-r { animation: tabInR .22s ease-out; }
.in-l { animation: tabInL .22s ease-out; }
/* botão "Guardar plano": destaque suave */
.btn.plan-btn { background: rgba(154,20,32,.16); color: var(--accent-text); border: 1px solid var(--accent); font-weight: 700; }
.btn.plan-btn:active { background: rgba(154,20,32,.28); }
.ex-arrow[disabled] { opacity: .35; cursor: default; }
.pts-note { color: var(--accent-text); font-weight: 600; }

/* classificação a abrir por baixo do cartão da equipa */
.team-rank { margin: -4px 0 10px; padding: 6px 12px 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; }
.team-rank-h { font-size: 12px; margin: 2px 0 4px; }
.team-rank-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--border); }
.team-rank-h + .team-rank-row { border-top: 0; }
.team-rank-row .pos { width: 26px; text-align: center; font-weight: 700; }
.team-rank-row .title { font-size: 15px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-rank-row .pts { font-weight: 700; white-space: nowrap; }
.team-rank-row.me .title { font-weight: 800; }

/* unilateral: kg + reps esquerdo + reps direito */
.set-row.uni, .set-head.uni { grid-template-columns: 24px 1fr 1fr 1fr 36px 34px; gap: 6px; }
.set-row.uni input { padding: 10px 4px; }
.uni-btn { display: inline-flex; align-items: center; height: 38px; padding: 0 12px; border-radius: 10px; font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer; background: transparent; color: var(--muted); border: 1px solid var(--border); }
.uni-btn.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.uni-pill { margin-left: 6px; }

/* rodapé do exercício: + Série largo, depois ⓘ e 🗑 */
.ex-foot .add-set-btn { flex: 1; width: auto; min-height: 38px; }

/* destaque suave nos botões Unilateral e + Série */
.uni-btn { background: rgba(154,20,32,.10); color: var(--accent-text); border: 1px solid rgba(154,20,32,.55); }
.uni-btn.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.add-set-btn { background: rgba(154,20,32,.10); color: var(--accent-text); border: 1px solid rgba(154,20,32,.55); font-weight: 700; }
.btn.add-set-btn:active { background: rgba(154,20,32,.22); }
.fab-new .row .btn { flex: 1 1 0; min-width: 0; white-space: nowrap; padding-left: 10px; padding-right: 10px; }

/* cronómetro de descanso: o botão enche como uma barra de loading */
.fab-bar .in.col { flex-direction: column; gap: 8px; }
.fab-bar .in .rest-row { display: flex; gap: 10px; }
.fab-bar .in .rest-btn { flex: none; width: 100%; position: relative; overflow: hidden; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); font-weight: 700; font-variant-numeric: tabular-nums; }
.rest-btn .rest-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: rgba(154,20,32,.6); transition: width .25s linear; pointer-events: none; }
.rest-btn .rest-label { position: relative; z-index: 1; }
.rest-btn.running { border-color: var(--accent); font-size: 18px; }

/* tira da semana (início) */
.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 0 0 14px; }
.week-strip .wd { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; color: var(--muted); font: inherit; cursor: pointer; }
.week-strip .wd[disabled] { cursor: default; }
.week-strip .wl { font-size: 11px; text-transform: capitalize; line-height: 1; }
.week-strip .wn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; font-size: 14px; font-weight: 700; color: var(--text); border: 2px solid transparent; }
.week-strip .wd.future { opacity: .55; }
.week-strip .wd.today .wn { border-color: var(--accent-text); }
.week-strip .wd.on .wn { background: var(--accent); color: var(--accent-ink); }
.week-strip .wd.on { border-color: rgba(154,20,32,.55); }

/* mapa de músculos */
:root { --mc0: #3a2d33; --mc1: #6b2733; --mc2: #8f2634; --mc3: #c72f3f; --mc4: #ff4f5e; }
:root[data-theme="light"] { --mc0: #eadde0; --mc1: #e5b4bb; --mc2: #d9808c; --mc3: #c4414f; --mc4: #a3131f; }
.mfig svg polygon { stroke-linejoin: round; stroke-width: .9; }
.mc0 { fill: var(--mc0); stroke: var(--mc0); } .mc1 { fill: var(--mc1); stroke: var(--mc1); } .mc2 { fill: var(--mc2); stroke: var(--mc2); } .mc3 { fill: var(--mc3); stroke: var(--mc3); } .mc4 { fill: var(--mc4); stroke: var(--mc4); }
.seg { display: flex; background: var(--surface-2); border-radius: 10px; padding: 3px; margin: 10px auto 6px; max-width: 220px; }
.seg button { flex: 1; padding: 7px 0; border: 0; border-radius: 8px; background: none; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.seg.range { max-width: none; margin: 0 0 12px; }
.mfig { text-align: center; }
.mfig svg { width: 62%; max-width: 250px; height: auto; }
.mbars { margin-top: 6px; }
.mr { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: 13px; }
.mr .mn { width: 98px; flex: none; }
.mr .mt { flex: 1; height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.mr .mt i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #9a1420, #ff5d6a); }
.mr .mv { width: 30px; text-align: right; color: var(--muted); font-size: 12px; }
.mhint { margin-top: 10px; font-size: 12px; color: var(--muted); background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.musc-mini { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; padding: 10px 14px; margin: 0 0 14px; }
.mm-figs { display: flex; gap: 2px; flex: none; }
.mm-figs > span { display: block; width: 46px; }
.mm-figs svg { width: 100%; height: auto; display: block; }
.mm-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.mm-txt b { font-size: 14px; margin-bottom: 2px; }
.mm-row { display: flex; justify-content: space-between; color: var(--muted); }
.mm-row span:last-child { color: var(--text); }
@media (prefers-color-scheme: light) { :root[data-theme="auto"] { --mc0: #eadde0; --mc1: #e5b4bb; --mc2: #d9808c; --mc3: #c4414f; --mc4: #a3131f; } }

/* guias interativos */
#tour.free .tour-block { pointer-events: none; background: transparent; }
#tour.free .tour-spot { opacity: 0 !important; }
#tour.inter .tour-spot { border-color: var(--accent-text); animation: tourPulse 1.4s ease-in-out infinite; }
#tour.ok .tour-spot { border-color: var(--good); animation: none; box-shadow: 0 0 0 9999px rgba(0,0,0,.78), 0 0 0 4px rgba(76,195,138,.5); }
@keyframes tourPulse { 0%, 100% { outline: 0 solid rgba(228,86,95,.0); } 50% { outline: 6px solid rgba(228,86,95,.25); } }
.tour-doit { align-self: center; font-size: 14px; color: var(--accent-text); font-weight: 600; }
.tour-card.compact { padding: 12px 14px; }
.tour-card.compact p { margin-bottom: 8px; font-size: 14px; }
.tour-card.compact .tour-dots { display: none; }
.tour-card.compact h3 { font-size: 16px; margin: 2px 0 4px; }
.tour-card .btn.danger { background: var(--bad); color: #fff; }
.guide-card { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.guide-card .gi { font-size: 26px; width: 36px; text-align: center; flex: none; }
.guide-card .grow { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.guide-card .gd { background: rgba(76,195,138,.15); color: var(--good); border-color: transparent; }

/* ===== Ícones angulares próprios (icons.js) ===== */
.ic{width:1.15em;height:1.15em;vertical-align:-.2em;flex:none;fill:none;stroke:currentColor;stroke-width:2;stroke-linejoin:miter;stroke-linecap:square;overflow:visible}
.ic [fill]{stroke:none}
.ic-g1{color:#d9a441}.ic-g2{color:#aeb6c1}.ic-g3{color:#b9743f}
.flag{font:700 .72em/1 var(--font,system-ui);letter-spacing:.06em}
.big .ic{width:1em;height:1em;stroke-width:1.5}

/* Página do endereço antigo (só explica a mudança) */
.moved .btn{display:flex;align-items:center;justify-content:center;text-decoration:none;margin-top:6px}
.moved-steps{margin:0 0 20px;padding-left:22px;display:flex;flex-direction:column;gap:10px;font-size:15px;line-height:1.45}
.moved-steps li::marker{color:var(--accent-text,#e4565f);font-weight:700}
.moved-sorry{margin:22px 0 0;text-align:center;opacity:.75;font-size:14px;line-height:1.5}
.moved-sorry span{display:inline-block;margin-top:6px;opacity:.9}
