/* Sono Profundo · design system "luar"
   Um quarto escuro azul-tinta iluminado só pela lua. A prata marca só o que se toca;
   o luar claro marca destaques de texto e o azul luar marca dados e seleções secundárias. Sem modo claro de propósito: o app é
   usado na cama, à noite. Todos os valores de cor, tipo, espaço e raio saem daqui. */
/* Fontes guardadas no projeto (fonts/), para o app abrir igual sem internet. As duas são variáveis. */
@font-face { font-family: 'Newsreader'; font-style: normal; font-weight: 200 800; font-display: swap; src: url(fonts/newsreader-latin.woff2) format('woff2'); }
@font-face { font-family: 'Figtree'; font-style: normal; font-weight: 300 900; font-display: swap; src: url(fonts/figtree-latin.woff2) format('woff2'); }
:root {
  /* Superfícies: um só matiz azul-tinta, ganhando luz em degraus (a profundidade vem daqui, não de sombra) */
  --bg: #0E1220;
  --bg-deep: #0A0D18;
  --surface: #161B2C;
  --surface-2: #202740;
  --surface-3: #121727;
  --nav-bg: #0C101C;
  /* Linhas: divisória (decorativa) e contorno de controle (≥ 3:1 sobre a superfície) */
  --line: #262D45;
  --line-soft: #1D2337;
  --line-control: #646E8E;
  --line-strong: #7C86A6;
  /* Texto cor de papel à meia-luz: menos brilho que o branco */
  --fg: #ECE5D8;
  --fg-2: #CFC8BA;
  --muted: #A7A296;
  --placeholder: #8E8A80;
  /* Prata da lua: a ação principal (botão claro com texto escuro) */
  --accent: #DDE3EE;
  --accent-press: #C2CADA;
  --accent-ink: #141A2B;
  --accent-soft: #242C42;
  /* Luar claro: destaques de texto, mais azul para não se confundir com o texto cor de papel */
  --accent-2: #BFD0EE;
  /* Luar: dados, gráfico e apoio */
  --moon: #9DB4DE;
  --moon-soft: #1C2742;
  --bar-hi: #9DB4DE;
  --bar-lo: #5E6E94;
  /* Estados */
  --good: #8CC7A3;
  --good-bg: #17302A;
  --warn: #F4B9A6;
  --warn-bg: #2E1C1A;
  --warn-line: #8A4E43;
  /* Perigo: só na zona de apagar a conta (texto ≥ 7:1 no fundo, contorno ≥ 3:1 no cartão) */
  --danger: #F2928A;
  --danger-solid: #E2685F;
  --danger-press: #CC574F;
  --danger-ink: #2A0B08;
  --danger-bg: #24141A;
  --danger-line: #B85C55;
  /* Véus sobre as cenas */
  --scrim-12: rgba(10, 13, 24, 0.12);
  --scrim-35: rgba(10, 13, 24, 0.35);
  --scrim-55: rgba(10, 13, 24, 0.55);
  --scrim-80: rgba(10, 13, 24, 0.8);
  --core: #1E2740;
  --core-glass: rgba(30, 39, 64, 0.85);
  --text-shadow: rgba(6, 8, 16, 0.75);
  /* Guias visuais do player */
  --pmr-ring: rgba(220, 227, 238, 0.25);
  --pmr-hi: #F7F9FC;
  --pmr-mid: #C3CEE3;
  --pmr-lo: #4E5A78;
  --scan-glow: rgba(191, 208, 238, 0.55);
  --scan-clear: rgba(191, 208, 238, 0);
  /* Fontes: serifa de livro de cabeceira nos títulos; corpo em Figtree, firme e calma, com zero sem corte */
  --font-display: 'Newsreader', 'Iowan Old Style', Georgia, serif;
  --font-body: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  /* Escala de texto (≈ 1,25) */
  --text-nav: 12px;
  --text-xs: 14px;
  --text-sm: 15px;
  --text-md: 17px;
  --text-lg: 20px;
  --text-xl: 25px;
  --text-2xl: 32px;
  --text-3xl: 40px;
  /* Espaço em 4/8 px */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  /* Raios com papel definido */
  --radius-sm: 10px;   /* controles */
  --radius-md: 18px;   /* cartões */
  --radius-pill: 999px;
  /* Movimento: só em resposta a uma ação */
  --ease: cubic-bezier(.2, .7, .2, 1);
  --dur-fast: .15s;
  --dur: .28s;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);   /* entradas: começa rápido e assenta devagar */
  color-scheme: dark;
  /* Margens laterais do conteúdo. Fundos, céu, player e barras vão até a borda da tela;
     só o conteúdo respeita a margem, o recorte do aparelho e a largura máxima de 480 px. */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --pad-l: max(var(--space-5), env(safe-area-inset-left, 0px), calc((100vw - 440px) / 2));
  --pad-r: max(var(--space-5), env(safe-area-inset-right, 0px), calc((100vw - 440px) / 2));
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; overflow-x: clip; }
html { scrollbar-color: var(--line) transparent; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 var(--text-md)/1.5 var(--font-body);
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  caret-color: var(--accent);
}
::selection { background: var(--accent-soft); color: var(--fg); }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: var(--accent-2); -webkit-tap-highlight-color: transparent; }
h1, h2, h3, p, ol, ul { margin: 0; }
h2, h3 { text-wrap: balance; }
h1 { overflow-wrap: break-word; min-width: 0; }
p, .subtle, .item-sub { text-wrap: pretty; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
[tabindex="-1"]:focus { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

#app { height: 100%; margin: 0 auto; display: flex; flex-direction: column; position: relative; }
#view { flex: 1; min-height: 0; overflow-y: auto; overflow-x: clip; padding: calc(var(--space-6) + var(--safe-top)) var(--pad-r) var(--space-8) var(--pad-l); display: flex; flex-direction: column; gap: var(--space-6); outline: none; scrollbar-color: var(--line) transparent; }
#view > * { flex-shrink: 0; }
#app.no-nav #view { padding-bottom: calc(var(--space-8) + var(--safe-bottom)); }
#view.enter { animation: view-in var(--dur) var(--ease); }
@keyframes view-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- navegação */
#nav { display: flex; justify-content: space-around; border-top: 1px solid var(--line-soft); background: var(--nav-bg); padding: var(--space-2) max(var(--space-1), env(safe-area-inset-right, 0px)) calc(var(--space-2) + var(--safe-bottom)) max(var(--space-1), env(safe-area-inset-left, 0px)); }
#nav[hidden] { display: none; }
#nav a { position: relative; display: flex; flex-direction: column; align-items: center; gap: var(--space-1); min-width: 60px; min-height: 48px; padding: var(--space-1); font-size: var(--text-nav); text-decoration: none; color: var(--muted); border-radius: var(--radius-sm); transition: color var(--dur-fast); }
#nav a[aria-current="page"] { color: var(--accent); }
#nav a[aria-current="page"]::before { content: ""; position: absolute; top: calc(var(--space-2) * -1); left: 30%; right: 30%; height: 2px; border-radius: 2px; background: var(--accent); }
#nav a:active { background: var(--surface); }
.nav-brand { display: none; }

/* ---------------------------------------------------------------- mini player */
#mini:empty { display: none; }
.mini { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--pad-r) var(--space-2) var(--pad-l); background: var(--surface-2); border-top: 1px solid var(--line); }
.mini-open { flex: 1; min-width: 0; display: flex; flex-direction: column; text-align: left; background: none; border: none; padding: var(--space-1) 0; }
.mini-title { font-size: var(--text-sm); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-sub { font-size: var(--text-xs); color: var(--muted); }
.mini-sub.err { color: var(--warn); }

/* ---------------------------------------------------------------- tipografia */
.display { font-family: var(--font-display); font-size: var(--text-2xl); font-weight: 500; line-height: 1.12; letter-spacing: -0.01em; }
.title { font-family: var(--font-display); font-size: var(--text-2xl); font-weight: 500; line-height: 1.15; letter-spacing: -0.01em; }
.title-sm { font-family: var(--font-display); font-size: var(--text-xl); font-weight: 500; line-height: 1.2; }
.section-title { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 500; line-height: 1.25; }
.eyebrow { font-size: var(--text-xs); color: var(--accent-2); font-weight: 500; }
h2.eyebrow { font-size: var(--text-sm); color: var(--fg-2); font-weight: 500; }
.subtle { font-size: var(--text-sm); color: var(--muted); }
.fine { font-size: var(--text-xs); color: var(--muted); }
.head { display: flex; flex-direction: column; gap: var(--space-2); }
.num { font-family: var(--font-display); font-size: var(--text-xl); font-weight: 500; font-variant-numeric: tabular-nums lining-nums; line-height: 1.1; }

/* ---------------------------------------------------------------- cartões e linhas */
.card { background: var(--surface); border-radius: var(--radius-md); padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-3); }
.card.on { box-shadow: inset 0 0 0 1px var(--line-control); }
.card.dim { background: var(--surface-3); }
a.card, a.row { text-decoration: none; color: var(--fg); }
a.card:active { background: var(--surface-2); }
.row { display: flex; align-items: center; gap: var(--space-3); min-width: 0; width: 100%; background: none; border: none; text-align: left; padding: 0; color: var(--fg); }
.ico { width: 40px; height: 40px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--moon); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ico.round { width: 36px; height: 36px; border-radius: var(--radius-pill); }
.ico.done { background: var(--good-bg); color: var(--good); }
.ico.lock { background: transparent; box-shadow: inset 0 0 0 1px var(--line); color: var(--muted); }
.ico.step { background: var(--accent-soft); color: var(--accent); font-weight: 600; font-variant-numeric: tabular-nums; }
.grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.item-title { font-size: var(--text-md); font-weight: 500; line-height: 1.3; }
.item-sub { font-size: var(--text-xs); color: var(--muted); line-height: 1.35; }
.status { font-size: var(--text-xs); color: var(--muted); white-space: nowrap; }
.status.good { color: var(--good); font-weight: 600; }
.status.act { color: var(--accent); font-weight: 600; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.tile { background: var(--surface); border-radius: var(--radius-md); padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.tile.on { box-shadow: inset 0 0 0 1px var(--line-control); }
.tile .label { font-size: var(--text-xs); color: var(--muted); }
.tile .delta { font-size: var(--text-xs); color: var(--muted); }
.tile .delta.good { color: var(--good); }
.bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--moon); border-radius: 3px; transition: width .6s var(--ease); }
.list-lines { display: flex; flex-direction: column; }
.list-lines > * { border-top: 1px solid var(--line-soft); }
.list-lines .row { padding: var(--space-3) 0; min-height: 52px; }
.list-lines .row:active, button.row:active { opacity: 0.7; }
.note { display: flex; align-items: flex-start; gap: var(--space-3); font-size: var(--text-sm); color: var(--fg-2); line-height: 1.45; }
.note svg { flex-shrink: 0; margin-top: 2px; color: var(--moon); }
.group { display: flex; flex-direction: column; gap: var(--space-3); }
.lesson-ico { display: flex; color: var(--moon); flex-shrink: 0; }
.lesson-ico.t-audio { color: var(--accent); }
.lesson-ico.t-doc { color: var(--fg-2); }
.lesson-ico.t-done { color: var(--good); }
.lesson-t { font-size: var(--text-sm); }
.lesson-t.todo { font-weight: 500; }
.lesson-t .subtle { font-size: var(--text-xs); }

/* ---------------------------------------------------------------- botões */
.btn { min-height: 52px; border-radius: var(--radius-pill); border: none; background: var(--accent); color: var(--accent-ink); font-weight: 600; font-size: var(--text-md); display: flex; align-items: center; justify-content: center; gap: var(--space-2); text-decoration: none; padding: 0 var(--space-4); width: 100%; text-align: center; transition: background var(--dur-fast), transform var(--dur-fast); }
.btn:active { background: var(--accent-press); transform: scale(.985); }
.btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--fg); box-shadow: inset 0 0 0 1px var(--line-control); min-height: 48px; }
.btn.ghost:active { background: var(--surface); }
.btn.small { min-height: 44px; font-size: var(--text-sm); }
.btn.danger { background: var(--danger-solid); color: var(--danger-ink); }
.btn.danger:active { background: var(--danger-press); }
.btn.danger-ghost { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger-line); min-height: 48px; }
.btn.danger-ghost:active { background: var(--danger-bg); }
/* Em andamento: giro antes do texto; o botão não esmaece como um desabilitado */
.btn[aria-busy="true"] { opacity: 1; cursor: progress; }
.btn[aria-busy="true"]::before { content: ""; width: 16px; height: 16px; flex-shrink: 0; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
.link-btn { background: none; border: none; padding: var(--space-2) 0; min-height: 44px; color: var(--accent); font-size: var(--text-sm); text-align: left; text-decoration: underline; text-underline-offset: 0.2em; align-self: flex-start; }
.link-btn:active { color: var(--accent-press); }
.back { align-self: flex-start; display: inline-flex; align-items: center; gap: var(--space-2); min-height: 44px; font-size: var(--text-sm); background: none; border: none; color: var(--fg-2); padding: 0; text-decoration: none; }
.back:active { color: var(--fg); }
.icon-btn { width: 44px; height: 44px; border-radius: var(--radius-pill); border: none; background: transparent; color: var(--fg-2); display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:active { background: var(--surface-2); }
.mini .icon-btn { background: var(--accent); color: var(--accent-ink); }
.mini .icon-btn:active { background: var(--accent-press); }
.mini .mini-close { background: transparent; color: var(--fg-2); width: 40px; margin-left: calc(var(--space-1) * -1); }
.end-btn { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 44px; padding: 0 var(--space-4); border-radius: var(--radius-pill); border: none; box-shadow: inset 0 0 0 1px var(--line-control); background: transparent; color: var(--fg-2); font-size: var(--text-sm); }
.end-btn:active { background: var(--surface); }

/* Chips e controles segmentados */
.chips { display: grid; gap: var(--space-2); }
.chips.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.chips.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.chips.c5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.chip { min-height: 44px; border-radius: var(--radius-pill); font-size: var(--text-sm); border: none; box-shadow: inset 0 0 0 1px var(--line-control); background: transparent; color: var(--fg-2); padding: 0 var(--space-1); transition: background var(--dur-fast), color var(--dur-fast), box-shadow var(--dur-fast); }
.chip:active { background: var(--surface-2); }
.chip.lg { font-size: var(--text-md); }
.chip[aria-pressed="true"] { box-shadow: inset 0 0 0 1.5px var(--accent); background: var(--accent-soft); color: var(--accent-2); font-weight: 600; }

/* ---------------------------------------------------------------- formulários */
.field-label { font-size: var(--text-sm); color: var(--fg-2); }
.field { display: flex; flex-direction: column; gap: var(--space-2); border: none; padding: 0; margin: 0; min-width: 0; }
.input { min-height: 52px; border-radius: var(--radius-sm); border: 1px solid var(--line-control); background: var(--surface-3); color: var(--fg); padding: 0 var(--space-4); font-size: var(--text-md); width: 100%; transition: border-color var(--dur-fast); }
.input:focus { border-color: var(--accent); outline: none; }
.input[aria-invalid="true"] { border-color: var(--warn); }
textarea.input { padding: var(--space-3) var(--space-4); min-height: 52px; resize: none; }
.input::placeholder { color: var(--placeholder); }
.pass { position: relative; }
.pass .input { padding-right: 96px; }
.pass-toggle { position: absolute; right: var(--space-1); top: 50%; transform: translateY(-50%); min-height: 44px; padding: 0 var(--space-3); background: none; border: none; color: var(--fg-2); font-size: var(--text-xs); text-decoration: underline; text-underline-offset: .2em; }
.field-err { font-size: var(--text-xs); color: var(--warn); }
.field-err:empty { display: none; }
.stepper { display: flex; align-items: center; justify-content: space-between; border-radius: var(--radius-sm); box-shadow: inset 0 0 0 1px var(--line-control); padding: 1px; }
.stepper button { flex-shrink: 0; width: 44px; height: 44px; border: none; border-radius: var(--radius-sm); background: transparent; font-size: 20px; color: var(--fg-2); }
.stepper button:active, .counter button:active { background: var(--surface-2); }
.stepper output { font-size: var(--text-lg); font-weight: 600; font-variant-numeric: tabular-nums; }
.counter { display: flex; align-items: center; gap: var(--space-1); border-radius: var(--radius-sm); box-shadow: inset 0 0 0 1px var(--line-control); padding: 1px; }
.counter output { min-width: 28px; text-align: center; font-size: var(--text-lg); font-weight: 600; font-variant-numeric: tabular-nums; }
.counter button { width: 44px; height: 44px; border: none; border-radius: var(--radius-sm); background: transparent; font-size: 20px; color: var(--fg-2); }
.between { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.msg { border-radius: var(--radius-sm); padding: var(--space-3) var(--space-4); font-size: var(--text-sm); line-height: 1.5; background: var(--surface); color: var(--fg-2); }
.msg.warn { background: var(--warn-bg); box-shadow: inset 0 0 0 1px var(--warn-line); color: var(--warn); }
.efic { border-top: 1px solid var(--line); padding-top: var(--space-4); display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.efic .big { font-family: var(--font-display); font-size: var(--text-2xl); font-weight: 500; color: var(--good); font-variant-numeric: tabular-nums lining-nums; }
.efic-txt { display: flex; flex-direction: column; gap: 2px; }
.scale { display: flex; justify-content: space-between; font-size: var(--text-xs); color: var(--muted); }
.form { display: flex; flex-direction: column; gap: var(--space-6); }

/* ---------------------------------------------------------------- entrar */
/* A cena do horizonte ocupa o alto da tela, como no Início; a marca fica no pé da cena */
.login { display: flex; flex-direction: column; gap: var(--space-6); }
.login-art { position: relative; margin: calc((var(--space-6) + var(--safe-top)) * -1) calc(var(--pad-r) * -1) 0 calc(var(--pad-l) * -1); height: calc(232px + var(--safe-top)); display: flex; align-items: flex-end; padding: 0 var(--pad-r) var(--space-2) var(--pad-l); overflow: hidden; }
.login-art canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.login-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 45%, var(--bg) 100%); pointer-events: none; }
.login-brand { position: relative; z-index: 1; display: flex; align-items: center; gap: var(--space-3); }
.login-brand .logo { width: 200px; height: auto; display: block; }
.wordmark { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 500; }
.login-head { display: flex; flex-direction: column; gap: var(--space-3); }
.login-head .display { font-size: var(--text-3xl); text-wrap: balance; }
.login-method { margin: 0; font-size: var(--text-md); line-height: 1.5; color: var(--fg-2); }
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.login-foot { display: flex; flex-direction: column; gap: var(--space-3); padding-top: var(--space-4); border-top: 1px solid rgba(236, 229, 216, .08); }
.login-foot .fine { font-size: var(--text-sm); line-height: 1.5; color: var(--fg-2); }

/* ---------------------------------------------------------------- início: "esta noite" */
.tonight { position: relative; margin: calc((var(--space-6) + var(--safe-top)) * -1) calc(var(--pad-r) * -1) 0 calc(var(--pad-l) * -1); min-height: calc(248px + var(--safe-top)); display: flex; flex-direction: column; justify-content: flex-end; padding: calc(var(--space-8) + var(--safe-top)) var(--pad-r) var(--space-5) var(--pad-l); overflow: hidden; }
.tonight canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.tonight::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 35%, var(--bg) 100%); pointer-events: none; }
.tonight-txt { position: relative; z-index: 1; display: flex; flex-direction: column; gap: var(--space-2); text-shadow: 0 1px 12px var(--text-shadow); }
.tonight-date { font-size: var(--text-sm); color: var(--fg-2); }
.tonight .display { font-size: var(--text-3xl); }
.tonight-sub { font-size: var(--text-sm); font-weight: 500; color: var(--accent-2); }
/* Barra das 6 semanas: as que passaram cheias, a atual até o dia em que está (--p vem do app.js) */
.weeks { display: flex; gap: var(--space-1); max-width: 280px; }
.weeks i { flex: 1; height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--accent) var(--p), rgba(238, 241, 246, .18) var(--p)); }
.ritual { display: flex; flex-direction: column; gap: var(--space-4); }
/* Cartão "Esta noite": capa, título, uma frase e um botão só */
.tn-card { padding: 0; gap: 0; overflow: hidden; }
.tn-cover { position: relative; aspect-ratio: 16 / 9; max-height: 200px; width: 100%; background: var(--bg-deep); }
/* Ilustração que preenche a capa; o assunto fica à direita, então o corte puxa para lá */
.pic { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.tn-cover .pic, .wk-cover .pic { object-position: 72% 50%; }
.tn-chip { position: absolute; left: var(--space-3); top: var(--space-3); padding: var(--space-1) 10px; border-radius: var(--radius-pill); background: var(--scrim-55); color: var(--fg); font-size: var(--text-xs); font-weight: 500; }
.tn-body { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-4) var(--space-5) var(--space-5); }
.tn-txt { display: flex; flex-direction: column; gap: var(--space-1); }
.tn-title { font-size: var(--text-lg); font-weight: 500; line-height: 1.25; }
/* Os outros passos do ritual, numa lista curta abaixo do cartão */
.tn-list { list-style: none; padding: 0; display: flex; flex-direction: column; }
.tn-list > li + li { border-top: 1px solid var(--line); }
.tn-list .row { padding: var(--space-2) 0; min-height: 60px; }
.tn-ico { width: 40px; height: 40px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--surface); color: var(--moon); }
.tn-list .is-done .tn-ico { background: var(--good-bg); color: var(--good); }
.mark { width: 40px; height: 40px; border-radius: var(--radius-pill); display: flex; align-items: center; justify-content: center; flex-shrink: 0; box-shadow: inset 0 0 0 1px var(--line-control); color: var(--fg-2); font-weight: 600; font-variant-numeric: tabular-nums; background: var(--bg); }
.is-current .mark { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.is-done .mark { background: var(--good-bg); color: var(--good); box-shadow: none; }
.is-done .item-title { color: var(--fg-2); }
.last-night .fx-ring { flex-shrink: 0; }
.dev-link { color: var(--muted); }

/* ---------------------------------------------------------------- trilha */
/* Semana aberta: capa com o nome por cima e as aulas embaixo */
.week { padding: 0; gap: 0; overflow: hidden; }
.week.on { box-shadow: inset 0 0 0 1px var(--line-control); }
.wk-cover { position: relative; height: 128px; background: var(--bg-deep); }
.wk-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 30%, var(--scrim-55)); }
.wk-cover-txt { position: absolute; z-index: 1; left: var(--space-4); right: var(--space-4); bottom: var(--space-3); display: flex; flex-direction: column; gap: 2px; text-shadow: 0 1px 10px var(--text-shadow); }
.wk-title { font-family: var(--font-display); font-size: var(--text-xl); font-weight: 500; line-height: 1.2; }
.wk-state { display: inline-flex; align-items: center; gap: var(--space-1); font-size: var(--text-xs); color: var(--fg-2); }
.week.is-done .wk-state { color: var(--good); }
.week .tn-chip { z-index: 1; }
details.week > summary { display: block; list-style: none; cursor: pointer; height: 88px; }
details.week > summary::-webkit-details-marker { display: none; }
details.week > summary .chev { position: absolute; z-index: 1; right: var(--space-4); bottom: var(--space-3); color: var(--fg); transition: transform var(--dur) var(--ease); }
details.week[open] > summary .chev { transform: rotate(180deg); }
details.week .wk-cover-txt { right: calc(var(--space-4) + 28px); }
details.week .tn-chip { display: none; }
.week .list-lines { padding: var(--space-1) var(--space-4) var(--space-2); }
/* Aula feita: apagada, sem chamar o olho */
.list-lines .row.is-done .lesson-t { color: var(--muted); }
.list-lines .row.is-done .lesson-ico { color: var(--muted); }
.wk-thumb { position: relative; width: 48px; height: 40px; border-radius: var(--radius-sm); overflow: hidden; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--fg-2); }
.wk-thumb .pic { opacity: .45; object-position: 72% 50%; }
.wk-thumb svg { position: relative; }
.week-locked { border-top: 1px solid var(--line-soft); }
.week-locked > summary { list-style: none; display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4) 0; min-height: 64px; cursor: pointer; }
.week-locked > summary::-webkit-details-marker { display: none; }
.week-locked > summary .chev { transition: transform var(--dur) var(--ease); }
.week-locked[open] > summary .chev { transform: rotate(180deg); }
.week-locked .item-title { color: var(--fg-2); }
.week-locked .list-lines { padding-bottom: var(--space-3); }
.week-locked .lesson-t, .week-locked .lesson-ico { color: var(--muted); }
.locked-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) 0; min-height: 48px; }

