/* =========================================================
   SEMÁFORO DA SAÚDE MENTAL — sistema visual "Sinaleira"
   Metáfora: sinais luminosos reais, vistos ao entardecer.
   Paleta: céu noturno + três luzes de sinaleira.
   Tipografia: Space Grotesk (display) / Inter (texto) / Space Mono (painel de controle).
   ========================================================= */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/inter-variable.woff2") format("woff2");
}

@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url("../fonts/space-grotesk-variable.woff2") format("woff2");
}

@font-face {
  font-family: "Space Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/space-mono-400.woff2") format("woff2");
}

@font-face {
  font-family: "Space Mono";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/space-mono-700.woff2") format("woff2");
}

:root {
  --ink: #0b0e1f;
  --panel: #161a37;
  --panel-2: #1f254a;
  --mist: #a9aede;
  --paper: #f6f4ec;
  --green: #34d399;
  --amber: #ffb547;
  --red: #ff6161;
  --hairline: rgba(169, 174, 222, 0.16);
  --shadow-deep: 0 24px 60px rgba(0, 0, 0, 0.45);
  --radius: 26px;
  --font-display: "Space Grotesk", "Inter", Arial, sans-serif;
  --font-body: "Inter", Arial, sans-serif;
  --font-mono: "Space Mono", ui-monospace, "Courier New", monospace;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--paper);
  background:
    radial-gradient(circle at 15% -10%, rgba(52, 211, 153, 0.14), transparent 40%),
    radial-gradient(circle at 110% 10%, rgba(255, 97, 97, 0.12), transparent 45%),
    radial-gradient(circle at 50% 120%, rgba(255, 181, 71, 0.10), transparent 50%),
    var(--ink);
  overflow-x: hidden;
  touch-action: manipulation;
}

/* faint starfield atmosphere for the dusk sky */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 10% 20%, rgba(246, 244, 236, 0.35), transparent),
    radial-gradient(1px 1px at 80% 15%, rgba(246, 244, 236, 0.3), transparent),
    radial-gradient(1.5px 1.5px at 60% 70%, rgba(246, 244, 236, 0.25), transparent),
    radial-gradient(1px 1px at 30% 85%, rgba(246, 244, 236, 0.3), transparent),
    radial-gradient(1px 1px at 92% 60%, rgba(246, 244, 236, 0.25), transparent),
    radial-gradient(1.5px 1.5px at 45% 35%, rgba(246, 244, 236, 0.2), transparent);
  background-size: 100% 100%;
}

.fullscreen-btn {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 9999;
  width: 60px;
  height: 60px;
  border: 1px solid var(--hairline);
  border-radius: 18px;
  background: var(--panel);
  color: var(--paper);
  font-size: 1.6rem;
  font-weight: bold;
  cursor: pointer;
  box-shadow: var(--shadow-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, background 0.15s ease;
}

.fullscreen-btn:active {
  transform: scale(0.94);
  background: var(--panel-2);
}

.app {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 100vh;
  padding: 28px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.screen {
  width: 100%;
  max-width: 1000px;
  display: none;
  animation: fadeIn 0.4s ease;
}

.screen.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card {
  background: linear-gradient(180deg, var(--panel), var(--ink));
  border-radius: var(--radius);
  box-shadow: var(--shadow-deep);
  padding: 40px;
  border: 1px solid var(--hairline);
}

.center {
  text-align: center;
}

.eyebrow {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.85rem;
  color: var(--mist);
  margin: 0 0 14px;
}

h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.1rem, 4.6vw, 3.6rem);
  margin: 0 0 16px;
  line-height: 1.05;
  letter-spacing: -0.01em;
}

h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.7rem, 3.6vw, 2.6rem);
  margin: 0 0 14px;
  letter-spacing: -0.01em;
}

h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.4rem;
  margin: 22px 0 12px;
}

p {
  font-size: clamp(1rem, 1.8vw, 1.2rem);
  line-height: 1.55;
  margin: 12px 0;
  color: var(--paper);
}

.subtitle {
  color: var(--mist);
  max-width: 720px;
  margin: 0 auto 26px;
}

.hint {
  color: var(--mist);
  font-size: 1.05rem;
  margin-bottom: 24px;
}

/* =========================================================
   BEACON — o componente-assinatura: uma lanterna de sinaleira,
   reaproveitada no hero, nas opções e no painel de resultado.
   ========================================================= */

.beacon-wrap {
  position: relative;
  width: 84px;
  height: 108px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.beacon-glow {
  position: absolute;
  inset: -16px;
  border-radius: 50%;
  filter: blur(18px);
  opacity: var(--glow, 0.55);
  background: var(--lamp-color, var(--mist));
  transition: opacity 0.6s ease;
  z-index: 0;
}

.beacon {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  color: var(--lamp-color, var(--mist));
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.35));
}

.beacon-wrap--green { --lamp-color: var(--green); }
.beacon-wrap--amber { --lamp-color: var(--amber); }
.beacon-wrap--red { --lamp-color: var(--red); }

