/* General page styling */
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  color: #333;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  box-sizing: border-box;
}

/* Quiz container */
#composer-quiz {
  max-width: 100%;
  margin: 0;
  background: white;
  border-radius: 0;
  padding: 15px; /* Was 20px */
  box-shadow: none;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
  width: 100%;
}

#composer-quiz::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(90deg, #0077cc, #00aaff, #0077cc);
}

/* Headings */
#composer-quiz h2 {
  text-align: center;
  margin-bottom: 8px;
  color: #222;
  font-size: 1.5em; /* Was 2.2em */
  font-weight: 700;
  background: linear-gradient(90deg, #0077cc, #00aaff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Day number - Made smaller and light grey */
#dayNumber {
  font-weight: 500;
  font-size: 0.95em;
  margin: 5px 0 20px 0;
  text-align: center;
  color: #888;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* Instructions */
#instructions {
  font-size: 0.85em; /* Was 0.95em */
  color: #666;
  margin-bottom: 15px; /* Was 25px */
  line-height: 1.4; /* Tighter */
  padding: 10px; /* Was 15px */
  background: #f8fafc;
  border-radius: 8px; /* Was 10px */
  border-left: 3px solid #0077cc; /* Was 4px */
}

/* Progress indicator */
#progress {
  font-size: 0.9em;
  margin-bottom: 15px;
  text-align: center;
  color: #555;
  font-weight: 600;
  background: #e8f4fc;
  padding: 8px 15px;
  border-radius: 20px;
  display: inline-block;
  margin-left: 50%;
  transform: translateX(-50%);
}

/* Clues styling */
#clues {
  margin: 20px 0;
  background: #f8fafc;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid #e1e8ed;
  width: 100%;
  box-sizing: border-box;
}

#clues p {
  background: white;
  padding: 8px 12px; /* Changed from 12px 15px */
  border-radius: 6px; /* Changed from 8px */
  margin: 5px 0; /* Changed from 8px 0 */
  border-left: 3px solid #0077cc;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05); /* Lighter shadow */
  transition: transform 0.2s, box-shadow 0.2s;
  width: 100%;
  box-sizing: border-box;
  font-size: 0.9em; /* Added smaller text */
  line-height: 1.3; /* Added tighter line height */
}

#clues p:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Guess row */
.guess-row {
  text-align: center;
  margin: 25px 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
}

#guessBox {
  flex: 1;
  min-width: 200px; /* Was 250px */
  max-width: 100%;
  padding: 8px 12px; /* Was 12px 18px */
  font-size: 0.9em; /* Was 1.1em */
  border: 1px solid #ddd; /* Thinner border */
  border-radius: 6px; /* Smaller radius */
  transition: all 0.3s;
  background: #f8fafc;
  box-sizing: border-box;
}

#guessBox:focus {
  outline: none;
  border-color: #0077cc;
  box-shadow: 0 0 0 3px rgba(0, 119, 204, 0.1);
  background: white;
}

/* Button in guess row */
.guess-row button {
  padding: 12px 24px;
  font-weight: 600;
  min-width: 140px;
}

/* Buttons - LARGER TEXT */
button {
  border: none;
  border-radius: 8px; /* Was 10px */
  padding: 8px 16px; /* Was 12px 24px */
  margin: 3px; /* Was 5px */
  cursor: pointer;
  transition: all 0.3s;
  font-size: 0.9em; /* Was 1.1em */
  font-weight: 600;
  letter-spacing: normal; /* Remove letter-spacing */
}

button.primary {
  background: linear-gradient(135deg, #0077cc, #00aaff);
  color: white;
  box-shadow: 0 4px 15px rgba(0, 119, 204, 0.3);
}

button.primary:hover {
  background: linear-gradient(135deg, #005fa3, #0088cc);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 119, 204, 0.4);
}

button.primary:active {
  transform: translateY(0);
}

button.secondary {
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  color: #475569;
  border: 1px solid #cbd5e1;
}

button.secondary:hover {
  background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Center the action buttons with flexbox */
.actions {
  display: flex;
  justify-content: center;
  gap: 15px;
  flex-wrap: wrap;
  margin: 20px 0;
  width: 100%;
}

/* Reset button */
#resetButton {
  display: block;
  margin: 20px auto 10px auto;
  font-size: 0.9em; /* Slightly larger */
  padding: 10px 20px; /* Larger padding */
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #64748b;
  border-radius: 8px;
  min-width: 120px;
}

#resetButton:hover {
  background: #f1f5f9;
  color: #475569;
}

/* Feedback messages */
#feedback {
  text-align: center;
  padding: 15px;
  margin: 20px 0;
  border-radius: 10px;
  font-weight: 500;
  font-size: 1.1em;
  min-height: 20px;
  width: 100%;
  box-sizing: border-box;
}

.feedback-correct {
  color: #059669;
  background: #d1fae5;
  border: 1px solid #a7f3d0;
}

.feedback-close {
  color: #d97706;
  background: #fef3c7;
  border: 1px solid #fde68a;
}

.feedback-wrong {
  color: #dc2626;
  background: #fee2e2;
  border: 1px solid #fecaca;
}

.feedback-reveal {
  color: #4b5563;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  font-style: italic;
}