/* ---------------------------------------------------------------- aula */
/* leitor de guias: coluna estreita, corpo um pouco maior e espaço generoso entre blocos */
.guia { display: flex; flex-direction: column; gap: var(--space-4); max-width: 38em; color: var(--fg-2); font-size: var(--text-md); line-height: 1.6; }
.guia p { margin: 0; }
.guia-h { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 500; line-height: 1.25; color: var(--fg); margin: var(--space-4) 0 0; }
.guia-lista { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: var(--space-2); }
.guia-lista li::marker { color: var(--accent-2); }
.guia-destaque { margin: 0; font-family: var(--font-display); font-size: var(--text-lg); line-height: 1.35; color: var(--fg); background: var(--surface); border-left: 3px solid var(--accent); border-radius: var(--radius-sm); padding: var(--space-3) var(--space-4); }
.aula-video { width: 100%; aspect-ratio: 16 / 9; display: block; border-radius: var(--radius-md); background: var(--surface); }
.soon { border-radius: var(--radius-md); overflow: hidden; background: var(--surface); }
.soon canvas { width: 100%; aspect-ratio: 16 / 7; display: block; }
.soon-txt { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-4) var(--space-5) var(--space-5); }
.soon-txt .section-title { display: flex; align-items: center; gap: var(--space-2); }
.soon-txt svg { color: var(--accent-2); flex-shrink: 0; }
.soon p { color: var(--fg-2); font-size: var(--text-sm); max-width: 40ch; }
.done-line { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: 52px; padding: 0 var(--space-4); border-radius: var(--radius-sm); background: var(--good-bg); color: var(--good); font-weight: 600; }
.done-line span { display: inline-flex; align-items: center; gap: var(--space-2); }
.done-line .link-btn { color: var(--fg-2); align-self: center; }

