/* ============================================================================
   Redação 900+ — App (SPA)
   Paleta da marca: creme + laranja + verde-lima + roxo. Mobile-first.

   TEMA: claro (creme) é o padrão (:root). O escuro fica em [data-theme="dark"],
   ligado pelo botão de alternar tema (ver js/theme.js) e lembrado no
   localStorage. As cores de destaque (--purple/--orange/--lime/--green/--red)
   têm um valor mais escuro no tema claro (legibilidade em texto sobre fundo
   creme) e mais vivo no escuro.
   ============================================================================ */

:root {
  --bg:        #faf6ec;
  --bg-2:      #f3ecda;
  --card:      #ffffff;
  --card-2:    #f7f1e2;
  --line:      #e7dcc3;
  --line-2:    #d9cba6;
  --text:      #2b2419;
  --text-soft: #4d4330;
  --muted:     #8c7f66;
  --purple:    #5b3dc0;
  --purple-2:  #7a5aeb;
  --orange:    #e8501f;
  --orange-2:  #ff7a58;
  --lime:      #6e7c1c;
  --lime-2:    #566016;
  --gold:      var(--lime);
  --green:     #1c8f63;
  --red:       #c93548;
  --nivel-a:   #1c8f63;
  --nivel-b:   #c94a1f;
  --nivel-c:   #5b3dc0;
  --code-bg:   #f1ede0;
  --code-text: #33301f;
  --topbar-bg: rgba(255,253,246,.85);
  --subtle-tint: rgba(40,30,10,.035);
  --panel-overlay: rgba(0,0,0,.06);
  --panel-a:   #fdf8ec;
  --panel-b:   #f5ebd2;
  --gate-glow: #f7ecc9;
  --orange-tint: rgba(232,80,31,.08);
  --lime-tint:   rgba(110,124,28,.08);
  --red-tint:    rgba(201,53,72,.08);
  --radius:    16px;
  --shadow:    0 16px 50px rgba(60,45,10,.10);
  --sidebar-w: 264px;
}

:root[data-theme="dark"] {
  --bg:        #100e22;
  --bg-2:      #17142e;
  --card:      #1e1a38;
  --card-2:    #262048;
  --line:      #342e56;
  --line-2:    #423a6b;
  --text:      #eeeaf8;
  --text-soft: #ded8ee;
  --muted:     #9f97c0;
  --purple:    #6a4bd6;
  --purple-2:  #8c6dff;
  --orange:    #ff5c33;
  --orange-2:  #ff7a58;
  --lime:      #cbe84a;
  --lime-2:    #dbf16f;
  --green:     #2fc281;
  --red:       #ff6b7a;
  --nivel-a:   #6ce4ac;
  --nivel-b:   #ff9c82;
  --nivel-c:   #b6a2ff;
  --code-bg:   #0b0918;
  --code-text: #cfd6e6;
  --topbar-bg: rgba(16,14,34,.85);
  --subtle-tint: rgba(255,255,255,.025);
  --panel-overlay: rgba(0,0,0,.25);
  --panel-a:   #2c2456;
  --panel-b:   #201b3d;
  --gate-glow: #2a1f52;
  --orange-tint: rgba(255,92,51,.1);
  --lime-tint:   rgba(203,232,74,.07);
  --red-tint:    rgba(255,107,122,.1);
  --shadow:    0 16px 50px rgba(0,0,0,.45);
}

* { box-sizing: border-box; }

/* Garante que o atributo [hidden] sempre esconda o elemento, mesmo quando a
   classe define display:grid/flex (ex.: a tela de login #gate). */
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  transition: background-color .15s ease, color .15s ease;
}
h1, h2, h3, h4 { font-family: 'Fraunces', Georgia, serif; font-weight: 600; line-height: 1.15; }
a { color: var(--lime-2); }
.gold { color: var(--lime); }

