/*
  HEX CODES:
  - Darker green: B8C480
  - Lighter green: D4E79E
  - Lighter magenta: 922D50
  - Darker magenta: 501537
  - Dark purple: 3C1B43
*/

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #3c1b43;
  color: #d4e79e;
  font-family: "VT323", monospace;
  font-size: 1.4rem;
}

.bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -1;
}

/* Screen Stuff */
.screen {
  display: none;
  min-height: 100vh;
  padding: 2rem;
}

.screen.active {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Title Screen */
.title-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.logo {
  width: 100%;
  max-width: 420px;
  height: auto;
}

#start-btn {
  padding: 0.75rem 2rem;
  font-size: 1.4rem;
  cursor: pointer;
  color: #501537;
  background: #b8c480;
  border: 0;
  border-radius: 8px;
  font-family: "VT323", monospace;
}

/* Speech Bubble */
.speech-bubble {
  position: relative;
  padding: 28px 34px;
  max-width: 460px;
  margin-bottom: 30px;
  background: #b8c480;
  border-radius: 44px;
  color: #3c1b43;
  font-family: "VT323", monospace;
  font-size: 22px;
  line-height: 1.45;
  box-shadow: 0 10px 0 rgba(80, 21, 55, 0.25), 0 0 30px rgba(212, 231, 158, 0.6);
  animation: bubble-float 3s ease-in-out infinite;
}

.speech-bubble::after {
  content: "";
  position: absolute;
  width: 25px;
  height: 75px;
  background: #b8c480;
  bottom: -40px;
  left: 60%;
  transform: translateX(-50%) rotate(20deg) skewX(-20deg);
  border-radius: 0 0 80% 20% / 0 0 100% 40%;
}

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

.oracle-small {
  width: min(220px, 38vw);
  height: auto;
  position: relative;
  z-index: 2;
}

.oracle-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  animation: oracle-float 5s ease-in-out infinite;
}

.oracle-wrapper::before {
  content: "";
  position: absolute;
  inset: -28px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(212, 231, 158, 0.45),
    rgba(212, 231, 158, 0.2),
    transparent 70%
  );
  filter: blur(18px);
  z-index: 0;
  animation: oracle-glow 4s ease-in-out infinite;
}

.oracle {
  position: relative;
  z-index: 2;
  display: block;
}

.oracle-large {
  width: min(360px, 80vw);
  height: auto;
  cursor: pointer;
  transition: transform 0.25s ease, filter 0.25s ease;
}

.oracle-large:hover {
  transform: scale(1.06);
  filter: drop-shadow(0 0 12px rgba(212, 231, 158, 0.8));
}

.oracle-large:active {
  transform: scale(0.98);
}

/* Magic Ball Button */
.magic-ball {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 2px solid #501537;
  background: transparent;
  font-size: 4rem;
  color: #922d50;
  cursor: pointer;
}

/* Intro Layout */
.intro-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Quiz Layout */
.quiz-layout {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  width: 100%;
  max-width: 1200px;
  transition: opacity 0.3s ease;
}

.quiz-layout.fading {
  opacity: 0;
}

.oracle-column {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.answers {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

/* Small gap to push answers down under the oracle image */
#quiz-screen .oracle-wrapper + .answers {
  margin-top: 20px;
}

.answer-btn {
  position: relative;
  width: 100%;
  max-width: 620px;
  padding: 22px 24px;
  background: linear-gradient(
    180deg,
    rgba(184, 196, 128, 0.12),
    rgba(60, 27, 67, 0.85)
  );
  border: 2px solid rgba(212, 231, 158, 0.35);
  border-radius: 14px;
  color: #d4e79e;
  font-family: "VT323", monospace;
  font-size: 22px;
  text-align: center;
  cursor: pointer;
  overflow: hidden;
  backdrop-filter: blur(6px);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  animation: oracle-breathe 4s ease-in-out infinite;
}

#restart-btn {
  padding: 0.75rem 2rem;
  font-size: 1.4rem;
  cursor: pointer;
  color: #501537;
  background: #b8c480;
  border: 0;
  border-radius: 8px;
  font-family: "VT323", monospace;
}

