/* ============================================================
   AnonVote — публичная часть
   Дерзкий контрастный стиль: плоские цвета, жёсткие тени,
   никакого блюра и фиолетово-розовых градиентов.
   ============================================================ */

:root {
  --accent: #d7ff3f;         /* цвет темы опроса — задаётся в админке per-poll */
  --ink: #0c0c0d;
  --panel: #17171a;
  --panel-2: #1d1d21;
  --line: rgba(255, 255, 255, 0.14);
  --line-strong: rgba(255, 255, 255, 0.28);
  --text: #f6f6f1;
  --muted: #a3a39b;
  --muted-2: #706f68;
  --ok: #2fe6a6;
  --danger: #ff4d4d;
  --radius: 16px;
  --radius-sm: 11px;
  --shadow-hard: 5px 5px 0 0 rgba(0, 0, 0, 0.55);
  --font-head: 'Space Grotesk', 'Inter', sans-serif;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  min-height: 100vh;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* --- Фон: плоские графичные пятна, без блюра --- */
.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: var(--ink);
}
.bg::before {
  content: '';
  position: absolute;
  top: -18vw; right: -14vw;
  width: 60vw; height: 60vw;
  max-width: 640px; max-height: 640px;
  background: var(--accent);
  opacity: 0.14;
  border-radius: 40% 60% 55% 45% / 50% 45% 55% 50%;
  transform: rotate(8deg);
}
.bg::after {
  content: '';
  position: absolute;
  bottom: -22vw; left: -16vw;
  width: 52vw; height: 52vw;
  max-width: 520px; max-height: 520px;
  border: 3px solid var(--line-strong);
  border-radius: 30%;
  transform: rotate(-12deg);
  opacity: 0.5;
}
.bg .grain {
  position: absolute;
  inset: 0;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 34px 34px;
}

/* --- Каркас --- */
.wrap {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 18px 60px;
}
.wrap.wide { max-width: 1000px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0 26px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-head);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
  font-size: 16px;
}
.brand .dot {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--ink);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 0 rgba(0, 0, 0, 0.5);
  display: grid; place-items: center;
  font-size: 13px;
  font-weight: 700;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border-radius: 100px;
  background: var(--panel);
  border: 1.5px solid var(--line-strong);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}
.pill .live {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent);
  animation: pulse 2.2s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 55%, transparent); }
  70%  { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* --- Карточка --- */
.card {
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hard);
}
.card.pad { padding: clamp(20px, 4vw, 34px); }

