/* biopandim — banco de questões
   Identidade: preto + osso + laranja, com amarelo e azul lâmina de apoio.
   Títulos Fraunces (itálico pesado), texto Bricolage Grotesque, anotações Caveat.
   Elementos: manchas de panda, pontilhado, olho do panda, setas à mão. */

:root {
  --preto: #1e1e1e;
  --osso: #f0eade;
  --osso-claro: #f8f4ec;
  --laranja: #f66036;
  --laranja-escuro: #e0532b;
  --amarelo: #ffd65a;
  --azul: #9cb4f6;
  --rosa: #f472b6;
  --cinza: #6b6760;
  --linha: #1e1e1e;
  --radius: 22px;
  --f-titulo: "Fraunces", Georgia, serif;
  --f-texto: "Bricolage Grotesque", system-ui, -apple-system, sans-serif;
  --f-nota: "Caveat", "Comic Sans MS", cursive;
  font-family: var(--f-texto);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--osso); color: var(--preto); }
body { min-height: 100vh; font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }

/* textura granulada sobre tudo (10–20% de transparência) */
.glow {
  position: fixed; inset: 0; z-index: 100; pointer-events: none; opacity: 0.14; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* pontilhado (pelagem / microscópio) */
.dots {
  background-image: radial-gradient(rgba(30, 30, 30, 0.28) 1.4px, transparent 1.6px);
  background-size: 16px 16px;
}

/* ---------------------------------------------------------------- topo */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px clamp(16px, 4vw, 40px);
  background: var(--preto); color: var(--osso);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--osso); }
.brand img { width: 38px; height: 38px; object-fit: contain; background: var(--osso); border-radius: 12px; padding: 4px; }
.brand-name { font-family: var(--f-titulo); font-style: italic; font-weight: 800; font-size: 22px; letter-spacing: -0.01em; }
.brand-name b { color: var(--laranja); font-weight: 800; }
.nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.nav a, .nav button {
  color: var(--osso); text-decoration: none; background: transparent; border: 0; cursor: pointer;
  padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: 14px;
}
.nav a:hover, .nav button:hover { background: rgba(240, 234, 222, 0.12); }
.nav a.active { background: var(--laranja); color: var(--preto); }

