:root {
  --bg: #131f24;
  --panel: #1a2a31;
  --line: #37464f;
  --text: #f1f7fb;
  --muted: #8a9ba5;
  --green: #58cc02;
  --green-dark: #46a302;
  --blue: #1cb0f6;
  --red: #ff4b4b;
  --gold: #ffc800;
  --radius: 16px;
  --ring-off: #37464f;
  --orange: #ff9600;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font-family: "Nunito", system-ui, sans-serif; font-weight: 700; min-height: 100dvh; }
button { font: inherit; color: inherit; cursor: pointer; }
#app { max-width: 760px; margin: 0 auto; padding: 0 16px; }

/* ---------- Home ---------- */
.topbar { position: sticky; top: 0; z-index: 5; background: var(--bg); display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 2px solid var(--line); }
.brand { font-size: 22px; font-weight: 900; color: var(--green); letter-spacing: -.5px; }
.stats { display: flex; gap: 16px; font-weight: 800; }
.stats .fire { color: #ff9600; }
.stats .xp { color: var(--gold); }

.unit { margin: 28px 0 8px; }
.unit-banner { border-radius: var(--radius); padding: 16px 18px; display: flex; justify-content: space-between; align-items: center; gap: 12px; box-shadow: 0 4px 0 rgba(0,0,0,.25); }
.unit-banner h2 { margin: 0; font-size: 20px; font-weight: 900; color: #fff; }
.unit-banner p { margin: 4px 0 0; color: rgba(255,255,255,.9); font-size: 15px; }
.guide-btn { background: rgba(0,0,0,.18); border: 2px solid rgba(255,255,255,.35); border-radius: 12px; padding: 10px 14px; font-weight: 900; font-size: 14px; letter-spacing: .5px; color: #fff; white-space: nowrap; }

.path { display: flex; flex-direction: column; align-items: center; gap: 22px; padding: 28px 0 10px; }
.node { display: flex; flex-direction: column; align-items: center; gap: 8px; background: none; border: 0; padding: 0; }
.node .circle { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; font-size: 34px; background: var(--unit-color); box-shadow: 0 7px 0 rgba(0,0,0,.35); transition: transform .1s; position: relative; }
.node:active .circle { transform: translateY(5px); box-shadow: 0 2px 0 rgba(0,0,0,.35); }
.node.done .circle { background: var(--gold); }
.node.done .circle::after { content: "✓"; position: absolute; right: -4px; bottom: -4px; width: 26px; height: 26px; border-radius: 50%; background: var(--green); color: #fff; font-size: 16px; display: grid; place-items: center; border: 3px solid var(--bg); }
.node .label { font-size: 14px; color: var(--muted); max-width: 160px; text-align: center; line-height: 1.2; }
.node .label b { display: block; color: var(--text); }

/* ---------- Guia ---------- */
.back { background: none; border: 0; color: var(--muted); font-size: 20px; font-weight: 800; padding: 18px 0; display: flex; gap: 10px; align-items: center; }
.guide-head { display: flex; gap: 20px; align-items: center; padding: 10px 0 24px; border-bottom: 2px solid var(--line); }
.guide-head .big { font-size: 72px; }
.guide-head h1 { margin: 0 0 6px; font-size: 28px; font-weight: 900; }
.guide-head p { margin: 0; color: var(--muted); }
.section-title { color: var(--blue); font-weight: 900; letter-spacing: .5px; margin: 26px 0 14px; }
.phrase { border: 2px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 14px; display: flex; gap: 14px; align-items: flex-start; width: fit-content; max-width: 100%; }
.phrase .pt { color: var(--muted); margin-top: 6px; font-weight: 600; }

/* ---------- Palavras clicáveis ---------- */
.speak { background: none; border: 0; padding: 0; color: var(--blue); flex: none; display: grid; place-items: center; }
.speak svg { width: 30px; height: 30px; }
.speak.playing svg { animation: pulse .5s ease-in-out infinite alternate; }
@keyframes pulse { to { transform: scale(1.15); } }
.en { font-size: 19px; line-height: 1.5; }
.w { cursor: pointer; border-bottom: 2px dashed #52656d; padding-bottom: 1px; border-radius: 2px; }
.w:hover, .w.active { background: rgba(28,176,246,.18); }

.tooltip { position: fixed; z-index: 50; background: var(--text); color: var(--bg); border-radius: 12px; padding: 8px 12px; font-weight: 800; font-size: 15px; max-width: 240px; box-shadow: 0 6px 20px rgba(0,0,0,.4); pointer-events: none; }

/* ---------- Lição ---------- */
.lesson { min-height: 100dvh; display: flex; flex-direction: column; }
.lesson-top { position: sticky; top: 0; z-index: 5; background: var(--bg); display: flex; align-items: center; gap: 16px; padding: 16px 0; }
.close { background: none; border: 0; color: var(--muted); font-size: 28px; line-height: 1; padding: 4px; }
.bar { flex: 1; height: 16px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar > div { height: 100%; width: 0; background: var(--green); border-radius: 99px; transition: width .35s ease; box-shadow: inset 0 -4px 0 rgba(255,255,255,.0), inset 0 4px 0 rgba(255,255,255,.25); }
.autoplay { background: none; border: 2px solid var(--line); border-radius: 10px; color: var(--muted); font-size: 13px; padding: 6px 8px; }
.autoplay.on { color: var(--blue); border-color: var(--blue); }

.feed { flex: 1; padding: 10px 0 150px; }
.story-head { text-align: center; padding: 10px 0 18px; }
.story-head .art { font-size: 96px; line-height: 1.1; filter: drop-shadow(0 6px 0 rgba(0,0,0,.25)); }
.story-head .title { display: inline-flex; gap: 10px; align-items: center; margin-top: 10px; }
.story-head .title .en { font-size: 26px; font-weight: 900; }
.story-head .sub { color: var(--muted); margin-top: 4px; }

.line { display: flex; gap: 14px; align-items: flex-start; margin: 14px 0; animation: rise .3s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
.avatar { width: 54px; flex: none; text-align: center; font-size: 40px; line-height: 1; }
.avatar small { display: block; font-size: 11px; color: var(--muted); margin-top: 4px; font-weight: 800; }
.bubble { border: 2px solid var(--line); border-radius: var(--radius); padding: 12px 16px; display: flex; gap: 12px; align-items: flex-start; max-width: 100%; }
.bubble .content { min-width: 0; }
.trans { color: var(--muted); font-weight: 600; font-size: 15px; margin-top: 4px; }
.trans[hidden] { display: none; }
.pt-toggle { background: none; border: 0; color: #52656d; font-size: 12px; font-weight: 900; padding: 2px 0 0; letter-spacing: .5px; }
.line.narr { justify-content: center; }
.line.narr .bubble { border-style: dashed; }
.line.narr .en { font-style: italic; color: #c8d6dd; }
.line.dim { opacity: .55; }

.question { margin: 24px 0; animation: rise .3s ease; }
.question h3 { font-size: 21px; font-weight: 900; margin: 0 0 16px; }
.opt { display: flex; align-items: center; gap: 16px; width: 100%; text-align: left; background: none; border: 0; padding: 8px 0; font-size: 18px; }
.opt .box { width: 44px; height: 44px; flex: none; border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; color: #fff; }
.opt:hover .box { border-color: #52656d; }
.opt.wrong { color: var(--red); animation: shake .35s; }
.opt.wrong .box { border-color: var(--red); background: var(--red); }
.opt.right { color: var(--green); }
.opt.right .box { border-color: var(--green); background: var(--green); }
.opt:disabled { cursor: default; }
.opt.wrong:disabled { opacity: .6; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

.footer { position: fixed; left: 0; right: 0; bottom: 0; border-top: 2px solid var(--line); background: var(--bg); padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
.footer.ok { background: #1f3a12; border-color: #1f3a12; }
.footer-inner { max-width: 760px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.feedback { color: var(--green); font-weight: 900; font-size: 20px; }
.btn { border: 0; border-radius: 16px; padding: 14px 28px; font-weight: 900; font-size: 17px; letter-spacing: .8px; text-transform: uppercase; background: var(--green); color: #0b1a05; box-shadow: 0 5px 0 var(--green-dark); margin-left: auto; }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--green-dark); }
.btn:disabled { background: var(--line); color: #52656d; box-shadow: 0 5px 0 #2a363c; cursor: default; transform: none; }
.btn.ghost { background: none; color: var(--blue); box-shadow: none; border: 2px solid var(--line); }

/* ---------- Fim ---------- */
.end { min-height: 80dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 12px; padding-bottom: 120px; }
.end .big { font-size: 110px; animation: pop .5s ease; }
@keyframes pop { from { transform: scale(.3); opacity: 0; } }
.end h1 { color: var(--gold); font-size: 30px; margin: 0; font-weight: 900; }
.cards { display: flex; gap: 14px; margin-top: 14px; }
.card { border: 2px solid var(--gold); border-radius: 14px; overflow: hidden; min-width: 120px; }
.card .k { background: var(--gold); color: var(--bg); font-size: 13px; font-weight: 900; padding: 4px; letter-spacing: .5px; }
.card .v { padding: 12px; font-size: 22px; font-weight: 900; }
.card.green { border-color: var(--green); }
.card.green .k { background: var(--green); }

@media (max-width: 520px) {
  .en { font-size: 17px; }
  .avatar { width: 42px; font-size: 32px; }
  .story-head .art { font-size: 76px; }
  .btn { padding: 14px 20px; width: 100%; }
  .footer-inner { flex-wrap: wrap; }
  .guide-head .big { font-size: 56px; }
}

/* ---------- Marca, instalar, splash ---------- */
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 34px; height: 34px; }
.install { background: var(--blue); color: #0b1a24; border: 0; border-radius: 10px; padding: 4px 10px; font-weight: 900; font-size: 13px; box-shadow: 0 3px 0 #1899d6; }
.splash { min-height: 100dvh; display: grid; place-items: center; }
.splash img { width: 96px; height: 96px; animation: bob 1s ease-in-out infinite alternate; }
@keyframes bob { to { transform: translateY(-10px) rotate(-4deg); } }
@media (max-width: 420px) { .stats { gap: 10px; font-size: 14px; } .brand { font-size: 19px; } }

/* ---------- Níveis de dificuldade ---------- */
.levels { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; margin-top: 14px; }
.lv { min-width: 0; background: none; border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 14px; padding: 8px 4px 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); }
.lv b { font-size: 20px; font-weight: 900; line-height: 1; }
.lv small { font-size: 11px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.lv.on { border-color: var(--unit-color); color: var(--text); background: color-mix(in srgb, var(--unit-color) 18%, transparent); }
.lv.on b { color: var(--unit-color); }
.lv.full b::after { content: " ✓"; font-size: 13px; color: var(--gold); }
.lv-desc { margin: 10px 2px 0; color: var(--muted); font-weight: 600; font-size: 14px; line-height: 1.4; }
.lv-desc b { color: var(--text); font-weight: 800; }
.cefr, .lv-badge span { display: inline-block; font-size: 11px; font-weight: 900; padding: 1px 6px; border-radius: 6px; background: var(--line); color: var(--text); vertical-align: 1px; }
.lv-badge { display: inline-flex; gap: 8px; align-items: center; margin-top: 12px; padding: 6px 14px; border-radius: 99px; border: 2px solid var(--line); font-size: 14px; font-weight: 900; }
.lv-badge.lv-1, .lv-badge.lv-2 { color: var(--green); border-color: var(--green); }
.lv-badge.lv-3 { color: var(--blue); border-color: var(--blue); }
.lv-badge.lv-4 { color: #ce82ff; border-color: #ce82ff; }
.lv-badge.lv-5 { color: var(--red); border-color: var(--red); }
.question h3.q-en { display: flex; gap: 12px; align-items: flex-start; }
.question h3.q-en .en { font-size: 21px; font-weight: 900; line-height: 1.4; }
.end .up { margin: 18px 0 0; }
@media (max-width: 520px) {
  .levels { gap: 6px; }
  .lv small { font-size: 9.5px; }
  .end .up { width: auto; }
}

/* ---------- Abas Histórias / Pro ---------- */
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.tab { text-align: center; text-decoration: none; color: var(--muted); font-weight: 900; font-size: 16px; padding: 10px 8px; border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 14px; }
.tab.on { color: var(--blue); border-color: var(--blue); background: rgba(28,176,246,.12); }
.pro-intro { color: var(--muted); font-weight: 600; margin: 14px 2px 0; line-height: 1.4; }

/* ---------- Círculo das 4 faces (leitura, escuta, fala, escrita) ---------- */
.ring { position: absolute; inset: -11px; width: calc(100% + 22px); height: calc(100% + 22px); pointer-events: none; overflow: visible; }
.ring path { fill: none; stroke-width: 7; stroke-linecap: round; transition: stroke .3s; }
.faces-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 2px 0; font-size: 12.5px; color: var(--muted); font-weight: 700; }
.faces-legend span { display: inline-flex; align-items: center; gap: 5px; }
.faces-legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.path { gap: 30px; }
.start-ring { position: relative; width: 64px; height: 64px; margin: 18px auto 0; border-radius: 50%; }
.end-ring { position: relative; width: 130px; height: 130px; display: grid; place-items: center; font-size: 72px; animation: pop .5s ease; }
.end-ring .ring { inset: 0; width: 100%; height: 100%; }
.end-ring .ring path { stroke-width: 6; }
.face-list { list-style: none; padding: 0; margin: 16px 0 0; width: 100%; max-width: 420px; text-align: left; display: grid; gap: 8px; }
.face-list li { display: grid; grid-template-columns: 14px 1fr; column-gap: 10px; align-items: center; border: 2px solid var(--line); border-radius: 14px; padding: 10px 14px; }
.face-list li.got { border-color: color-mix(in srgb, var(--green) 45%, var(--line)); }
.face-list .dot { width: 12px; height: 12px; border-radius: 50%; grid-row: span 2; }
.face-list b { font-size: 15px; }
.face-list small { color: var(--muted); font-weight: 600; font-size: 13px; }
.face-list em { color: var(--gold); font-style: normal; font-weight: 900; }
.mode-hint { color: var(--muted); font-weight: 600; font-size: 14px; max-width: 460px; margin: 12px auto 0; line-height: 1.45; }

/* ---------- Modos dentro da lição ---------- */
.lesson-head { position: sticky; top: 0; z-index: 5; background: var(--bg); padding-bottom: 8px; }
.lesson-head .lesson-top { position: static; padding-bottom: 8px; }
.modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.mode { background: none; border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 12px; padding: 7px 4px; font-weight: 900; font-size: 14px; color: var(--muted); white-space: nowrap; }
.mode.on[data-mode="listen"] { color: #ce82ff; border-color: #ce82ff; background: rgba(206,130,255,.1); }
.mode.on[data-mode="speak"] { color: var(--orange); border-color: var(--orange); background: rgba(255,150,0,.1); }
.mode.on[data-mode="write"] { color: var(--green); border-color: var(--green); background: rgba(88,204,2,.1); }
.mode.unavailable { opacity: .45; text-decoration: line-through; }

/* ---------- Exercícios de fala e escrita ---------- */
.practice { margin: 14px 0 22px; border: 2px solid var(--line); border-radius: var(--radius); padding: 14px 16px; animation: rise .3s ease; background: rgba(255,255,255,.02); }
.practice.ok { border-color: var(--green); background: rgba(88,204,2,.07); }
.practice.bad { border-color: var(--red); background: rgba(255,75,75,.06); }
.practice.skipped { opacity: .65; }
.pr-head { font-weight: 900; font-size: 16px; margin-bottom: 10px; }
.speak-box .pr-head { color: var(--orange); }
.write-box .pr-head { color: var(--green); }
.pr-said { min-height: 30px; font-size: 19px; line-height: 1.45; padding: 8px 12px; border-radius: 12px; background: rgba(0,0,0,.2); }
.pr-said i { color: var(--muted); }
.pr-said .ph { color: #52656d; font-weight: 600; font-size: 15px; }
.pr-row { display: flex; align-items: center; gap: 14px; margin-top: 12px; }
.mic { width: 56px; height: 56px; flex: none; border-radius: 50%; border: 0; background: var(--orange); font-size: 26px; box-shadow: 0 4px 0 #c76f00; }
.mic.on { animation: micpulse 1s ease-in-out infinite; }
@keyframes micpulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255,150,0,.6), 0 4px 0 #c76f00; } 50% { box-shadow: 0 0 0 12px rgba(255,150,0,0), 0 4px 0 #c76f00; } }
.pr-msg { font-weight: 700; font-size: 15px; color: var(--muted); line-height: 1.45; }
.practice.ok .pr-msg { color: var(--green); }
.practice.bad .pr-msg { color: #ffb4b4; }
.diff { margin-top: 6px; color: var(--text); font-size: 17px; line-height: 1.5; }
.diff mark { background: rgba(255,75,75,.3); color: #fff; border-radius: 4px; padding: 0 3px; }
.pr-tools { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.hint { background: none; border: 2px solid var(--line); border-radius: 10px; color: var(--gold); font-weight: 800; font-size: 13px; padding: 4px 10px; }
.pr-hint { font-family: ui-monospace, Consolas, monospace; letter-spacing: 1px; color: var(--gold); margin: 6px 0; font-size: 15px; }
.pr-src { font-size: 19px; line-height: 2; }
.pr-src.pt-src { color: var(--text); font-weight: 800; }
.pr-pt { color: var(--muted); font-weight: 600; font-size: 15px; margin: 4px 0 8px; }
.blank { font: inherit; font-size: 18px; font-weight: 800; color: var(--text); background: rgba(0,0,0,.25); border: 0; border-bottom: 3px solid var(--blue); border-radius: 6px 6px 0 0; padding: 0 6px; margin: 0 2px; text-align: center; outline: none; }
.blank:focus { background: rgba(28,176,246,.15); }
.blank.right { border-color: var(--green); color: var(--green); }
.blank.wrong { border-color: var(--red); color: var(--red); text-decoration: line-through; }
.fix { color: var(--green); font-weight: 900; font-size: 13px; margin-right: 4px; }
.pr-input { width: 100%; font: inherit; font-size: 18px; font-weight: 700; color: var(--text); background: rgba(0,0,0,.25); border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; resize: vertical; outline: none; margin-top: 8px; }
.pr-input:focus { border-color: var(--blue); }
.footer.bad { background: #3a1a1a; border-color: #3a1a1a; }
.footer.bad .feedback { color: #ff8a8a; }
.btn.skip { margin-left: auto; padding: 14px 18px; }
.btn.skip + .btn.main { margin-left: 0; }
.toast { position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%); z-index: 60; background: var(--text); color: var(--bg); font-weight: 800; padding: 10px 16px; border-radius: 12px; max-width: min(92vw, 440px); text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,.4); transition: opacity .4s; }
.toast.out { opacity: 0; }
@media (max-width: 520px) {
  .mode { font-size: 12.5px; }
  .btn.skip { width: auto; flex: 0 0 auto; }
  .footer-inner .btn.main { flex: 1; width: auto; }
}
.feed.quiz .line .en, .feed.quiz .line .trans { filter: blur(7px); user-select: none; pointer-events: none; transition: filter .25s; }
.feed.quiz .line .pt-toggle { visibility: hidden; }
/* espaço extra embaixo durante o exercício, para a caixa poder subir até o topo da tela */
.feed.quiz { padding-bottom: 100vh; }

/* ícones das 4 faces sobre o círculo da lição */
.ring-ic { position: absolute; width: 24px; height: 24px; margin: -12px 0 0 -12px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; line-height: 1; background: var(--bg); border: 2px solid var(--ring-off); filter: grayscale(1); opacity: .55; z-index: 2; }
.ring-ic.got { border-color: var(--c); filter: none; opacity: 1; }
/* meio de cada parte: 45°, 135°, 225° e 315°, no raio do círculo */
.ring-ic.ic-0 { left: calc(50% + 32px); top: calc(50% - 32px); }
.ring-ic.ic-1 { left: calc(50% + 32px); top: calc(50% + 32px); }
.ring-ic.ic-2 { left: calc(50% - 32px); top: calc(50% + 32px); }
.ring-ic.ic-3 { left: calc(50% - 32px); top: calc(50% - 32px); }
/* ✓ embaixo, para não cobrir os ícones */
.node.done .circle::after { right: auto; left: 50%; bottom: -20px; transform: translateX(-50%); z-index: 3; }
.path { gap: 40px; }
.node .label { margin-top: 14px; }
/* tela final: círculo grande, ícones maiores e espaço para o rodapé fixo */
.end { padding-bottom: 280px; }
.end-ring .ring-ic { width: 32px; height: 32px; margin: -16px 0 0 -16px; font-size: 16px; }
.end-ring .ring-ic.ic-0 { left: calc(50% + 42px); top: calc(50% - 42px); }
.end-ring .ring-ic.ic-1 { left: calc(50% + 42px); top: calc(50% + 42px); }
.end-ring .ring-ic.ic-2 { left: calc(50% - 42px); top: calc(50% + 42px); }
.end-ring .ring-ic.ic-3 { left: calc(50% - 42px); top: calc(50% - 42px); }

/* marcação sutil das palavras divergentes */
.mk { border-bottom: 2px dotted; padding-bottom: 1px; }
.mk sup { font-size: 11px; font-weight: 900; margin-left: 1px; }
.mk.close { border-color: var(--orange); }
.mk.close sup { color: var(--orange); }
.mk.miss { border-color: var(--red); background: rgba(255,75,75,.12); border-radius: 3px 3px 0 0; }
.mk.miss sup { color: var(--red); }
.mk-legend { color: var(--orange); }
.diff small { color: var(--muted); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; margin-right: 4px; }
.diff + .diff { margin-top: 4px; }
.blank.near { border-color: var(--orange); color: var(--orange); }
.fix.near { color: var(--orange); }
.practice.ok .pr-msg .diff { color: var(--text); }

/* ---------- Janela de confirmação do app ---------- */
.dialog-wrap { position: fixed; inset: 0; z-index: 80; background: rgba(5,12,15,.72); display: grid; place-items: end center; padding: 16px; animation: fadein .2s ease; }
@keyframes fadein { from { opacity: 0; } }
.dialog { width: 100%; max-width: 440px; background: var(--panel); border: 2px solid var(--line); border-radius: 22px; padding: 22px 20px 18px; text-align: center; display: grid; gap: 10px; animation: rise .25s ease; margin-bottom: max(8px, env(safe-area-inset-bottom)); }
.dialog-icon img { width: 56px; height: 56px; }
.dialog h2 { margin: 2px 0 0; font-size: 22px; font-weight: 900; }
.dialog p { margin: 0 0 8px; color: var(--muted); font-weight: 600; line-height: 1.45; }
.dialog .btn { width: 100%; margin: 0; }
.btn.danger { color: var(--red); border-color: var(--line); }
@media (min-width: 600px) { .dialog-wrap { place-items: center; } }

/* ---------- Lição salva / retomada ---------- */
.resume-note { margin: 14px auto 0; max-width: 460px; padding: 10px 14px; border-radius: 12px; border: 2px solid var(--blue); color: var(--text); font-weight: 700; font-size: 15px; background: rgba(28,176,246,.08); }
.resume-mark { text-align: center; color: var(--blue); font-weight: 900; font-size: 13px; letter-spacing: .5px; margin: 18px 0 6px; display: flex; align-items: center; gap: 10px; }
.resume-mark::before, .resume-mark::after { content: ""; flex: 1; height: 2px; background: rgba(28,176,246,.35); }
.question.answered { opacity: .75; }
.resume-tag { display: block; font-style: normal; color: var(--blue); font-weight: 900; font-size: 12px; margin-top: 3px; }

/* ---------- Tour guiado (spotlight) ---------- */
.help { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); background: none; color: var(--muted); font-weight: 900; font-size: 15px; line-height: 1; padding: 0; }
.spot-wrap { position: fixed; inset: 0; z-index: 90; }
.spot-wrap.centered { background: rgba(5,12,15,.82); display: grid; place-items: center; padding: 16px; }
.spot-hole { position: fixed; box-shadow: 0 0 0 9999px rgba(5,12,15,.8); border: 2px solid rgba(255,255,255,.85); pointer-events: none; transition: left .3s ease, top .3s ease, width .3s ease, height .3s ease; }
.spot-card { position: fixed; background: var(--panel); border: 2px solid var(--blue); border-radius: 20px; padding: 16px 18px 14px; box-shadow: 0 16px 40px rgba(0,0,0,.5); color: var(--text); transition: left .3s ease, top .3s ease; }
.spot-wrap.centered .spot-card { position: relative; width: min(400px, 100%); text-align: center; }
.spot-card.in { animation: rise .3s ease; }
.spot-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.spot-count { color: var(--blue); font-weight: 900; font-size: 12px; letter-spacing: .5px; text-transform: uppercase; }
.spot-skip { background: none; border: 0; color: var(--muted); font-weight: 800; font-size: 13px; padding: 4px 0; }
.spot-icon { font-size: 44px; line-height: 1.1; margin: 4px 0; }
.spot-title { margin: 2px 0 6px; font-size: 19px; font-weight: 900; }
.spot-text { margin: 0; color: #c8d6dd; font-weight: 600; font-size: 15px; line-height: 1.5; }
.spot-text b { color: var(--text); }
.spot-actions { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.spot-dots { display: flex; gap: 5px; margin-right: auto; }
.spot-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.spot-dots i.on { background: var(--blue); width: 18px; border-radius: 4px; }
.spot-back { background: none; border: 2px solid var(--line); border-radius: 12px; color: var(--muted); font-weight: 900; font-size: 14px; padding: 8px 12px; }
.spot-next { border: 0; border-radius: 12px; background: var(--blue); color: #06202d; font-weight: 900; font-size: 14px; padding: 10px 16px; box-shadow: 0 4px 0 #1899d6; letter-spacing: .3px; }
.spot-wrap.centered .spot-actions { justify-content: center; }

/* ---------- Unidades recolhíveis ---------- */
.unit { margin: 16px 0 8px; scroll-margin-top: 84px; }
.unit.open { margin-bottom: 26px; }
.unit-banner { cursor: pointer; user-select: none; justify-content: flex-start; }
.unit-banner .uh-emoji { font-size: 28px; line-height: 1; flex: none; }
.unit-banner .uh-text { flex: 1; min-width: 0; }
.unit-banner .chev { color: #fff; font-size: 18px; opacity: .85; flex: none; width: 18px; text-align: center; }
.unit-banner .uh-meta { color: #fff; background: rgba(0,0,0,.18); border-radius: 999px; padding: 5px 10px; font-size: 13px; font-weight: 900; white-space: nowrap; flex: none; }
.unit.collapsed .unit-banner { padding: 12px 16px; box-shadow: 0 3px 0 rgba(0,0,0,.25); }
.unit.collapsed .unit-banner h2 { font-size: 17px; }
.unit.collapsed .unit-banner p { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unit-banner:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

/* ---------- Busca de profissões ---------- */
.pro-find { display: flex; gap: 10px; margin: 6px 0 4px; flex-wrap: wrap; }
.pro-search { flex: 1 1 200px; display: flex; align-items: center; gap: 8px; background: var(--panel); border: 2px solid var(--line); border-radius: 14px; padding: 0 12px; }
.pro-search:focus-within { border-color: var(--blue); }
.pro-search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--text); font: inherit; font-size: 16px; padding: 12px 0; }
#pro-pick { flex: 0 1 auto; background: var(--panel); color: var(--text); border: 2px solid var(--line); border-radius: 14px; padding: 12px; font: inherit; font-size: 15px; }
.no-results { text-align: center; color: var(--muted); padding: 24px 0; }
@media (max-width: 520px) {
  .pro-find { flex-wrap: nowrap; }
  .pro-search { flex: 1 1 auto; min-width: 0; }
  .pro-search input { width: 100%; }
  #pro-pick { max-width: 128px; padding: 12px 8px; }
  .unit.open .unit-banner { flex-wrap: wrap; row-gap: 10px; }
  .unit.open .unit-banner .uh-text { flex: 1 1 calc(100% - 80px); }
  .unit.open .unit-banner .guide-btn { margin-left: 40px; padding: 8px 12px; font-size: 13px; }
  .unit.open .unit-banner .chev { margin-left: auto; }
}

/* ---------- Palavras novas ---------- */
:root { --new: #ce82ff; }
.w.new { color: var(--new); border-bottom: 2px solid var(--new); font-weight: 900; }
.new-words { border: 2px solid color-mix(in srgb, var(--new) 55%, var(--line)); background: color-mix(in srgb, var(--new) 9%, transparent); border-radius: var(--radius); padding: 14px 16px; margin: 16px auto 4px; max-width: 460px; text-align: left; }
.nw-title { color: var(--new); font-weight: 900; font-size: 15px; letter-spacing: .3px; margin-bottom: 8px; }
.nw-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.nw-list li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.nw-list li > span { color: var(--muted); font-weight: 600; }
.nw-play { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 2px 0; color: var(--text); }
.nw-play svg { width: 18px; height: 18px; color: var(--new); flex: none; }
.nw-play b { font-size: 17px; }
.nw-note { color: var(--muted); font-weight: 600; font-size: 13px; margin: 10px 0 0; }
.nw-sample { color: var(--new); text-decoration: underline dotted 2px; text-underline-offset: 3px; }
.word-quiz .nw-tag { color: var(--new); font-weight: 900; font-size: 13px; letter-spacing: 1px; margin-bottom: 4px; }
.word-quiz h3 { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.nw-play.big { border: 2px solid color-mix(in srgb, var(--new) 60%, var(--line)); border-radius: 12px; padding: 4px 10px; }
.nw-play.big b { color: var(--new); font-size: 19px; }
.end .new-words { width: 100%; margin: 18px auto 0; }

/* ---------- Nível 0: vocabulário ---------- */
.lv0 small { font-size: 10px; }
.lv-badge.lv-0 { color: var(--gold); border-color: var(--gold); }
.zero-note { margin: 12px 2px 0; color: var(--muted); font-weight: 600; font-size: 14px; line-height: 1.4; }
.zero-note b { color: var(--text); }
.zero-link { display: inline-block; margin: 14px auto 0; color: var(--gold); font-weight: 800; font-size: 14px; text-decoration: none; border: 2px dashed color-mix(in srgb, var(--gold) 50%, var(--line)); border-radius: 12px; padding: 8px 12px; }
.drill-title { font-size: 20px !important; }
.dr-screen { padding: 18px 0 6px; animation: rise .25s ease; }
.dr-tag { color: var(--muted); font-weight: 900; font-size: 13px; letter-spacing: 1px; }
.dr-screen .dr-tag:first-child { color: var(--new); }
.dr-q { font-size: 23px; font-weight: 900; margin: 6px 0 16px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; line-height: 1.3; }
.dr-q:empty { margin: 0 0 8px; }
.dr-card { display: flex; flex-direction: column; align-items: center; gap: 8px; border: 2px solid color-mix(in srgb, var(--new) 55%, var(--line)); background: color-mix(in srgb, var(--new) 8%, transparent); border-radius: 20px; padding: 26px 16px; margin: 10px auto; max-width: 360px; }
.dr-word { font-size: 38px; font-weight: 900; }
.dr-pt { color: var(--muted); font-size: 21px; font-weight: 800; }
.dr-hint { text-align: center; color: var(--muted); font-weight: 600; font-size: 14px; }
.big-speaker { width: 64px; height: 64px; border-radius: 18px; border: 0; background: var(--blue); color: #fff; display: grid; place-items: center; box-shadow: 0 4px 0 #1185bd; flex: none; }
.big-speaker svg { width: 32px; height: 32px; }
.big-speaker.playing { filter: brightness(1.15); }
.dr-listen { display: flex; justify-content: center; margin: 4px 0 18px; }
.dr-listen .big-speaker { width: 96px; height: 96px; border-radius: 24px; }
.dr-listen .big-speaker svg { width: 46px; height: 46px; }
.dr-sentence { display: flex; align-items: center; gap: 14px; margin: 4px 0 8px; }
.dr-sentence .en { font-size: 21px; font-weight: 800; line-height: 1.4; }
.dr-sentence .gap { color: var(--blue); letter-spacing: 2px; }
.dr-pt-line { color: var(--muted); font-weight: 600; margin: 0 0 14px 78px; }
.dr-opts { display: grid; gap: 4px; }
.opt.sel .box { border-color: var(--blue); background: color-mix(in srgb, var(--blue) 25%, transparent); }
.opt.sel { color: var(--blue); }
.dr-bank { margin-top: 6px; }
.dr-line { min-height: 64px; border-top: 2px solid var(--line); border-bottom: 2px solid var(--line); padding: 10px 0; display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; margin-bottom: 22px; }
.dr-tiles { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.tile { background: var(--panel); border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 12px; padding: 9px 14px; font-size: 18px; font-weight: 800; color: var(--text); }
.tile.used { visibility: hidden; }
.tile:disabled { cursor: default; }
.dr-pairs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.dr-pairs .tile { min-height: 56px; }
.dr-pairs .tile.sel { border-color: var(--blue); color: var(--blue); background: color-mix(in srgb, var(--blue) 15%, var(--panel)); }
.dr-pairs .tile.done { opacity: .35; border-color: var(--green); color: var(--green); }
.dr-pairs .tile.bad { border-color: var(--red); color: var(--red); animation: shake .35s; }
.dr-type .write-input { width: 100%; font: inherit; font-size: 19px; color: var(--text); background: var(--panel); border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; resize: none; outline: 0; }
.dr-type .write-input:focus { border-color: var(--blue); }
.footer .feedback small { display: block; font-size: 13px; opacity: .85; }
.feed.drill { padding-bottom: 170px; }

/* ---------- Fala por partes ---------- */
.pr-parts { font-size: 17px; line-height: 1.6; margin: 0 0 10px; }
.pp { color: var(--muted); border-radius: 6px; padding: 1px 3px; }
.pp.cur { color: var(--text); background: color-mix(in srgb, var(--orange) 22%, transparent); font-weight: 900; }
.pp.done { color: var(--green); }
.pp.done::after { content: " ✓"; font-size: 13px; }
.dr-phrase { max-width: 460px; }
.dr-sent { font-size: 24px; font-weight: 900; text-align: center; line-height: 1.4; }
.dr-phrase .dr-pt { font-size: 17px; text-align: center; }

/* ---------- Menu lateral ---------- */
.menu-btn { background: none; border: 0; color: var(--text); font-size: 26px; line-height: 1; padding: 4px 10px 4px 0; margin-right: 4px; }
.topbar .brand { margin-right: auto; }
#drawer { position: fixed; top: 0; bottom: 0; left: 0; z-index: 40; width: 270px; max-width: 84vw; background: var(--bg); border-right: 2px solid var(--line); padding: 18px 14px calc(18px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 6px; transform: translateX(-102%); transition: transform .22s ease; overflow-y: auto; }
.drawer-scrim { position: fixed; inset: 0; z-index: 39; background: rgba(0,0,0,.5); opacity: 0; pointer-events: none; transition: opacity .22s; }
body.drawer-open #drawer { transform: none; }
body.drawer-open .drawer-scrim { opacity: 1; pointer-events: auto; }
.dr-brand { display: flex; align-items: center; gap: 10px; font-size: 26px; font-weight: 900; color: var(--green); padding: 4px 8px 14px; }
.dr-brand img { width: 34px; height: 34px; }
.dr-user { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 14px; text-decoration: none; color: var(--text); margin-bottom: 8px; border: 2px solid var(--line); }
.dr-user b { display: block; font-size: 16px; }
.dr-user small { color: var(--muted); font-weight: 700; }
.dr-item { position: relative; display: flex; align-items: center; gap: 16px; padding: 12px; border-radius: 14px; text-decoration: none; color: var(--text); font-weight: 900; font-size: 15px; letter-spacing: .8px; text-transform: uppercase; border: 2px solid transparent; }
.dr-item:hover { background: var(--panel); }
.dr-item.on { color: var(--blue); background: color-mix(in srgb, var(--blue) 12%, transparent); border-color: color-mix(in srgb, var(--blue) 55%, transparent); }
.dr-ic { font-size: 28px; width: 36px; text-align: center; }
.dr-badge { margin-left: auto; background: var(--red); color: #fff; font-style: normal; font-size: 12px; border-radius: 99px; padding: 2px 8px; letter-spacing: 0; }
.avatar-dot { width: 42px; height: 42px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 24px; flex: none; }
.avatar-dot.xl { width: 96px; height: 96px; font-size: 54px; box-shadow: 0 5px 0 rgba(0,0,0,.25); }
/* telas largas: menu fixo ao lado (some dentro das lições) */
@media (min-width: 1100px) {
  #drawer { transform: none; }
  body:not(.in-lesson) { padding-left: 270px; }
  body:not(.in-lesson) .menu-btn { display: none; }
  body.in-lesson #drawer { transform: translateX(-102%); }
  body.in-lesson.drawer-open #drawer { transform: none; }
  .drawer-scrim { display: none; }
}

/* ---------- Páginas (Praticar, Missões, Perfil) ---------- */
.page-h { font-size: 28px; font-weight: 900; margin: 22px 0 14px; }
.sec-h { font-size: 22px; font-weight: 900; margin: 28px 0 12px; display: flex; align-items: baseline; gap: 10px; }
.sec-h small { color: var(--muted); font-size: 13px; font-weight: 700; }
.page-sub { color: var(--muted); font-weight: 600; line-height: 1.45; }
.page-sub b { color: var(--text); }
.page-foot { color: var(--muted); font-weight: 600; font-size: 14px; text-align: center; padding: 26px 0 50px; }
.page-foot a { color: var(--blue); }
.back-link { color: var(--muted); text-decoration: none; font-weight: 800; display: inline-block; margin: -4px 0 4px; }
.pr-hero, .pr-card { position: relative; display: flex; align-items: stretch; justify-content: space-between; gap: 10px; text-decoration: none; color: var(--text); border-radius: 18px; overflow: hidden; }
.pr-hero { min-height: 190px; padding: 22px 20px; background: linear-gradient(160deg, #0f4a52 0%, #123a7a 50%, #47237a 100%); }
.pr-hero.locked { filter: saturate(.5); }
.pr-text { display: flex; flex-direction: column; gap: 8px; z-index: 1; }
.pr-text b { font-size: 21px; font-weight: 900; }
.pr-text > span { font-weight: 600; line-height: 1.4; }
.pr-go { margin-top: auto; align-self: flex-start; background: #fff; color: #4b2bd6 !important; font-weight: 900 !important; letter-spacing: .6px; border-radius: 12px; padding: 10px 16px; box-shadow: 0 4px 0 #c9c2ee; font-size: 14px; }
.pr-hero.locked .pr-go { background: rgba(255,255,255,.15); color: #fff !important; box-shadow: none; }
.pr-art { font-size: 56px; align-self: center; flex: none; }
.pr-art.big { font-size: 96px; margin-right: -6px; }
.pr-card { border: 2px solid var(--line); border-bottom-width: 4px; padding: 18px; margin-bottom: 14px; align-items: center; overflow: visible; }
.pr-card:hover { background: var(--panel); }
.pr-card .pr-text b { font-size: 18px; }
.pr-card .pr-text > span { color: var(--muted); font-size: 15px; }
.pr-card.muted { opacity: .7; }
.pr-badge { position: absolute; top: -10px; right: -6px; background: var(--red); color: #fff; font-style: normal; font-weight: 900; font-size: 13px; border-radius: 99px; padding: 3px 9px; border: 3px solid var(--bg); }
.btn.wide { display: block; text-align: center; text-decoration: none; margin: 14px 0 6px; }
.word-search { margin: 14px 0 6px; }
.word-list { list-style: none; padding: 0; margin: 10px 0 40px; }
.word-list li { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.word-list li[hidden] { display: none; }
.word-list li > span { color: var(--muted); font-weight: 600; }
.wl-err { margin-left: auto; color: var(--red); font-style: normal; font-weight: 900; border: 2px solid var(--red); border-radius: 50%; width: 22px; height: 22px; display: grid; place-items: center; font-size: 13px; }
/* missões */
.goal-card { display: flex; align-items: center; gap: 18px; border: 2px solid var(--line); border-radius: 18px; padding: 18px; }
.goal-card b { display: block; font-size: 19px; }
.goal-card span { color: var(--muted); font-weight: 700; display: block; margin: 2px 0 6px; }
.goal-card a { color: var(--blue); font-weight: 800; font-size: 14px; }
.goal-ring { width: 76px; height: 76px; border-radius: 50%; flex: none; display: grid; place-items: center; background: conic-gradient(var(--gold) calc(var(--p) * 1%), var(--line) 0); }
.goal-ring span { width: 60px; height: 60px; border-radius: 50%; background: var(--bg); display: grid; place-items: center; font-size: 28px; margin: 0; }
.missions, .achievements { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.missions li, .achievements li { display: flex; align-items: center; gap: 14px; border: 2px solid var(--line); border-radius: 16px; padding: 14px; }
.missions li.done { border-color: color-mix(in srgb, var(--green) 60%, var(--line)); }
.m-ic { font-size: 30px; width: 40px; text-align: center; flex: none; }
.m-body { flex: 1; min-width: 0; }
.m-body b { display: block; font-size: 16px; margin-bottom: 6px; }
.m-body small { display: block; color: var(--muted); font-weight: 700; margin: -2px 0 6px; }
.m-xp { color: var(--gold); font-weight: 900; font-size: 13px; white-space: nowrap; }
.m-bar { position: relative; height: 18px; border-radius: 99px; background: var(--line); overflow: hidden; }
.m-bar i { position: absolute; inset: 0 auto 0 0; background: var(--green); border-radius: 99px; }
.m-bar span { position: relative; display: block; text-align: center; font-size: 12px; font-weight: 900; line-height: 18px; }
.a-ic { position: relative; font-size: 30px; width: 54px; height: 54px; border-radius: 14px; display: grid; place-items: center; background: var(--panel); flex: none; filter: grayscale(1); opacity: .6; }
.achievements li.got .a-ic { filter: none; opacity: 1; background: color-mix(in srgb, var(--gold) 20%, var(--panel)); }
.a-ic em { position: absolute; bottom: -6px; right: -6px; font-style: normal; font-size: 11px; font-weight: 900; background: var(--gold); color: #3a2a00; border-radius: 8px; padding: 1px 5px; }
/* perfil */
.prof-head { display: flex; align-items: center; gap: 18px; margin: 4px 0 18px; }
.prof-head > div { flex: 1; min-width: 0; }
.prof-name { width: 100%; font: inherit; font-size: 24px; font-weight: 900; color: var(--text); background: none; border: 0; border-bottom: 2px dashed var(--line); padding: 4px 0; outline: 0; }
.prof-name:focus { border-bottom-color: var(--blue); }
.prof-head small { color: var(--muted); font-weight: 700; }
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stat-grid div { border: 2px solid var(--line); border-radius: 14px; padding: 12px 10px; }
.stat-grid b { display: block; font-size: 19px; font-weight: 900; }
.stat-grid span { color: var(--muted); font-size: 12px; font-weight: 700; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 8px; }
.pick-grid button { font-size: 26px; height: 50px; border-radius: 12px; background: var(--panel); border: 2px solid var(--line); }
.pick-grid button.on, .goal-row button.on { border-color: var(--blue); background: color-mix(in srgb, var(--blue) 18%, var(--panel)); }
.color-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.color-row button { width: 36px; height: 36px; border-radius: 50%; border: 3px solid transparent; }
.color-row button.on { border-color: #fff; }
.goal-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.goal-row button { text-align: left; background: var(--panel); border: 2px solid var(--line); border-radius: 14px; padding: 12px; }
.goal-row b { display: block; font-size: 16px; }
.goal-row small { color: var(--muted); font-weight: 700; }
.data-row { display: flex; gap: 10px; flex-wrap: wrap; padding-bottom: 50px; }
.data-row .btn { margin-left: 0; font-size: 14px; padding: 12px 16px; cursor: pointer; }
@media (max-width: 420px) { .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
