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

body {
  font-family: 'Nunito', sans-serif;
  background: #0a0a12;
  color: #f0e6d3;
  overflow: hidden;
  min-height: 100vh;
  min-height: 100dvh;
}

#canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

#ui-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
  transition: background 0.3s ease;
}

#ui-overlay.input-focused {
  background: rgba(0, 0, 0, 0.3);
}

#ui-overlay > * {
  pointer-events: auto;
}

/* Score Display */
#score-display {
  position: absolute;
  top: 20px;
  left: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.crystal-shape {
  width: 60px;
  height: 70px;
  background: linear-gradient(135deg, #2a1a4a 0%, #1a0a2e 100%);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(157, 78, 221, 0.3);
  animation: crystalPulse 3s ease-in-out infinite;
}

@keyframes crystalPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(157, 78, 221, 0.3); }
  50% { box-shadow: 0 0 30px rgba(157, 78, 221, 0.5); }
}

#score-value {
  font-family: 'Cinzel', serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: #ffd700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.score-label, .streak-label {
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  color: #b8a9c9;
  margin-top: 5px;
}

/* Streak Display */
#streak-display {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.flame-container {
  width: 50px;
  height: 60px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

#streak-flame {
  position: absolute;
  width: 30px;
  height: 40px;
  background: linear-gradient(to top, #9d4edd, #00d4aa);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  filter: blur(2px);
  animation: flameFlicker 0.3s ease-in-out infinite alternate;
}

@keyframes flameFlicker {
  0% { transform: scaleY(1) scaleX(1); opacity: 0.8; }
  100% { transform: scaleY(1.1) scaleX(0.95); opacity: 1; }
}

#streak-value {
  position: relative;
  z-index: 1;
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 0 10px rgba(0, 212, 170, 0.8);
}

/* Hint Text */
#hint-text {
  position: absolute;
  top: 15%;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Cinzel', serif;
  font-style: italic;
  font-size: 1rem;
  color: #b8a9c9;
  text-align: center;
  max-width: 80%;
  opacity: 0;
  transition: opacity 0.5s ease;
  text-shadow: 0 0 20px rgba(184, 169, 201, 0.5);
}

#hint-text.visible {
  opacity: 1;
}

/* Letter Slots */
#letter-slots {
  position: absolute;
  top: 60%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
}

.letter-slot {
  font-family: 'Cinzel', serif;
  font-size: 1.5rem;
  color: #7a8599;
  padding: 5px 10px;
  border-bottom: 2px solid #4a3f5c;
  min-width: 30px;
  text-align: center;
  transition: all 0.3s ease;
}

.letter-slot.revealed {
  color: #ffd700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
  border-bottom-color: #ffd700;
}

/* Hints Container */
#hints-container {
  position: absolute;
  bottom: 180px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 20px;
}

.hint-charm {
  position: relative;
  width: 60px;
  height: 70px;
  background: linear-gradient(135deg, #2a1a4a 0%, #1a0a2e 100%);
  border: 1px solid #4a3f5c;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  animation: charmBob 3s ease-in-out infinite;
}

.hint-charm:nth-child(2) { animation-delay: 0.5s; }
.hint-charm:nth-child(3) { animation-delay: 1s; }

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

.hint-charm:hover:not(.used) {
  border-color: #00d4aa;
  box-shadow: 0 0 20px rgba(0, 212, 170, 0.3);
}

.hint-charm.used {
  opacity: 0.3;
  cursor: not-allowed;
  animation: none;
}

.charm-glow {
  position: absolute;
  inset: -5px;
  background: radial-gradient(circle, rgba(0, 212, 170, 0.2) 0%, transparent 70%);
  border-radius: 15px;
  animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.7; }
}

.charm-rune {
  font-size: 1.5rem;
  color: #00d4aa;
  text-shadow: 0 0 10px rgba(0, 212, 170, 0.5);
}

.charm-label {
  font-size: 0.55rem;
  letter-spacing: 0.1em;
  color: #7a8599;
  margin-top: 5px;
}

/* Input Container */
#input-container {
  position: absolute;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
}

#guess-input {
  width: 280px;
  max-width: 70vw;
  padding: 15px 25px;
  background: rgba(26, 26, 46, 0.9);
  border: 2px solid transparent;
  border-radius: 30px;
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-style: italic;
  color: #f0e6d3;
  outline: none;
  transition: all 0.3s ease;
  background-image: linear-gradient(rgba(26, 26, 46, 0.9), rgba(26, 26, 46, 0.9)),
                    linear-gradient(90deg, #9d4edd, #00d4aa, #ffd700, #9d4edd);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  animation: borderShift 4s linear infinite;
}

@keyframes borderShift {
  0% { background-position: 0% 50%, 0% 50%; }
  100% { background-position: 0% 50%, 200% 50%; }
}

#guess-input::placeholder {
  color: #7a8599;
  font-style: italic;
}

