* {
  box-sizing: border-box;
}

:root {
  --text: #202733;
  --muted: #596476;
  --line: #d1d9e8;
  --card: rgba(255, 255, 255, 0.93);
  --bg1: #fdf6ec;
  --bg2: #eaf9f0;
  --bg3: #e9f0ff;
  --primary: #157f66;
  --primary-soft: #d8f4eb;
  --danger: #b23a3a;
  --shadow: 0 18px 36px rgba(31, 43, 70, 0.12);
  font-family: "Nunito Sans", "Avenir Next", "Trebuchet MS", sans-serif;
  color: var(--text);
}

body {
  margin: 0;
  min-height: 100vh;
  padding-top: calc(86px + env(safe-area-inset-top, 0px));
  background:
    radial-gradient(circle at 5% 8%, var(--bg1), transparent 35%),
    radial-gradient(circle at 90% 10%, var(--bg2), transparent 40%),
    linear-gradient(150deg, #f6f8ff, var(--bg3));
}

.app-shell {
  width: min(1120px, 100% - 2rem);
  margin: 0 auto 2rem;
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr);
}

.quiz-panel,
.result-panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.quiz-panel {
  padding: 1.2rem;
}

.eyebrow {
  margin: 0;
  display: inline-block;
  background: var(--primary-soft);
  color: #105545;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  font-weight: 800;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 0.35rem 0.72rem;
}

h1 {
  margin: 0.8rem 0 0.5rem;
  font-size: clamp(1.55rem, 3vw, 2.25rem);
}

.intro {
  margin: 0;
  color: var(--muted);
}

.progress-row {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  align-items: baseline;
}

.progress-row span {
  color: var(--muted);
}

.progress-track {
  margin-top: 0.45rem;
  height: 9px;
  border-radius: 999px;
  background: #e0e7f3;
  overflow: hidden;
}

.progress-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #1ca98a, #157f66);
  transition: width 0.18s ease;
}

.progress-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 80;
  padding: calc(0.45rem + env(safe-area-inset-top, 0px)) 0.5rem 0.5rem;
}

.progress-panel {
  margin: 0 auto;
  width: min(1120px, calc(100% - 0.5rem));
  border: 1px solid #cad7eb;
  border-radius: 14px;
  background: rgba(248, 251, 255, 0.97);
  box-shadow: 0 10px 20px rgba(24, 42, 71, 0.16);
  backdrop-filter: blur(4px);
  padding: 0.62rem 0.75rem;
}

.progress-panel .progress-row span {
  font-weight: 700;
}

.quiz-form {
  margin-top: 0.9rem;
}

.questions {
  display: grid;
  gap: 0.75rem;
}

.question-card {
  margin: 0;
  border: 1px solid #d7ddeb;
  border-radius: 14px;
  background: #fbfdff;
  padding: 0.85rem;
}

.question-card legend {
  font-weight: 700;
  padding: 0 0.25rem;
}

.options {
  margin-top: 0.6rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.option-btn {
  border: 1px solid #ccd5e7;
  background: #fff;
  color: inherit;
  border-radius: 11px;
  padding: 0.62rem;
  text-align: left;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}

.option-btn strong {
  display: block;
}

.option-btn small {
  color: var(--muted);
}

.option-btn:hover {
  transform: translateY(-1px);
}

.option-btn:focus-visible {
  outline: 3px solid rgba(21, 127, 102, 0.25);
  outline-offset: 1px;
}

.option-btn.selected {
  border-color: var(--primary);
  background: #effbf7;
  box-shadow: 0 0 0 2px rgba(21, 127, 102, 0.14);
}

.completion-section {
  margin-top: 0.95rem;
  border-radius: 14px;
  padding: 0.3rem;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.completion-section.highlight {
  background: rgba(35, 151, 126, 0.1);
  box-shadow: 0 0 0 2px rgba(35, 151, 126, 0.25);
}

.email-box {
  margin-top: 0;
  border: 1px solid #d7deea;
  border-radius: 12px;
  background: #f8faff;
  padding: 0.82rem;
  transition: opacity 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.email-box.locked {
  opacity: 0.68;
  border-style: dashed;
  border-color: #c8d2e4;
  background: #f3f6fb;
}

.email-box label {
  display: block;
  font-size: 0.82rem;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #2d3f59;
}

.email-box input {
  margin-top: 0.5rem;
  width: 100%;
  min-height: 46px;
  border-radius: 10px;
  border: 1px solid #c5d0e3;
  padding: 0 0.75rem;
  font-size: 1rem;
}

.email-box input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(21, 127, 102, 0.17);
}

.email-box input.invalid {
  border-color: var(--danger);
  background: #fff8f8;
}

.email-box p {
  margin: 0.42rem 0 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.error-message {
  margin: 0.72rem 0 0;
  color: var(--danger);
  font-weight: 700;
}

.actions {
  margin-top: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.56rem;
}

.footer-actions {
  margin-top: 0.65rem;
}

.btn {
  min-height: 45px;
  border-radius: 11px;
  padding: 0 1rem;
  font-weight: 800;
  cursor: pointer;
}

.btn-primary {
  border: 0;
  color: #fff;
  background: linear-gradient(130deg, #1aa283, #146f59);
  box-shadow: 0 10px 20px rgba(20, 111, 89, 0.28);
}

#submitResult:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-secondary {
  border: 1px solid #c7d0df;
  background: #fff;
  color: #2d3f59;
}

.result-panel {
  position: sticky;
  top: calc(92px + env(safe-area-inset-top, 0px));
  padding: 1.1rem;
}

h2 {
  margin-top: 0;
}

.result-placeholder {
  color: var(--muted);
}

.score-line {
  margin: 0.8rem 0 0.45rem;
  font-size: 1.05rem;
}

.level-badge {
  display: inline-block;
  margin: 0 0 0.6rem;
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-weight: 800;
}

.level-badge.low {
  background: #dff9ed;
  color: #0e5f4a;
}

.level-badge.mild {
  background: #fff3d5;
  color: #70510f;
}

.level-badge.high {
  background: #ffe7cc;
  color: #824c11;
}

.level-badge.very-high {
  background: #ffe0e0;
  color: #902828;
}

.summary,
.next-step {
  margin: 0 0 0.55rem;
}

.result-cta {
  display: inline-block;
  margin-top: 0.35rem;
  padding: 0.58rem 0.8rem;
  border-radius: 10px;
  border: 1px solid #9bc8bf;
  background: #effaf7;
  color: #155d4f;
  font-weight: 800;
  text-decoration: none;
}

.result-cta:hover {
  background: #e5f6f1;
}

.disclaimer {
  margin: 0.95rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.site-footer {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto 1.1rem;
  text-align: center;
  color: #526072;
  font-size: 0.9rem;
}

.site-footer a {
  color: #146f59;
  font-weight: 700;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .result-panel {
    position: static;
  }
}

@media (max-width: 620px) {
  body {
    padding-top: calc(82px + env(safe-area-inset-top, 0px));
  }

  .app-shell {
    width: calc(100% - 1rem);
    margin-inline: auto;
  }

  .quiz-panel,
  .result-panel {
    border-radius: 14px;
    padding: 0.9rem;
  }

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

  .actions {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

  .progress-panel {
    width: calc(100% - 0.25rem);
    border-radius: 12px;
    padding: 0.58rem 0.64rem;
  }

  .progress-panel .progress-row {
    font-size: 0.9rem;
  }
}
