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

:root {
  --bg: #f7f5f0;
  --surface: #ffffff;
  --text: #2c2a26;
  --muted: #6b6560;
  --border: #e2ddd4;
  --accent: #5c6b4a;
  --accent-hover: #4a5739;
  --accent-light: #eef2e8;
  --chart-grid: #e8e4dc;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(44, 42, 38, 0.06);
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
  height: 100%;
}

body {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1 0 auto;
}

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px;
}

.container-wide {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.logo {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

.nav { display: flex; gap: 20px; }

.nav-link {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

.nav-link:hover,
.nav-link.active { color: var(--accent); }

/* Hero */
.hero {
  padding: 56px 0 48px;
  text-align: center;
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
}

.hero .container {
  max-width: 36rem;
}

.eyebrow {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 12px;
}

.hero h1 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 600;
  margin-bottom: 12px;
}

.lead {
  font-size: 1.15rem;
  color: var(--muted);
  margin-bottom: 28px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 28px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background 0.15s, opacity 0.15s;
}

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

.btn-primary:hover { background: var(--accent-hover); color: #fff; }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
}

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

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Content */
.content-section { padding: 40px 0 64px; }

.prose h2 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.35rem;
  margin: 32px 0 12px;
}

.prose h2:first-child { margin-top: 0; }

.prose p { margin-bottom: 16px; color: var(--text); }

.callout {
  background: var(--accent-light);
  border-left: 3px solid var(--accent);
  padding: 16px 20px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 24px 0;
}

.callout p { margin: 0; }

.callout-warning {
  background: #fdf6e8;
  border-left-color: #c9a227;
}

.steps-list {
  margin: 0 0 16px 20px;
}

.steps-list li {
  margin-bottom: 10px;
}

.prose ul {
  margin: 0 0 16px 20px;
}

.prose ul li {
  margin-bottom: 8px;
}

.demographic-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px 16px;
}

.demographic-list li {
  margin: 0;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
}

.prose-tip {
  font-size: 0.9rem;
  color: var(--muted);
  font-style: italic;
  margin-bottom: 16px;
}

.source-note {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

/* Survey */
.survey-header {
  padding: 40px 0 24px;
}

.survey-header h1 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.75rem;
  margin-bottom: 8px;
}

.survey-header p { color: var(--muted); }

.progress-bar-wrap {
  background: var(--border);
  border-radius: 99px;
  height: 6px;
  margin: 24px 0 8px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.3s ease;
  width: 0%;
}

.progress-label {
  font-size: 0.8rem;
  color: var(--muted);
}

.survey-scale-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 28px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.survey-section-title {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.2rem;
  margin: 32px 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent-light);
}

.question-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.question-text {
  font-size: 0.95rem;
  margin-bottom: 14px;
  line-height: 1.5;
}

.likert-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.likert-option {
  flex: 1;
  min-width: 72px;
}

.likert-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.likert-option label {
  display: block;
  text-align: center;
  padding: 10px 6px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.78rem;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1.3;
}

.likert-option input:checked + label {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.likert-option label:hover {
  border-color: var(--accent);
}

.survey-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding: 32px 0 64px;
}

/* Score entry */
.score-entry-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  text-align: center;
}

.score-entry-section h2 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.1rem;
  margin-bottom: 20px;
}

.score-entry-form {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 20px;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}

.score-entry-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  width: 100%;
}

.score-entry-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
}

.score-entry-actions .btn {
  width: 100%;
}

.score-input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  min-width: 0;
  text-align: left;
}

.score-input-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.score-input-group input {
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  width: 100%;
}

.score-input-group input:focus {
  outline: none;
  border-color: var(--accent);
}

.score-entry-hint {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 18px auto 0;
  max-width: 720px;
  line-height: 1.5;
}

/* Results */
.results-header {
  padding: 40px 0 16px;
}

.results-header h1 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.75rem;
  margin-bottom: 8px;
}

