:root {
  --bg: #0f172a;
  --card: #1e293b;
  --border: #334155;
  --text: #e2e8f0;
  --text-bright: #f8fafc;
  --muted: #94a3b8;
  --muted-dim: #64748b;
  --accent: #2563eb;
  --accent-bright: #60a5fa;
  --success: #16a34a;
}

:root[data-theme="light"] {
  --bg: #f8fafc;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-bright: #070d18;
  --muted: #64748b;
  --muted-dim: #94a3b8;
  --accent: #087cff;
  --accent-bright: #2563eb;
  --success: #16a34a;
}

#theme-toggle {
  position: fixed;
  top: 20px;
  right: max(24px, calc((100vw - 1400px) / 2 + 24px));
  z-index: 10;
  white-space: nowrap;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 14px;
  cursor: pointer;
}

#theme-toggle:hover {
  border-color: var(--accent);
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  position: relative;
  min-height: 100vh;
  margin: 0;
  max-width: 100vw;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ponytail: absolute (preso ao documento) em vez de fixed (preso ao viewport) —
   fixed piscava/sumia no mobile porque a barra de endereco do navegador recolhe/expande
   e muda a altura do viewport a cada scroll, fazendo o elemento "pular" */
#watermark {
  position: absolute;
  bottom: 20px;
  right: max(20px, calc((100vw - 1400px) / 2 + 20px));
  width: min(15vw, 180px);
  height: min(15vw, 180px);
  z-index: 0;
  background: url("../assets/watermark-dark.png") no-repeat center / contain;
  opacity: 0.25;
  pointer-events: none;
}

:root[data-theme="light"] #watermark {
  background-image: url("../assets/watermark-light.png");
  opacity: 0.12;
}

#app {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 24px 32px;
}

.screen {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

h1 {
  margin: 0 0 8px;
  font-size: 28px;
  color: var(--text-bright);
}

.subtitle {
  color: var(--muted);
  margin: 0 0 28px;
}

.center {
  text-align: center;
}

.home-hero {
  min-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.home-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 56px 64px;
  max-width: 620px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.home-card-topbar {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 16px;
}

.home-card-topbar #theme-toggle {
  position: static;
  margin: 0;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}

.card + .card {
  margin-top: 12px;
}

.btn {
  display: block;
  width: 100%;
  padding: 14px;
  border-radius: 8px;
  border: none;
  font-size: 15px;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-secondary {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: color-mix(in srgb, var(--card) 80%, var(--accent-bright) 20%);
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-success:hover {
  background: #128a3e;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.area-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.area-nav-btn {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  cursor: pointer;
}

.area-nav-btn:hover {
  border-color: var(--accent-bright);
  color: var(--text);
}

.area-nav-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.wizard-title {
  color: var(--text-bright);
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  margin: 0 0 18px;
}

.btn-voltar {
  display: block;
  margin: 14px auto 0;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}

.btn-voltar:hover {
  color: var(--accent-bright);
}

.idioma-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 20px;
  color: var(--text);
  font-size: 14px;
}

.idioma-label {
  color: var(--muted);
}

.idioma-row label {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.btn-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 320px;
  margin: 0 auto;
}

.footnote {
  color: var(--muted);
  font-size: 15px;
  font-family: Georgia, 'Times New Roman', serif;
  margin-top: 32px;
  text-align: center;
  line-height: 1.9;
}

.top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-right: 130px;
}

.top-row .pill:last-of-type {
  margin-right: auto;
  margin-left: 24px;
}

.top-row #btn-pausar {
  margin-left: 10px;
}

.pill {
  color: var(--muted);
  font-size: 13px;
}

.timer-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.timer-row .progress-bar {
  flex: 1;
  margin-bottom: 0;
}

.timer-display {
  font-variant-numeric: tabular-nums;
  font-family: 'Courier New', monospace;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 1px;
  text-align: center;
  color: var(--accent);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 18px;
  transition: color 0.2s, border-color 0.2s;
  white-space: nowrap;
}

.question-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 28px;
  align-items: start;
}

.question-left {
  max-height: calc(100vh - 220px);
  overflow-y: auto;
  padding-right: 8px;
}

.question-right {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (max-width: 860px) {
  .question-grid {
    grid-template-columns: 1fr;
  }
  .question-left {
    max-height: none;
    overflow-y: visible;
  }
}

.timer-display.timer-alerta {
  color: #fbbf24;
  border-color: #fbbf24;
}

.timer-display.timer-esgotado {
  color: #f87171;
  border-color: #f87171;
  animation: timer-pulse 1s infinite;
}

@keyframes timer-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.btn-reiniciar {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
}

#pausable-content.pausado {
  pointer-events: none;
  user-select: none;
}

.btn-reiniciar:hover {
  color: #f87171;
  border-color: #f87171;
}

.tempo-gasto {
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
}

.list-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.list-row .list-item {
  flex: 1;
}

.list-delete {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  padding: 0 14px;
  font-size: 14px;
}

.list-delete:hover {
  color: #f87171;
  border-color: #f87171;
}

.progress-bar {
  height: 6px;
  background: var(--card);
  border-radius: 3px;
  margin-bottom: 20px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.2s ease;
}

.statement {
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 8px;
}

