/* ============================================================
   GCM ESTUDOS — tema azul-marinho (inspirado no art. 21 da Lei 13.022/2014)
   ============================================================ */
:root {
  --navy-900: #0a1929;
  --navy-800: #0d2137;
  --navy-700: #122c4a;
  --navy-600: #1a3a5f;
  --navy-500: #234b78;
  --gold: #f5b942;
  --gold-dark: #d99a1b;
  --text: #e8eef6;
  --text-dim: #9db1c7;
  --green: #2fbf71;
  --green-bg: rgba(47, 191, 113, .12);
  --red: #ef5b5b;
  --red-bg: rgba(239, 91, 91, .12);
  --blue: #4d9fff;
  --card: #12294a;
  --card-border: rgba(157, 177, 199, .14);
  --radius: 16px;
  --shadow: 0 6px 24px rgba(0, 0, 0, .35);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(160deg, var(--navy-900) 0%, var(--navy-800) 60%, #0e2540 100%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
}

#app { max-width: 760px; margin: 0 auto; padding-bottom: 84px; }

.hidden { display: none !important; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: rgba(13, 33, 55, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--card-border);
}
.topbar-title { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.topbar-title .shield { font-size: 26px; }
.topbar-title h1 { font-size: 17px; font-weight: 800; letter-spacing: .3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title p { font-size: 11.5px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  background: var(--navy-600); border: 1px solid var(--card-border); color: var(--text);
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; cursor: pointer;
  flex-shrink: 0;
}
.icon-btn:active { transform: scale(.94); }
.install-btn {
  background: var(--gold); color: #33260a; font-weight: 800; font-size: 12.5px;
  border: none; padding: 9px 14px; border-radius: 12px; cursor: pointer; flex-shrink: 0;
}

/* ---------- View / cards ---------- */
main { padding: 16px 14px 24px; }
.card {
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: 1.4px; color: var(--text-dim); margin: 18px 4px 10px; font-weight: 700; }

/* ---------- Home ---------- */
.hero {
  background: linear-gradient(135deg, var(--navy-600), var(--navy-700));
  border: 1px solid var(--card-border);
  border-radius: 20px; padding: 20px; margin-bottom: 14px; position: relative; overflow: hidden;
}
.hero::after { content: "🛡️"; position: absolute; right: -8px; bottom: -18px; font-size: 90px; opacity: .08; }
.hero h2 { font-size: 20px; margin-bottom: 6px; }
.hero p { color: var(--text-dim); font-size: 13.5px; line-height: 1.5; }
.hero .badge {
  display: inline-block; background: rgba(245, 185, 66, .15); color: var(--gold);
  border: 1px solid rgba(245, 185, 66, .35); font-size: 11px; font-weight: 700;
  padding: 4px 10px; border-radius: 999px; margin-bottom: 10px; letter-spacing: .5px;
}
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 6px; }
.stat {
  background: var(--card); border: 1px solid var(--card-border); border-radius: 14px;
  padding: 12px 8px; text-align: center;
}
.stat b { display: block; font-size: 21px; color: var(--gold); }
.stat span { font-size: 11px; color: var(--text-dim); }

.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  background: var(--card); border: 1px solid var(--card-border); border-radius: 16px;
  padding: 16px 14px; color: var(--text); cursor: pointer; text-align: left;
  transition: transform .12s ease;
}
.quick-btn:active { transform: scale(.97); }
.quick-btn .qb-icon { font-size: 24px; }
.quick-btn b { font-size: 14.5px; }
.quick-btn span { font-size: 11.5px; color: var(--text-dim); line-height: 1.35; }

/* ---------- Listas de disciplinas ---------- */
.disc-item {
  display: flex; align-items: center; gap: 13px; width: 100%;
  background: var(--card); border: 1px solid var(--card-border); border-radius: 16px;
  padding: 14px; margin-bottom: 10px; color: var(--text); cursor: pointer; text-align: left;
}
.disc-item:active { transform: scale(.985); }
.disc-icon {
  width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center;
  font-size: 22px; flex-shrink: 0;
}
.disc-info { flex: 1; min-width: 0; }
.disc-info b { display: block; font-size: 14.5px; margin-bottom: 3px; }
.disc-info p { font-size: 12px; color: var(--text-dim); line-height: 1.35; }
.disc-count {
  font-size: 11px; color: var(--gold); background: rgba(245, 185, 66, .12);
  border: 1px solid rgba(245, 185, 66, .3); border-radius: 999px; padding: 4px 9px; font-weight: 700; white-space: nowrap;
}
.arrow { color: var(--text-dim); font-size: 18px; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--navy-500); color: var(--text); border: 1px solid var(--card-border);
  font-size: 14.5px; font-weight: 700; padding: 13px 18px; border-radius: 14px; cursor: pointer;
  width: 100%; transition: transform .1s ease;
}
.btn:active { transform: scale(.98); }
.btn-gold { background: linear-gradient(135deg, var(--gold), var(--gold-dark)); color: #33260a; border: none; }
.btn-green { background: var(--green); color: #06281a; border: none; }
.btn-outline { background: transparent; border: 1.5px solid var(--navy-500); }
.btn-sm { padding: 9px 14px; font-size: 13px; width: auto; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

/* ---------- Teoria ---------- */
.teoria-bloco { margin-bottom: 12px; }
.teoria-bloco h3 {
  font-size: 15px; margin-bottom: 8px; color: var(--gold);
}
.teoria-bloco p, .teoria-bloco li { font-size: 13.8px; line-height: 1.62; color: #d5e0ee; }
.teoria-bloco ul, .teoria-bloco ol { padding-left: 20px; margin: 8px 0; }
.teoria-bloco li { margin-bottom: 6px; }
.teoria-bloco b { color: #fff; }
.teoria-bloco table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 12.8px; }
.teoria-bloco th, .teoria-bloco td { border: 1px solid var(--card-border); padding: 7px 9px; text-align: left; }
.teoria-bloco th { background: var(--navy-600); color: var(--gold); }
.teoria-bloco .alerta {
  background: var(--red-bg); border-left: 3px solid var(--red);
  padding: 9px 12px; border-radius: 8px; margin-top: 10px;
}
.teoria-bloco .dica {
  background: rgba(245, 185, 66, .1); border-left: 3px solid var(--gold);
  padding: 9px 12px; border-radius: 8px; margin-top: 10px;
}

/* ---------- Questão ---------- */
.q-progress { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.q-progress-bar { flex: 1; height: 7px; background: var(--navy-600); border-radius: 99px; overflow: hidden; }
.q-progress-bar > div { height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-dark)); border-radius: 99px; transition: width .3s ease; }
.q-progress span { font-size: 12px; color: var(--text-dim); font-weight: 700; white-space: nowrap; }

.q-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tag {
  font-size: 10.5px; font-weight: 700; letter-spacing: .4px; padding: 4px 9px; border-radius: 999px;
  background: var(--navy-600); color: var(--text-dim); border: 1px solid var(--card-border);
}
.tag-gold { background: rgba(245, 185, 66, .13); color: var(--gold); border-color: rgba(245, 185, 66, .3); }
.tag-blue { background: rgba(77, 159, 255, .13); color: var(--blue); border-color: rgba(77, 159, 255, .3); }

.q-enunciado { font-size: 15px; line-height: 1.65; margin-bottom: 16px; white-space: pre-wrap; }

.opt {
  display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left;
  background: var(--navy-700); border: 1.5px solid var(--card-border); border-radius: 14px;
  padding: 13px 14px; margin-bottom: 9px; color: var(--text); cursor: pointer; font-size: 14.2px; line-height: 1.5;
  transition: border-color .15s ease, background .15s ease;
}
.opt .opt-letra {
  width: 28px; height: 28px; flex-shrink: 0; border-radius: 50%;
  display: grid; place-items: center; font-weight: 800; font-size: 13px;
  background: var(--navy-500); color: var(--text);
}
.opt:not(.locked):hover { border-color: var(--navy-500); }
.opt:not(.locked):active { transform: scale(.99); }
.opt.locked { cursor: default; opacity: .82; }
.opt.escolhida { border-color: var(--blue); background: rgba(77, 159, 255, .1); }
.opt.certa { border-color: var(--green); background: var(--green-bg); opacity: 1 !important; }
.opt.certa .opt-letra { background: var(--green); color: #06281a; }
.opt.errada { border-color: var(--red); background: var(--red-bg); opacity: 1 !important; }
.opt.errada .opt-letra { background: var(--red); color: #3a0d0d; }

/* ---------- Feedback / comentário ---------- */
.feedback { margin-top: 14px; animation: slideUp .28s ease; }
@keyframes slideUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.veredito {
  display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 16px;
  padding: 13px 16px; border-radius: 14px; margin-bottom: 12px;
}
.veredito.ok { background: var(--green-bg); border: 1px solid rgba(47, 191, 113, .4); color: var(--green); }
.veredito.err { background: var(--red-bg); border: 1px solid rgba(239, 91, 91, .4); color: var(--red); }
.veredito.neu { background: rgba(245, 185, 66, .08); border: 1px solid rgba(245, 185, 66, .35); color: var(--gold); }
.veredito small { display: block; font-weight: 600; font-size: 12px; color: var(--text-dim); }

.comentario-box {
  background: var(--navy-700); border: 1px solid var(--card-border);
  border-radius: 14px; padding: 15px; margin-bottom: 10px;
}
.comentario-box h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--gold); margin-bottom: 9px; }
.comentario-box .txt { font-size: 13.8px; line-height: 1.68; color: #d9e4f1; white-space: pre-wrap; }
.base-box {
  background: rgba(77, 159, 255, .08); border: 1px dashed rgba(77, 159, 255, .4);
  border-radius: 12px; padding: 11px 14px; font-size: 12.8px; color: #bcd7ff; margin-bottom: 12px;
}
.base-box b { color: var(--blue); }

details.teoria-drop {
  background: var(--navy-700); border: 1px solid var(--card-border);
  border-radius: 14px; margin-bottom: 12px; overflow: hidden;
}
details.teoria-drop summary {
  padding: 13px 15px; cursor: pointer; font-weight: 700; font-size: 13.8px; color: var(--gold);
  list-style: none; display: flex; align-items: center; gap: 8px;
}
details.teoria-drop summary::before { content: "▸"; transition: transform .2s; }
details.teoria-drop[open] summary::before { transform: rotate(90deg); }
details.teoria-drop .drop-body { padding: 0 15px 15px; font-size: 13.5px; line-height: 1.65; color: #d5e0ee; }

.fav-btn {
  background: transparent; border: 1.5px solid var(--card-border); color: var(--text-dim);
  border-radius: 12px; padding: 10px 16px; font-size: 13.5px; font-weight: 700; cursor: pointer;
}
.fav-btn.on { color: var(--gold); border-color: rgba(245, 185, 66, .5); background: rgba(245, 185, 66, .1); }

/* ---------- Simulado ---------- */
.sim-config-row { margin-bottom: 16px; }
.sim-config-row label { font-size: 12.5px; color: var(--text-dim); font-weight: 700; display: block; margin-bottom: 8px; text-transform: uppercase; letter-spacing: .8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: var(--navy-700); border: 1.5px solid var(--card-border); color: var(--text-dim);
  padding: 9px 15px; border-radius: 999px; font-size: 13.5px; font-weight: 700; cursor: pointer;
}
.chip.on { background: rgba(245, 185, 66, .14); border-color: var(--gold); color: var(--gold); }

.sim-header {
  position: sticky; top: 64px; z-index: 40; display: flex; align-items: center; justify-content: space-between;
  background: var(--navy-800); border: 1px solid var(--card-border); border-radius: 14px;
  padding: 10px 14px; margin-bottom: 12px; font-size: 13px; font-weight: 800;
}
.sim-timer { color: var(--gold); font-variant-numeric: tabular-nums; }

.grid-respostas { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 8px; margin: 12px 0; }
.grid-respostas button {
  aspect-ratio: 1; border-radius: 11px; border: 1.5px solid var(--card-border);
  background: var(--navy-700); color: var(--text-dim); font-weight: 800; font-size: 13px; cursor: pointer;
}
.grid-respostas button.resp { background: rgba(77, 159, 255, .25); border-color: var(--blue); color: var(--text); }
.grid-respostas button.atual { border-color: var(--gold); color: var(--gold); }
.grid-respostas button.g-ok { background: var(--green-bg); border-color: var(--green); color: var(--green); }
.grid-respostas button.g-err { background: var(--red-bg); border-color: var(--red); color: var(--red); }

/* ---------- Resultado ---------- */
.resultado-circ { text-align: center; padding: 10px 0 4px; }
.circ-wrap { position: relative; width: 168px; height: 168px; margin: 0 auto 12px; }
.circ-wrap svg { transform: rotate(-90deg); }
.circ-val { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.circ-val b { font-size: 34px; color: var(--gold); display: block; }
.circ-val span { font-size: 11.5px; color: var(--text-dim); }
.msg-resultado { font-size: 14.5px; color: var(--text-dim); margin-bottom: 6px; line-height: 1.5; }

/* ---------- Busca ---------- */
.search-box { position: relative; margin-bottom: 14px; }
.search-box input {
  width: 100%; background: var(--card); border: 1.5px solid var(--card-border); border-radius: 14px;
  padding: 13px 15px 13px 42px; color: var(--text); font-size: 14.5px; outline: none;
}
.search-box input:focus { border-color: var(--navy-500); }
.search-box .lupa { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); opacity: .6; }

.q-resumo {
  display: block; width: 100%; text-align: left; background: var(--card);
  border: 1px solid var(--card-border); border-radius: 14px; padding: 13px 14px;
  margin-bottom: 9px; color: var(--text); cursor: pointer;
}
.q-resumo .qt { font-size: 13.4px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: #d5e0ee; }
.q-resumo .qm { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; align-items: center; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 5px; }
.status-dot.ok { background: var(--green); }
.status-dot.err { background: var(--red); }

/* ---------- Progresso ---------- */
.prog-item { margin-bottom: 14px; }
.prog-item .pi-head { display: flex; justify-content: space-between; font-size: 13.5px; margin-bottom: 6px; }
.prog-item .pi-head b { color: var(--text); }
.prog-item .pi-head span { color: var(--text-dim); font-weight: 700; }
.prog-bar { height: 9px; background: var(--navy-600); border-radius: 99px; overflow: hidden; }
.prog-bar > div { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--green), #1f9d5c); }
.prog-bar > div.low { background: linear-gradient(90deg, var(--red), #c93c3c); }
.prog-bar > div.mid { background: linear-gradient(90deg, var(--gold), var(--gold-dark)); }

.vazio { text-align: center; padding: 46px 20px; color: var(--text-dim); }
.vazio .v-icon { font-size: 44px; margin-bottom: 12px; }
.vazio p { font-size: 14px; line-height: 1.55; }

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
  display: flex; justify-content: space-around; align-items: stretch;
  background: rgba(10, 25, 41, .96); backdrop-filter: blur(12px);
  border-top: 1px solid var(--card-border);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-item {
  flex: 1; background: none; border: none; color: var(--text-dim);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 9px 0 8px; cursor: pointer; font-size: 10.5px; font-weight: 700;
}
.nav-item .nav-icon { font-size: 20px; filter: grayscale(1) opacity(.65); }
.nav-item.active { color: var(--gold); }
.nav-item.active .nav-icon { filter: none; }

@media (min-width: 640px) {
  .stats-row { grid-template-columns: repeat(3, 1fr); }
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
}
