@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface2: #1c2230;
  --border: #2d3748;
  --accent: #4f8ef7;
  --accent2: #7c3aed;
  --accent-glow: rgba(79,142,247,0.18);
  --text: #e2e8f0;
  --muted: #8892a4;
  --success: #22c55e;
  --error: #ef4444;
  --section-a: #4f8ef7;
  --section-b: #7c3aed;
  --section-c: #10b981;
  --section-d: #f59e0b;
  --section-e: #ef4444;
  --section-f: #ec4899;
  --section-g: #06b6d4;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 60px;
}

/* ── Header ── */
header {
  background: linear-gradient(135deg, #0d1117 0%, #161b22 100%);
  border-bottom: 1px solid var(--border);
  padding: 18px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-left { display: flex; align-items: center; gap: 12px; }

.logo-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}

.header-title h1 {
  font-size: 15px; font-weight: 700; color: var(--text);
  line-height: 1.2;
}
.header-title p { font-size: 12px; color: var(--muted); }

.counter-badge {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  color: var(--muted);
  display: flex; align-items: center; gap: 6px;
}
.counter-badge span { font-weight: 700; color: var(--accent); font-size: 15px; }

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* ── Main layout ── */
main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 28px 16px;
}

/* ── Section block ── */
.section-block {
  margin-bottom: 28px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
}

.section-header {
  padding: 12px 20px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-header .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.section-a .section-header { background: rgba(79,142,247,0.12); color: var(--section-a); }
.section-b .section-header { background: rgba(124,58,237,0.12); color: var(--section-b); }
.section-c .section-header { background: rgba(16,185,129,0.12); color: var(--section-c); }
.section-d .section-header { background: rgba(245,158,11,0.12); color: var(--section-d); }
.section-e .section-header { background: rgba(239,68,68,0.12); color: var(--section-e); }
.section-f .section-header { background: rgba(236,72,153,0.12); color: var(--section-f); }
.section-g .section-header { background: rgba(6,182,212,0.12); color: var(--section-g); }

/* ── Question rows ── */
.question-row {
  display: grid;
  grid-template-columns: 320px 1fr;
  border-top: 1px solid var(--border);
  transition: background 0.15s;
}
.question-row:first-of-type { border-top: none; }
.question-row:hover { background: var(--surface2); }

.question-cell {
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-right: 1px solid var(--border);
}

.q-num {
  flex-shrink: 0;
  width: 26px; height: 26px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}

.section-a .q-num { background: var(--section-a); }
.section-b .q-num { background: var(--section-b); }
.section-c .q-num { background: var(--section-c); }
.section-d .q-num { background: var(--section-d); }
.section-e .q-num { background: var(--section-e); }
.section-f .q-num { background: var(--section-f); }
.section-g .q-num { background: var(--section-g); }

.q-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.45;
}

.answers-cell {
  padding: 12px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* ── Age input ── */
.age-input {
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  width: 100px;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.age-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ── Radio / Checkbox pills ── */
.choice-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--surface2);
  cursor: pointer;
  font-size: 12.5px;
  color: var(--muted);
  transition: all 0.15s ease;
  user-select: none;
  white-space: nowrap;
}

.choice-label:hover {
  border-color: var(--accent);
  color: var(--text);
  background: var(--accent-glow);
}

.choice-label input[type="radio"],
.choice-label input[type="checkbox"] {
  display: none;
}

.choice-label.selected {
  border-color: var(--accent);
  background: rgba(79,142,247,0.15);
  color: var(--accent);
  font-weight: 600;
}

/* Section-specific accent colors for selected state */
.section-b .choice-label.selected { border-color: var(--section-b); background: rgba(124,58,237,0.15); color: var(--section-b); }
.section-c .choice-label.selected { border-color: var(--section-c); background: rgba(16,185,129,0.15); color: var(--section-c); }
.section-d .choice-label.selected { border-color: var(--section-d); background: rgba(245,158,11,0.15); color: var(--section-d); }
.section-e .choice-label.selected { border-color: var(--section-e); background: rgba(239,68,68,0.15); color: var(--section-e); }
.section-f .choice-label.selected { border-color: var(--section-f); background: rgba(236,72,153,0.15); color: var(--section-f); }
.section-g .choice-label.selected { border-color: var(--section-g); background: rgba(6,182,212,0.15); color: var(--section-g); }

.choice-label .check-icon {
  font-size: 11px;
  opacity: 0;
  transition: opacity 0.15s;
}
.choice-label.selected .check-icon { opacity: 1; }

/* ── "Other" text input ── */
.other-input {
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 12.5px;
  outline: none;
  min-width: 180px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.other-input:focus {
  border-color: var(--section-g);
  box-shadow: 0 0 0 3px rgba(6,182,212,0.15);
}
.other-input::placeholder { color: var(--muted); }

/* ── Submit button ── */
.submit-wrap {
  display: flex;
  justify-content: center;
  padding: 10px 0 30px;
}

.submit-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 14px 52px;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
  box-shadow: 0 4px 24px rgba(79,142,247,0.3);
}
.submit-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(79,142,247,0.45); }
.submit-btn:active { transform: translateY(0); }
.submit-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ── Toast ── */
#toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  padding: 14px 28px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  z-index: 999;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.35s;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}
#toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
#toast.success { background: linear-gradient(135deg, #16a34a, #15803d); box-shadow: 0 8px 30px rgba(22,163,74,0.4); }
#toast.error { background: linear-gradient(135deg, #dc2626, #b91c1c); box-shadow: 0 8px 30px rgba(220,38,38,0.4); }

/* ── Required highlight ── */
.question-row.missing .question-cell { background: rgba(239,68,68,0.07); }
.question-row.missing .q-text { color: #fca5a5; }

/* ── Logout button ── */
.logout-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 14px;
  color: var(--muted);
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.logout-btn:hover {
  border-color: var(--error);
  color: var(--error);
  background: rgba(239,68,68,0.08);
}

/* ── Responsive / Mobile ── */
@media (max-width: 700px) {
  /* Header */
  header {
    flex-wrap: wrap;
    padding: 12px 16px;
    gap: 10px;
  }
  .header-title h1 { font-size: 13px; }
  .header-title p  { font-size: 11px; }
  .counter-badge   { font-size: 12px; padding: 5px 10px; }

  /* Main */
  main { padding: 16px 10px; }
  .section-block { border-radius: 10px; }
  .section-header { font-size: 11px; padding: 10px 14px; }

  /* Question rows — stack vertically */
  .question-row {
    grid-template-columns: 1fr;
  }
  .question-cell {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 12px 14px;
  }
  .q-text { font-size: 13.5px; }

  /* Choices — larger tap targets */
  .answers-cell {
    padding: 12px 14px;
    gap: 8px;
    flex-wrap: wrap;
  }
  .choice-label {
    min-height: 44px;
    padding: 8px 14px;
    font-size: 13.5px;
    flex: 1 1 calc(50% - 8px);
    justify-content: center;
    text-align: center;
    white-space: normal;
  }

  /* Age input */
  .age-input {
    width: 120px;
    font-size: 16px; /* prevents iOS zoom */
    padding: 12px 14px;
    min-height: 44px;
  }

  /* Other text inputs */
  .other-input {
    width: 100%;
    min-height: 44px;
    font-size: 15px;
    padding: 10px 14px;
  }

  /* Submit button */
  .submit-btn {
    width: 100%;
    padding: 16px;
    font-size: 16px;
    border-radius: 14px;
  }

  /* Toast */
  #toast {
    width: calc(100% - 32px);
    white-space: normal;
    text-align: center;
    bottom: 16px;
  }
}