.question-image {
  max-width: 100%;
  display: block;
  margin: 12px auto;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.motivational-text {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 16px;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  background: var(--card);
  cursor: pointer;
}

.option:hover {
  border-color: var(--accent-bright);
  background: color-mix(in srgb, var(--card) 85%, var(--accent-bright) 15%);
}

.option.selected {
  border: 2px solid var(--accent);
  background: var(--card);
  color: var(--text-bright);
  padding: 11px 13px;
}

.nav-row {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
  gap: 12px;
}

.nav-row .btn {
  width: auto;
  flex: 1;
  padding: 10px 18px;
}

.theme-label {
  color: var(--accent-bright);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
  letter-spacing: 0.04em;
}

.theme-title {
  font-size: 16px;
  color: var(--text-bright);
  font-weight: 600;
}

.theme-text {
  color: var(--muted);
  font-size: 13px;
  margin-top: 8px;
  line-height: 1.6;
}

.textarea {
  width: 100%;
  min-height: 220px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
}

.textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.counter-row {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  color: var(--muted-dim);
  font-size: 12px;
}

.score-block {
  text-align: center;
  margin-bottom: 16px;
  padding: 20px 16px;
}

.score-label {
  font-size: 13px;
  color: var(--muted);
}

.score-value {
  font-size: 42px;
  font-weight: 700;
  color: var(--text-bright);
}

.score-value .score-max {
  font-size: 18px;
  color: var(--muted-dim);
}

.score-disclaimer {
  font-size: 11px;
  color: var(--muted-dim);
  margin-top: 4px;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.result-grid .card {
  padding: 12px;
}

.result-grid .area-label {
  color: var(--muted);
  font-size: 12px;
}

.result-grid .area-score {
  color: var(--text-bright);
  font-size: 20px;
  font-weight: 600;
}

.checklist-title {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
  letter-spacing: 0.03em;
}

.checklist-item {
  color: var(--text);
  font-size: 13px;
  line-height: 1.8;
}

.brand-logo {
  max-width: 260px;
  margin: 0 auto 28px;
  display: block;
}

.revisao-area {
  margin-bottom: 16px;
}

.revisao-item {
  border-top: 1px solid var(--border);
  padding: 10px 0;
}

.revisao-statement {
  color: var(--text);
  font-size: 13px;
  margin-bottom: 6px;
}

.revisao-errada {
  color: #f87171;
  font-size: 12px;
  margin: 2px 0;
}

.revisao-correta {
  color: #4ade80;
  font-size: 12px;
  margin: 2px 0;
}

.list-item {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 12px 14px;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  margin-top: 8px;
}

.list-item:hover {
  border-color: var(--accent-bright);
}

.empty-state {
  color: var(--muted-dim);
  font-size: 13px;
  text-align: center;
  padding: 8px 0;
}

/* tablet (portrait principalmente) — nem tao compacto quanto celular, nem tao espacoso
   quanto desktop; sem isso ficava com padding/max-width pensados pra tela de 1400px */
@media (min-width: 641px) and (max-width: 1024px) {
  #app {
    padding: 20px;
  }

  .home-hero {
    min-height: calc(100vh - 40px);
  }

  .home-card {
    max-width: 480px;
    padding: 40px 40px;
  }

  .brand-logo {
    max-width: 210px;
  }

  h1 {
    font-size: 26px;
  }

  .subtitle {
    font-size: 14px;
  }

  .question-grid {
    gap: 20px;
  }
}

@media (max-width: 640px) {
  #app {
    padding: 16px;
  }

  #theme-toggle {
    position: static;
    display: block;
    margin: 0 0 16px auto;
  }

  .top-row {
    flex-wrap: wrap;
    row-gap: 8px;
    padding-right: 0;
  }

  .top-row .pill:last-of-type {
    margin-left: 0;
  }

  .area-nav {
    gap: 6px;
  }

  .area-nav-btn {
    padding: 5px 11px;
    font-size: 11px;
  }

  /* marca d'agua no rodape da pagina ficava caindo em cima do nav-row (Anterior/Proxima) em
     paginas de questao longas — no mobile ela some do canto fixo e passa a ficar no fundo do
     bloco de alternativas, onde sempre ha espaco livre abaixo da ultima opcao */
  #watermark {
    display: none;
  }

  .options {
    position: relative;
    padding-bottom: 56px;
  }

  .options::before {
    content: '';
    position: absolute;
    right: 8px;
    bottom: 8px;
    width: 56px;
    height: 56px;
    background: url("../assets/watermark-dark.png") no-repeat center / contain;
    opacity: 0.2;
    pointer-events: none;
  }

  :root[data-theme="light"] .options::before {
    background-image: url("../assets/watermark-light.png");
  }

  .home-hero {
    min-height: calc(100vh - 32px);
    padding: 8px 0;
  }

  #theme-toggle {
    margin-bottom: 6px;
    padding: 7px 12px;
    font-size: 13px;
  }

  .home-card {
    padding: 36px 26px;
  }

  .brand-logo {
    max-width: 200px;
    margin-bottom: 14px;
  }

  h1 {
    font-size: 28px;
    margin-bottom: 8px;
  }

  .subtitle {
    font-size: 14px;
    margin-bottom: 14px;
  }

  .wizard-title {
    margin-bottom: 16px;
    font-size: 16px;
  }

  .idioma-row {
    margin-bottom: 20px;
    font-size: 15px;
  }

  .btn-group {
    gap: 12px;
  }

  .btn {
    padding: 17px;
    font-size: 16px;
  }

  .footnote {
    margin-top: 14px;
    font-size: 12px;
    line-height: 1.6;
  }
}
