@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/poppins-600-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/poppins-600-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #f3efe6;
  --surface: #fffdf9;
  --ink: #1c1915;
  --muted: #4f4a43;
  --line: #e3dcd0;
  --accent: rgb(254, 0, 2);
  --accent-hover: rgb(204, 0, 2);
  --accent-soft: rgb(255, 228, 229);
  --danger: rgb(254, 0, 2);
  --danger-soft: rgb(255, 228, 229);
  --shadow: 0 1px 2px rgba(28, 25, 21, 0.04), 0 12px 40px rgba(28, 25, 21, 0.06);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  background: var(--bg);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.5;
}

h1, h2, p { margin: 0; }

h1, h2, h3, h4 {
  font-family: "Poppins", ui-sans-serif, system-ui, sans-serif;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

h1 { text-wrap: balance; }

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

fieldset { border: 0; padding: 0; margin: 0; min-inline-size: 0; }

.skip {
  position: absolute;
  left: 8px;
  top: 8px;
  transform: translateY(-150%);
  background: white;
  padding: 8px 12px;
  z-index: 5;
  border-radius: 8px;
}

.skip:focus { transform: none; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus { outline: none; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.option input:focus { outline: none; }

.option:focus-within:not(:has(input:checked)) {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

body.public {
  display: grid;
  align-items: safe center;
  justify-items: center;
  padding: 28px 16px 40px;
}

.stack { width: min(100%, 32rem); display: grid; gap: 16px; justify-items: center; }
.stack > * { width: 100%; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 28px 22px 24px;
}

.intro { text-align: center; }

body.public h1 {
  font-size: clamp(2.1rem, 7vw, 3.15rem);
  margin-top: 12px;
}

.description {
  color: var(--muted);
  margin-top: 12px;
  white-space: pre-wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 4px 12px 4px 10px;
  font-size: 0.85rem;
  font-weight: 650;
  background: #eeeae3;
  color: var(--muted);
}

.badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.badge[data-status="open"] { background: #e5f3ee; color: #0c5c4c; }
.badge[data-status="closed"] { background: var(--danger-soft); color: var(--danger); }

.banner {
  background: var(--accent-soft);
  color: var(--ink);
  border-radius: 12px;
  padding: 12px 14px;
  margin-top: 16px;
}

.banner.is-error { background: var(--danger-soft); color: var(--danger); }

.options { display: grid; gap: 10px; margin: 18px 0; }

.option {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  padding: 16px;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  background: white;
  cursor: pointer;
  text-align: left;
}

.option-title { font-size: 1.15rem; }

.option input {
  appearance: none;
  width: 1.35rem;
  height: 1.35rem;
  margin: 0;
  border: 2px solid #6f685e;
  border-radius: 50%;
  display: grid;
  place-content: center;
  flex: none;
  background: white;
}

.option input::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  transform: scale(0);
  background: white;
}

.option input:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.option input:checked::before { transform: scale(1); }

.option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
  outline: none;
}

fieldset:disabled .option { cursor: not-allowed; }

.btn {
  appearance: none;
  border: 1px solid transparent;
  background: var(--accent);
  color: white;
  border-radius: 12px;
  padding: 12px 16px;
  min-height: 48px;
  font-weight: 650;
  cursor: pointer;
}

.btn:hover { background: var(--accent-hover); }

.btn.block { width: 100%; }

.stack-form > .btn,
.danger-zone > .btn,
.delete > .btn,
body.public form > .btn {
  display: block;
  margin-top: 16px;
}

.stack-form > .btn:not(.block),
.danger-zone > .btn:not(.block),
.delete > .btn:not(.block) {
  width: fit-content;
}

.btn.secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

.btn.secondary:hover { background: #f6f3ec; }

.btn.danger { background: var(--danger); }
.btn.danger:hover { background: rgb(204, 0, 2); }

.btn.small { min-height: 40px; padding: 8px 12px; font-size: 0.95rem; }

.btn.is-current,
.btn.is-current:disabled {
  background: var(--accent);
  color: white;
  border-color: transparent;
  opacity: 1;
  cursor: default;
}

button:disabled,
.btn:disabled { opacity: 0.48; cursor: not-allowed; }

.done {
  text-align: center;
  background: var(--accent-soft);
  border-radius: 16px;
  padding: 28px 18px;
  margin-top: 18px;
}

.done-mark {
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: white;
  font-size: 1.6rem;
}

.done-text { font-size: 1.25rem; }

.conn {
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  margin-top: 14px;
}

.conn.is-down { color: var(--danger); }

label { display: block; font-weight: 650; margin: 14px 0 6px; }

input[type="text"],
input[type="password"],
input:not([type]),
textarea,
#new-option,
#reset-confirm,
#poll-title-input,
#poll-description,
.rename input {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: white;
  min-height: 48px;
}

textarea { min-height: 96px; resize: vertical; }

body.admin { display: block; }

.wrap {
  width: min(100%, 60rem);
  margin: 0 auto;
  padding: 24px 16px 72px;
}

.top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.eyebrow {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

body.admin h1 { font-size: clamp(1.8rem, 3vw, 2.5rem); }

.top-actions { display: flex; gap: 10px; align-items: center; }

.quiet { color: var(--muted); font-weight: 450; }

.panel, .stat, .danger-zone, .note {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.panel { padding: 18px; margin-top: 16px; }

.panel h2, .danger-zone h2 { font-size: 1.45rem; margin-bottom: 8px; }

.panel-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
}

.segmented { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

.stat { padding: 14px 16px; }

.stat-label { color: var(--muted); font-size: 0.9rem; }

.stat-value {
  font-family: "Poppins", ui-sans-serif, system-ui, sans-serif;
  font-weight: 600;
  font-size: 2rem;
  line-height: 1.1;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.stat-small { font-size: 1.2rem; }

.results { list-style: none; margin: 8px 0 0; padding: 0; }

.result { border-radius: 12px; padding: 10px 8px; }

.result-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.result-title { font-weight: 650; }

.result-count { color: var(--muted); font-variant-numeric: tabular-nums; }

.bar {
  height: 10px;
  margin-top: 8px;
  background: #efeae1;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: inherit;
  transition: width 400ms ease;
}

.flash { animation: flash 0.8s ease; }

.result.is-new { animation: flash 0.8s ease; }

@keyframes flash {
  from { background: var(--accent-soft); }
  to { background: transparent; }
}

.stack-form, .add-option { margin-top: 8px; }

.row, .rename, .editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 8px;
  align-items: center;
}

.row input, .rename input { flex: 1 1 12rem; width: auto; }

.editor { list-style: none; margin: 0; padding: 0; }

.editor-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.option-row {
  --control: 48px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.option-row .rename {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  align-items: center;
}

.option-row .rename input,
.option-row .rename .btn {
  height: var(--control);
  min-height: var(--control);
  padding-top: 0;
  padding-bottom: 0;
}

.option-row .rename input {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  line-height: calc(var(--control) - 2px);
}

.option-row .rename .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.option-row .icon-btn {
  width: var(--control);
  height: var(--control);
  aspect-ratio: 1;
}

.icon-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  color: var(--muted);
  cursor: pointer;
}

.icon-btn svg { display: block; fill: currentColor; }

.icon-btn.danger svg { fill: none; }

.icon-btn.drag { cursor: grab; touch-action: none; }

.icon-btn.drag:active { cursor: grabbing; }

.icon-btn.danger {
  color: var(--danger);
  border-color: #e7c8c8;
  background: #fff8f8;
}

.icon-btn:hover { background: #f6f3ec; }

.icon-btn.danger:hover { background: var(--danger-soft); }

.editor-item.is-dragging {
  position: relative;
  z-index: 2;
  background: var(--surface);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding-right: 8px;
  padding-left: 8px;
}

.modal {
  width: min(100% - 32px, 24rem);
  margin: auto;
  padding: 0;
  border: 0;
  background: transparent;
}

.modal::backdrop { background: rgba(28, 25, 21, 0.45); }

.modal-card {
  background: var(--surface);
  border-radius: 18px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.modal-card h2 { font-size: 1.45rem; }

.modal-card .quiet { margin-top: 8px; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.check {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-weight: 450;
  margin: 8px 0;
}

.check input { width: 1.15rem; height: 1.15rem; margin-top: 0.25rem; flex: none; }

.danger-zone {
  margin-top: 16px;
  padding: 18px;
  background: #fff8f8;
  border-color: #e7c8c8;
}

.poll-card + .poll-card { margin-top: 16px; }
.poll-card-head, .add-poll { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.add-poll { margin: 16px 0; }
.poll-results, .poll-options { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.poll-options h4 { font-size: 1.25rem; margin-bottom: 8px; }
.poll-delete { margin-top: 18px; }

.note { margin-top: 16px; padding: 14px 16px; }

.note summary { cursor: pointer; font-weight: 650; }

.note p { margin-top: 8px; color: var(--muted); }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

body.admin .conn { text-align: left; margin: 8px 0 0; }

@media (min-width: 640px) {
  .card { padding: 40px 36px 32px; }
}

@media (min-width: 800px) {
  .stats { grid-template-columns: repeat(4, 1fr); }
}

@media (hover: hover) {
  .option:hover { border-color: #cfc6b8; }
  .option:has(input:checked):hover { border-color: var(--accent); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

::selection { background: #cfe7df; }