/* Result Layout */
.result-layout {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  width: min(100%, 1200px);
  max-width: 1200px;
  margin: 0 auto;
}

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

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
}

.media-slot {
  aspect-ratio: 2 / 3;
  width: 100%;
  max-width: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 220ms cubic-bezier(0.2, 0.9, 0.2, 1), box-shadow 220ms ease;
  will-change: transform, box-shadow;
  border-radius: 10px;
}

.media-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
}

.media-slot:hover {
  transform: scale(1.06);
  box-shadow: 0 8px 24px rgba(184, 196, 128, 0.35), 0 0 32px rgba(184, 196, 128, 0.22);
  z-index: 5;
}

.media-slot:hover img {
  transform: scale(1.02);
}

/* Interactive button hover effects */
#start-btn,
#restart-btn,
.answer-btn,
.magic-ball {
  transition: transform 180ms cubic-bezier(0.2, 0.9, 0.2, 1), box-shadow 180ms ease, border-color 180ms ease;
  will-change: transform, box-shadow;
}

#start-btn:hover,
#restart-btn:hover,
.answer-btn:hover,
.magic-ball:hover {
  transform: scale(1.08);
  box-shadow: 0 10px 30px rgba(184, 196, 128, 0.36), 0 0 40px rgba(184, 196, 128, 0.18);
  border-color: rgba(212, 231, 158, 0.6);
  z-index: 6;
}

/* Image transitions on hover */
.answer-btn:hover img,
.media-slot:hover img {
  transition: transform 220ms ease;
}

/* Animations */
@keyframes oracle-breathe {
  0%,
  100% {
    box-shadow: 0 0 12px rgba(146, 45, 80, 0.35);
  }
  50% {
    box-shadow: 0 0 20px rgba(212, 231, 158, 0.55);
  }
}

/* Small vertical padding so the oracle has breathing room */
#quiz-screen .oracle-wrapper {
  padding-top: 1.25rem;
  padding-bottom: 1.25rem;
}

/* Add explicit bottom spacing under the oracle image */
#quiz-screen .oracle-small {
  padding-bottom: 20px;
}

/* Desktop Layout */
@media (min-width: 900px) {
  .quiz-layout {
    flex-direction: row;
    align-items: center;
  }

  .answers {
    grid-template-columns: repeat(3, 1fr);
  }

  .result-layout {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .result-text {
    text-align: left;
    max-width: 500px;
  }

  /* Ensure on wide screens the quiz content stacks vertically so
     the oracle image sits under the speech-bubble (desktop layout) */
  #quiz-screen .quiz-layout {
    flex-direction: column;
    align-items: center;
    gap: 2.5rem;
  }

  /* Keep the speech bubble visually above the oracle */
  #quiz-screen .speech-bubble {
    z-index: 3;
    margin-bottom: 0.75rem;
    max-width: 680px;
  }

  /* Make sure the oracle wrapper centers and constrains image size */
  #quiz-screen .oracle-wrapper {
    order: 2;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 0;
    flex-direction: column;
    gap: 1rem;
    padding-top: 2rem;
    padding-bottom: 2rem;
  }

  /* Target the nested wrapper that actually contains the image */
  #quiz-screen .oracle-wrapper > .oracle-wrapper {
    order: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
  }

  #quiz-screen .oracle-wrapper .answers {
    order: 2;
    width: 100%;
    margin-top: 0.5rem;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
  }

  #quiz-screen .oracle-small {
    width: min(320px, 34vw);
    max-width: 420px;
  }

  /* Place the answer grid under the oracle on desktop */
  #quiz-screen .answers {
    order: 3;
    width: 100%;
    max-width: 920px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    align-self: center;
  }

  /* Result screen: make oracle a bit larger and move it closer to the title */
  #result-screen .oracle-small {
    width: min(480px, 40vw);
    max-width: 560px;
    padding-bottom: 20px;
  }

  /* Pull the oracle up slightly so it sits nearer the speech bubble/title */
  #result-screen .oracle-wrapper {
    margin-top: 0.5rem;
    transform: translateY(-8px);
  }

  /* Ensure oracle column centers nicely with the result text */
  #result-screen .oracle-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }
}

