#app {
  --font-sans: "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: "Libre Baskerville", Georgia, serif;
  --page-bg: #f5f5f5;
  --surface: #ffffff;
  --surface-muted: #f5f5f5;
  --surface-subtle: #fafafa;
  --text-main: #1a1a1a;
  --text-muted: #666666;
  --text-soft: #5f5f5f;
  --border: #dddddd;
  --line: #e7e7e7;
  --primary: #1a1a1a;
  --primary-soft: #f5f5f5;
  --success: #2b6b55;
  --warning: #8a5a1f;
  --danger: #9d3b32;
  --radius-lg: 0.5rem;
  --radius-md: 0.5rem;
  --radius-sm: 10px;
  --shadow: none;
}

#app,
#app * {
  box-sizing: border-box;
}

#app {
  font-family: var(--font-sans);
  color: var(--text-main);
}

#app .page-shell {
  width: 100%;
  margin: 0;
  padding: 0;
}

#app .layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
}

#app .card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 32px;
}

#app .hero-card {
  padding: 40px;
}

#app .eyebrow {
  display: inline-block;
  margin-bottom: 14px;
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 700;
}

#app .hero-title,
#app .section-title,
#app .result-score {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 700;
  letter-spacing: -0.02em;
}

#app .hero-title {
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.12;
}

#app .hero-copy,
#app .intro-copy,
#app .question-copy,
#app .body-copy,
#app .support-copy,
#app .result-copy,
#app .field-note,
#app .bullet-list li {
  color: var(--text-muted);
  line-height: 1.7;
  font-size: 17px;
}

#app .hero-copy,
#app .intro-copy,
#app .body-copy,
#app .support-copy,
#app .result-copy {
  margin: 0 0 28px;
}

#app .hero-grid,
#app .lead-grid,
#app .result-grid,
#app .preview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 32px;
}

#app .stats-grid,
#app .mini-grid,
#app .metric-grid,
#app .preview-metrics,
#app .score-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

#app .stat-box,
#app .mini-card,
#app .metric-card,
#app .preview-card,
#app .score-card,
#app .locked-panel,
#app .cta-panel,
#app .side-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  padding: 20px;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

#app .stat-number,
#app .metric-value,
#app .preview-value,
#app .score-value,
#app .result-score {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4vw, 3.3rem);
  line-height: 1;
  color: var(--primary);
  font-weight: 700;
  overflow-wrap: anywhere;
  word-break: break-word;
}

#app .preview-value.value-text,
#app .score-value.value-text {
  font-size: clamp(1.35rem, 2.35vw, 1.8rem);
  line-height: 1.2;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}

#app .stat-label,
#app .metric-label,
#app .preview-label,
#app .score-label {
  display: block;
  margin-top: 8px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-word;
}

#app .preview-card,
#app .mini-card,
#app .score-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

#app .bullet-list {
  margin: 18px 0 0;
  padding-left: 20px;
}

#app .btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

#app .btn {
  display: inline-block;
  padding: 0.75rem 1.25rem;
  min-height: 48px;
  font-size: 0.8rem;
  line-height: 1.2;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  appearance: none;
  border: 1px solid transparent;
  border-radius: 0;
  cursor: pointer;
  transition: opacity 0.2s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

#app .btn:hover {
  opacity: 0.85;
  transform: none;
}

#app .btn-primary {
  background: var(--text-main);
  color: #ffffff;
}

#app .btn-primary:hover {
  background: var(--text-main);
  color: #ffffff;
}

#app .btn-secondary {
  background: transparent;
  color: var(--text-main);
  border-color: var(--border);
}

#app .btn-secondary:hover {
  border-color: var(--text-main);
}

#app .btn-light {
  background: var(--primary-soft);
  color: var(--text-main);
}

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

#app button,
#app input,
#app select,
#app textarea {
  font: inherit;
}

#app a {
  color: inherit;
}