/* ---------------- Botão de alternar tema ---------------- */
.theme-toggle {
  background: var(--card); border: 1px solid var(--line); color: var(--text);
  width: 38px; height: 38px; border-radius: 10px; cursor: pointer; font-size: 17px;
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.theme-toggle:hover { border-color: var(--purple); }

/* ============================ GATE / LOGIN ============================ */
.gate {
  min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative;
  background: radial-gradient(1100px 600px at 50% -10%, var(--gate-glow) 0%, var(--bg) 55%);
}
.gate-theme-toggle { position: absolute; top: 18px; right: 18px; }
.gate-card {
  width: 100%; max-width: 430px; background: var(--card); border: 1px solid var(--line);
  border-radius: 22px; padding: 40px 32px; text-align: center; box-shadow: var(--shadow);
}
.gate-badge {
  display: inline-block; font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--lime); border: 1px solid rgba(110,124,28,.35); border-radius: 999px; padding: 6px 14px; margin-bottom: 22px;
}
:root[data-theme="dark"] .gate-badge { border-color: rgba(203,232,74,.35); }
.gate-title { font-size: 44px; margin: 0 0 10px; }
.gate-sub { color: var(--muted); margin: 0 0 24px; font-size: 15px; }
#gate-form { display: flex; flex-direction: column; gap: 12px; }
#gate-input {
  padding: 15px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-2);
  color: var(--text); font-size: 16px; text-align: center; letter-spacing: .05em;
}
#gate-input:focus { outline: none; border-color: var(--purple); }
#gate-form button {
  padding: 15px; border: none; border-radius: 12px;
  background: linear-gradient(135deg, var(--orange), var(--orange-2));
  color: #fff; font-weight: 700; font-size: 16px; cursor: pointer; transition: transform .1s;
}
#gate-form button:active { transform: scale(.98); }
.gate-error { color: var(--red); font-size: 14px; margin: 14px 0 0; line-height: 1.5; }
.gate-ok { color: var(--green); font-size: 14px; margin: 14px 0 0; line-height: 1.5; }
#gate-email-form { display: flex; flex-direction: column; gap: 12px; }
#gate-email {
  padding: 15px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-2);
  color: var(--text); font-size: 16px; text-align: center; font-family: inherit;
}
#gate-email:focus { outline: none; border-color: var(--purple); }
#gate-email-form button {
  padding: 15px; border: none; border-radius: 12px;
  background: linear-gradient(135deg, var(--orange), var(--orange-2));
  color: #fff; font-weight: 700; font-size: 16px; cursor: pointer; font-family: inherit;
}
#gate-email-form button:disabled { opacity: .6; cursor: wait; }
.gate-features { list-style: none; padding: 0; margin: 24px 0 0; text-align: left; display: grid; gap: 10px; }
.gate-features li { font-size: 14px; color: var(--text-soft); background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.gate-help { color: var(--muted); font-size: 14px; margin: 22px 0 0; }

/* ============================ APP SHELL ============================ */
.app-shell { min-height: 100vh; }

.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 40; }

/* ---------------- Sidebar ---------------- */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w); z-index: 50;
  background: var(--bg-2); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 14px;
  transform: translateX(-100%); transition: transform .25s ease;
}
.sidebar.open { transform: translateX(0); }
.side-brand { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 18px; }
.brand-name { font-family: 'Fraunces', serif; font-size: 21px; font-weight: 700; }
.side-close { background: none; border: none; color: var(--muted); font-size: 18px; cursor: pointer; }