/* --- Экраны --- */
.screen { display: none; animation: fadeUp 0.45s cubic-bezier(0.16, 0.9, 0.2, 1) both; }
.screen.active { display: block; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* --- Типографика --- */
h1, h2, h3 { margin: 0; font-family: var(--font-head); letter-spacing: -0.02em; font-weight: 700; line-height: 1.12; }
h1 { font-size: clamp(27px, 5.4vw, 42px); }
h2 { font-size: clamp(20px, 3.4vw, 25px); }
p { margin: 0; }
.lead { color: var(--muted); font-size: clamp(14.5px, 2.6vw, 16.5px); margin-top: 12px; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 11.5px;
  font-weight: 700;
  font-family: var(--font-head);
  color: var(--ink);
  background: var(--accent);
  padding: 4px 10px 4px 8px;
  border-radius: 6px;
  transform: rotate(-1.5deg);
}
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* --- Капча --- */
.captcha-box { text-align: center; padding: clamp(26px, 6vw, 48px) clamp(18px, 5vw, 40px); }
.shield {
  width: 76px; height: 76px;
  margin: 0 auto 22px;
  border-radius: 20px;
  display: grid; place-items: center;
  background: var(--accent);
  border: 2.5px solid var(--ink);
  box-shadow: 5px 5px 0 0 rgba(0, 0, 0, 0.5);
  transform: rotate(-4deg);
}
.shield svg { width: 32px; height: 32px; stroke: var(--ink); }

.human-check {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  max-width: 330px;
  margin: 26px auto 0;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  border: 2px solid var(--line-strong);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.2s, transform 0.12s, box-shadow 0.2s;
  text-align: left;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
}
.human-check:hover { border-color: var(--accent); box-shadow: 4px 4px 0 0 rgba(0, 0, 0, 0.5); transform: translate(-2px, -2px); }
.human-check:active { transform: translate(0, 0); box-shadow: none; }
.human-check[disabled] { cursor: default; }
.human-check .box {
  position: relative;
  width: 26px; height: 26px;
  flex: none;
  border-radius: 7px;
  border: 2px solid var(--line-strong);
  transition: border-color 0.25s, background 0.25s;
}
.human-check .box svg { position: absolute; inset: 2px; opacity: 0; transform: scale(0.5); transition: 0.3s cubic-bezier(0.2, 1.4, 0.4, 1); }
.human-check .spinner {
  position: absolute; inset: -2px;
  border: 2px solid transparent;
  border-top-color: var(--accent);
  border-right-color: var(--accent);
  border-radius: 9px;
  opacity: 0;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.human-check.loading .spinner { opacity: 1; }
.human-check.done { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, var(--panel-2)); }
.human-check.done .box { border-color: var(--ok); background: var(--ok); }
.human-check.done .box svg { opacity: 1; transform: scale(1); stroke: var(--ink); }
.captcha-note { margin-top: 18px; font-size: 12.5px; color: var(--muted-2); }

/* --- Прогресс опроса --- */
.progress-line {
  height: 8px;
  border-radius: 5px;
  background: var(--panel-2);
  border: 1.5px solid var(--line);
  overflow: hidden;
  margin-bottom: 22px;
}
.progress-line i {
  display: block; height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* --- Вопрос --- */
.poll-head { margin-bottom: 26px; }
.poll-head .cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  border: 1.5px solid var(--line);
}
.question { margin-bottom: 26px; }
.question:last-of-type { margin-bottom: 0; }
.q-num {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.05em;
  color: var(--muted-2);
  text-transform: uppercase;
  margin-bottom: 10px;
}
.q-title { font-family: var(--font-head); font-size: clamp(17px, 3.2vw, 21px); font-weight: 700; letter-spacing: -0.01em; }
.q-hint { color: var(--muted); font-size: 13.5px; margin-top: 6px; }
.q-image { width: 100%; border-radius: var(--radius-sm); margin-top: 14px; border: 1.5px solid var(--line); }
.q-rule {
  display: inline-block;
  margin-top: 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  background: var(--accent);
  padding: 3px 10px;
  border-radius: 100px;
}

.options { display: grid; gap: 10px; margin-top: 16px; }
.option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 17px;
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  border: 2px solid var(--line);
  cursor: pointer;
  transition: transform 0.14s cubic-bezier(0.2, 0.8, 0.2, 1), border-color 0.15s, box-shadow 0.15s;
}
.option:hover { border-color: var(--line-strong); transform: translate(-2px, -2px); box-shadow: 3px 3px 0 0 rgba(0, 0, 0, 0.4); }
.option:active { transform: translate(0, 0); box-shadow: none; }
.option.selected {
  border-color: var(--accent);
  box-shadow: 4px 4px 0 0 var(--accent);
  transform: translate(-2px, -2px);
}
.option .mark {
  position: relative;
  z-index: 1;
  width: 22px; height: 22px;
  flex: none;
  border: 2px solid var(--line-strong);
  transition: 0.18s cubic-bezier(0.2, 1.3, 0.4, 1);
}
.option .mark.radio { border-radius: 50%; }
.option .mark.check { border-radius: 6px; }
.option .mark svg { position: absolute; inset: 1px; opacity: 0; transform: scale(0.4); transition: 0.2s cubic-bezier(0.2, 1.5, 0.4, 1); stroke: var(--ink); }
.option.selected .mark { border-color: var(--accent); background: var(--accent); }
.option.selected .mark svg { opacity: 1; transform: scale(1); }
.option .label { position: relative; z-index: 1; flex: 1; font-size: 15.5px; font-weight: 560; }
.option .thumb {
  position: relative; z-index: 1;
  width: 46px; height: 46px; flex: none;
  border-radius: 9px; object-fit: cover;
  border: 1.5px solid var(--line);
}
.option.shake { animation: shake 0.4s; }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  30%, 70% { transform: translateX(4px); }
  50%      { transform: translateX(-4px); }
}

.other-wrap { margin-top: 10px; }
textarea, input[type='text'] {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  border: 2px solid var(--line);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  resize: vertical;
  transition: border-color 0.2s;
}
textarea:focus, input[type='text']:focus {
  outline: none;
  border-color: var(--accent);
}
textarea::placeholder, input::placeholder { color: var(--muted-2); }