/* ---------------------------------------------------------------- player */
.player-view { background: var(--bg-deep); margin: calc((var(--space-6) + var(--safe-top)) * -1) calc(var(--pad-r) * -1) calc((var(--space-8) + var(--safe-bottom)) * -1) calc(var(--pad-l) * -1); padding: calc(var(--space-4) + var(--safe-top)) var(--pad-r) calc(var(--space-6) + var(--safe-bottom)) var(--pad-l); gap: var(--space-5); display: flex; flex-direction: column; flex: 1; }
/* No iPhone, o puxão da rolagem mostra o fundo da página: no player ele é o mesmo do painel */
html:has(.player-view), html:has(.player-view) body { background: var(--bg-deep); }
/* Barra do topo por cima da cena: os botões ganham um véu para ler sobre qualquer paisagem */
.player-top { position: absolute; z-index: 2; top: calc(var(--space-3) + var(--safe-top)); left: var(--pad-l); right: var(--pad-r); display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.player-top .back { align-self: auto; background: var(--scrim-55); color: var(--fg); border-radius: var(--radius-pill); padding: 0 var(--space-4) 0 var(--space-3); }
.player-top .end-btn { background: var(--scrim-55); color: var(--fg); }
.rings { align-self: center; width: 220px; height: 220px; border-radius: 50%; border: 1px solid var(--line-soft); display: flex; align-items: center; justify-content: center; }
.rings > div { width: 170px; height: 170px; border-radius: 50%; border: 1px solid var(--line-strong); display: flex; align-items: center; justify-content: center; }
.core { width: 120px; height: 120px; border-radius: 50%; background: var(--core); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.is-breath .core { animation: breathe 19s linear infinite; animation-delay: var(--delay, 0s); animation-play-state: paused; }
.player-view[data-on="1"] .is-breath .core { animation-play-state: running; }
@keyframes breathe { 0% { transform: scale(0.78); } 21% { transform: scale(1); } 58% { transform: scale(1); } 100% { transform: scale(0.78); } }
/* A cena ocupa o alto da tela, de borda a borda, e o título fica no pé dela */
.stage { position: relative; height: min(56svh, 520px); min-height: 340px; margin: calc((var(--space-4) + var(--safe-top)) * -1) calc(var(--pad-r) * -1) 0 calc(var(--pad-l) * -1); overflow: hidden; background: var(--bg-deep); flex-shrink: 0; }
.stage::after { content: ""; position: absolute; inset: 40% 0 0; z-index: 1; background: linear-gradient(180deg, transparent, var(--bg-deep)); pointer-events: none; }
.stage canvas, .stage video { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage video { object-fit: cover; object-position: 50% 30%; }
.stage canvas[hidden], .stage video[hidden], .stage.has-vid .rays { display: none; }
.stage .rings { position: absolute; inset: 0; margin: auto; transform: translateY(-16px); width: 196px; height: 196px; background: var(--scrim-35); }
.stage .rings > div { width: 150px; height: 150px; }
.stage .core { width: 104px; height: 104px; background: var(--core-glass); }
.stage .guide { inset: calc(64px + var(--safe-top)) 0 104px; background: radial-gradient(circle at 50% 50%, var(--scrim-55), transparent 72%); }
.stage-txt { position: absolute; z-index: 2; left: var(--pad-l); right: var(--pad-r); bottom: var(--space-5); display: flex; flex-direction: column; gap: var(--space-1); text-shadow: 0 1px 12px var(--text-shadow); }
.stage-txt .title-sm { font-size: var(--text-2xl); line-height: 1.15; }
.stage-sub { font-size: var(--text-sm); color: var(--fg-2); }
.scene-pick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-3) var(--space-2); }
.scene-opt { display: flex; flex-direction: column; align-items: stretch; gap: var(--space-2); background: none; border: none; padding: 0; color: var(--fg-2); font-size: var(--text-xs); line-height: 1.2; text-align: center; min-width: 0; }
.scene-opt .scene-thumb { position: static; height: auto; }
.scene-opt .scene-thumb, .scene-opt .none-thumb { width: 100%; aspect-ratio: 4 / 3; border-radius: var(--radius-sm); display: block; border: 2px solid var(--line-soft); background: var(--bg-deep); box-sizing: border-box; transition: border-color var(--dur-fast); }
.scene-opt .none-thumb { display: flex; align-items: center; justify-content: center; color: var(--muted); background: var(--surface); }
.scene-opt:active .scene-thumb, .scene-opt:active .none-thumb { border-color: var(--line-control); }
.scene-opt-name { min-height: 2.4em; overflow-wrap: anywhere; }
.scene-opt[aria-pressed="true"] { color: var(--accent-2); font-weight: 600; }
.scene-opt[aria-pressed="true"] .scene-thumb, .scene-opt[aria-pressed="true"] .none-thumb { border-color: var(--accent); }
.player-msg { font-size: var(--text-sm); color: var(--warn); text-align: center; }
.player-msg:empty { display: none; }

/* ---------------------------------------------------------------- ouvir */
/* Filtros por momento: rolam para o lado no celular, sem quebrar linha */
.filter-chips { display: flex; gap: var(--space-2); overflow-x: auto; scrollbar-width: none; margin: 0 calc(var(--pad-r) * -1) 0 calc(var(--pad-l) * -1); padding: 2px var(--pad-r) 2px var(--pad-l); scroll-padding-inline: var(--pad-l); }
.filter-chips::-webkit-scrollbar { display: none; }
.filter-chips .chip { flex: none; padding: 0 var(--space-4); }
/* Guiados: capas altas numa fileira que rola para o lado e para em cada capa */
.rail { display: flex; gap: var(--space-3); overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; margin: 0 calc(var(--pad-r) * -1) 0 calc(var(--pad-l) * -1); padding: 0 var(--pad-r) var(--space-1) var(--pad-l); scroll-padding-inline: var(--pad-l); }
.rail::-webkit-scrollbar { display: none; }
.g-tile { flex: none; width: 148px; display: flex; flex-direction: column; gap: 2px; padding: 0; border: none; background: none; color: var(--fg); text-align: left; scroll-snap-align: start; }
.g-tile .g-tile-art { position: relative; display: block; overflow: hidden; background: var(--bg-deep); width: 100%; height: 184px; border-radius: var(--radius-md); margin-bottom: var(--space-2); }
.g-tile:active .g-tile-art { opacity: .85; }
.g-tile[aria-current="true"] .g-tile-art { box-shadow: inset 0 0 0 1.5px var(--accent); }
.g-tile[aria-current="true"] .item-sub { color: var(--accent-2); }
/* Paisagens: grade de 2 colunas com o nome sobre a cena */
.scape-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.scape { position: relative; height: 104px; padding: 0; border: none; border-radius: var(--radius-md); overflow: hidden; background: var(--bg-deep); color: var(--fg); text-align: left; }
.scape::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 35%, var(--scrim-55)); }
.scape-name { position: absolute; z-index: 1; left: var(--space-3); right: var(--space-3); bottom: var(--space-2); display: flex; flex-direction: column; font-size: var(--text-sm); font-weight: 500; line-height: 1.25; text-shadow: 0 1px 8px var(--text-shadow); }
.scape-name small { font-size: var(--text-xs); font-weight: 500; color: var(--accent-2); }
.scape:active { opacity: .85; }
.scape[aria-current="true"] { box-shadow: inset 0 0 0 1.5px var(--accent); }
.ouvir-off { display: inline-flex; align-items: center; gap: var(--space-2); }
.chev { color: var(--fg-2); display: flex; flex-shrink: 0; transition: transform var(--dur) var(--ease); }
.cue-box { display: flex; flex-direction: column; gap: var(--space-1); min-height: 44px; }
/* Nos guiados, o que fazer agora vem num cartão próprio, logo abaixo da cena */
.cue-box.is-card { background: var(--surface); border-radius: var(--radius-md); padding: var(--space-4) var(--space-5); }
.cue-k { font-size: var(--text-xs); color: var(--muted); text-align: center; }
.cue-sub { text-align: center; font-size: var(--text-sm); color: var(--fg-2); min-height: 20px; font-variant-numeric: tabular-nums; }

