:root {
  --green: #2e7d32;
  --green-dark: #1b5e20;
  --ink: #1f2933;
  --muted: #6b7280;
  --line: #d8dee9;
  --bg: #f5f7fa;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Sarabun", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
}

.app-header {
  background: linear-gradient(135deg, var(--green) 0%, var(--green-dark) 100%);
  color: #fff;
  padding: 28px 20px;
  text-align: center;
}
.app-header h1 { margin: 0 0 6px; font-size: 1.45rem; }
.subtitle { margin: 0; opacity: 0.9; }

main {
  max-width: 720px;
  margin: 28px auto;
  padding: 0 20px 60px;
}

.question-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  animation: slideIn 0.25s ease;
}
.question-card.is-followup {
  border-left: 4px solid var(--green);
  background: #f3faf3;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.question-title {
  font-weight: 600;
  margin: 0 0 12px;
  display: flex;
  gap: 8px;
}
.question-title .q-index {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.options { display: grid; gap: 8px; }
.option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.option:hover { border-color: var(--green); }
.option input { accent-color: var(--green); }
.option.is-selected { border-color: var(--green); background: #eef7ee; }

.text-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}

.actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 8px;
}
.btn {
  font: inherit;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--line); }

.progress { color: var(--muted); margin-top: 14px; text-align: right; }

/* toast */
#toast-region {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  z-index: 50;
}
.toast {
  background: var(--green-dark);
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
  animation: toastIn 0.2s ease;
}
.toast.is-error { background: #b3261e; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* overlay สั้น ๆ ที่บัง UI ระหว่าง "บันทึก" (จำลอง loading) */
.saving-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.55);
  display: grid;
  place-items: center;
  z-index: 40;
  font-weight: 600;
  color: var(--green-dark);
}

.done-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px;
  text-align: center;
}
.done-panel h2 { color: var(--green-dark); margin-top: 0; }
