* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Paleta industrial/amber da imagem */
  --color-primary: #FFA500;
  --color-primary-hover: #FF8C00;
  --color-primary-glow: rgba(255, 165, 0, 0.5);
  --color-success: #7CB342;
  --color-error: #E57373;
  --color-bg: #353535;
  --color-card: #453A2A;
  --color-card-hover: #524633;
  --color-text: #E8E0D5;
  --color-text-muted: #A0A0A0;
  --radius: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  line-height: 1.5;
  padding-top: 150px; /* Espaço para o header fixo */
}

/* Header com logo - barra branca */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: #ffffff;
  padding: 1rem 1.5rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
}

.back-link {
  position: absolute;
  left: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  color: #353535;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  transition: background 0.2s, color 0.2s;
}

.back-link:hover,
.back-link:focus-visible {
  background: rgba(255, 165, 0, 0.15);
  color: #1a1510;
  outline: none;
}

.site-logo {
  height: 132px; /* 3x o tamanho original */
  width: auto;
  max-width: min(90vw, 400px);
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

/* Tablets */
@media (max-width: 768px) {
  body {
    padding-top: 130px;
  }

  .site-header {
    padding: 0.75rem 1rem;
  }

  .back-link {
    left: 0.75rem;
    font-size: 0.85rem;
    padding: 0.35rem 0.55rem;
  }

  .site-logo {
    height: 100px;
    max-width: min(85vw, 320px);
  }
}

/* Telemóveis */
@media (max-width: 480px) {
  body {
    padding-top: 110px;
  }

  .site-header {
    padding: 0.5rem 0.75rem;
  }

  .back-link {
    left: 0.4rem;
    font-size: 0.75rem;
    padding: 0.3rem 0.45rem;
  }

  .site-logo {
    height: 80px;
    max-width: min(80vw, 260px);
  }
}

/* Telemóveis muito pequenos */
@media (max-width: 360px) {
  body {
    padding-top: 95px;
  }

  .site-logo {
    height: 70px;
  }
}

#app {
  max-width: 640px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
  min-height: 100vh;
}

/* Página só com vídeo de introdução — um ecrã, 16:9 sem cortar */
body.intro-only {
  padding-top: 0 !important;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

body.intro-only .site-header {
  position: relative;
  flex-shrink: 0;
}

body.intro-only #app {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: min(1200px, 94vw);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 1.25rem;
  overflow: hidden;
}

body.intro-only #intro.screen.active {
  min-height: 0;
  width: 100%;
  justify-content: center;
}

body.intro-only .video-container {
  /* PC: até ~1200px; limita pela altura disponível para não cortar */
  width: min(1200px, 94vw, calc(100% * 1), calc((100dvh - 12rem) * 16 / 9));
  max-width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  max-height: calc(100dvh - 12rem);
}

@media (max-width: 900px) {
  body.intro-only #app {
    max-width: min(900px, 94vw);
  }

  body.intro-only .video-container {
    width: min(900px, 94vw, calc((100dvh - 11rem) * 16 / 9));
    max-height: calc(100dvh - 11rem);
  }
}

@media (max-width: 640px) {
  body.intro-only #app {
    max-width: 100%;
    padding: 0.75rem;
  }

  body.intro-only .video-container {
    width: min(100%, calc((100dvh - 9rem) * 16 / 9));
    max-height: calc(100dvh - 9rem);
  }
}

@media (max-width: 480px) {
  #app {
    padding: 1rem 0.75rem;
  }
}

.screen {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 150px);
  min-height: calc(100dvh - 150px);
}

.screen.active {
  display: flex;
}

/* Intro e Outro: vídeos e botões centrados no ecrã */
#intro,
#outro {
  min-height: calc(100vh - 150px);
  min-height: calc(100dvh - 150px);
  padding: 1rem 0;
}

@media (max-width: 768px) {
  .screen,
  #intro,
  #outro {
    min-height: calc(100vh - 130px);
    min-height: calc(100dvh - 130px);
  }
}

@media (max-width: 480px) {
  .screen,
  #intro,
  #outro {
    min-height: calc(100vh - 110px);
    min-height: calc(100dvh - 110px);
  }
}

@media (max-width: 360px) {
  .screen,
  #intro,
  #outro {
    min-height: calc(100vh - 95px);
    min-height: calc(100dvh - 95px);
  }
}

