/* ===========================================================
   MathUP — profissional + divertido
   Roxo escuro como âncora séria, fundo claro arejado,
   microinterações e recompensas pra dar leveza.
   =========================================================== */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --roxo: #6D28D9;        /* primário (roxo escuro vibrante) */
  --roxo-d: #5B21B6;      /* roxo mais escuro */
  --roxo-dd: #4C1D95;     /* profundo (headers/destaques) */
  --roxo-soft: #F3EEFF;   /* fundo suave roxo */
  --lima: #16C784;        /* acerto/sucesso */
  --lima-soft: #E3FAF0;
  --coral: #F2547D;       /* erro */
  --coral-soft: #FDE7EE;
  --ambar: #FFB020;       /* recompensa/streak */
  --tinta: #1A1626;       /* texto principal */
  --tinta-2: #6B6680;     /* texto secundário */
  --bg: #FAFAFC;          /* fundo geral */
  --card: #FFFFFF;
  --linha: #ECEAF3;
  --r: 16px;
  --r-lg: 22px;
  --sombra: 0 1px 3px rgba(26,22,38,.06), 0 8px 24px -12px rgba(109,40,217,.14);
  --sombra-hover: 0 4px 8px rgba(26,22,38,.08), 0 16px 36px -14px rgba(109,40,217,.24);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--tinta);
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif; font-weight: 500;
  -webkit-font-smoothing: antialiased;
}
.app { max-width: 700px; margin: 0 auto; padding: 22px 18px 100px; }

/* topo */
.top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: var(--tinta); }
.brand .mascote {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--roxo), var(--roxo-dd));
  color: #fff; font-size: 22px; font-weight: 800;
  box-shadow: 0 4px 12px -2px rgba(109,40,217,.5);
}
.brand b { font-size: 21px; font-weight: 800; letter-spacing: -.4px; }
.linkmut { color: var(--tinta-2); font-weight: 700; font-size: 14px; text-decoration: none; cursor: pointer; background: none; border: 0; padding: 8px 10px; border-radius: 10px; transition: background .15s; }
.linkmut:hover { background: var(--roxo-soft); color: var(--roxo); }

/* títulos */
h1 { font-size: clamp(26px, 6vw, 36px); line-height: 1.1; margin: 0 0 10px; font-weight: 800; letter-spacing: -.8px; }
h1 .hl { color: var(--roxo); }
.lead { font-size: 15.5px; color: var(--tinta-2); line-height: 1.55; font-weight: 500; max-width: 52ch; }
.eyebrow { font-size: 11.5px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; color: var(--roxo); margin: 0 0 9px; }

