/* Maxfit: fundo escuro esverdeado, cartões de vidro e degradê do verde-limão ao ciano. */

:root {
  color-scheme: dark;
  --bg: #06110e;
  --surface: rgba(18, 38, 32, 0.72);
  --surface-2: rgba(255, 255, 255, 0.055);
  --surface-3: rgba(255, 255, 255, 0.1);
  --border: rgba(160, 255, 220, 0.12);
  --border-forte: rgba(160, 255, 220, 0.26);
  --text: #effff8;
  --text-2: #cfe8dd;
  --muted: #8fb0a3;
  --accent: #a3f76b;
  --accent-2: #2de2c5;
  --accent-tinta: #052017;
  --accent-suave: rgba(163, 247, 107, 0.13);
  --p2: #7cc4ff;
  --p2-suave: rgba(124, 196, 255, 0.14);
  --perigo: #ff8b8b;
  --perigo-suave: rgba(255, 139, 139, 0.13);
  --atencao: #ffd166;
  --grad-marca: linear-gradient(135deg, #b6fb5c 0%, #4be3a0 50%, #19d3c5 100%);
  --grad-hero: linear-gradient(135deg, rgba(163, 247, 107, 0.22) 0%, rgba(45, 226, 197, 0.1) 100%);
  --grad-ouro: linear-gradient(135deg, #fde68a 0%, #f59e0b 55%, #d97706 100%);
  --radius: 22px;
  --radius-sm: 14px;
  --sombra: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 22px 48px -28px rgba(0, 0, 0, 0.8);
  --fonte: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --barra-altura: 74px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--fonte);
  font-size: 15px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

/* Manchas de cor ao fundo, paradas: não gastam bateria durante o treino. */
.fundo {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(60% 40% at 90% 0%, rgba(163, 247, 107, 0.16), transparent 70%),
    radial-gradient(55% 40% at 0% 30%, rgba(45, 226, 197, 0.13), transparent 70%),
    radial-gradient(70% 45% at 60% 100%, rgba(40, 120, 255, 0.1), transparent 70%);
}

.app { max-width: 560px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-2); }
[hidden] { display: none !important; }
svg.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* ---- Topo ---- */

.topo {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(14px + env(safe-area-inset-top)) 18px 8px;
}
.marca { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; min-width: 0; }
.marca-selo {
  width: 38px; height: 38px; border-radius: 13px; flex: none;
  background: var(--grad-marca); color: var(--accent-tinta);
  display: grid; place-items: center; font-weight: 900; font-size: 19px;
  box-shadow: 0 8px 22px -8px rgba(75, 227, 160, 0.7);
}
.marca-nome { font-size: 18px; font-weight: 800; letter-spacing: -0.2px;
  background: var(--grad-marca); -webkit-background-clip: text; background-clip: text; color: transparent; }
.marca small { display: block; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topo-acoes { display: flex; gap: 8px; }

/* ---- Tela ---- */

.tela {
  flex: 1; display: flex; flex-direction: column; gap: 14px;
  padding: 8px 18px calc(var(--barra-altura) + 40px + env(safe-area-inset-bottom));
}
.tela.com-descanso { padding-bottom: calc(var(--barra-altura) + 110px + env(safe-area-inset-bottom)); }

h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.4px; line-height: 1.15; }
h2 { font-size: 19px; font-weight: 800; letter-spacing: -0.2px; }
h3 { font-size: 15px; font-weight: 700; }
.sub { color: var(--muted); font-size: 13px; }
.rotulo { font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); font-weight: 700; margin-top: 4px; }
.num { font-size: 24px; font-weight: 800; letter-spacing: -0.4px; font-variant-numeric: tabular-nums; }
.destaque-texto { color: var(--accent); }

