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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0A0813;
  font-family: 'Fredoka', 'Baloo 2', sans-serif;
  color: #FFFFFF;
  user-select: none;
  -webkit-user-select: none;
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #0A0813;
}

.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  z-index: 1;
}

.screen.active {
  display: flex;
}

canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

button {
  cursor: pointer;
  border: none;
  outline: none;
  font-family: 'Fredoka', 'Baloo 2', sans-serif;
  transition: all 0.3s ease;
}

button:focus-visible {
  outline: 3px solid #FFC928;
  outline-offset: 2px;
}

img {
  pointer-events: none;
  -webkit-user-drag: none;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #12101C; }
::-webkit-scrollbar-thumb { background: #6F2DA8; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9B4DDA; }

#loading-screen {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #0A0813;
  z-index: 1000;
}

.loading-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 20px;
}

.loading-title {
  font-family: 'Luckiest Guy', 'Bungee', cursive;
  font-size: clamp(24px, 5vw, 52px);
  color: #F4A900;
  text-shadow: 3px 3px 0 #4C1D78, 6px 6px 0 rgba(0,0,0,0.5);
  margin-bottom: 10px;
  letter-spacing: 2px;
}

.loading-subtitle {
  font-size: clamp(14px, 2vw, 22px);
  color: #D8D1E4;
  margin-bottom: 30px;
}

.loading-bar-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin-bottom: 20px;
}

.loading-bar-bg {
  width: clamp(200px, 40vw, 500px);
  height: 24px;
  background: #1B1428;
  border-radius: 12px;
  border: 2px solid #6F2DA8;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.5), 0 0 15px rgba(111,45,168,0.3);
}

.loading-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #4C1D78, #9B4DDA, #F4A900);
  border-radius: 10px;
  transition: width 0.3s ease;
  box-shadow: 0 0 20px rgba(155,77,218,0.5);
}

.loading-percent {
  font-family: 'Luckiest Guy', cursive;
  font-size: clamp(20px, 3vw, 32px);
  color: #F4A900;
  text-shadow: 2px 2px 0 #4C1D78;
  min-width: 60px;
}

.loading-message {
  font-size: clamp(13px, 1.8vw, 18px);
  color: #9B4DDA;
  text-shadow: 0 0 10px rgba(155,77,218,0.5);
  animation: pulse-text 1.5s ease-in-out infinite;
}

@keyframes pulse-text {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

.result-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(10,8,19,0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.3s ease;
}

.result-panel {
  background: linear-gradient(145deg, #1B1428, #12101C);
  border: 2px solid #6F2DA8;
  border-radius: 20px;
  padding: 30px 40px;
  max-width: 500px;
  width: 90%;
  text-align: center;
  box-shadow: 0 0 40px rgba(111,45,168,0.4), inset 0 0 30px rgba(111,45,168,0.1);
  animation: scaleIn 0.4s ease;
}

.result-icon {
  font-size: 48px;
  margin-bottom: 10px;
}

.result-title {
  font-family: 'Luckiest Guy', cursive;
  font-size: clamp(28px, 4vw, 42px);
  margin-bottom: 10px;
}

.result-title.correct { color: #79C528; text-shadow: 0 0 20px rgba(121,197,40,0.5); }
.result-title.incorrect { color: #FF344D; text-shadow: 0 0 20px rgba(255,52,77,0.5); }

.result-message {
  font-size: clamp(14px, 1.8vw, 18px);
  color: #D8D1E4;
  margin-bottom: 15px;
}

.result-coins {
  font-size: clamp(18px, 2.5vw, 24px);
  color: #F4A900;
  margin-bottom: 10px;
  text-shadow: 0 0 10px rgba(244,169,0,0.5);
}

.result-explanation {
  background: rgba(75,67,88,0.3);
  border: 1px solid #4B4358;
  border-radius: 12px;
  padding: 15px;
  margin: 15px 0;
  font-size: clamp(13px, 1.5vw, 16px);
  color: #D8D1E4;
  line-height: 1.5;
  text-align: left;
}

.result-stats {
  margin: 10px 0;
  font-size: clamp(13px, 1.5vw, 16px);
  color: #D8D1E4;
}

.result-btn {
  font-family: 'Luckiest Guy', cursive;
  font-size: clamp(18px, 2.5vw, 24px);
  padding: 12px 40px;
  background: linear-gradient(145deg, #6F2DA8, #4C1D78);
  color: #FFFFFF;
  border: 2px solid #9B4DDA;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(111,45,168,0.4);
  margin-top: 15px;
  transition: all 0.3s ease;
}

.result-btn:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 25px rgba(111,45,168,0.6);
}
