:root {
  --deep: #0d0221;
  --purple: #1a0a3e;
  --violet: #7c3aed;
  --pink: #e879f9;
  --gold: #fbbf24;
  --white: #f0e6ff;
  --font-title: 'Hachi Maru Pop', cursive;
  --font-body: 'Zen Maru Gothic', sans-serif;
}

html, body {
  width: 100%;
  min-height: 100dvh;
  overflow-x: hidden;
  font-family: var(--font-body);
  background: var(--deep);
  color: var(--white);
}

/* ===== BACK LINK ===== */
.back-to-top-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1000;
  color: var(--gold);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 700;
  background: rgba(13, 2, 33, 0.85);
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid rgba(251, 191, 36, 0.3);
  backdrop-filter: blur(6px);
  transition: all 0.3s;
}
.back-to-top-link:hover {
  background: rgba(251, 191, 36, 0.15);
  border-color: var(--gold);
}

/* ===== BACKGROUND STARS ===== */
.bg-stars {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.star {
  position: absolute;
  left: var(--x);
  top: var(--y);
  font-size: 1.2rem;
  opacity: 0.3;
  animation: twinkle var(--dur) var(--delay) infinite ease-in-out;
}
@keyframes twinkle {
  0%, 100% { opacity: 0.1; transform: scale(0.8); }
  50% { opacity: 0.6; transform: scale(1.2); }
}

/* ===== SCREENS ===== */
.screen {
  display: none;
  min-height: 100dvh;
  position: relative;
  z-index: 1;
}
.screen.active {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* ===== TITLE SCREEN ===== */
.title-container {
  text-align: center;
  width: min(100%, 520px);
  margin-inline: auto;
  padding: 2rem;
  border-radius: 32px;
  background:
    radial-gradient(circle at top, rgba(124, 58, 237, 0.18), transparent 48%),
    rgba(18, 8, 39, 0.48);
  border: 1px solid rgba(251, 191, 36, 0.14);
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(12px);
  animation: fadeInUp 0.8s ease-out;
}
.title-icon {
  font-size: 80px;
  animation: float 3s infinite ease-in-out;
  filter: drop-shadow(0 0 30px rgba(124, 58, 237, 0.6));
}
.title-text {
  font-family: var(--font-title);
  font-size: clamp(1.8rem, 6vw, 3rem);
  color: var(--gold);
  text-shadow: 0 0 20px rgba(251, 191, 36, 0.4);
  margin-top: 0.5rem;
}
.title-sub {
  font-family: var(--font-title);
  font-size: clamp(0.9rem, 3vw, 1.2rem);
  color: var(--pink);
  margin-top: 0.3rem;
  opacity: 0.8;
}
.title-desc {
  font-size: 0.95rem;
  color: rgba(240, 230, 255, 0.7);
  margin-top: 1.5rem;
  line-height: 1.8;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

/* ===== BUTTONS ===== */
.btn-main {
  display: inline-block;
  margin-top: 2rem;
  padding: 16px 48px;
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--deep);
  background: linear-gradient(135deg, var(--gold), #f59e0b);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 20px rgba(251, 191, 36, 0.4);
}
.btn-main:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 30px rgba(251, 191, 36, 0.6);
}
.btn-main:active {
  transform: translateY(0);
}

/* ===== QUESTION SCREEN ===== */
.question-container {
  width: 90%;
  max-width: 500px;
  text-align: center;
  padding: 2rem 1rem;
}

/* Progress bar */
.progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 1rem;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--violet), var(--pink));
  border-radius: 3px;
  transition: width 0.5s ease;
  width: 0%;
}

.question-number {
  font-size: 0.85rem;
  color: var(--pink);
  font-weight: 700;
  letter-spacing: 0.1em;
}

/* Crystal ball */
.crystal-ball {
  font-size: 60px;
  margin: 1rem 0;
  filter: drop-shadow(0 0 20px rgba(124, 58, 237, 0.5));
}
.crystal-ball.pulse {
  animation: crystalPulse 0.6s ease-out;
}
@keyframes crystalPulse {
  0% { transform: scale(1); }
  30% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.question-text {
  font-size: clamp(1rem, 3.5vw, 1.2rem);
  font-weight: 700;
  line-height: 1.7;
  margin-bottom: 1.5rem;
  min-height: 3em;
}

/* Choices */
.choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.choice-btn {
  width: 100%;
  padding: 14px 20px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--white);
  background: rgba(124, 58, 237, 0.15);
  border: 2px solid rgba(124, 58, 237, 0.4);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.3s;
  animation: fadeInUp 0.5s ease-out both;
}
.choice-btn:hover:not(:disabled) {
  background: rgba(124, 58, 237, 0.35);
  border-color: var(--violet);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}
.choice-btn:active:not(:disabled) {
  transform: translateY(0);
}
.choice-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

