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

body {
  font-family: 'Helvetica Neue', Helvetica, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #fff;
  color: #1d1d1f;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 780px;
  margin: 0 auto;
  padding: 60px 24px 120px;
}

h1 {
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 48px;
  letter-spacing: -0.5px;
}

.section {
  margin-bottom: 36px;
}

.section label {
  display: block;
  font-size: 15px;
  font-weight: 500;
  color: #1d1d1f;
  margin-bottom: 10px;
}

/* Toggle / Segmented Control */

.toggle-group {
  display: inline-flex;
  background: #f5f5f7;
  border-radius: 10px;
  padding: 3px;
}

.toggle-btn {
  padding: 8px 28px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: #6e6e73;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.toggle-btn.active {
  background: #860000;
  color: #fff;
  box-shadow: 0 1px 3px rgba(134, 0, 0, 0.3);
}

.toggle-btn:not(.active):hover {
  color: #1d1d1f;
}

/* Textareas */

textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid #d2d2d7;
  border-radius: 10px;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
  color: #1d1d1f;
  resize: vertical;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  outline: none;
}

textarea:focus {
  border-color: #860000;
  box-shadow: 0 0 0 3px rgba(134, 0, 0, 0.12);
}

textarea::placeholder {
  color: #a1a1a6;
}

#taskInstructions {
  min-height: 140px;
}

#readingsText {
  min-height: 100px;
}

#customInstructions {
  min-height: 80px;
}

#feedback {
  min-height: 80px;
  margin-bottom: 16px;
}

/* File Upload */

.file-upload-area {
  border: 2px dashed #d2d2d7;
  border-radius: 10px;
  padding: 28px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
  margin-bottom: 12px;
}

.file-upload-area:hover {
  border-color: #860000;
  background: rgba(134, 0, 0, 0.02);
}

.file-upload-area.dragover {
  border-color: #860000;
  background: rgba(134, 0, 0, 0.04);
}

.file-upload-label {
  font-size: 14px;
  color: #6e6e73;
  line-height: 1.6;
}

.file-upload-label strong {
  color: #860000;
}

.file-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.file-list:empty {
  margin-bottom: 0;
}

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #f5f5f7;
  border-radius: 6px;
  font-size: 13px;
  color: #1d1d1f;
}

.file-chip button {
  background: none;
  border: none;
  color: #86868b;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
}

.file-chip button:hover {
  color: #860000;
}

/* Buttons */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 36px;
  background: #860000;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
  min-width: 160px;
}

.btn-primary:hover {
  background: #6d0000;
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-primary:disabled {
  background: #d2d2d7;
  cursor: not-allowed;
  transform: none;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 10px;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Output Section */

.output-section {
  margin-top: 48px;
  padding-top: 40px;
  border-top: 1px solid #e8e8ed;
}

.output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.output-header h2 {
  font-size: 18px;
  font-weight: 600;
}

.btn-copy {
  padding: 8px 18px;
  background: #f5f5f7;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: #1d1d1f;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-copy:hover {
  background: #e8e8ed;
}

.btn-copy.copied {
  background: #860000;
  color: #fff;
}

.output-content {
  padding: 24px;
  background: #fafafa;
  border: 1px solid #f0f0f0;
  border-radius: 10px;
  font-size: 15px;
  line-height: 1.75;
  white-space: pre-wrap;
  word-wrap: break-word;
  min-height: 60px;
}

/* Feedback Section */

.feedback-section {
  margin-top: 36px;
}

.feedback-section label {
  display: block;
  font-size: 15px;
  font-weight: 500;
  color: #1d1d1f;
  margin-bottom: 10px;
}

/* Utility */

.hidden {
  display: none !important;
}

/* Responsive */

@media (max-width: 600px) {
  .container {
    padding: 32px 16px 80px;
  }

  h1 {
    font-size: 24px;
    margin-bottom: 32px;
  }

  .toggle-btn {
    padding: 8px 18px;
    font-size: 13px;
  }

  .btn-primary {
    width: 100%;
  }
}