#app .progress-card {
  padding: 22px 24px;
  margin-bottom: 20px;
}

#app .progress-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  color: var(--text-muted);
  font-size: 14px;
}

#app .progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-muted);
  overflow: hidden;
}

#app .progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

#app .step-label {
  margin: 0 0 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 12px;
  font-weight: 700;
}

#app .question-title {
  margin: 0 0 12px;
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  line-height: 1.2;
}

#app .question-meta,
#app .section-kicker,
#app .detail-kicker {
  color: var(--text-muted);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 700;
}

#app .answer-list {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

#app .answer-btn,
#app .scale-row button {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #ffffff;
  color: var(--text-main);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

#app .answer-btn {
  display: flex;
  gap: 14px;
  padding: 16px 18px;
  align-items: flex-start;
}

#app .answer-btn:hover,
#app .scale-row button:hover {
  border-color: #aeaea5;
  transform: translateY(-1px);
}

#app .answer-btn.active,
#app .scale-row button.active {
  border-color: var(--primary);
  background: var(--surface-muted);
}

#app .answer-index {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-muted);
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

#app .answer-btn.active .answer-index,
#app .scale-row button.active .answer-index {
  background: #ffffff;
}

#app .toggle-link {
  display: inline-flex;
  margin-top: 18px;
  background: none;
  border: 0;
  padding: 0;
  color: var(--text-main);
  cursor: pointer;
  font-weight: 600;
}

#app .explanation-box {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
  color: var(--text-muted);
  line-height: 1.75;
}

#app .explanation-box p {
  margin: 0 0 12px;
}

#app .explanation-box ul {
  margin: 12px 0 0;
  padding-left: 18px;
}

#app .category-stack {
  display: grid;
  gap: 18px;
  margin-top: 28px;
}

#app .scale-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px;
  background: var(--surface-subtle);
}

#app .scale-card h4 {
  margin: 0 0 8px;
  font-size: 18px;
}

#app .scale-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

#app .scale-row button {
  padding: 13px 0;
  text-align: center;
  font-weight: 700;
}

#app .scale-caption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  color: var(--text-soft);
  font-size: 12px;
}

#app .info-banner,
#app .success-banner,
#app .error-banner {
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-top: 18px;
  line-height: 1.65;
}

#app .info-banner {
  background: var(--surface-muted);
  border: 1px solid var(--line);
  color: var(--text-main);
}

#app .success-banner {
  background: #eef5f1;
  border: 1px solid #c6ddd2;
  color: var(--success);
}

#app .error-banner {
  background: #f9efed;
  border: 1px solid #e7cbc6;
  color: var(--danger);
}

#app .locked-panel {
  position: relative;
  overflow: hidden;
  background: var(--surface-muted);
}

#app .locked-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  backdrop-filter: blur(4px);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(245, 245, 245, 0.72));
  pointer-events: none;
}

#app .locked-content {
  filter: blur(5px);
  opacity: 0.5;
}

#app .locked-note {
  position: absolute;
  inset: auto 18px 18px 18px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(26, 26, 26, 0.96);
  color: #ffffff;
  z-index: 1;
}

#app .form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 24px;
}

#app .field {
  display: grid;
  gap: 6px;
}

#app .field.full {
  grid-column: 1 / -1;
}

#app .field label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
}

#app .field input,
#app .field select {
  width: 100%;
  border: 1px solid var(--border);
  background: #ffffff;
  border-radius: 0.5rem;
  min-height: 48px;
  padding: 0 14px;
  color: var(--text-main);
}

#app .field input:focus,
#app .field select:focus {
  outline: none;
  border-color: #676760;
}

#app .field.error input,
#app .field.error select {
  border-color: var(--danger);
  background: #fcf4f3;
}

#app .checkbox-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 18px;
  color: var(--text-muted);
  font-size: 14px;
}

#app .checkbox-row input {
  margin-top: 4px;
}

