:root {
  --bg: #080d1a;
  --bg-soft: #0d1426;
  --panel: rgba(17, 25, 45, 0.82);
  --panel-solid: #121a2e;
  --border: rgba(132, 156, 255, 0.15);
  --border-strong: rgba(132, 156, 255, 0.32);
  --text: #e9eefc;
  --muted: #8f9cbe;
  --accent: #7c6cff;
  --accent-2: #35d6c0;
  --danger: #ff6b81;
  --shadow: 0 24px 60px rgba(3, 8, 22, 0.55);
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 700px at 15% -10%, rgba(124, 108, 255, 0.18), transparent 60%),
    radial-gradient(900px 600px at 100% 0%, rgba(53, 214, 192, 0.12), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.bg-glow {
  position: fixed;
  left: 50%;
  top: 180px;
  width: 900px;
  height: 900px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(124, 108, 255, 0.12), transparent 65%);
  pointer-events: none;
  z-index: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(20px, 4vw, 48px);
  background: rgba(8, 13, 26, 0.72);
  border-bottom: 1px solid rgba(132, 156, 255, 0.08);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #5547d8);
  box-shadow: 0 8px 24px rgba(124, 108, 255, 0.4);
  font-size: 20px;
  font-weight: 900;
}

.brand-dot {
  color: var(--accent-2);
}

.page {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: 48px clamp(20px, 4vw, 48px) 80px;
}

.hero {
  margin-bottom: 48px;
}

.eyebrow {
  margin: 0 0 16px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--accent-2);
}

.hero h1 {
  margin: 0;
  font-size: clamp(38px, 6vw, 62px);
  line-height: 1.1;
  letter-spacing: -1.5px;
  font-weight: 900;
}

.hero h1 span {
  background: linear-gradient(100deg, var(--accent) 10%, var(--accent-2) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub {
  max-width: 560px;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.8;
}

.hero-stats {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 26px;
  color: var(--muted);
  font-size: 14px;
}

.hero-stats .dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--border-strong);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.section-head h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0.5px;
}

.poll-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.poll-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  animation: rise 0.35s ease both;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.poll-card:hover {
  border-color: rgba(132, 156, 255, 0.24);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.poll-head {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.poll-question {
  margin: 0;
  font-size: 19px;
  line-height: 1.5;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.poll-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  color: var(--muted);
  font-size: 12.5px;
}

.badge {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(53, 214, 192, 0.12);
  border: 1px solid rgba(53, 214, 192, 0.3);
  color: var(--accent-2);
  font-weight: 700;
  letter-spacing: 0.3px;
}

.option-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option {
  position: relative;
  overflow: hidden;
  display: block;
  width: 100%;
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: rgba(9, 14, 28, 0.6);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.option:hover:not(:disabled) {
  border-color: rgba(124, 108, 255, 0.6);
  transform: translateY(-1px);
  background: rgba(20, 29, 54, 0.75);
}

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

.option:disabled {
  cursor: default;
}

.option.voting {
  opacity: 0.65;
}

.option-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: linear-gradient(90deg, rgba(124, 108, 255, 0.34), rgba(53, 214, 192, 0.2));
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.option-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.option-label {
  font-size: 14.5px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.option-stats {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.option.chosen {
  border-color: rgba(53, 214, 192, 0.55);
  background: rgba(53, 214, 192, 0.06);
}

.option.chosen .option-label {
  color: #bff7ee;
  font-weight: 700;
}

.option.chosen .option-fill {
  background: linear-gradient(90deg, rgba(53, 214, 192, 0.3), rgba(124, 108, 255, 0.22));
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border: 1px solid transparent;
  border-radius: 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, opacity 0.16s ease;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #5d4bdf);
  color: #fff;
  box-shadow: 0 10px 28px rgba(124, 108, 255, 0.32);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 14px 34px rgba(124, 108, 255, 0.45);
}

.btn-ghost {
  background: rgba(17, 25, 45, 0.75);
  border-color: var(--border);
  color: var(--text);
}

.btn-ghost:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: rgba(24, 34, 60, 0.9);
}

.btn-sm {
  padding: 8px 14px;
  font-size: 12.5px;
  border-radius: 10px;
}

.empty {
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 72px 24px;
  border: 1px dashed rgba(132, 156, 255, 0.22);
  border-radius: var(--radius);
  text-align: center;
  color: var(--muted);
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin-bottom: 8px;
  border-radius: 22px;
  background: rgba(124, 108, 255, 0.1);
  border: 1px solid rgba(124, 108, 255, 0.24);
  color: var(--accent);
}

.empty-icon svg {
  width: 34px;
  height: 34px;
}

.empty h3 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
}

.empty p {
  margin: 0;
  font-size: 14px;
}

.dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text);
  overflow: visible;
}

.dialog::backdrop {
  background: rgba(4, 7, 16, 0.72);
  backdrop-filter: blur(6px);
}

.dialog-card {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-height: calc(100vh - 48px);
  padding: 26px;
  overflow-y: auto;
  background: var(--panel-solid);
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.dialog-head h2 {
  margin: 0;
  font-size: 20px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.icon-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-color: var(--border);
}

.icon-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  color: #c4cdea;
}

.field input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(7, 12, 24, 0.85);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.field input::placeholder {
  color: #5f6b8c;
}

.field input:focus {
  outline: none;
  border-color: rgba(124, 108, 255, 0.65);
  box-shadow: 0 0 0 3px rgba(124, 108, 255, 0.16);
}

.option-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.6;
}

.form-error {
  margin: 0;
  padding: 10px 14px;
  border: 1px solid rgba(255, 107, 129, 0.35);
  border-radius: 10px;
  background: rgba(255, 107, 129, 0.1);
  color: #ff9daa;
  font-size: 13px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 2px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  z-index: 50;
  transform: translate(-50%, 24px);
  padding: 12px 22px;
  border: 1px solid rgba(53, 214, 192, 0.35);
  border-radius: 12px;
  background: rgba(13, 30, 34, 0.95);
  color: #c9fff5;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.error {
  border-color: rgba(255, 107, 129, 0.4);
  background: rgba(38, 14, 22, 0.96);
  color: #ffc0c9;
}

@media (max-width: 640px) {
  .topbar {
    padding: 14px 18px;
  }

  .page {
    padding: 32px 18px 64px;
  }

  .hero {
    margin-bottom: 36px;
  }

  .hero h1 {
    letter-spacing: -1px;
  }

  .poll-grid {
    grid-template-columns: 1fr;
  }

  .dialog-card {
    padding: 22px;
  }

  .toast {
    max-width: calc(100vw - 32px);
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
