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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 20px;
}

.container {
  max-width: 600px;
  margin: 0 auto;
  background: white;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  overflow: hidden;
}

header {
  background: #4a5568;
  color: white;
  padding: 24px;
  text-align: center;
}

header h1 {
  font-size: 1.5rem;
  margin-bottom: 16px;
}

#progress-container {
  background: rgba(255,255,255,0.2);
  border-radius: 10px;
  height: 20px;
  position: relative;
  overflow: hidden;
}

#progress-bar {
  background: #48bb78;
  height: 100%;
  width: 0%;
  transition: width 0.3s ease;
  border-radius: 10px;
}

#progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.75rem;
  font-weight: bold;
}

main {
  padding: 32px 24px;
  min-height: 400px;
}

/* Survey Sections */
.survey-section {
  display: none;
}

.survey-section.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-title {
  font-size: 1.1rem;
  color: #4a5568;
  margin-bottom: 8px;
  font-weight: 600;
}

.section-subtitle {
  font-size: 0.875rem;
  color: #718096;
  margin-bottom: 8px;
}

.section-leadin {
  font-size: 0.875rem;
  color: #4a5568;
  font-style: italic;
  font-weight: 500;
  margin-bottom: 16px;
}

/* Questions */
.question {
  margin-bottom: 24px;
}

.question-text {
  font-size: 1rem;
  color: #2d3748;
  margin-bottom: 12px;
  line-height: 1.5;
}

.question-number {
  color: #667eea;
  font-weight: bold;
}

/* Radio/Checkbox Options */
.options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.option {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: #f7fafc;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.option:hover {
  border-color: #667eea;
  background: #eef2ff;
}

.option.selected {
  border-color: #667eea;
  background: #eef2ff;
}

.option input {
  margin-right: 12px;
  width: 18px;
  height: 18px;
  accent-color: #667eea;
}

.option label {
  cursor: pointer;
  flex: 1;
}

/* Likert Scale */
.likert-scale {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
}

.likert-option {
  flex: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  aspect-ratio: 1;
}

.likert-option input {
  display: none;
}

.likert-option label {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 8px;
  background: #f0f2f8;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  color: #4a5568;
  transition: all 0.2s ease;
}

.likert-option input:checked + label {
  background: #667eea;
  border-color: #667eea;
  color: white;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.35);
}

.likert-option label:hover {
  border-color: #667eea;
  background: #e8ecfb;
}

.likert-option input:checked + label:hover {
  background: #667eea;
}

.likert-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #718096;
  margin-top: 4px;
}

/* Text Input */
.text-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s ease;
}

.text-input:focus {
  outline: none;
  border-color: #667eea;
}

/* Sleep Quantity Slider */
.sleep-slider-wrapper {
  text-align: center;
  padding: 20px 0;
}

.sleep-display {
  font-size: 2.2em;
  font-weight: 700;
  color: #2d3748;
  margin-bottom: 24px;
}

.sleep-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: #e2e8f0;
  outline: none;
  cursor: pointer;
}

.sleep-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #667eea;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(102, 126, 234, 0.4);
  transition: transform 0.15s ease;
}

.sleep-slider::-webkit-slider-thumb:active {
  transform: scale(1.15);
}

.sleep-slider::-moz-range-thumb {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #667eea;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 6px rgba(102, 126, 234, 0.4);
}

.sleep-slider.touched::-webkit-slider-thumb {
  background: #48bb78;
  box-shadow: 0 2px 6px rgba(72, 187, 120, 0.4);
}

.sleep-slider.touched::-moz-range-thumb {
  background: #48bb78;
  box-shadow: 0 2px 6px rgba(72, 187, 120, 0.4);
}

.sleep-range-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 0.85em;
  color: #a0aec0;
}

/* Tenure Slider */
.tenure-slider-wrapper {
  text-align: center;
  padding: 20px 0;
}

.tenure-display {
  font-size: 1.8em;
  font-weight: 700;
  color: #2d3748;
  margin-bottom: 24px;
}

.tenure-slider-group {
  display: flex;
  gap: 24px;
}