@media (prefers-reduced-motion: no-preference) {
  .beacon-wrap {
    animation: beacon-warm-up 0.7s ease both;
  }

  .legend-card:nth-child(1) .beacon-wrap { animation-delay: 0.05s; }
  .legend-card:nth-child(2) .beacon-wrap { animation-delay: 0.2s; }
  .legend-card:nth-child(3) .beacon-wrap { animation-delay: 0.35s; }
}

@keyframes beacon-warm-up {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* start screen: legend cards replace the old duplicated dots + grid */
.legend {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin: 32px 0;
}

.legend-card {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: 22px;
  padding: 26px 20px;
  text-align: center;
}

.legend-card strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  margin: 16px 0 8px;
}

.legend-card p {
  font-size: 0.98rem;
  color: var(--mist);
  margin: 0;
  line-height: 1.45;
}

.start-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 30px;
}

/* =========================================================
   BUTTONS — verde = seguir em frente (semanticamente "sinal aberto").
   ========================================================= */

.btn {
  font-family: var(--font-body);
  border: none;
  border-radius: 18px;
  padding: 20px 30px;
  font-size: 1.25rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 70px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease, background 0.15s ease;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3);
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--green);
  color: #04241a;
  box-shadow: 0 10px 28px rgba(52, 211, 153, 0.35);
}

.btn-secondary {
  background: var(--panel-2);
  color: var(--paper);
  border: 1px solid var(--hairline);
  box-shadow: none;
}

.btn-light {
  background: transparent;
  color: var(--mist);
  border: 1px solid var(--hairline);
  box-shadow: none;
}

/* =========================================================
   QUIZ SCREEN
   ========================================================= */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
  padding-right: 70px;
}

.progress-wrap {
  flex: 1;
  min-width: 260px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.progress-dots {
  display: flex;
  gap: 8px;
}

.progress-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--panel-2);
  border: 1px solid var(--hairline);
  transition: background 0.25s ease, box-shadow 0.25s ease, transform 0.2s ease;
}

.progress-dot.is-current {
  transform: scale(1.25);
  border-color: var(--paper);
}

.progress-dot.is-green { background: var(--green); box-shadow: 0 0 10px rgba(52, 211, 153, 0.7); border-color: transparent; }
.progress-dot.is-amber { background: var(--amber); box-shadow: 0 0 10px rgba(255, 181, 71, 0.7); border-color: transparent; }
.progress-dot.is-red { background: var(--red); box-shadow: 0 0 10px rgba(255, 97, 97, 0.7); border-color: transparent; }

.progress-count {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--mist);
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.question-title {
  font-family: var(--font-mono);
  color: var(--mist);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.95rem;
  margin-bottom: 10px;
}

.question-icon {
  font-size: clamp(3rem, 7vw, 4.5rem);
  margin-bottom: 6px;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.4));
}

.question-text {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3.6vw, 2.5rem);
  font-weight: 700;
  line-height: 1.18;
  margin: 8px 0 16px;
  letter-spacing: -0.01em;
}

.options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 24px;
}

.option-btn {
  border: 2px solid var(--hairline);
  border-radius: 24px;
  padding: 26px 16px;
  min-height: 230px;
  cursor: pointer;
  text-align: center;
  font-family: var(--font-body);
  font-weight: 600;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.2s ease;
  background: var(--panel);
  color: var(--paper);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.option-btn .beacon-wrap {
  width: 68px;
  height: 88px;
}

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

.option-btn.selected {
  border-color: var(--lamp-color);
  background: var(--panel-2);
  transform: translateY(-4px);
}

.option-btn.option-green { --lamp-color: var(--green); }
.option-btn.option-yellow { --lamp-color: var(--amber); }
.option-btn.option-red { --lamp-color: var(--red); }

.option-btn:not(.selected) .beacon-glow {
  opacity: 0.25;
}

.option-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
}

.option-desc {
  font-size: 0.95rem;
  line-height: 1.35;
  font-weight: 400;
  color: var(--mist);
}

.nav-actions {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 28px;
  flex-wrap: wrap;
}

.nav-actions .btn {
  flex: 1;
  min-width: 220px;
}

/* =========================================================
   RESULT SCREEN — painel de sinal: intensidade do brilho
   é proporcional à contagem de cada cor.
   ========================================================= */

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 22px 0;
}

.score-card {
  border-radius: 22px;
  padding: 20px 14px;
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--hairline);
}

.score-card .beacon-wrap {
  width: 56px;
  height: 72px;
  margin-bottom: 8px;
}

.score-card .num {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 700;
  margin: 4px 0;
}

.score-card .label {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--mist);
}

.score-card div:last-child {
  font-size: 0.85rem;
  color: var(--mist);
}

.result-box {
  border-radius: 22px;
  padding: 22px;
  margin: 16px 0;
  background: var(--panel);
  border-left: 6px solid var(--hairline);
}

