:root {
  color-scheme: light;
  --ink: #30233f;
  --muted: #806e92;
  --purple: #8153c4;
  --purple-deep: #5b368f;
  --lavender: #e9dcf8;
  --pink: #f6d9e9;
  --white: #fffaff;
  --glass: rgb(255 251 255 / 76%);
  font-family: "Nunito", "Trebuchet MS", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 10% 18%, rgb(255 255 255 / 74%), transparent 28%),
    radial-gradient(ellipse at 92% 76%, rgb(255 205 229 / 58%), transparent 30%),
    linear-gradient(135deg, #e7d7fa 0%, #f8e2f0 48%, #d9cef8 100%);
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

.sky {
  position: fixed;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.sparkle,
.floaty {
  position: absolute;
  color: #fff;
  text-shadow: 0 0 12px rgb(142 88 197 / 50%);
  animation: twinkle 3.5s ease-in-out infinite;
}

.sparkle {
  font-size: 28px;
}

.sparkle--one { top: 17%; left: 12%; }
.sparkle--two { top: 70%; left: 17%; animation-delay: 1s; }
.sparkle--three { top: 24%; right: 12%; animation-delay: 1.8s; }
.sparkle--four { top: 78%; right: 18%; animation-delay: 0.7s; }

.floaty {
  color: #9867c6;
  font-size: 23px;
  opacity: 0.55;
  animation: float 7s ease-in-out infinite;
}

.floaty--one { top: 29%; left: 6%; }
.floaty--two { top: 57%; left: 8%; animation-delay: 1s; }
.floaty--three { top: 17%; right: 8%; animation-delay: 2s; }
.floaty--four { top: 48%; right: 6%; animation-delay: 0.6s; }
.floaty--five { top: 86%; left: 34%; animation-delay: 2.5s; }
.floaty--six { top: 82%; right: 31%; font-size: 19px; animation-delay: 1.3s; }
.floaty--seven { top: 67%; right: 10%; animation-delay: 3s; }
.floaty--eight { top: 9%; left: 40%; animation-delay: 1.5s; }

.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  width: min(1160px, calc(100% - 48px));
  height: 76px;
  align-items: center;
  justify-content: space-between;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-size: 14px;
  text-decoration: none;
}

.brand b {
  color: var(--purple-deep);
  font-weight: 900;
}

.brand__icon {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid rgb(108 71 156 / 20%);
  border-radius: 10px;
  background: rgb(255 255 255 / 56%);
  color: var(--purple-deep);
}

.sound-toggle {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border: 1px solid rgb(111 76 151 / 17%);
  border-radius: 999px;
  background: rgb(255 255 255 / 52%);
  color: var(--purple-deep);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  transition: background 180ms ease, transform 180ms ease;
}

.sound-toggle:hover {
  transform: translateY(-1px);
  background: #fff;
}

.sound-toggle__icon {
  font-size: 17px;
}

.page {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: calc(100vh - 76px);
  place-items: center;
  padding: 18px 20px 22px;
}

.quiz-card {
  position: relative;
  width: min(100%, 610px);
  min-height: 560px;
  overflow: hidden;
  padding: 38px 52px 34px;
  border: 1px solid rgb(255 255 255 / 90%);
  border-radius: 30px;
  background: var(--glass);
  box-shadow:
    0 25px 70px rgb(82 50 121 / 15%),
    0 4px 16px rgb(94 63 130 / 7%),
    inset 0 1px 0 rgb(255 255 255 / 90%);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.card-glow {
  position: absolute;
  top: -135px;
  left: 50%;
  width: 320px;
  height: 210px;
  border-radius: 50%;
  background: rgb(224 193 255 / 48%);
  filter: blur(50px);
  pointer-events: none;
  transform: translateX(-50%);
}

.screen {
  position: relative;
  z-index: 1;
  animation: enter 420ms ease both;
}

.welcome-screen,
.result-screen {
  display: flex;
  min-height: 486px;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--purple);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow span {
  font-size: 13px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin: 13px 0 3px;
  color: #38254e;
  font-size: clamp(34px, 7vw, 47px);
  font-weight: 900;
  letter-spacing: -0.055em;
  line-height: 1.12;
}

.title-heart {
  font-size: 0.72em;
  vertical-align: 0.12em;
}

.subtitle {
  margin: 8px 0 0;
  color: #715c84;
  font-size: 16px;
  font-weight: 700;
}

.mascot {
  position: relative;
  width: 176px;
  height: 172px;
  margin: 12px auto 2px;
  animation: bob 3.8s ease-in-out infinite;
}

.mascot__face {
  position: absolute;
  z-index: 2;
  top: 46px;
  left: 31px;
  display: flex;
  width: 114px;
  height: 105px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 4px solid #4c365d;
  border-radius: 48% 48% 44% 44%;
  background: #fffaff;
  box-shadow: 0 8px 16px rgb(65 38 87 / 15%);
}

.mascot__ears {
  position: absolute;
  z-index: 1;
  top: -6px;
  left: 13px;
  width: 150px;
  height: 92px;
  overflow: hidden;
  border: 4px solid #30233f;
  border-radius: 55% 55% 35% 35%;
  background: linear-gradient(145deg, #49305c, #211b2d);
  color: transparent;
  clip-path: polygon(0 25%, 37% 0, 49% 28%, 63% 0, 100% 25%, 97% 100%, 3% 100%);
}

.mascot__ears::before,
.mascot__ears::after {
  position: absolute;
  top: 15px;
  width: 27px;
  height: 42px;
  border-radius: 50%;
  background: #a77dc9;
  content: "";
  transform: rotate(-24deg);
}

.mascot__ears::before { left: 30px; }
.mascot__ears::after { right: 30px; transform: rotate(24deg); }

.mascot__eyes {
  margin-top: 8px;
  color: #30233f;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 4px;
}

.mascot__blush {
  margin-top: 2px;
  color: #b66c9f;
  font-size: 23px;
  font-weight: 900;
}

.mascot__skull {
  position: absolute;
  z-index: 3;
  top: 23px;
  left: 75px;
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border: 2px solid #34233f;
  border-radius: 50%;
  background: #f7d9ec;
  color: #34233f;
  font-size: 16px;
}

.mascot__collar {
  position: absolute;
  z-index: 4;
  bottom: 0;
  left: 76px;
  color: #7d4bab;
  font-size: 26px;
}

.mascot__spark {
  position: absolute;
  color: #9469c7;
  font-size: 25px;
  animation: twinkle 2.6s ease-in-out infinite;
}

.mascot__spark--left { top: 47px; left: 0; }
.mascot__spark--right { top: 30px; right: 0; animation-delay: 1s; }

.welcome-note {
  margin: 3px 0 16px;
  color: #735d84;
  font-size: 13px;
  font-weight: 700;
}

.welcome-note span {
  padding: 0 3px;
}

.button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 21px;
  border: 1px solid transparent;
  border-radius: 15px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease, opacity 180ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-2px);
}

.button:focus-visible,
.sound-toggle:focus-visible,
.answer:focus-visible {
  outline: 3px solid #c398ed;
  outline-offset: 3px;
}

.button--primary {
  background: linear-gradient(135deg, #9564d0, #7044ad);
  box-shadow: 0 8px 18px rgb(110 65 169 / 23%);
  color: #fff;
}

.button--primary:hover:not(:disabled) {
  box-shadow: 0 11px 23px rgb(110 65 169 / 31%);
}

.button--primary:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.button--ghost {
  border-color: rgb(118 82 157 / 19%);
  background: rgb(255 255 255 / 63%);
  color: #63458a;
}

.button--ghost:hover:not(:disabled) {
  background: #fff;
}

.start-button {
  min-width: 205px;
  min-height: 51px;
  font-size: 14px;
}

.tiny-note {
  margin: 11px 0 0;
  color: #9989a7;
  font-size: 10px;
  font-weight: 700;
}

.question-screen {
  min-height: 486px;
  padding-top: 3px;
}

.quiz-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.question-count {
  color: #846b9c;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.score-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border: 1px solid rgb(191 137 188 / 22%);
  border-radius: 999px;
  background: rgb(255 255 255 / 61%);
  color: #654584;
  font-size: 11px;
  font-weight: 900;
}

.score-badge > span:first-child {
  color: #c16d9f;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  margin: 15px 0 30px;
  border-radius: 999px;
  background: #e7dced;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #bd8be8, #7950be);
  box-shadow: 0 0 10px rgb(135 82 192 / 35%);
  transition: width 380ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.question-heading {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 76px;
}

.question-sparkle {
  padding-top: 2px;
  color: #a06bc9;
  font-size: 21px;
}

.question-heading h2 {
  margin: 0;
  color: #39284e;
  font-size: clamp(21px, 4vw, 26px);
  font-weight: 900;
  letter-spacing: -0.035em;
  line-height: 1.3;
}

.answers {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.answer {
  display: flex;
  min-height: 52px;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border: 1px solid rgb(134 102 159 / 16%);
  border-radius: 14px;
  background: rgb(255 255 255 / 69%);
  color: #574568;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  text-align: left;
  transition: border-color 180ms ease, transform 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.answer:hover:not(:disabled) {
  transform: translateX(3px);
  border-color: #bd9ada;
  background: #fff;
}

.answer__letter {
  display: grid;
  width: 27px;
  height: 27px;
  flex: 0 0 27px;
  place-items: center;
  border-radius: 9px;
  background: #f0e7f7;
  color: #80609d;
  font-size: 11px;
  font-weight: 900;
}

.answer.is-selected {
  border-color: #9363c5;
  background: #f4eafb;
  box-shadow: 0 0 0 2px rgb(147 99 197 / 10%);
  animation: answer-pop 280ms ease;
}

.answer.is-selected .answer__letter {
  background: #8455b8;
  color: #fff;
}

.answer.is-correct {
  border-color: #80aa8b;
  background: #eff8ef;
}

.answer.is-correct .answer__letter {
  background: #729e79;
}

.answer.is-wrong {
  border-color: #d49bad;
  background: #fff0f3;
}

.answer.is-wrong .answer__letter {
  background: #c98198;
  color: #fff;
}

.answer:disabled {
  cursor: default;
}

.answer-feedback {
  min-height: 19px;
  margin: 10px 0 8px;
  color: #775b90;
  font-size: 11px;
  font-weight: 800;
}

.quiz-navigation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 3px;
}

.result-screen {
  position: relative;
  justify-content: center;
  padding: 16px 0;
}

.result-confetti {
  margin-bottom: 8px;
  color: #9d6cc8;
  font-size: 23px;
  letter-spacing: 5px;
  animation: twinkle 2.5s ease-in-out infinite;
}

.result-icon {
  display: grid;
  width: 76px;
  height: 76px;
  margin-bottom: 10px;
  place-items: center;
  border: 1px solid rgb(168 126 204 / 23%);
  border-radius: 25px;
  background: linear-gradient(145deg, #fff, #f0e2fb);
  box-shadow: 0 10px 24px rgb(81 51 117 / 11%);
  font-size: 39px;
  animation: bob 3s ease-in-out infinite;
}

.result-screen h2 {
  margin: 10px 0 2px;
  color: #3b2851;
  font-size: clamp(24px, 5vw, 32px);
  font-weight: 900;
  letter-spacing: -0.04em;
}

.result-score {
  margin: 2px 0 5px;
  color: #8052b7;
  font-size: 49px;
  font-weight: 900;
  letter-spacing: -0.07em;
  line-height: 1;
}

.result-score__outof {
  color: #a38eaf;
  font-size: 22px;
  letter-spacing: 0;
}

.result-message {
  max-width: 380px;
  min-height: 40px;
  margin: 8px 0 19px;
  color: #705b81;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.55;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.share-status {
  min-height: 18px;
  margin: 9px 0 0;
  color: #775b90;
  font-size: 11px;
  font-weight: 800;
}

.result-confetti--bottom {
  position: absolute;
  bottom: 0;
  margin: 0;
  opacity: 0.72;
}

.page-footer {
  position: absolute;
  bottom: 10px;
  margin: 0;
  color: #856f98;
  font-size: 10px;
  font-weight: 700;
}

.page-footer span {
  color: #b75c95;
}

.side-doodle {
  position: absolute;
  top: 50%;
  display: flex;
  flex-direction: column;
  gap: 44px;
  color: rgb(110 72 149 / 37%);
  font-size: 31px;
  animation: float 6s ease-in-out infinite;
}

.side-doodle--left { left: max(5vw, calc((100vw - 1080px) / 2)); }
.side-doodle--right { right: max(5vw, calc((100vw - 1080px) / 2)); animation-delay: 1.7s; }
.side-doodle span:nth-child(2) { font-size: 24px; }
.side-doodle span:nth-child(3) { font-size: 21px; }

[hidden] {
  display: none !important;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.56; transform: scale(0.92) rotate(-6deg); }
  50% { opacity: 1; transform: scale(1.12) rotate(7deg); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-13px); }
}

@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-6px) rotate(1deg); }
}

