/* Base and global styles */
/* (#13) Montserrat carregada via JS — fallback seguro */
html,
body {
  margin: 0;
  padding: 0;
  font-family: 'Montserrat', 'Gotham', sans-serif;
  background: radial-gradient(circle at 30% 30%, #f8fafc 0%, #eef2f7 50%, #e5eaf1 100%),
              radial-gradient(circle at 80% 80%, #f8fafc 0%, #eef2f7 50%, #e5eaf1 100%);
  color: #000;
  min-height: 100vh;
  /* Mobile: previne zoom indesejado */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Melhorias globais de toque para mobile */
*,
*::before,
*::after {
  -webkit-tap-highlight-color: transparent;
}

button, .card-option, .multi-select-option, .button-option {
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Container for quiz steps */
.quiz-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  padding: 80px 16px 140px;
  box-sizing: border-box;
  text-align: center;
}

/* Result page container */
.result-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  background: linear-gradient(180deg, #1e2533 0%, #10131d 100%);
  padding: 60px 16px 140px;
  box-sizing: border-box;
  color: #fff;
}

.result-card-title {
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 6px;
}

.result-card-sub {
  font-size: 13px;
  opacity: 0.85;
  line-height: 1.35;
}

.result-card-match {
  font-size: 12px;
  opacity: 0.7;
  line-height: 1.35;
  margin-top: 2px;
}

/* Question heading */
.question-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 1px;
  margin: 40px 0 32px;
  text-align: center;
  color: #111;
  font-family: 'Montserrat', 'Gotham', sans-serif;
  text-transform: uppercase;
  padding: 0 8px;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* Simple button options */
.button-options {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin-bottom: 64px;
  padding: 0 8px;
  width: 100%;
  max-width: 600px;
}

.button-option {
  border: 1px solid #000;
  color: #000;
  min-width: 160px;
  padding: 16px 36px;
  border-radius: 32px;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
  background: #ffffff;
  font-family: inherit;
}

.button-option:hover {
  background: #000;
  color: #fff;
}

.button-option:active {
  background: #000;
  color: #fff;
}

.button-option.selected {
  background: #000;
  color: #fff;
}

/* Card grid styles */
.card-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  width: 100%;
  max-width: 1200px;
  margin-bottom: 64px;
  padding: 0 8px;
  box-sizing: border-box;
}

.card-option {
  position: relative;
  flex: 0 1 calc(33.333% - 16px);
  min-width: 200px;
  height: 200px;
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  transition: transform 0.2s ease;
}

.card-option:hover {
  transform: translateY(-4px);
}

.card-option:active {
  transform: scale(0.97);
}

.card-option img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-option .overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  top: 50%;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0) 70%);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  padding: 16px;
  box-sizing: border-box;
  text-align: left;
}

.card-option .overlay h3 {
  margin: 0 0 4px 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.2;
}

.card-option .overlay p {
  margin: 0;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.2;
}

/* Scale selector */
.scale-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  margin-bottom: 32px;
  padding: 0 12px;
  box-sizing: border-box;
}

.scale-labels {
  display: flex;
  justify-content: space-between;
  width: 100%;
  max-width: 500px;
  font-size: 14px;
  margin-bottom: 10px;
  color: #333;
}

.scale-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 500px;
  gap: 4px;
}

.scale-options button {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  transition: transform 0.15s ease;
  font-family: inherit;
  padding: 0;
  flex-shrink: 1;
}

.scale-options button.selected {
  outline: 3px solid #000;
  outline-offset: 2px;
  transform: scale(1.15);
}

.scale-options button:active {
  transform: scale(0.9);
}

/* Multi-select grid */
.multi-select-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(140px, 1fr));
  gap: 12px;
  width: 100%;
  max-width: 800px;
  margin-bottom: 24px;
  padding: 0 8px;
  box-sizing: border-box;
}

@media (max-width: 900px) {
  .multi-select-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 520px) {
  .multi-select-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
}

@media (max-width: 360px) {
  .multi-select-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
}

.multi-select-option {
  position: relative;
  height: 150px;
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: transform 0.15s ease;
}

.multi-select-option:active {
  transform: scale(0.96);
}

.multi-select-option img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.multi-select-option .overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px;
  font-size: 14px;
  font-weight: 500;
}

.multi-select-option .check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  color: #000;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

.multi-select-option.selected .overlay {
  background: rgba(0, 0, 0, 0.6);
  border: 3px solid #fff;
  border-radius: 14px;
}

