* {
  box-sizing: border-box;
}

:root {
  --bg-main: #eaf4ff;
  --bg-secondary: #f5faff;
  --card: #ffffff;
  --text: #102033;
  --muted: #607089;
  --line: #d8e6f5;
  --primary: #1145b5;
  --primary-strong: #0d3790;
  --primary-soft: #eef5ff;
  --soft-blue: #f7fbff;
  --warning-soft: #fff7ed;
  --warning-text: #b45309;
  --info-soft: #eef5ff;
  --info-text: #1145b5;
  --success-soft: #ecfdf3;
  --success-text: #15803d;
  --shadow: 0 24px 70px rgba(17, 69, 181, 0.12);
  --radius-xl: clamp(1.25rem, 1rem + 1vw, 1.75rem);
  --radius-lg: clamp(1rem, 0.85rem + 0.7vw, 1.25rem);
  --radius-md: clamp(0.875rem, 0.78rem + 0.45vw, 1rem);
  --shell-pad-y: clamp(0.5rem, 0.25rem + 1.2vh, 2rem);
  --shell-pad-x: clamp(0.75rem, 0.55rem + 1vw, 2rem);
  --card-max-width: clamp(20rem, 92vw, 42.5rem);
  --card-min-height: clamp(31rem, 78dvh, 45rem);
  --card-max-height: calc(100dvh - (var(--shell-pad-y) * 2));
  --header-pad-y: clamp(1rem, 0.75rem + 0.8vw, 1.75rem);
  --header-pad-x: clamp(1rem, 0.7rem + 1vw, 1.75rem);
  --stage-pad-y: clamp(1rem, 0.7rem + 1.1vw, 2.25rem);
  --stage-pad-x: clamp(1rem, 0.7rem + 1vw, 1.75rem);
  --footer-pad-y: clamp(1rem, 0.75rem + 0.75vw, 1.75rem);
  --footer-pad-x: clamp(1rem, 0.7rem + 1vw, 1.75rem);
  --content-gap: clamp(0.75rem, 0.55rem + 0.8vw, 1.5rem);
  --transition: 0.25s ease;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Inter", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(17, 69, 181, 0.12), transparent 28%),
    linear-gradient(180deg, var(--bg-main) 0%, var(--bg-secondary) 100%);
}

html {
  height: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
}

button,
input {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: var(--shell-pad-y) var(--shell-pad-x);
  overflow: hidden;
}

.quiz-card {
  width: min(100%, var(--card-max-width));
  max-width: var(--card-max-width);
  min-height: min(var(--card-min-height), var(--card-max-height));
  max-height: var(--card-max-height);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(216, 230, 245, 0.95);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  overflow: hidden;
}

.quiz-header {
  flex-shrink: 0;
  padding: var(--header-pad-y) var(--header-pad-x) clamp(0.9rem, 0.7rem + 0.5vw, 1.25rem);
  border-bottom: 1px solid rgba(216, 230, 245, 0.9);
  background: linear-gradient(180deg, rgba(255,255,255,0.95) 0%, rgba(247,251,255,0.95) 100%);
}

.brand-pill {
  display: inline-flex;
  align-items: center;
  padding: clamp(0.45rem, 0.35rem + 0.3vw, 0.56rem) clamp(0.7rem, 0.55rem + 0.5vw, 0.82rem);
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: clamp(0.72rem, 0.68rem + 0.2vw, 0.82rem);
  font-weight: 800;
  margin-bottom: clamp(0.75rem, 0.6rem + 0.5vw, 1rem);
}

.progress-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(0.5rem, 0.35rem + 0.5vw, 1rem);
  color: var(--muted);
  font-size: clamp(0.82rem, 0.76rem + 0.25vw, 0.92rem);
  margin-bottom: clamp(0.5rem, 0.4rem + 0.35vw, 0.65rem);
}

.progress-bar {
  width: 100%;
  height: clamp(0.45rem, 0.38rem + 0.25vw, 0.625rem);
  border-radius: 999px;
  background: #e7eef7;
  overflow: hidden;
}

.progress-bar > div {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary) 0%, #4b83f0 100%);
  transition: width var(--transition);
}

.quiz-stage {
  padding: var(--stage-pad-y) var(--stage-pad-x);
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  min-height: 0;
  overflow: auto;
  scrollbar-gutter: stable both-edges;
}

.stage-content {
  width: 100%;
  min-width: 0;
  animation: fadeIn 0.25s ease;
}

