:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --primary: #2d5bff;
  --danger: #dc2626;
  --chip: #eef2ff;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);

  --container: min(1120px, calc(100vw - 32px));
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

img,
svg {
  max-width: 100%;
  display: block;
}

.hidden {
  display: none !important;
}

/* HOME */
#homePage {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* NAVBAR */
.navbar {
  width: 100%;
  min-height: 74px;
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  border-bottom: 1px solid var(--line);
  background: transparent;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-img {
  height: 42px;
  width: auto;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}

.logo-text {
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  font-weight: 800;
  color: #0b132b;
  line-height: 1;
}

/* HERO */
.hero {
  flex: 1;
  display: grid;
  place-items: center;
  padding: clamp(32px, 6vw, 72px) 20px;
}

.hero-content {
  width: min(1200px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.hero-content h1 {
  font-size: clamp(3.2rem, 10vw, 7.5rem);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.03em;
  margin: 0 0 20px 0;
  color: #0b132b;
  text-wrap: balance;
}

.hero-content p {
  font-size: clamp(1rem, 2.3vw, 1.5rem);
  color: var(--muted);
  margin: 0 0 32px 0;
  max-width: 820px;
  line-height: 1.5;
  text-wrap: balance;
}

.hero-content button {
  min-height: 58px;
  padding: 16px 34px;
  min-width: min(280px, 90vw);
  font-size: clamp(1rem, 2vw, 1.25rem);
  font-weight: 700;
  border: none;
  border-radius: 18px;
  background: linear-gradient(135deg, #3b5bff, #2d5bff);
  color: white;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.hero-content button:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(45, 91, 255, 0.25);
}

/* FOOTER */
footer {
  width: 100%;
  border-top: 1px solid var(--line);
  padding: 18px 20px 22px;
  text-align: center;
  color: var(--muted);
  font-size: clamp(0.92rem, 1.8vw, 1.02rem);
}

footer p {
  margin: 0;
  line-height: 1.5;
}

footer a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px dotted var(--muted);
  word-break: break-word;
}

/* QUIZ */
#quizApp {
  width: var(--container);
  margin: 0 auto;
  padding: 20px 0 40px;
}

.quiz-navbar {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 14px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(14px, 2vw, 20px);
  margin-bottom: 18px;
}

.topRow {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.progressWrap {
  flex: 1 1 280px;
  min-width: 0;
}

.progressOuter {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #edf1f8;
  border: 1px solid var(--line);
  overflow: hidden;
}

.progressInner {
  height: 100%;
  background: var(--primary);
  transition: width 0.2s ease;
}

.progressText {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

.stepper {
  list-style: none;
  display: flex;
  gap: 8px;
  padding: 0;
  margin: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.stepper li {
  padding: 8px 12px;
  border-radius: 999px;
  background: #f8fafc;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.stepper li.active {
  background: #eef2ff;
  color: var(--primary);
  border-color: #c7d2fe;
  font-weight: 700;
}

.message {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #9a3412;
  line-height: 1.4;
}

.sectionTitle {
  margin: 12px 0 6px;
  font-size: clamp(1.6rem, 3.2vw, 2rem);
}

.sectionDesc {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.5;
}

.qCard {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  margin: 12px 0;
  background: white;
}

.qCard.missing {
  border-color: #f59e0b;
  background: #fffbeb;
}

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

legend {
  font-weight: 700;
  margin-bottom: 10px;
  line-height: 1.45;
  width: 100%;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.optRow {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.optRow input {
  margin-top: 3px;
  flex-shrink: 0;
}

.optRow label {
  line-height: 1.45;
}

.likertRow {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.likertCell {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafbfe;
  padding: 10px 8px;
  text-align: center;
  min-width: 0;
}

.likertCell label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

.badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--chip);
  border: 1px solid #dbe3ff;
  color: #2b3a8f;
  font-size: 12px;
  vertical-align: middle;
}

.help {
  color: var(--muted);
  font-size: 13px;
  margin-top: 8px;
  line-height: 1.4;
}

.navRow {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
  flex-wrap: wrap;
}

.navSpacer {
  flex: 1 1 auto;
}

.btn {
  border: none;
  border-radius: 12px;
  padding: 11px 15px;
  cursor: pointer;
  font-weight: 600;
  min-height: 44px;
  font-size: 0.98rem;
}

.btnPrimary {
  background: var(--primary);
  color: white;
}

.btnSecondary {
  background: #eef2ff;
  color: #1d2b6b;
  border: 1px solid #dbe3ff;
}

.btnDanger {
  background: var(--danger);
  color: white;
}

/* RESULTS */
.resultsHeader {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
}

.resultsHeader h2 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2rem);
}

.resultsActions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.userSummary {
  margin-top: 12px;
  padding: 12px;
  border-radius: 14px;
  border: 1px dashed var(--line);
  background: #fcfdff;
  color: var(--muted);
  line-height: 1.5;
}

.resultsList {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 14px;
}

.resultCard {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: white;
}

.resultTop {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.resultTitle {
  margin: 0;
  font-size: clamp(1.15rem, 2.2vw, 1.4rem);
  line-height: 1.35;
}

.meta {
  color: var(--muted);
  font-size: 14px;
  margin-top: 6px;
  line-height: 1.45;
}

.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.chip {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--chip);
  border: 1px solid #dbe3ff;
  color: #2b3a8f;
  font-size: 12px;
}

.scoreBox {
  min-width: 180px;
  max-width: 100%;
}

.scoreBig {
  font-size: clamp(1.8rem, 4vw, 2rem);
  font-weight: 800;
}

.scoreBarOuter {
  width: min(220px, 100%);
  height: 10px;
  border-radius: 999px;
  background: #edf1f8;
  border: 1px solid var(--line);
  overflow: hidden;
  margin-top: 8px;
}

.scoreBarInner {
  height: 100%;
  background: var(--primary);
}

.resultBody {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 12px;
  align-items: flex-start;
}

.explain {
  flex: 1 1 280px;
  min-width: min(280px, 100%);
}

.explain p {
  margin: 8px 0;
  line-height: 1.5;
}

.svgWrap {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  background: #fafbfe;
  flex: 1 1 320px;
  min-width: min(320px, 100%);
  overflow-x: auto;
}

/* MODAL */
.modalOverlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 1000;
}

.modal {
  width: min(520px, 100%);
  background: white;
  border-radius: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.modal h3 {
  margin: 0 0 8px;
}

.modal p {
  margin: 0;
  line-height: 1.5;
  color: var(--muted);
}

.modalActions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

/* TABLET */
@media (max-width: 900px) {
  .stepper {
    justify-content: flex-start;
  }

  .resultTop {
    flex-direction: column;
  }

  .scoreBox {
    min-width: 0;
  }
}

/* MOBILE */
@media (max-width: 640px) {
  :root {
    --container: calc(100vw - 20px);
  }

  .navbar {
    min-height: 68px;
    padding: 14px 16px;
  }

  .logo-img {
    height: 36px;
  }

  .logo-text {
    font-size: 1.15rem;
  }

  .hero {
    padding: 28px 16px 42px;
  }

  .hero-content p {
    max-width: 100%;
  }

  .hero-content button {
    width: min(100%, 320px);
  }

  #quizApp {
    padding-top: 14px;
    padding-bottom: 28px;
  }

  .quiz-navbar {
    margin-bottom: 12px;
  }

  .card {
    padding: 14px;
    border-radius: 16px;
  }

  .topRow {
    gap: 12px;
  }

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

  .navRow {
    flex-direction: column;
    align-items: stretch;
  }

  .navSpacer {
    display: none;
  }

  .navRow .btn,
  .resultsActions .btn,
  .modalActions .btn,
  .quiz-navbar .btn {
    width: 100%;
  }

  .resultsActions {
    width: 100%;
  }

  .resultsActions .btn {
    flex: 1 1 100%;
  }

  .resultBody {
    flex-direction: column;
  }

  .svgWrap,
  .explain {
    min-width: 0;
    width: 100%;
  }

  footer {
    padding-left: 16px;
    padding-right: 16px;
  }
}

@media (max-width: 380px) {
  .stepper li {
    font-size: 12px;
    padding: 7px 10px;
  }

  .btn {
    font-size: 0.95rem;
  }
}
.top-matches-box {
  width: 100%;
}

.top-matches-title {
  font-size: 1rem;
  font-weight: 700;
  color: #475569;
  margin: 0 0 14px 0;
}

.top-match-item {
  margin-bottom: 14px;
}

.top-match-item:last-child {
  margin-bottom: 0;
}

.top-match-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.top-match-label {
  font-size: 0.98rem;
  color: #475569;
  line-height: 1.35;
  font-weight: 500;
}

.top-match-value {
  font-size: 0.98rem;
  color: #0f172a;
  font-weight: 700;
  white-space: nowrap;
}

.top-match-bar {
  width: 100%;
  height: 12px;
  background: #dbe4f0;
  border-radius: 999px;
  overflow: hidden;
}

.top-match-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #2563eb);
  border-radius: 999px;
  transition: width 0.5s ease;
}
