/* --- BASE STYLES --- */
body {
  font-family: 'Lexend', sans-serif;
  text-align: center;
  background: #fdfcf0;
  color: #333;
  padding: 10px;
  margin: 0;
  overflow-x: hidden;
}

h1 {
  color: #2c3e50;
  font-weight: 700;
  margin: 10px 0;
}

#menu, #quiz {
  width: 95vw;
  max-width: 1000px;
  margin: 10px auto;
  background: white;
  padding: 20px;
  border-radius: 30px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.05);
  box-sizing: border-box;
  display: flex;
  flex-direction: column; 
  align-items: center;
}

/* --- BUTTONS & INTERFACE --- */
button {
  display: block;
  width: 100%;
  margin: 10px auto;
  padding: 18px;
  font-family: 'Lexend', sans-serif;
  font-size: 22px;
  font-weight: 500;
  border-radius: 15px;
  border: 3px solid #e0e0e0;
  background: #fff;
  cursor: pointer;
  touch-action: manipulation;
}

/* --- RESET BUTTON --- */
.reset-btn {
  background: #f0f0f0 !important;
  border: 2px solid #ccc !important;
  font-size: 14px !important;
  padding: 8px !important;
  margin: 0 0 5px 0 !important;
  color: #666 !important;
  border-radius: 10px !important;
  width: 100% !important;
  box-shadow: none !important;
}

.reset-btn:active {
  background: #e0e0e0 !important;
}

/* --- HEAR QUESTION BUTTON --- */
.read-btn {
  background-color: #ffeb3b !important;
  color: #333 !important;
  border: 3px solid #fbc02d !important;
  font-weight: 700 !important;
  font-size: 18px !important;
  padding: 10px 25px !important;
  width: auto !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 15px !important;
  border-radius: 30px !important;
  box-shadow: 0 4px 0 #fbc02d;
}

/* --- AUDIO BUTTONS --- */
.mini-audio-btn {
  width: 50px !important;
  height: 50px !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 50% !important;
  background-color: #e3f2fd !important;
  border: 2px solid #2196F3 !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 20px !important;
}

.mini-audio-btn.small {
  width: 30px !important;
  height: 30px !important;
  font-size: 14px !important;
  border-width: 1px !important;
}

/* --- ANSWER SELECTION (Choice Questions) --- */
#answer-options {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 15px;
  margin-top: 10px;
  width: 100%;
}

.answer-wrapper {
  flex: 1 1 45%;
  min-width: 300px;
  max-width: 500px;
  min-height: 70px;
  max-height: 70px;
  display: flex;
  align-items: center;
  background: white;
  border: 3px solid #e0e0e0;
  border-radius: 10px;
  padding: 5px 10px;
  cursor: pointer;
}

.answer-wrapper button:first-child {
  flex: 1;
  border: none !important;
  background: none !important;
  text-align: center;
  pointer-events: none;
  font-size: 22px;
  margin: 0;
}

/* --- DRAG AND DROP (Common Draggable) --- */
.draggable-word {
  padding: 8px 12px;
  font-size: 18px;
  background: white;
  border: 2px solid #2196F3;
  border-radius: 30px;
  box-shadow: 0 3px 5px rgba(0,0,0,0.1);
  margin: 0;
  cursor: grab;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  white-space: nowrap; /* Forces text and audio to stay on one line */
}

.draggable-word span {
  flex: 1;
}

.draggable-word:active { cursor: grabbing; }

.word-bank {
  background: #f0f0f0;
  border: 3px inset #ddd;
  border-radius: 20px;
  padding: 15px;
  min-height: 60px;
  width: 100%;
  margin: 10px 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  box-sizing: border-box;
}

/* --- GROUPING BUCKETS --- */
/* --- GROUPING BUCKETS --- */
.drop-bucket {
  flex: 1;
  min-height: 150px; 
  background: #f9f9f9;
  border: 3px dashed #2196F3;
  border-radius: 20px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Add this to prevent the bucket itself from growing */
  height: auto; 
}

.bucket-content {
  width: 100%;
  min-height: 100px;
  display: flex;
  /* Change from column to wrap rows */
  flex-wrap: wrap; 
  /* Center items horizontally */
  justify-content: center; 
  /* Align items to the top so they don't stretch vertically */
  align-items: flex-start; 
  gap: 10px;
}

/* Ensure dropped words in grouping don't take up 100% width */
.drop-bucket .draggable-word {
  width: auto !important;
  max-width: 90%;
}

/* --- LABELLING DIAGRAM --- */
.diagram-wrapper {
  position: relative;
  display: inline-block;
  width: 100%;
  max-width: 800px;
  margin: 15px auto;
}

.label-zone {
  position: absolute;
  width: 140px;
  height: auto;
  min-height: 35px !important; /* Force override of bucket min-height */
  padding: 4px !important;
  border: 2px dashed #2196F3;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  display: flex !important;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%);
  z-index: 10;
}

/* Style for word dropped specifically in a label zone */
.label-zone .draggable-word {
  width: 100% !important;
  height: auto !important;
  padding: 4px 8px !important;
  font-size: 16px !important;
  border-radius: 8px;
  box-shadow: none;
  justify-content: center; /* Center text since audio is hidden */
  border-width: 1.5px;
}

.label-zone .mini-audio-btn {
  display: none !important; /* Hide audio inside diagram */
}

