:root {
  --plum: #4a1838;
  --ink: #2a0e20;
  --muted: #6a4c60;
  --ivory: #fbf6f1;
  --card: #fef9f6;
  --blush: #f3ddd8;
  --blush-soft: #fbe9e3;
  --coral: #f28c6b;
  --line: rgba(242, 140, 107, 0.55);
  --serif: "Fraunces", Georgia, serif;
  --sans: "Hanken Grotesk", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--ivory);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
  color: inherit;
}

.app {
  max-width: 440px;
  min-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
  animation: enter 0.32s ease-out both;
}

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

h1,
h2 {
  margin: 0;
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-variation-settings: "opsz" 144;
  font-weight: 560;
  color: var(--ink);
  letter-spacing: -0.018em;
  text-wrap: balance;
}

h1:focus {
  outline: none;
}

.logo {
  font-family: var(--serif);
  font-variation-settings: "opsz" 144;
  font-size: 30px;
  font-weight: 520;
  color: var(--plum);
  letter-spacing: -0.02em;
  line-height: 1;
}

.rule {
  height: 1px;
  background: var(--line);
  border: 0;
  margin: 0;
}

.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}

.footer.center {
  justify-content: center;
  border-top: 0;
}

/* Photos: circle with the coral sparkle at the top right */
.photo {
  position: relative;
  flex-shrink: 0;
}

.photo img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.photo .spark {
  position: absolute;
  top: 3%;
  right: -7%;
  width: 26%;
  max-width: 44px;
  color: var(--coral);
}

/* Buttons */
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 58px;
  padding: 0 34px;
  border: 0;
  border-radius: 999px;
  background: var(--plum);
  color: var(--ivory);
  font-family: var(--serif);
  font-variation-settings: "opsz" 72;
  font-size: 21px;
  font-weight: 480;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease;
}

.pill:active {
  transform: scale(0.98);
}

.pill.wide {
  width: 100%;
}

.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 22px;
  border: 1.5px solid rgba(74, 24, 56, 0.25);
  border-radius: 999px;
  background: transparent;
  font-size: 15px;
  font-weight: 650;
  color: var(--plum);
  cursor: pointer;
}

.textlink {
  min-height: 48px;
  padding: 0 12px;
  border: 0;
  background: none;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* 1. Cover */
.cover {
  align-items: center;
  text-align: center;
  gap: 18px;
}

.cover .logo {
  align-self: flex-start;
}

.cover .photo {
  width: min(66vw, 280px);
  aspect-ratio: 1;
  margin-top: 6px;
}

.cover h1 {
  font-size: clamp(34px, 10.4vw, 44px);
  line-height: 1.04;
}

.cover .rule {
  width: 78%;
}

.cover .sub {
  margin: 0;
  font-size: 18px;
  line-height: 1.4;
  color: var(--ink);
  max-width: 13em;
  text-wrap: balance;
}

.cover .footer {
  width: 100%;
  margin-top: auto;
}

/* 2. Lineup */
.lineup {
  gap: 4px;
}

.lineup .logo {
  align-self: center;
  font-size: 24px;
  letter-spacing: 0.08em;
}

.lineup h1 {
  margin: 12px 0 10px;
  text-align: center;
  font-size: clamp(29px, 8.6vw, 36px);
  line-height: 1.1;
}

.lineup h1 em,
.twin-name em {
  font-style: italic;
  font-weight: 440;
  color: var(--coral);
}

.lineup ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.lineup li {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--line);
}

.lineup li:last-child {
  border-bottom: 0;
}

.lineup li img {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.twin-name {
  font-family: var(--serif);
  font-variation-settings: "opsz" 144;
  font-size: 27px;
  font-weight: 480;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.lineup .line {
  margin-top: 4px;
  font-size: 15px;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.lineup .pill {
  margin-top: 18px;
}

/* 3. Questions */
.question {
  gap: 16px;
}

.qhead {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
}

.back {
  width: 36px;
  height: 44px;
  margin-left: -10px;
  margin-right: -6px;
  border: 0;
  background: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--plum);
  cursor: pointer;
}

.track {
  flex: 1;
  height: 5px;
  border-radius: 3px;
  background: var(--blush-soft);
  overflow: hidden;
}

.track span {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--plum);
  transition: width 0.35s ease;
}

.count {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.qtitle {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
}

.qtitle h1 {
  flex: 1;
  font-size: clamp(30px, 9vw, 40px);
  line-height: 1.04;
}

.qtitle .photo {
  width: min(31vw, 132px);
  aspect-ratio: 1;
  margin-right: 8px;
}

.answers {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.answer {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 78px;
  padding: 10px 14px 10px 12px;
  border: 1.5px solid transparent;
  border-radius: 18px;
  background: var(--card);
  box-shadow: 0 1px 2px rgba(74, 24, 56, 0.05), 0 4px 14px rgba(74, 24, 56, 0.04);
  text-align: left;
  font-size: 17px;
  line-height: 1.3;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}

.answer:active {
  transform: scale(0.99);
}

.answer[aria-pressed="true"] {
  border-color: var(--plum);
  background: #fff4f0;
}

.answer .text {
  flex: 1;
}

.answer .chev {
  flex-shrink: 0;
  color: var(--plum);
}

.answer .icon svg {
  width: 30px;
  height: 30px;
}

.answer .icon {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--blush-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--plum);
}

.answer .food {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  object-fit: cover;
}

.answer .thumb {
  flex-shrink: 0;
  width: 80px;
  height: 60px;
  border-radius: 12px;
  object-fit: cover;
}

.answer .bar {
  flex-shrink: 0;
  width: 2px;
  align-self: stretch;
  margin: 8px 0;
  border-radius: 1px;
  background: var(--coral);
}

/* 4. Loading */
.loading {
  align-items: center;
  justify-content: center;
  gap: 28px;
  text-align: center;
}

.loading .faces {
  display: flex;
}

.loading .faces img {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--ivory);
  margin-left: -10px;
  animation: bob 1s ease-in-out infinite;
}

.loading .faces img:first-child {
  margin-left: 0;
}

@keyframes bob {
  50% {
    transform: translateY(-8px);
  }
}

.loading h1 {
  font-size: 28px;
  line-height: 1.15;
}

/* 5. Result */
.result {
  align-items: center;
  text-align: center;
  gap: 14px;
}

.result .logo {
  align-self: flex-start;
}

.result .kicker {
  margin-top: 4px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.result .photo {
  width: min(52vw, 210px);
  aspect-ratio: 1;
  animation: pop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

@keyframes pop {
  from {
    transform: scale(0.85);
    opacity: 0;
  }
}

.result .twin-name {
  font-size: clamp(36px, 11vw, 46px);
}

.result .line {
  margin: -4px 0 0;
  font-size: 17px;
  letter-spacing: 0.02em;
}

.insight {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 4px;
  padding: 16px 18px;
  border-radius: 20px;
  background: var(--card);
  box-shadow: 0 1px 2px rgba(74, 24, 56, 0.05), 0 4px 14px rgba(74, 24, 56, 0.04);
  text-align: left;
}

.insight div {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 15.5px;
  line-height: 1.4;
}

.insight b {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.insight .emoji {
  font-size: 22px;
  line-height: 1.2;
}

.result .cta {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.result .note {
  font-size: 13px;
  color: var(--muted);
}

.result .more {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.result .footer {
  width: 100%;
  margin-top: auto;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--ivory);
  font-size: 14px;
  font-weight: 600;
  animation: enter 0.2s ease-out both;
}

.noscript {
  padding: 40px 20px;
  text-align: center;
}

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