:root {
  --blue: #17689a;
  --blue-dark: #0d4f78;
  --blue-light: #eef7fb;
  --orange: #ef9a38;
  --text: #183444;
  --muted: #6b7c86;
  --border: #dce7ec;
  --background: #f6f9fa;
  --surface: #ffffff;
  --success: #2f7d5a;
  --warning: #9a6421;
  --danger: #b94b4b;
  --shadow: 0 14px 38px rgba(25, 72, 98, 0.09);
  --radius: 16px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; width: 100%; overflow-x: hidden; }
body {
  margin: 0;
  width: 100%;
  min-width: 0;
  overflow-x: hidden;
  color: var(--text);
  background: var(--background);
  font-family: "Inter", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; -webkit-tap-highlight-color: transparent; }
button:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(239, 154, 56, 0.35);
  outline-offset: 3px;
}

.page-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.site-header {
  background: #492D7F;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner,
.footer-inner {
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
}

.header-inner {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #fff;
  text-decoration: none;
}

.brand-logo {
  width: 132px;
  height: auto;
  display: block;
}
.brand-tagline {
  max-width: 150px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  line-height: 1.35;
}

.header-action {
  border: 0;
  background: transparent;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.header-action:hover { text-decoration: underline; }

.progress-track { height: 4px; background: #e7eef1; }
.progress-bar {
  height: 100%;
  width: 0;
  background: var(--orange);
  transition: width 220ms ease;
}

.main-content {
  width: min(1160px, calc(100% - 40px));
  margin: auto;
  padding: 52px 0;
}

.screen { animation: screen-in 240ms ease both; }
@keyframes screen-in {
  from { opacity: 0; transform: translateY(8px); }
}

.section-label {
  display: inline-block;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1 {
  margin: 12px 0 16px;
  font-size: clamp(32px, 4.4vw, 54px);
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.lead {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(17px, 2vw, 21px);
  line-height: 1.6;
}

.intro-screen {
  min-height: 570px;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.65fr);
  align-items: center;
  gap: clamp(44px, 8vw, 100px);
}

.intro-copy h1 { max-width: 760px; }
.instruction-box {
  max-width: 680px;
  margin: 34px 0 30px;
  padding: 20px;
  display: flex;
  gap: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.instruction-number {
  flex: 0 0 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--orange);
  font-weight: 700;
}
.instruction-box p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.5;
}
.intro-actions { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.resume-note { margin: 0; color: var(--success); font-size: 14px; font-weight: 600; }

.intro-card {
  min-height: 320px;
  padding: 34px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-radius: 24px;
  background: var(--blue);
  color: white;
  box-shadow: var(--shadow);
}
.intro-card-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255,255,255,.55);
  border-radius: 50%;
  font-size: 26px;
  font-weight: 700;
}
.intro-card p {
  margin: 0;
  font-size: 23px;
  line-height: 1.45;
}

.button {
  min-height: 50px;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.button-primary { color: #fff; background: var(--blue); }
.button-primary:hover { background: var(--blue-dark); }
.button-secondary { color: var(--blue); background: #fff; border-color: var(--border); }
.button-secondary:hover { border-color: #b9ced8; background: #fbfdfe; }

.question-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
}
.question-title {
  max-width: 850px;
  font-size: clamp(30px, 4vw, 48px);
}
.question-counter {
  margin-top: 4px;
  white-space: nowrap;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}
.question-help { margin: 0 0 26px; color: var(--muted); }

.ranking-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(330px, 0.85fr);
  gap: 24px;
  align-items: start;
}

.choices-card,
.priority-card,
.module-ranking {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.choices-card,
.priority-card { padding: 22px; }
.card-heading {
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}
.card-heading small { color: var(--muted); font-weight: 500; }

.options-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.option-card {
  min-height: 70px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  width: 100%;
  text-align: left;
  color: inherit;
  font: inherit;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: border-color 160ms ease, background 160ms ease, opacity 160ms ease;
}
.option-card:hover { border-color: #9fc2d3; background: #fbfdfe; }
.option-card:active { transform: scale(.995); }
.option-card[draggable="true"] { cursor: grab; }
.option-card.dragging { opacity: 0.45; }
.option-card.selected { opacity: 0.45; background: #f2f5f6; cursor: default; }
.option-index {
  flex: 0 0 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--blue-light);
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
}
.option-label { font-size: 15px; font-weight: 600; line-height: 1.35; }

.priority-list { display: grid; gap: 10px; }
.rank-slot {
  min-height: 72px;
  padding: 13px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px dashed #b7cad3;
  border-radius: 12px;
  background: #fbfdfe;
  transition: border-color 160ms ease, background 160ms ease;
  touch-action: manipulation;
}
.rank-slot.drag-over { border-color: var(--orange); background: #fff8ef; }
.rank-slot.filled { border-style: solid; border-color: #a8c8d7; background: var(--blue-light); }
.rank-number {
  flex: 0 0 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--blue);
  color: white;
  font-weight: 700;
}
.slot-placeholder { color: var(--muted); font-size: 14px; }
.slot-answer { flex: 1; font-size: 14px; font-weight: 700; line-height: 1.35; }
.remove-choice {
  flex: 0 0 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: rgba(255,255,255,.75);
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
}
.clear-ranking { margin-top: 16px; padding: 0; font-size: 13px; }
.validation-message { min-height: 24px; margin-top: 14px; color: var(--danger); font-size: 14px; font-weight: 600; }
.navigation { margin-top: 16px; display: flex; justify-content: space-between; gap: 12px; }

.summary-screen { max-width: 900px; margin: 0 auto; }
.summary-screen h1 { max-width: 760px; }
.module-ranking { margin-top: 32px; padding: 10px 24px; }
.module-row {
  display: grid;
  grid-template-columns: 44px minmax(180px, 1.1fr) minmax(180px, 1.5fr) 72px;
  align-items: center;
  gap: 16px;
  padding: 15px 0;
  border-bottom: 1px solid var(--border);
}
.module-row:last-child { border-bottom: 0; }
.module-position { color: var(--orange); font-weight: 700; }
.module-name { font-weight: 600; }
.module-track { height: 8px; overflow: hidden; border-radius: 99px; background: #e9eff2; }
.module-fill { height: 100%; border-radius: inherit; background: var(--blue); }
.module-score { color: var(--muted); font-size: 13px; text-align: right; }
.summary-actions { margin-top: 28px; display: flex; gap: 12px; flex-wrap: wrap; }
.submit-status { margin-top: 18px; line-height: 1.5; }
.submit-status.success { color: var(--success); }
.submit-status.warning { color: var(--warning); }

.site-footer { border-top: 1px solid var(--border); background: #fff; }
.footer-inner {
  min-height: 62px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  color: var(--muted);
  font-size: 12px;
}

.footer-action {
  margin-left: auto;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 16px;
  background: #fff;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}
.footer-action:hover {
  background: #fbfdfe;
  border-color: #b9ced8;
  transform: translateY(-1px);
}

@media (max-width: 900px) {
  .intro-screen { grid-template-columns: 1fr; min-height: auto; }
  .intro-card { display: none; }
  .ranking-layout { grid-template-columns: 1fr; }
  .priority-card { position: static; }
}

@media (max-width: 640px) {
  .header-inner,
  .footer-inner,
  .main-content { width: calc(100% - 24px); max-width: 100%; }
  .page-shell { min-height: 100dvh; }
  .site-header { position: relative; }
  .main-content { margin: 0 auto; overflow: visible; }
  .header-inner { min-height: 68px; }
  .brand-tagline { display: none; }
  .brand-logo { width: 116px; }
  .header-action { font-size: 13px; }
  .main-content { padding: 34px 0; }
  h1 { font-size: 34px; }
  .question-header { display: block; }
  .question-counter { display: inline-block; margin-top: 0; margin-bottom: 12px; }
  .ranking-layout { display: flex; flex-direction: column; gap: 16px; }
  .priority-card { order: 1; }
  .choices-card { order: 2; }
  .options-list { grid-template-columns: 1fr; }
  .option-card { min-height: 58px; padding: 12px; }
  .rank-slot { min-height: 60px; }
  .choices-card,
  .priority-card { padding: 16px; }
  .navigation { position: sticky; bottom: 0; z-index: 5; margin-inline: -12px; padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); background: rgba(246,249,250,.98); border-top: 1px solid var(--border); }
  .navigation .button { flex: 1; padding-inline: 14px; }
  .module-ranking { padding: 8px 16px; }
  .module-row { grid-template-columns: 38px 1fr 58px; gap: 10px; }
  .module-track { grid-column: 2 / 4; }
  .summary-actions .button { width: 100%; }
  .footer-inner { min-height: 70px; align-items: flex-start; justify-content: center; flex-direction: column; gap: 4px; padding: 14px 0; }
  .footer-action { margin-left: 0; width: 100%; }
}

@media (hover: none), (pointer: coarse) {
  .option-card { cursor: pointer; }
  .option-card:hover { border-color: var(--border); background: #fff; }
  .option-card.selected:hover { background: #f2f5f6; }
  .card-heading small { font-size: 0; }
  .choices-card .card-heading small::after { content: "Toque para escolher"; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