#app .divider {
  height: 1px;
  background: var(--line);
  margin: 28px 0;
}

#app .result-score {
  font-size: clamp(2.8rem, 6vw, 4.8rem);
}

#app .score-suffix {
  color: var(--text-muted);
  font-size: 0.45em;
  white-space: nowrap;
}

#app .tier-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text-main);
  font-size: 13px;
  font-weight: 700;
}

#app .detail-table,
#app .bar-list,
#app .summary-list {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

#app .detail-row,
#app .bar-row,
#app .summary-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.2fr) minmax(0, 2fr) 72px;
  gap: 12px;
  align-items: center;
}

#app .detail-row strong,
#app .summary-row strong {
  font-size: 14px;
  color: var(--text-main);
}

#app .track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: var(--surface-muted);
  overflow: hidden;
}

#app .track > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

#app .detail-score {
  text-align: right;
  font-weight: 700;
  color: var(--text-main);
}

#app .matrix {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: 18px;
}

#app .matrix-cell {
  min-height: 120px;
  padding: 18px;
  border-right: 1px solid rgba(17, 17, 17, 0.06);
  border-bottom: 1px solid rgba(17, 17, 17, 0.06);
  position: relative;
}

#app .matrix-cell:nth-child(2n) {
  border-right: 0;
}

#app .matrix-cell:nth-last-child(-n + 2) {
  border-bottom: 0;
}

#app .matrix-label {
  font-size: 13px;
  color: var(--text-muted);
}

#app .matrix-value {
  margin-top: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
}

#app .matrix-point {
  display: inline-flex;
  margin-top: 14px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(26, 26, 26, 0.08);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
}

#app .footer-note {
  margin-top: 26px;
  color: var(--text-soft);
  font-size: 13px;
}

#app .side-panel {
  background: #1a1a1a;
  color: #f4f4ef;
  border-color: #1a1a1a;
}

#app .side-panel .score-value,
#app .side-panel .preview-value,
#app .side-panel .result-score,
#app .side-panel .tier-pill {
  color: #f4f4ef;
}

#app .side-panel .score-suffix {
  color: #9ca3af;
}

#app .side-panel .mini-card,
#app .side-panel .preview-card {
  background: #ffffff;
  color: #1a1a1a;
  border-color: #dddddd;
}

#app .side-panel .mini-card .score-value,
#app .side-panel .mini-card .preview-value,
#app .side-panel .preview-card .score-value,
#app .side-panel .preview-card .preview-value {
  color: #1a1a1a;
  font-size: 2.2rem;
  line-height: 1.05;
}

#app .side-panel .mini-card .score-value.value-text,
#app .side-panel .mini-card .preview-value.value-text,
#app .side-panel .preview-card .score-value.value-text,
#app .side-panel .preview-card .preview-value.value-text {
  font-size: 1.2rem;
  line-height: 1.1;
}

#app .side-panel .mini-card .score-label,
#app .side-panel .mini-card .preview-label,
#app .side-panel .preview-card .score-label,
#app .side-panel .preview-card .preview-label {
  color: #666666;
  font-size: 11px;
  line-height: 1.35;
  letter-spacing: 0.05em;
}

#app .side-panel .mini-card .score-suffix,
#app .side-panel .preview-card .score-suffix {
  color: #9ca3af;
}

#app .side-panel .eyebrow,
#app .side-panel .meta-note,
#app .side-panel .field-note,
#app .side-panel .stat-label,
#app .side-panel .body-copy,
#app .side-panel .score-label,
#app .side-panel .preview-label,
#app .side-panel .mini-card .score-label,
#app .side-panel .mini-card .preview-label,
#app .side-panel .bullet-list li,
#app .side-panel ul li,
#app .side-panel ol li,
#app .side-panel p {
  color: #9ca3af;
}

#app .side-panel a {
  color: #ffffff;
}

#app .side-panel .track {
  background: rgba(255, 255, 255, 0.12);
}

