:root {
  --pink: #ff69b4;
  --pink-light: #ffb7c5;
  --pink-pale: #fff0f5;
  --pink-dark: #d4477a;
  --gold: #ffd700;
  --white: #ffffff;
  --text: #4a2040;
  --text-light: #7a4a6a;
  --shadow: rgba(180, 60, 100, 0.15);
  --font-display: 'Dela Gothic One', cursive;
  --font-body: 'M PLUS Rounded 1c', 'Zen Maru Gothic', sans-serif;
  --font-cute: 'Hachi Maru Pop', cursive;
}

html { font-size: 16px; }
body {
  font-family: var(--font-body);
  background: linear-gradient(160deg, #fff0f5 0%, #ffe0ec 40%, #ffd6e7 100%);
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
  position: relative;
}

/* ===== Back Link ===== */
.back-to-top-link {
  display: inline-block;
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(6px);
  color: var(--pink-dark);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 20px;
  border: 2px solid var(--pink-light);
  transition: all 0.2s;
}
.back-to-top-link:hover {
  background: var(--pink);
  color: var(--white);
}

/* ===== Sakura Petals Background ===== */
.sakura-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.petal {
  position: absolute;
  left: var(--x);
  top: -30px;
  font-size: 1.4rem;
  opacity: 0.5;
  animation: petalFall var(--dur) var(--delay) linear infinite;
}
@keyframes petalFall {
  0% { transform: translateY(-30px) rotate(0deg) translateX(0); opacity: 0.5; }
  50% { opacity: 0.7; }
  100% { transform: translateY(105vh) rotate(360deg) translateX(40px); opacity: 0; }
}

/* ===== Sparkle Floats ===== */
.sparkle-float {
  position: absolute;
  left: var(--x);
  top: var(--y);
  font-size: 1.2rem;
  animation: sparkle 3s var(--delay) ease-in-out infinite;
  pointer-events: none;
}
@keyframes sparkle {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* ===== Game Wrapper ===== */
#game-wrapper {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  padding: 60px 16px 30px;
  min-height: 100dvh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

/* ===== Screens ===== */
.screen {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 100%;
  animation: fadeIn 0.4s ease;
}
.screen.active { display: flex; }

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

/* ===== Title Screen ===== */
#title-screen { text-align: center; gap: 16px; }
.title-deco { position: relative; width: 100%; height: 0; }

#game-title {
  font-family: var(--font-display);
  font-size: 2.2rem;
  color: var(--pink-dark);
  text-shadow: 2px 2px 0 var(--pink-light), 0 0 20px rgba(255, 105, 180, 0.3);
  line-height: 1.4;
}

.subtitle {
  font-family: var(--font-cute);
  font-size: 1.1rem;
  color: var(--pink);
}

.studio-name {
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--text-light);
  letter-spacing: 0.3em;
}

.rule-box {
  background: var(--white);
  border: 3px solid var(--pink-light);
  border-radius: 16px;
  padding: 16px 20px;
  margin: 4px 0;
  box-shadow: 0 4px 15px var(--shadow);
}
.rule-title {
  font-weight: 800;
  font-size: 1rem;
  color: var(--pink-dark);
  margin-bottom: 6px;
}
.rule-box p {
  font-size: 0.9rem;
  line-height: 1.6;
}

/* ===== Buttons ===== */
#start-btn, #retry-btn {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--white);
  background: linear-gradient(135deg, var(--pink) 0%, var(--pink-dark) 100%);
  border: none;
  border-radius: 50px;
  padding: 16px 48px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(255, 105, 180, 0.4);
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}
#start-btn:hover, #retry-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(255, 105, 180, 0.5);
}
#start-btn:active, #retry-btn:active {
  transform: translateY(1px);
}

#next-btn {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--white);
  background: var(--pink);
  border: none;
  border-radius: 30px;
  padding: 12px 40px;
  cursor: pointer;
  margin-top: 10px;
  transition: all 0.2s;
}
#next-btn:hover { background: var(--pink-dark); transform: translateY(-2px); }

.disclaimer {
  font-size: 0.7rem;
  color: var(--text-light);
  line-height: 1.6;
  opacity: 0.7;
  margin-top: 8px;
}

/* ===== Quiz Screen ===== */
#quiz-screen { gap: 16px; }

.quiz-header {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

#round-indicator {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--pink-dark);
}

#score-display {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--gold);
  text-shadow: 1px 1px 0 rgba(0,0,0,0.1);
}

#timer-bar-container {
  width: 100%;
  height: 8px;
  background: var(--pink-pale);
  border-radius: 4px;
  overflow: hidden;
  order: 3;
}

#timer-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--pink), var(--pink-dark));
  border-radius: 4px;
  width: 100%;
  transition: width 0.1s linear;
}
#timer-bar.danger {
  background: linear-gradient(90deg, #ff4444, #cc0000);
  animation: pulse-bar 0.5s ease-in-out infinite;
}
@keyframes pulse-bar {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ===== Question Card ===== */
#question-card {
  background: var(--white);
  border-radius: 20px;
  padding: 24px 20px;
  width: 100%;
  text-align: center;
  box-shadow: 0 6px 25px var(--shadow);
  border: 3px solid var(--pink-light);
}
.question-label {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-bottom: 10px;
}
#question-text {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--pink-dark);
  line-height: 1.4;
}