.multi-select-option.selected .check {
  background: #000;
  color: #fff;
}

/* Start screen styles */
.start-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  padding: 80px 16px 140px;
  box-sizing: border-box;
  text-align: center;
}

.start-tagline {
  font-size: 14px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #555;
  margin: 0 0 8px 0;
}

.start-title {
  font-size: 60px;
  font-weight: 400;
  letter-spacing: 12px;
  margin: 0 0 10px 0;
  color: #111;
  text-transform: uppercase;
  word-break: break-word;
  overflow-wrap: break-word;
}

.start-description {
  font-size: 16px;
  font-weight: 400;
  max-width: 520px;
  margin: 0 0 24px 0;
  color: #555;
  line-height: 1.5;
  padding: 0 12px;
}

.start-note {
  font-size: 12px;
  color: #777;
  margin: 8px 0 24px;
  padding: 0 12px;
}

.start-input {
  width: 100%;
  max-width: 420px;
  padding: 14px 24px;
  border: 1px solid #ccc;
  border-radius: 30px;
  /* font-size 16px previne zoom em iOS ao focar o input */
  font-size: 16px;
  color: #333;
  background: #fff;
  box-sizing: border-box;
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
}

.start-input:focus {
  outline: none;
  border-color: #000;
}

.start-button {
  background: #fff;
  color: #000;
  border: 1px solid #000;
  padding: 16px 40px;
  font-size: 14px;
  letter-spacing: 2px;
  text-transform: uppercase;
  border-radius: 32px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
  min-width: 220px;
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
}

.start-button:hover {
  background: #000;
  color: #fff;
}

.start-button:active:not(:disabled) {
  background: #000;
  color: #fff;
  transform: scale(0.97);
}

/* (#5) Botão "Continuar" desabilitado quando nenhuma nota selecionada */
.start-button.disabled,
.start-button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  background: #fff;
  color: #000;
  pointer-events: none;
}

.start-button.disabled:hover,
.start-button:disabled:hover {
  background: #fff;
  color: #000;
}

/* Footer — revisado para mobile com safe-area */
.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
  color: #666;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid rgba(0,0,0,0.06);
}

.footer-disclaimer {
  max-width: 70%;
  line-height: 1.4;
  color: #666;
  font-size: 12px;
}

.footer-logo {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #222;
  padding: 6px 0;
  flex-shrink: 0;
}

.footer-logo img {
  max-height: 36px;
  width: auto;
}

.footer-logo img.logo-mobile {
  display: none;
}

/* Footer variation for dark result page */
.footer.dark {
  background: rgba(16, 19, 29, 0.88);
  border-top-color: rgba(255,255,255,0.08);
  color: rgba(255, 255, 255, 0.7);
}
.footer.dark .footer-disclaimer {
  color: rgba(255, 255, 255, 0.5);
}
.footer.dark .footer-logo {
  color: #fff;
}

/* Result page styles */
.result-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 20px;
  text-align: center;
  font-family: 'Montserrat', sans-serif;
  padding: 0 12px;
}

.result-description {
  font-size: 16px;
  margin-bottom: 36px;
  max-width: 700px;
  text-align: center;
  line-height: 1.5;
  padding: 0 12px;
}

/* Back button style — com área de toque grande para mobile */
.back-button {
  position: absolute;
  top: 20px;
  left: 12px;
  border: none;
  background: transparent;
  font-size: 28px;
  cursor: pointer;
  color: #000;
  padding: 8px;
  z-index: 10;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.back-button:active {
  opacity: 0.5;
}

/* =======================
   PROGRESS BAR
   ======================= */

.progress-container {
  width: 100%;
  max-width: 520px;
  margin: 0 auto 12px;
  padding: 8px 8px 20px 8px;
  box-sizing: border-box;
}

.progress-bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: #000;
  transition: width 0.35s ease;
}

.progress-text {
  margin-top: 8px;
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #555;
}

/* versao escura no result */
.progress-container.progress-dark .progress-bar {
  background: rgba(255, 255, 255, 0.18);
}
.progress-container.progress-dark .progress-fill {
  background: #fff;
}
.progress-container.progress-dark .progress-text {
  color: rgba(255, 255, 255, 0.75);
}

.result-list {
  width: 100%;
  max-width: 980px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  margin-top: 18px;
  padding: 0 8px;
  box-sizing: border-box;
}

