:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #171a2c;
  --muted: #646a85;
  --line: #e4e6f0;
  --track: #eceef6;
  --brand: #5b4cf0;
  --brand-2: #8a7dff;
  --brand-soft: #efedff;
  --danger: #e0445a;
  --ok: #17946a;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(20, 20, 60, .04), 0 8px 24px rgba(20, 20, 60, .06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1017; --card: #181a24; --text: #eceef7; --muted: #9ba0b8;
    --line: #2a2d3c; --track: #262938; --brand-soft: #24224a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  display: flex; flex-direction: column; min-height: 100vh;
}
body > main { flex: 1; min-width: 0; width: 100%; }
a { color: var(--brand); }
h1 { font-size: clamp(24px, 4.5vw, 32px); line-height: 1.2; margin: 0 0 12px; letter-spacing: -.01em; }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 16px; margin: 8px 0 6px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small-text { font-size: 13.5px; }
.center { text-align: center; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line);
}
.header-in { display: flex; align-items: center; justify-content: space-between; height: 62px; }
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 20px; text-decoration: none; color: var(--text); }
.logo-text span { color: var(--brand); }
.logo-mark {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), #f0596b); color: #fff; font-size: 16px;
}
.nav { display: flex; align-items: center; gap: 18px; }
.nav a:not(.btn), .nav .link { color: var(--text); text-decoration: none; font-weight: 500; font-size: 15px; }
.nav a:not(.btn):hover, .nav .link:hover { color: var(--brand); }
.nav-toggle, .nav-burger { display: none; }
@media (max-width: 760px) {
  .nav-burger { display: grid; place-items: center; width: 42px; height: 42px; cursor: pointer; border-radius: 10px; }
  .nav-burger span, .nav-burger span::before, .nav-burger span::after {
    display: block; width: 20px; height: 2px; background: var(--text); border-radius: 2px; position: relative; content: "";
  }
  .nav-burger span::before { position: absolute; top: -6px; }
  .nav-burger span::after { position: absolute; top: 6px; }
  .nav {
    display: none; position: absolute; top: 62px; left: 0; right: 0; flex-direction: column; align-items: stretch;
    gap: 0; background: var(--card); border-bottom: 1px solid var(--line); padding: 8px 16px 16px; box-shadow: var(--shadow);
  }
  .nav a:not(.btn), .nav .link { padding: 12px 4px; border-bottom: 1px solid var(--line); text-align: left; }
  .nav .btn { margin-top: 12px; padding: 12px; }
  .nav-toggle:checked ~ .nav { display: flex; }
}

