@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@300;400;600;700&display=swap');

* {
  box-sizing: border-box;
}

body { 
  font-family: 'Fredoka', sans-serif;
  background: linear-gradient(135deg, #228B22 0%, #FFD700 25%, #DC143C 50%, #000000 75%, #FFFFFF 100%);
  background-attachment: fixed;  
  color: #2d1b69;
  margin: 0;
  padding: 0;
  font-weight: 400;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Animated background particles*/ 
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(circle at 20% 80%, rgba(255, 255, 255, 0.1) 1px, transparent 1px),
    radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.15) 1px, transparent 1px),
    radial-gradient(circle at 40% 40%, rgba(255, 255, 255, 0.1) 2px, transparent 2px);
  background-size: 200px 200px, 300px 300px, 150px 150px;
  animation: float 20s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

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

#app { 
  max-width: 450px;
  margin: 2em auto;
  padding: 2.5em;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 2em;
  box-shadow: 
    0 20px 40px rgba(0, 0, 0, 0.1),
    0 8px 32px rgba(118, 75, 162, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  position: relative;
  z-index: 1;
}

#app::before {
  content: '🦓';
  position: absolute;
  top: -15px;
  right: -15px;
  font-size: 2em;
  background: linear-gradient(45deg, #228B22, #FFD700);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(34, 139, 34, 0.3);
  animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-10px); }
  60% { transform: translateY(-5px); }
}

h1 {
  text-align: center;
  color: #2d1b69;
  font-size: 2.5em;
  font-weight: 700;
  margin-bottom: 0.5em;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

#game { 
  margin-top: 2em;
}

#wordDisplay { 
  font-size: 2.2em;
  font-weight: 600;
  margin: 1.5em 0;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  text-align: center;
  padding: 1em;
  border-radius: 1.5em;
  background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
  border: 3px solid rgba(255, 255, 255, 0.5);
  box-shadow: 
    0 10px 30px rgba(252, 182, 159, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  color: #8b4513;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

#timer { 
  font-size: 1.8em;
  font-weight: 600;
  margin: 1em 0;
  text-align: center;
  color: #e91e63;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  background: linear-gradient(90deg, #ff9a9e 0%, #fecfef 100%);
  padding: 0.8em;
  border-radius: 1em;
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 15px rgba(233, 30, 99, 0.2);
}

#score { 
  font-size: 1.4em;
  font-weight: 600;
  margin: 1em 0;
  text-align: center;
  color: #2d1b69;
  background: linear-gradient(90deg, #a8edea 0%, #fed6e3 100%);
  padding: 0.8em;
  border-radius: 1em;
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 15px rgba(168, 237, 234, 0.3);
}

.hidden { 
  display: none !important; 
}

.feedback { 
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
}

