/* ============================================================
   Lumina — design system
   Tema escuro, glassmorphism, gamificação calma.
   ============================================================ */
:root {
  --bg: #0b1020;
  --bg-2: #0f1530;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-2: rgba(255, 255, 255, 0.07);
  --stroke: rgba(255, 255, 255, 0.10);
  --txt: #eef1fb;
  --txt-dim: #9aa3c4;
  --txt-faint: #6b738f;
  --indigo: #6366f1;
  --violet: #a855f7;
  --pink: #ec4899;
  --green: #10b981;
  --amber: #f59e0b;
  --blue: #3b82f6;
  --red: #f43f5e;
  --grad: linear-gradient(135deg, var(--indigo), var(--violet));
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  --maxw: 560px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(1200px 600px at 50% -10%, #1a2150 0%, var(--bg) 55%) fixed;
  color: var(--txt);
  line-height: 1.5;
  overflow-x: hidden;
}
a { color: var(--violet); }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
h1, h2, h3 { line-height: 1.2; }

#app { max-width: var(--maxw); margin: 0 auto; min-height: 100%; padding: 0 16px calc(96px + var(--safe-b)); }

/* ---------- boot ---------- */
.boot { min-height: 70vh; display: grid; place-content: center; text-align: center; color: var(--txt-dim); gap: 12px; }
.boot-logo { font-size: 56px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: .5; transform: scale(.96);} 50% { opacity: 1; transform: scale(1.04);} }

/* ---------- header ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 22px 4px 14px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .3px; }
.brand .spark { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; font-size: 22px; }
.brand small { display: block; font-weight: 500; color: var(--txt-faint); font-size: 11px; letter-spacing: .5px; text-transform: uppercase; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; background: var(--surface); border: 1px solid var(--stroke); display: grid; place-content: center; font-size: 18px; }

/* ---------- stat chips ---------- */
.stats-row { display: flex; gap: 10px; margin: 6px 0 18px; }
.chip { flex: 1; background: var(--surface); border: 1px solid var(--stroke); border-radius: var(--radius-sm); padding: 12px; text-align: center; }
.chip .v { font-size: 22px; font-weight: 800; }
.chip .l { font-size: 11px; color: var(--txt-faint); text-transform: uppercase; letter-spacing: .5px; }
.chip.flame .v { color: var(--amber); }
.chip.xp .v { color: var(--violet); }
.chip.lvl .v { color: var(--green); }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--stroke); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.card + .card { margin-top: 14px; }
.card h2 { font-size: 17px; margin-bottom: 4px; }
.card .sub { color: var(--txt-dim); font-size: 13px; }