.results-header p { color: var(--muted); }

.score-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 24px 0 32px;
}

.score-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  box-shadow: var(--shadow);
}

.score-card .label {
  font-size: 0.85rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.score-card .value {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--accent);
  line-height: 1;
}

.score-card-my .value {
  color: #6b7a52;
}

#visitor-score-card:not(.has-data) .value {
  color: var(--muted);
  font-size: 1.5rem;
}

.score-pair {
  display: flex;
  gap: 24px;
  justify-content: center;
  margin: 8px 0;
}

.score-dim {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 4px;
}

.score-card .range {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 6px;
}

.chart-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 32px;
  box-shadow: var(--shadow);
}

.chart-section h2 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.15rem;
  margin-bottom: 4px;
}

.chart-section .subtitle {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 20px;
}

.chart-wrap {
  position: relative;
  height: 420px;
}

.chart-source-note {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 14px;
  text-align: center;
  font-style: italic;
}

.compare-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 48px;
  box-shadow: var(--shadow);
}

.compare-section h2 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.15rem;
  margin-bottom: 8px;
}

.compare-intro {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 20px;
}

.demographic-groups {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  line-height: 1.4;
}

.demographic-category {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  max-width: 100%;
}

.demographic-category h3 {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 0;
  padding: 8px 10px 8px 0;
  white-space: nowrap;
  flex-shrink: 0;
}

.demographic-category:not(:first-child) h3 {
  padding-left: 10px;
  border-left: 1px solid var(--border);
  margin-left: 2px;
}

.checkbox-list {
  list-style: none;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  margin: 0;
  padding: 0;
}

.checkbox-list li {
  display: inline-flex;
}

.checkbox-list label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  cursor: pointer;
  padding: 7px 10px;
  margin: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  white-space: nowrap;
}

.checkbox-list li + li label {
  border-left: none;
}

.checkbox-list label:has(input:checked) {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent-hover);
  font-weight: 600;
  z-index: 1;
  position: relative;
}

.checkbox-list label:hover {
  background: var(--accent-light);
}

.checkbox-list input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.selection-hint {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-style: italic;
}

.filtered-result {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--accent-light);
  border-radius: var(--radius);
  font-size: 0.9rem;
  display: none;
}

.filtered-result.visible { display: block; }

/* Footer */
.site-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  padding: 24px 0;
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
  background: var(--bg);
}

@media (max-width: 640px) {
  .container,
  .container-wide { padding: 0 16px; }

  .header-inner {
    flex-direction: column;
    align-items: stretch;
    height: auto;
    padding: 10px 0;
    gap: 8px;
  }

  .logo {
    text-align: center;
    font-size: 1.05rem;
  }

  .nav {
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 12px;
  }

  .nav-link { font-size: 0.8rem; }

  .hero {
    padding: 24px 0 28px;
    min-height: calc(100svh - 5.5rem);
    display: flex;
    align-items: center;
  }

  .hero h1 {
    font-size: 1.6rem;
    line-height: 1.2;
    margin-bottom: 10px;
    overflow-wrap: anywhere;
  }

  .lead {
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 18px;
    overflow-wrap: anywhere;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-actions .btn {
    width: 100%;
    padding: 11px 20px;
    font-size: 0.9rem;
  }

  .score-entry-section { padding: 22px 16px; }

  .score-entry-fields,
  .score-entry-actions {
    grid-template-columns: 1fr;
  }

  .demographic-category {
    flex-basis: 100%;
  }

  .demographic-category:not(:first-child) h3 {
    padding-left: 0;
    border-left: none;
    margin-left: 0;
    padding-top: 10px;
  }

  .checkbox-list label {
    white-space: normal;
  }

  .score-summary { grid-template-columns: 1fr; }
  .chart-wrap { height: 340px; }
  .likert-option { min-width: 100%; }
  .survey-actions { flex-direction: column; }
  .survey-actions .btn { width: 100%; }
}