.result-card {
  width: 100%;
  max-width: 300px;
  text-decoration: none;
  color: inherit;
  border-radius: 18px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.result-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.result-card:active {
  transform: scale(0.98);
}

.result-card-img {
  width: 100%;
  aspect-ratio: 2 / 3;
  height: auto;
  object-fit: cover;
  display: block;
  border-radius: 18px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.18);
  transform: scale(1.02);
}

.result-card-body {
  padding: 14px 14px 16px;
}

/* ================================
   RESPONSIVE
   ================================ */

/* Tablets */
@media (max-width: 768px) {
  .question-title {
    font-size: 22px;
    margin: 30px 0 24px;
    padding: 0 40px;
  }

  .card-option {
    flex: 0 1 calc(50% - 12px);
    min-width: unset;
    height: 180px;
  }

  .card-option .overlay h3 {
    font-size: 16px;
  }

  .card-option .overlay p {
    font-size: 12px;
  }

  .scale-labels {
    font-size: 12px;
  }

  .scale-options button {
    width: 36px;
    height: 36px;
    min-width: 36px;
    font-size: 13px;
    border-radius: 8px;
  }
}

/* Phones */
@media (max-width: 600px) {
  .start-container {
    padding: 60px 16px 140px;
    justify-content: flex-start;
    padding-top: 80px;
  }

  .start-title {
    font-size: 36px;
    letter-spacing: 6px;
  }

  .start-tagline {
    font-size: 12px;
    letter-spacing: 2px;
  }

  .start-description {
    font-size: 14px;
  }

  .quiz-container {
    padding: 60px 12px 140px;
  }

  .question-title {
    font-size: 18px;
    margin: 24px 0 20px;
    padding: 0 36px;
    letter-spacing: 0.5px;
  }

  .button-options {
    gap: 12px;
    margin-bottom: 40px;
  }

  .button-option {
    min-width: 140px;
    padding: 14px 28px;
    font-size: 14px;
  }

  .card-grid {
    gap: 12px;
    margin-bottom: 40px;
  }

  .card-option {
    flex: 0 1 100%;
    min-width: unset;
    height: 180px;
  }

  .card-option .overlay {
    top: 55%;
    padding: 14px;
  }

  .card-option .overlay h3 {
    font-size: 17px;
  }

  .scale-wrapper {
    padding: 0 8px;
  }

  .scale-labels {
    font-size: 11px;
    max-width: 100%;
  }

  .scale-options {
    max-width: 100%;
    gap: 3px;
  }

  .scale-options button {
    width: 30px;
    height: 44px;
    min-width: 28px;
    font-size: 12px;
    border-radius: 8px;
    flex: 1;
  }

  .multi-select-option {
    height: 120px;
    border-radius: 12px;
  }

  .multi-select-option .overlay {
    font-size: 13px;
    padding: 6px;
  }

  .multi-select-option.selected .overlay {
    border-radius: 12px;
  }

  .footer {
    padding: 8px 12px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  }

  .footer-disclaimer {
    font-size: 8px;
    flex: 0 0 70%;
    max-width: 70%;
    line-height: 1.3;
  }

  .footer-logo {
    flex: 0 0 30%;
    max-width: 30%;
    display: flex;
    justify-content: flex-end;
  }

  .footer-logo img {
    max-height: 28px;
  }

  .footer-logo img.logo-desktop {
    display: none;
  }

  .footer-logo img.logo-mobile {
    display: block;
  }

  .result-container {
    padding: 50px 12px 140px;
  }

  .result-title {
    font-size: 22px;
  }

  .result-description {
    font-size: 14px;
  }

  .result-list {
    gap: 14px;
  }

  .result-card {
    max-width: 280px;
  }

  .result-card-title {
    font-size: 15px;
  }
}

/* Very small phones (iPhone SE, Galaxy S older) */
@media (max-width: 375px) {
  .start-title {
    font-size: 30px;
    letter-spacing: 4px;
  }

  .question-title {
    font-size: 16px;
    padding: 0 30px;
  }

  .button-option {
    min-width: 120px;
    padding: 12px 20px;
    font-size: 13px;
  }

  .scale-options button {
    width: 26px;
    height: 40px;
    min-width: 24px;
    font-size: 11px;
  }

  .card-option {
    height: 160px;
  }

  .multi-select-option {
    height: 100px;
  }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
  .quiz-container,
  .start-container {
    min-height: auto;
    padding-top: 50px;
    padding-bottom: 100px;
  }

  .question-title {
    margin: 16px 0 16px;
    font-size: 18px;
  }

  .card-option {
    height: 150px;
  }
}