/* botões */
.btn {
  font-family: inherit; font-weight: 700; font-size: 15.5px; border: 0; border-radius: 14px;
  padding: 14px 24px; cursor: pointer; transition: transform .12s, box-shadow .15s, filter .15s;
  color: #fff;
}
.btn:active { transform: scale(.97); }
.btn-roxo { background: var(--roxo); box-shadow: 0 6px 16px -4px rgba(109,40,217,.5); }
.btn-roxo:hover { filter: brightness(1.08); box-shadow: 0 8px 22px -4px rgba(109,40,217,.6); }
.btn-lima { background: var(--lima); box-shadow: 0 6px 16px -4px rgba(22,199,132,.5); }
.btn-lima:hover { filter: brightness(1.06); }
.btn-ghost { background: #fff; color: var(--tinta); box-shadow: 0 0 0 1.5px var(--linha) inset; }
.btn-ghost:hover { box-shadow: 0 0 0 1.5px var(--roxo) inset; color: var(--roxo); }
.full { width: 100%; }

/* cartão */
.card { background: var(--card); border-radius: var(--r-lg); padding: 24px; box-shadow: var(--sombra); }

/* campos */
.field { display: block; margin: 0 0 15px; }
.field span { display: block; font-weight: 700; font-size: 13px; margin-bottom: 7px; color: var(--tinta); }
.field input {
  width: 100%; padding: 14px 16px; font-size: 16px; font-family: inherit; font-weight: 500;
  border: 1.5px solid var(--linha); border-radius: 12px; background: #fff; color: var(--tinta);
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus { outline: none; border-color: var(--roxo); box-shadow: 0 0 0 4px var(--roxo-soft); }

/* streak / status pill */
.statusbar { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; gap: 7px; background: #fff; border-radius: 12px;
  padding: 9px 14px; font-weight: 800; font-size: 14px; box-shadow: var(--sombra); color: var(--tinta);
}
.pill .v { color: var(--roxo); }
.pill.fire .v { color: var(--ambar); }

/* dashboard: assuntos */
.dom { display: grid; gap: 11px; margin: 20px 0; }
.dom-row {
  display: flex; align-items: center; gap: 14px; background: var(--card); border-radius: var(--r);
  padding: 15px 17px; cursor: pointer; border: 1.5px solid transparent; text-align: left; width: 100%;
  font-family: inherit; box-shadow: var(--sombra); transition: transform .14s, box-shadow .14s, border-color .14s;
}
.dom-row:hover { transform: translateY(-2px); box-shadow: var(--sombra-hover); border-color: var(--roxo-soft); }
.dom-ico { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; font-size: 21px; flex-shrink: 0; color: #fff; }
.dom-mid { flex: 1; min-width: 0; }
.dom-nome { font-weight: 700; font-size: 15.5px; color: var(--tinta); }
.dom-sub { font-size: 12.5px; color: var(--tinta-2); font-weight: 500; margin-top: 1px; }
.dom-track { height: 8px; background: var(--linha); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.dom-fill { height: 100%; border-radius: 99px; display: block; background: var(--lima); transition: width .5s; }
.dom-fill.fraco { background: var(--ambar); }
.dom-fill.zero { background: var(--linha); }
.dom-pct { font-weight: 800; font-size: 15px; color: var(--roxo); flex-shrink: 0; min-width: 38px; text-align: right; }

/* seletor de modo */
.modos-praticar { display: grid; gap: 13px; margin: 22px 0; }
.modo-card {
  display: flex; align-items: center; gap: 16px; background: var(--card); border: 1.5px solid var(--linha);
  border-radius: var(--r-lg); padding: 20px; cursor: pointer; text-align: left; width: 100%;
  font-family: inherit; box-shadow: var(--sombra); transition: transform .14s, box-shadow .14s, border-color .14s;
}
.modo-card:hover { transform: translateY(-3px); box-shadow: var(--sombra-hover); border-color: var(--roxo); }
.modo-emoji { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; font-size: 28px; flex-shrink: 0; }
.modo-info b { display: block; font-size: 17px; font-weight: 800; color: var(--tinta); margin-bottom: 3px; }
.modo-info small { color: var(--tinta-2); font-weight: 500; font-size: 13.5px; line-height: 1.45; }

/* quiz */
.qtag { display:inline-block; font-weight: 800; font-size: 12px; letter-spacing: .6px; text-transform: uppercase; color: var(--roxo); background: var(--roxo-soft); padding: 6px 12px; border-radius: 8px; margin: 0 0 16px; }
.qtext { font-size: 17.5px; line-height: 1.55; margin: 0 0 22px; color: var(--tinta); font-weight: 500; }
.qtext p { margin: 0 0 12px; }
.qimg { display: block; max-width: 100%; height: auto; margin: 14px auto; border-radius: 12px; background: #fff; border: 1.5px solid var(--linha); padding: 6px; }
.opts { display: grid; gap: 11px; }
.opt {
  display: flex; align-items: flex-start; gap: 13px; text-align: left; background: var(--card);
  border: 1.5px solid var(--linha); border-radius: var(--r); padding: 15px 16px; font-family: inherit;
  font-weight: 600; font-size: 15.5px; cursor: pointer; color: var(--tinta); transition: all .14s;
}
.opt:hover { border-color: var(--roxo); background: var(--roxo-soft); transform: translateX(2px); }
.opt .l { width: 28px; height: 28px; border-radius: 8px; background: var(--roxo-soft); display: grid; place-items: center; font-weight: 800; color: var(--roxo); flex-shrink: 0; font-size: 14px; }
.opt-corpo { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; padding-top: 2px; }
.optimg { max-width: 220px; max-height: 160px; height: auto; border-radius: 10px; border: 1.5px solid var(--linha); background: #fff; padding: 4px; }
.opt.ok { background: var(--lima-soft); border-color: var(--lima); }
.opt.ok .l { background: var(--lima); color: #fff; }
.opt.no { background: var(--coral-soft); border-color: var(--coral); }
.opt.no .l { background: var(--coral); color: #fff; }
.semimg { color: var(--tinta-2); font-style: italic; }

/* tutor */
.tutor {
  margin-top: 18px; background: var(--roxo-soft); border-radius: var(--r); padding: 18px 20px;
  font-size: 15px; line-height: 1.6; white-space: pre-line; font-weight: 500; color: var(--tinta);
  border-left: 4px solid var(--roxo);
}
.tutor b { color: var(--roxo-d); font-weight: 800; }
.tutor.acerto { background: var(--lima-soft); border-left-color: var(--lima); }
.tutor.acerto b { color: var(--lima); }

/* barra de progresso */
.bar { height: 10px; background: var(--linha); border-radius: 99px; overflow: hidden; margin-bottom: 24px; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--roxo), var(--lima)); border-radius: 99px; transition: width .5s; }

.muted { color: var(--tinta-2); font-weight: 600; text-align: center; margin-top: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.aviso { color: var(--coral); font-weight: 700; margin-top: 12px; min-height: 18px; font-size: 14px; }

/* animações de leveza */
@keyframes pop { 0%{transform:scale(.96);opacity:0} 100%{transform:scale(1);opacity:1} }
.celebra { animation: pop .35s ease; }
@keyframes bounce { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-6px)} }
.bounce { animation: bounce .5s ease; }

@media (max-width: 480px) {
  .card { padding: 18px; }
  .modo-card { padding: 16px; }
}

/* ---- estado selecionado do card de modo (dashboard) ---- */
.modo-card { position: relative; }
.modo-card .modo-check {
  position: absolute; top: 14px; right: 16px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--linha); color: transparent; display: grid; place-items: center;
  font-weight: 800; font-size: 13px; transition: all .15s;
}
.modo-card.sel { border-color: var(--roxo); box-shadow: 0 0 0 1.5px var(--roxo), var(--sombra); }
.modo-card.sel .modo-check { background: var(--roxo); color: #fff; }
.modo-info em { color: var(--ambar); font-style: normal; font-weight: 700; font-size: 12px; }

/* ================= LOUSA DE RASCUNHO ================= */
.lousa-fab {
  position: fixed; bottom: 22px; right: 22px; z-index: 40;
  display: flex; align-items: center; gap: 7px;
  background: var(--roxo); color: #fff; border: 0; border-radius: 16px;
  padding: 14px 20px; font-family: inherit; font-weight: 700; font-size: 15px; cursor: pointer;
  box-shadow: 0 8px 24px -6px rgba(109,40,217,.6); transition: transform .12s, filter .15s;
}
.lousa-fab:hover { filter: brightness(1.08); transform: translateY(-2px); }
.lousa-fab:active { transform: scale(.96); }

.lousa-panel {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  height: 60vh; background: #fff; border-radius: 24px 24px 0 0;
  box-shadow: 0 -10px 40px -10px rgba(26,22,38,.3);
  transform: translateY(100%); transition: transform .28s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column;
}
.lousa-panel.aberta { transform: translateY(0); }

.lousa-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1.5px solid var(--linha); flex-shrink: 0;
}
.lousa-titulo { font-weight: 800; font-size: 15px; color: var(--tinta); }
.lousa-tools { display: flex; gap: 8px; align-items: center; }
.lt {
  width: 38px; height: 38px; border-radius: 11px; border: 1.5px solid var(--linha);
  background: #fff; cursor: pointer; display: grid; place-items: center; font-size: 17px;
  transition: all .12s; padding: 0;
}
.lt:hover { border-color: var(--roxo); }
.lt.ativo { border-color: var(--roxo); box-shadow: 0 0 0 1.5px var(--roxo); }
.lt span { width: 18px; height: 18px; border-radius: 50%; display: block; }
.lt.fechar { font-size: 14px; color: var(--tinta-2); }

#lousaCanvas {
  flex: 1; width: 100%; touch-action: none; cursor: crosshair;
  background:
    linear-gradient(var(--linha) 1px, transparent 1px) 0 0 / 100% 28px,
    #fff;
  border-radius: 0 0 24px 24px;
}
@media (min-width: 760px) {
  .lousa-panel { left: auto; right: 22px; bottom: 22px; width: 440px; height: 520px; border-radius: 20px; }
}

/* select estilizado (páginas de admin) */
.sel-input {
  width: 100%; padding: 14px 16px; font-size: 15px; font-family: inherit; font-weight: 600;
  border: 1.5px solid var(--linha); border-radius: 12px; background: #fff; color: var(--tinta);
  cursor: pointer;
}
.sel-input:focus { outline: none; border-color: var(--roxo); box-shadow: 0 0 0 4px var(--roxo-soft); }

/* ---- seletor de nível de dificuldade ---- */
.niveis { display: flex; gap: 7px; margin: 0 0 18px; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.nivel {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: #fff; border: 1.5px solid var(--linha); border-radius: 13px; padding: 9px 13px;
  cursor: pointer; font-family: inherit; transition: all .14s; min-width: 64px;
}
.nivel:hover { border-color: var(--roxo); }
.nivel.on { border-color: var(--roxo); background: var(--roxo-soft); box-shadow: 0 0 0 1.5px var(--roxo); }
.nivel-emoji { font-size: 19px; }
.nivel-nome { font-size: 11.5px; font-weight: 700; color: var(--tinta-2); }
.nivel.on .nivel-nome { color: var(--roxo); }

/* rodapé de versão (discreto) */
.versao-rodape {
  position: fixed; bottom: 8px; left: 10px; z-index: 5;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif; font-size: 11px; font-weight: 600;
  color: var(--tinta-2); opacity: .55; user-select: none;
}
.versao-rodape:hover { opacity: 1; }