.side-nav { display: flex; flex-direction: column; gap: 4px; margin-bottom: 18px; }
.side-link {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: none; border: none; color: var(--muted); cursor: pointer;
  padding: 11px 12px; border-radius: 10px; font-size: 14.5px; font-weight: 500; font-family: inherit; text-align: left;
}
.side-link .ico { font-size: 16px; }
.side-link:hover { background: var(--card); color: var(--text); }
.side-link.active { background: linear-gradient(135deg, var(--purple), var(--purple-2)); color: #fff; }

.side-progress { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 16px; }
.side-progress-top { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
#side-progress-pct { color: var(--lime); font-weight: 700; }

.side-lessons-title { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); padding: 0 6px 8px; }
.side-lessons { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; margin: 0 -4px; padding: 0 4px; }
.side-lesson {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; cursor: pointer; font-size: 13px; color: var(--muted);
}
.side-lesson:hover { background: var(--card); color: var(--text); }
.side-lesson.active { background: var(--card-2); color: var(--text); }
.side-lesson .sl-num { flex: none; width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--lime-tint); color: var(--lime); }
.side-lesson.done .sl-num { background: var(--green); color: #06281c; }
.side-lesson .sl-title { line-height: 1.25; }

.side-logout { margin-top: 12px; background: none; border: 1px solid var(--line); color: var(--muted); padding: 10px; border-radius: 10px; cursor: pointer; font-size: 13px; }
.side-logout:hover { border-color: var(--red); color: var(--red); }

/* ---------------- Main ---------------- */
.main { min-height: 100vh; padding-bottom: 80px; }
.app-topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px;
  background: var(--topbar-bg); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
  padding: 12px 16px;
}
.menu-toggle { background: var(--card); border: 1px solid var(--line); color: var(--text); font-size: 18px; width: 40px; height: 40px; border-radius: 10px; cursor: pointer; }
.topbar-title { font-family: 'Fraunces', serif; font-weight: 600; font-size: 18px; flex: 1; }

.main-scroll { padding: 20px 16px 40px; max-width: 900px; margin: 0 auto; }
.view { display: none; animation: fade .28s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.page-head { margin-bottom: 20px; }
.page-title { font-size: 28px; margin: 0 0 6px; }
.page-sub { color: var(--muted); margin: 0; font-size: 15px; }

/* ============================ INÍCIO (dashboard) ============================ */
.hero {
  background: linear-gradient(135deg, var(--panel-a), var(--panel-b));
  border: 1px solid var(--line); border-radius: 20px; padding: 24px; margin-bottom: 20px; position: relative; overflow: hidden;
}
.hero::after { content: ""; position: absolute; right: -40px; top: -40px; width: 170px; height: 170px; border-radius: 50%; background: radial-gradient(circle, var(--orange-tint), transparent 70%); }
.hero-hi { color: var(--muted); font-size: 14px; margin: 0 0 4px; }
.hero-title { font-size: 26px; margin: 0 0 18px; position: relative; }
.continue-card {
  display: flex; align-items: center; gap: 14px; background: var(--panel-overlay); border: 1px solid var(--line-2);
  border-radius: 14px; padding: 14px; cursor: pointer; position: relative; transition: border-color .15s;
}
.continue-card:hover { border-color: var(--lime); }
.continue-num { flex: none; width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; font-family: 'Fraunces', serif; font-weight: 700; font-size: 20px; background: var(--lime-tint); color: var(--lime); }
.continue-info { flex: 1; min-width: 0; }
.continue-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--lime); }
.continue-titulo { font-size: 15px; font-weight: 600; margin-top: 2px; }
.continue-go { flex: none; color: var(--muted); font-size: 22px; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 20px; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; text-align: center; }
.stat-num { font-family: 'Fraunces', serif; font-size: 28px; font-weight: 700; color: var(--lime); }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 4px; }

.section-title { font-size: 19px; margin: 26px 0 12px; }