.pilha { display: flex; flex-direction: column; gap: 10px; }
.linha { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.linha > .cresce, .cresce { flex: 1; min-width: 0; }
.junto { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.grade-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grade-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

/* ---- Cartões ---- */

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--sombra);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.card.hero { background: var(--grad-hero), var(--surface); border-color: var(--border-forte); }
.card.justo { padding: 12px 14px; }
.card.centro { text-align: center; }
button.card, a.card { display: block; width: 100%; text-align: left; text-decoration: none; color: inherit; }
button.card:active, a.card:active { transform: scale(0.99); }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 800; padding: 4px 10px; border-radius: 999px; white-space: nowrap;
  background: var(--accent-suave); color: var(--accent);
}
.pill.neutra { background: var(--surface-3); color: var(--text-2); }
.pill.ouro { background: rgba(245, 158, 11, 0.16); color: #fcd34d; }
.pill.ruim { background: var(--perigo-suave); color: var(--perigo); }
.pill.p2 { background: var(--p2-suave); color: var(--p2); }
.pill svg.ico { width: 13px; height: 13px; }
button.pill { border: 0; }

/* ---- Botões ---- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 50px; padding: 12px 18px;
  border: 0; border-radius: 16px; text-decoration: none;
  background: var(--grad-marca); color: var(--accent-tinta);
  font-weight: 800; font-size: 15px; letter-spacing: 0.1px;
  box-shadow: 0 12px 28px -14px rgba(75, 227, 160, 0.8);
  transition: transform 0.15s var(--ease), opacity 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; box-shadow: none; }
.btn.sec { background: var(--surface-3); color: var(--text); box-shadow: none; }
.btn.fantasma { background: transparent; color: var(--text-2); box-shadow: none; border: 1px dashed var(--border-forte); }
.btn.perigo { background: var(--perigo-suave); color: var(--perigo); box-shadow: none; }
.btn.pequeno { width: auto; min-height: 38px; padding: 8px 14px; font-size: 13px; border-radius: 12px; }
.btn.icone-so { width: 40px; min-height: 40px; padding: 0; border-radius: 13px; flex: none; }
.btn.icone-so.mini { width: 34px; min-height: 34px; border-radius: 11px; }

/* ---- Campos ---- */

input, select, textarea {
  width: 100%; min-height: 46px; padding: 10px 13px;
  background: rgba(0, 0, 0, 0.28); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text);
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.8; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(45, 226, 197, 0.16); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
select option { background: #0b1f19; color: var(--text); }
textarea { resize: vertical; min-height: 72px; }
input[type="file"] { padding: 9px; font-size: 13px; }
.campo { display: grid; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.busca { position: relative; }
.busca svg.ico { position: absolute; left: 13px; top: 13px; color: var(--muted); }
.busca input { padding-left: 42px; }

.contador { display: flex; align-items: center; gap: 8px; }
.contador b { min-width: 44px; text-align: center; font-size: 17px; font-variant-numeric: tabular-nums; }

.interruptor { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; background: none; border: 0; text-align: left; padding: 0; }
.interruptor .trilho { width: 46px; height: 28px; border-radius: 999px; background: var(--surface-3); position: relative; flex: none; transition: background 0.2s; }
.interruptor .trilho::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform 0.2s var(--ease); }
.interruptor[aria-checked="true"] .trilho { background: var(--grad-marca); }
.interruptor[aria-checked="true"] .trilho::after { transform: translateX(18px); }

/* ---- Abas e chips ---- */

.abas { display: flex; gap: 4px; padding: 4px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border); }
.abas button { flex: 1; min-height: 38px; border: 0; border-radius: 12px; background: transparent; color: var(--muted); font-weight: 700; font-size: 13px; }
.abas button[aria-selected="true"] { background: var(--grad-marca); color: var(--accent-tinta); }

.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 34px; padding: 6px 13px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); font-size: 13px; font-weight: 600; }
.chip[aria-pressed="true"] { background: var(--accent-suave); border-color: var(--accent); color: var(--accent); }

/* ---- Listas ---- */

.lista { display: flex; flex-direction: column; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.item:first-child { border-top: 0; padding-top: 2px; }
.item:last-child { padding-bottom: 2px; }
.item .cresce strong { display: block; font-weight: 700; overflow-wrap: anywhere; }
.item .cresce small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
button.item { background: none; border: 0; border-top: 1px solid var(--border); width: 100%; text-align: left; }
button.item:first-child { border-top: 0; }
.item > svg.ico:last-child { color: var(--muted); }

.opcao { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 13px 14px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface-2); }
.opcao strong { display: block; }
.opcao small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.opcao[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-suave); }
.opcao .marca-opcao { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-forte); flex: none; display: grid; place-items: center; }
.opcao[aria-pressed="true"] .marca-opcao { border-color: var(--accent); background: var(--accent); color: var(--accent-tinta); }
.opcao .marca-opcao svg.ico { width: 14px; height: 14px; stroke-width: 3; opacity: 0; }
.opcao[aria-pressed="true"] .marca-opcao svg.ico { opacity: 1; }

.vazio { text-align: center; color: var(--muted); padding: 22px 10px; font-size: 14px; }
.vazio svg.ico { width: 34px; height: 34px; margin-bottom: 8px; opacity: 0.6; }

/* ---- Semana ---- */