/* --- Кнопки --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 15px 26px;
  border-radius: var(--radius-sm);
  border: 2.5px solid var(--ink);
  font: inherit;
  font-family: var(--font-head);
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;
  text-decoration: none;
  color: var(--ink);
  background: var(--accent);
  box-shadow: 5px 5px 0 0 rgba(0, 0, 0, 0.55);
  transition: transform 0.14s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.18s, opacity 0.2s;
}
.btn:hover { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 0 rgba(0, 0, 0, 0.55); }
.btn:active { transform: translate(1px, 1px); box-shadow: 2px 2px 0 0 rgba(0, 0, 0, 0.55); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.block { width: 100%; }
.btn.ghost {
  background: transparent;
  border: 2px solid var(--line-strong);
  box-shadow: none;
  color: var(--text);
}
.btn.ghost:hover { border-color: var(--accent); box-shadow: none; transform: none; }
.btn .ld {
  width: 16px; height: 16px;
  border: 2px solid rgba(12, 12, 13, 0.3);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}
.btn.loading .ld { display: block; }
.btn.loading span { opacity: 0.7; }

.submit-row { margin-top: 28px; }
.error-msg {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--danger) 16%, var(--panel));
  border: 2px solid var(--danger);
  color: #ffd6d6;
  font-size: 14px;
  font-weight: 560;
  display: none;
}
.error-msg.show { display: block; animation: fadeUp 0.3s both; }

/* --- Спасибо --- */
.thanks { text-align: center; padding: clamp(30px, 7vw, 56px) clamp(18px, 5vw, 40px); }
.tick {
  width: 84px; height: 84px;
  margin: 0 auto 24px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ok);
  border: 2.5px solid var(--ink);
  box-shadow: 5px 5px 0 0 rgba(0, 0, 0, 0.5);
  animation: pop 0.5s cubic-bezier(0.2, 1.4, 0.3, 1) both;
}
@keyframes pop {
  0%   { transform: scale(0.5); opacity: 0; }
  60%  { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}
.tick svg { width: 40px; height: 40px; stroke: var(--ink); }
.tick svg path {
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  animation: draw 0.5s 0.2s cubic-bezier(0.6, 0, 0.3, 1) forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }
.thanks h2 { margin-bottom: 10px; }
.thanks .share { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 26px; }

/* --- Результаты (если включены) --- */
.results { margin-top: 30px; text-align: left; }
.res-q { margin-bottom: 22px; }
.res-q h3 { font-family: var(--font-head); font-size: 16px; margin-bottom: 12px; }
.res-row { margin-bottom: 12px; }
.res-row .top { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; margin-bottom: 6px; font-weight: 560; }
.res-row .top b { font-variant-numeric: tabular-nums; }
.res-bar { height: 10px; border-radius: 6px; background: var(--panel-2); border: 1.5px solid var(--line); overflow: hidden; }
.res-bar i {
  display: block; height: 100%;
  background: var(--accent);
  width: 0;
  transition: width 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* --- Реклама --- */
.ad-slot { margin: 22px auto; max-width: 100%; min-height: 0; overflow: hidden; }
.ad-slot:empty { display: none; }

/* --- Футер --- */
.footer {
  margin-top: 34px;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted-2);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.footer a { color: var(--muted); text-decoration: none; }
.footer a:hover { color: var(--text); }
.anon-badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px;
  border-radius: 100px;
  background: var(--panel);
  border: 1.5px solid var(--line);
  font-weight: 560;
}

/* --- Заглушки состояний --- */
.state { text-align: center; padding: clamp(34px, 8vw, 64px) 24px; }
.state .emoji { font-size: 44px; margin-bottom: 16px; display: block; }

/* --- Лендинг --- */
.hero { text-align: center; padding: clamp(24px, 7vw, 60px) 0 clamp(20px, 5vw, 40px); }
.hero h1 { max-width: 16ch; margin: 14px auto 0; }
.hero .lead { max-width: 46ch; margin: 16px auto 0; }
.poll-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); margin-top: 8px; }
.poll-card {
  display: block;
  padding: 22px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 2px solid var(--line);
  text-decoration: none;
  color: var(--text);
  transition: transform 0.16s cubic-bezier(0.2, 0.8, 0.2, 1), border-color 0.16s, box-shadow 0.16s;
}
.poll-card:hover { transform: translate(-3px, -3px); border-color: var(--accent); box-shadow: 5px 5px 0 0 rgba(0, 0, 0, 0.45); }
.poll-card h3 { font-family: var(--font-head); font-size: 17px; margin-bottom: 8px; }
.feature-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-top: 30px; }
.feature {
  padding: 18px;
  border-radius: var(--radius-sm);
  background: var(--panel);
  border: 2px solid var(--line);
}
.feature b { display: block; font-family: var(--font-head); font-size: 14.5px; margin-bottom: 4px; font-weight: 700; }
.feature span { font-size: 13px; color: var(--muted); }

@media (max-width: 480px) {
  .wrap { padding: 14px 14px 44px; }
  .card.pad { padding: 20px 17px; }
  .option { padding: 14px 15px; }
}

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