:root {
  --bg: linear-gradient(160deg, #fff3e5 0%, #ffe7f3 45%, #e4f7ff 100%);
  --card-bg: rgba(255, 255, 255, 0.9);
  --text: #2e294e;
  --muted: #6d6a84;
  --accent: #ff6b9d;
  --accent-2: #7e7bff;
  --shadow: 0 18px 40px rgba(67, 39, 103, 0.16);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", sans-serif;
  color: var(--text);
  background: var(--bg);
}

.top-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(126, 123, 255, 0.12);
}

.brand-link {
  font-family: "Baloo 2", cursive;
  font-size: 1.35rem;
  color: #473e72;
  text-decoration: none;
  font-weight: 800;
}

.app-shell {
  min-height: calc(100vh - 160px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 14px 30px;
}

.card {
  width: min(560px, 100%);
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.progress-wrap {
  margin-bottom: 12px;
}

.progress-top {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.progress-bar {
  height: 10px;
  border-radius: 999px;
  background: #f0ecff;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.4s ease;
}

.fade-in {
  animation: fadeIn 0.35s ease both;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.title {
  font-family: "Baloo 2", cursive;
  font-size: clamp(1.45rem, 2vw + 1rem, 2rem);
  line-height: 1.15;
  margin: 8px 0 6px;
}

.subtitle {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.95rem;
}

.answers,
.actions,
.modal-actions,
.social-grid {
  display: grid;
  gap: 12px;
}

.answer-btn,
.primary-btn,
.secondary-btn,
.social-btn {
  width: 100%;
  border: none;
  border-radius: 16px;
  padding: 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}

.answer-btn {
  text-align: left;
  color: var(--text);
  background: #fff;
  border: 1px solid #ece7ff;
  box-shadow: 0 8px 16px rgba(95, 67, 148, 0.08);
}

.answer-btn:hover,
.answer-btn:focus-visible,
.primary-btn:hover,
.secondary-btn:hover,
.social-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 20px rgba(95, 67, 148, 0.14);
}

.answer-label {
  display: inline-block;
  margin-right: 6px;
  color: var(--accent-2);
  font-weight: 700;
}

.primary-btn {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: white;
}

.secondary-btn,
.social-btn {
  background: #fff;
  border: 1px solid #ddd9f8;
  color: var(--text);
}

.sub-action {
  margin: 6px 0 0;
  color: #81799e;
  text-align: center;
  font-size: 0.86rem;
}

.result-header {
  text-align: center;
}

.type-code {
  font-family: "Baloo 2", cursive;
  font-size: clamp(2.2rem, 5vw, 3rem);
  margin: 4px 0;
}

.type-name {
  font-size: 1.15rem;
  margin-top: 0;
}

.desc {
  line-height: 1.5;
  color: #4b4668;
  margin: 10px 0 14px;
}

.traits {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 8px;
  color: #4b4668;
}

.cta-box {
  margin-top: 20px;
  background: #fff7fd;
  border: 1px solid #ffd2e8;
  border-radius: 16px;
  padding: 14px;
  text-align: center;
}

.match-score {
  text-align: center;
  font-family: "Baloo 2", cursive;
  font-size: clamp(2.1rem, 5vw, 2.8rem);
  margin: 8px 0;
}

.match-score.bounce {
  animation: scoreBounce 0.7s cubic-bezier(0.3, 1.5, 0.4, 1);
}

@keyframes scoreBounce {
  0% {
    transform: scale(0.8);
  }
  40% {
    transform: scale(1.16);
  }
  100% {
    transform: scale(1);
  }
}

.result-card {
  margin-top: 18px;
  border-radius: 24px;
  padding: 18px;
  text-align: center;
  background: linear-gradient(155deg, #ffd6a4, #ffc2dd 42%, #badcff);
  box-shadow: 0 15px 30px rgba(64, 26, 87, 0.2);
}

.result-card h4 {
  margin: 0 0 4px;
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #604366;
}

.result-card .card-type {
  font-family: "Baloo 2", cursive;
  font-size: 2rem;
  margin: 0;
}

.result-card p {
  margin: 6px 0;
}

.mini-copy {
  text-align: center;
  color: #7a728f;
  margin-top: 10px;
  font-size: 0.9rem;
}

.site-footer {
  text-align: center;
  padding: 20px 14px 30px;
}

.footer-title {
  margin: 0;
  font-weight: 700;
}

.footer-tag {
  margin: 6px 0 10px;
  color: #726b8f;
}

.footer-links {
  display: flex;
  gap: 16px;
  justify-content: center;
}

.footer-links a {
  color: #5a5082;
  text-decoration: none;
  font-weight: 600;
}

.share-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
}

.share-modal.is-open {
  display: block;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(23, 14, 48, 0.45);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(540px, calc(100% - 20px));
  margin: 10vh auto 0;
  border-radius: 20px;
  padding: 18px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(21, 11, 39, 0.25);
  animation: modalEnter 0.25s ease;
}

@keyframes modalEnter {
  from {
    transform: translateY(14px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  border: none;
  background: #f2eeff;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  font-size: 1.2rem;
  cursor: pointer;
}

.modal-card h3 {
  margin: 0;
}

.modal-sub {
  color: #756f8c;
  margin: 8px 0 14px;
}

.share-status {
  min-height: 20px;
  margin: 10px 0 0;
  font-size: 0.9rem;
  color: #5b5379;
}

.confetti-layer {
  pointer-events: none;
  position: fixed;
  inset: 0;
  overflow: hidden;
}

.confetti {
  position: absolute;
  top: -16px;
  width: 10px;
  height: 14px;
  opacity: 0.9;
  animation: confettiFall 1.7s linear forwards;
}

@keyframes confettiFall {
  to {
    transform: translate3d(var(--x, 0), 100vh, 0) rotate(600deg);
    opacity: 0;
  }
}

@media (min-width: 680px) {
  .card,
  .modal-card {
    padding: 24px;
  }

  .actions,
  .modal-actions,
  .social-grid {
    grid-template-columns: 1fr 1fr;
  }
}