/* ---------------------------------------------------------------- layout */
.app { max-width: 1080px; margin: 0 auto; padding: clamp(28px, 5vw, 56px) clamp(16px, 4vw, 32px) 96px; }
.center { text-align: center; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.muted { color: var(--cinza); }
.small { font-size: 13px; }

/* ---------------------------------------------------------------- tipografia */
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
.h-hero { font-family: var(--f-titulo); font-style: italic; font-weight: 800; font-size: clamp(34px, 5.4vw, 58px); line-height: 1.02; text-wrap: balance; }
.h-sec { font-family: var(--f-titulo); font-style: italic; font-weight: 800; font-size: clamp(26px, 3.4vw, 38px); line-height: 1.08; }
.hl { color: var(--laranja); font-style: italic; }
.pill-hl {
  font-weight: 700; padding: 0 4px;
  background: linear-gradient(transparent 55%, var(--amarelo) 55%, var(--amarelo) 92%, transparent 92%);
}
.marca-rosa { background: linear-gradient(transparent 50%, var(--rosa) 50%, var(--rosa) 88%, transparent 88%); padding: 0 4px; }
.lead { font-size: 18px; color: #3d3a35; max-width: 640px; margin: 16px auto 0; text-wrap: pretty; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; }
.nota { font-family: var(--f-nota); font-size: 26px; line-height: 1; color: var(--laranja); font-weight: 600; }
.nota.amarela { color: var(--amarelo); }

/* ---------------------------------------------------------------- cartões */
.card {
  position: relative; overflow: hidden;
  background: var(--osso-claro); color: var(--preto);
  border: 1.5px solid var(--linha); border-radius: var(--radius);
  padding: clamp(22px, 3vw, 34px);
}
.card.blob::after {
  /* mancha de panda no canto */
  content: ""; position: absolute; top: -46px; right: -46px; width: 120px; height: 120px;
  background: var(--preto); border-radius: 58% 42% 55% 45% / 50% 60% 40% 50%; pointer-events: none;
}
.card.blob > * { position: relative; z-index: 1; }
.card-title { font-family: var(--f-titulo); font-style: italic; font-weight: 800; font-size: 26px; line-height: 1.1; }

/* cartões temáticos (como os posts) */
.tile {
  position: relative; overflow: hidden; border-radius: var(--radius); padding: 22px; min-height: 180px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 18px;
  border: 1.5px solid var(--preto); background: var(--osso-claro);
}
.tile .eyebrow { font-size: 11px; }
.tile p { margin: 0; font-family: var(--f-titulo); font-style: italic; font-weight: 700; font-size: 22px; line-height: 1.15; }
.tile.preto { background: var(--preto); color: var(--osso); }
.tile.laranja { background-color: var(--laranja); }
.tile.azul { background: var(--azul); }
.tile.amarelo { background: var(--amarelo); }
.tile.preto .nota { color: var(--amarelo); }
.tile.laranja .nota, .tile.azul .nota, .tile.amarelo .nota { color: var(--preto); }
.tile .canto {
  position: absolute; right: -30px; bottom: -34px; width: 96px; height: 90px; background: var(--preto);
  border-radius: 55% 45% 50% 50% / 60% 50% 50% 40%;
}
.tile.preto .canto { background: var(--osso); }

/* ---------------------------------------------------------------- números */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.stat {
  background: var(--preto); color: var(--osso); border-radius: var(--radius);
  padding: 20px 18px 18px; position: relative; overflow: hidden;
}
.stat .bubble { display: none; }
.stat .num {
  font-family: var(--f-titulo); font-weight: 800; font-size: clamp(42px, 6vw, 60px); line-height: 0.95;
  color: var(--laranja); font-variant-numeric: lining-nums tabular-nums; letter-spacing: -0.02em;
}
.stat .num span { color: rgba(240, 234, 222, 0.5) !important; font-size: 0.45em !important; }
.stat .lbl { font-family: var(--f-titulo); font-style: italic; font-size: 19px; margin-top: 6px; }
.stats .stat:nth-child(2) { background: var(--laranja); color: var(--preto); }
.stats .stat:nth-child(2) .num { color: var(--preto); }
.stats .stat:nth-child(3) { background: var(--azul); color: var(--preto); }
.stats .stat:nth-child(3) .num { color: var(--preto); }
.stats .stat:nth-child(4) { background: var(--osso-claro); color: var(--preto); border: 1.5px solid var(--preto); }

/* olho do panda: moldura de destaque */
.badge-burst {
  width: 118px; height: 132px; flex: none; display: grid; place-items: center; text-align: center;
  background: var(--preto); color: var(--osso); border-radius: 50%; transform: rotate(-14deg);
  clip-path: none; font-weight: 800; line-height: 1;
}
.badge-burst > div {
  width: 70px; height: 70px; border-radius: 50%; background: var(--osso); color: var(--preto);
  display: grid; place-items: center; align-content: center; transform: rotate(14deg);
}
.badge-burst span { font-family: var(--f-titulo); font-size: 22px; display: block; }
.badge-burst small { font-size: 9px; font-weight: 700; letter-spacing: 0.08em; }

/* ---------------------------------------------------------------- botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1.5px solid var(--preto); cursor: pointer; text-decoration: none;
  background: var(--laranja); color: var(--preto); font-weight: 700; font-size: 15px;
  padding: 13px 24px; border-radius: 999px;
  transition: transform 0.08s ease, box-shadow 0.15s ease;
  box-shadow: 3px 3px 0 var(--preto);
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--preto); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--preto); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.ghost:hover { background: rgba(30, 30, 30, 0.06); transform: none; }
.btn.yellow { background: var(--amarelo); }
.btn.dark { background: var(--preto); color: var(--osso); box-shadow: 3px 3px 0 var(--laranja); }
.btn.sm { padding: 8px 14px; font-size: 13px; box-shadow: 2px 2px 0 var(--preto); }
.btn.danger { background: transparent; color: var(--laranja-escuro); border-color: currentColor; box-shadow: none; }
.link { color: var(--laranja-escuro); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; background: none; border: 0; cursor: pointer; padding: 0; }

/* ---------------------------------------------------------------- formulários */
label.f { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.input, select.input, textarea.input {
  width: 100%; padding: 12px 14px; border-radius: 14px;
  border: 1.5px solid var(--preto); background: #fff; color: var(--preto);
}
.input:focus { outline: none; box-shadow: 0 0 0 3px var(--amarelo); }
textarea.input { min-height: 140px; resize: vertical; line-height: 1.5; }
.form-error { color: var(--laranja-escuro); font-size: 14px; font-weight: 700; min-height: 20px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1.5px solid var(--preto); background: transparent;
  padding: 7px 14px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 14px;
}
.chip:hover:not(:disabled):not([aria-pressed="true"]) { background: rgba(30, 30, 30, 0.06); }
.chip[aria-pressed="true"] { background: var(--preto); color: var(--osso); }
.chip .count { opacity: 0.55; font-weight: 500; margin-left: 4px; }

.seg { display: flex; border: 1.5px solid var(--preto); border-radius: 999px; padding: 3px; gap: 3px; flex-wrap: wrap; background: #fff; }
.seg button { flex: 1 1 auto; white-space: nowrap; border: 0; background: transparent; padding: 9px 12px; border-radius: 999px; font-weight: 700; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--laranja); }

/* ---------------------------------------------------------------- questão */
.q-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.tag { font-size: 12px; font-weight: 700; padding: 4px 11px; border-radius: 999px; border: 1.5px solid var(--preto); background: transparent; }
.tag.pink { background: var(--azul); }
.tag.dark { background: var(--preto); color: var(--osso); }
.q-text { font-size: 17px; }
.q-text p { margin: 0 0 12px; }
.q-img { margin: 8px auto 20px; max-height: 560px; width: auto; border-radius: 12px; border: 1.5px solid var(--preto); background: #fff; }
.alts { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 10px; }
.alt {
  width: 100%; text-align: left; display: flex; gap: 12px; align-items: flex-start;
  border: 1.5px solid var(--preto); background: #fff;
  border-radius: 18px; padding: 11px 16px; cursor: pointer; line-height: 1.45; font-size: 16px;
}
.alt:hover:not(:disabled) { background: var(--osso); }
.alt .letter { flex: none; font-weight: 800; min-width: 22px; }
.alt:disabled { cursor: default; }
.alt.correct { background: var(--amarelo); }
.alt.correct .letter::after { content: " ✓"; }
.alt.wrong { background: var(--laranja); }
.alt.wrong .letter::after { content: " ✕"; }
.alt.dim { opacity: 0.45; }

.feedback { margin-top: 22px; border-radius: var(--radius); padding: 22px; background: var(--preto); color: var(--osso); position: relative; overflow: hidden; }
.feedback h3 { font-family: var(--f-titulo); font-style: italic; font-weight: 800; font-size: 26px; display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; color: var(--osso); }
.feedback .res p { margin: 0 0 8px; color: #ebe5d8; }
.feedback h3 .dot { display: none; }
.feedback.ok h3 { color: var(--amarelo); }
.feedback.no h3 { color: var(--laranja); }
.feedback.neutral h3 { color: var(--azul); }
.self-eval { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.self-eval .btn { flex: 1 1 140px; box-shadow: 3px 3px 0 var(--osso); }

.progressbar { height: 10px; border: 1.5px solid var(--preto); border-radius: 999px; overflow: hidden; background: #fff; }
.progressbar > i { display: block; height: 100%; background: var(--laranja); }

/* barras por tema */
.bars { display: grid; gap: 14px; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 190px) 1fr 58px; gap: 12px; align-items: center; font-size: 14px; }
.bar-track { height: 14px; border-radius: 999px; background: #fff; border: 1.5px solid var(--preto); overflow: hidden; display: flex; }
.bar-ok { background: var(--preto); }
.bar-no { background: var(--laranja); }
.bar-row .pct { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--cinza); margin-bottom: 14px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; border: 1.5px solid var(--preto); }

/* tabela */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 8px; text-align: left; border-bottom: 1px dashed rgba(30, 30, 30, 0.25); vertical-align: top; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--cinza); }
td.num { font-variant-numeric: tabular-nums; }

.tabs { display: flex; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; }
.tabs button { border: 1.5px solid var(--preto); background: transparent; padding: 9px 16px; border-radius: 999px; font-weight: 700; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--preto); color: var(--osso); }

.empty { text-align: center; padding: 28px 12px; color: var(--cinza); }
.notice { border: 1.5px dashed var(--preto); background: rgba(255, 214, 90, 0.35); border-radius: 16px; padding: 12px 16px; font-size: 14px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--preto); color: var(--osso); font-weight: 700; padding: 12px 20px; border-radius: 999px;
  opacity: 0; pointer-events: none; transition: 0.2s; z-index: 50; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%); }

.check-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.check-list li { display: flex; gap: 10px; align-items: flex-start; }
.check-list svg { flex: none; width: 20px; height: 20px; stroke: var(--laranja); fill: none; stroke-width: 3; margin-top: 2px; }
code { background: #fff; border: 1px solid rgba(30, 30, 30, 0.2); padding: 1px 6px; border-radius: 6px; font-size: 13px; }

/* ---------------------------------------------------------------- login: painel da Fer */
.auth { display: grid; grid-template-columns: 1.05fr 1fr; gap: 24px; align-items: stretch; max-width: 980px; margin: 0 auto; }
.auth-hero {
  background: var(--preto); color: var(--osso); border-radius: var(--radius); padding: 34px;
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; min-height: 520px;
}
.auth-hero .h-hero { font-size: clamp(32px, 4.2vw, 48px); }
.auth-hero .hl { color: var(--laranja); }
.auth-hero .lead { color: #d9d3c6; margin: 14px 0 0; font-size: 16px; }
.fer-wrap { position: relative; width: 210px; height: 210px; align-self: flex-end; margin-top: 20px; }
.fer-wrap::before {
  /* mancha laranja atrás da foto */
  content: ""; position: absolute; inset: -16px -10px -8px -22px; background: var(--laranja);
  border-radius: 62% 38% 55% 45% / 45% 55% 45% 55%;
}
.fer-wrap img { position: relative; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.fer-wrap .nota { position: absolute; left: -128px; bottom: 34px; color: var(--amarelo); transform: rotate(-6deg); white-space: nowrap; }
.auth-hero .blob-osso {
  position: absolute; top: -60px; right: -50px; width: 170px; height: 150px; background: var(--osso);
  border-radius: 58% 42% 55% 45% / 50% 60% 40% 50%;
}
.auth-form { align-self: center; }

/* hero da página inicial */
.hero { display: grid; grid-template-columns: 1.3fr 0.7fr; gap: 28px; align-items: center; }
.hero .lead { margin-left: 0; }
.hero-fer { position: relative; justify-self: center; width: min(100%, 260px); aspect-ratio: 1; }
.hero-fer::before {
  content: ""; position: absolute; inset: -18px -14px -10px -24px; background: var(--preto);
  border-radius: 58% 42% 52% 48% / 46% 54% 46% 54%;
}
.hero-fer img { position: relative; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.hero-fer .nota { position: absolute; right: -12px; bottom: -26px; transform: rotate(-5deg); }

@media (max-width: 760px) {
  .auth, .hero { grid-template-columns: 1fr; }
  .auth-hero { min-height: 0; }
  .fer-wrap { width: 150px; height: 150px; }
  .hero-fer { width: 190px; order: -1; }
}
@media (max-width: 640px) {
  .bar-row { grid-template-columns: 1fr 52px; }
  .bar-row .bar-track { grid-column: 1 / -1; order: 3; }
  .topbar { flex-wrap: wrap; gap: 6px; padding-bottom: 8px; }
  .nav { width: 100%; flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; margin: 0 -6px; }
  .nav a, .nav button { padding: 6px 10px; font-size: 13px; white-space: nowrap; }
  .nav #sair { margin-left: auto; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------------------------------------------------------------- revisão (estilo Anki) */
.nav-badge { display: inline-block; min-width: 20px; padding: 1px 6px; margin-left: 4px; border-radius: 999px; background: var(--amarelo); color: var(--preto); font-size: 12px; font-weight: 800; text-align: center; line-height: 18px; }
.decks td, .decks th { vertical-align: middle; }
.decks .deck-disc td { padding-top: 18px; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--laranja-escuro); }
.decks .deck-total td { border-top: 2px solid var(--preto); }
.due { display: inline-block; min-width: 34px; padding: 3px 10px; border-radius: 999px; background: var(--laranja); border: 1.5px solid var(--preto); font-weight: 800; text-align: center; }
.due.zero { background: transparent; border-color: #d6d3cc; color: #9a968d; }
.grades { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-top: 12px; }
.grade { flex-direction: column; justify-content: center; gap: 2px; padding: 12px 10px; }
.grade small { font-weight: 600; font-size: 12px; opacity: .8; }
.g-errei { background: var(--laranja); }
.g-dificil { background: var(--azul); }
.g-bom { background: var(--amarelo); }
.g-facil { background: #fff; }

/* ---------------------------------------------------------------- ranking */
.ranking { list-style: none; margin: 0; padding: 0; }
.ranking li { display: grid; grid-template-columns: 40px 1fr 170px auto; gap: 16px; align-items: center; padding: 14px 0; border-bottom: 1px solid #eceef0; }
.ranking li:last-child { border-bottom: 0; }
.ranking .pos { font-family: var(--f-titulo); font-size: 26px; font-weight: 800; color: var(--laranja-escuro); text-align: center; }
.rk-tit { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rk-txt { margin-top: 4px; }
.rk-num { font-family: var(--f-titulo); font-size: 24px; font-weight: 800; }
.rk-num small { font-size: 12px; font-weight: 600; color: #777; }
.rk-taxa .bar-track { margin: 4px 0; }
@media (max-width: 700px) {
  .ranking li { grid-template-columns: 32px 1fr; }
  .ranking .rk-taxa, .ranking li > .btn { grid-column: 2; }
}
button.due { cursor: pointer; font: inherit; font-weight: 800; color: var(--preto); }
button.due:hover { background: var(--amarelo); }
@media (max-width: 600px) {
  .decks th:last-child, .decks td:last-child:not([colspan]) { display: none; }
}

/* ---------------------------------------------------------------- assinatura e cupons */
.plano-op { cursor: pointer; text-align: center; font: inherit; transition: transform .12s, box-shadow .12s; }
.plano-op:hover { transform: translateY(-2px); }
.plano-op[aria-pressed="true"] { background: var(--amarelo); box-shadow: 4px 4px 0 var(--preto); }
.plano-op .preco { font-size: 40px; font-weight: 800; }
.plano-op del { color: var(--cinza); font-weight: 600; margin-right: 6px; }
.cupom-ok { color: #1f7a3a; font-weight: 700; font-size: 14px; }
.tag.ok { background: #bfe8c9; }
.tag.cancel { background: #e6e1d8; text-decoration: line-through; }
