:root {
  --gold: #C9A84C;
  --gold-light: #E8D5A3;
  --gold-dark: #A07830;
  --petroleum: #1B4D6B;
  --petroleum-dark: #0D2E40;
  --petroleum-light: #2E6E8E;
  --bg: #f8f9fa;
  --white: #ffffff;
  --text: #1a1a2e;
  --text-muted: #2f363c;
  --border: rgba(0,0,0,0.08);
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { overflow-x: hidden; max-width: 100%; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); }
a { text-decoration: none; color: inherit; }
.gold { color: var(--gold); }

/* NAV */
.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 2rem;
  background: var(--petroleum-dark);
  position: sticky; top: 0; z-index: 100;
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon { font-size: 22px; }
.logo-text { font-size: 20px; font-weight: 600; color: #fff; letter-spacing: 0.5px; }
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a { font-size: 14px; color: rgba(255,255,255,0.75); transition: color 0.2s; }
.nav-links a:hover { color: var(--gold); }
.btn-nav {
  background: var(--gold); color: var(--petroleum-dark);
  padding: 8px 20px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600;
  transition: background 0.2s;
}
.btn-nav:hover { background: var(--gold-dark); color: #fff; }

/* HERO */
.hero {
  background: var(--petroleum-dark);
  padding: 5rem 2rem 4rem;
  text-align: center;
}
.badge {
  display: inline-block;
  background: rgba(201,168,76,0.15);
  border: 1px solid rgba(201,168,76,0.4);
  color: var(--gold-light);
  font-size: 12px; padding: 5px 16px;
  border-radius: 20px; margin-bottom: 1.5rem;
  letter-spacing: 0.5px;
}
.hero h1 {
  font-size: 42px; font-weight: 700; color: #fff;
  line-height: 1.2; margin-bottom: 1.25rem;
}
.hero p {
  font-size: 16px; color: rgba(255,255,255,0.65);
  max-width: 520px; margin: 0 auto 2rem; line-height: 1.7;
}
.hero-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 3rem; }
.btn-primary {
  background: var(--gold); color: var(--petroleum-dark);
  padding: 14px 32px; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 600; border: none; cursor: pointer;
  transition: all 0.2s; display: inline-block;
}
.btn-primary:hover { background: var(--gold-dark); color: #fff; transform: translateY(-1px); }
.btn-secondary {
  background: transparent; color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
  padding: 14px 32px; border-radius: var(--radius-sm);
  font-size: 15px; cursor: pointer; display: inline-block;
  transition: all 0.2s;
}
.btn-secondary:hover { border-color: rgba(255,255,255,0.6); }

.hero-stats {
  display: flex; justify-content: center; align-items: center; gap: 2rem;
  flex-wrap: wrap;
}
.stat { text-align: center; }
.stat-num { display: block; font-size: 24px; font-weight: 700; color: var(--gold); }
.stat-label { display: block; font-size: 12px; color: rgba(255,255,255,0.8); margin-top: 2px; }
.stat-divider { width: 1px; height: 40px; background: rgba(255,255,255,0.15); }

/* FEATURES */
.features {
  padding: 5rem 2rem;
  text-align: center;
  background: var(--white);
}
.features h2 { font-size: 28px; font-weight: 600; margin-bottom: 2.5rem; color: var(--petroleum-dark); }
.features-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem; max-width: 900px; margin: 0 auto;
}
.feature-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 1.5rem;
  text-align: left;
  transition: transform 0.2s, box-shadow 0.2s;
}
.feature-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.08); }
.feature-icon { font-size: 28px; margin-bottom: 1rem; }
.feature-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 8px; color: var(--petroleum-dark); }
.feature-card p { font-size: 14.5px; font-weight: 500; color: var(--text-muted); line-height: 1.6; }

