@font-face {
  font-display: swap;
  font-family: Montserrat;
  font-style: normal;
  font-weight: 400;
  src: url("fonts/Montserrat-Regular.woff2") format("woff2");
}

@font-face {
  font-display: swap;
  font-family: Montserrat;
  font-style: normal;
  font-weight: 700;
  src: url("fonts/Montserrat-Bold.woff2") format("woff2");
}

@font-face {
  font-display: swap;
  font-family: Montserrat;
  font-style: normal;
  font-weight: 800;
  src: url("fonts/Montserrat-ExtraBold.woff2") format("woff2");
}

:root {
  /* Palette per brand_context/DESIGN.md. Pink is the default button, blue is
     hover/focus, yellow is the inline-link highlighter. The greens and red are
     diagram-only and must never be used as UI surface, button or text colour,
     so the accent is pink rather than the green this file previously used. */
  --brand-blue: #25b9d5;
  --brand-pink: #ff66a9;
  --brand-pink-wash: #fff5f9;
  --brand-yellow: #ffff00;
  --brand-light-grey: #f2f2f2;
  --brand-mid-grey: #dfdfdf;
  --diagram-red: #e92102;
  --diagram-green: #3eae07;
  --diagram-green-deep: #38761d;
  --bg: #f2f2f2;
  --fg: #212121;
  --ink: #000000;
  --muted: #666666;
  --panel: #ffffff;
  --border: #dfdfdf;
  --accent: #ff66a9;
  --accent-hover: #25b9d5;
  --highlight: #ffff00;
  --danger: #e92102;
  --radius-pill: 2rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --fg: #ffffff;
    --ink: #ffffff;
    --muted: #a6a6a6;
    --panel: #212121;
    --border: #666666;
    --accent: #ff66a9;
    --accent-hover: #25b9d5;
    --highlight: #ffff00;
    --danger: #e92102;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 Montserrat, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

.topbar {
  align-items: center;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  padding: 18px 28px;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin: 0 0 4px;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  line-height: 1.1;
  margin: 0 0 14px;
}

/* ExtraBold display weight, per the brand type scale. */
h1,
h2 {
  font-weight: 800;
}

h3,
h4 {
  font-weight: 700;
}

main {
  margin: 0 auto;
  max-width: 1180px;
  padding: 28px;
}

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

button {
  background: var(--accent);
  border: 0;
  border-radius: var(--radius-pill);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  padding: 0.667em 1.333em;
  transition: background-color 0.15s ease-out;
}

button:hover,
button:focus-visible {
  background: var(--accent-hover);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--highlight);
  outline-offset: 3px;
}

button[hidden],
[hidden] {
  display: none !important;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 20px;
}

.danger {
  border-color: var(--danger);
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.tabs button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg);
}

.tabs button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.toolbar,
.session-actions,
.version-grid,
.admin-form {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-form {
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
  padding-bottom: 14px;
}

.admin-form label {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  gap: 4px;
  min-width: 180px;
  text-transform: uppercase;
}

.admin-form input,
.admin-form select {
  min-height: 36px;
}

.checkbox-label {
  align-items: center;
  display: flex !important;
  gap: 6px !important;
  min-width: auto !important;
}

table {
  border-collapse: collapse;
  width: 100%;
}

th,
td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.question {
  border-bottom: 1px solid var(--border);
  display: block;
  padding: 14px 0;
}

.question span,
legend {
  display: block;
  font-weight: 700;
  margin-bottom: 8px;
}

/* Context under a question title. Overrides the bold weight .question span
   sets, so the hint reads as secondary to the question itself. */
.question .question-description {
  color: var(--muted);
  font-weight: 400;
  margin-bottom: 8px;
}

.question .question-error {
  color: var(--brand-pink);
  font-weight: 700;
  margin: 6px 0 0;
}

.question .question-error[hidden] {
  display: none;
}

.question.is-invalid textarea {
  border-color: var(--brand-pink);
}

.question input[type="range"] {
  accent-color: var(--accent);
  width: min(320px, 100%);
}

.question input[type="range"]:focus-visible {
  outline: 3px solid var(--highlight);
  outline-offset: 3px;
}

.slider-scale {
  color: var(--muted);
  display: flex;
  font-size: 12px;
  font-weight: 700;
  justify-content: space-between;
  margin-top: 4px;
  width: min(320px, 100%);
}

.survey-static h1,
.survey-static h2,
.survey-static h3 {
  color: var(--accent) !important;
}

.survey-page {
  border-top: 4px solid var(--accent);
  margin-bottom: 28px;
  padding-top: 18px;
}

.survey-page:nth-of-type(3n + 1) {
  border-top-color: var(--accent);
}

.survey-page:nth-of-type(3n + 2) {
  border-top-color: var(--brand-blue);
}

.survey-page:nth-of-type(3n) {
  border-top-color: var(--brand-yellow);
}

.completion-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-top: 6px solid var(--accent);
  box-shadow: inset 0 0 0 1px var(--brand-light-grey);
  max-width: 720px;
  padding: 28px;
}