/* ---------- buttons & forms ---------- */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 18px; border-radius: 11px; border: 1px solid transparent; min-height: 44px;
  background: var(--brand); color: #fff; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: filter .15s, transform .05s;
}
button:hover, .btn:hover { filter: brightness(1.08); }
button:active, .btn:active { transform: translateY(1px); }
button:disabled { opacity: .55; cursor: not-allowed; }
button.ghost, .btn.ghost { background: transparent; color: var(--text); border-color: var(--line); }
button.ghost:hover, .btn.ghost:hover { border-color: var(--brand-2); }
button.danger { background: var(--danger); }
button.small, .btn.small { padding: 7px 12px; font-size: 14px; min-height: 36px; }
button.icon { padding: 8px 12px; background: transparent; color: var(--muted); border-color: var(--line); min-height: 44px; }
button.link { background: none; border: 0; padding: 0; min-height: 0; color: var(--brand); font-weight: 600; }
.block { width: 100%; }
label.field { display: block; font-weight: 600; margin: 16px 0 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 12px 13px; border: 1px solid var(--line); border-radius: 11px;
  background: var(--bg); color: var(--text); font: inherit; font-size: 16px; /* 16px stops iOS zoom */
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-2); outline-offset: 0; border-color: transparent; }
.row { display: flex; gap: 8px; align-items: center; }
.row > input { flex: 1; }
.opt-row { display: flex; gap: 8px; margin-bottom: 8px; }
.opt-row input { flex: 1; }
.check { display: flex; gap: 10px; align-items: center; margin-top: 12px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.error { color: var(--danger); margin-top: 10px; min-height: 1.3em; font-size: 14px; }
.settings { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
@media (max-width: 560px) { .settings { grid-template-columns: 1fr; } }
.settings-box { margin: 16px 0 4px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.settings-box summary { cursor: pointer; font-weight: 600; }
.settings-box[open] { padding-bottom: 14px; }

/* ---------- cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow); margin-bottom: 18px;
}
@media (max-width: 560px) { .card { padding: 18px; } }
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 700;
  background: var(--brand-soft); color: var(--brand);
}
.badge.closed { background: #fde7ea; color: var(--danger); }
.badge.open { background: #ddf5ea; color: var(--ok); }

/* ---------- home ---------- */
.hero {
  background:
    radial-gradient(900px 400px at 10% -10%, color-mix(in srgb, var(--brand) 18%, transparent), transparent 70%),
    radial-gradient(700px 400px at 100% 0%, color-mix(in srgb, #f0596b 14%, transparent), transparent 70%);
  padding: 44px 0 28px;
}
.hero-in { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: start; }
.eyebrow { display: inline-block; font-size: 13px; font-weight: 700; color: var(--brand); background: var(--brand-soft); padding: 4px 12px; border-radius: 99px; margin-bottom: 14px; }
.hero h1 { font-size: clamp(30px, 5.5vw, 48px); }
.grad { background: linear-gradient(90deg, var(--brand), #f0596b); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { font-size: 18px; color: var(--muted); max-width: 520px; }
.ticks { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 8px; }
.ticks li::before { content: "✓"; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #ddf5ea; color: var(--ok); font-weight: 800; font-size: 13px; margin-right: 10px; }
.create-card { margin: 0; }
.create-card h2 { font-size: 20px; }
@media (max-width: 860px) {
  .hero { padding: 24px 0 8px; }
  .hero-in { grid-template-columns: 1fr; gap: 20px; }
  .lead { font-size: 16px; }
  .ticks { display: none; }
}
.section { padding: 28px 16px; }
.section-title { font-size: clamp(20px, 3vw, 26px); margin-bottom: 16px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.section-head h1, .section-head h2 { margin: 0; }
.features { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 900px) { .features { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .features { grid-template-columns: 1fr; } }
.feature { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.feature p { margin: 0; color: var(--muted); font-size: 14.5px; }
.f-ico { font-size: 26px; }
.steps { list-style: none; counter-reset: s; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr; } }
.steps li { counter-increment: s; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 20px 20px 66px; position: relative; display: grid; gap: 4px; }
.steps li::before { content: counter(s); position: absolute; left: 18px; top: 18px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff; font-weight: 800; }
.steps span { color: var(--muted); font-size: 14.5px; }
.poll-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 900px) { .poll-cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .poll-cards { grid-template-columns: 1fr; } }
.poll-card {
  display: flex; flex-direction: column; justify-content: space-between; gap: 10px; min-height: 104px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px;
  text-decoration: none; color: var(--text); transition: border-color .15s, transform .15s;
}
.poll-card:hover { border-color: var(--brand-2); transform: translateY(-2px); }
.poll-card-q { font-weight: 600; }
.faq details { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin-bottom: 10px; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq p { margin: 10px 0 0; color: var(--muted); }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 20px; }

/* ---------- poll page ---------- */
.poll-main { padding-top: 18px; padding-bottom: 40px; }
.crumbs { color: var(--muted); margin-bottom: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--brand); }
.poll-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; align-items: start; }
@media (max-width: 900px) { .poll-layout { grid-template-columns: minmax(0, 1fr); } }
.poll-q { font-size: clamp(22px, 4vw, 30px); word-wrap: break-word; }
.poll-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin-bottom: 18px; }
.choices { border: 0; padding: 0; margin: 0; }
.choice {
  display: flex; gap: 12px; align-items: center; padding: 14px 16px; margin-bottom: 10px;
  border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; font-weight: 500;
  transition: border-color .15s, background .15s; word-break: break-word;
}
.choice:hover { border-color: var(--brand-2); }
.choice input { accent-color: var(--brand); width: 20px; height: 20px; flex-shrink: 0; margin: 0; }
.choice:has(input:checked) { background: var(--brand-soft); border-color: var(--brand); }
.vote-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.vote-actions button[type=submit] { min-width: 150px; }
@media (max-width: 560px) { .block-mobile { flex: 1 1 100%; } }
.results-grid { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 26px; align-items: center; }
@media (max-width: 640px) { .results-grid { grid-template-columns: 1fr; gap: 18px; } }
.chart-wrap { display: grid; place-items: center; }
.donut { width: 100%; max-width: 220px; height: auto; }
.donut circle { transition: stroke-dasharray .6s ease, stroke-dashoffset .6s ease; }
.donut-num { font-size: 30px; font-weight: 800; fill: var(--text); }
.donut-lbl { font-size: 13px; fill: var(--muted); }
.res { margin-bottom: 14px; }
.res-top { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.res-text { flex: 1; min-width: 0; word-break: break-word; font-weight: 500; }
.res-num { white-space: nowrap; font-size: 14.5px; }
.lead .res-text { font-weight: 700; }
.lead .res-text::after { content: " 🏆"; }
.dot { width: 12px; height: 12px; border-radius: 4px; flex-shrink: 0; }
.bar { height: 10px; background: var(--track); border-radius: 99px; overflow: hidden; }
.bar > div { height: 100%; width: 0; border-radius: 99px; background: var(--brand); transition: width .6s ease; }
.results-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.results-foot .link { margin-left: auto; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(23, 148, 106, .5); animation: pulse 1.8s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(23, 148, 106, 0); } 100% { box-shadow: 0 0 0 0 rgba(23, 148, 106, 0); } }
.share-row { display: flex; gap: 8px; }
.share-row input { flex: 1; min-width: 0; }
.share-new { border-color: var(--brand-2); background: var(--brand-soft); }
.share-btns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
@media (max-width: 560px) { .share-btns { grid-template-columns: repeat(2, 1fr); } }
.sbtn { display: grid; place-items: center; padding: 10px; border-radius: 10px; color: #fff; text-decoration: none; font-weight: 600; font-size: 14px; min-height: 44px; }
.sbtn.wa { background: #25d366; } .sbtn.x { background: #111; } .sbtn.fb { background: #1877f2; } .sbtn.tg { background: #229ed9; }
.side .card h2 { font-size: 16px; }
.cta-card { background: linear-gradient(135deg, var(--brand-soft), var(--card)); }
.side-list { list-style: none; padding: 0; margin: 0; }
.side-list li { display: grid; gap: 2px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.side-list li:last-child { border-bottom: 0; }
.side-list a { text-decoration: none; color: var(--text); font-weight: 500; }
.side-list a:hover { color: var(--brand); }

/* ---------- auth & dashboard ---------- */
.auth-main { display: grid; place-items: center; padding: 36px 16px 60px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card button[type=submit] { margin-top: 6px; }
.my-polls { display: grid; gap: 12px; margin-top: 14px; }
.my-poll { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 0; flex-wrap: wrap; }
.my-poll-main { min-width: 0; flex: 1 1 300px; }
.my-poll-q { font-weight: 600; color: var(--text); text-decoration: none; word-break: break-word; }
.my-poll-q:hover { color: var(--brand); }
.my-poll-actions { display: flex; gap: 8px; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--card); margin-top: 30px; padding: 28px 0 18px; }
.footer-in { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.footer-in p { max-width: 360px; }
.footer-links { display: grid; grid-template-columns: repeat(2, auto); gap: 8px 28px; align-content: start; }
.footer-links a { color: var(--text); text-decoration: none; font-size: 14.5px; }
.footer-links a:hover { color: var(--brand); }
.copy { margin-top: 14px; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translate(-50%, 10px); z-index: 50;
  background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 11px; font-weight: 500;
  opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- admin panel (public/admin.html) ---------- */
header.top { display: flex; align-items: center; justify-content: space-between; max-width: 1120px; margin: 0 auto; padding: 16px; width: 100%; }
header.top ~ main { max-width: 680px; width: 100%; margin: 0 auto; padding: 8px 16px 60px; }
header.top ~ main.wide { max-width: 1120px; }
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 18px; }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat b { display: block; font-size: 24px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--brand-soft); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.note { margin-top: 12px; padding: 10px 12px; border-radius: 10px; font-size: 13px; background: var(--brand-soft); color: var(--text); }