/* Guias visuais: luz quente, sem brilho colorido e sem tremor */
.guide { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; background: radial-gradient(circle at 50% 50%, var(--scrim-55), var(--scrim-12) 72%); }
.pmr { width: 156px; height: 156px; border-radius: 50%; border: 1px solid var(--pmr-ring); display: flex; align-items: center; justify-content: center; }
.pmr span { width: 100px; height: 100px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, var(--pmr-hi), var(--pmr-mid) 60%, var(--pmr-lo)); opacity: 0.8; transform: scale(0.9); transition: transform 1.2s ease, opacity 1.2s ease; }
.guide[data-fase="contraia"] .pmr span { transform: scale(0.64); opacity: 1; transition-duration: 6.5s; }
.guide[data-fase="solte"] .pmr span { transform: scale(1.14); opacity: 0.6; transition-duration: 2.4s; }
.guide[data-fase="descanso"] .pmr span, .guide[data-fase="fim"] .pmr span { transform: scale(1); opacity: 0.75; transition-duration: 5s; }
.body-wrap { position: relative; height: 86%; aspect-ratio: 60 / 160; }
.body-wrap svg { position: absolute; inset: 0; width: 100%; height: 100%; }
/* A faixa sobe por transform: --pos vai de 0 (pés) a 1 (cabeça); 625% = altura do corpo em alturas da faixa */
.scan-band { position: absolute; left: -40%; right: -40%; height: 16%; bottom: 0; transform: translateY(calc(50% - var(--pos, 0) * 625%)); border-radius: 50%; background: radial-gradient(ellipse at center, var(--scan-glow), var(--scan-clear) 70%); mix-blend-mode: screen; transition: transform 3s ease, opacity 2s; }
.guide[data-fase="intro"] .scan-band { opacity: 0; }
.guide[data-fase="todo"] .scan-band, .guide[data-fase="fim"] .scan-band { transform: translateY(-262.5%) scaleY(7.2); opacity: .45; }
.word { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); text-align: center; padding: 0 var(--space-4); }
.word-letter { font-size: var(--text-sm); color: var(--accent-2); min-height: 20px; font-weight: 500; }
.word-big { font-family: var(--font-display); font-size: var(--text-3xl); font-weight: 400; color: var(--fg); text-shadow: 0 2px 18px var(--text-shadow); opacity: 0; min-height: 52px; }
.word-big.in { animation: word-in 2.4s ease forwards; }
@keyframes word-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.cue { text-align: center; font-family: var(--font-display); font-size: var(--text-lg); color: var(--accent-2); min-height: 26px; }
.center { text-align: center; display: flex; flex-direction: column; gap: var(--space-2); }
.seek { width: 100%; accent-color: var(--accent); height: 28px; margin: 0; }
.times { display: flex; justify-content: space-between; font-size: var(--text-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.controls { display: flex; align-items: center; justify-content: center; gap: var(--space-8); }
.play { position: relative; width: 76px; height: 76px; border-radius: var(--radius-pill); border: none; background: var(--accent); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; transition: background var(--dur-fast), transform var(--dur-fast); }
.play:active { background: var(--accent-press); transform: scale(.96); }
.play.is-loading::after, .icon-btn.is-loading::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid transparent; border-top-color: var(--accent-2); animation: spin 1s linear infinite; }
.icon-btn.is-loading { position: relative; }
@keyframes spin { to { transform: rotate(360deg); } }
.skip { width: 52px; height: 52px; }
.timer-left { font-size: var(--text-xs); color: var(--accent-2); min-height: 18px; font-variant-numeric: tabular-nums; text-align: center; }
/* Som de fundo, timer e download: três botões iguais, cada um abre sua janela */
.tools { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: var(--space-2); }
.tool { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 84px; padding: var(--space-3) var(--space-2); border: none; border-radius: var(--radius-md); background: var(--surface); color: var(--fg); text-align: center; transition: background var(--dur-fast); }
.tool:active { background: var(--surface-2); }
.tool-ico { display: flex; color: var(--moon); margin-bottom: var(--space-1); }
.tool-k { font-size: var(--text-xs); color: var(--muted); }
.tool-v { font-size: var(--text-sm); font-weight: 500; overflow-wrap: anywhere; }
.tag { align-self: center; font-size: var(--text-xs); color: var(--muted); }

/* ---------------------------------------------------------------- progresso */
/* Painel: um número em destaque, o gráfico da eficiência e números de apoio. O luar é a única cor dos dados. */
.dash { gap: var(--space-2); }
.dash-top { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.dash-l { margin: 0; font-size: var(--text-sm); font-weight: 500; color: var(--fg-2); }
.seg { display: inline-flex; flex-shrink: 0; padding: 2px; border-radius: var(--radius-pill); background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line); }
.seg button { min-height: 36px; padding: 0 var(--space-3); border: none; border-radius: var(--radius-pill); background: none; color: var(--muted); font-size: var(--text-xs); transition: background var(--dur-fast), color var(--dur-fast); }
.seg button[aria-pressed="true"] { background: var(--surface-2); color: var(--fg); box-shadow: inset 0 0 0 1px var(--line-control); }
.dash-hero { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2) var(--space-3); margin-top: var(--space-2); }
.hero-n { font-size: 56px; font-weight: 500; line-height: 1; letter-spacing: -0.02em; color: var(--fg); }
.hero-n small { font-size: 28px; font-weight: 400; letter-spacing: 0; color: var(--fg-2); margin-left: 2px; }
.hero-n.is-none { color: var(--muted); }
.dpill { font-size: var(--text-xs); color: var(--fg-2); background: var(--surface-2); border-radius: var(--radius-pill); padding: 4px 10px; }
.dpill.good { color: var(--good); background: var(--good-bg); }
.dash-sub { margin: 0; font-size: var(--text-xs); color: var(--muted); }

