:root {
  --bg: #f7f8fb;
  --card: #ffffff;
  --ink: #1a1d26;
  --muted: #5d6577;
  --line: #e5e8ef;
  --brand: #4f46e5;
  --brand-dark: #4338ca;
  --brand-soft: #eef0ff;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ---------- layout ---------- */
.wrap { max-width: 720px; margin: 0 auto; padding: 0 20px; }

.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px;
}
.logo { font-weight: 800; font-size: 1.25rem; color: var(--ink); text-decoration: none; }
.logo span { color: var(--brand); }
.nav a {
  color: var(--muted); text-decoration: none; font-weight: 600; margin-left: 18px;
}
.nav a:hover { color: var(--brand); }

main { padding: 32px 0 64px; }

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted); font-size: .85rem; text-align: center;
  padding: 24px 0 40px;
}

/* ---------- cards, buttons ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px; margin-bottom: 20px;
}

.btn {
  display: inline-block; border: none; cursor: pointer;
  background: var(--brand); color: #fff; font-weight: 700; font-size: 1rem;
  padding: 12px 24px; border-radius: 10px; text-decoration: none;
  transition: background .15s, transform .1s;
}
.btn:hover { background: var(--brand-dark); }
.btn:active { transform: scale(.98); }
.btn.secondary {
  background: var(--card); color: var(--ink); border: 1px solid var(--line);
}
.btn.secondary:hover { border-color: var(--brand); color: var(--brand); }
.btn.danger { background: var(--red); }
.btn.danger:hover { background: #b91c1c; }
.btn.small { padding: 8px 14px; font-size: .875rem; }
.btn.block { display: block; width: 100%; }

/* ---------- hero ---------- */
.hero { text-align: center; padding: 48px 0 36px; }
.hero h1 { font-size: 2.6rem; margin: 0 0 12px; letter-spacing: -0.02em; }
.hero h1 span { color: var(--brand); }
.hero p { color: var(--muted); font-size: 1.1rem; margin: 0 0 24px; }
.hero .btn { font-size: 1.1rem; padding: 14px 36px; }

.how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 28px 0; }
.how .step {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 14px; text-align: center;
}
.how .step .num {
  display: inline-flex; width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand);
  font-weight: 800; align-items: center; justify-content: center; margin-bottom: 8px;
}
.how .step p { margin: 4px 0 0; color: var(--muted); font-size: .9rem; }

/* ---------- forms ---------- */
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 700; margin-bottom: 6px; }
.field .hint { color: var(--muted); font-size: .85rem; font-weight: 400; }
input[type="text"], input[type="datetime-local"] {
  width: 100%; padding: 11px 14px; font-size: 1rem;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
input:focus { outline: 2px solid var(--brand); border-color: var(--brand); }

.opt-row { display: flex; gap: 8px; margin-bottom: 8px; }
.opt-row input { flex: 1; }
.icon-btn {
  border: 1px solid var(--line); background: #fff; border-radius: 10px;
  width: 44px; cursor: pointer; font-size: 1.1rem; color: var(--muted);
}
.icon-btn:hover { color: var(--red); border-color: var(--red); }

.check { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 14px; }
.check input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--brand); }
.check .hint { display: block; color: var(--muted); font-size: .85rem; font-weight: 400; }

.errors {
  background: #fef2f2; border: 1px solid #fecaca; color: #991b1b;
  border-radius: 10px; padding: 12px 16px; margin-bottom: 18px;
}
.errors ul { margin: 0; padding-left: 20px; }

/* ---------- poll vote page ---------- */
.poll-question { font-size: 1.5rem; margin: 0 0 4px; letter-spacing: -0.01em; }
.poll-meta { color: var(--muted); font-size: .9rem; margin-bottom: 20px; }

.option-card {
  display: flex; align-items: center; gap: 12px;
  border: 2px solid var(--line); border-radius: 12px;
  padding: 14px 16px; margin-bottom: 10px; cursor: pointer;
  transition: border-color .15s, background .15s;
  font-weight: 600; font-size: 1.05rem;
}
.option-card:hover { border-color: var(--brand); background: var(--brand-soft); }
.option-card.selected { border-color: var(--brand); background: var(--brand-soft); }
.option-card input { width: 20px; height: 20px; accent-color: var(--brand); flex-shrink: 0; }

.closed-banner {
  background: #fffbeb; border: 1px solid #fde68a; color: #92400e;
  border-radius: 10px; padding: 12px 16px; font-weight: 600; margin-bottom: 18px;
}
.vote-error {
  background: #fef2f2; border: 1px solid #fecaca; color: #991b1b;
  border-radius: 10px; padding: 12px 16px; margin-bottom: 14px; display: none;
}
.vote-error.show { display: block; }
.thanks {
  background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534;
  border-radius: 10px; padding: 12px 16px; margin-bottom: 14px; display: none;
}
.thanks.show { display: block; }

/* ---------- results bars ---------- */
.results-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.results-head h2 { margin: 0; font-size: 1.2rem; }
.live-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--green); margin-right: 6px;
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.result-row { margin-bottom: 14px; }
.result-row .label { display: flex; justify-content: space-between; font-weight: 600; margin-bottom: 5px; }
.result-row .label .pct { color: var(--brand); }
.bar {
  height: 26px; background: #eef1f6; border-radius: 8px; overflow: hidden;
}
.bar .fill {
  height: 100%; background: linear-gradient(90deg, var(--brand), #818cf8);
  border-radius: 8px; transition: width .6s ease;
  display: flex; align-items: center; justify-content: flex-end;
  min-width: 0;
}
.bar .count {
  color: #fff; font-size: .75rem; font-weight: 700; padding-right: 8px; white-space: nowrap;
}
.total-line { color: var(--muted); font-size: .9rem; margin-top: 6px; }

/* ---------- recent polls list ---------- */
.poll-list { list-style: none; margin: 0; padding: 0; }
.poll-list li { border-bottom: 1px solid var(--line); padding: 12px 0; }
.poll-list li:last-child { border-bottom: none; }
.poll-list a { font-weight: 700; color: var(--ink); text-decoration: none; }
.poll-list a:hover { color: var(--brand); }
.poll-list .meta { color: var(--muted); font-size: .85rem; }

.empty { text-align: center; color: var(--muted); padding: 32px 0; }
.empty .big { font-size: 2.5rem; display: block; margin-bottom: 8px; }

/* ---------- created / manage ---------- */
.link-box {
  display: flex; gap: 8px; margin: 10px 0 20px;
}
.link-box input { flex: 1; background: #f3f4f6; font-size: .9rem; }
.kv { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--muted); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.inline-form { display: inline; }

.section-title { font-size: 1.2rem; margin: 0 0 12px; }
.mt { margin-top: 28px; }

/* ---------- responsive ---------- */
@media (max-width: 640px) {
  .hero h1 { font-size: 2rem; }
  .how { grid-template-columns: 1fr; }
  .card { padding: 18px; }
  .link-box { flex-direction: column; }
  .actions .btn { flex: 1 1 100%; }
}