/* --- FEEDBACK & SUBMIT --- */
.correct-item, .correct { background-color: #d4edda !important; border-color: #28a745 !important; }
.wrong-item, .wrong { background-color: #f8d7da !important; border-color: #dc3545 !important; }
.missed { border: 4px dashed #28a745 !important; background-color: #f0fff0 !important; }

.submit-btn {
  background-color: #2196F3 !important;
  color: white !important;
  /* Reduced from 24px to 18px */
  font-size: 18px !important; 
  /* Reduced padding for a sleeker look */
  padding: 10px 30px !important; 
  border-radius: 50px !important;
  width: auto !important;
  /* Pulled closer to the reset button (was 20px) */
  margin-top: 10px !important; 
  box-shadow: 0 4px 0 #1976D2;
  transition: transform 0.1s;
}

.submit-btn.label-submit {
  white-space: nowrap !important;
  font-size: 16px !important;
  padding: 8px 20px !important;
  /* Changed from 100% to auto so it doesn't look giant */
  width: auto !important; 
  margin: 10px auto !important;
  display: block;
}

.submit-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #1976D2;
}

/* --- UTILITIES --- */
h2 { font-size: 28px; line-height: 1.3; margin: 15px 0; }
p { font-size: 18px; }
.hidden { display: none !important; }
.selected { background-color: #e3f2fd !important; border: 3px solid #2196F3 !important; }

/* --- EMOJI GROUPING STYLES --- */

/* This targets spans that contain emojis (large 1-character items) */
.draggable-word span {
  font-size: 18px; /* Default for text */
  transition: font-size 0.2s;
}

/* If the draggable-word has a very short length (like an emoji), make it huge */
.draggable-word:has(span:empty), 
.draggable-word span:only-child {
  /* This is a fallback, but we'll use a specific class in JS for better control */
}

/* Add this class to your CSS to handle the "Large Emoji" look */
.emoji-large {
  font-size: 60px !important; /* Makes emoji very clear for children */
  padding: 10px !important;
  min-width: 80px;
  min-height: 80px;
  justify-content: center;
  background: white;
  border-radius: 20px;
}

/* Hide the audio button for emojis if you prefer, or keep it small at the bottom */
.emoji-large .mini-audio-btn.small {
  width: 25px !important;
  height: 25px !important;
  position: absolute;
  bottom: 5px;
  right: 5px;
}

/* --- LARGE EMOJI STYLE --- */
.emoji-large {
  font-size: 50px !important; /* Large for kids to see */
  min-width: 80px;
  min-height: 80px;
  justify-content: center;
  padding: 10px !important;
  border-radius: 20px !important;
}

.emoji-large span {
  line-height: 1;
}

/* Keep the audio button small even when the emoji is huge */
.emoji-large .mini-audio-btn.small {
  width: 25px !important;
  height: 25px !important;
  font-size: 12px !important;
}

/* --- NAKED EMOJI STYLE --- */
.draggable-word.emoji-large {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  cursor: grab;
  padding: 0 !important;
  min-width: auto !important;
  min-height: auto !important;
}

.emoji-large span {
  font-size: 80px; /* Even bigger now since there's no box */
  display: block;
  line-height: 1;
  transition: transform 0.2s;
}

.emoji-large:hover span {
  transform: scale(1.1); /* Slight grow on hover for feedback */
}

/* Hide the audio button for pure emoji questions to keep it clean */
.emoji-large .mini-audio-btn {
  display: none !important;
}

/* --- EMOJI CHECKING COLORS --- */

/* Green glow for correct emojis */
.emoji-large.correct-item {
  filter: drop-shadow(0 0 15px rgba(76, 175, 80, 0.8)) !important;
  transform: scale(1.1);
}

/* Red glow for wrong emojis */
.emoji-large.wrong-item {
  filter: drop-shadow(0 0 15px rgba(244, 67, 54, 0.8)) !important;
}

/* Optional: Add a little checkmark or X icon floating next to them */
.emoji-large.correct-item::after {
  content: "✅";
  font-size: 20px;
  position: absolute;
  top: -10px;
  right: -10px;
}

.emoji-large.wrong-item::after {
  content: "❌";
  font-size: 20px;
  position: absolute;
  top: -10px;
  right: -10px;
}

.home-btn {
    position: absolute !important; /* Changed to absolute to stay inside the relative header */
    top: 15px !important;
    right: 15px !important;
    width: auto !important; /* Prevents it from stretching full-width */
    height: auto !important;
    
    /* Look and Feel */
    background: white !important;
    color: #333 !important;
    border: 2px solid #ddd !important;
    border-radius: 12px !important;
    padding: 8px 16px !important;
    font-size: 18px !important;
    font-weight: bold !important;
    
    /* Layout */
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    z-index: 9999 !important;
    cursor: pointer !important;
    box-shadow: 0 4px 0 #eee !important;
}

.home-btn:hover {
    background: #f9f9f9 !important;
}

/* --- TOP LEFT PROGRESS TEXT --- */
.quiz-progress-text {
    position: fixed; /* Pins it to the screen regardless of scrolling */
    top: 25px;
    left: 20px;
    margin: 0 !important;
    font-size: 16px !important;
    color: #444 !important;
    background: rgba(255, 255, 255, 0.8);
    padding: 5px 10px;
    border-radius: 8px;
    font-weight: 500;
    z-index: 1000;
}

/* Ensure strong tags within progress look bold */
.quiz-progress-text strong {
    color: #000;
    font-weight: 700;
}

.reset-btn {
  /* ... keep your existing styles ... */
  margin-top: 15px !important; /* This adds the gap you need */
  margin-bottom: 5px !important;
}