:root {
  --primary: #0055a5;
  --primary-light: #e6f0fb;
  --accent: #009688;
  --danger: #c62828;
  --bg: #f5f7fb;
  --text: #1f2933;
  --muted: #6b7280;
  --border: #d1d5db;
  --radius: 8px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.12);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--text);
  background-color: var(--bg);
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Utilitários */

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Header */

.app-header {
  background: linear-gradient(120deg, #003f7d, #0055a5);
  color: #fff;
  padding: 16px 0;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.app-header h1 {
  margin: 0;
  font-size: 1.5rem;
}

.subtitle {
  margin: 4px 0 0;
  font-size: 0.9rem;
  color: #e5efff;
}

.badge {
  padding: 6px 12px;
  border-radius: 999px;
  background-color: rgba(15, 23, 42, 0.25);
  font-size: 0.8rem;
}

/* Layout principal */

.app-main {
  flex: 1;
  padding: 16px 0 24px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(260px, 1fr);
  gap: 16px;
}

.panel {
  background: #fff;
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.panel-main {
  min-height: 400px;
}

.panel-header h2 {
  margin: 0;
  font-size: 1rem;
}

/* Meta e progresso */

.question-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.question-number {
  font-weight: 600;
  color: var(--primary);
}

.question-tag {
  font-size: 0.8rem;
  padding: 4px 8px;
  border-radius: 999px;
  background-color: var(--primary-light);
  color: #02416f;
}

.progress-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-bar-bg {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background-color: #e5e7eb;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.25s ease;
}

.progress-text {
  font-size: 0.8rem;
  color: var(--muted);
}

/* Área da questão */

.question-area {
  margin-top: 12px;
  flex: 1;
}

.question-text {
  font-size: 1rem;
  line-height: 1.5;
  margin: 0 0 12px;
}

/* Alternativas */

.options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.option-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease,
    background-color 0.15s ease;
}

.option-item:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.option-item input[type="radio"] {
  margin-top: 3px;
}

.option-label {
  flex: 1;
  font-size: 0.95rem;
}

/* Estados de resposta */

.option-item.selected {
  border-color: var(--primary);
  background-color: var(--primary-light);
}

.option-item.correct {
  border-color: #15803d;
  background-color: #dcfce7;
}

.option-item.incorrect {
  border-color: var(--danger);
  background-color: #fee2e2;
}

/* Feedback */

.feedback {
  min-height: 40px;
  font-size: 0.9rem;
  color: var(--muted);
}

.feedback.correct {
  color: #166534;
}

.feedback.incorrect {
  color: var(--danger);
}

/* Navegação */

.nav-footer {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: background-color 0.15s ease, box-shadow 0.15s ease,
    transform 0.05s ease;
}

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

.btn-secondary {
  background-color: #e5e7eb;
  color: #111827;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

.btn:not(:disabled):hover {
  box-shadow: var(--shadow-sm);
}

.btn:not(:disabled):active {
  transform: scale(0.98);
}

/* Painel lateral */

.panel-side {
  max-height: 520px;
}

.score-box p {
  margin: 4px 0;
  font-size: 0.9rem;
}

.panel-section {
  margin-top: 16px;
  font-size: 0.9rem;
}

.hint {
  margin: 4px 0 0;
  color: var(--muted);
}

.legend-list {
  list-style: none;
  padding: 0;
  margin: 4px 0 0;
}

.legend-list li {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.pill {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  display: inline-block;
}

.pill.easy {
  background-color: #bbf7d0;
}

.pill.medium {
  background-color: #facc15;
}

.pill.hard {
  background-color: #fecaca;
}

/* Footer */

.app-footer {
  border-top: 1px solid #e5e7eb;
  padding: 12px 0;
  font-size: 0.8rem;
  color: var(--muted);
  background: #f9fafb;
}

.footer-inner {
  text-align: center;
}

/* Acessibilidade: foco */

button:focus-visible,
.option-item:focus-visible,
input[type="radio"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Responsivo */

@media (max-width: 840px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .panel-side {
    order: -1;
  }
}

@media (max-width: 520px) {
  .app-header h1 {
    font-size: 1.2rem;
  }
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}