:root {
  --blue: #0270eb;
  --blue-600: #005fd1;
  --blue-700: #004fae;
  --blue-50: #eaf3ff;
  --blue-100: #d5e7ff;
  --white: #ffffff;
  --ink: #0b1f3a;
  --muted: #5b6b82;
  --line: #e3e9f2;
  --danger: #d93a3a;
  --success: #12a46b;
  --radius: 24px;
  --shadow: 0 24px 60px -20px rgba(0, 30, 80, 0.45);
  --font: "Open Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: var(--font);
  background: var(--blue);
  color: var(--white);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

button, input, textarea { font: inherit; }

/* ---------- background shapes (from brand image) ---------- */
.bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.bg span {
  position: absolute;
  background: rgba(255, 255, 255, 0.055);
  border-radius: 48px;
}
.bg .s1 { width: 520px; height: 520px; top: -300px; left: -260px; transform: rotate(-30deg); }
.bg .s2 { width: 560px; height: 560px; top: -360px; right: -160px; transform: rotate(38deg); }
.bg .s3 { width: 520px; height: 520px; bottom: -380px; left: -200px; transform: rotate(38deg); }
.bg .s4 { width: 520px; height: 520px; bottom: -320px; right: -300px; transform: rotate(-30deg); }

@media (max-width: 640px) {
  .bg .s1, .bg .s2, .bg .s3, .bg .s4 { width: 300px; height: 300px; border-radius: 32px; }
  .bg .s1 { top: -190px; left: -170px; }
  .bg .s2 { top: -210px; right: -150px; }
  .bg .s3 { bottom: -220px; left: -150px; }
  .bg .s4 { bottom: -200px; right: -190px; }
}

/* ---------- logo ---------- */
.logo {
  display: inline-flex;
  align-items: baseline;
  font-size: 34px;
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--white);
  text-decoration: none;
  user-select: none;
}
.logo .l { font-weight: 300; }
.logo .b { font-weight: 700; position: relative; }
.logo .b i {
  font-style: normal;
  position: relative;
}
.logo .b i::after {
  /* lightbulb-style dot on the "i" */
  content: "";
  position: absolute;
  left: 50%;
  top: 0.05em;
  width: 0.2em;
  height: 0.24em;
  transform: translateX(-50%);
  border-radius: 50% 50% 45% 45%;
  background: currentColor;
}
.logo.xl { font-size: clamp(52px, 12vw, 84px); }
.logo.sm { font-size: 26px; }
.logo.dark { color: var(--blue); }

/* ---------- layout ---------- */
.app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 28px;
}
[hidden] { display: none !important; }

.stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 16px 40px;
}

.footer {
  text-align: center;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
  padding: 0 16px 22px;
}

/* ---------- buttons ---------- */
.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 28px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 16px;
  transition: transform .15s ease, background-color .15s ease, box-shadow .15s ease, opacity .15s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-white { background: var(--white); color: var(--blue); box-shadow: 0 12px 30px -10px rgba(0, 20, 60, .5); }
