/* === MAGICAL FONTS === */
@font-face {
  font-family: 'HarryPotter';
  src: url('assets/fonts/HarryPotter.ttf') format('truetype');
}

/* === ENCHANTED BACKGROUND === */
body {
  font-family: 'HarryPotter', 'Times New Roman', serif;
  background: 
    radial-gradient(circle, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.9) 100%),
    url('assets/images/hogwarts-castle.jpg') no-repeat center center fixed;
  background-size: cover;
  color: #f0e6d2;
  text-align: center;
  min-height: 100vh;
  margin: 0;
  padding: 20px;
  position: relative;
  overflow-x: hidden;
}

/* === FLOATING CANDLES EFFECT === */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url('assets/images/candles.png');
  opacity: 0.3;
  pointer-events: none;
  z-index: -1;
  animation: float 8s ease-in-out infinite;
}

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

/* === MAGICAL CONTAINER === */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 30px;
  background: rgba(20, 20, 20, 0.85);
  border: 2px solid #f0e6d2;
  border-radius: 15px;
  box-shadow: 0 0 30px rgba(210, 180, 140, 0.6),
              inset 0 0 20px rgba(210, 180, 140, 0.4);
  position: relative;
  overflow: hidden;
}

.container::before {
  content: "";
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -10px;
  background: linear-gradient(45deg, 
    #740001 0%, #ae0001 20%, 
    #eeba30 40%, #d3a625 60%, 
    #000000 80%, #000000 100%);
  z-index: -1;
  filter: blur(20px);
  opacity: 0.7;
}

/* === ENCHANTED TYPOGRAPHY === */
h1 {
  font-size: 3.5rem;
  color: #f0e6d2;
  text-shadow: 0 0 10px #eeba30, 
               0 0 20px #ae0001,
               0 0 30px #000000;
  margin-bottom: 30px;
  letter-spacing: 2px;
  position: relative;
  animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
  from { text-shadow: 0 0 10px #eeba30, 0 0 20px #ae0001; }
  to { text-shadow: 0 0 15px #eeba30, 0 0 25px #ae0001, 0 0 35px #000000; }
}

/* === MAGICAL QUESTION CARDS === */
.question {
  background: rgba(0, 0, 0, 0.7);
  padding: 25px;
  margin: 25px 0;
  border-radius: 10px;
  border: 1px solid #f0e6d2;
  box-shadow: 0 0 15px rgba(210, 180, 140, 0.5);
  position: relative;
  transition: all 0.5s ease;
  animation: fadeIn 0.8s ease-out;
}

.question h3 {
  font-size: 1.8rem;
  margin-bottom: 20px;
  color: #f0e6d2;
  text-shadow: 0 0 5px #000000;
}

.question::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    #eeba30 20%, 
    #ae0001 50%, 
    #eeba30 80%, 
    transparent 100%);
}

/* === ENCHANTED BUTTONS === */
button {
  background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
  color: #f0e6d2;
  border: none;
  padding: 12px 25px;
  margin: 8px;
  border-radius: 50px;
  cursor: pointer;
  font-size: 1.1rem;
  font-family: 'HarryPotter', sans-serif;
  letter-spacing: 1px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3),
              inset 0 2px 4px rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
  min-width: 180px;
}

button::before {
  content: "";
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg, 
    #740001, #eeba30, #000000, #eeba30, #740001);
  background-size: 400%;
  z-index: -1;
  border-radius: 50px;
  opacity: 0;
  transition: 0.5s;
}

button:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

button:hover::before {
  opacity: 1;
  animation: buttonGlow 3s linear infinite;
}

@keyframes buttonGlow {
  0% { background-position: 0 0; }
  50% { background-position: 400% 0; }
  100% { background-position: 0 0; }
}

/* === HOUSE THEMES === */
.gryffindor-theme {
  background: linear-gradient(135deg, rgba(174, 0, 1, 0.2), rgba(0, 0, 0, 0.8));
  border-color: #eeba30;
}

.slytherin-theme {
  background: linear-gradient(135deg, rgba(42, 98, 61, 0.2), rgba(0, 0, 0, 0.8));
  border-color: #aaaaaa;
}

.ravenclaw-theme {
  background: linear-gradient(135deg, rgba(34, 47, 91, 0.2), rgba(0, 0, 0, 0.8));
  border-color: #946b2d;
}

.hufflepuff-theme {
  background: linear-gradient(135deg, rgba(255, 219, 0, 0.1), rgba(0, 0, 0, 0.8));
  border-color: #000000;
}

/* === MAGICAL RESULT DISPLAY === */
#result {
  padding: 30px;
  border-radius: 15px;
  animation: fadeIn 1.5s ease-out;
  position: relative;
  /* REMOVED: display: none; */ 
}

#result.hidden { 
  display: none; 
}

#result h2 {
  font-size: 2.5rem;
  margin-bottom: 20px;
  text-shadow: 0 0 10px currentColor;
}

#result p {
  font-size: 1.8rem;
  margin: 20px 0;
}

#house-crest {
  width: 200px;
  height: 200px;
  object-fit: contain;
  margin: 20px auto;
  filter: drop-shadow(0 0 15px currentColor);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* === RESTART BUTTON === */
#restart-btn {
  background: linear-gradient(145deg, #3a3a3a, #2a2a2a);
  font-size: 1.2rem;
  padding: 15px 30px;
  margin-top: 20px;
}

#restart-btn:hover {
  background: linear-gradient(145deg, #4a4a4a, #3a3a3a);
}

/* === MAGICAL SCROLLBAR === */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.3);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(#740001, #eeba30);
  border-radius: 10px;
}

/* === SPARKLE EFFECT === */
.sparkle {
  position: absolute;
  width: 5px;
  height: 5px;
  background: #fff;
  border-radius: 50%;
  pointer-events: none;
  animation: sparkle 1s ease-out forwards;
}

@keyframes sparkle {
  0% {
    transform: translate(0, 0);
    opacity: 1;
  }
  100% {
    transform: translate(var(--tx), var(--ty));
    opacity: 0;
  }
}


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

#progress {
  margin: 20px 0;
  color: #f0e6d2;
  font-size: 1.2rem;
}

#musicToggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(210, 180, 140, 0.7);
  border: none;
  color: #000;
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

#musicToggle.muted {
  opacity: 0.5;
}

/* Hide result elements during quiz */
/* These rules are good as they ensure these elements are hidden unless part of #result which is visible */
#house-result, #patronus-result, #house-crest {
  display: none;
}

/* Only show them in results */
#result #house-result,
#result #patronus-result,
#result #house-crest {
  display: inline; /* or block, depending on element */
}

footer {
  margin-top: 20px;
  padding: 10px;
  color: #f0e6d2;
  font-size: 0.9rem;
  opacity: 0.6; /* Light opacity */
  text-shadow: 0 0 5px rgba(0,0,0,0.5);
}