.completion-card h2 {
  color: var(--fg);
  margin-bottom: 10px;
}

.completion-status {
  color: var(--accent);
  font-size: 18px;
  font-weight: 800;
  margin: 0;
}

textarea {
  min-height: 120px;
  width: 100%;
}

#draft-question-json {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  min-height: 220px;
  margin: 12px 0;
}

.status {
  color: var(--muted);
  margin-top: 12px;
}

.empty {
  color: var(--muted);
}

.output-panel {
  margin: 14px 0;
}

.output-panel pre {
  background: var(--bg);
  border: 1px solid var(--border);
  overflow: auto;
  padding: 12px;
}

.send-links {
  border: 1px solid var(--border);
  margin-bottom: 12px;
  padding: 12px;
}

.send-links ul {
  margin: 0;
  padding-left: 18px;
}

.send-links span {
  color: var(--muted);
  margin-left: 8px;
}

/* Respondent survey: progress bar, rating scales and capped choice lists. */

.survey-progress {
  background: var(--panel, #fff);
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
  padding: 10px 0 8px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.survey-progress-track {
  background: var(--brand-mid-grey);
  border-radius: 0;
  height: 6px;
  overflow: hidden;
}

.survey-progress-fill {
  background: var(--brand-blue);
  height: 100%;
  transition: width 0.3s ease;
}

.survey-progress-label {
  color: var(--muted);
  display: flex;
  font-size: 12px;
  justify-content: space-between;
  margin-top: 5px;
}

.rating-scale {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.rating-option {
  cursor: pointer;
  flex: 0 0 auto;
}

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

.rating-option span {
  align-items: center;
  border: 1px solid var(--ink);
  border-radius: 0;
  display: flex;
  height: 40px;
  justify-content: center;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  width: 44px;
}

.rating-option:hover span {
  border-color: var(--accent);
}

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

.rating-option input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.rating-ends {
  color: var(--muted);
  display: flex;
  font-size: 12px;
  justify-content: space-between;
  margin-top: 6px;
  max-width: 260px;
}

/* Choices had no layout rules, so they ran together inline. Twenty obstacles
   in a single wrapped block is unreadable when you only get to pick three.
   One per line, each row its own target. */
fieldset[data-question-type="checkbox"] label,
fieldset[data-question-type="radiogroup"] label {
  align-items: flex-start;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  font-weight: 400;
  gap: 10px;
  line-height: 1.45;
  padding: 9px 10px;
}

fieldset[data-question-type="checkbox"] label:hover,
fieldset[data-question-type="radiogroup"] label:hover {
  background: var(--brand-pink-wash);
}

fieldset[data-question-type="checkbox"] label.choice-disabled:hover {
  background: none;
  cursor: default;
}

fieldset[data-question-type="checkbox"] label input,
fieldset[data-question-type="radiogroup"] label input {
  flex: none;
  margin: 3px 0 0;
}

.choice-counter {
  color: var(--muted);
  font-size: 13px;
  margin: 10px 0 0;
}

label.choice-disabled {
  color: var(--muted);
  opacity: 0.5;
}

.question-input {
  align-items: baseline;
  display: flex;
  gap: 8px;
}

.question-suffix {
  color: var(--muted);
  font-size: 13px;
}

.q-list-title {
  font-weight: 600;
  margin: 18px 0 6px;
}

.q-muted {
  color: var(--muted);
  font-size: 13px;
}

/* Brand lockup in the respondent header. */

.brand-logo {
  display: inline-flex;
  align-items: center;
  color: var(--ink);
}

.brand-logo img {
  display: block;
  height: 34px;
  width: auto;
}

@media (max-width: 640px) {
  .brand-logo img {
    height: 26px;
  }
}

/* Accessible page title where the visual identity is carried by the logo. */

.visually-hidden {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}
