:root {
  color-scheme: light;
  --background: #fff;
  --foreground: #171717;
  --card: #fff;
  --primary: #171717;
  --primary-foreground: #fafafa;
  --muted: #f5f5f5;
  --muted-foreground: #525252;
  --border: #e5e5e5;
  --input: #d4d4d4;
  --ring: #737373;
  --destructive: #b91c1c;
  --radius: .625rem;
  font: 1rem/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--foreground);
  background: var(--background);
}

* { box-sizing: border-box; }
body { margin: 0; }

.shell {
  width: min(100% - 2rem, 42rem);
  margin-inline: auto;
}

.site-header { border-bottom: 1px solid var(--border); }
.site-header .shell {
  display: flex;
  align-items: center;
  min-height: 3.5rem;
}

.brand {
  color: inherit;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -.045em;
  text-decoration: none;
}

main.shell {
  display: grid;
  gap: 1rem;
  padding-block: clamp(1.5rem, 5vw, 3rem) 3rem;
}

h1, h2, p { margin: 0; }
h1, h2, p, strong { overflow-wrap: anywhere; }
h1 { font-size: clamp(1.5rem, 4vw, 2rem); line-height: 1.2; letter-spacing: -.035em; }
h2 { font-size: 1rem; line-height: 1.4; letter-spacing: -.015em; }
p { color: var(--muted-foreground); }
.poll-description { white-space: pre-wrap; }

.panel {
  display: grid;
  gap: 1rem;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + .125rem);
  padding: clamp(1rem, 4vw, 1.5rem);
  background: var(--card);
  box-shadow: 0 1px 2px rgb(0 0 0 / 5%);
}

.page-heading, .card-header, .field { display: grid; gap: .375rem; }
.stack, form { display: grid; gap: 1rem; }
.choice-group, .choices { display: grid; gap: .5rem; }
.choice-group {
  min-inline-size: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

legend { padding: 0; margin-bottom: .5rem; color: var(--muted-foreground); }
legend, label { font-size: .875rem; font-weight: 550; }

input:not([type=checkbox]):not([type=radio]), textarea, select {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 2.5rem;
  border: 1px solid var(--input);
  border-radius: calc(var(--radius) - .125rem);
  padding: .5rem .75rem;
  background: var(--background);
  color: inherit;
  font: inherit;
}

textarea { resize: vertical; min-height: 5rem; }
input[readonly] { color: var(--muted-foreground); }

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: start;
  min-height: 2.5rem;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - .125rem);
  padding: .5rem .875rem;
  color: var(--primary-foreground);
  background: var(--primary);
  font: inherit;
  font-size: .875rem;
  font-weight: 550;
  text-decoration: none;
  cursor: pointer;
}

button:hover, .btn:hover { background: #333; }
button:disabled { opacity: .5; cursor: not-allowed; }
.secondary { border-color: var(--input); color: var(--foreground); background: var(--background); }
.secondary:hover { background: var(--muted); }
.danger { color: var(--destructive); background: var(--background); border-color: var(--input); }
.danger:hover { background: #fef2f2; }

.actions, .split { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.split { justify-content: space-between; }
.actions + .actions { margin-top: -.5rem; }

.option, .check {
  display: flex;
  align-items: center;
  gap: .75rem;
  cursor: pointer;
}

.option {
  min-height: 2.75rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - .125rem);
  padding: .5rem .75rem;
  overflow-wrap: anywhere;
}

.option:hover { background: #fafafa; }
.option:has(input:checked) { border-color: var(--ring); background: var(--muted); }
.option input, .check input {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--primary);
  flex-shrink: 0;
}

.result, .pollrow { display: grid; gap: .375rem; }
.result-head { display: flex; justify-content: space-between; gap: .75rem; font-size: .875rem; overflow-wrap: anywhere; }
.result-head span:last-child { white-space: nowrap; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.pollrow { padding-top: .875rem; border-top: 1px solid var(--border); }

progress {
  display: block;
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: .375rem;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: var(--muted);
}

progress::-webkit-progress-bar { background: var(--muted); }
progress::-webkit-progress-value { background: var(--primary); }
progress::-moz-progress-bar { background: var(--primary); }

.pill {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  padding: .125rem .5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 550;
}

.muted, #message { font-size: .875rem; }
.error { color: var(--destructive); }
.success { color: #166534; }
#message:empty { margin-top: -1rem; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 3px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 480px) {
  input:not([type=checkbox]):not([type=radio]), textarea, select { font-size: 1rem; }
  .actions > * { flex: 1 1 auto; }
}
