:root {
  --bg: #0a0a0f;
  --bg-2: #121218;
  --card: #16161e;
  --card-2: #1c1c26;
  --line: rgba(255,255,255,.08);
  --line-2: rgba(255,255,255,.14);

  --tx: #f4f2fb;
  --tx-soft: #a6a3b8;
  --tx-mute: #6f6c82;

  --accent: #8b5cf6;
  --accent-2: #a98bf5;
  --grad: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
  --ig-ring: linear-gradient(45deg, #feda75, #fa7e1e, #d62976, #962fbf, #4f5bd5);

  --green: #22c55e;
  --orange: #f59e0b;
  --red: #ef4444;

  --r: 18px;
  --r-sm: 12px;
  --shadow: 0 18px 44px -18px rgba(0,0,0,.6);
  --maxw: 520px;

  font-family: "Poppins", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--tx);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }

/* ============ TOPBAR ============ */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(10,10,15,.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  max-width: var(--maxw);
  margin: 0 auto;
}
.topbar__brand { display: flex; align-items: center; gap: 10px; }
.topbar__avatar {
  width: 38px; height: 38px; border-radius: 50%;
  border: 2px solid transparent;
  background-origin: border-box;
  background-clip: padding-box, border-box;
  background-image: linear-gradient(var(--bg), var(--bg)), var(--ig-ring);
}
.avatar-photo {
  background-image: url("../img/ricardao-avatar.jpg"), var(--ig-ring) !important;
  background-clip: padding-box, border-box !important;
  background-origin: border-box !important;
  background-size: cover, cover !important;
  background-position: center, center !important;
}
.topbar__name { display: flex; flex-direction: column; line-height: 1.25; }
.topbar__name b { font-size: 14px; font-weight: 700; }
.topbar__name small { font-size: 11.5px; color: var(--tx-mute); }
.topbar__reset {
  background: var(--card); border: 1px solid var(--line); color: var(--tx-soft);
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

/* ============ APP SHELL ============ */
.app {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 18px 16px 96px;
  min-height: calc(100vh - 66px);
}
.screen { animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ============ QUIZ ============ */
.quiz__progress {
  height: 6px; border-radius: 99px; background: var(--card);
  overflow: hidden; margin-bottom: 22px;
}
.quiz__progress-bar { height: 100%; background: var(--grad); transition: width .3s ease; }
.quiz__step-label { font-size: 12.5px; color: var(--tx-mute); font-weight: 600; margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em; }
.quiz__question { font-size: 22px; font-weight: 700; line-height: 1.3; margin: 0 0 20px; }

.optgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.optgrid--single { grid-template-columns: 1fr; }
.opt {
  background: var(--card); border: 1.5px solid var(--line); border-radius: var(--r-sm);
  padding: 16px 14px; text-align: left; color: var(--tx);
  font-size: 14.5px; font-weight: 600;
  display: flex; align-items: center; gap: 10px;
  transition: border-color .15s ease, background .15s ease, transform .1s ease;
}
.opt:active { transform: scale(.98); }
.opt.is-selected { border-color: var(--accent); background: var(--card-2); box-shadow: 0 0 0 1px var(--accent) inset; }
.opt__icon { font-size: 20px; }

.field { margin-bottom: 20px; }
.field label { display: block; font-size: 13px; color: var(--tx-soft); margin-bottom: 8px; font-weight: 600; }
.field input {
  width: 100%; background: var(--card); border: 1.5px solid var(--line); border-radius: var(--r-sm);
  padding: 14px 16px; color: var(--tx); font-size: 16px; font-family: inherit;
}
.field input:focus { outline: none; border-color: var(--accent); }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }

.field--big {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 6px;
}
.field--big input {
  border: none; background: none; padding: 10px 4px;
  font-size: 34px; font-weight: 800; text-align: left;
  -moz-appearance: textfield;
}
.field--big input::-webkit-outer-spin-button,
.field--big input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.field--big:focus-within { border-color: var(--accent); }
.field__suffix { font-size: 18px; font-weight: 700; color: var(--tx-mute); white-space: nowrap; padding-right: 8px; }
.field__hint { min-height: 18px; font-size: 12.5px; color: var(--red); margin: -12px 0 12px; padding-left: 4px; }

.quiz__nav { display: flex; gap: 10px; margin-top: 8px; }
.btn {
  border: none; border-radius: 14px; padding: 15px 20px; font-weight: 700; font-size: 15px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; color: #fff; background: var(--grad);
  box-shadow: 0 10px 24px -10px rgba(139,92,246,.55);
}
.btn:disabled { opacity: .4; pointer-events: none; }
.btn--ghost { background: var(--card); color: var(--tx-soft); box-shadow: none; border: 1.5px solid var(--line); flex: 0 0 auto; width: auto; padding: 15px 18px; }
.btn--outline { background: transparent; color: var(--accent-2); box-shadow: none; border: 1.5px solid var(--accent); }
.btn--sm { padding: 10px 16px; font-size: 13px; border-radius: 10px; }

/* ============ LOADING ============ */
.loading { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 60vh; text-align: center; gap: 18px; }
.loading__ring { width: 64px; height: 64px; border-radius: 50%; border: 4px solid var(--card-2); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading__text { font-size: 15px; color: var(--tx-soft); font-weight: 600; }
.loading__text b { color: var(--tx); }

/* ============ DASHBOARD HOME ============ */
.hero {
  background: var(--grad); border-radius: var(--r); padding: 22px;
  margin-bottom: 18px; position: relative; overflow: hidden;
}
.hero__label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; opacity: .85; font-weight: 700; }
.hero__title { font-size: 24px; font-weight: 800; margin: 4px 0 14px; }
.hero__stats { display: flex; gap: 18px; }
.hero__stat b { display: block; font-size: 20px; font-weight: 800; }
.hero__stat span { font-size: 11.5px; opacity: .85; }

.streak-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 14px 16px; margin-bottom: 12px;
}
.streak-card__flame { font-size: 26px; }
.streak-card__info { display: flex; flex-direction: column; }
.streak-card__info b { font-size: 15px; }
.streak-card__info span { font-size: 12px; color: var(--tx-mute); }