/* Gráfico de linha: grade em fio, rótulos na margem direita, dica ao tocar */
.ch { position: relative; margin-top: var(--space-4); outline: none; border-radius: var(--radius-sm); }
.ch:focus-visible { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.ch-plot { position: relative; height: 168px; margin: var(--space-2) 48px 0 0; touch-action: pan-y; cursor: crosshair; }
.ch-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.ch-line { fill: none; stroke: var(--moon); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.ch-area { fill: url(#chFill); }
.ch-f0 { stop-color: var(--moon); stop-opacity: .18; }
.ch-f1 { stop-color: var(--moon); stop-opacity: 0; }
.ch-grid { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line-soft); pointer-events: none; }
.ch-grid.is-meta { border-top-color: var(--line-control); }
.ch-grid span { position: absolute; left: calc(100% + var(--space-2)); top: -8px; font-size: 12px; line-height: 16px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ch-grid.is-meta span { color: var(--fg-2); }
.ch-dot { position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--moon); box-shadow: 0 0 0 2px var(--surface); pointer-events: none; }
.ch-hot { width: 12px; height: 12px; margin: -6px 0 0 -6px; background: var(--accent); }
.ch-cross { position: absolute; top: 0; bottom: 0; width: 1px; margin-left: -0.5px; background: var(--line-control); pointer-events: none; }
.ch-hot, .ch-cross { opacity: 0; transition: opacity var(--dur-fast); }
.ch.is-hover .ch-hot, .ch.is-hover .ch-cross { opacity: 1; }
.ch-x { position: relative; height: 18px; margin: var(--space-2) 48px 0 0; }
.ch-x span { position: absolute; top: 0; transform: translateX(-50%); font-size: 12px; color: var(--muted); white-space: nowrap; }
.ch-x span.cur { color: var(--fg); font-weight: 500; }
.ch-x span.off { opacity: .5; }
.ch-tip { position: absolute; left: 0; top: 0; z-index: 2; display: none; flex-direction: column; gap: 2px; padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); background: var(--surface-2); box-shadow: 0 0 0 1px var(--line-control), 0 8px 24px var(--scrim-55); font-size: var(--text-xs); color: var(--fg-2); white-space: nowrap; pointer-events: none; }
.ch.is-hover .ch-tip { display: flex; }
.ch-tip b { color: var(--fg); font-weight: 600; }
.ch-tip span { color: var(--muted); }
.ch-tip .ch-tip-v { color: var(--fg-2); }
.ch-empty { margin: var(--space-4) 0; }

/* Números de apoio e andamento do programa */
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); }
.kpi { background: var(--surface); border-radius: var(--radius-md); padding: var(--space-4) var(--space-3); display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.kpi-l { font-size: 13px; color: var(--muted); }
.kpi-v { font-size: var(--text-xl); font-weight: 500; line-height: 1.15; color: var(--fg); white-space: nowrap; }
.kpi-v small { font-size: 13px; font-weight: 400; color: var(--muted); margin-left: 3px; }
.kpi-d { min-height: 18px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.kpi-d.good { color: var(--good); }
.kpis-note { margin: calc(var(--space-2) * -1) 0 0; font-size: 13px; color: var(--muted); }
.prog-card { gap: var(--space-4); }
.meter-row { display: flex; flex-direction: column; gap: var(--space-2); color: inherit; text-decoration: none; }
.meter-row:active .bar { background: var(--line); }
@media (hover: hover) and (pointer: fine) { .meter-row:hover .item-title { color: var(--accent-2); } }
.empty { align-items: flex-start; padding: var(--space-6) var(--space-5); }

/* ---------------------------------------------------------------- ajustes */
.tonight-set { position: absolute; z-index: 2; top: calc(var(--space-3) + var(--safe-top)); right: calc(var(--pad-r) - var(--space-2)); color: var(--fg); background: var(--scrim-35); }
.tonight-set:active { background: var(--scrim-55); }
#nav .nav-extra { display: none; }
.profile { gap: var(--space-4); }
.profile-id { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.profile-mail { overflow-wrap: anywhere; }
.avatar { width: 48px; height: 48px; flex-shrink: 0; border-radius: var(--radius-pill); background: var(--moon-soft); color: var(--moon); display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-size: var(--text-xl); font-weight: 500; }
.set-list { list-style: none; padding: 0; margin: 0; background: var(--surface); border-radius: var(--radius-md); }
.set-list > li + li { border-top: 1px solid var(--line-soft); }
.set-list .set-row { min-height: 56px; padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); }
.set-list .set-row:focus-visible { outline-offset: -2px; }
.set-list .set-row:active { background: var(--surface-2); }
.set-ico { display: flex; color: var(--moon); flex-shrink: 0; }
.set-tail { display: flex; color: var(--muted); flex-shrink: 0; }
.danger-zone { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); border-radius: var(--radius-md); background: var(--danger-bg); box-shadow: inset 0 0 0 1px var(--danger-line); }
.danger-zone .section-title { color: var(--danger); }
.danger-zone p { font-size: var(--text-sm); color: var(--fg-2); }

/* ---------------------------------------------------------------- diário: qual noite */
.night-pick .input[type="date"] { -webkit-appearance: none; appearance: none; display: flex; align-items: center; line-height: 50px; text-align: left; }
.night-pick .input::-webkit-date-and-time-value { text-align: left; }
.night-had { color: var(--moon); font-weight: 500; }

/* ---------------------------------------------------------------- progresso: noites */
.hist { background: var(--surface); border-radius: var(--radius-md); overflow: hidden; }
.hist-head { min-height: 64px; padding: var(--space-3) var(--space-4); }
.hist-head:active { background: var(--surface-2); }
.hist-head:focus-visible { outline-offset: -2px; }
.hist-head[aria-expanded="true"] .chev { transform: rotate(180deg); }
.hist .set-list { border-radius: 0; border-top: 1px solid var(--line-soft); }
.hist .set-list .set-row { border-radius: 0; }
.night-efic { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 500; color: var(--fg-2); font-variant-numeric: tabular-nums lining-nums; }
.night-efic.hi { color: var(--good); }

/* ---------------------------------------------------------------- boas-vindas */
.ob { display: flex; flex-direction: column; gap: var(--space-5); min-height: 100%; }
/* Cena de borda a borda, do topo da tela (com a área do relógio) até o texto, sem linha de corte */
.ob-art { position: relative; overflow: hidden; margin: calc((var(--space-6) + var(--safe-top)) * -1) calc(var(--pad-r) * -1) 0 calc(var(--pad-l) * -1); height: calc(280px + var(--safe-top)); }
.ob-art canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ob-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 72%, var(--bg) 100%); pointer-events: none; }
.ob-top { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; min-height: 44px; padding: calc(var(--space-3) + var(--safe-top)) var(--pad-r) 0 var(--pad-l); text-shadow: 0 1px 10px var(--text-shadow); }
.ob-top .back { color: var(--fg); }
.ob-skip { align-self: center; color: var(--fg); padding: 0 var(--space-2); }
.ob-txt { display: flex; flex-direction: column; gap: var(--space-4); }
.ob-txt p { color: var(--fg-2); max-width: 40ch; }
.ob-txt .btn, .ob-txt form { margin-top: var(--space-2); }
.ob-dots { display: flex; gap: 6px; }
.ob-dots i { width: 24px; height: 4px; border-radius: 2px; background: var(--line-control); }
.ob-dots i.done { background: var(--moon); }
.ob-dots i.on { background: var(--accent); }