.correct { 
  background: linear-gradient(135deg, #a8e6cf 0%, #88d8a3 100%) !important;
  border: 3px solid #4ade80 !important;
  box-shadow: 
    0 0 30px rgba(74, 222, 128, 0.4),
    0 10px 30px rgba(168, 230, 207, 0.3) !important;
  color: #065f46 !important;
}

.skipped { 
  background: linear-gradient(135deg, #ffaaa5 0%, #ff8a80 100%) !important;
  border: 3px solid #ef4444 !important;
  box-shadow: 
    0 0 30px rgba(239, 68, 68, 0.4),
    0 10px 30px rgba(255, 170, 165, 0.3) !important;
  color: #991b1b !important;
}

.animate { 
  transform: scale(1.1) rotate(2deg);
  animation: wiggle 0.5s ease-in-out;
}

@keyframes wiggle {
  0%, 7% { transform: scale(1.1) rotateZ(0deg); }
  15% { transform: scale(1.1) rotateZ(-2deg); }
  20% { transform: scale(1.1) rotateZ(2deg); }
  25% { transform: scale(1.1) rotateZ(-2deg); }
  30% { transform: scale(1.1) rotateZ(2deg); }
  35% { transform: scale(1.1) rotateZ(-2deg); }
  40% { transform: scale(1.1) rotateZ(2deg); }
  100% { transform: scale(1.1) rotateZ(0deg); }
}

button { 
  margin: 0.8em 0; 
  padding: 1em 1.5em; 
  font-size: 1.1em; 
  font-weight: 600;
  border-radius: 1.2em; 
  border: none; 
  background: linear-gradient(135deg, #228B22 0%, #FFD700 100%);
  color: #fff; 
  cursor: pointer; 
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 
    0 8px 25px rgba(34, 139, 34, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  font-family: 'Fredoka', sans-serif;
  position: relative;
  overflow: hidden;
}

button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 12px 35px rgba(118, 75, 162, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

button:hover::before {
  left: 100%;
}

button:active {
  transform: translateY(0px);
  box-shadow: 
    0 4px 15px rgba(118, 75, 162, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

button:disabled { 
  background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
  color: #9ca3af; 
  cursor: not-allowed; 
  transform: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

button:disabled::before {
  display: none;
}

button.pressed { 
  background: linear-gradient(135deg, #4f46e5 0%, #5b21b6 100%);
  transform: scale(0.98);
  box-shadow: 
    0 4px 15px rgba(79, 70, 229, 0.4),
    inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

select {
  padding: 1em;
  font-size: 1.1em;
  font-weight: 500;
  border-radius: 1em;
  border: 2px solid rgba(118, 75, 162, 0.2);
  margin: 0.8em 0;
  display: block;
  width: 100%;
  max-width: 100%;
  background: linear-gradient(135deg, #fafafa 0%, #f3f4f6 100%);
  color: #2d1b69;
  font-family: 'Fredoka', sans-serif;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 
    0 0 0 3px rgba(102, 126, 234, 0.1),
    0 4px 20px rgba(102, 126, 234, 0.2);
  transform: translateY(-1px);
}

label {
  display: block;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  font-weight: 600;
  font-size: 1.1em;
  color: #2d1b69;
}

#feedbackMsg {
  font-size: 2.2em;
  font-weight: 700;
  margin: 0.5em 0;
  height: 1.5em;
  opacity: 0;
  transition: opacity 0.8s ease;
  text-align: center;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

#summary {
  margin-top: 2em;
  padding: 2em;
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
  border-radius: 1.5em;
  font-size: 1.1em;
  text-align: center;
  border: 2px solid rgba(34, 197, 94, 0.2);
  box-shadow: 0 8px 25px rgba(34, 197, 94, 0.1);
}

#summary h3 { 
  margin-bottom: 1em;
  font-size: 1.8em;
  font-weight: 700;
  color: #2d1b69;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

#summary ul{ 
  margin-top: 0; 
  text-align: left; 
  display: inline-block; 
  padding-left: 1.5em;
  font-weight: 500;
}

#summary .summary-btns {
  margin-top: 1.5em; 
  display: flex;
  gap: 1em;
  justify-content: center;
  flex-wrap: wrap;
}

#summary .summary-btns button {
  margin: 0;
  flex: 1;
  min-width: 120px;
}

#manualControls {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  gap: 1.5em;
  margin-top: 2em;
}

#manualControls button {
  flex: 1;
  font-size: 1.3em;
  font-weight: 700;
  padding: 1.2em 0.8em;
  position: relative;
}

#correctBtn {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  box-shadow: 0 8px 25px rgba(34, 197, 94, 0.3);
}

#correctBtn:hover {
  box-shadow: 0 12px 35px rgba(34, 197, 94, 0.4);
}

#skipBtn {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  box-shadow: 0 8px 25px rgba(239, 68, 68, 0.3);
}

#skipBtn:hover {
  box-shadow: 0 12px 35px rgba(239, 68, 68, 0.4);
}

#startError, #motionStatus {
  font-weight: 500;
  font-size: 1em;
  text-align: center;
  padding: 0.8em;
  border-radius: 0.8em;
  margin-top: 1em;
}

#requestPermissionBtn {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  box-shadow: 0 8px 25px rgba(245, 158, 11, 0.3);
}

#requestPermissionBtn:hover {
  box-shadow: 0 12px 35px rgba(245, 158, 11, 0.4);
}

/* Mobile responsiveness */
@media (max-width: 450px) {
  #app {
    margin: 0.5em;
    padding: 1.5em;
    width: calc(100% - 1em);
  }
  
  h1 {
    font-size: 2em;
  }
  
  #wordDisplay {
    font-size: 1.8em;
    padding: 0.8em;
  }
  
  #timer {
    font-size: 1.5em;
  }
  
  #score {
    font-size: 1.2em;
  }
  
  #manualControls {
    flex-direction: column;
    gap: 1em;
  }
  
  #summary .summary-btns {
    flex-direction: column;
  }
}

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

#timer {
  animation: pulse 1s ease-in-out infinite;
}

button:focus-visible, select:focus-visible {
  outline: 3px solid rgba(102, 126, 234, 0.5);
  outline-offset: 2px;
}

#categorySelect:hover {
  border-color: #667eea;
  transform: translateY(-1px);
}