#app .side-panel .track > span {
  background: linear-gradient(90deg, #ffffff 0%, #d7d7d1 100%);
}

#app .side-panel .btn-secondary {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.24);
}

#app .side-panel .btn-secondary:hover {
  border-color: rgba(255, 255, 255, 0.42);
}

#app .result-stack {
  display: grid;
  gap: 24px;
}

#app .result-heading {
  text-align: center;
  padding-top: 8px;
}

#app .wai-hero-card {
  text-align: center;
}

#app .wai-hero-score {
  max-width: 620px;
  margin: 0 auto;
}

#app .wai-position {
  margin: 16px auto 0;
  max-width: 520px;
}

#app .bar-list {
  display: grid;
  gap: 16px;
}

#app .bar-item {
  display: grid;
  gap: 8px;
}

#app .bar-item-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--text-soft);
  font-size: 15px;
  line-height: 1.4;
}

#app .bar-item-row span:last-child {
  color: var(--text-main);
  font-weight: 700;
}

#app .bar-track {
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: #e8edf3;
}

#app .bar-fill {
  height: 100%;
  border-radius: 999px;
}

#app .tier-overview {
  display: grid;
  gap: 12px;
}

#app .scenario-card,
#app .wai-hero-card {
  position: relative;
  border-left: 0;
  box-shadow: none;
  overflow: visible;
}

#app .scenario-card::before,
#app .wai-hero-card::before {
  content: "";
  position: absolute;
  top: -1px;
  bottom: -1px;
  left: 0;
  width: 4px;
  background: var(--accent, var(--primary));
  border-radius: 0;
}

#app .tier-row {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

#app .tier-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

#app .tier-label {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 700;
  color: var(--text-main);
}

#app .tier-range {
  flex: 0 0 auto;
  white-space: nowrap;
  font-weight: 600;
  color: var(--text-soft);
}

#app .tier-pos {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
}

#app .preview-value,
#app .score-value {
  overflow-wrap: normal;
  word-break: normal;
}

#app .side-panel .mini-card,
#app .side-panel .preview-card {
  align-items: flex-start;
}

#app .side-panel .mini-card .score-value,
#app .side-panel .mini-card .preview-value,
#app .side-panel .preview-card .score-value,
#app .side-panel .preview-card .preview-value {
  font-size: 2.2rem;
  line-height: 1.15;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}

#app .side-panel .mini-card .score-value.value-text,
#app .side-panel .mini-card .preview-value.value-text,
#app .side-panel .preview-card .score-value.value-text,
#app .side-panel .preview-card .preview-value.value-text {
  font-size: 1.2rem;
}

#app .toggle-link {
  display: inline-flex;
  margin-top: 18px;
  background: none;
  border: 0;
  padding: 0;
  color: #2f66e0;
  cursor: pointer;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 900px) {
  #app .hero-grid,
  #app .lead-grid,
  #app .result-grid,
  #app .preview-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  #app .stats-grid,
  #app .mini-grid,
  #app .metric-grid,
  #app .preview-metrics,
  #app .score-grid,
  #app .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 720px) {
  #app .page-shell {
    width: 100%;
    padding: 0;
  }

  #app .card,
  #app .hero-card {
    padding: 24px 18px;
    border-radius: 0.5rem;
  }

  #app .detail-row,
  #app .bar-row,
  #app .summary-row {
    grid-template-columns: minmax(0, 1fr);
  }

  #app .detail-score {
    text-align: left;
  }

  #app .scale-row {
    grid-template-columns: repeat(5, minmax(44px, 1fr));
  }

  #app .matrix {
    grid-template-columns: minmax(0, 1fr);
  }

  #app .matrix-cell {
    border-right: 0;
  }

  #app .matrix-cell:nth-last-child(-n + 2) {
    border-bottom: 1px solid rgba(17, 17, 17, 0.06);
  }

  #app .matrix-cell:last-child {
    border-bottom: 0;
  }
}
