/* LingoMap PWA — telas do app (mobile-first 390px, moldura no desktop) */
body.app-body { min-height: 100vh; min-height: 100dvh; }
.app-frame { position: relative; max-width: 430px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; background: var(--bg); }
.view { padding: calc(14px + env(safe-area-inset-top)) 18px calc(100px + env(safe-area-inset-bottom)); }
body.immersive .view { padding-bottom: calc(32px + env(safe-area-inset-bottom)); }

@media (min-width: 600px) {
  body.app-body { background: radial-gradient(circle at 20% 10%, #E0E7FF 0, transparent 40%), radial-gradient(circle at 85% 90%, #D1FAE5 0, transparent 40%), #EEF0F7; padding: 28px 0; }
  .app-frame { min-height: calc(100vh - 56px); border-radius: 36px; box-shadow: 0 30px 80px rgba(30, 41, 59, .18), 0 0 0 10px #fff; overflow: hidden; }
  .tabbar { border-radius: 0 0 36px 36px; }
}

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 430px; z-index: 20;
  display: grid; grid-template-columns: repeat(3, 1fr); background: rgba(255, 255, 255, .94); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
@media (min-width: 600px) { .tabbar { bottom: 28px; } }
body.immersive .tabbar { display: none; }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px; font-size: .72rem; font-weight: 700; color: var(--ink-3); border-radius: 12px; }
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a.active { color: var(--primary); }

/* ---------- topo ---------- */
.topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.icon-btn { flex: none; width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.icon-btn svg { width: 22px; height: 22px; }
.topbar-title { min-width: 0; }
.topbar-title h1 { font-size: 1.15rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title p { font-size: .8rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- home ---------- */
.home-head { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 16px; }
.eyebrow { color: var(--ink-2); font-weight: 600; }
.home-head h1 { font-size: 1.75rem; font-weight: 850; }
.streak { display: flex; align-items: center; gap: 4px; padding: 8px 14px 8px 10px; border-radius: 999px; background: #fff; box-shadow: var(--shadow); color: var(--ink-3); }
.streak .flame svg, .streak-big .flame svg { width: 24px; height: 24px; }
.streak strong { font-size: 1.15rem; color: var(--ink); }
.streak.lit { background: linear-gradient(135deg, #FFF7ED, #FEF3C7); color: var(--gold); }
.streak.lit .flame { animation: flicker 1.8s ease-in-out infinite; transform-origin: bottom center; }
@keyframes flicker { 0%, 100% { transform: scale(1) rotate(0); } 50% { transform: scale(1.08) rotate(-3deg); } }
.hero-progress { display: grid; gap: 10px; margin-bottom: 14px; }
.hero-progress strong { font-size: 1.2rem; color: var(--primary); }
.review-cta { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; color: var(--ink); background: linear-gradient(135deg, #4F46E5, #7C3AED); color: #fff; }
.review-cta strong { display: block; font-size: 1.05rem; }
.review-cta small { opacity: .9; }
.review-ico { width: 46px; height: 46px; border-radius: 14px; display: flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, .18); flex: none; }
.review-ico svg { width: 24px; height: 24px; }
.chev { margin-left: auto; font-size: 1.6rem; opacity: .6; }

.install { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 14px; border-radius: var(--radius); background: #fff; border: 1.5px dashed #C7D2FE; position: relative; }
.install strong { display: block; font-size: .95rem; }
.install small { display: block; color: var(--ink-2); font-size: .8rem; line-height: 1.3; }
.install .btn { margin-left: auto; flex: none; }
.install-x { position: absolute; top: 2px; right: 6px; border: 0; background: none; color: var(--ink-3); font-size: 1.1rem; cursor: pointer; }

.section-title { font-size: 1.05rem; font-weight: 800; margin: 20px 2px 12px; }
.shelf { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.book { display: flex; flex-direction: column; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; color: var(--ink); transition: transform .15s var(--ease); }
.book:active { transform: scale(.98); }
.cover { position: relative; aspect-ratio: 3 / 4; background: #E0E7FF; }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.book-body { display: flex; flex-direction: column; gap: 8px; padding: 12px; flex: 1; }
.book-body h3 { font-size: .95rem; font-weight: 800; }
.kind { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.pct { font-weight: 800; color: var(--primary); }
.book-body .btn { margin-top: auto; }
.book.locked .cover img { filter: grayscale(.55) blur(1.5px) brightness(.9); }
.lock-badge { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 54px; height: 54px; border-radius: 50%; background: rgba(30, 41, 59, .82); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 24px rgba(0,0,0,.25); backdrop-filter: blur(4px); }
.lock-badge svg { width: 24px; height: 24px; }
.preview { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.preview li { font-size: .75rem; color: var(--ink-2); padding-left: 14px; position: relative; line-height: 1.3; }
.preview li::before { content: ""; position: absolute; left: 2px; top: .45em; width: 6px; height: 6px; border-radius: 50%; background: var(--line); }

/* ---------- módulo ---------- */
.module-hero { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; }
.module-hero > div { flex: 1; display: grid; gap: 6px; }
.module-cover { width: 76px; border-radius: 12px; box-shadow: var(--shadow); }
.big { font-size: 1.6rem; color: var(--primary); }
.lessons { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.lesson { display: flex; align-items: center; gap: 14px; padding: 14px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); color: var(--ink); }
.lesson .num { flex: none; width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-weight: 800; color: #fff; background: var(--lc, var(--primary)); }
.lesson .num svg { width: 20px; height: 20px; }
.lesson.done .num { background: var(--ok); }
.lesson-txt { min-width: 0; display: grid; }
.lesson-txt strong { font-size: .98rem; }
.lesson-txt small { color: var(--ink-2); font-size: .8rem; }
.lesson .score { margin-left: auto; font-weight: 800; color: var(--ok); font-size: .9rem; }

/* ---------- mapa ---------- */
.map-intro { color: var(--ink-2); text-align: center; margin: -4px 8px 4px; font-size: .95rem; }
.explore-count { text-align: center; color: var(--ink-2); font-size: .9rem; margin: 4px 0 14px; }
.explore-count .ok { color: var(--ok); }
.map-actions { display: grid; gap: 6px; }

/* ---------- quiz ---------- */
.quiz-dots { display: flex; gap: 6px; margin-bottom: 14px; }
.quiz-dots span { flex: 1; height: 6px; border-radius: 9px; background: #E2E8F0; }
.quiz-dots span.done { background: var(--ok); }
.quiz-dots span.now { background: var(--primary); }
.quiz-card { display: grid; gap: 14px; }
.quiz-q { font-size: 1.35rem; font-weight: 800; }
.options { display: grid; gap: 10px; }
.option { text-align: left; padding: 15px 16px; border-radius: 14px; border: 2px solid var(--line); background: #fff; font-weight: 700; font-size: 1.02rem; cursor: pointer; transition: border-color .15s, background .2s, transform .1s; }
.option:active { transform: scale(.985); }
.option:hover:not(:disabled) { border-color: #C7D2FE; }
.option.right { border-color: var(--ok); background: var(--ok-soft); color: #065F46; }
.option.wrong { border-color: #FDA4AF; background: var(--no-soft); color: #9F1239; animation: shake .35s; }
.option:disabled { cursor: default; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.quiz-next { margin-top: 16px; }

/* ---------- celebração ---------- */
.celebrate { text-align: center; padding: 40px 6px; display: grid; gap: 12px; justify-items: center; }
.celebrate .stack { width: 100%; margin-top: 14px; }
.medal { font-size: 4rem; animation: bounceIn .7s var(--ease); }
.celebrate h1 { font-size: 1.8rem; font-weight: 850; }
.score-line { font-size: 1.1rem; }
.streak-big { display: inline-flex; align-items: center; gap: 6px; color: #B45309; background: var(--gold-soft); padding: 8px 16px; border-radius: 99px; font-weight: 600; }
.streak-big:empty { display: none; }
.streak-big .flame { color: var(--gold); }
@keyframes bounceIn { 0% { transform: scale(.3); opacity: 0; } 60% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); } }
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 60; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translate(var(--drift), 105vh) rotate(var(--spin)); opacity: .9; } }

/* ---------- flashcards ---------- */
.flip-wrap { perspective: 1200px; margin: 16px 0 12px; }
.flip { position: relative; display: block; width: 100%; aspect-ratio: 4 / 3.6; border: 0; padding: 0; background: none; cursor: pointer; transform-style: preserve-3d; transition: transform .6s var(--ease); }
.flip.flipped { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 24px; padding: 22px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; box-shadow: var(--shadow-lg); }
.face.front { background: #fff; border: 1px solid var(--line); }
.face.back { background: linear-gradient(160deg, #4F46E5, #6D28D9); color: #fff; transform: rotateY(180deg); }
.face-label { position: absolute; top: 16px; left: 18px; font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; opacity: .55; }
.face-main { font-size: 1.6rem; font-weight: 850; line-height: 1.2; }
.face-sub { font-size: .98rem; opacity: .75; }
.face-en { font-size: .85rem; opacity: .7; margin-top: 6px; padding: 4px 12px; border-radius: 99px; background: rgba(255, 255, 255, .15); }
.tap-hint { position: absolute; bottom: 14px; font-size: .75rem; color: var(--ink-3); }
.card-audio { margin-bottom: 14px; }
.grades { animation: rise .25s var(--ease); }
.grade-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.grade { display: grid; gap: 2px; padding: 12px 6px; border-radius: 14px; border: 2px solid transparent; cursor: pointer; text-align: center; transition: transform .1s; }
.grade:active { transform: scale(.96); }
.grade small { font-size: .72rem; opacity: .75; }
.grade.again { background: var(--no-soft); color: #BE123C; border-color: #FECDD3; }
.grade.hard { background: var(--gold-soft); color: #B45309; border-color: #FDE68A; }
.grade.easy { background: var(--ok-soft); color: #047857; border-color: #A7F3D0; }

/* ---------- exercícios ---------- */
.ex-card { display: grid; gap: 14px; margin-top: 14px; }
.ex-sentence { font-size: 1.35rem; font-weight: 750; line-height: 1.6; }
.ex-translation { font-size: 1.1rem; font-weight: 700; color: var(--ink-2); }
.gap { display: inline-block; min-width: 76px; padding: 0 10px; margin: 0 4px; border-bottom: 3px solid var(--primary); color: var(--primary); text-align: center; }
.gap.filled { animation: pop2 .25s var(--ease); }
.gap.right { color: #047857; border-color: var(--ok); background: var(--ok-soft); border-radius: 8px 8px 0 0; }
.gap.wrong { color: #BE123C; border-color: var(--no); background: var(--no-soft); border-radius: 8px 8px 0 0; }
@keyframes pop2 { from { transform: scale(.8); } to { transform: scale(1); } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 10px 16px; border-radius: 12px; border: 2px solid var(--line); border-bottom-width: 4px; background: #fff; font-weight: 750; font-size: 1.02rem; cursor: pointer; transition: transform .1s, opacity .2s; }
.chip:active { transform: translateY(2px); }
.chip.picked { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.chip.used { opacity: .25; pointer-events: none; }
.chip:disabled { cursor: default; }
.answer-line { min-height: 62px; display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; padding: 10px 4px; border-bottom: 2px solid var(--line); border-top: 2px solid var(--line); }
.answer-line.right { border-color: var(--ok); background: var(--ok-soft); }
.answer-line.wrong { border-color: #FDA4AF; background: var(--no-soft); }
.chip.in { animation: pop2 .2s var(--ease); }

/* ---------- vários ---------- */
.page-head { margin: 8px 0 16px; }
.page-head h1 { font-size: 1.7rem; font-weight: 850; }
.h3 { font-size: 1.05rem; font-weight: 800; }
section.card + section.card, form.card + section.card { margin-top: 14px; }
.empty { text-align: center; padding: 48px 12px; display: grid; gap: 12px; justify-items: center; }
.empty-ico { font-size: 3rem; }
.skeleton { display: grid; gap: 14px; padding-top: 12px; }
.skeleton div { height: 90px; border-radius: var(--radius); background: linear-gradient(90deg, #EEF0F6 25%, #F7F8FC 50%, #EEF0F6 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.skeleton div:first-child { height: 48px; width: 60%; }
@keyframes shimmer { to { background-position: -200% 0; } }
.login { text-align: center; padding: 40px 6px; display: grid; gap: 14px; }
.login form { text-align: left; }
.login-logo { margin: 0 auto; border-radius: 20px; box-shadow: var(--shadow); }
.login h1 { font-size: 1.6rem; font-weight: 850; }
#toast { position: fixed; left: 50%; bottom: 96px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 99px; font-size: .9rem; opacity: 0; transition: .25s var(--ease); z-index: 70; pointer-events: none; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.sticky { pointer-events: auto; display: flex; align-items: center; gap: 10px; border-radius: 16px; width: max-content; max-width: 92vw; }
.ex-prompt { font-size: 1.25rem; font-weight: 750; line-height: 1.45; }
