:root {
  /* Green Theme - Light Mode */
  --bg: #f2f7f2;
  --text: #1a2e1a;
  --header-bg: #1b4332;
  --header-text: #ffffff;
  --card-bg: #ffffff;
  --card-shadow: rgba(27, 67, 50, 0.1);
  --section-bg: #ffffff;
  --accent: #52b788;
  --accent-hover: #40916c;
  --logout-red: #e53935;
  --footer-bg: #081c15;
  --footer-text: #ffffff;
  --border-color: #d8e2dc;
  --stat-color: #1b4332;
  --link-color: #1b4332;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #081c15;
    --text: #d8f3dc;
    --header-bg: #1b4332;
    --card-bg: #142a20;
    --card-shadow: rgba(0, 0, 0, 0.5);
    --section-bg: #0b251c;
    --accent: #74c69d;
    --accent-hover: #95d5b2;
    --logout-red: #ef4444;
    --footer-bg: #000000;
    --border-color: #2d4a3e;
    --stat-color: #d8f3dc;
    --link-color: #74c69d;
  }
}

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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ==================== Navbar ==================== */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 30px;
  background-color: var(--header-bg);
  color: var(--header-text);
  box-shadow: 0 2px 10px var(--card-shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-logo {
  font-weight: 800;
  font-size: 22px;
  color: var(--header-text);
  text-decoration: none;
}

.nav-tag {
  font-size: 13px;
  opacity: 0.75;
  font-weight: 500;
}

/* ==================== Splash / Intro ==================== */
.splash {
  text-align: center;
  padding: 70px 20px 60px;
  background: linear-gradient(135deg, var(--header-bg) 0%, #2d6a4f 100%);
  color: white;
}

.splash h1 {
  font-size: 40px;
  margin-bottom: 16px;
  font-weight: 700;
}

.splash p {
  font-size: 17px;
  max-width: 640px;
  margin: 0 auto;
  opacity: 0.95;
}

/* ==================== Survey Shell ==================== */
.survey-wrap {
  flex: 1;
  max-width: 720px;
  margin: -40px auto 60px;
  padding: 0 20px;
  width: 100%;
}

.progress-track {
  height: 8px;
  border-radius: 8px;
  background-color: var(--border-color);
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-fill {
  height: 100%;
  background-color: var(--accent);
  transition: width 0.35s ease;
  border-radius: 8px;
}

.progress-label {
  color: #d8f3dc;
  text-align: right;
  font-size: 13px;
  opacity: 0.7;
  margin-bottom: 24px;
}

.question-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 4px 20px var(--card-shadow);
  padding: 36px 34px;
}

.question-card.entering {
  animation: fadeSlide 0.3s ease;
}

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

.question-eyebrow {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-hover);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.question-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}

.question-required {
  font-size: 13px;
  opacity: 0.6;
  margin-bottom: 22px;
}

.question-required.optional { color: var(--accent-hover); opacity: 0.9; }

/* Options: multiple choice / checkbox */
.option-list { display: flex; flex-direction: column; gap: 12px; }

.option-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
  background-color: var(--section-bg);
}

.option-item:hover {
  border-color: var(--accent);
  transform: translateX(2px);
}

.option-item.selected {
  border-color: var(--accent);
  background-color: color-mix(in srgb, var(--accent) 12%, var(--card-bg));
}

.option-marker {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  border: 2px solid var(--border-color);
  transition: border-color 0.2s ease, background-color 0.2s ease;
  position: relative;
}

.option-marker.radio { border-radius: 50%; }
.option-marker.checkbox { border-radius: 5px; }

.option-item.selected .option-marker {
  border-color: var(--accent);
  background-color: var(--accent);
}

.option-item.selected .option-marker.radio::after {
  content: '';
  position: absolute;
  top: 5px; left: 5px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--card-bg);
}

.option-item.selected .option-marker.checkbox::after {
  content: '✓';
  position: absolute;
  top: -3px; left: 2px;
  font-size: 14px;
  color: var(--card-bg);
  font-weight: bold;
}

.option-text { font-size: 16px; }

/* Linear scale */
.scale-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-top: 10px;
}

.scale-point {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  flex: 1;
}

.scale-circle {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
  background-color: var(--section-bg);
}

.scale-point:hover .scale-circle { border-color: var(--accent); }

.scale-point.selected .scale-circle {
  background-color: var(--accent);
  border-color: var(--accent);
  color: #0b1f16;
}

.scale-caption {
  font-size: 12px;
  opacity: 0.7;
  text-align: center;
  max-width: 80px;
}

/* Grid question */
.grid-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 14px;
}

.grid-table th {
  font-weight: 600;
  padding: 8px 6px;
  text-align: center;
  opacity: 0.75;
  font-size: 13px;
}

.grid-table th:first-child { text-align: left; }

.grid-table td {
  padding: 12px 6px;
  text-align: center;
  border-top: 1px solid var(--border-color);
}

.grid-row-label {
  text-align: left !important;
  font-weight: 500;
  padding-right: 12px;
  max-width: 220px;
}

.grid-radio {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  margin: 0 auto;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
  position: relative;
  background-color: var(--section-bg);
}

.grid-radio:hover { border-color: var(--accent); }

.grid-radio.selected {
  border-color: var(--accent);
  background-color: var(--accent);
}

.grid-radio.selected::after {
  content: '';
  position: absolute;
  top: 5px; left: 5px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--card-bg);
}

/* Paragraph */
.paragraph-input {
  width: 100%;
  min-height: 130px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background-color: var(--section-bg);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.paragraph-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

/* Nav buttons */
.question-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 32px;
}

.btn {
  padding: 12px 26px;
  border-radius: 8px;
  border: none;
  font-weight: bold;
  cursor: pointer;
  font-size: 15px;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.btn-primary {
  background-color: var(--accent);
  color: #0b1f16;
}

.btn-primary:hover { background-color: var(--accent-hover); transform: translateY(-1px); }

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-ghost {
  background: none;
  color: var(--text);
  border: 1px solid var(--border-color);
}

.btn-ghost:hover { border-color: var(--accent); }

.validation-msg {
  color: var(--logout-red);
  font-size: 13px;
  margin-top: 14px;
  display: none;
}

.validation-msg.show { display: block; }

/* Review screen */
.review-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--border-color);
}

.review-item:last-child { border-bottom: none; }

.review-q {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
  opacity: 0.85;
}

.review-a {
  font-size: 15px;
  color: var(--accent-hover);
}

.review-a.empty { opacity: 0.5; font-style: italic; color: var(--text); }

/* Thank you screen */
.thankyou {
  text-align: center;
  padding: 40px 0;
}

.thankyou h2 { font-size: 26px; margin-bottom: 10px; }
.thankyou p { opacity: 0.8; }

/* Footer */
.footer {
  padding: 30px 20px;
  background-color: var(--footer-bg);
  color: var(--footer-text);
  text-align: center;
  font-size: 13px;
  opacity: 0.8;
}

@media (max-width: 600px) {
  .question-card { padding: 26px 20px; }
  .splash h1 { font-size: 30px; }
  .scale-caption { max-width: 50px; font-size: 10px; }
  .grid-table { font-size: 12px; }
}