/* ===== Choices ===== */
#choices-area {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.choice-btn {
  width: 100%;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  background: var(--white);
  border: 3px solid var(--pink-light);
  border-radius: 16px;
  padding: 16px 20px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 3px 10px var(--shadow);
  position: relative;
  overflow: hidden;
}
.choice-btn:hover:not(:disabled) {
  border-color: var(--pink);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px var(--shadow);
}
.choice-btn:active:not(:disabled) {
  transform: translateY(1px);
}
.choice-btn:disabled { cursor: default; }

/* Choice feedback states */
.choice-btn.elite-best {
  background: linear-gradient(135deg, #fff0f5, #ffe0ec);
  border-color: var(--gold);
  color: var(--pink-dark);
  animation: elitePop 0.5s ease;
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
}
.choice-btn.elite-good {
  background: linear-gradient(135deg, #f0f8ff, #e8f0fe);
  border-color: #7cb8ff;
  color: #3a6ea5;
  animation: elitePop 0.5s ease;
}
.choice-btn.correct-boring {
  background: #f5f5f5;
  border-color: #ccc;
  color: #999;
}
.choice-btn.not-selected {
  opacity: 0.4;
}

@keyframes elitePop {
  0% { transform: scale(1); }
  30% { transform: scale(1.05); }
  60% { transform: scale(0.98); }
  100% { transform: scale(1); }
}

/* ===== Reaction Screen ===== */
#reaction-screen {
  text-align: center;
  gap: 12px;
}

#reaction-emoji {
  font-size: 4rem;
  animation: bounceIn 0.6s ease;
}

#reaction-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--pink-dark);
}

#reaction-text {
  font-family: var(--font-cute);
  font-size: 1rem;
  color: var(--text-light);
  line-height: 1.6;
}

#stars-earned {
  font-size: 2rem;
  letter-spacing: 4px;
}

@keyframes bounceIn {
  0% { transform: scale(0) rotate(-20deg); opacity: 0; }
  50% { transform: scale(1.3) rotate(10deg); }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* ===== Result Screen ===== */
#result-screen {
  text-align: center;
  gap: 14px;
}

#result-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--pink-dark);
  text-shadow: 2px 2px 0 var(--pink-light);
}

#result-stars {
  font-size: 2.2rem;
  letter-spacing: 3px;
  animation: fadeIn 0.8s ease;
}

#result-score-text {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--pink);
}

#result-rank {
  font-family: var(--font-display);
  font-size: 1.6rem;
  background: linear-gradient(135deg, var(--pink), var(--pink-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

#result-comment {
  font-family: var(--font-cute);
  font-size: 0.95rem;
  color: var(--text-light);
  line-height: 1.7;
  max-width: 320px;
}

/* ===== Confetti burst (result) ===== */
.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  overflow: hidden;
}
.confetti-piece {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  animation: confettiFall var(--dur) var(--delay) ease-in forwards;
}
@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ===== Time Up overlay ===== */
.time-up-flash {
  position: fixed;
  inset: 0;
  background: rgba(255, 0, 0, 0.15);
  z-index: 50;
  pointer-events: none;
  animation: flashOnce 0.6s ease forwards;
}
@keyframes flashOnce {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* ===== Responsive ===== */
@media (max-width: 360px) {
  #game-title { font-size: 1.7rem; }
  #question-text { font-size: 1.6rem; }
  .choice-btn { font-size: 0.95rem; padding: 14px 16px; }
}
@media (min-width: 600px) {
  #game-title { font-size: 2.8rem; }
  #question-text { font-size: 2.4rem; }
}
@media (min-width: 700px) {
  #game-wrapper {
    max-width: 560px;
    padding-top: 78px;
  }

  #title-screen,
  #result-screen {
    gap: 20px;
  }

  #game-title {
    font-size: 3.1rem;
    line-height: 1.28;
  }

  .subtitle {
    font-size: 1.18rem;
  }

  .studio-name {
    font-size: 0.95rem;
  }

  .rule-box {
    max-width: 420px;
    padding: 20px 26px;
  }

  .rule-box p {
    font-size: 0.96rem;
  }

  #start-btn,
  #retry-btn {
    font-size: 1.42rem;
    padding: 18px 56px;
  }

  .disclaimer {
    max-width: 420px;
  }

  #question-card {
    padding: 28px 26px;
  }

  .choice-btn {
    font-size: 1.12rem;
    padding: 18px 22px;
  }

  #result-comment {
    max-width: 380px;
  }
}

@media (min-width: 1100px) {
  #game-wrapper {
    padding-top: 86px;
  }

  .rule-box {
    max-width: 440px;
  }
}