/* ---------------------------------------------------------------- janelas (dialog) */
.sheet { border: none; padding: 0; margin: auto auto 0; width: 100%; max-width: 480px; max-height: calc(100% - var(--space-8)); overflow-y: auto; background: var(--surface); color: var(--fg); border-radius: var(--radius-md) var(--radius-md) 0 0; box-shadow: inset 0 1px 0 var(--line); }
.sheet.is-danger { box-shadow: inset 0 2px 0 var(--danger-solid); }
/* O fundo da janela não herda as variáveis de :root em todos os navegadores: cor escrita direto (= --scrim-80) */
.sheet::backdrop { background: rgba(10, 13, 24, 0.8); }
.sheet[open] { animation: sheet-in var(--dur) var(--ease); }
@keyframes sheet-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.sheet-body { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-6) var(--space-5) calc(var(--space-6) + var(--safe-bottom)); }
.sheet-body > p { font-size: var(--text-sm); color: var(--fg-2); }
.sheet .msg.warn { font-size: var(--text-sm); }
.sheet-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); margin-top: var(--space-2); }
.bullets { margin: 0; padding-left: var(--space-5); display: flex; flex-direction: column; gap: var(--space-1); font-size: var(--text-sm); color: var(--fg-2); }
@media (min-width: 600px) {
  .sheet { margin: auto; max-width: 440px; border-radius: var(--radius-md); }
  .sheet-body { padding-bottom: var(--space-6); }
}

