:root {
  --ink: #293241;
  --muted: #6f7786;
  --paper: #fffaf6;
  --panel: rgba(255, 255, 255, 0.8);
  --line: rgba(41, 50, 65, 0.13);
  --rose: #e8899d;
  --coral: #f2ad95;
  --sage: #abcdbb;
  --sky: #a9d4e8;
  --lemon: #f3df96;
  --lavender: #ccb9e6;
  --shadow: 0 24px 80px rgba(71, 61, 68, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background:
    linear-gradient(115deg, rgba(171, 205, 187, 0.56), transparent 35%),
    linear-gradient(245deg, rgba(169, 212, 232, 0.58), transparent 38%),
    linear-gradient(180deg, #fff6f0 0%, #f8fbf5 55%, #f4f8fb 100%);
  letter-spacing: 0;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  background-image:
    linear-gradient(rgba(41, 50, 65, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(41, 50, 65, 0.045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.72), transparent 82%);
}

button {
  min-width: 96px;
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  padding: 0 22px;
  color: var(--ink);
  font: inherit;
  font-weight: 780;
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
  user-select: none;
}

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

button:active {
  transform: translateY(0);
}

.app-shell {
  position: relative;
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  place-items: center;
  overflow-x: hidden;
  padding: 28px;
}

.quiz-card,
.photo-stage,
.button-stage,
.bank-stage,
.success-stage,
.modal {
  width: min(100%, 1040px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.quiz-card {
  position: relative;
  width: min(100%, 820px);
  min-height: 570px;
  overflow: hidden;
  padding: clamp(24px, 5vw, 48px);
}

.quiz-card::after {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 44%;
  height: 7px;
  content: "";
  background: linear-gradient(90deg, var(--rose), var(--lemon), var(--sage), var(--sky));
}

.topline,
.eyebrow,
.save-status {
  color: #936071;
  font-size: 0.82rem;
  font-weight: 820;
  letter-spacing: 0;
  text-transform: uppercase;
}

.save-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  color: var(--muted);
}

.mark {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
}

.progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(41, 50, 65, 0.08);
}

.progress span {
  display: block;
  width: 3%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--rose), var(--lemon), var(--sage));
  transition: width 320ms ease;
}

.question-view,
.final-question {
  position: relative;
  padding-top: clamp(28px, 5vw, 52px);
}

.eyebrow {
  margin: 0 0 12px;
}

h1,
h2 {
  max-width: 13ch;
  margin: 0;
  color: var(--ink);
  font-size: clamp(2rem, 5.2vw, 4.4rem);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  max-width: 16ch;
  font-size: clamp(1.8rem, 5vw, 3rem);
}

.question-text,
.photo-copy p,
.button-stage-head p,
.bank-stage p,
.success-stage p,
.modal p {
  max-width: 560px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2.2vw, 1.14rem);
  line-height: 1.6;
}

.answers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: clamp(26px, 4.5vw, 40px);
}

.answer-btn {
  position: relative;
  min-height: 116px;
  overflow: hidden;
  border: 1px solid rgba(41, 50, 65, 0.1);
  background: rgba(255, 255, 255, 0.72);
  text-align: left;
  box-shadow: 0 12px 28px rgba(82, 68, 74, 0.08);
}

.answer-btn::before {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  content: "";
  background: var(--rose);
  opacity: 0.34;
}

.answer-btn:nth-child(2n) {
  background: rgba(216, 198, 234, 0.34);
}

.answer-btn:nth-child(2n)::before {
  background: var(--sky);
}

.answer-btn:nth-child(3n) {
  background: rgba(171, 205, 187, 0.34);
}

.answer-btn:nth-child(3n)::before {
  background: var(--lemon);
}

.choice-row {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  min-height: 72px;
  margin-top: 34px;
  overflow: hidden;
  border-radius: 8px;
}

.primary-btn {
  background: linear-gradient(135deg, #f2a0b1, #f3df96);
  box-shadow: 0 16px 32px rgba(232, 137, 157, 0.28);
}

.secondary-btn {
  background: #ffffff;
  box-shadow: 0 12px 24px rgba(41, 50, 65, 0.1);
}

.runaway {
  z-index: 4;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

.photo-stage {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(280px, 0.8fr);
  align-items: center;
  gap: clamp(22px, 4vw, 44px);
  padding: clamp(22px, 5vw, 42px);
}

.photo-copy h1 {
  max-width: 10ch;
}

.photo-frame {
  position: relative;
  min-height: 410px;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(41, 50, 65, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(140deg, rgba(255, 255, 255, 0.68), rgba(169, 212, 232, 0.5)),
    repeating-linear-gradient(45deg, rgba(41, 50, 65, 0.06) 0 1px, transparent 1px 14px);
}

.photo-frame img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 410px;
  object-fit: cover;
}

.photo-frame img.is-missing {
  display: none;
}

.photo-frame figcaption {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 28px;
  color: var(--muted);
  font-weight: 760;
  text-align: center;
}

.photo-frame img:not(.is-missing) + figcaption {
  display: none;
}

.button-stage {
  width: min(100%, 1080px);
  padding: clamp(18px, 3vw, 30px);
}

.bank-stage {
  width: min(100%, 760px);
  padding: clamp(24px, 5vw, 48px);
}

.bank-card {
  width: 100%;
}

.bank-icon {
  display: grid;
  width: 78px;
  height: 78px;
  place-items: center;
  margin: 8px 0 18px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(171, 205, 187, 0.8), rgba(243, 223, 150, 0.82));
  color: var(--ink);
  font-size: 2.4rem;
  font-weight: 900;
  box-shadow: 0 18px 36px rgba(41, 50, 65, 0.12);
}

.bank-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 520px;
  min-height: 56px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--muted);
}