/* ===== RESULT SCREEN ===== */
.result-container {
  width: 90%;
  max-width: 500px;
  text-align: center;
  padding: 2rem 1rem;
  animation: fadeInUp 0.8s ease-out;
}
.result-label {
  font-size: 0.9rem;
  color: var(--pink);
  font-weight: 700;
  letter-spacing: 0.15em;
  animation: fadeInUp 0.6s ease-out;
}
.result-icon {
  font-size: 80px;
  margin: 1rem 0;
  animation: resultBounce 0.8s 0.3s ease-out both;
  filter: drop-shadow(0 0 25px rgba(232, 121, 249, 0.5));
}
@keyframes resultBounce {
  0% { transform: scale(0) rotate(-20deg); opacity: 0; }
  60% { transform: scale(1.3) rotate(5deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
.result-title {
  font-family: var(--font-title);
  font-size: clamp(1.3rem, 5vw, 1.8rem);
  color: var(--gold);
  text-shadow: 0 0 15px rgba(251, 191, 36, 0.4);
  animation: fadeInUp 0.6s 0.5s ease-out both;
}
.result-desc {
  font-size: 0.9rem;
  line-height: 1.9;
  color: rgba(240, 230, 255, 0.85);
  margin-top: 1rem;
  text-align: left;
  animation: fadeInUp 0.6s 0.7s ease-out both;
}

/* Stats */
.result-stats {
  margin-top: 1.5rem;
  animation: fadeInUp 0.6s 0.9s ease-out both;
}
.stat-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.stat-label {
  font-size: 0.8rem;
  font-weight: 700;
  min-width: 5.5em;
  text-align: right;
  color: var(--pink);
}
.stat-bar-bg {
  flex: 1;
  height: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  overflow: hidden;
}
.stat-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--violet), var(--pink), var(--gold));
  border-radius: 5px;
  transition: width 1s 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.stat-value {
  font-size: 0.8rem;
  font-weight: 700;
  min-width: 3em;
  text-align: left;
  color: var(--gold);
}

/* Action buttons */
.result-actions {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  animation: fadeInUp 0.6s 1.1s ease-out both;
}
.btn-share {
  display: inline-block;
  padding: 14px 36px;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: #000;
  border: 2px solid #555;
  border-radius: 50px;
  text-decoration: none;
  transition: all 0.3s;
}
.btn-share:hover {
  background: #1a1a1a;
  border-color: #888;
  transform: translateY(-2px);
}
.btn-retry {
  padding: 12px 32px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--white);
  background: transparent;
  border: 2px solid rgba(124, 58, 237, 0.5);
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s;
}
.btn-retry:hover {
  background: rgba(124, 58, 237, 0.2);
  border-color: var(--violet);
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (min-width: 700px) {
  #title-screen.active,
  #question-screen.active,
  #result-screen.active {
    justify-content: flex-start;
    padding-top: clamp(92px, 11vh, 132px);
  }

  .title-container {
    width: min(100%, 680px);
    padding: 2.5rem;
  }

  .title-icon,
  .result-icon {
    font-size: 92px;
  }

  .title-text {
    font-size: clamp(2.4rem, 5.6vw, 3.4rem);
  }

  .title-sub {
    font-size: 1.25rem;
    margin-top: 0.5rem;
  }

  .title-desc {
    max-width: 30ch;
    margin-left: auto;
    margin-right: auto;
    font-size: 1rem;
  }

  .btn-main {
    padding: 18px 56px;
    font-size: 1.18rem;
  }

  .question-container,
  .result-container {
    width: min(100%, 640px);
    max-width: 640px;
    padding: 2.5rem 1.5rem;
  }

  .question-text {
    font-size: clamp(1.15rem, 2.5vw, 1.35rem);
    min-height: 2.6em;
  }

  .choices {
    gap: 12px;
  }

  .choice-btn {
    padding: 16px 24px;
    font-size: 1rem;
  }

  .result-desc {
    max-width: 52ch;
    margin-left: auto;
    margin-right: auto;
  }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
  #title-screen.active,
  #question-screen.active,
  #result-screen.active {
    justify-content: flex-start;
    padding: 78px 16px 28px;
  }

  .title-container,
  .question-container,
  .result-container {
    width: min(100%, 352px);
    margin-inline: auto;
    padding: 24px 18px;
    border-radius: 28px;
    background: rgba(27, 12, 55, 0.52);
    border: 1px solid rgba(251, 191, 36, 0.14);
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(12px);
  }

  .title-icon { font-size: 60px; }
  .crystal-ball { font-size: 48px; }
  .result-icon { font-size: 64px; }

  .title-text {
    font-size: clamp(1.72rem, 7.4vw, 2.28rem);
    line-height: 1.3;
  }

  .title-sub {
    font-size: 0.92rem;
  }

  .title-desc {
    margin-top: 1.15rem;
    font-size: 0.9rem;
    line-height: 1.7;
  }

  .btn-main {
    width: 100%;
    margin-top: 1.5rem;
    padding: 15px 22px;
    font-size: 1rem;
  }

  .choice-btn { padding: 12px 16px; font-size: 0.9rem; }
}
