:root {
  --bg: #f7f5f2;
  --surface: #ffffff;
  --surface-2: #efece7;
  --text: #2a2b38;
  --muted: #8b8a97;
  --line: #e6e2db;
  --shadow: 0 1px 2px rgba(42, 43, 56, .04), 0 6px 20px rgba(42, 43, 56, .06);
  --shadow-lift: 0 2px 6px rgba(42, 43, 56, .07), 0 18px 44px rgba(42, 43, 56, .13);
  --stroke: #2a2b38;
  --btn-from: #3a3b4c;
  --btn-to: #24252f;
  --btn-text: #fbfaf8;
  --wash-1: rgba(201, 149, 74, .10);
  --wash-2: rgba(147, 102, 201, .08);
  --wash-3: rgba(111, 168, 112, .07);
  --glow-1: rgba(201, 149, 74, .20);
  --glow-2: rgba(201, 149, 74, .10);
  --glow-3: rgba(147, 102, 201, .05);
  --radius: 22px;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --ease-back: cubic-bezier(.34, 1.56, .64, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15161a;
    --surface: #1f2126;
    --surface-2: #282a31;
    --text: #f2f2f4;
    --muted: #9b9ba8;
    --line: #32343c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .34);
    --shadow-lift: 0 2px 6px rgba(0, 0, 0, .36), 0 18px 44px rgba(0, 0, 0, .5);
    --stroke: #f2f2f4;
    --btn-from: #f4f3f0;
    --btn-to: #dedcd6;
    --btn-text: #1b1c22;
    --wash-1: rgba(217, 189, 144, .13);
    --wash-2: rgba(198, 162, 230, .11);
    --wash-3: rgba(171, 214, 172, .08);
    --glow-1: rgba(217, 189, 144, .18);
    --glow-2: rgba(198, 162, 230, .10);
    --glow-3: rgba(171, 214, 172, .05);
  }
}

:root[data-theme="light"] {
  --bg: #f7f5f2; --surface: #fff; --surface-2: #efece7;
  --text: #2a2b38; --muted: #8b8a97; --line: #e6e2db; --stroke: #2a2b38;
  --btn-from: #3a3b4c; --btn-to: #24252f; --btn-text: #fbfaf8;
  --shadow: 0 1px 2px rgba(42, 43, 56, .04), 0 6px 20px rgba(42, 43, 56, .06);
  --shadow-lift: 0 2px 6px rgba(42, 43, 56, .07), 0 18px 44px rgba(42, 43, 56, .13);
  --wash-1: rgba(201, 149, 74, .10);
  --wash-2: rgba(147, 102, 201, .08);
  --wash-3: rgba(111, 168, 112, .07);
  --glow-1: rgba(201, 149, 74, .20);
  --glow-2: rgba(201, 149, 74, .10);
  --glow-3: rgba(147, 102, 201, .05);
}

:root[data-theme="dark"] {
  --bg: #15161a; --surface: #1f2126; --surface-2: #282a31;
  --text: #f2f2f4; --muted: #9b9ba8; --line: #32343c; --stroke: #f2f2f4;
  --btn-from: #f4f3f0; --btn-to: #dedcd6; --btn-text: #1b1c22;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .34);
  --shadow-lift: 0 2px 6px rgba(0, 0, 0, .36), 0 18px 44px rgba(0, 0, 0, .5);
  --wash-1: rgba(217, 189, 144, .13);
  --wash-2: rgba(198, 162, 230, .11);
  --wash-3: rgba(171, 214, 172, .08);
  --glow-1: rgba(217, 189, 144, .18);
  --glow-2: rgba(198, 162, 230, .10);
  --glow-3: rgba(171, 214, 172, .05);
}


* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  min-height: 100%;
  background-color: var(--bg);
}

body {
  min-height: 100%;
  background: transparent;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto,
               "Helvetica Neue", sans-serif;
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    radial-gradient(115% 55% at 50% 0%, var(--wash-1), transparent 62%),
    radial-gradient(85% 45% at 100% 100%, var(--wash-2), transparent 62%),
    radial-gradient(70% 40% at 0% 78%, var(--wash-3), transparent 62%);
}