.bank-row strong {
  color: var(--ink);
}

.error-stage {
  display: grid;
  width: min(100%, 760px);
  min-height: 480px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.84), rgba(216, 198, 234, 0.28)),
    repeating-linear-gradient(135deg, rgba(41, 50, 65, 0.05) 0 1px, transparent 1px 18px);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  padding: clamp(24px, 5vw, 48px);
}

.error-card {
  width: 100%;
}

.error-code {
  margin: 6px 0 12px;
  color: rgba(232, 137, 157, 0.95);
  font-size: clamp(4.5rem, 18vw, 8.5rem);
  font-weight: 900;
  line-height: 0.9;
}

.error-loader {
  width: min(100%, 420px);
  height: 10px;
  margin-top: 30px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(41, 50, 65, 0.08);
}

.error-loader span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--rose), var(--lemon), var(--sage));
  animation: loader-slide 1300ms ease-in-out infinite;
}

.error-stage.is-agreement .error-code {
  color: rgba(171, 205, 187, 0.95);
}

.button-stage-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px 24px;
  align-items: end;
  margin-bottom: 18px;
}

.button-stage-head .eyebrow {
  grid-column: 1 / -1;
}

.button-stage-head h1 {
  max-width: none;
  font-size: clamp(1.7rem, 4vw, 3.1rem);
}

.button-stage-head p {
  margin: 0;
  text-align: right;
}

.button-cloud {
  position: relative;
  min-height: min(68vh, 720px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.54), rgba(216, 198, 234, 0.18)),
    repeating-linear-gradient(135deg, rgba(41, 50, 65, 0.04) 0 1px, transparent 1px 18px);
}

.tiny-yes {
  position: absolute;
  min-width: 0;
  min-height: 42px;
  padding: 0 9px;
  border: 1px solid rgba(41, 50, 65, 0.1);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: none;
}

.tiny-yes:nth-child(4n) {
  background: rgba(232, 137, 157, 0.38);
}

.tiny-yes:nth-child(5n) {
  background: rgba(169, 212, 232, 0.5);
}

.tiny-yes:nth-child(7n) {
  background: rgba(243, 223, 150, 0.48);
}

.tiny-yes.real {
  background: rgba(171, 205, 187, 0.65);
}

.success-stage {
  position: relative;
  min-height: 420px;
  overflow: hidden;
  padding: clamp(28px, 6vw, 58px);
}

.success-stage h1 {
  max-width: 12ch;
}

.confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.confetti span {
  position: absolute;
  width: 10px;
  height: 18px;
  border-radius: 3px;
  animation: fall 1500ms ease-out forwards;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(41, 50, 65, 0.24);
  backdrop-filter: blur(12px);
}

.modal {
  position: relative;
  max-width: 560px;
  padding: clamp(24px, 5vw, 42px);
}

.hidden {
  display: none !important;
}

@keyframes fall {
  0% {
    opacity: 0;
    transform: translateY(-30px) rotate(0deg);
  }

  18% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translateY(420px) rotate(280deg);
  }
}

@keyframes loader-slide {
  0% {
    transform: translateX(-120%);
  }

  100% {
    transform: translateX(240%);
  }
}

@media (max-width: 760px) {
  .app-shell {
    align-items: center;
    padding: 10px;
  }

  .quiz-card,
  .photo-stage,
  .button-stage,
  .bank-stage,
  .success-stage,
  .error-stage {
    width: 100%;
    min-height: auto;
  }

  .answers {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 22px;
  }

  .answer-btn {
    min-height: 70px;
    padding: 15px 46px 15px 16px;
  }

  .quiz-card {
    padding: 18px;
  }

  .question-view,
  .final-question {
    padding-top: 24px;
  }

  .topline {
    margin-bottom: 16px;
  }

  .mark,
  .counter {
    font-size: 0.72rem;
  }

  h1 {
    max-width: 12ch;
    font-size: clamp(2rem, 11vw, 2.85rem);
  }

  h2 {
    font-size: clamp(1.65rem, 8vw, 2.25rem);
  }

  .question-text,
  .photo-copy p,
  .button-stage-head p,
  .success-stage p,
  .bank-stage p,
  .modal p {
    margin-top: 14px;
    font-size: 0.98rem;
    line-height: 1.45;
  }

  .choice-row {
    min-height: 120px;
    margin-top: 24px;
  }

  .photo-stage {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 18px;
  }

  .photo-frame,
  .photo-frame img {
    min-height: 330px;
  }

  .button-stage-head {
    grid-template-columns: 1fr;
  }

  .button-stage-head p {
    text-align: left;
  }

  .button-cloud {
    min-height: calc(100dvh - 176px);
  }

  button {
    min-width: 88px;
  }

  .tiny-yes {
    min-width: 52px;
    min-height: 38px;
    padding: 0 8px;
  }
}