/* HOW IT WORKS */
.how-it-works {
  padding: 5rem 2rem;
  background: var(--petroleum-dark);
  text-align: center;
}
.how-it-works h2 { font-size: 28px; font-weight: 600; color: #fff; margin-bottom: 3rem; }
.steps { display: flex; justify-content: center; align-items: center; gap: 1rem; flex-wrap: wrap; }
.step {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  max-width: 220px; text-align: center;
}
.step-num {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--gold); color: var(--petroleum-dark);
  font-size: 18px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem;
}
.step h3 { font-size: 15px; font-weight: 600; color: #fff; margin-bottom: 8px; }
.step p { font-size: 13px; color: rgba(255,255,255,0.85); line-height: 1.6; }
.step-arrow { font-size: 24px; color: var(--gold); }

/* CTA */
.cta {
  padding: 5rem 2rem;
  text-align: center;
  background: var(--white);
}
.cta h2 { font-size: 28px; font-weight: 600; margin-bottom: 1rem; color: var(--petroleum-dark); }
.cta p { font-size: 16px; font-weight: 500; color: var(--text-muted); margin-bottom: 2rem; }

/* FOOTER */
.footer {
  background: var(--petroleum-dark);
  padding: 2rem;
  text-align: center;
}
.footer-logo { font-size: 20px; font-weight: 700; color: #fff; margin-bottom: 8px; }
.footer p { font-size: 13px; color: rgba(255,255,255,0.8); }
.footer-sub { margin-top: 4px; font-size: 12px; }

/* APP */
.app-layout {
  display: flex; flex-direction: column; height: 100vh;
}
.app-nav {
  background: var(--petroleum-dark);
  padding: 0.75rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.app-nav .logo-text { font-size: 18px; }
.app-nav-right { display: flex; align-items: center; gap: 1rem; }
.saldo-badge {
  background: rgba(201,168,76,0.15);
  border: 1px solid rgba(201,168,76,0.3);
  color: var(--gold-light);
  font-size: 12px; padding: 4px 12px; border-radius: 20px;
}
.btn-sair {
  background: transparent; color: rgba(255,255,255,0.85);
  border: 1px solid rgba(255,255,255,0.2);
  padding: 6px 14px; border-radius: var(--radius-sm);
  font-size: 13px; cursor: pointer;
}
.app-body {
  display: flex; flex: 1; overflow: hidden;
}
.sidebar {
  width: 280px; flex-shrink: 0;
  background: var(--white);
  border-right: 1px solid var(--border);
  padding: 1.25rem;
  overflow-y: auto;
}
.sidebar-title { font-size: 12.5px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 0.75rem; }
.sidebar select, .sidebar-select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 13px; color: var(--text);
  background: var(--bg); margin-bottom: 1rem; cursor: pointer;
}
.tipo-btns { display: flex; gap: 6px; margin-bottom: 1rem; }
.tipo-btn {
  flex: 1; padding: 8px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; cursor: pointer;
  background: var(--bg); color: var(--text-muted); text-align: center;
  transition: all 0.2s;
}
.tipo-btn.active {
  background: var(--petroleum); color: #fff; border-color: var(--petroleum);
}
.questao-select { display: none; }
.questao-select.visible { display: block; }
#sel-questao { width: auto; min-width: 110px; }

.main-content {
  flex: 1; display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg);
}
.editor-area {
  flex: 1; display: flex; gap: 0; overflow: hidden;
}
.panel {
  flex: 1; display: flex; flex-direction: column;
  border-right: 1px solid var(--border);
}
.panel:last-child { border-right: none; }
.panel-header {
  padding: 10px 16px;
  background: var(--petroleum);
  display: flex; align-items: center; justify-content: space-between;
}
.panel-header span { font-size: 13px; color: rgba(255,255,255,0.9); font-weight: 500; }
.panel-counter { font-size: 11px; color: rgba(255,255,255,0.8); }
.panel-body { flex: 1; overflow-y: auto; padding: 1rem; }
textarea.input-texto {
  width: 100%; height: 100%; border: none; resize: none;
  font-size: 14px; line-height: 1.7; color: var(--text);
  background: transparent; outline: none; font-family: inherit;
}
.resultado-texto {
  font-size: 14px; line-height: 1.8; color: var(--text);
  white-space: pre-wrap;
}
.resultado-texto h2 { font-size: 16px; color: var(--petroleum-dark); margin: 1rem 0 0.5rem; }
.resultado-texto h3 { font-size: 14px; color: var(--petroleum); margin: 0.75rem 0 0.25rem; }
.resultado-texto strong { color: var(--petroleum-dark); }
.nota-card {
  background: var(--petroleum-dark);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  text-align: center;
  display: none;
}
.nota-card.visible { display: block; }
.nota-numero { font-size: 48px; font-weight: 700; color: var(--gold); }
.nota-max { font-size: 20px; color: rgba(255,255,255,0.8); }
.nota-status { font-size: 14px; color: rgba(255,255,255,0.85); margin-top: 4px; }
.nota-aprovado { color: #4CAF50; }
.nota-reprovado { color: #f44336; }

.rodape {
  padding: 12px 16px;
  background: var(--white);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}
.btn-avaliar {
  background: var(--gold); color: var(--petroleum-dark);
  border: none; padding: 10px 28px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: all 0.2s;
}
.btn-avaliar:hover { background: var(--gold-dark); color: #fff; }
.btn-avaliar:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-limpar {
  background: transparent; color: var(--petroleum-dark);
  border: 1px solid var(--border); padding: 10px 20px;
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; cursor: pointer;
}
.status-bar { flex: 1; font-size: 13.5px; font-weight: 500; color: var(--text-muted); }

/* MODAL */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 1rem;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--white);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%; max-width: 420px;
}
.modal h2 { font-size: 20px; font-weight: 600; margin-bottom: 0.5rem; color: var(--petroleum-dark); }
.modal p { font-size: 15px; font-weight: 500; color: var(--text-muted); margin-bottom: 1.5rem; }
.modal-tabs { display: flex; gap: 0; margin-bottom: 1.5rem; border-bottom: 1px solid var(--border); }
.modal-tab {
  flex: 1; padding: 10px; text-align: center; font-size: 14px; font-weight: 500;
  cursor: pointer; color: var(--text-muted); border-bottom: 2px solid transparent;
  margin-bottom: -1px; background: none; border-left: none; border-right: none; border-top: none;
}
.modal-tab.active { color: var(--petroleum); border-bottom-color: var(--petroleum); font-weight: 600; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 13px; font-weight: 700; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.3px; }
.form-group input {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 14px; color: var(--text);
  background: var(--bg); outline: none; transition: border-color 0.2s;
}
.form-group input:focus { border-color: var(--petroleum); }
.btn-full {
  width: 100%; padding: 12px; background: var(--petroleum);
  color: #fff; border: none; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: background 0.2s;
}
.btn-full:hover { background: var(--petroleum-light); }
.modal-error { font-size: 13px; color: #e53e3e; margin-top: 0.75rem; text-align: center; }
.modal-success { font-size: 13px; color: #38a169; margin-top: 0.75rem; text-align: center; }

/* LOADING */
.loading-dots::after {
  content: ''; animation: dots 1.5s infinite;
}
@keyframes dots {
  0% { content: '.'; } 33% { content: '..'; } 66% { content: '...'; }
}

/* PLANOS */
.planos-page { max-width: 900px; margin: 0 auto; padding: 4rem 2rem; }
.planos-page h1 { font-size: 32px; font-weight: 700; text-align: center; color: var(--petroleum-dark); margin-bottom: 0.75rem; }
.planos-page p { text-align: center; font-weight: 500; color: var(--text-muted); margin-bottom: 3rem; }
.planos-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.5rem; }
.plano-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2rem 1.5rem;
  text-align: center; position: relative;
}
.plano-card.destaque { border: 2px solid var(--petroleum); }
.plano-popular {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--petroleum); color: #fff;
  font-size: 11px; padding: 4px 14px; border-radius: 20px; white-space: nowrap;
}
.plano-nome { font-size: 18px; font-weight: 600; color: var(--petroleum-dark); margin-bottom: 0.5rem; }
.plano-preco { font-size: 36px; font-weight: 700; color: var(--petroleum); margin-bottom: 0.25rem; }
.plano-preco span { font-size: 16px; color: var(--text-muted); font-weight: 500; }
.plano-desc { font-size: 14.5px; font-weight: 500; color: var(--text-muted); margin-bottom: 1.5rem; line-height: 1.6; }
.plano-btn {
  width: 100%; padding: 12px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; cursor: pointer; border: none;
  background: var(--petroleum); color: #fff; transition: background 0.2s;
}
.plano-btn:hover { background: var(--petroleum-light); }

/* Responsivo */
@media (max-width: 768px) {
  .hero h1 { font-size: 28px; }

  /* O app de avaliação (.app-layout) usa altura rígida de tela inteira
     (100vh) com painéis lado a lado -- funciona bem em telas largas, mas
     quebrava TOTALMENTE no celular: faltava dizer para o .app-body
     empilhar (ficava tentando colocar a barra lateral, forçada a 100% de
     largura, "lado a lado" com a área principal), o que empurrava o
     editor de texto (Enunciado / Sua resposta / Análise da banca) para
     fora da tela -- por isso ele nunca aparecia nos prints do celular.
     100dvh (dynamic viewport height) evita o problema clássico do 100vh
     em mobile, que não encolhe quando a barra de endereço do navegador
     aparece/some. */
  .app-layout { height: auto; min-height: 100dvh; }
  .app-body { flex-direction: column; overflow: visible; }
  .sidebar { width: 100%; max-height: none; overflow-y: visible; border-right: none; border-bottom: 1px solid var(--border); }
  .editor-area { flex-direction: column; overflow: visible; }
  .panel { flex: none; min-height: 280px; border-right: none; border-bottom: 1px solid var(--border); }
  .panel:last-child { border-bottom: none; }
  .panel-body { flex: none; height: 220px; }
  .rodape { flex-wrap: wrap; }

  .step-arrow { transform: rotate(90deg); }

  /* Em telas estreitas, os links do topo (Início, Simulado, Treino Livre,
     Qual norma, Upload de Provas/Espelhos...) não cabem numa linha só --
     sem isso quebravam em 3-4 linhas inteiras, empurrando todo o resto da
     tela pra baixo. Reduzindo o espaçamento e a fonte, cabe em menos
     espaço vertical. */
  .app-nav { flex-wrap: wrap; row-gap: 6px; padding: 0.65rem 1rem; }
  .app-nav-right { flex-wrap: wrap; justify-content: center; gap: 0.5rem; width: 100%; }
  .app-nav-right a, .app-nav-right .saldo-badge { font-size: 11.5px !important; }
  .app-nav-right .btn-sair { font-size: 11.5px; padding: 4px 10px; }
}