.btn-white:hover:not(:disabled) { background: var(--blue-50); }
.btn-blue { background: var(--blue); color: var(--white); }
.btn-blue:hover:not(:disabled) { background: var(--blue-600); }
.btn-ghost { background: transparent; color: var(--muted); padding: 0 14px; }
.btn-ghost:hover:not(:disabled) { color: var(--blue); }
.btn-outline { background: transparent; color: var(--white); box-shadow: inset 0 0 0 2px rgba(255,255,255,.55); }
.btn-outline:hover { box-shadow: inset 0 0 0 2px var(--white); }
.btn-sm { min-height: 40px; padding: 0 18px; font-size: 14px; }
.btn-danger { background: #fff0f0; color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: #ffe1e1; }

:focus-visible { outline: 3px solid #ffd84d; outline-offset: 3px; }

/* ---------- card ---------- */
.card {
  background: var(--white);
  color: var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
}

/* ---------- screens / animation ---------- */
.screen { width: 100%; display: none; }
.screen.active { display: block; animation: rise .45s cubic-bezier(.2,.8,.2,1); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.slide-in { animation: slide .35s cubic-bezier(.2,.8,.2,1); }
@keyframes slide { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- welcome ---------- */
.welcome {
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
}
.welcome h1 {
  font-size: clamp(24px, 4.6vw, 34px);
  font-weight: 700;
  margin: 34px 0 12px;
  line-height: 1.25;
}
.welcome p {
  font-size: clamp(16px, 2.6vw, 18px);
  line-height: 1.6;
  color: rgba(255, 255, 255, .85);
  margin: 0 auto 34px;
  max-width: 520px;
}
.meta {
  display: flex;
  gap: 18px;
  justify-content: center;
  margin-top: 22px;
  font-size: 14px;
  color: rgba(255, 255, 255, .7);
  flex-wrap: wrap;
}
.meta span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- question ---------- */
.q-card {
  max-width: 680px;
  margin: 0 auto;
  padding: 34px 40px 28px;
}
.q-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}
.q-head strong { color: var(--blue); }
.progress {
  height: 8px;
  background: var(--blue-50);
  border-radius: 99px;
  overflow: hidden;
  margin: 14px 0 34px;
}
.progress > div {
  height: 100%;
  width: 0;
  background: var(--blue);
  border-radius: 99px;
  transition: width .4s cubic-bezier(.2,.8,.2,1);
}
.q-text {
  font-size: clamp(21px, 3.6vw, 27px);
  font-weight: 700;
  line-height: 1.35;
  margin: 0 0 34px;
  min-height: 2.7em;
}

.scale {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}
.scale button {
  appearance: none;
  cursor: pointer;
  aspect-ratio: 1;
  max-height: 84px;
  width: 100%;
  border: 2px solid var(--line);
  background: var(--white);
  color: var(--ink);
  border-radius: 20px;
  font-size: clamp(20px, 4vw, 26px);
  font-weight: 700;
  transition: all .15s ease;
}
.scale button:hover { border-color: var(--blue); color: var(--blue); transform: translateY(-2px); }
.scale button[aria-checked="true"] {
  background: var(--blue);
  border-color: var(--blue);
  color: var(--white);
  box-shadow: 0 12px 24px -10px rgba(2, 112, 235, .8);
  transform: translateY(-2px);
}
.scale-labels {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 13px;
  color: var(--muted);
  margin-top: 12px;
}
.scale-labels span:last-child { text-align: right; }

.q-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 34px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.hint { font-size: 13px; color: var(--muted); }

/* ---------- result ---------- */
.r-card {
  max-width: 680px;
  margin: 0 auto;
  padding: 40px 40px 34px;
  text-align: center;
}
.ring {
  position: relative;
  width: 190px;
  height: 190px;
  margin: 0 auto 18px;
}
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 14; }
.ring .track { stroke: var(--blue-50); }
.ring .bar { stroke: var(--blue); stroke-linecap: round; transition: stroke-dashoffset 1.2s cubic-bezier(.2,.8,.2,1); }
.ring .value {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.ring .num { font-size: 50px; font-weight: 800; color: var(--ink); line-height: 1; }
.ring .of { font-size: 14px; color: var(--muted); margin-top: 6px; font-weight: 600; }
.badge {
  display: inline-block;
  background: var(--blue-50);
  color: var(--blue);
  font-weight: 700;
  font-size: 14px;
  padding: 7px 16px;
  border-radius: 99px;
}
.r-card h2 { font-size: clamp(22px, 4vw, 28px); margin: 16px 0 8px; }
.r-card .r-msg { color: var(--muted); line-height: 1.6; margin: 0 auto 28px; max-width: 460px; }

.breakdown { text-align: left; border-top: 1px solid var(--line); padding-top: 22px; margin-top: 4px; }
.breakdown h3 { font-size: 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 14px; }
.b-row { display: grid; grid-template-columns: 1fr 120px 28px; gap: 14px; align-items: center; padding: 9px 0; font-size: 14px; }
.b-row .t { line-height: 1.4; }
.b-bar { height: 8px; background: var(--blue-50); border-radius: 99px; overflow: hidden; }
.b-bar > div { height: 100%; background: var(--blue); border-radius: 99px; }
.b-row .v { font-weight: 700; text-align: right; color: var(--blue); }
.r-actions { margin-top: 28px; }

.thanks { color: rgba(255,255,255,.85); text-align: center; margin-top: 22px; font-size: 15px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, calc(100% + 40px));
  visibility: hidden;
  background: var(--ink);
  color: var(--white);
  padding: 13px 22px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
  z-index: 50;
  transition: transform .3s cubic-bezier(.2,.8,.2,1), visibility .3s;
  max-width: calc(100% - 32px);
  text-align: center;
}
.toast.show { transform: translate(-50%, 0); visibility: visible; }
.toast.error { background: var(--danger); }
.toast.ok { background: var(--success); }

.spinner {
  width: 34px; height: 34px;
  border: 3px solid rgba(255,255,255,.3);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- mobile ---------- */
@media (max-width: 640px) {
  .topbar { padding: 18px 16px; }
  .stage { padding: 8px 16px 28px; align-items: flex-start; }
  .q-card, .r-card { padding: 24px 20px 20px; border-radius: 20px; }
  .progress { margin: 12px 0 24px; }
  .q-text { margin-bottom: 26px; }
  .scale { gap: 8px; }
  .scale button { border-radius: 14px; }
  .scale-labels { font-size: 12px; }
  .q-actions { margin-top: 24px; padding-top: 16px; }
  .hint { display: none; }
  .welcome { padding-top: 12vh; }
  .welcome .btn { width: 100%; max-width: 340px; }
  .ring { width: 160px; height: 160px; }
  .ring .num { font-size: 42px; }
  .b-row { grid-template-columns: 1fr 64px 26px; gap: 10px; font-size: 13px; }
}