@keyframes answer-pop {
  0% { transform: scale(0.98); }
  65% { transform: scale(1.015); }
  100% { transform: scale(1); }
}

@keyframes enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 760px) {
  .side-doodle {
    display: none;
  }

  .page {
    min-height: calc(100vh - 68px);
    padding: 12px 16px 28px;
  }

  .topbar {
    width: calc(100% - 32px);
    height: 66px;
  }

  .quiz-card {
    min-height: 540px;
    padding: 32px 28px 28px;
  }

  .welcome-screen,
  .result-screen,
  .question-screen {
    min-height: 475px;
  }

  .floaty--one { left: 2%; }
  .floaty--two { left: 3%; }
  .floaty--four { right: 2%; }
  .floaty--seven { right: 2%; }
}

@media (max-width: 420px) {
  .topbar {
    width: calc(100% - 26px);
  }

  .brand {
    gap: 6px;
    font-size: 12px;
  }

  .sound-toggle {
    padding: 6px 9px;
    font-size: 10px;
  }

  .quiz-card {
    min-height: 530px;
    padding: 28px 20px 24px;
    border-radius: 24px;
  }

  .welcome-screen,
  .result-screen {
    min-height: 470px;
  }

  .question-screen {
    min-height: 475px;
  }

  .answer {
    min-height: 48px;
    gap: 9px;
    padding: 7px 10px;
    font-size: 12px;
  }

  .quiz-navigation .button {
    min-height: 43px;
    padding: 0 14px;
  }

  .page-footer {
    bottom: 8px;
    font-size: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