/* ---------------------------------------------------------------- termos e privacidade */
.doc { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: var(--space-6); padding: calc(var(--space-6) + var(--safe-top)) var(--pad-r) calc(var(--space-10) + var(--safe-bottom)) var(--pad-l); }
.doc-body { display: flex; flex-direction: column; gap: var(--space-4); color: var(--fg-2); max-width: 62ch; }

/* ---------------------------------------------------------------- modo teste */
.steps { margin: 0; padding-left: var(--space-5); display: flex; flex-direction: column; gap: var(--space-2); font-size: var(--text-sm); color: var(--fg-2); }
.log { font-family: var(--font-mono); font-size: 12px; line-height: 1.5; color: var(--fg-2); background: var(--bg-deep); border-radius: var(--radius-sm); padding: var(--space-3); max-height: 260px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.btn-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
.btn-row .btn { white-space: normal; line-height: 1.2; padding: var(--space-2); }

/* ---------------------------------------------------------------- aviso rápido */
#toast { position: absolute; left: var(--space-3); right: var(--space-3); bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 5; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line), 0 8px 24px rgba(0, 0, 0, .35); border-radius: var(--radius-sm); padding: var(--space-3) var(--space-4); font-size: var(--text-sm); opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .2s, transform .2s var(--ease); }
#toast.show { opacity: 1; transform: none; }

/* ---------------------------------------------------------------- sem internet */
/* Faixa acima da barra de navegação enquanto a conexão estiver fora */
.net { flex-shrink: 0; padding: var(--space-2) var(--pad-r) var(--space-2) var(--pad-l); background: var(--surface-2); border-top: 1px solid var(--line); color: var(--fg-2); font-size: var(--text-xs); line-height: 1.4; }
.net[hidden] { display: none; }
#app.no-nav .net { padding-bottom: calc(var(--space-2) + var(--safe-bottom)); }
.off-list { list-style: none; margin: 0; padding: 0; }
.off-row { display: flex; align-items: center; gap: var(--space-3); min-height: 64px; padding: var(--space-2) 0; border-bottom: 1px solid var(--line-soft); }
.off-list > .off-row:last-child { border-bottom: none; }
.off-row .grow { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.off-row .off-st { font-variant-numeric: tabular-nums; }
.off-row.is-saved .off-st { color: var(--good); }
.off-row.is-saved .off-st::before { content: "✓ "; }
.off-bar { margin-top: var(--space-1); }
.off-bar[hidden] { display: none; }
.off-btn { width: auto; flex-shrink: 0; min-width: 96px; }
.player-view .off-list, .aula-off { background: var(--surface); border-radius: var(--radius-md); padding: 0 var(--space-4); }

/* ---------------------------------------------------------------- avisos no Início e no Progresso */
.card.notice { flex-direction: row; align-items: center; gap: var(--space-3); color: var(--fg); text-decoration: none; border: none; width: 100%; text-align: left; box-shadow: inset 0 0 0 1px var(--line-control); min-height: 64px; }
.card.notice .grow { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.card.notice:active { background: var(--surface-2); }
.card.notice .set-ico { color: var(--accent-2); }

/* ---------------------------------------------------------------- questionário */
.q { display: flex; flex-direction: column; gap: var(--space-5); }
.q > p { color: var(--fg-2); max-width: 40ch; }
.q-top { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: 44px; }
.q-opts { display: flex; flex-direction: column; gap: var(--space-2); }
.q-opt { position: relative; display: flex; align-items: center; gap: var(--space-3); min-height: 52px; padding: var(--space-2) var(--space-4); border-radius: var(--radius-sm); box-shadow: inset 0 0 0 1px var(--line-control); color: var(--fg-2); cursor: pointer; transition: background var(--dur-fast), box-shadow var(--dur-fast); }
.q-opt input { appearance: none; -webkit-appearance: none; flex-shrink: 0; width: 22px; height: 22px; margin: 0; border-radius: 50%; border: 2px solid var(--line-strong); background: transparent; display: grid; place-content: center; cursor: pointer; }
.q-opt input::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); transform: scale(0); transition: transform var(--dur-fast); }
.q-opt input:checked { border-color: var(--accent); }
.q-opt input:checked::before { transform: scale(1); }
.q-opt input:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; }
.q-opt:has(input:checked) { box-shadow: inset 0 0 0 1.5px var(--accent); background: var(--accent-soft); color: var(--accent-2); font-weight: 600; }
.q-opt:active { background: var(--surface-2); }

