:root {
  color-scheme: light;
  --ink: #2a2440;
  --muted: #6d6780;
  --paper: #f4effc;
  --card: rgba(255, 255, 255, 0.86);
  --line: #e3dcf2;
  --accent: #6d5bd0;
  --accent-dark: #5344b0;
  --danger: #8d2f2f;
  --focus: #8b6cf0;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
  overflow-wrap: break-word;
}
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.backdrop-fabric {
  --fabric-x: 0%;
  --fabric-y: 0%;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  transform: translate3d(var(--fabric-x), var(--fabric-y), 0) scale(1.06);
  animation: fabric-drift 48s ease-in-out infinite alternate;
}
@keyframes fabric-drift {
  from { transform: translate3d(var(--fabric-x), var(--fabric-y), 0) scale(1.06); }
  to { transform: translate3d(calc(var(--fabric-x) + 3%), calc(var(--fabric-y) + 2%), 0) scale(1.1); }
}
.site-header, main, footer { position: relative; z-index: 1; width: min(960px, calc(100% - 32px)); margin: 0 auto; }
.site-header { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 20px 0; }
.site-header nav { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.brand { font-size: 1.4rem; font-weight: 650; color: var(--ink); text-decoration: none; }
a { color: var(--accent-dark); }
main { padding-bottom: 48px; }
footer { display: flex; gap: 16px; padding: 24px 0 40px; color: var(--muted); }
h1, h2 { font-weight: 650; line-height: 1.25; }
label, .stack { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
input, textarea, button {
  font: inherit;
  color: inherit;
}
label:has(+ .password-field) { margin-bottom: 6px; }
.password-field { position: relative; margin-bottom: 14px; }
.password-field input { padding-right: 7.2rem; }
.password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  padding: 4px 8px;
  border: 0;
  background: transparent;
  color: var(--accent-dark);
}
input[type="text"], input[type="email"], input[type="password"], input[type="url"], textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}
textarea { min-height: 88px; resize: vertical; }
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--accent-dark);
  background: var(--accent);
  color: white;
  text-decoration: none;
  cursor: pointer;
}
button.secondary, a.secondary {
  background: transparent;
  color: var(--accent-dark);
}
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.flash, .errors { padding: 12px 14px; border-radius: 8px; background: #fff4d6; }
.errors { border: 1px solid var(--danger); }
.card, fieldset { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin: 16px 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.survey-list { list-style: none; padding: 0; }
.survey-list li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.muted { color: var(--muted); }
.public-link { display: flex; align-items: flex-end; gap: 8px; }
.public-link .stack { flex: 1 1 auto; min-width: 0; margin-bottom: 0; }
.public-link input { width: 100%; min-width: 0; }
.public-link button {
  flex: 0 0 auto;
  width: auto;
  min-height: 0;
  height: 42px;
  padding: 6px 12px;
  white-space: nowrap;
}
table { width: 100%; border-collapse: collapse; background: white; max-width: 100%; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.bar-row { display: grid; gap: 4px; margin: 8px 0; }
.track { width: 100%; height: 10px; background: #ece6f8; border-radius: 99px; display: block; }
.fill { fill: var(--accent); }
.stat-card h2 { margin-bottom: 4px; overflow-wrap: anywhere; }
.chart-switch { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.chart-switch button {
  background: transparent;
  color: var(--accent-dark);
}
.chart-switch button[aria-checked="true"] {
  background: var(--accent);
  color: white;
}
.chart-hint { margin: 0 0 8px; color: var(--muted); }
.chart-frame { position: relative; width: 100%; }
.chart-frame canvas { display: block; max-width: 100%; }
.chart-empty { margin: 8px 0; }
.chart-legend { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.chart-legend li { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 8px; align-items: start; }
.chart-legend .swatch { width: 14px; height: 14px; border-radius: 4px; margin-top: 4px; }
.legend-name { overflow-wrap: anywhere; }
.legend-value { color: var(--muted); white-space: nowrap; }
.exact-values { margin-top: 12px; }
.exact-values summary { cursor: pointer; }
.recent-submissions { margin-top: 28px; }
.recent-submissions > summary {
  cursor: pointer;
  font-size: 1.5rem;
  font-weight: 650;
  line-height: 1.3;
}
.recent-submissions .when-open { display: none; }
.recent-submissions[open] .when-open { display: inline; }
.recent-submissions[open] .when-closed { display: none; }
.recent-submissions > h2 { margin: 18px 0 0; }
.response-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}
.response-expand { display: flex; flex-wrap: wrap; gap: 8px; }
.response-list { display: grid; gap: 20px; margin-top: 16px; }
.response-list[hidden],
.response-table-wrap[hidden],
.response-expand[hidden] { display: none; }
.response-card {
  background: #fff;
  border: 1px solid #d9d3ea;
  border-radius: 12px;
}
.survey-tile { position: relative; }
.survey-open {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
}
.survey-tile .response-heading {
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
}
.survey-tile .response-card > summary { padding-right: 176px; }
.response-card > summary {
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px;
  font-weight: 650;
}
.response-card > summary::-webkit-details-marker { display: none; }
.response-card > summary::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-top: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  flex: 0 0 auto;
}
.response-card[open] > summary::before {
  margin-top: 4px;
  transform: rotate(45deg);
}
.response-heading {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 16px;
}
.response-card > summary time,
.response-card .response-status { color: var(--muted); font-weight: 450; }
.response-pairs { display: grid; gap: 18px; padding: 0 18px 18px; }
.response-question { margin: 0; font-size: 15px; line-height: 1.4; color: #5c5670; }
.response-answer {
  margin: 4px 0 0;
  font-size: 17px;
  font-weight: 650;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.response-table-wrap { margin-top: 16px; overflow-x: auto; }
.response-table-wrap table { min-width: 720px; }
.response-table-wrap th,
.response-table-wrap td {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  vertical-align: top;
}
.response-pages { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 16px; }
.stat-card.charts-ready .bar-fallback { display: none; }
.option-row { display: flex; gap: 8px; align-items: end; }
.option-row .stack { flex: 1; min-width: 0; }
fieldset legend { font-weight: 650; padding: 0 4px; }
.answer-question {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
}
.answer-question { padding-top: 14px; }
.answer-question > legend {
  float: left;
  width: 100%;
  max-width: 100%;
  margin: 0 0 10px;
  padding: 0;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.answer-question > .choice { clear: both; }
.toggle {
  flex-direction: row;
  align-items: flex-start;
  gap: 12px;
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px dashed var(--accent);
  border-radius: 8px;
  background: #f6f3ff;
  cursor: pointer;
}
.toggle input {
  width: 1.15rem;
  height: 1.15rem;
  margin: 3px 0 0;
  flex: 0 0 auto;
  accent-color: var(--accent-dark);
}
.choice {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  margin: 6px 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  cursor: pointer;
}
.choice:hover { border-color: var(--accent); background: #f6f3ff; }
.choice:has(input:checked) {
  border-color: var(--accent);
  background: #efeaff;
  box-shadow: inset 3px 0 0 var(--accent);
}
.choice input[type="radio"],
.choice input[type="checkbox"] {
  margin: 0;
  width: 1.15rem;
  height: 1.15rem;
  flex: 0 0 auto;
  accent-color: var(--accent-dark);
}
.choice span { line-height: 1.35; }
.choice-custom { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.choice-custom input[type="text"]:disabled { background: #f6f3fb; color: var(--muted); }
.form-card {
  position: relative;
  overflow: hidden;
  margin: 8px 0 28px;
  padding: 28px 24px 20px;
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 18px 40px rgba(88, 62, 140, 0.12);
}
.form-card::before,
.form-card::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.form-card::before {
  width: 280px;
  height: 180px;
  right: -70px;
  top: -50px;
  background: rgba(196, 176, 245, 0.45);
}
.form-card::after {
  width: 360px;
  height: 210px;
  left: -90px;
  bottom: -110px;
  background: rgba(214, 196, 255, 0.4);
}
.form-card > * { position: relative; z-index: 1; }
.form-card h1, .form-card h2 { margin: 0 0 6px; font-size: 1.6rem; }
.form-card fieldset {
  background: transparent;
  border: 0;
  padding: 0;
  margin: 18px 0;
  box-shadow: none;
}
.form-card select { border-radius: 12px; background: white; }
.scale {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.scale-option { position: relative; margin: 0; }
.scale-option input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.scale-mark, .scale-preview {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid #cfc6e6;
  background: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}
.scale-option:hover .scale-mark,
.scale-option input:focus-visible + .scale-mark { border-color: var(--accent); }
.scale-option input:checked + .scale-mark {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.scale-ends {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.85rem;
}
.pill {
  display: inline-flex;
  margin: 8px 0 16px;
  padding: 8px 14px;
  border-radius: 12px;
  background: #ece6ff;
  color: #4d3e9a;
  font-weight: 650;
}
.preview-label { margin: 16px 0 8px; font-weight: 650; }
.preview-select {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  color: var(--muted);
}
@media (max-width: 720px) {
  .survey-open { top: 12px; right: 12px; }
  .survey-tile .response-card > summary { padding-right: 18px; padding-top: 64px; }
  .site-header, main, footer { width: min(960px, calc(100% - 20px)); }
  .site-header { flex-direction: column; align-items: stretch; padding: 16px 0; }
  .site-header nav { width: 100%; }
  .site-header nav a, .site-header nav button { min-height: 44px; }
  h1 { font-size: 1.7rem; }
  button, .button { min-height: 44px; }
  .option-row { flex-direction: column; align-items: stretch; }
  .option-row button { width: 100%; }
  .actions > * { flex: 1 1 auto; }
  .public-link button { height: 42px; min-height: 0; }
  footer { flex-wrap: wrap; }
  table { display: block; overflow-x: auto; }
  .choice { align-items: flex-start; }
  .scale-mark, .scale-preview { width: 32px; height: 32px; }
  .chart-legend li { grid-template-columns: 14px minmax(0, 1fr); }
  .legend-value { grid-column: 2; white-space: normal; }
}
@media (prefers-reduced-motion: reduce) {
  .backdrop-fabric { animation: none; }
}