.stage-kicker {
  display: inline-block;
  margin-bottom: clamp(0.625rem, 0.5rem + 0.35vw, 0.75rem);
  color: var(--primary);
  font-size: clamp(0.8rem, 0.74rem + 0.2vw, 0.88rem);
  font-weight: 800;
  letter-spacing: 0.01em;
}

.stage-title {
  margin: 0 0 clamp(0.625rem, 0.5rem + 0.45vw, 0.75rem);
  font-size: clamp(1.45rem, 1.15rem + 1.55vw, 2.3rem);
  line-height: 1.12;
  color: #0d1d33;
}

.stage-description {
  margin: 0 0 clamp(1rem, 0.75rem + 0.8vw, 1.5rem);
  color: var(--muted);
  line-height: clamp(1.45, 1.4 + 0.1vw, 1.7);
  font-size: clamp(0.94rem, 0.88rem + 0.25vw, 1rem);
}

.input-wrap input {
  width: 100%;
  border: 1px solid #cdddee;
  border-radius: clamp(0.9rem, 0.78rem + 0.4vw, 1.125rem);
  background: #fff;
  padding: clamp(0.85rem, 0.75rem + 0.35vw, 1rem) clamp(0.95rem, 0.82rem + 0.45vw, 1.125rem);
  font-size: clamp(0.95rem, 0.9rem + 0.2vw, 1rem);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.input-wrap input:focus {
  outline: none;
  border-color: #7ca0ea;
  box-shadow: 0 0 0 4px rgba(17, 69, 181, 0.08);
}

.options-grid {
  display: grid;
  gap: clamp(0.625rem, 0.5rem + 0.35vw, 0.75rem);
}

.option-card {
  position: relative;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: clamp(0.9rem, 0.78rem + 0.4vw, 1.125rem);
  padding: clamp(0.85rem, 0.74rem + 0.4vw, 1rem);
  background: #fff;
  cursor: pointer;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition), background var(--transition);
  font-weight: 700;
  font-size: clamp(0.94rem, 0.9rem + 0.2vw, 1rem);
  color: var(--text);
  text-align: left;
}

.option-card:hover {
  transform: translateY(-1px);
  border-color: #b5cdf0;
  background: #fbfdff;
}

.option-card.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 3px rgba(17, 69, 181, 0.08);
}

.helper-row {
  margin-top: clamp(0.875rem, 0.7rem + 0.55vw, 1.125rem);
  display: flex;
  flex-wrap: wrap;
  gap: clamp(0.5rem, 0.4rem + 0.25vw, 0.625rem);
}

.helper-badge {
  font-size: clamp(0.75rem, 0.7rem + 0.2vw, 0.82rem);
  color: var(--muted);
  background: #f7fbff;
  border: 1px solid #e6effa;
  border-radius: 999px;
  padding: clamp(0.42rem, 0.34rem + 0.25vw, 0.5rem) clamp(0.65rem, 0.55rem + 0.35vw, 0.75rem);
}

.quiz-footer {
  flex-shrink: 0;
  padding: var(--footer-pad-y) var(--footer-pad-x);
  border-top: 1px solid rgba(216, 230, 245, 0.9);
  display: flex;
  justify-content: space-between;
  gap: clamp(0.625rem, 0.5rem + 0.35vw, 0.75rem);
  background: rgba(255,255,255,0.96);
}

.btn {
  appearance: none;
  border: 0;
  border-radius: clamp(0.9rem, 0.78rem + 0.35vw, 1rem);
  padding: clamp(0.85rem, 0.75rem + 0.35vw, 0.95rem) clamp(1rem, 0.82rem + 0.55vw, 1.125rem);
  font-size: clamp(0.94rem, 0.9rem + 0.2vw, 1rem);
  font-weight: 800;
  cursor: pointer;
  transition: transform var(--transition), opacity var(--transition), background var(--transition);
}

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

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  flex: 1 1 auto;
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-strong);
}

.btn-ghost {
  background: #eef4ff;
  color: var(--primary);
  min-width: clamp(5.75rem, 5rem + 2vw, 6.5rem);
}

.hidden {
  display: none;
}

.error-text {
  margin-top: clamp(0.75rem, 0.65rem + 0.35vw, 0.75rem);
  color: #b42318;
  font-size: clamp(0.84rem, 0.8rem + 0.15vw, 0.9rem);
  font-weight: 700;
}