#guess-input:focus {
  box-shadow: 0 0 30px rgba(157, 78, 221, 0.4);
}

#input-container.warm #guess-input {
  box-shadow: 0 0 30px rgba(255, 158, 100, 0.5);
}

#input-container.cool #guess-input {
  box-shadow: 0 0 30px rgba(0, 212, 170, 0.5);
}

#submit-btn {
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, #2a1a4a 0%, #1a0a2e 100%);
  border: 2px solid #9d4edd;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  animation: breathe 3s ease-in-out infinite;
}

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

#submit-btn:hover {
  background: linear-gradient(135deg, #3a2a5a 0%, #2a1a3e 100%);
  box-shadow: 0 0 20px rgba(157, 78, 221, 0.5);
}

#submit-btn:active {
  transform: scale(0.95);
}

.sigil {
  font-size: 1.5rem;
  color: #ffd700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

/* Feedback Text */
#feedback-text {
  position: absolute;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  color: #b8a9c9;
  text-shadow: 0 0 10px rgba(184, 169, 201, 0.3);
}

/* Next Button */
#next-btn {
  position: absolute;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  padding: 15px 40px;
  background: linear-gradient(135deg, #3a2a5a 0%, #2a1a3e 100%);
  border: 2px solid #4a3f5c;
  border-radius: 10px;
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  color: #ffd700;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  animation: stonePulse 2s ease-in-out infinite;
}

@keyframes stonePulse {
  0%, 100% { box-shadow: 0 0 20px rgba(255, 215, 0, 0.2); }
  50% { box-shadow: 0 0 40px rgba(255, 215, 0, 0.4); }
}

#next-btn.visible {
  opacity: 1;
  visibility: visible;
}

#next-btn:hover {
  border-color: #ffd700;
  transform: translateX(-50%) scale(1.02);
}

#next-btn:active {
  transform: translateX(-50%) scale(0.98);
}

/* Reveal Container */
#reveal-container {
  position: absolute;
  top: 35%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.5s ease;
}

#reveal-container.visible {
  opacity: 1;
  visibility: visible;
}

#magic-circle {
  position: absolute;
  width: 300px;
  height: 300px;
  border: 2px solid rgba(157, 78, 221, 0.3);
  border-radius: 50%;
  animation: rotateCircle 10s linear infinite;
}

#magic-circle::before {
  content: '';
  position: absolute;
  inset: 20px;
  border: 1px solid rgba(0, 212, 170, 0.2);
  border-radius: 50%;
}

@keyframes rotateCircle {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

#revealed-word {
  font-family: 'Cinzel', serif;
  font-size: 3rem;
  font-weight: 700;
  color: #ffd700;
  text-shadow: 0 0 30px rgba(255, 215, 0, 0.8),
               0 0 60px rgba(255, 215, 0, 0.4);
  animation: wordReveal 1s ease-out;
}

@keyframes wordReveal {
  from {
    opacity: 0;
    transform: scale(0.5);
    filter: blur(10px);
  }
  to {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
  }
}

#result-banner {
  font-family: 'Cinzel', serif;
  font-size: 1.2rem;
  color: #00d4aa;
  margin-top: 20px;
  text-shadow: 0 0 15px rgba(0, 212, 170, 0.5);
  animation: bannerFade 0.5s ease-out 0.5s both;
}

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

/* Footer */
#footer {
  position: fixed;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
}

#footer a {
  font-size: 0.75rem;
  color: #7a8599;
  text-decoration: none;
  transition: all 0.3s ease;
}

#footer a:hover {
  color: #b8a9c9;
  text-shadow: 0 0 10px rgba(184, 169, 201, 0.5);
}

/* Responsive */
@media (max-width: 600px) {
  #score-display, #streak-display {
    top: 10px;
  }
  
  #score-display { left: 10px; }
  #streak-display { right: 10px; }
  
  .crystal-shape {
    width: 50px;
    height: 58px;
  }
  
  #score-value, #streak-value {
    font-size: 1rem;
  }
  
  #hints-container {
    bottom: 160px;
    gap: 12px;
  }
  
  .hint-charm {
    width: 50px;
    height: 60px;
  }
  
  .charm-rune {
    font-size: 1.2rem;
  }
  
  .charm-label {
    font-size: 0.5rem;
  }
  
  #input-container {
    bottom: 80px;
  }
  
  #guess-input {
    width: 220px;
    padding: 12px 20px;
    font-size: 0.9rem;
  }
  
  #submit-btn {
    width: 44px;
    height: 44px;
  }
  
  #revealed-word {
    font-size: 2rem;
  }
  
  #result-banner {
    font-size: 1rem;
  }
  
  #next-btn {
    bottom: 80px;
    padding: 12px 30px;
    font-size: 1rem;
  }
  
  .letter-slot {
    font-size: 1.2rem;
    padding: 4px 8px;
    min-width: 24px;
  }
}