:root {
  color-scheme: light;
  --ink: #182126;
  --muted: #607078;
  --line: #d9e1df;
  --paper: #f7fbfa;
  --surface: #ffffff;
  --teal: #16776f;
  --teal-dark: #0d5c55;
  --coral: #cf654d;
  --gold: #c99a36;
  --violet: #6062a8;
  --shadow: 0 18px 60px rgba(24, 33, 38, 0.11);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    linear-gradient(125deg, rgba(22, 119, 111, 0.14), rgba(247, 251, 250, 0) 42%),
    linear-gradient(315deg, rgba(207, 101, 77, 0.14), rgba(247, 251, 250, 0) 48%),
    var(--paper);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

button,
input,
textarea {
  font: inherit;
}

.tdah-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 54px;
}

.brand-link,
.repo-link,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-weight: 800;
  text-decoration: none;
}

.brand-link {
  gap: 10px;
}

.brand-link img {
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.repo-link {
  min-height: 40px;
  border: 1px solid var(--line);
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.72);
}

.hero {
  padding: 22px 0 18px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.45fr);
  gap: 22px;
  align-items: end;
  margin-top: 34px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--teal-dark);
  font-size: 0.75rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 18px;
  font-size: 4.8rem;
  line-height: 0.96;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.45rem;
  line-height: 1.15;
  letter-spacing: 0;
}

.lede {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.12rem;
  line-height: 1.6;
}

.safety-card,
.assessment-panel,
.result-card,
.summary-card,
.sources-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 14px 42px rgba(24, 33, 38, 0.06);
}

.safety-card {
  padding: 20px;
  border-color: rgba(207, 101, 77, 0.35);
}

.safety-card strong {
  display: block;
  margin-bottom: 8px;
  color: var(--coral);
}

.safety-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.assessment-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(330px, 0.85fr);
  gap: 18px;
  align-items: start;
  margin-top: 18px;
}

.assessment-panel {
  padding: 24px;
}

.section-heading {
  margin-bottom: 18px;
}

.section-heading.compact {
  margin-top: 30px;
}

.question-row {
  display: grid;
  gap: 10px;
}

.scale-head {
  display: none;
}

.question-list {
  display: grid;
  gap: 10px;
}

.question-row {
  min-height: 66px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
}

.scale-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.question-text {
  color: var(--ink);
  font-weight: 760;
  line-height: 1.35;
}

.scale-option {
  display: grid;
  grid-template-columns: 20px 1fr;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  cursor: pointer;
}

.scale-option::after {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 760;
  content: attr(data-label);
}

.scale-option input {
  width: 20px;
  height: 20px;
  accent-color: var(--teal);
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.choice-grid label {
  display: flex;
  min-height: 54px;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 720;
  line-height: 1.25;
}

.choice-grid input {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  accent-color: var(--teal);
}

.notes-label {
  display: block;
  margin: 30px 0 10px;
  font-weight: 820;
}

textarea {
  display: block;
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface);
  color: var(--ink);
  line-height: 1.5;
}

textarea:focus,
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(96, 98, 168, 0.28);
  outline-offset: 2px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.button {
  min-height: 44px;
  border: 1px solid var(--line);
  padding: 0 16px;
  cursor: pointer;
}

.button.primary {
  border-color: var(--teal);
  background: var(--teal);
  color: #ffffff;
}

.button.ghost {
  background: var(--surface);
  color: var(--teal-dark);
}

.result-panel {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 14px;
}

.result-card,
.summary-card,
.sources-card {
  padding: 22px;
}

.result-card p {
  color: var(--muted);
  line-height: 1.55;
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0;
}

.insight-grid article {
  min-height: 82px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
}

.insight-grid span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 850;
}

.insight-grid strong {
  display: block;
  font-size: 0.98rem;
  line-height: 1.22;
}

.meter {
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: #e7eceb;
}

.meter span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--gold), var(--coral));
  transition: width 180ms ease;
}

.summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.icon-button {
  display: inline-grid;
  width: 46px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--teal);
  border-radius: 8px;
  background: var(--surface);
  color: var(--teal-dark);
  cursor: pointer;
}

.copy-icon {
  position: relative;
  display: block;
  width: 19px;
  height: 19px;
}

.copy-icon::before,
.copy-icon::after {
  position: absolute;
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-radius: 3px;
  content: "";
}

.copy-icon::before {
  inset: 1px auto auto 5px;
}

.copy-icon::after {
  inset: 5px auto auto 1px;
  background: var(--surface);
}

pre {
  min-height: 220px;
  max-height: 520px;
  overflow: auto;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #132024;
  color: #e9fff8;
  font: 0.9rem ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  line-height: 1.5;
  white-space: pre-wrap;
}

.copy-status {
  min-height: 22px;
  margin: 10px 0 0;
  color: var(--muted);
}

.sources-card {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sources-card .eyebrow {
  flex-basis: 100%;
}

.sources-card a {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--surface);
  color: var(--teal-dark);
  font-weight: 800;
  text-decoration: none;
}

@media (max-width: 920px) {
  .hero-grid,
  .assessment-grid {
    grid-template-columns: 1fr;
  }

  .result-panel {
    position: static;
  }

  .scale-head {
    display: none;
  }

  .scale-options {
    grid-template-columns: 1fr;
  }

  .insight-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .tdah-shell {
    width: min(100% - 24px, 680px);
    padding: 18px 0 34px;
  }

  .topbar {
    align-items: flex-start;
  }

  h1 {
    font-size: 3.15rem;
  }

  .assessment-panel,
  .result-card,
  .summary-card,
  .sources-card,
  .safety-card {
    padding: 18px;
  }

  .choice-grid {
    grid-template-columns: 1fr;
  }

  .form-actions {
    display: grid;
  }

  .button {
    width: 100%;
  }
}
