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

:root {
  --pink: #ff6fa5;
  --pink-light: #ffd6e8;
  --purple: #9b7aff;
  --blue: #6fc3ff;
  --yellow: #ffd166;
  --dark: #3a2e4d;
  --bg1: #fff0f6;
  --bg2: #e8e4ff;
}

body {
  font-family: 'Poppins', sans-serif;
  color: var(--dark);
  min-height: 100vh;
  background: linear-gradient(160deg, var(--bg1), var(--bg2) 60%, #e0f3ff);
  overflow-x: hidden;
  position: relative;
}

h1, h2, h3 {
  font-family: 'Baloo 2', cursive;
}

.sakura-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.petal {
  position: absolute;
  top: -5%;
  animation: fall linear infinite;
}

@keyframes fall {
  0% { transform: translateY(-10vh) rotate(0deg); }
  100% { transform: translateY(110vh) rotate(360deg); }
}

.app {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 20px;
}

.topbar {
  display: flex;
  justify-content: center;
  padding: 10px 0 20px;
}

.logo {
  font-size: 1.3rem;
  font-family: 'Baloo 2', cursive;
  font-weight: 700;
  color: var(--pink);
}
.logo strong { color: var(--purple); }

.screen {
  display: none;
  flex: 1;
  align-items: center;
  justify-content: center;
}
.screen.active {
  display: flex;
  animation: fadeIn 0.4s ease;
}

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

.card {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  border-radius: 28px;
  padding: 36px 28px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(155, 122, 255, 0.18), 0 4px 12px rgba(255, 111, 165, 0.12);
  border: 2px solid rgba(255, 255, 255, 0.6);
  position: relative;
}

/* START SCREEN */
.hero-card { text-align: center; }
.hero-emoji { font-size: 3rem; margin-bottom: 10px; }
.hero-card h1 {
  font-size: 1.9rem;
  background: linear-gradient(90deg, var(--pink), var(--purple));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 14px;
  line-height: 1.3;
}
.subtitle {
  color: #6e6080;
  font-size: 0.98rem;
  line-height: 1.6;
  margin-bottom: 20px;
}
.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 28px;
}
.hero-tags span {
  background: var(--pink-light);
  color: var(--pink);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
}

.btn-main {
  background: linear-gradient(90deg, var(--pink), var(--purple));
  color: white;
  border: none;
  padding: 16px 32px;
  border-radius: 999px;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: 'Baloo 2', cursive;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(255, 111, 165, 0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-main:hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 14px 30px rgba(255, 111, 165, 0.5); }
.btn-main:active { transform: translateY(0) scale(0.98); }

.btn-ghost {
  background: transparent;
  color: var(--purple);
  border: 2px solid var(--purple);
  padding: 14px 28px;
  border-radius: 999px;
  font-weight: 700;
  font-family: 'Baloo 2', cursive;
  cursor: pointer;
  transition: background 0.15s ease;
}
.btn-ghost:hover { background: rgba(155, 122, 255, 0.1); }

/* QUIZ SCREEN */
.quiz-card { width: 100%; }
.progress-wrap { margin-bottom: 24px; }
.progress-bar {
  height: 10px;
  background: #f0e9ff;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 8px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--purple), var(--pink));
  border-radius: 999px;
  transition: width 0.4s ease;
}
.progress-label {
  font-size: 0.8rem;
  color: #8a7ea3;
  font-weight: 600;
}

.question-box { text-align: center; margin-bottom: 26px; }
.q-icon { font-size: 2.4rem; margin-bottom: 8px; }
#questionText { font-size: 1.25rem; line-height: 1.4; color: var(--dark); }

.options { display: flex; flex-direction: column; gap: 12px; }
.option-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  background: #fbf8ff;
  border: 2px solid #ece3ff;
  padding: 14px 16px;
  border-radius: 16px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.95rem;
  color: var(--dark);
  cursor: pointer;
  transition: all 0.15s ease;
  animation: popIn 0.35s ease backwards;
}
@keyframes popIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.option-btn:hover {
  border-color: var(--pink);
  background: var(--pink-light);
  transform: translateX(4px);
}
.opt-letter {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  color: white;
  font-weight: 700;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* RESULT SCREEN */
.result-card { text-align: center; overflow: hidden; }
.confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.confetti span {
  position: absolute;
  top: -10%;
  animation: confettiFall 2.2s ease-in forwards;
}
@keyframes confettiFall {
  to { top: 60%; opacity: 0; transform: rotate(200deg); }
}

.result-kicker {
  color: #8a7ea3;
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.mbti-code {
  font-size: 3rem;
  background: linear-gradient(90deg, var(--pink), var(--purple), var(--blue));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1.2;
}
.mbti-name {
  color: var(--purple);
  margin-bottom: 18px;
  font-size: 1.15rem;
}

.char-section-label {
  font-family: 'Baloo 2', cursive;
  font-weight: 700;
  color: var(--purple);
  font-size: 1rem;
  margin-bottom: 14px;
}

.char-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 24px;
}

.char-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  text-align: left;
  background: linear-gradient(160deg, #fff, var(--pink-light));
  border-radius: 20px;
  padding: 18px 16px;
  border: 2px solid #ffe0ee;
}

.char-avatar {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  box-shadow: 0 6px 14px rgba(155, 122, 255, 0.35);
  animation: bounce 2.4s ease infinite;
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.char-card-body { flex: 1; min-width: 0; }
.char-card-body h2 { font-size: 1.1rem; color: var(--dark); margin-bottom: 2px; }
.char-anime {
  color: var(--pink);
  font-weight: 600;
  font-size: 0.82rem;
  margin-bottom: 6px;
}
.char-quote {
  font-style: italic;
  color: var(--purple);
  font-size: 0.82rem;
  margin-bottom: 6px;
  line-height: 1.5;
}
.char-desc {
  color: #6e6080;
  font-size: 0.86rem;
  line-height: 1.55;
}

.power-level {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(90deg, #fff6e5, #ffe8f1);
  border: 2px solid #ffe0a8;
  border-radius: 999px;
  padding: 8px 18px;
  margin-bottom: 18px;
  font-family: 'Baloo 2', cursive;
}
.power-label {
  font-size: 0.78rem;
  color: #b08900;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.power-value {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--dark);
}

.sw-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
  text-align: left;
}
.sw-box {
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 0.85rem;
  line-height: 1.5;
}
.sw-box p { color: #6e6080; }
.sw-strength { background: #eafff0; border: 2px solid #c9f3d4; }
.sw-weakness { background: #fff0ef; border: 2px solid #ffd9d5; }
.sw-label {
  display: block;
  font-weight: 700;
  font-size: 0.8rem;
  margin-bottom: 4px;
  color: var(--dark);
}

@media (max-width: 420px) {
  .sw-grid { grid-template-columns: 1fr; }
}


.traits {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 26px;
}
.trait-pill {
  background: #eef0ff;
  color: var(--purple);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}

.result-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.footer {
  text-align: center;
  padding: 16px 0 6px;
  color: #a79bc2;
  font-size: 0.78rem;
}

@media (max-width: 420px) {
  .card { padding: 28px 18px; }
  .hero-card h1 { font-size: 1.5rem; }
  .mbti-code { font-size: 2.4rem; }
}