.tenure-slider-item {
  flex: 1;
}

.tenure-slider-label {
  display: block;
  font-size: 0.9em;
  font-weight: 600;
  color: #4a5568;
  margin-bottom: 12px;
}

.section-description {
  font-size: 0.9em;
  color: #718096;
  margin-bottom: 16px;
}

/* AQI Display */
.aqi-display {
  background: #f7fafc;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  margin-bottom: 24px;
}

.aqi-value {
  font-size: 3rem;
  font-weight: bold;
  margin-bottom: 8px;
}

.aqi-category {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.aqi-location {
  font-size: 0.875rem;
  color: #718096;
}

.aqi-good { color: #48bb78; }
.aqi-moderate { color: #ecc94b; }
.aqi-usg { color: #ed8936; }
.aqi-unhealthy { color: #f56565; }
.aqi-very-unhealthy { color: #9f7aea; }
.aqi-hazardous { color: #742a2a; }

/* Affect Grid */
.affect-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.affect-item {
  text-align: center;
}

.affect-item span {
  display: block;
  font-size: 0.875rem;
  margin-bottom: 8px;
  color: #4a5568;
}

.affect-item select {
  width: 100%;
  padding: 8px;
  border: 2px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.875rem;
  background: white;
}

/* Map Image */
.map-image {
  max-width: 100%;
  border-radius: 8px;
  margin-top: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.map-options {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

.map-option {
  display: flex;
  align-items: center;
  padding: 12px 24px;
  background: #f7fafc;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
}

.map-option:hover {
  border-color: #667eea;
  background: #eef2ff;
}

.map-option.selected {
  background: #667eea;
  border-color: #667eea;
  color: white;
}

.map-option input {
  margin-right: 8px;
  width: 18px;
  height: 18px;
  accent-color: #667eea;
}

.map-option.selected input {
  accent-color: white;
}

.map-option label {
  cursor: pointer;
}

/* Footer Navigation */
footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  background: #f7fafc;
  border-top: 1px solid #e2e8f0;
}

.nav-btn {
  padding: 12px 32px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-btn:disabled {
  background: #e2e8f0;
  color: #a0aec0;
  cursor: not-allowed;
}

#prev-btn {
  background: #e2e8f0;
  color: #4a5568;
}

#prev-btn:not(:disabled):hover {
  background: #cbd5e0;
}

#next-btn {
  background: #667eea;
  color: white;
}

#next-btn:hover {
  background: #5a67d8;
}

/* Welcome Screen */
.welcome-screen {
  text-align: center;
  padding: 20px 0;
}

.welcome-screen h2 {
  color: #2d3748;
  margin-bottom: 16px;
}

.welcome-screen p {
  color: #718096;
  line-height: 1.6;
  margin-bottom: 12px;
}

.welcome-screen .highlight {
  background: #eef2ff;
  padding: 16px;
  border-radius: 8px;
  margin: 20px 0;
}

/* End Screen */
.end-screen {
  text-align: center;
  padding: 40px 0;
}

.end-screen .checkmark {
  font-size: 4rem;
  margin-bottom: 16px;
}

.end-screen h2 {
  color: #48bb78;
  margin-bottom: 16px;
}

/* Skip Message */
.skip-message {
  background: #fefcbf;
  border: 1px solid #ecc94b;
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  margin-top: 16px;
}

.skip-message p {
  color: #744210;
  line-height: 1.5;
}

/* Affect Table (PANAS) */
.table-wrapper {
  overflow-x: auto;
  margin-top: 16px;
}

.affect-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.affect-table thead th {
  padding: 8px 4px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #4a5568;
  text-align: center;
  vertical-align: top;
  width: 10%;
}

.affect-table thead th:first-child {
  width: 40%;
  text-align: left;
}

.affect-table thead th .scale-label {
  font-weight: 400;
  font-size: 0.65rem;
  color: #718096;
  display: block;
  margin-top: 2px;
  min-height: 2.4em;
}

.affect-table tbody tr {
  border-bottom: 1px solid #e2e8f0;
}

.affect-table tbody tr:hover {
  background: #f7fafc;
}

.affect-table td {
  padding: 12px 4px;
}

.affect-table .item-label {
  font-size: 0.9rem;
  color: #2d3748;
  padding-left: 8px;
  padding-right: 12px;
  white-space: normal;
  line-height: 1.4;
}

.affect-table .radio-cell {
  text-align: center;
  padding: 4px 2px;
}

.affect-table .radio-cell input[type="radio"] {
  display: none;
}

.affect-table .radio-cell label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  background: #f0f2f8;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.affect-table .radio-cell label:hover {
  border-color: #667eea;
  background: #e8ecfb;
}

.affect-table .radio-cell input[type="radio"]:checked + label {
  background: #667eea;
  border-color: #667eea;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.35);
}

.affect-table .radio-cell input[type="radio"]:checked + label:hover {
  background: #667eea;
}

.affect-table tr.highlight-row {
  background: #fed7d7;
  animation: shake 0.5s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* Responsive */
@media (max-width: 480px) {
  body {
    padding: 10px;
  }

  header h1 {
    font-size: 1.25rem;
  }

  main {
    padding: 24px 16px;
  }

  .likert-scale {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
  }

  .likert-option {
    aspect-ratio: auto;
  }

  .likert-option label {
    min-height: 56px;
  }

  .likert-option {
    flex: unset;
  }

  .affect-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .affect-table .item-label {
    font-size: 0.8rem;
    padding-right: 6px;
  }

  .affect-table .radio-cell label {
    min-height: 36px;
    border-radius: 6px;
  }

  .affect-table thead th {
    font-size: 0.65rem;
    padding: 6px 2px;
  }

  .affect-table thead th .scale-label {
    font-size: 0.55rem;
  }

  .affect-table td {
    padding: 10px 2px;
  }
}

/* === reCAPTCHA v2 Verification === */
.verification-screen {
  text-align: center;
  padding: 20px 0;
}

.recaptcha-container {
  display: flex;
  justify-content: center;
  margin: 24px 0;
}

/* === Location share button === */
.location-btn {
  width: 100%;
  padding: 14px 20px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.location-btn:hover {
  background: #5a67d8;
}

.location-btn:disabled {
  background: #a0aec0;
  cursor: not-allowed;
}

/* === NEW: Honeypot Fields (hidden from users, visible to bots) === */
.hp-field {
  position: absolute;
  left: -9999px;
  top: -9999px;
  opacity: 0;
  height: 0;
  width: 0;
  overflow: hidden;
  pointer-events: none;
}

/* === NEW: Data Quality Metrics Panel (for demo/testing) === */
.quality-panel {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #1a202c;
  color: #e2e8f0;
  padding: 16px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  font-size: 0.8rem;
  z-index: 1000;
  min-width: 250px;
  transition: transform 0.3s ease;
}

.quality-panel.hidden {
  transform: translateX(calc(100% + 40px));
}

.quality-panel h4 {
  margin-bottom: 12px;
  font-size: 0.9rem;
  color: #90cdf4;
  border-bottom: 1px solid #4a5568;
  padding-bottom: 8px;
}

.quality-panel .metric {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid #2d3748;
}

.quality-panel .metric:last-of-type {
  border-bottom: none;
}

.quality-panel .metric span:first-child {
  color: #a0aec0;
}

.quality-panel .metric span:last-child {
  font-weight: 600;
  color: #68d391;
}

.quality-panel button {
  margin-top: 12px;
  width: 100%;
  padding: 8px;
  background: #4a5568;
  border: none;
  border-radius: 6px;
  color: #e2e8f0;
  cursor: pointer;
  font-size: 0.8rem;
  transition: background 0.2s;
}

.quality-panel button:hover {
  background: #718096;
}

/* Toggle button for metrics panel */
.metrics-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
  z-index: 999;
  display: none;
}

.quality-panel.hidden + .metrics-toggle {
  display: block;
}

/* Unanswered question highlight */
.unanswered-highlight {
  border: 2px solid #fc8181;
  border-radius: 8px;
  padding: 8px;
  background: #fff5f5;
}
