/* ============================================================
   GERABYTEZ — Simulado ENEM
   ============================================================ */

:root {
  --bg: #f8f9fc;
  --bg-soft: #f1f3f9;
  --panel: #ffffff;
  --panel-light: #f5f6fb;
  --panel-lighter: #ebedf6;
  --text: #1c2438;
  --text-dim: #667085;
  --accent-orange: #f7941d;
  --accent-navy: #16305c;
  --good: #16a34a;
  --bad: #dc2626;
  --radius: 16px;
  --header-h: 54px;

  --c-linguagens: #d6316e;
  --c-humanas: #c97314;
  --c-natureza: #12945c;
  --c-matematica: #2563eb;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: radial-gradient(1200px 800px at 10% -10%, #eef1f9 0%, var(--bg) 55%);
  color: var(--text);
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
h1, h2, h3, p { margin: 0; }

/* ---------------- Topbar ---------------- */
.gb-topbar {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}
.gb-topbar img { height: 32px; width: auto; max-width: 110px; object-fit: contain; }
.gb-topbar .brand { display: flex; flex-direction: column; line-height: 1.15; }
.gb-topbar .brand b { font-size: 15px; letter-spacing: 0.3px; }
.gb-topbar .brand span { font-size: 11.5px; color: var(--text-dim); }
.gb-topbar .spacer { flex: 1; }
.gb-topbar .reset-all-btn {
  font-size: 12.5px;
  color: var(--text-dim);
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(15,23,42,0.12);
  transition: all .15s;
}
.gb-topbar .reset-all-btn:hover { color: var(--bad); border-color: var(--bad); }

main#app { max-width: 1100px; margin: 0 auto; padding: 22px 22px 20px; }

.view { display: none; animation: fadeUp .22s ease; }
.view.active { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------------- Home ---------------- */
.home-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin: 2px 0 20px;
}
.home-head-title h1 { font-size: 23px; font-weight: 800; }
.home-head-title p { color: var(--text-dim); margin-top: 3px; font-size: 12.5px; max-width: 540px; line-height: 1.4; }

.summary-strip {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(160deg, var(--panel), var(--panel-light));
  border: 1px solid rgba(15,23,42,0.07);
  border-radius: 14px;
  padding: 11px 22px;
  flex-shrink: 0;
}
.summary-strip .s-item { display: flex; flex-direction: column; align-items: center; min-width: 64px; }
.summary-strip .s-val { font-size: 21px; font-weight: 800; line-height: 1.15; }
.summary-strip .s-val.small { font-size: 17px; }
.summary-strip .s-val.accent { color: var(--accent-orange); }
.summary-strip .s-lbl { font-size: 9.5px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.4px; margin-top: 2px; white-space: nowrap; }
.summary-strip .s-div { width: 1px; height: 30px; background: rgba(15,23,42,0.1); }

.area-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
@media (max-width: 700px) {
  .area-grid { grid-template-columns: 1fr; }
  .home-head { justify-content: center; text-align: center; }
  .home-head-title p { max-width: none; }
}
.area-card {
  background: linear-gradient(160deg, var(--panel), var(--panel-light));
  border: 1px solid rgba(15,23,42,0.06);
  border-radius: 14px;
  padding: 18px 20px;
  border-top: 3px solid var(--area-color, var(--accent-orange));
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.area-card .card-head { display: flex; align-items: center; gap: 10px; }
.area-card .icon { font-size: 22px; line-height: 1; }
.area-card h3 { font-size: 15.5px; font-weight: 800; line-height: 1.25; }
.area-card .subjects {
  font-size: 11.5px;
  color: var(--text-dim);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.area-card .stats { display: flex; gap: 10px; margin-top: 2px; }
.area-card .stat { flex: 1; background: rgba(15,23,42,0.04); border-radius: 9px; padding: 8px 10px; text-align: center; }
.area-card .stat .n { font-size: 17px; font-weight: 800; line-height: 1.2; }
.area-card .stat .n.empty { color: var(--text-dim); font-weight: 600; font-size: 14px; }
.area-card .stat .l { font-size: 9px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.3px; }
.area-card .bank-progress { font-size: 10.5px; color: var(--text-dim); }
.area-card .bank-bar { height: 5px; border-radius: 3px; background: rgba(15,23,42,0.08); overflow: hidden; margin-top: 4px; }
.area-card .bank-bar > div { height: 100%; background: var(--area-color); }
.area-card .card-actions { display: flex; gap: 8px; margin-top: 6px; }
.area-card .btn-start {
  flex: 1;
  background: var(--area-color);
  color: #0b1024;
  font-weight: 800;
  font-size: 13px;
  padding: 9px 14px;
  border-radius: 10px;
  text-align: center;
  transition: filter .15s, transform .15s;
}
.area-card .btn-start:hover { filter: brightness(1.1); transform: translateY(-1px); }
.area-card .btn-reset {
  font-size: 12px;
  color: var(--text-dim);
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid rgba(15,23,42,0.1);
  transition: all .15s;
}
.area-card .btn-reset:hover { color: var(--bad); border-color: var(--bad); }

/* ---------------- Config (escolha de fase) ---------------- */
.config-box {
  max-width: 560px;
  margin: 10px auto;
  background: linear-gradient(160deg, var(--panel), var(--panel-light));
  border: 1px solid rgba(15,23,42,0.06);
  border-radius: var(--radius);
  padding: 26px;
  border-top: 4px solid var(--area-color, var(--accent-orange));
}
.config-box .back-link { font-size: 12.5px; color: var(--text-dim); margin-bottom: 14px; display: inline-block; }
.config-box .back-link:hover { color: var(--text); }
.config-box h2 { font-size: 20px; font-weight: 800; }
.config-box .meta { font-size: 12.5px; color: var(--text-dim); margin-top: 4px; }
.config-box .size-row { display: flex; gap: 10px; margin: 22px 0 8px; }
.size-btn {
  flex: 1;
  padding: 16px 10px;
  border-radius: 12px;
  border: 2px solid rgba(15,23,42,0.1);
  background: rgba(15,23,42,0.03);
  text-align: center;
  transition: all .15s;
}
.size-btn .n { font-size: 22px; font-weight: 800; display: block; }
.size-btn .l { font-size: 11px; color: var(--text-dim); }
.size-btn.selected { border-color: var(--area-color); background: color-mix(in srgb, var(--area-color) 18%, transparent); }
.config-box .note { font-size: 11.5px; color: var(--text-dim); margin: 14px 0 20px; line-height: 1.5; }
.config-box .btn-go {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  background: var(--area-color);
  color: #0b1024;
  font-weight: 800;
  font-size: 15px;
}

/* ---------------- Quiz ---------------- */
.quiz-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.quiz-head .tag {
  font-size: 11.5px;
  font-weight: 800;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--area-color);
  color: #0b1024;
}
.quiz-head .quiz-back {
  font-size: 12.5px;
  color: var(--text-dim);
  padding: 6px 10px 6px 4px;
  border-radius: 8px;
  transition: color .15s;
}
.quiz-head .quiz-back:hover { color: var(--text); }
.quiz-head .progress-text { font-size: 12.5px; color: var(--text-dim); }
.quiz-head .spacer { flex: 1; }
.quiz-head .live-stats { display: flex; gap: 12px; font-size: 12.5px; }
.quiz-head .live-stats b { color: var(--good); }
.quiz-head .live-stats .miss { color: var(--bad); }
.progress-track { height: 7px; border-radius: 5px; background: rgba(15,23,42,0.08); overflow: hidden; margin-bottom: 22px; }
.progress-track > div { height: 100%; background: var(--area-color); transition: width .25s ease; }

.q-card {
  background: linear-gradient(160deg, var(--panel), var(--panel-light));
  border: 1px solid rgba(15,23,42,0.06);
  border-radius: var(--radius);
  padding: 24px;
}
.q-card .subject-label { font-size: 11.5px; color: var(--area-color); font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; }
.q-card .context {
  margin-top: 10px;
  padding: 14px 16px;
  background: rgba(15,23,42,0.04);
  border-left: 3px solid var(--area-color);
  border-radius: 8px;
  font-size: 14.5px;
  color: var(--text-dim);
  line-height: 1.6;
  white-space: pre-line;
}
.q-card .question-text { margin-top: 16px; font-size: 16.5px; font-weight: 600; line-height: 1.5; }

.opt-list { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.opt-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  text-align: left;
  padding: 13px 16px;
  border-radius: 12px;
  border: 1.5px solid rgba(15,23,42,0.1);
  background: rgba(15,23,42,0.03);
  font-size: 14.5px;
  line-height: 1.5;
  transition: all .15s;
}
.opt-item:hover:not(.disabled-choice) { border-color: var(--area-color); background: rgba(15,23,42,0.06); }
.opt-item .letter {
  flex-shrink: 0;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: rgba(15,23,42,0.08);
  display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 800;
}
.opt-item.disabled-choice { cursor: default; }
.opt-item.correct { border-color: var(--good); background: rgba(34,197,94,0.14); }
.opt-item.correct .letter { background: var(--good); color: #06210f; }
.opt-item.wrong { border-color: var(--bad); background: rgba(239,68,68,0.14); }
.opt-item.wrong .letter { background: var(--bad); color: #2a0a0a; }

.feedback-panel {
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: 12px;
  display: none;
  animation: fadeUp .25s ease;
}
.feedback-panel.show { display: block; }
.feedback-panel.ok { background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.35); }
.feedback-panel.no { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.35); }
.feedback-panel .fb-title { font-weight: 800; font-size: 14.5px; margin-bottom: 6px; }
.feedback-panel.ok .fb-title { color: var(--good); }
.feedback-panel.no .fb-title { color: var(--bad); }
.feedback-panel .fb-text { font-size: 14px; color: var(--text-dim); line-height: 1.6; }

.quiz-actions { margin-top: 20px; display: flex; justify-content: flex-end; }
.btn-next {
  padding: 12px 26px;
  border-radius: 10px;
  background: var(--area-color);
  color: #0b1024;
  font-weight: 800;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: all .2s;
}
.btn-next.show { opacity: 1; pointer-events: auto; transform: none; }

/* ---------------- Resultado ---------------- */
.result-box {
  max-width: 560px;
  margin: 10px auto;
  text-align: center;
  background: linear-gradient(160deg, var(--panel), var(--panel-light));
  border: 1px solid rgba(15,23,42,0.06);
  border-radius: var(--radius);
  padding: 32px 26px;
  border-top: 4px solid var(--area-color, var(--accent-orange));
}
.result-box .score-ring {
  width: 150px; height: 150px;
  margin: 10px auto 18px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: conic-gradient(var(--area-color) calc(var(--pct) * 1%), rgba(15,23,42,0.08) 0);
  position: relative;
}
.result-box .score-ring::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: var(--panel);
}
.result-box .score-ring .score-num { position: relative; font-size: 30px; font-weight: 800; }
.result-box .score-ring .score-lbl { position: relative; font-size: 10.5px; color: var(--text-dim); margin-top: 2px; }
.result-box h2 { font-size: 19px; font-weight: 800; margin-top: 4px; }
.result-box .stats-row { display: flex; gap: 12px; margin: 20px 0; }
.result-box .stat { flex: 1; background: rgba(15,23,42,0.04); border-radius: 12px; padding: 12px; }
.result-box .stat .n { font-size: 22px; font-weight: 800; }
.result-box .stat.good .n { color: var(--good); }
.result-box .stat.bad .n { color: var(--bad); }
.result-box .stat .l { font-size: 11px; color: var(--text-dim); text-transform: uppercase; }
.result-box .delta { font-size: 13px; color: var(--text-dim); margin-bottom: 18px; }
.result-box .delta b.up { color: var(--good); }
.result-box .delta b.down { color: var(--bad); }
.result-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.result-actions button, .result-actions a {
  padding: 12px 20px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 13.5px;
}
.result-actions .primary { background: var(--area-color); color: #0b1024; }
.result-actions .secondary { border: 1px solid rgba(15,23,42,0.15); color: var(--text); }
.result-actions .secondary:hover { border-color: var(--text); }

/* ---------------- Modal confirm ---------------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(5,8,20,0.72);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal-box {
  background: var(--panel-light);
  border: 1px solid rgba(15,23,42,0.1);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 380px;
  text-align: center;
}
.modal-box p { font-size: 14px; color: var(--text-dim); margin-top: 8px; line-height: 1.5; }
.modal-box h3 { font-size: 16px; font-weight: 800; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-actions button { flex: 1; padding: 11px; border-radius: 10px; font-weight: 700; font-size: 13.5px; }
.modal-actions .cancel { border: 1px solid rgba(15,23,42,0.15); }
.modal-actions .confirm { background: var(--bad); color: #fff; }

footer.gb-footer { text-align: center; padding: 22px 0 6px; font-size: 10.5px; color: var(--text-dim); line-height: 1.5; }

@media (max-width: 560px) {
  .home-head-title h1 { font-size: 17px; }
  .summary-strip { width: 100%; justify-content: center; }
  .quiz-head .live-stats { width: 100%; order: 3; }
}