.semana { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; text-align: center; font-size: 11px; color: var(--muted); font-weight: 700; }
.semana .dia { width: 36px; height: 36px; margin: 5px auto 0; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--border); color: var(--muted); }
.semana .dia.feito { background: var(--grad-marca); border-color: transparent; color: var(--accent-tinta); }
.semana .dia.hoje:not(.feito) { border-color: var(--accent); color: var(--accent); }
.semana .dia svg.ico { width: 16px; height: 16px; stroke-width: 3; }

.barra-prog { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.barra-prog i { display: block; height: 100%; border-radius: 999px; background: var(--grad-marca); transition: width 0.4s var(--ease); }
.barra-prog.fina { height: 5px; }
.barra-prog i.atencao { background: var(--atencao); }
.barra-prog i.p2 { background: var(--p2); }

/* ---- Treino em andamento ---- */

.passos { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
.passos::-webkit-scrollbar { display: none; }
.passo { flex: none; width: 38px; height: 38px; border-radius: 13px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); font-weight: 800; display: grid; place-items: center; }
.passo.feito { background: var(--accent-suave); border-color: transparent; color: var(--accent); }
.passo.atual { border-color: var(--accent); color: var(--text); box-shadow: 0 0 0 3px rgba(163, 247, 107, 0.16); }
.passo svg.ico { width: 16px; height: 16px; stroke-width: 3; }

.avatar { width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 12px; font-weight: 800; background: var(--accent-suave); color: var(--accent); }
.avatar.p2 { background: var(--p2-suave); color: var(--p2); }

.series-cab, .serie { display: grid; grid-template-columns: 34px 1fr 1fr 50px; gap: 8px; align-items: center; }
.series-cab { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.8px; text-align: center; padding-bottom: 6px; }
.serie { padding: 6px 0; }
.serie + .serie { border-top: 1px solid var(--border); }
.serie.mesma { border-top: 0; padding-top: 0; }
.serie .n { text-align: center; font-weight: 800; color: var(--muted); }
.serie input { text-align: center; font-size: 17px; font-weight: 700; min-height: 48px; padding: 6px; font-variant-numeric: tabular-nums; }
.serie .ok { width: 50px; height: 48px; border-radius: 14px; border: 1px solid var(--border-forte); background: var(--surface-2); color: var(--muted); display: grid; place-items: center; }
.serie .ok svg.ico { width: 22px; height: 22px; stroke-width: 3; }
.serie.feita input { color: var(--accent); border-color: transparent; background: var(--accent-suave); }
.serie.feita .ok { background: var(--grad-marca); border-color: transparent; color: var(--accent-tinta); }
.serie.p2.feita input { color: var(--p2); background: var(--p2-suave); }
.serie.p2.feita .ok { background: var(--p2); }

.dica { font-size: 13.5px; color: var(--text-2); }
.ultima { font-size: 12.5px; color: var(--muted); }
.ultima b { color: var(--text-2); font-weight: 700; }

/* Barra de descanso: fica acima do menu em qualquer tela enquanto o cronômetro corre. */
.descanso {
  position: fixed; left: 0; right: 0; bottom: calc(var(--barra-altura) + 14px + env(safe-area-inset-bottom)); z-index: 6;
  max-width: 524px; margin: 0 auto; width: calc(100% - 36px);
  display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 16px;
  background: rgba(8, 28, 23, 0.94); border: 1px solid var(--accent-2); border-radius: 20px;
  box-shadow: 0 18px 40px -16px rgba(0, 0, 0, 0.9); overflow: hidden;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.descanso .tempo { font-size: 30px; font-weight: 900; font-variant-numeric: tabular-nums; color: var(--accent-2); letter-spacing: 0.5px; line-height: 1; }
.descanso small { display: block; font-size: 10px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.descanso .fio { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--grad-marca); transition: width 0.5s linear; }
.descanso.acabou { border-color: var(--accent); }
.descanso.acabou .tempo { color: var(--accent); }

/* ---- Medalhas (no desenho do Maxve: selo, nome, o que pede e o progresso) ---- */

.medalhas { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.medalha { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 14px 10px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.medalha strong { font-size: 13.5px; }
.medalha small { font-size: 11.5px; color: var(--muted); }
.medalha .progresso { font-size: 11px; font-weight: 800; color: var(--text-2); }
.medalha-selo { width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); }
.medalha-selo svg.ico { width: 24px; height: 24px; }
.medalha[data-conquistada="sim"] { border-color: rgba(245, 158, 11, 0.4); }
.medalha[data-conquistada="sim"] .medalha-selo { background: var(--grad-ouro); color: #4a2a00; box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.55), 0 0 0 3px rgba(245, 158, 11, 0.24), 0 10px 22px -10px rgba(245, 158, 11, 0.9); }
.medalha[data-conquistada="sim"] .progresso { color: #fcd34d; }
.medalha.linha-so { flex-direction: row; text-align: left; gap: 12px; }

/* ---- Gráficos ---- */

.colunas { display: flex; align-items: flex-end; gap: 6px; height: 120px; position: relative; }
.colunas .coluna { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.colunas .coluna i { width: 100%; max-width: 34px; min-height: 3px; border-radius: 7px 7px 3px 3px; background: var(--surface-3); }
.colunas .coluna.cumpriu i { background: var(--grad-marca); }
.colunas .coluna small { font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.colunas .coluna b { font-size: 11px; }
.colunas .meta { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--border-forte); }

.grafico-linha { width: 100%; height: auto; display: block; overflow: visible; }
.grafico-linha .eixo { stroke: var(--border); stroke-width: 1; }
.grafico-linha .linha-g { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.grafico-linha .area { fill: var(--accent); opacity: 0.1; }
.grafico-linha .ponto { fill: var(--bg); stroke: var(--accent); stroke-width: 2.5; }
.grafico-linha text { fill: var(--muted); font-size: 10px; font-family: var(--fonte); }
.grafico-linha.p2 .linha-g, .grafico-linha.p2 .ponto { stroke: var(--p2); }
.grafico-linha.p2 .area { fill: var(--p2); }

.tabela { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.tabela th { text-align: left; font-size: 11px; color: var(--muted); font-weight: 700; padding: 6px 4px; }
.tabela td { padding: 8px 4px; border-top: 1px solid var(--border); }
.tabela td:last-child, .tabela th:last-child { text-align: right; }

/* ---- Menu inferior ---- */

.barra {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; margin: 0 auto; max-width: 560px;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  height: calc(var(--barra-altura) + env(safe-area-inset-bottom)); padding: 0 8px env(safe-area-inset-bottom);
  background: rgba(6, 17, 14, 0.9); border-top: 1px solid var(--border);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
}
.barra a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0; color: var(--muted); text-decoration: none; font-size: 10.5px; font-weight: 600; border-radius: 16px; }
.barra a svg.ico { width: 22px; height: 22px; }
.barra a[aria-current="page"] { color: var(--accent); }
.barra a.central { margin-top: -26px; }
.barra a.central .bola { width: 58px; height: 58px; border-radius: 20px; display: grid; place-items: center; background: var(--grad-marca); color: var(--accent-tinta); box-shadow: 0 14px 30px -10px rgba(75, 227, 160, 0.85); }
.barra a.central .bola svg.ico { width: 26px; height: 26px; }
.barra a.central.ativo .bola { animation: pulso 2s ease-in-out infinite; }
@keyframes pulso { 50% { box-shadow: 0 0 0 8px rgba(163, 247, 107, 0.14), 0 14px 30px -10px rgba(75, 227, 160, 0.85); } }

/* ---- Folha (painel que sobe de baixo) ---- */

.folha-fundo { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, 0.62); display: flex; align-items: flex-end; justify-content: center; animation: surgir 0.2s ease-out; }
.folha {
  width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
  background: #0b1d18; border: 1px solid var(--border-forte); border-bottom: 0; border-radius: 26px 26px 0 0;
  padding: 10px 18px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px;
  animation: subir 0.28s var(--ease);
}
.folha::before { content: ""; width: 42px; height: 4px; border-radius: 4px; background: var(--surface-3); align-self: center; flex: none; }
@keyframes subir { from { transform: translateY(30px); opacity: 0; } }
@keyframes surgir { from { opacity: 0; } }

/* ---- Avisos ---- */

.avisos { position: fixed; left: 0; right: 0; top: calc(12px + env(safe-area-inset-top)); z-index: 30; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.aviso { max-width: 460px; padding: 11px 16px; border-radius: 16px; background: #0f2a22; border: 1px solid var(--accent-2); font-size: 13.5px; font-weight: 600; box-shadow: 0 18px 40px -16px rgba(0, 0, 0, 0.9); animation: subir 0.25s var(--ease); }
.aviso.erro { border-color: var(--perigo); }

/* ---- Resumo do treino ---- */

.festa { text-align: center; padding: 10px 0 2px; }
.festa .pontos { font-size: 46px; font-weight: 900; letter-spacing: -1px; background: var(--grad-marca); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1.05; }

@media (min-width: 420px) { .medalhas { grid-template-columns: repeat(3, 1fr); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
