:root {
  --page: #1f1f1f;
  --card: #2b2b2b;
  --card-border: #383838;
  --divider: #4a4a4a;
  --text: #ffffff;
  --muted: #adadad;
  --option: #c5c8f2;
  --accent: #6264a7;
  --accent-hover: #7579c9;
  --track: #d4d4d4;
  --radio: #8a8a8a;
  --danger: #c4314b;
  --danger-hover: #d9465f;
  --ok: #92c353;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 420px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.wrap.wide { max-width: 980px; }

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 6px;
  padding: 14px 16px 16px;
  margin-bottom: 18px;
}

.card-header {
  color: var(--muted);
  font-size: 12px;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--divider);
}

.label-above {
  color: var(--muted);
  font-size: 11px;
  margin: 0 0 4px 2px;
}

.question {
  font-size: 14px;
  font-weight: 400;
  margin: 0 0 8px;
  word-wrap: break-word;
}

/* ---- Options (radio list) ---- */

.options { display: flex; flex-direction: column; }

.option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 2px;
  cursor: pointer;
  color: var(--option);
  user-select: none;
}

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

.radio {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid var(--radio);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.option:hover .radio { border-color: var(--text); }

.option input:checked + .radio { border-color: var(--accent-hover); }
.option input:checked + .radio::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-hover);
}
.option input:focus-visible + .radio { outline: 2px solid var(--text); outline-offset: 2px; }

.options.locked .option { cursor: default; opacity: .7; }

/* ---- Buttons & inputs ---- */

.btn {
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  border: 1px solid #6b6b6b;
  border-radius: 4px;
  padding: 6px 12px;
  min-height: 32px;
  cursor: pointer;
}
.btn:hover:not(:disabled) { background: #3b3b3b; border-color: #8a8a8a; }
.btn:disabled { opacity: .45; cursor: default; }

.btn.primary { background: var(--accent); border-color: var(--accent); }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn.danger { border-color: var(--danger); color: #f3c0c9; }
.btn.danger:hover:not(:disabled) { background: var(--danger); border-color: var(--danger); color: var(--text); }

.btn.small { min-height: 24px; padding: 2px 8px; font-size: 12px; font-weight: 400; }

.input {
  font: inherit;
  color: var(--text);
  background: #1f1f1f;
  border: 1px solid #555;
  border-bottom: 2px solid #555;
  border-radius: 4px;
  padding: 7px 10px;
  width: 100%;
}
.input:focus { outline: none; border-bottom-color: var(--accent-hover); }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mt { margin-top: 12px; }

.error { color: #f1707b; font-size: 12px; min-height: 16px; margin-top: 6px; }
.muted { color: var(--muted); }
.small-text { font-size: 12px; }

/* ---- Selection banner ---- */

.selected {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 4px;
  background: #33344a;
  border-left: 3px solid var(--accent-hover);
}
.selected strong { font-size: 16px; }

/* ---- Results bars ---- */

.result { margin-bottom: 14px; }
.result-top {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  margin-bottom: 6px;
}
.result-top .pct { font-weight: 400; }
.bar {
  height: 4px;
  border-radius: 2px;
  background: var(--track);
  overflow: hidden;
}
.bar > span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width .4s ease;
}
.result.mine .result-top .letter::after {
  content: " (your answer)";
  font-weight: 400;
  color: var(--option);
  font-size: 12px;
}
.responses { margin-top: 18px; font-size: 13px; }

.waiting {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent-hover);
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }

/* ---- Admin ---- */

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
@media (max-width: 760px) {
  .admin-grid { grid-template-columns: minmax(0, 1fr); }
}

.status-pill {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: #3b3b3b;
  color: var(--muted);
}
.status-pill.on { background: #2f3b22; color: var(--ok); }

.people { list-style: none; margin: 0; padding: 0; }
.people li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--card-border);
}
.people li:last-child { border-bottom: none; }
.people .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people .ans {
  min-width: 28px;
  text-align: center;
  font-weight: 700;
  border-radius: 4px;
  padding: 1px 6px;
  background: var(--accent);
}
.people .ans.none { background: transparent; color: var(--muted); font-weight: 400; }

.group-title { font-weight: 600; margin: 10px 0 4px; }
.group-names { color: var(--muted); font-size: 13px; line-height: 1.5; }

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.top-bar h1 { font-size: 16px; font-weight: 600; margin: 0; }

.hidden { display: none !important; }