/* antes e depois */
.cmp-sum { font-family: var(--font-display); font-size: var(--text-lg); line-height: 1.3; color: var(--fg); }
.cmp { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.cmp > li { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-3) 0; border-top: 1px solid var(--line-soft); }
.cmp .item-title { font-size: var(--text-sm); font-weight: 600; }
.cmp-row { display: grid; grid-template-columns: 52px minmax(0, 1fr); column-gap: var(--space-3); row-gap: 2px; align-items: center; }
.cmp-k { font-size: var(--text-xs); color: var(--muted); grid-row: span 2; align-self: start; }
.cmp-track { height: 8px; margin-top: 6px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.cmp-track > i { display: block; height: 100%; border-radius: 4px; }
.cmp-track.antes > i { background: var(--bar-lo); }
.cmp-track.agora > i { background: var(--moon); }
.cmp-v { font-size: var(--text-xs); color: var(--fg-2); }
.cmp-tag { flex-shrink: 0; font-size: var(--text-xs); color: var(--fg-2); padding: 2px var(--space-2); border-radius: var(--radius-pill); box-shadow: inset 0 0 0 1px var(--line-control); }
.cmp-tag.up { color: var(--good); background: var(--good-bg); box-shadow: none; }
.cmp-legend { display: flex; gap: var(--space-4); font-size: var(--text-xs); color: var(--muted); }
.cmp-legend i { display: inline-block; width: 14px; height: 8px; border-radius: 4px; margin-right: 6px; vertical-align: 1px; }
.cmp-legend i.antes { background: var(--bar-lo); }
.cmp-legend i.agora { background: var(--moon); }

/* ---------------------------------------------------------------- fim do programa */
.fim-art { position: relative; overflow: hidden; margin: calc((var(--space-6) + var(--safe-top)) * -1) calc(var(--pad-r) * -1) calc(var(--space-6) * -1) calc(var(--pad-l) * -1); height: calc(220px + var(--safe-top)); }
.fim-art canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.fim-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 60%, var(--bg) 100%); pointer-events: none; }
.tile.span2 { grid-column: 1 / -1; }
.fim-arrow { color: var(--muted); font-family: var(--font-body); font-size: var(--text-lg); }
.fim-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.fim-steps > li { display: flex; gap: var(--space-3); align-items: flex-start; background: var(--surface); border-radius: var(--radius-md); padding: var(--space-4); }
.fim-steps .set-ico { padding-top: 2px; }
.fim-steps .grow { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.fim-steps .btn { align-self: flex-start; width: auto; margin-top: var(--space-1); }
.fim-favs { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.fim-favs .btn { margin-top: 0; }

/* Telas bem estreitas: os dois horários do diário ficam um embaixo do outro */
@media (max-width: 359px) {
  .form .grid2 { grid-template-columns: minmax(0, 1fr); }
  /* Telas bem estreitas: o botão de encerrar cabe numa linha ao lado do Voltar */
  .player-top .end-btn { padding: 0 var(--space-3); font-size: var(--text-xs); white-space: nowrap; }
  .player-top .back { padding-right: var(--space-3); }
}

/* ---------------------------------------------------------------- computador */
@media (min-width: 900px) {
  /* Com espaço de sobra, a fileira de guiados vira grade e os filtros cabem numa linha */
  .rail, .filter-chips { margin: 0; padding-left: 0; padding-right: 0; overflow: visible; }
  .rail { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--space-4) var(--space-3); }
  .g-tile { width: auto; }
  :root { --pad-l: var(--space-5); --pad-r: var(--space-5); }
  body { background: var(--bg-deep); }
  #app { max-width: 980px; display: grid; grid-template-columns: 220px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto auto; grid-template-areas: "nav view" "nav net" "nav mini"; background: var(--bg); border-left: 1px solid var(--line-soft); border-right: 1px solid var(--line-soft); }
  #app.no-nav { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto auto; grid-template-areas: "view" "net" "mini"; }
  .net { grid-area: net; padding: var(--space-2) max(var(--space-8), calc((100% - 560px) / 2)); }
  #view, #app.no-nav #view { grid-area: view; padding: var(--space-10) max(var(--space-8), calc((100% - 560px) / 2)) var(--space-10); }
  #mini { grid-area: mini; }
  .mini { margin: 0; padding: var(--space-3) max(var(--space-8), calc((100% - 560px) / 2)); }
  #nav { grid-area: nav; flex-direction: column; justify-content: flex-start; gap: var(--space-1); border-top: none; border-right: 1px solid var(--line-soft); margin: 0; padding: var(--space-8) var(--space-3); }
  #nav a { flex-direction: row; justify-content: flex-start; gap: var(--space-3); min-height: 44px; padding: 0 var(--space-3); font-size: var(--text-sm); }
  #nav a[aria-current="page"] { background: var(--surface); }
  #nav a[aria-current="page"]::before { top: 25%; bottom: 25%; left: 0; right: auto; width: 2px; height: auto; }
  #nav a:hover { color: var(--fg); }
  .nav-brand { display: flex; align-items: center; gap: var(--space-3); padding: 0 var(--space-3) var(--space-6); font-family: var(--font-display); font-size: var(--text-lg); color: var(--fg); }
  .nav-brand img { width: 160px; height: auto; display: block; }
  #nav .nav-extra { display: flex; margin-top: auto; }
  .tonight-set { display: none; }
  .ob { max-width: 440px; margin: 0 auto; width: 100%; }
  .ob-art { margin: calc(var(--space-10) * -1) calc(var(--space-8) * -1) 0; height: 300px; border-radius: 0 0 var(--radius-md) var(--radius-md); }
  .ob-top { padding: var(--space-4) var(--space-8) 0; }
  .tonight { margin: calc(var(--space-10) * -1) calc(var(--space-8) * -1) 0; border-radius: 0 0 var(--radius-md) var(--radius-md); }
  .fim-art { margin: calc(var(--space-10) * -1) calc(var(--space-8) * -1) calc(var(--space-6) * -1); height: 240px; border-radius: 0 0 var(--radius-md) var(--radius-md); }
  .player-view { margin: calc(var(--space-10) * -1) calc(var(--space-8) * -1); padding: var(--space-6) var(--space-8); }
  .stage { margin: calc(var(--space-6) * -1) calc(var(--space-8) * -1) 0; height: min(52vh, 480px); }
  .player-top { top: var(--space-4); left: var(--space-8); right: var(--space-8); }
  .stage-txt { left: var(--space-8); right: var(--space-8); }
  .stage .guide { top: 72px; }
  #toast { left: auto; right: var(--space-6); bottom: var(--space-6); width: 360px; }
  .btn:hover, .chip:hover, .row:hover .item-title, .g-tile:hover .item-title { filter: brightness(1.06); }
  .login { max-width: 400px; margin: 0 auto; width: 100%; padding-top: clamp(16px, 6vh, 56px); }
  .login-art { margin: 0; height: 200px; border-radius: var(--radius-md); padding: 0 var(--space-4) var(--space-3); }
}

/* ---------------------------------------------------------------- luar: entrada, estrela, raios, segurar */
/* Entrada do Início: só na primeira vez que ele aparece depois de abrir o app (classe posta em render()).
   O texto sobe 8 px e sai de um desfoque leve, um item depois do outro. Não bloqueia o toque. */
#view.is-first.enter { animation: none; }
#view.is-first .tonight-txt > *, #view.is-first .ritual > * { animation: bf-in 320ms var(--ease-out) both; }
#view.is-first .tonight-txt > :nth-child(2) { animation-delay: 60ms; }
#view.is-first .tonight-txt > :nth-child(3), #view.is-first .tonight-txt > :nth-child(4) { animation-delay: 120ms; }
#view.is-first .ritual > :nth-child(1) { animation-delay: 180ms; }
#view.is-first .ritual > :nth-child(2) { animation-delay: 240ms; }
#view.is-first .ritual > :nth-child(3) { animation-delay: 300ms; }
@keyframes bf-in { from { opacity: 0; transform: translateY(8px); filter: blur(4px); } }
@keyframes bf-fade { from { opacity: 0; } }
/* Estrela cadente no céu do Início: um risco em CSS por cima da cena parada, uma vez a cada 40 s
   (1,2 s de passagem). Assim o canvas não precisa ficar redesenhando só por ela. */
.meteor { position: absolute; top: 14%; left: 18%; width: 90px; height: 1.5px; border-radius: 1px; pointer-events: none; opacity: 0;
  background: linear-gradient(90deg, rgba(240, 245, 255, 0), rgba(240, 245, 255, .9)); transform-origin: right center;
  animation: meteor 40s linear 6s infinite; }
@keyframes meteor {
  0% { opacity: 0; transform: rotate(18deg) translateX(0) scaleX(.4); }
  0.6% { opacity: 1; }
  3%, 100% { opacity: 0; transform: rotate(18deg) translateX(150px) scaleX(1); }
}
/* Raios de luar sobre a cena do player: feixes frios vindos do canto da lua. Só a opacidade muda,
   devagar, como nuvem passando na frente da lua. */
.rays { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.rays i { position: absolute; top: -10%; right: var(--x); width: var(--w); height: 130%; transform-origin: 50% 0; transform: rotate(var(--r));
  background: linear-gradient(180deg, rgba(214, 224, 242, var(--a)) 0%, rgba(214, 224, 242, 0) 78%);
  clip-path: polygon(42% 0, 58% 0, 100% 100%, 0 100%); animation: ray var(--d) ease-in-out infinite alternate; }
.rays i:nth-child(1) { --x: 14%; --w: 70px; --r: 24deg; --a: .16; --d: 11s; }
.rays i:nth-child(2) { --x: 26%; --w: 46px; --r: 30deg; --a: .11; --d: 14s; animation-delay: -5s; }
.rays i:nth-child(3) { --x: 4%;  --w: 96px; --r: 18deg; --a: .09; --d: 17s; animation-delay: -9s; }
.rays i:nth-child(4) { --x: 36%; --w: 34px; --r: 36deg; --a: .08; --d: 13s; animation-delay: -2s; }
@keyframes ray { from { opacity: .45; } to { opacity: 1; } }
/* Segurar para confirmar (data-hold em app.js): encher é lento e linear, porque é uma barra de progresso;
   soltar antes volta rápido. Cheio, a ação acontece quando o dedo sai. */
[data-hold] { position: relative; overflow: hidden; isolation: isolate; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: manipulation; transition: transform var(--dur-fast) var(--ease-out); }
.hold-fill { position: absolute; inset: 0; z-index: -1; pointer-events: none; background: var(--hold-fill, rgba(221, 227, 238, .16)); clip-path: inset(0 100% 0 0); transition: clip-path 200ms var(--ease-out); }
.is-holding .hold-fill { clip-path: inset(0 0 0 0); transition: clip-path var(--hold-ms, 1s) linear; }
.is-ready .hold-fill { clip-path: inset(0 0 0 0); transition: none; }
[data-hold].is-holding { transform: scale(.985); }
.btn.danger-ghost[data-hold] { --hold-fill: rgba(226, 104, 95, .28); }

@media (prefers-reduced-motion: reduce) {
  #view.is-first .tonight-txt > *, #view.is-first .ritual > * { animation: bf-fade 200ms ease both; }
  .meteor { display: none; }
  .rays i { animation: none; }
  [data-hold].is-holding { transform: none; }
  #view.enter, .word-big.in, .is-breath .core, .sheet[open] { animation: none !important; }
  .btn[aria-busy="true"]::before { animation-duration: 3s; }
  .word-big.in { opacity: 1; }
  .chev, .pmr span, .scan-band, #toast, .bar > i, .btn, .chip, .play, .q-opt, .q-opt input::before { transition: none; }
  .play.is-loading::after, .icon-btn.is-loading::after { animation-duration: 3s; }
}
