:root {
  --bg: #fbf5f8;
  --surface: #ffffff;
  --surface-2: #f7ecf2;
  --ink: #2a1620;
  --ink-soft: #7d6b74;
  --line: #efdde8;
  --brand: #a52361;          /* magenta MDA */
  --brand-deep: #7c1a49;
  --wine: #4a1230;           /* aubergine escuro (fundo da arte) */
  --pink: #e85a9c;           /* rosa vibrante */
  --pink-soft: #fbe3ef;
  --grad: linear-gradient(120deg, #7c1a49 0%, #b32568 48%, #e85a9c 100%);
  --danger: #c0392b;
  --shadow: 0 1px 2px rgba(124, 26, 73, .05), 0 6px 18px rgba(124, 26, 73, .08);
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; overflow-x: hidden; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); }

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 18px;
  background: var(--grad);
  color: #fff;
}
.brand {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.18rem;
  color: #fff;
  text-decoration: none;
  letter-spacing: .02em;
}
.logout { display: flex; align-items: center; gap: 10px; margin: 0; }
.logout .hi { font-size: .84rem; color: #f6dcea; text-decoration: none; border-bottom: 1px dotted rgba(246,220,234,.5); }
.logout .hi:hover { color: #fff; }
.logout button {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .45);
  color: #fff;
  border-radius: 999px;
  padding: 5px 13px;
  font: inherit;
  font-size: .8rem;
  cursor: pointer;
}
.logout button:hover { background: rgba(255, 255, 255, .16); }

.content { flex: 1; padding: 24px 18px 44px; }
.content.has-nav { padding-bottom: 92px; }
.content > h1 { font-family: var(--font-serif); font-weight: 600; font-size: 1.6rem; margin: 0 0 18px; }

/* ---------- Welcome (landing) ---------- */
.welcome {
  position: relative;
  margin: -24px -18px -44px;               /* full-bleed dentro do .content */
  min-height: calc(100dvh - 51px);         /* preenche abaixo da topbar */
  padding: 30px 24px 42px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; overflow: hidden;
}
.welcome-bg {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(58% 42% at 86% 6%, rgba(232, 90, 156, .30), transparent 62%),
    radial-gradient(52% 40% at 8% 96%, rgba(124, 26, 73, .20), transparent 60%),
    var(--bg);
}
.welcome-inner { position: relative; z-index: 1; width: 100%; max-width: 360px; display: flex; flex-direction: column; align-items: center; }

.eyebrow-pill {
  font-size: .7rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: #fff; background: var(--grad); padding: 6px 15px; border-radius: 999px;
  margin-bottom: 24px; box-shadow: 0 8px 18px rgba(165, 35, 97, .28);
}
.logo-glow { position: relative; line-height: 0; margin-bottom: 20px; }
.logo-glow::before {
  content: ""; position: absolute; inset: -22% -14%; z-index: -1;
  background: radial-gradient(closest-side, rgba(232, 90, 156, .38), transparent 70%);
}
.logo-glow img { width: 172px; height: auto; }

/* Coração de fogo (logo 10 Anos) — batimento + brilho de chama */
.flame-heart { position: relative; line-height: 0; margin-bottom: 16px; }
.flame-heart img {
  width: 236px; height: auto; transform-origin: center 58%;
  animation: heartbeat 2.6s ease-in-out infinite, flameglow 2.6s ease-in-out infinite;
}
@keyframes heartbeat {
  0%, 42%, 100% { transform: scale(1); }
  12% { transform: scale(1.06); }
  24% { transform: scale(1); }
  32% { transform: scale(1.035); }
}
@keyframes flameglow {
  0%, 100% { filter: drop-shadow(0 3px 14px rgba(232, 90, 156, .40)); }
  50% { filter: drop-shadow(0 4px 30px rgba(232, 90, 156, .74)); }
}
@media (prefers-reduced-motion: reduce) {
  .flame-heart img { animation: none; filter: drop-shadow(0 3px 16px rgba(232, 90, 156, .45)); }
}

.welcome h1 { font-family: var(--font-serif); font-weight: 600; font-size: 2.2rem; line-height: 1.06; letter-spacing: -.01em; margin: 0 0 14px; }
.welcome .tagline { color: var(--ink-soft); max-width: 30ch; margin: 0 0 26px; line-height: 1.55; }
.cta { display: flex; flex-direction: column; gap: 12px; width: 100%; }

.wfeatures {
  list-style: none; padding: 0; margin: 34px 0 0; width: 100%;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.wfeatures li {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 15px 6px 13px; display: flex; flex-direction: column; align-items: center; gap: 2px; box-shadow: var(--shadow);
}
.wf-ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; color: #fff; background: var(--grad); margin-bottom: 6px; }
.wf-ic svg { width: 20px; height: 20px; }
.wfeatures b { font-size: .85rem; }
.wfeatures small { font-size: .72rem; color: var(--ink-soft); }

.verse { margin: 28px 0 0; font-family: var(--font-serif); font-style: italic; font-size: .95rem; color: var(--brand); max-width: 32ch; line-height: 1.5; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 20px; border-radius: 12px; font: inherit; font-size: 1rem; font-weight: 600;
  text-decoration: none; border: 1px solid transparent; cursor: pointer;
}
.btn-primary, .btn-green { background: var(--grad); color: #fff; }
.btn-primary:hover, .btn-green:hover { filter: brightness(.95); }
.btn-ghost { background: var(--surface); color: var(--brand); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-block { width: 100%; }
.btn[aria-disabled="true"], .btn.soon { opacity: .5; pointer-events: none; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card h2 { font-size: 1.1rem; margin: 0 0 12px; }
.greet { font-size: 1.08rem; color: var(--ink-soft); margin: 0 0 16px; }
.greet b { color: var(--ink); }

.group-card { text-align: center; background: linear-gradient(160deg, #fff, var(--pink-soft)); }
.group-card .label { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--brand); font-weight: 700; }
.group-card h2 { font-family: var(--font-serif); font-size: 1.75rem; margin: 6px 0 12px; }
.group-card .pts { font-size: 1rem; color: var(--ink-soft); }
.group-card .pts b {
  display: block; font-size: 2.5rem; line-height: 1; margin-bottom: 2px; font-variant-numeric: tabular-nums;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- Forms ---------- */
.form-wrap { max-width: 360px; margin: 0 auto; }
.form-wrap h1 { font-family: var(--font-serif); font-weight: 600; font-size: 1.7rem; margin: 0 0 20px; text-align: center; }
.form { display: flex; flex-direction: column; gap: 15px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: .85rem; color: var(--ink-soft); font-weight: 600; }
.form input, .form select, .form textarea { font: inherit; font-size: 1rem; color: var(--ink); padding: 12px 14px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); width: 100%; }
.form textarea { resize: vertical; }
.form label small { font-weight: 400; color: var(--ink-soft); }
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent); }
.form.row { flex-direction: row; gap: 10px; align-items: stretch; }
.form.row input { flex: 1; }
.alt { text-align: center; margin-top: 20px; color: var(--ink-soft); font-size: .92rem; }

/* ---------- Alerts / Flash ---------- */
.alert { background: #fdecec; border: 1px solid #f2c4c0; color: var(--danger); padding: 12px 14px; border-radius: 11px; margin-bottom: 16px; font-size: .9rem; }
.alert ul { margin: 0; padding-left: 18px; }
.flash { background: var(--pink-soft); border: 1px solid #f3c2da; color: var(--brand); padding: 12px 14px; border-radius: 11px; margin-bottom: 16px; font-size: .95rem; font-weight: 500; }

/* ---------- Progresso da semana ---------- */
.week .week-head { display: flex; justify-content: space-between; align-items: baseline; font-size: .9rem; color: var(--ink-soft); }
.week .week-head b { color: var(--ink); font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.dots { display: flex; gap: 8px; margin: 12px 0; }
.dots .dot { flex: 1; height: 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.dots .dot.on { background: var(--pink); border-color: var(--brand); }
.week-msg { margin: 4px 0 0; font-size: .9rem; color: var(--ink-soft); }
.week-msg.ok { color: var(--brand); font-weight: 600; }

/* ---------- Check-in ---------- */
.ci-lead { margin: 0 0 8px; }
.ci-week { font-size: .85rem; color: var(--ink-soft); }
.center { text-align: center; }
#ci-form { display: flex; flex-direction: column; }
.ci-camera {
  display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: 240px; border: 2px dashed #e3b9d1; border-radius: 16px;
  background: var(--surface-2); color: var(--brand); cursor: pointer;
  overflow: hidden; margin-bottom: 14px; font-size: 1rem; line-height: 1.6; font-weight: 600;
}
.ci-camera img { width: 100%; max-height: 340px; object-fit: cover; display: block; }
.ci-camera img[hidden] { display: none; }

/* ---------- Ranking ---------- */
.rank { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.rank-item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.rank-item .pos { font-weight: 700; color: var(--ink-soft); min-width: 34px; font-variant-numeric: tabular-nums; }
.rank-item.top .pos { color: var(--brand); }
.rank-item .rk-name { flex: 1; min-width: 0; font-weight: 600; display: flex; flex-direction: column; }
.rank-item .rk-name small { font-weight: 400; color: var(--ink-soft); font-size: .78rem; }
.rank-item .rk-pts { font-size: 1.25rem; font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; }
.rank-item.mine { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 5%, var(--surface)); }

/* ---------- Admin ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th, .tbl td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.tbl th { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
.tbl .r { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-weight: 700; color: var(--brand); letter-spacing: .06em; }
.tbl tr:last-child td { border-bottom: 0; }
.muted { color: var(--ink-soft); }

/* ---------- Bottom nav ---------- */
.bottomnav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; display: flex; justify-content: space-around;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom)); z-index: 20;
}
.nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; text-decoration: none; color: var(--ink-soft); font-size: .68rem; font-weight: 600; padding: 4px 0; }
.nav-item svg { width: 24px; height: 24px; }
.nav-item.active { color: var(--brand); }

@media (prefers-reduced-motion: no-preference) {
  .card { animation: rise .5s ease both; }
  .welcome-inner > * { animation: rise .55s cubic-bezier(.2,.7,.2,1) both; }
  .welcome-inner > *:nth-child(2) { animation-delay: .06s; }
  .welcome-inner > *:nth-child(3) { animation-delay: .12s; }
  .welcome-inner > *:nth-child(4) { animation-delay: .18s; }
  .welcome-inner > *:nth-child(5) { animation-delay: .24s; }
  .welcome-inner > *:nth-child(6) { animation-delay: .30s; }
  .welcome-inner > *:nth-child(7) { animation-delay: .36s; }
  @keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
}

/* ===== Boas-vindas — variantes B e C ===== */
.btn-glass { background: rgba(255,255,255,.16); color:#fff; border:1px solid rgba(255,255,255,.55); }
.btn-glass:hover { background: rgba(255,255,255,.26); }

/* Variante B — foto dramática: rosto/braço livres, texto embaixo */
.welcome-b {
  justify-content: flex-end;
  padding-bottom: 34px;
  background-image:
    linear-gradient(180deg, rgba(40,8,26,.10) 0%, rgba(56,12,34,.22) 38%, rgba(96,20,56,.82) 78%, rgba(112,22,66,.97) 100%),
    url('/static/img/hero-b.png');
  background-size: cover;
  background-position: 22% center;
}
.welcome-b h1 { color:#fff; font-size: 2.15rem; text-shadow: 0 2px 14px rgba(0,0,0,.30); margin-bottom: 10px; }
.welcome-b .eyebrow-pill { background: rgba(255,255,255,.20); box-shadow: none; }
.welcome-b .tagline { color: #f6dcea; }
.welcome-b .wfeatures li { background: rgba(255,255,255,.13); border-color: rgba(255,255,255,.28); box-shadow: none; }
.welcome-b .wfeatures b { color: #fff; }
.welcome-b .wfeatures small { color: #f0cfe0; }
.welcome-b .wf-ic { background: rgba(255,255,255,.22); }

/* Variante C — arte "A Construção" (imersiva, tom vinho) */
.welcome-c { margin: -24px -18px -44px; min-height: 100dvh; padding: 0; justify-content: flex-start; background: #3e1530; }
.welcome-c .wc-photo { position: relative; width: 100%; }
.welcome-c .wc-photo img { width: 100%; display: block; }
.welcome-c .wc-photo::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 96px; background: linear-gradient(transparent, #3e1530); }
.welcome-c .wc-body { flex: 1; padding: 2px 26px 40px; text-align: center; display: flex; flex-direction: column; align-items: center; }
.welcome-c .eyebrow-pill { margin-bottom: 14px; }
.welcome-c .wc-tag { color: #eccbde; max-width: 30ch; margin: 4px 0 22px; line-height: 1.55; }
.welcome-c .cta { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 320px; }
.welcome-c .wc-verse { color: #e7b9d2; font-family: var(--font-serif); font-style: italic; margin: 22px 0 0; font-size: .9rem; max-width: 30ch; }

/* ---------- Recados / listas ---------- */
.card-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.card-title { margin: 0; font-size: 1.05rem; }
.link-more { font-size: .82rem; font-weight: 600; text-decoration: none; color: var(--brand); }
.recado-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.recado-item { display: flex; flex-direction: column; gap: 2px; font-size: .92rem; line-height: 1.45; padding-left: 12px; border-left: 3px solid color-mix(in srgb, var(--brand) 45%, var(--line)); }
.recado-item b { color: var(--ink); }
.recado-item span { color: var(--ink-soft); }
.recado-list.big { gap: 14px; }
.recado-card { text-align: left; }
.recado-card h3 { margin: 0 0 6px; font-size: 1.08rem; }
.recado-card p { margin: 0; color: var(--ink); line-height: 1.5; }
.tag-mini { display: inline-block; margin-top: 10px; font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--brand); background: var(--pink-soft); padding: 3px 9px; border-radius: 999px; }
.mini-list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 7px; font-size: .9rem; }
.mini-list li { padding-left: 16px; position: relative; }
.mini-list li::before { content: ""; position: absolute; left: 2px; top: 8px; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }
.mini-list small { color: var(--ink-soft); }

/* ===== Boas-vindas — cenas animadas (D: cena completa, E: coração) ===== */
.welcome-d, .welcome-e {
  margin: -24px -18px -44px; min-height: 100dvh; padding: 0;
  position: relative; overflow: hidden;
}
.welcome-d { justify-content: center; background: radial-gradient(82% 60% at 50% 42%, #48112d 0%, #280a18 56%, #150610 100%); }
.welcome-e {
  justify-content: flex-end;
  background-image:
    linear-gradient(180deg, rgba(20,6,16,.28) 0%, transparent 26%, transparent 50%, rgba(20,6,16,.76) 82%, rgba(16,5,12,.97) 100%),
    url('/static/img/scene-2026.jpg');
  background-size: cover; background-position: 50% 40%;
}

.welcome-d .wd-inner {
  position: relative; z-index: 4; width: 100%; max-width: 430px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 26px 22px 34px; color: #fff;
}
.welcome-d .eyebrow-pill { margin-bottom: 8px; }
.welcome-d .wd-scene { position: relative; width: 100%; margin: 8px 0 6px; }
.welcome-d .wd-scene img {
  width: 100%; display: block;
  -webkit-mask-image: radial-gradient(128% 122% at 50% 48%, #000 60%, transparent 100%);
  mask-image: radial-gradient(128% 122% at 50% 48%, #000 60%, transparent 100%);
}
.welcome-d .wd-glow, .welcome-e .we-glow {
  position: absolute; left: 50%; top: 47%; width: 46%; height: 56%;
  transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(255,95,175,.5), transparent 72%);
  mix-blend-mode: screen; animation: scene-pulse 2.6s ease-in-out infinite; pointer-events: none; z-index: 1;
}
.welcome-e .we-glow { top: 40%; width: 70%; height: 46%; }
.welcome-d .wd-tag, .welcome-e .we-tag { color: #f8dcea; max-width: 30ch; line-height: 1.55; text-shadow: 0 2px 14px rgba(0,0,0,.6); }
.welcome-d .wd-tag { margin: 8px 0 18px; }
.welcome-e .we-tag { margin: 0 0 18px; }
.welcome-d .cta, .welcome-e .cta { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 320px; }
.welcome-d .wd-verse, .welcome-e .we-verse { color: #f2c6dc; font-style: italic; font-family: var(--font-serif); font-size: .86rem; margin: 16px 0 0; text-shadow: 0 2px 12px rgba(0,0,0,.6); }

.welcome-e .we-inner {
  position: relative; z-index: 4; width: 100%; max-width: 430px; margin: 0 auto;
  min-height: 100dvh; display: flex; flex-direction: column; align-items: center;
  text-align: center; padding: 30px 22px 36px; color: #fff;
}
.welcome-e .we-spacer { flex: 1; }

.welcome-d .ember, .welcome-e .ember {
  position: absolute; bottom: -12px; border-radius: 50%;
  background: rgba(255,130,195,.95); box-shadow: 0 0 8px rgba(255,120,190,.9);
  filter: blur(.5px); animation: scene-rise linear infinite; z-index: 2; pointer-events: none;
}
@keyframes scene-pulse { 0%, 100% { opacity: .3; } 50% { opacity: .85; } }
@keyframes scene-rise { 0% { transform: translateY(0) scale(1); opacity: 0; } 12% { opacity: 1; } 100% { transform: translateY(-92vh) scale(.35); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .welcome-d .wd-glow, .welcome-e .we-glow, .welcome-d .ember, .welcome-e .ember { animation: none; }
  .welcome-d .ember, .welcome-e .ember { display: none; }
}

/* ---------- Abas (painel) ---------- */
.tabs { display: flex; gap: 5px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 5px; margin-bottom: 18px; }
.tab { flex: 1; padding: 9px 8px; border: none; background: transparent; border-radius: 9px; font: inherit; font-weight: 600; font-size: .9rem; color: var(--ink-soft); cursor: pointer; }
.tab.active { background: var(--surface); color: var(--brand); box-shadow: 0 1px 3px rgba(124, 26, 73, .12); }
.tabpanel[hidden] { display: none; }

/* ---------- Plano de fundo (coração 10 Anos, telas logadas) ---------- */
/* Coração oficial como imagem de fundo, grande e centralizado, atrás de
   todo o conteúdo. Nas telas com cards fica só como textura leve (7%); na
   home, onde há espaço, ganha presença (16%). */
body.logged .app::before {
  content: "";
  position: fixed;
  inset: 0;
  background: url('/static/img/logo-2026-web.png') no-repeat;
  background-position: center 44%;
  background-size: min(124vw, 600px) auto;
  opacity: .07;
  pointer-events: none;
  z-index: 0;
}
body.home .app::before { opacity: .16; }
body.logged .topbar,
body.logged .content,
body.logged .bottomnav { position: relative; z-index: 1; }

:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 8px; }