.today-card {
  background: var(--card-2); border: 1px solid var(--line-2); border-radius: var(--r-sm);
  padding: 16px; margin-bottom: 18px;
}
.today-card__label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--tx-mute); font-weight: 700; }
.today-card__title { font-size: 17px; font-weight: 800; margin: 4px 0 12px; }

.foco-tag { font-size: 12px; }

.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 16px;
}
.card__label { font-size: 11.5px; color: var(--tx-mute); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.card__value { font-size: 22px; font-weight: 800; margin-top: 4px; }
.card__value small { font-size: 12px; font-weight: 600; color: var(--tx-soft); }

.section-title { font-size: 16px; font-weight: 700; margin: 22px 0 12px; display: flex; align-items: center; justify-content: space-between; }
.section-title small { font-size: 12.5px; color: var(--accent-2); font-weight: 600; }

.macro-bar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; margin: 10px 0 6px; background: var(--card-2); }
.macro-bar__seg--p { background: var(--accent); }
.macro-bar__seg--c { background: var(--orange); }
.macro-bar__seg--f { background: var(--green); }
.macro-legend { display: flex; gap: 14px; font-size: 12px; color: var(--tx-soft); flex-wrap: wrap; }
.macro-legend span { display: inline-flex; align-items: center; gap: 5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot--p { background: var(--accent); } .dot--c { background: var(--orange); } .dot--f { background: var(--green); }

/* ============ TREINO ============ */
.day-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  margin-bottom: 14px; overflow: hidden;
}
.day-card__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 16px 14px; cursor: pointer;
}
.day-card__title { font-size: 15.5px; font-weight: 700; }
.day-card__count { font-size: 12px; color: var(--tx-mute); font-weight: 600; }
.day-card__chevron { transition: transform .2s ease; color: var(--tx-mute); }
.day-card.is-open .day-card__chevron { transform: rotate(180deg); }
.day-card__body { max-height: 0; overflow: hidden; transition: max-height .3s ease; }
.day-card.is-open .day-card__body { max-height: 900px; }
.exercise-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-top: 1px solid var(--line);
  font-size: 13.5px;
}
.exercise-row__video {
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%;
  background: rgba(139,92,246,.14); color: var(--accent-2);
  display: flex; align-items: center; justify-content: center;
  transition: background .15s ease;
}
.exercise-row__video:hover { background: rgba(139,92,246,.28); }
.exercise-row__name { font-weight: 600; flex: 1; }
.exercise-row__meta { color: var(--accent-2); font-weight: 700; font-size: 12.5px; white-space: nowrap; }

/* ============ DIETA ============ */
.meal-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 16px; margin-bottom: 14px;
}
.meal-card__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.meal-card__title { font-size: 15px; font-weight: 700; }
.meal-card__kcal { font-size: 12.5px; font-weight: 700; color: var(--orange); background: rgba(245,158,11,.12); padding: 4px 10px; border-radius: 99px; }
.meal-card__items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.meal-card__items li { font-size: 13.5px; color: var(--tx-soft); padding-left: 16px; position: relative; }
.meal-card__items li::before { content: ""; position: absolute; left: 0; top: 7px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }

/* ============ PERFIL ============ */
.profile-row { display: flex; justify-content: space-between; padding: 13px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.profile-row span:first-child { color: var(--tx-soft); }
.profile-row span:last-child { font-weight: 700; }

/* ============ TAB BAR ============ */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex; justify-content: space-around;
  background: rgba(18,18,24,.92); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding: 8px 6px calc(env(safe-area-inset-bottom, 0) + 8px);
  max-width: var(--maxw); margin: 0 auto;
}
.tabbar__btn {
  background: none; border: none; color: var(--tx-mute);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 10.5px; font-weight: 600; padding: 6px 14px; border-radius: 12px;
}
.tabbar__btn.is-active { color: var(--accent-2); }

/* ============ EMPTY / CTA ============ */
.pdf-cta {
  margin-top: 22px; text-align: center;
}
.pdf-cta small { display: block; margin-top: 8px; color: var(--tx-mute); font-size: 11.5px; }

.badge-restricao {
  display: inline-block; font-size: 11.5px; font-weight: 700; color: var(--accent-2);
  background: rgba(139,92,246,.12); padding: 4px 10px; border-radius: 99px; margin-bottom: 14px;
}

@media (min-width: 560px) {
  .app { padding-top: 28px; }
}