.result-badge {
  display: inline-flex;
  margin-bottom: clamp(0.75rem, 0.65rem + 0.35vw, 0.875rem);
  padding: clamp(0.45rem, 0.35rem + 0.3vw, 0.56rem) clamp(0.75rem, 0.62rem + 0.4vw, 0.875rem);
  border-radius: 999px;
  font-size: clamp(0.76rem, 0.72rem + 0.2vw, 0.84rem);
  font-weight: 800;
}

.result-badge.reativo {
  background: var(--warning-soft);
  color: var(--warning-text);
}

.result-badge.organizado {
  background: var(--info-soft);
  color: var(--info-text);
}

.result-badge.gerenciado {
  background: #edf8ff;
  color: #0f5e9c;
}

.result-badge.estrategico {
  background: var(--success-soft);
  color: var(--success-text);
}

.score-card {
  border: 1px solid #dfeafb;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border-radius: clamp(1rem, 0.88rem + 0.6vw, 1.375rem);
  padding: clamp(1rem, 0.85rem + 0.6vw, 1.25rem);
  margin-bottom: clamp(0.875rem, 0.7rem + 0.55vw, 1.125rem);
}

.score-label {
  display: block;
  color: var(--muted);
  font-size: clamp(0.84rem, 0.78rem + 0.25vw, 0.92rem);
  margin-bottom: clamp(0.375rem, 0.3rem + 0.2vw, 0.5rem);
}

.score-value {
  display: flex;
  align-items: flex-end;
  gap: clamp(0.35rem, 0.3rem + 0.2vw, 0.5rem);
}

.score-value strong {
  font-size: clamp(2.2rem, 1.75rem + 2vw, 3rem);
  line-height: 1;
  color: var(--primary);
}

.score-value span {
  color: var(--muted);
  font-weight: 700;
  padding-bottom: clamp(0.2rem, 0.12rem + 0.2vw, 0.375rem);
}

.result-box {
  padding: clamp(0.95rem, 0.82rem + 0.45vw, 1.125rem);
  border-radius: clamp(1rem, 0.88rem + 0.5vw, 1.25rem);
  border: 1px solid #e1ebf8;
  background: #fbfdff;
  margin-bottom: clamp(0.75rem, 0.62rem + 0.4vw, 0.875rem);
}

.result-box h3 {
  margin: 0 0 clamp(0.5rem, 0.42rem + 0.25vw, 0.625rem);
  font-size: clamp(0.95rem, 0.9rem + 0.2vw, 1rem);
}

.result-box p,
.result-box li {
  margin: 0;
  color: var(--muted);
  line-height: clamp(1.5, 1.45 + 0.12vw, 1.7);
  font-size: clamp(0.92rem, 0.88rem + 0.15vw, 0.98rem);
}

.result-box ul {
  margin: 0;
  padding-left: clamp(1rem, 0.9rem + 0.35vw, 1.125rem);
}

.result-actions {
  display: grid;
  gap: clamp(0.625rem, 0.5rem + 0.35vw, 0.75rem);
  margin-top: clamp(1rem, 0.82rem + 0.7vw, 1.375rem);
}

.btn-secondary {
  width: 100%;
  text-decoration: none;
  text-align: center;
}

.processing-wrap {
  text-align: center;
  width: 100%;
}

.processing-spinner {
  width: clamp(3rem, 2.5rem + 1.5vw, 4rem);
  height: clamp(3rem, 2.5rem + 1.5vw, 4rem);
  border: clamp(0.25rem, 0.22rem + 0.15vw, 0.375rem) solid #dbe9fb;
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto clamp(0.875rem, 0.75rem + 0.45vw, 1.125rem);
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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

@media (max-width: 767px) {
  .quiz-footer {
    flex-wrap: wrap;
  }

  .btn,
  .btn-ghost,
  .btn-primary {
    width: 100%;
    min-width: 0;
  }
}

@media (max-height: 48rem) {
  :root {
    --shell-pad-y: clamp(0.35rem, 0.2rem + 0.7vh, 0.875rem);
    --header-pad-y: clamp(0.8rem, 0.65rem + 0.4vh, 1rem);
    --stage-pad-y: clamp(0.8rem, 0.65rem + 0.55vh, 1rem);
    --footer-pad-y: clamp(0.8rem, 0.65rem + 0.45vh, 1rem);
  }

  .brand-pill {
    margin-bottom: clamp(0.5rem, 0.35rem + 0.35vh, 0.75rem);
  }

  .stage-description {
    margin-bottom: clamp(0.8rem, 0.65rem + 0.4vh, 1rem);
  }
}