html.is-stub body::before {
  background-image: radial-gradient(ellipse farthest-corner at 50% 47%,
    var(--glow-1) 0%,
    var(--glow-2) 30%,
    var(--glow-3) 60%,
    transparent 88%);
  transform-origin: 50% 47%;
  animation: stub-glow 8s ease-in-out infinite;
  will-change: transform, opacity;
}

html { scrollbar-width: none; -ms-overflow-style: none; }
html::-webkit-scrollbar,
body::-webkit-scrollbar { width: 0; height: 0; display: none; }

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

.is-hidden { display: none !important; }

.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 0 18px;
  padding-top: max(16px, env(safe-area-inset-top));
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  max-width: 560px;
  margin: 0 auto;
}

.screen { display: none; flex: 1; flex-direction: column; }
.screen.is-active { display: flex; animation: screen-in .42s var(--ease) both; }

@keyframes screen-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}


.btn {
  display: block;
  width: 100%;
  padding: 17px 20px;
  border-radius: 17px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -.01em;
  transition: transform .16s var(--ease), opacity .16s var(--ease),
              box-shadow .16s var(--ease);
}

.btn:active { transform: scale(.975); }

.btn--primary {
  background: linear-gradient(180deg, var(--btn-from), var(--btn-to));
  color: var(--btn-text);
  border: 1px solid transparent;
  box-shadow: 0 1px 2px rgba(42, 43, 56, .18), 0 10px 26px rgba(42, 43, 56, .18);
}

.btn--primary:active { box-shadow: 0 1px 2px rgba(42, 43, 56, .2); }

.btn--ghost {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  margin-top: 10px;
}

.btn--link {
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  padding: 12px;
}

.btn--link:active { color: var(--text); }


.intro {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px 0 8px;
}

.intro__shapes {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 38px;
  position: relative;
}

.intro__shapes::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 260px;
  height: 130px;
  transform: translate(-50%, -50%);
  background: radial-gradient(50% 50% at 50% 50%, var(--wash-1), transparent 70%);
  filter: blur(6px);
  pointer-events: none;
}

.intro__shape {
  width: 34px;
  height: 34px;
  display: block;
  position: relative;
  opacity: 0;
  animation: shape-float .7s var(--ease-back) both;
}

.intro__shape svg { width: 100%; height: 100%; display: block; }
.intro__shape:nth-child(1) { animation-delay: .05s; }
.intro__shape:nth-child(2) { animation-delay: .13s; }
.intro__shape:nth-child(3) { animation-delay: .21s; }
.intro__shape:nth-child(4) { animation-delay: .29s; }
.intro__shape:nth-child(5) { animation-delay: .37s; }

@keyframes shape-float {
  from { opacity: 0; transform: translateY(18px) scale(.8); }
  to   { opacity: 1; transform: none; }
}

.intro__kicker {
  font-size: 15px;
  color: var(--muted);
  margin-bottom: 8px;
}

.intro__title {
  font-size: 31px;
  line-height: 1.16;
  font-weight: 700;
  letter-spacing: -.032em;
  margin-bottom: 16px;
}

.intro__title span { color: var(--muted); font-weight: 600; }

.intro__text {
  font-size: 16px;
  color: var(--muted);
  margin-bottom: 30px;
  max-width: 34ch;
}


.stub {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px 0;
}

@keyframes stub-glow {
  0%, 100% { opacity: .55; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.12); }
}

.stub__text {
  font-size: 17px;
  line-height: 1.45;
  color: var(--muted);
  max-width: 26ch;
}


.quiz__head { padding: 8px 0 20px; }

.slots {
  display: flex;
  gap: 8px;
  margin-bottom: 22px;
}

.slot {
  flex: 1;
  height: 46px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: background-color .3s var(--ease), border-color .3s var(--ease),
              box-shadow .3s var(--ease);
}

.slot__index {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  opacity: .5;
}

.slot__art { display: none; }
.slot__art svg { width: 24px; height: 24px; display: block; }

.slot.is-current {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: var(--shadow);
}

.slot.is-current .slot__index { opacity: .85; }

.slot.is-filled {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: var(--shadow);
}

.slot.is-filled .slot__index { display: none; }
.slot.is-filled .slot__art { display: block; }

.slot.is-new { animation: slot-pop .45s var(--ease-back) both; }

