#pageBody {
  background: linear-gradient(135deg, #f8f9ff 0%, #f2f4ff 100%);
  min-height: 100vh;
  padding: 2rem 1rem;
  font-family: 'Inter', sans-serif;
}

#mainContainer {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-radius: 24px;
  box-shadow: 0 8px 32px rgba(31, 38, 135, 0.05);
  padding: 2.5rem;
  max-width: 800px;
  margin: 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Error box, instructions, etc. */
.errorBox {
  background: #fee2e2;
  color: #dc2626;
  padding: 1rem;
  border-radius: 8px;
  margin: 1rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.descriptionText {
  color: #6b7280;
  line-height: 1.6;
  margin-bottom: 2rem;
  text-align: center;
  font-size: 0.95rem;
}

/* Controls panel: 2 columns on larger screens */
.controlsPanel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  background: rgba(249, 250, 251, 0.8);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  border: 1px solid #e5e7eb;
}

.formRow {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0; /* grid gap used instead */
}

.formLabel {
  color: #374151;
  font-weight: 500;
  font-size: 0.9rem;
}

.formSelect {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 0.75rem;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}
.formSelect:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.sliderInput {
  -webkit-appearance: none;
  height: 6px;
  border-radius: 4px;
  background: #e5e7eb;
  margin: 0.75rem 0;
}
.sliderInput::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #6366f1;
  cursor: pointer;
  transition: transform 0.2s;
}
.sliderInput:hover::-webkit-slider-thumb {
  transform: scale(1.1);
}

/* ----------------------
   TEXT AREA + TOP ROW BAR
   ---------------------- */
.textAreaPanel {
  position: relative; /* to position the top row absolutely */
  margin-top: 1rem;
}

/* 
   We put char counter + Pause + Clear together in .topRowBar.
   It's positioned top-right above the textarea.
*/
.topRowBar {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.9rem;
  padding: 0.5rem 0.75rem;
  /* 
    If you want a white background behind them, uncomment:
    background: #fff; 
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  */
}

.charCounterInfo {
  color: #374151;
  white-space: nowrap; /* keep it on one line */
}

/* We keep the label as requested */
.formLabel[for="textInputArea"] {
  display: block;
  margin: 1.5rem 0 0.5rem; 
  color: #374151;
  font-weight: 500;
}

.textInputArea {
  width: 100%;
  min-height: 250px;
  margin-top: 2.5rem; /* space so topRowBar doesn't overlap text */
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 1.25rem;
  font-size: 1rem;
  transition: all 0.2s ease;
  resize: vertical;
}
.textInputArea:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Pause entry row (toggled on/off) */
#pauseEntryRow {
  background: rgba(243, 244, 246, 0.5);
  border-radius: 12px;
  padding: 1rem;
  margin: 1rem 0;
  animation: slideDown 0.3s ease;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* -------------
   BUTTONS
   ------------- */
.buttonRow {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 2rem; 
}

/* Generic gradient style for all buttons */
.pulseBtn {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  border-radius: 10px;
  color: #ffffff;
  font-family: 'Poppins', sans-serif; 
  font-weight: 600;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
}
.pulseBtn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}
@keyframes buttonPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}
.pulseBtn:active {
  animation: buttonPulse 0.3s ease;
}

/* Pause & Clear in the top row bar: same smaller style as screenshot */
#pauseToggleBtn, 
#clearButton {
  font-size: 10px; 
  border-radius: 6px;
  padding: 0.5rem 1rem;
}

/* Listen & Download: bigger buttons */
.bigButton {
  font-size: 1.05rem;
  padding: 0.9rem 1.75rem;
}

/* Disabled button style */
.btnDisabled {
  background: linear-gradient(135deg, #d1d5db 0%, #9ca3af 100%);
  cursor: not-allowed;
}

/* Audio player */
#audioPlayer {
  width: 100%;
  margin-top: 2rem;
  border-radius: 12px;
  background: #f3f4f6;
}

/* Responsive tweaks */
@media (max-width: 640px) {
  #mainContainer {
    padding: 1.5rem;
    border-radius: 20px;
  }
  .controlsPanel {
    display: block;
  }
  .formRow {
    margin-bottom: 1rem;
  }
  .topRowBar {
    position: static; /* let it flow normally on narrow screens */
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.5rem;
  }
  .textInputArea {
    margin-top: 0; /* remove top margin if .topRowBar is no longer absolute */
  }
  .buttonRow {
    justify-content: center;
  }
  .pulseBtn {
    width: 100%;
  }
}
#mainContainer .sliderInput {
  width: auto;
}