/* Vídeos */
.video-container {
  position: relative;
  width: 100%;
  max-width: 640px;
  aspect-ratio: 16/9;
  background: #1a1510;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 165, 0, 0.2);
}

.btn-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid var(--color-primary);
  background: rgba(255, 165, 0, 0.25);
  box-shadow: 0 0 24px var(--color-primary-glow);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
  z-index: 2;
}

.btn-play:hover {
  background: rgba(255, 165, 0, 0.4);
  box-shadow: 0 0 32px var(--color-primary-glow);
  transform: translate(-50%, -50%) scale(1.05);
}

.btn-play.hidden {
  display: none;
}

.play-icon {
  width: 0;
  height: 0;
  margin-left: 6px;
  border-style: solid;
  border-width: 16px 0 16px 28px;
  border-color: transparent transparent transparent var(--color-primary);
}

.video-container iframe,
.video-container video {
  width: 100%;
  height: 100%;
  border: none;
  object-fit: contain;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-touch-callout: none; /* Evita menu de contexto no iOS */
}

.video-container.hidden {
  display: none;
}

.hidden {
  display: none !important;
}

#restart-wrapper {
  margin-top: 2rem;
  text-align: center;
}

.end-actions {
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  align-items: center;
}

.end-actions .btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 160px;
}

.btn-secondary {
  background: transparent;
  color: var(--color-primary);
  box-shadow: none;
}

.btn-secondary:hover {
  background: rgba(255, 165, 0, 0.12);
  color: var(--color-primary-hover);
  box-shadow: 0 0 20px var(--color-primary-glow);
}

/* Pergunta binária SIM / NÃO (EP2 e similares) */
.binary-question {
  width: 100%;
}

.binary-options {
  gap: 1rem;
}

.binary-option {
  width: 100%;
  justify-content: center;
  text-align: center;
  font: inherit;
  color: inherit;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
}

.binary-option:disabled {
  cursor: default;
  opacity: 1;
}

.binary-label {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}


/* Botões - estilo neon/glow da imagem */
.btn {
  padding: 1rem 2.5rem;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 2px solid var(--color-primary);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 20px var(--color-primary-glow);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--color-primary);
  color: #1a1510;
  box-shadow: 0 0 16px var(--color-primary-glow);
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  color: #1a1510;
  box-shadow: 0 0 24px var(--color-primary-glow);
}

/* Quiz */
.quiz-header {
  width: 100%;
  text-align: center;
  margin-bottom: 2rem;
}

.quiz-header h1 {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
  color: var(--color-primary);
  text-shadow: 0 0 12px var(--color-primary-glow);
}

.progress {
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

#questions-container {
  width: 100%;
}

.question-block {
  display: none;
  background: var(--color-card);
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.question-block {
  transition: opacity 0.9s ease;
}

.question-block.active {
  display: block;
}

.question-block.fade-out {
  opacity: 0;
  pointer-events: none;
}

.question-block h3 {
  font-size: 1.1rem;
  margin-bottom: 1.25rem;
  color: var(--color-text);
}

.options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem;
  border: 2px solid rgba(255, 165, 0, 0.3);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.option:hover {
  border-color: var(--color-primary);
  background: rgba(255, 165, 0, 0.08);
}

.option.selected {
  border-color: var(--color-primary);
  background: rgba(255, 165, 0, 0.15);
  box-shadow: 0 0 12px rgba(255, 165, 0, 0.2);
}

.option input {
  margin-top: 2px;
  accent-color: var(--color-primary);
}

.option label {
  flex: 1;
  cursor: pointer;
}


/* Resultados */
.results-content {
  width: 100%;
  background: var(--color-card);
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.results-content h2 {
  text-align: center;
  margin-bottom: 1.5rem;
  color: var(--color-primary);
  text-shadow: 0 0 12px var(--color-primary-glow);
}

.score-text {
  text-align: center;
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}

.wrong-answers {
  margin-bottom: 1.5rem;
}

.wrong-answer-item {
  padding: 1rem;
  margin-bottom: 0.75rem;
  background: rgba(229, 115, 115, 0.12);
  border-left: 4px solid var(--color-error);
  border-radius: 0 8px 8px 0;
}

.wrong-answer-item h4 {
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  color: var(--color-text);
}

.wrong-answer-item p {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.wrong-answer-item .correct {
  color: var(--color-success);
  font-weight: 500;
}

.results-content .btn {
  width: 100%;
}