.historico { display: flex; flex-direction: column; gap: 8px; }
.hist-item { display: flex; justify-content: space-between; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.hist-tema { font-size: 13px; color: var(--muted); max-width: 72%; }
.hist-nota { font-family: 'Fraunces', serif; font-weight: 700; color: var(--lime); font-size: 18px; }
.empty { color: var(--muted); font-size: 14px; font-style: italic; padding: 10px 2px; }

/* ============================ TRILHA (lista de aulas) ============================ */
.trilha-progress { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.trilha-progress .progress-bar { flex: 1; }
.trilha-progress span { font-size: 12px; color: var(--muted); white-space: nowrap; }

.lesson-cards { display: flex; flex-direction: column; gap: 12px; }
.lesson-card {
  display: flex; align-items: center; gap: 14px; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 16px; cursor: pointer; transition: border-color .15s, transform .1s;
}
.lesson-card:hover { border-color: var(--purple-2); transform: translateY(-1px); }
.lesson-card .lc-num { flex: none; width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-family: 'Fraunces', serif; font-weight: 700; font-size: 19px; background: var(--lime-tint); color: var(--lime); border: 1px solid rgba(110,124,28,.2); }
:root[data-theme="dark"] .lesson-card .lc-num { border-color: rgba(203,232,74,.2); }
.lesson-card.done .lc-num { background: var(--green); color: #06281c; border-color: var(--green); }
.lc-info { flex: 1; min-width: 0; }
.lc-title { font-size: 15px; font-weight: 600; }
.lc-meta { display: flex; align-items: center; gap: 8px; margin-top: 5px; flex-wrap: wrap; }
.lc-go { flex: none; color: var(--muted); font-size: 20px; }

.nivel-badge { font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; }
.nivel-iniciante     { background: rgba(28,143,99,.16); color: var(--nivel-a); }
.nivel-intermediario { background: rgba(201,74,31,.16); color: var(--nivel-b); }
.nivel-avancado      { background: rgba(91,61,192,.18); color: var(--nivel-c); }
.nivel-bonus         { background: var(--lime-tint); color: var(--lime-2); }
:root[data-theme="dark"] .nivel-iniciante     { background: rgba(47,194,129,.16); }
:root[data-theme="dark"] .nivel-intermediario { background: rgba(255,92,51,.16); }
:root[data-theme="dark"] .nivel-avancado      { background: rgba(140,109,255,.18); }
.lc-dur { font-size: 12px; color: var(--muted); }

/* ============================ LEITOR DE AULA (imersivo) ============================ */
.lesson-reader { max-width: 760px; margin: 0 auto; }
.lesson-back { display: inline-flex; align-items: center; gap: 6px; background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 0; margin-bottom: 16px; }
.lesson-back:hover { color: var(--lime); }
.lesson-hero { margin-bottom: 20px; }
.lesson-kicker { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.lesson-kicker .lk-num { font-family: 'Fraunces', serif; font-weight: 700; font-size: 15px; color: var(--lime); }
.lesson-title { font-size: 30px; line-height: 1.12; margin: 0 0 8px; }
.lesson-dur { color: var(--muted); font-size: 13px; }

.reading-bar { position: sticky; top: 65px; z-index: 25; height: 3px; background: var(--line); border-radius: 999px; overflow: hidden; margin-bottom: 18px; }
.reading-bar > div { height: 100%; width: 0; background: var(--lime); transition: width .1s; }

/* Conteúdo da aula (tipografia de leitura) */
.lesson-body { font-size: 16px; line-height: 1.75; color: var(--text-soft); }
.lesson-body p { margin: 14px 0; }
.lesson-body h4 { font-size: 19px; color: var(--lime); margin: 30px 0 10px; }
.lesson-body ul, .lesson-body ol { padding-left: 22px; }
.lesson-body li { margin: 8px 0; }
.lesson-body b, .lesson-body strong { color: var(--text); }
.lesson-body a { text-decoration: underline; text-underline-offset: 2px; }
.lesson-body hr { border: 0; border-top: 1px solid var(--line); margin: 26px 0; }
.lesson-body blockquote { border-left: 3px solid var(--lime); margin: 18px 0; padding: 12px 18px; color: var(--text-soft); background: var(--bg-2); border-radius: 10px; font-size: 15px; }
.lesson-body code { background: var(--bg-2); padding: 2px 6px; border-radius: 5px; font-size: 14px; }

/* Vídeos */
.videos-wrap { display: flex; flex-direction: column; gap: 16px; margin: 18px 0 24px; }
.video-frame { position: relative; width: 100%; aspect-ratio: 16/9; border-radius: 14px; overflow: hidden; background: #000; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-cap { padding: 8px 2px 0; font-size: 13px; }
.video-cap strong { display: block; color: var(--text); }
.video-cap span { color: var(--muted); font-size: 12px; }

/* Tabelas */
.tbl { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 14.5px; display: block; overflow-x: auto; }
.tbl th { background: var(--purple); color: #fff; text-align: left; padding: 10px 12px; font-family: 'Inter', sans-serif; font-weight: 600; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--text-soft); }
.tbl tr:nth-child(even) td { background: var(--subtle-tint); }

/* Repertório / listas destacadas */
ul.rep { list-style: none; padding: 0; margin: 10px 0; }
ul.rep li { padding: 10px 14px; margin: 7px 0; background: var(--bg-2); border-left: 3px solid var(--orange); border-radius: 8px; font-size: 14.5px; line-height: 1.55; color: var(--text-soft); }
ul.rep li b { color: var(--lime); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; margin-right: 4px; }

/* Caixas de exemplo, aviso e resumo */
.lesson-body .ex { background: var(--subtle-tint); border-left: 3px solid var(--orange); padding: 12px 16px; border-radius: 8px; font-size: 15px; line-height: 1.6; margin: 14px 0; }
.lesson-body .ex u { text-decoration-color: var(--lime); }
.aviso { background: var(--orange-tint); border: 1px solid rgba(232,80,31,.4); color: var(--orange); padding: 12px 15px; border-radius: 10px; font-size: 14px; margin: 18px 0; }
:root[data-theme="dark"] .aviso { border-color: rgba(255,92,51,.4); }
.lesson-body .resumo { background: var(--lime-tint); border: 1px solid rgba(110,124,28,.25); padding: 14px 16px; border-radius: 12px; font-size: 15px; line-height: 1.6; margin: 22px 0 6px; color: var(--text-soft); }
:root[data-theme="dark"] .lesson-body .resumo { border-color: rgba(203,232,74,.25); }

/* Redações comentadas */
.legenda { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 18px; }
.redacao-card { background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin: 16px 0; }
.redacao-tema { font-family: 'Inter', sans-serif; font-size: 15px; font-weight: 700; color: var(--text); margin: 0 0 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.nota-badge { background: var(--lime); color: #1a2400; font-size: 10px; font-weight: 800; padding: 3px 8px; border-radius: 999px; letter-spacing: .05em; }
.par { font-size: 14.5px; line-height: 1.65; color: var(--text-soft); margin: 10px 0; }
.par-tag { display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: .04em; padding: 3px 7px; border-radius: 5px; margin-right: 8px; color: #fff; vertical-align: middle; }
.par-tag.intro { background: var(--purple); }
.par-tag.dev1  { background: var(--orange); }
.par-tag.dev2  { background: var(--green); }
.par-tag.concl { background: #4a3fb0; }
.analise { font-size: 13px; line-height: 1.55; color: var(--muted); background: var(--lime-tint); border-left: 3px solid var(--lime); padding: 10px 12px; border-radius: 8px; margin-top: 12px; }
.analise b { color: var(--lime-2); }

/* Prompts */
pre.prompt { background: var(--code-bg); border: 1px solid var(--line); border-radius: 10px; padding: 14px; font-size: 12.5px; line-height: 1.55; color: var(--code-text); white-space: pre-wrap; overflow-x: auto; font-family: 'Courier New', monospace; margin: 8px 0 18px; }

/* Navegação anterior/próxima da aula */
.lesson-nav { display: flex; gap: 10px; margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--line); align-items: stretch; }
.lnav-btn { flex: 1; background: var(--card); border: 1px solid var(--line); color: var(--text); border-radius: 12px; padding: 14px; cursor: pointer; font-size: 13px; font-family: inherit; text-align: left; }
.lnav-btn:hover { border-color: var(--purple-2); }
.lnav-btn:disabled { opacity: .35; cursor: default; }
.lnav-btn small { display: block; color: var(--muted); font-size: 11px; margin-bottom: 3px; }
.lnav-btn.next { text-align: right; }
.mark-done-btn { width: 100%; padding: 14px; border-radius: 12px; cursor: pointer; font-size: 15px; font-weight: 600; font-family: inherit; margin-top: 16px; border: 1px solid var(--green); background: transparent; color: var(--green); }
.mark-done-btn.done { background: var(--green); color: #06281c; }

/* ============================ CORRIGIR ============================ */
.corrigir-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.field-label { display: block; font-size: 13px; color: var(--muted); margin: 4px 0 6px; font-weight: 500; }
.corrigir-card textarea { margin-bottom: 0; }
.tema-row { display: flex; gap: 8px; margin-bottom: 6px; }
#tema, #redacao { width: 100%; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; color: var(--text); font-family: inherit; font-size: 15px; padding: 14px; }
#tema:focus, #redacao:focus { outline: none; border-color: var(--purple); }
#redacao { resize: vertical; line-height: 1.6; }
.editor-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; gap: 12px; flex-wrap: wrap; }
.editor-info { display: flex; flex-direction: column; gap: 2px; }
.contador { font-size: 13px; color: var(--muted); }
.restantes { font-size: 11.5px; color: var(--lime); }
.ghost-btn { background: transparent; border: 1px solid var(--line); color: var(--muted); padding: 10px 14px; border-radius: 10px; cursor: pointer; font-size: 14px; white-space: nowrap; }
.ghost-btn:hover { border-color: var(--purple); color: var(--text); }
.ghost-btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.ghost-btn:disabled { opacity: .5; cursor: not-allowed; }
.field-label-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.field-label-row .field-label { margin: 4px 0; }
.foto-hint { font-size: 12px; color: var(--muted); margin: 0 0 8px; }
.foto-status { font-size: 13px; padding: 10px 12px; border-radius: 10px; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.foto-status.loading { background: var(--lime-tint); border: 1px solid var(--lime); color: var(--text); }
.foto-status.erro { background: var(--red-tint); border: 1px solid var(--red); color: var(--red); }
.foto-status.ok { background: var(--lime-tint); border: 1px solid var(--lime); color: var(--text); }
.foto-status .mini-spinner { width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--lime); border-radius: 50%; animation: spin 0.8s linear infinite; flex: 0 0 auto; }
.primary-btn { background: linear-gradient(135deg, var(--orange), var(--orange-2)); border: none; color: #fff; padding: 13px 24px; border-radius: 12px; font-weight: 700; font-size: 15px; cursor: pointer; }
.primary-btn:disabled { opacity: .5; cursor: not-allowed; }

.corrigindo { text-align: center; padding: 30px; color: var(--muted); }
.spinner { width: 38px; height: 38px; margin: 0 auto 14px; border: 3px solid var(--line); border-top-color: var(--lime); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.resultado { margin-top: 24px; }
.nota-hero { text-align: center; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 26px; margin-bottom: 18px; }
.nota-hero .big { font-family: 'Fraunces', serif; font-size: 60px; font-weight: 700; color: var(--lime); line-height: 1; }
.nota-hero .max { color: var(--muted); font-size: 20px; }
.nota-hero .label { color: var(--muted); margin-top: 6px; font-size: 14px; }
.comp-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 10px; }
.comp-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.comp-nome { font-size: 14px; font-weight: 600; }
.comp-nota { font-family: 'Fraunces', serif; font-weight: 700; font-size: 20px; }
.comp-bar { height: 6px; background: var(--bg-2); border-radius: 999px; margin: 10px 0; overflow: hidden; }
.comp-bar-fill { height: 100%; border-radius: 999px; }
.comp-coment { font-size: 14px; color: var(--muted); line-height: 1.55; }
.feedback-grid { display: grid; gap: 12px; margin-top: 14px; }
.fb-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.fb-card h4 { margin: 0 0 10px; font-size: 14px; font-family: 'Inter', sans-serif; }
.fb-card.good h4 { color: var(--green); }
.fb-card.bad h4 { color: var(--lime); }
.fb-card ul { margin: 0; padding-left: 18px; }
.fb-card li { font-size: 14px; color: var(--muted); margin: 6px 0; line-height: 1.5; }
.fb-geral { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-top: 12px; color: var(--text-soft); line-height: 1.6; font-size: 15px; }
.erro-box { background: var(--red-tint); border: 1px solid var(--red); color: var(--red); padding: 16px; border-radius: 12px; font-size: 14px; }

/* Barra de progresso genérica */
.progress-bar { height: 8px; background: var(--bg-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--purple), var(--lime)); transition: width .5s ease; }

/* ============================ BLOQUEIO / UPSELL ============================ */
.nivel-premium { background: linear-gradient(135deg, var(--lime), var(--lime-2)); color: #fff; }
:root[data-theme="dark"] .nivel-premium { background: linear-gradient(135deg, var(--lime), #a8d321); color: #1a2400; }
.lesson-card.locked { border-style: dashed; opacity: .92; }
.lesson-card.locked .lc-num { background: var(--lime-tint); color: var(--lime); }
.lesson-card.locked .lc-dur { color: var(--lime); font-weight: 600; }
.side-lesson.locked .sl-num { background: var(--lime-tint); color: var(--lime); }

.unlock { text-align: center; max-width: 460px; margin: 10px auto 0; padding: 24px 20px 30px;
  background: linear-gradient(160deg, var(--panel-a), var(--panel-b)); border: 1px solid var(--line); border-radius: 20px; }
.unlock-lock { font-size: 46px; margin-bottom: 8px; }
.unlock-kicker { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--lime); margin-bottom: 8px; }
.unlock-title { font-size: 24px; margin: 0 0 10px; }
.unlock-sub { color: var(--muted); font-size: 15px; margin: 0 0 20px; }
.unlock-list { list-style: none; padding: 0; margin: 0 0 22px; text-align: left; display: grid; gap: 10px; }
.unlock-list li { background: var(--panel-overlay); border: 1px solid var(--line-2); border-radius: 10px; padding: 11px 14px; font-size: 14px; }
.unlock-btn { display: block; padding: 15px; border-radius: 12px; text-decoration: none;
  background: linear-gradient(135deg, var(--orange), var(--orange-2)); color: #fff; font-weight: 700; font-size: 16px; }
.unlock-btn:hover { filter: brightness(1.05); }
.unlock-hint { color: var(--muted); font-size: 12.5px; margin: 16px 0 8px; }
.unlock-reload { background: none; border: 1px solid var(--line); color: var(--muted); padding: 9px 16px; border-radius: 10px; cursor: pointer; font-size: 13px; }
.unlock-reload:hover { border-color: var(--lime); color: var(--lime); }

/* ============================ MODO SIMULADO ============================ */
.simulado-card {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: linear-gradient(135deg, var(--panel-a), var(--panel-b));
  border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 14px;
}
.simulado-card.running { border-color: var(--orange); }
.simulado-info { flex: 1; min-width: 160px; }
.simulado-title { font-weight: 700; font-size: 15px; }
.simulado-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.simulado-timer { font-family: 'Fraunces', serif; font-weight: 700; font-size: 30px; color: var(--lime); font-variant-numeric: tabular-nums; }
.simulado-timer.alerta { color: var(--orange); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .5; } }
.simulado-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.simulado-select { background: var(--bg-2); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 10px 12px; font-family: inherit; font-size: 14px; }

/* ============================ GRÁFICO DE EVOLUÇÃO ============================ */
.chart-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.chart-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.chart-big { font-family: 'Fraunces', serif; font-weight: 700; font-size: 30px; color: var(--lime); }
.chart-small { color: var(--muted); font-size: 15px; }
.chart-meta { font-size: 12px; color: var(--muted); }
.chart-up { color: var(--green); font-weight: 600; }
.chart-down { color: var(--red); font-weight: 600; }
.chart-flat { color: var(--muted); font-weight: 600; }
.chart-svg { width: 100%; height: 150px; display: block; }
.chart-empty { background: var(--card); border: 1px dashed var(--line); border-radius: 14px; padding: 20px; text-align: center; color: var(--muted); font-size: 14px; }

/* ============================ MENU INFERIOR (celular) ============================ */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 35; display: flex;
  background: var(--bg-2); border-top: 1px solid var(--line);
}
.bnav { flex: 1; background: none; border: none; color: var(--muted); cursor: pointer; padding: 9px 4px 8px; font-size: 11px; font-family: inherit; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.bnav span { font-size: 20px; }
.bnav.active { color: var(--lime); }

/* ============================ DESKTOP ============================ */
@media (min-width: 900px) {
  .sidebar { transform: translateX(0); }
  .overlay { display: none !important; }
  .main { margin-left: var(--sidebar-w); }
  .menu-toggle, .side-close, .bottom-nav { display: none; }
  .main { padding-bottom: 0; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .gate-features { grid-template-columns: 1fr 1fr; }
  .lesson-title { font-size: 36px; }
}

@media (min-width: 640px) and (max-width: 899px) {
  .stats { grid-template-columns: repeat(4, 1fr); }
  .gate-features { grid-template-columns: 1fr 1fr; }
}