.result-box.yellow-border {
  border-left-color: var(--amber);
}

.result-box.red-border {
  border-left-color: var(--red);
}

.result-box ul {
  margin: 12px 0 0;
  padding-left: 22px;
}

.result-box li {
  margin: 10px 0;
  font-size: 1rem;
  line-height: 1.42;
  color: var(--paper);
}

.result-box li strong {
  color: var(--paper);
}

.badge {
  display: inline-block;
  font-family: var(--font-mono);
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.badge-yellow {
  background: rgba(255, 181, 71, 0.16);
  color: var(--amber);
}

.badge-red {
  background: rgba(255, 97, 97, 0.16);
  color: var(--red);
}

.general-feedback {
  background: var(--panel);
  border-left: 6px solid var(--mist);
  border-radius: 22px;
  padding: 22px;
  margin-top: 18px;
}

.general-feedback p {
  color: var(--paper);
}

/* the crisis line is the one place this dark UI deliberately
   breaks into a lit, paper-toned panel — it should read as
   the most important thing on the screen. */
.disclaimer {
  background: var(--paper);
  border-left: 6px solid var(--red);
  border-radius: 22px;
  padding: 20px;
  color: #3a1414;
  font-size: 1rem;
  line-height: 1.45;
  margin-top: 20px;
}

.disclaimer strong {
  color: #6e1414;
}

.result-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 28px;
}

.result-actions .btn {
  flex: 1;
  min-width: 220px;
}

/* QR / link section — a lit paper window in the night sky,
   kept high-contrast so the code always scans reliably. */
.qr-section {
  border-radius: 22px;
  padding: 24px;
  margin-top: 20px;
  background: var(--panel);
  border: 1px solid var(--hairline);
}

.qr-section h3 {
  margin: 0 0 6px;
}

.qr-section .hint {
  margin-bottom: 18px;
}

.qr-code-holder {
  display: flex;
  justify-content: center;
  margin-bottom: 18px;
}

.qr-code-holder svg {
  width: 200px;
  height: 200px;
  max-width: 100%;
  background: var(--paper);
  padding: 14px;
  border-radius: 16px;
}

.qr-link-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: center;
}

.qr-link-row .btn {
  min-height: 54px;
  padding: 12px 22px;
  font-size: 1.05rem;
  flex: none;
}

.invalid-state {
  border-radius: 22px;
  padding: 24px;
  margin: 18px 0;
  background: var(--paper);
  color: #3a1414;
  border-left: 6px solid var(--red);
}

.invalid-state h2,
.invalid-state p {
  color: #3a1414;
}

/* RESULTADO MAIS COMPACTO */
#resultScreen .card {
  padding: 24px;
}

#resultScreen h2 {
  font-size: 2rem;
  margin-bottom: 6px;
  line-height: 1.1;
}

#resultScreen .subtitle {
  font-size: 1rem;
  margin-bottom: 14px;
  line-height: 1.35;
}

#resultScreen .result-grid {
  gap: 12px;
  margin: 14px 0;
}

#resultScreen .general-feedback {
  padding: 18px;
  margin-top: 14px;
  border-radius: 18px;
}

#resultScreen .general-feedback h3 {
  font-size: 1.2rem;
  margin: 0 0 8px;
}

#resultScreen .general-feedback p {
  font-size: 1rem;
  line-height: 1.35;
  margin: 0;
}

#resultScreen .result-box {
  padding: 18px;
  margin: 14px 0;
  border-radius: 18px;
}

#resultScreen .result-box h3 {
  font-size: 1.2rem;
  margin: 8px 0;
}

#resultScreen .result-box li {
  font-size: 1rem;
  line-height: 1.35;
  margin: 8px 0;
}

#resultScreen .disclaimer {
  padding: 16px;
  border-radius: 18px;
  font-size: 0.95rem;
  line-height: 1.35;
  margin-top: 14px;
}

#resultScreen .result-actions {
  margin-top: 18px;
}

#resultScreen .result-actions .btn {
  min-height: 60px;
  padding: 16px 22px;
  font-size: 1.05rem;
}

@media (max-width: 820px) {
  .fullscreen-btn {
    width: 52px;
    height: 52px;
    font-size: 1.4rem;
    top: 12px;
    right: 12px;
    border-radius: 16px;
  }

  .app {
    padding: 16px;
    align-items: flex-start;
  }

  .card {
    padding: 26px;
  }

  .legend,
  .options,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .option-btn {
    min-height: 170px;
  }

  .topbar {
    padding-right: 56px;
  }
}

@media print {
  body {
    background: white;
    color: black;
  }

  .fullscreen-btn,
  .btn,
  .nav-actions,
  .result-actions,
  .topbar,
  body::before {
    display: none !important;
  }

  .app {
    padding: 0;
  }

  .card {
    box-shadow: none;
    border: none;
    background: white;
    color: black;
  }
}