@keyframes slot-pop {
  0%   { transform: scale(.72); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.quiz__title {
  font-size: 25px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -.025em;
  margin-bottom: 6px;
}

.quiz__hint { font-size: 15px; color: var(--muted); }

.cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-content: start;
  padding-bottom: 8px;
}

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 14px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow);
  animation: card-in .38s var(--ease-back) both;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(circle at 50% 42%, var(--card-wash) 0%, transparent 56%);
}

.card__art, .card__name { position: relative; }

.card:active { transform: scale(.955); box-shadow: var(--shadow-lift); }

.card.is-centered { grid-column: 1 / -1; width: calc(50% - 6px); justify-self: center; }

.card__art {
  width: 100%;
  aspect-ratio: 1 / .86;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card__art svg { width: 74%; height: 74%; display: block; }

.card__name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.01em;
}

.card.is-chosen { animation: card-out .34s var(--ease) forwards; pointer-events: none; }

@keyframes card-in {
  from { opacity: 0; transform: translateY(10px) scale(.96); }
  to   { opacity: 1; transform: none; }
}

@keyframes card-out {
  40%  { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(.4) translateY(-40px); opacity: 0; }
}


.result { padding: 8px 0 12px; }

.result > * { animation: reveal .5s var(--ease) both; }
.result > *:nth-child(1) { animation-delay: .02s; }
.result > *:nth-child(2) { animation-delay: .10s; }
.result > *:nth-child(3) { animation-delay: .18s; }
.result > *:nth-child(4) { animation-delay: .26s; }
.result > *:nth-child(5) { animation-delay: .34s; }
.result > *:nth-child(6) { animation-delay: .42s; }
.result > *:nth-child(7) { animation-delay: .50s; }
.result > *:nth-child(8) { animation-delay: .58s; }

@keyframes reveal {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}

.hero {
  text-align: center;
  padding: 26px 20px 28px;
  border-radius: 26px;
  background: var(--accent-wash);
  border: 1px solid var(--accent-line);
  background-clip: padding-box;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(72% 58% at 50% 12%, var(--accent-wash-strong), transparent 70%);
}

.hero > * { position: relative; }

.hero__art {
  width: 104px;
  height: 104px;
  margin: 0 auto 16px;
  animation: hero-in .8s var(--ease-back) both;
}

.hero__art svg { width: 100%; height: 100%; display: block; }

@keyframes hero-in {
  from { opacity: 0; transform: scale(.5) rotate(-14deg); }
  to   { opacity: 1; transform: none; }
}

.hero__kicker {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 7px;
}

.hero__name {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -.035em;
  line-height: 1.1;
}

.hero__tagline { font-size: 16px; color: var(--muted); margin-top: 5px; }

.lead {
  font-size: 18px;
  line-height: 1.45;
  letter-spacing: -.015em;
  margin-bottom: 26px;
}

.block { margin-bottom: 22px; }

.block__title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

.block__list { list-style: none; display: flex; flex-direction: column; gap: 11px; }

.block__list li {
  position: relative;
  padding-left: 21px;
  font-size: 15.5px;
  line-height: 1.45;
}

.block__list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}

.note {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--accent-line);
  border-radius: 20px;
  padding: 17px 19px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
  background-clip: padding-box;
}

.note::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(180deg, var(--accent-wash), transparent 70%);
}

.note > * { position: relative; }

.note__title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}

.note p { font-size: 15.5px; line-height: 1.45; }

.pair {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 14px 18px 14px 14px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}

.pair__art {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 13px;
  background: var(--pair-wash);
}

.pair__art svg { width: 62%; height: 62%; display: block; }
.pair__text { font-size: 14.5px; line-height: 1.4; color: var(--muted); }
.pair__text b { color: var(--text); font-weight: 600; }

.result__actions { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.result__actions .btn--ghost { margin-top: 0; }


.overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 24px;
}

.overlay.is-active { display: flex; }
.overlay__box { text-align: center; max-width: 300px; width: 100%; }
.overlay__text { color: var(--muted); font-size: 15px; margin-top: 16px; }

.overlay__title {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -.02em;
  margin-top: 18px;
}

.overlay__box .btn { margin-top: 20px; }
.overlay__box .btn + .btn { margin-top: 10px; }

.spinner {
  width: 30px;
  height: 30px;
  margin: 0 auto;
  border: 2.5px solid var(--line);
  border-top-color: var(--muted);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