.hero { background: var(--grad); border: none; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; inset: 0; background: radial-gradient(400px 200px at 90% -20%, rgba(255,255,255,.25), transparent 60%); }
.hero h2, .hero p { color: #fff; position: relative; }
.hero .big { font-size: 26px; font-weight: 800; margin: 2px 0 6px; }

/* progress bar */
.bar { height: 10px; border-radius: 999px; background: rgba(255,255,255,.15); overflow: hidden; margin-top: 10px; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: #fff; transition: width .6s cubic-bezier(.2,.8,.2,1); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 15px 18px; border-radius: 14px; font-weight: 700; font-size: 16px; background: var(--grad); color: #fff; transition: transform .08s, filter .2s; box-shadow: 0 8px 24px rgba(99,102,241,.35); }
.btn:active { transform: scale(.98); }
.btn.secondary { background: var(--surface-2); color: var(--txt); box-shadow: none; border: 1px solid var(--stroke); }
.btn.ghost { background: transparent; border: 1px solid var(--stroke); color: var(--txt-dim); box-shadow: none; }
.btn:disabled { opacity: .5; filter: grayscale(.4); }
.btn-row { display: flex; gap: 12px; }

/* ---------- nav (bottom) ---------- */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: center; padding-bottom: var(--safe-b); background: linear-gradient(to top, var(--bg) 60%, transparent); }
.nav-inner { display: flex; gap: 4px; background: rgba(15,21,48,.85); border: 1px solid var(--stroke); border-radius: 18px; padding: 6px; margin: 10px; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: var(--shadow); }
.nav button { display: grid; place-items: center; gap: 2px; width: 76px; padding: 8px 4px; border-radius: 12px; color: var(--txt-faint); font-size: 11px; font-weight: 600; }
.nav button .ic { font-size: 20px; }
.nav button.active { color: #fff; background: var(--surface-2); }

/* ---------- flashcard 3D ---------- */
.flash-wrap { perspective: 1400px; margin: 8px 0 18px; }
.flash { position: relative; width: 100%; min-height: 230px; transform-style: preserve-3d; transition: transform .5s cubic-bezier(.2,.8,.2,1); cursor: pointer; }
.flash.flip { transform: rotateY(180deg); }
.flash .face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: var(--radius); border: 1px solid var(--stroke); padding: 24px; display: grid; place-content: center; text-align: center; }
.flash .front { background: var(--surface); }
.flash .back { background: linear-gradient(160deg, rgba(99,102,241,.18), rgba(168,85,247,.12)); transform: rotateY(180deg); }
.flash .tag { position: absolute; top: 14px; left: 16px; font-size: 11px; color: var(--txt-faint); text-transform: uppercase; letter-spacing: .5px; }
.flash .q { font-size: 19px; font-weight: 600; }
.flash .a { font-size: 17px; color: var(--txt); }
.flash .hint { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; font-size: 12px; color: var(--txt-faint); }

.judge-row { display: flex; gap: 12px; }
.judge { flex: 1; padding: 16px; border-radius: 14px; font-weight: 800; font-size: 16px; border: 1px solid var(--stroke); }
.judge.no { background: rgba(244,63,94,.14); color: #ff8da3; }
.judge.yes { background: rgba(16,185,129,.16); color: #46e3b0; }
.judge:active { transform: scale(.97); }

/* ---------- concept / markdown ---------- */
.prose { font-size: 15.5px; color: var(--txt); }
.prose h2 { font-size: 18px; margin: 18px 0 8px; }
.prose p { margin: 10px 0; color: #dfe3f5; }
.prose ul { margin: 8px 0 8px 20px; }
.prose li { margin: 4px 0; color: #dfe3f5; }
.prose strong { color: #fff; }
.prose code { background: rgba(255,255,255,.08); padding: 1px 6px; border-radius: 6px; font-size: 14px; }
.prose blockquote { border-left: 3px solid var(--violet); padding: 6px 12px; margin: 10px 0; background: var(--surface); border-radius: 8px; color: var(--txt-dim); }
.prose table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 14px; }
.prose th, .prose td { border: 1px solid var(--stroke); padding: 7px 10px; text-align: left; }
.prose th { background: var(--surface-2); }
.prose pre { background: rgba(0,0,0,.3); border: 1px solid var(--stroke); border-radius: 10px; padding: 12px; overflow-x: auto; font-size: 13px; margin: 10px 0; }

/* ---------- step header ---------- */
.step { display: flex; align-items: center; gap: 10px; margin: 14px 2px; }
.step .num { width: 30px; height: 30px; border-radius: 9px; background: var(--grad); display: grid; place-content: center; font-weight: 800; font-size: 14px; }
.step .t { font-weight: 700; }
.step .t small { display: block; color: var(--txt-faint); font-weight: 500; font-size: 12px; }
.progress-dots { display: flex; gap: 6px; justify-content: center; margin: 10px 0; }
.progress-dots i { width: 8px; height: 8px; border-radius: 999px; background: var(--stroke); }
.progress-dots i.on { background: var(--violet); }
.progress-dots i.done { background: var(--green); }

/* ---------- feynman / mic ---------- */
.mic-wrap { display: grid; place-items: center; gap: 14px; padding: 10px 0; }
.mic { width: 96px; height: 96px; border-radius: 999px; background: var(--grad); display: grid; place-content: center; font-size: 38px; box-shadow: 0 10px 30px rgba(168,85,247,.45); }
.mic.rec { animation: ring 1.2s ease-out infinite; }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(236,72,153,.5);} 100% { box-shadow: 0 0 0 28px rgba(236,72,153,0);} }
.transcript { width: 100%; min-height: 110px; background: var(--surface); border: 1px solid var(--stroke); border-radius: 12px; padding: 14px; color: var(--txt); font-size: 15px; resize: vertical; }
.score-row { display: flex; gap: 8px; justify-content: center; }
.score-row button { width: 46px; height: 46px; border-radius: 12px; border: 1px solid var(--stroke); background: var(--surface); font-weight: 800; }
.score-row button.on { background: var(--grad); color: #fff; }

/* ---------- tree ---------- */
.area-block { margin-bottom: 22px; }
.area-head { display: flex; align-items: center; gap: 10px; margin: 12px 2px; font-weight: 800; }
.area-head .dot { width: 14px; height: 14px; border-radius: 5px; }
.node { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-radius: 14px; border: 1px solid var(--stroke); background: var(--surface); margin: 8px 0; }
.node .st { width: 34px; height: 34px; border-radius: 10px; display: grid; place-content: center; font-size: 17px; flex: none; background: var(--surface-2); }
.node.dominado .st { background: rgba(16,185,129,.2); }
.node.progresso .st { background: rgba(245,158,11,.2); }
.node.bloqueado { opacity: .5; }
.node .body { flex: 1; min-width: 0; }
.node .body .ti { font-weight: 600; font-size: 14.5px; }
.node .body .me { font-size: 12px; color: var(--txt-faint); }
.node .arrow { color: var(--txt-faint); }

/* ---------- heatmap ---------- */
.heat { display: grid; grid-template-columns: repeat(auto-fill, 14px); gap: 4px; }
.heat i { width: 14px; height: 14px; border-radius: 4px; background: var(--surface-2); }
.heat i.l1 { background: rgba(99,102,241,.35); }
.heat i.l2 { background: rgba(99,102,241,.6); }
.heat i.l3 { background: rgba(168,85,247,.85); }
.heat i.l4 { background: var(--violet); }

/* ---------- login ---------- */
.login { min-height: 88vh; display: grid; place-content: center; text-align: center; gap: 8px; }
.login .logo { font-size: 64px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login h1 { font-size: 28px; }
.login p { color: var(--txt-dim); margin-bottom: 20px; }
.field { width: 100%; padding: 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--stroke); color: var(--txt); font-size: 17px; text-align: center; letter-spacing: 1px; }
.field:focus { outline: 2px solid var(--violet); }
.muted { color: var(--txt-faint); font-size: 12px; }

/* ---------- misc ---------- */
.center { text-align: center; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--surface-2); border: 1px solid var(--stroke); color: var(--txt-dim); }
.pill.green { background: rgba(16,185,129,.15); color: #46e3b0; border-color: transparent; }
.pill.amber { background: rgba(245,158,11,.15); color: #ffce7a; border-color: transparent; }
.empty { text-align: center; color: var(--txt-faint); padding: 30px 10px; }
.empty .em { font-size: 40px; }

.toast { position: fixed; left: 50%; bottom: calc(100px + var(--safe-b)); transform: translateX(-50%) translateY(20px); background: #1b2247; border: 1px solid var(--stroke); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: all .3s; z-index: 50; box-shadow: var(--shadow); max-width: 90%; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* XP burst */
.burst { position: fixed; inset: 0; display: grid; place-content: center; pointer-events: none; z-index: 60; }
.burst .xp { font-size: 64px; font-weight: 900; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; animation: rise 1.4s ease-out forwards; }
@keyframes rise { 0% { transform: translateY(20px) scale(.6); opacity: 0;} 30% { opacity: 1;} 100% { transform: translateY(-60px) scale(1.1); opacity: 0;} }

@media (min-width: 600px) { .nav-inner button { width: 92px; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