/* Stats lines */
#average, #streak, #tomorrow, #todayPerformance {
  font-size: 0.8em; /* Was 0.9em */
  color: #555;
  margin-top: 5px; /* Was 10px */
  text-align: center;
  padding: 5px 10px; /* Was 8px 15px */
  background: #f8fafc;
  border-radius: 6px; /* Was 8px */
  margin-bottom: 3px; /* Was 5px */
  word-break: break-word;
  width: 100%;
  box-sizing: border-box;
}

#todayPerformance {
  color: #0077cc;
  font-weight: 600;
}

#streak {
  color: #7c3aed;
}

#average {
  color: #059669;
}

#tomorrow {
  color: #d97706;
}

/* Stats container */
#composer-quiz > p:nth-last-child(-n+4) {
  margin: 8px 0;
}

/* Animation for new clues */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

#clues p {
  animation: fadeIn 0.3s ease-out;
}

/* Decorative music note */
#composer-quiz::after {
  content: "♪";
  position: absolute;
  bottom: 20px;
  right: 20px;
  font-size: 24px;
  color: #e2e8f0;
  opacity: 0.5;
  z-index: 0;
}

/* ===== MOBILE OPTIMIZATIONS ===== */

/* ULTRA WIDE MOBILE - NO SIDE PADDING, LARGER BUTTONS */
@media (max-width: 768px) {
  body {
    padding: 0 !important;
    margin: 0;
    background: white;
  }
  
  #composer-quiz {
    padding: 10px;
    margin: 0;
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 0 !important;
    box-shadow: none;
    min-height: 100vh;
  }
  
  #composer-quiz h2 {
    font-size: 1.8em;
    margin-bottom: 8px;
  }
  
  #dayNumber {
    font-size: 0.85em;
    margin: 0 0 15px 0;
  }
  
  #instructions {
    padding: 12px;
    font-size: 0.95em; /* Slightly larger */
    margin-bottom: 20px;
    line-height: 1.4;
  }
  
  /* LARGER BUTTONS ON MOBILE */
 button {
  font-size: 0.95em !important; /* Was 1.2em */
  padding: 10px 14px !important; /* Was 16px 20px */
  min-height: 40px; /* Was 56px */
}
  
  .guess-row {
    flex-direction: column;
    gap: 15px;
    margin: 20px 0;
    width: 100%;
  }
  
  #guessBox {
    min-width: 100%;
    width: 100%;
    max-width: 100% !important;
    padding: 16px 18px; /* Larger padding */
    font-size: 18px; /* Larger text in input */
    border: 2px solid #ddd;
    border-radius: 12px; /* Larger radius */
    background: #f8fafc;
  }
  
  /* Ensure placeholder text fits */
  #guessBox::placeholder {
    font-size: 16px; /* Larger placeholder */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .guess-row button {
    width: 100%;
    margin: 0;
    padding: 18px 20px !important; /* Even larger */
    min-width: auto;
    font-size: 1.3em !important; /* Largest for submit button */
  }
  
  .actions {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin: 20px 0;
    width: 100%;
  }
  
  .actions button {
    width: 100%;
    margin: 0;
    padding: 18px 20px !important;
    font-size: 1.2em !important;
  }
  
  #clues {
    padding: 15px;
    margin: 15px 0;
    width: 100%;
    box-sizing: border-box;
  }
  
  #clues p {
    padding: 12px 15px;
    font-size: 1em; /* Slightly larger text */
    line-height: 1.4;
    width: 100%;
    box-sizing: border-box;
  }
  
  #feedback {
    padding: 15px;
    font-size: 1.1em; /* Larger feedback text */
    margin: 15px 0;
    line-height: 1.4;
    width: 100%;
    box-sizing: border-box;
  }
  
  #average, #streak, #tomorrow, #todayPerformance {
    font-size: 0.95em; /* Slightly larger stats */
    padding: 12px 15px;
    margin: 8px 0;
    line-height: 1.4;
    width: 100%;
    box-sizing: border-box;
  }
  
  #resetButton {
    width: 100%;
    padding: 16px 20px !important;
    margin: 20px auto;
    font-size: 1em !important; /* Larger reset button */
  }
  
  /* Hide decorative elements on small screens */
  #composer-quiz::after {
    display: none;
  }
  
  /* Progress indicator adjustment */
  #progress {
    font-size: 1em;
    padding: 10px 20px;
  }
}

/* Tablet adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
  #composer-quiz {
    padding: 25px;
  }
  
  button {
    font-size: 1.15em;
    padding: 14px 22px;
  }
  
  .guess-row {
    gap: 15px;
  }
  
  #guessBox {
    max-width: 100%;
  }
  
  .actions {
    justify-content: space-around;
  }
  
  .actions button {
    min-width: 220px;
  }
}

/* Desktop adjustments */
@media (min-width: 1025px) {
  #composer-quiz {
    max-width: 1000px;
    margin: 20px auto;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  }
  
  body {
    padding: 20px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  }
}

/* Prevent horizontal scrolling */
html, body {
  overflow-x: hidden;
  width: 100%;
}

/* Force full width on all elements inside quiz */
#composer-quiz > * {
  max-width: 100%;
  box-sizing: border-box;
}

/* Prevent the page from scrolling while dragging on the puzzle grid */
#word-grid-container,
#word-grid {
  touch-action: none !important;
  overscroll-behavior: contain;
}

#word-grid, #word-grid * {
  -webkit-user-select: none;
  user-select: none;
}
