/* ==========================================================================
   Poll — дизайн-система
   Шрифты: Forma DJR Text (blackboard.glvrd.ru)
   ========================================================================== */

@font-face {
  font-family: 'Forma DJR Text';
  src: url('/fonts/forma-djr-text-regular-web.woff2') format('woff2'),
    url('/fonts/forma-djr-text-regular-web.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  font-feature-settings: 'ss03' on;
}

@font-face {
  font-family: 'Forma DJR Text';
  src: url('/fonts/forma-djr-text-bold-web.woff2') format('woff2'),
    url('/fonts/forma-djr-text-bold-web.woff') format('woff');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  font-feature-settings: 'ss03' on;
}

:root {
  --font: 'Forma DJR Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', Verdana, Arial, sans-serif;
  --font-text: Arial, 'Helvetica Neue', Helvetica, 'Segoe UI', sans-serif;

  --bg: #f3f0ea;
  --surface: #fffdf9;
  --surface-2: #eae5dc;
  --text: #14110e;
  --muted: #6d665e;
  --faint: #9a938a;
  --line: #ddd5c8;
  --line-strong: #c9c0b1;
  --accent: #ee7b2f;
  --accent-strong: #d9641a;
  --accent-ink: #1a0e04;
  --accent-soft: rgba(238, 123, 47, 0.13);
  --track: rgba(20, 17, 14, 0.09);
  --ink: #14110e;
  --ink-soft: #3a342e;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 24px 48px -36px rgba(28, 20, 10, 0.45);
  --bg-blur: rgba(243, 240, 234, 0.82);
  --good: #2f7d4f;
  --bad: #b4432a;
  --radius: 20px;
  --radius-sm: 12px;
  --max: 1120px;
}

[data-theme='dark'] {
  --bg: #0b0b0c;
  --surface: #151517;
  --surface-2: #202024;
  --text: #f5f1e9;
  --muted: #a49c92;
  --faint: #756e66;
  --line: #2a2a2e;
  --line-strong: #3b3b41;
  --accent: #ff8a3d;
  --accent-strong: #ff9f5f;
  --accent-ink: #180b02;
  --accent-soft: rgba(255, 138, 61, 0.16);
  --track: rgba(255, 255, 255, 0.1);
  --ink: #f5f1e9;
  --ink-soft: #cfc7bc;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 24px 48px -36px rgba(0, 0, 0, 0.8);
  --bg-blur: rgba(11, 11, 12, 0.82);
  --good: #63c78c;
  --bad: #ff7b62;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-text);
  font-size: 16px;
  line-height: 1.45;
  font-feature-settings: 'ss03' on;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  color-scheme: light;
  overflow-x: hidden;
}

[data-theme='dark'] body {
  color-scheme: dark;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(1100px 520px at 78% -12%, var(--accent-soft), transparent 62%),
    radial-gradient(900px 500px at -10% 0%, rgba(20, 17, 14, 0.05), transparent 60%);
}

[data-theme='dark'] body::before {
  background:
    radial-gradient(1100px 520px at 78% -12%, var(--accent-soft), transparent 62%),
    radial-gradient(900px 500px at -10% 0%, rgba(255, 255, 255, 0.035), transparent 60%);
}

h1,
h2,
h3,
h4 {
  font-family: var(--font);
  font-weight: 700;
  letter-spacing: -0.02em;
}

strong,
b {
  font-weight: 700;
  letter-spacing: -0.02em;
}

p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.wrap-narrow {
  max-width: 760px;
}

.wrap {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: 28px;
}

.micro {
  font-size: 11px;
  line-height: 1.2;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.muted {
  color: var(--muted);
}

.num {
  font-variant-numeric: tabular-nums;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------- topbar --------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-block: 22px;
  position: relative;
  z-index: 5;
}

.brand {
  font-family: var(--font);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}

.brand-dot {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  background: var(--accent);
  transform: rotate(45deg);
  flex-shrink: 0;
}

.brand-sub {
  color: var(--muted);
  font-weight: 400;
  font-size: 15px;
}

.topbar-sep {
  width: 1px;
  height: 18px;
  background: var(--line);
}

.topbar-spacer {
  flex: 1;
}

.topbar .date {
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
}

.live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.live i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 18%, transparent);
  transition: background 0.2s, box-shadow 0.2s;
}

.live[data-state='offline'] i {
  background: var(--faint);
  box-shadow: none;
}

.live[data-state='offline'] {
  color: var(--faint);
}

/* ------------------------------- кнопки --------------------------------- */

.btn {
  --btn-bg: transparent;
  --btn-fg: var(--text);
  --btn-line: var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--btn-line);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-align: center;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

.btn:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
}

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

.btn[disabled] {
  opacity: 0.42;
  pointer-events: none;
}

.btn-primary {
  --btn-bg: var(--accent);
  --btn-fg: var(--accent-ink);
  --btn-line: var(--accent);
  padding-inline: 24px;
}

.btn-primary:hover {
  --btn-bg: var(--accent-strong);
  --btn-line: var(--accent-strong);
}

.btn-ghost {
  --btn-line: transparent;
  --btn-fg: var(--muted);
}

.btn-ghost:hover {
  --btn-fg: var(--text);
  background: var(--surface-2);
}

.btn-sm {
  height: 34px;
  padding: 0 13px;
  font-size: 13px;
}

.btn-danger {
  --btn-fg: var(--bad);
  --btn-line: color-mix(in srgb, var(--bad) 40%, transparent);
}

.btn-danger:hover {
  --btn-bg: color-mix(in srgb, var(--bad) 10%, transparent);
  --btn-line: var(--bad);
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: background 0.16s, border-color 0.16s;
  flex-shrink: 0;
}

.icon-btn:hover {
  background: var(--surface-2);
  border-color: var(--line-strong);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

[data-theme='light'] .icon-sun,
[data-theme='dark'] .icon-moon {
  display: none;
}

/* -------------------------------- poll ---------------------------------- */

.page-poll {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.poll-shell {
  flex: 1;
  width: 100%;
  max-width: 760px;
  margin-inline: auto;
  padding: 18px 24px 56px;
  display: flex;
  flex-direction: column;
}

.poll-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
}

.poll-head .kicker {
  font-size: 13px;
  color: var(--muted);
}

.poll-head .kicker b {
  color: var(--text);
}

.progress {
  height: 3px;
  background: var(--track);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 30px;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: inherit;
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.question {
  scroll-margin-top: 20px;
}

.q-head {
  margin-bottom: 26px;
}

.q-title {
  font-size: clamp(26px, 4.2vw, 38px);
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin: 0;
  text-wrap: balance;
}

.q-hint {
  font-size: 14px;
  color: var(--muted);
  margin: 10px 0 0;
}

.q-hint:empty {
  display: none;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 28px;
}

.option {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  width: auto;
  margin: 0 -14px;
  text-align: left;
  padding: 14px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  font-size: 16px;
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--text);
  transition: background 0.15s, transform 0.12s;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.option:hover {
  background: var(--surface-2);
}

.option:active {
  transform: scale(0.995);
}

.option .mark {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  display: grid;
  place-items: center;
  transition: border-color 0.15s, background 0.15s;
}

.option[data-type='multi'] .mark {
  border-radius: 6px;
}

.option .mark::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-ink);
  transform: scale(0);
  transition: transform 0.16s cubic-bezier(0.22, 1, 0.36, 1);
}

.option[data-type='multi'] .mark::after {
  border-radius: 2px;
  width: 10px;
  height: 10px;
}

.option[aria-pressed='true'] {
  background: var(--accent-soft);
}

.option[aria-pressed='true'] .mark {
  background: var(--accent);
  border-color: var(--accent);
}

.option[aria-pressed='true'] .mark::after {
  transform: scale(1);
}

.option[aria-pressed='true'] .opt-label {
  font-weight: 700;
}

.opt-label {
  flex: 1;
  min-width: 0;
}

.textarea {
  width: 100%;
  min-height: 132px;
  resize: vertical;
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 16px;
  line-height: 1.45;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.textarea::placeholder {
  color: var(--faint);
}

.counter {
  margin-top: 8px;
  font-size: 12px;
  color: var(--faint);
  text-align: right;
}

.form-error {
  display: none;
  align-items: center;
  gap: 8px;
  margin: 4px 0 18px;
  color: var(--bad);
  font-size: 14px;
  font-weight: 700;
}

.form-error[data-show='true'] {
  display: flex;
}

.poll-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px -34px -26px;
  padding: 14px 34px calc(20px + env(safe-area-inset-bottom));
  position: sticky;
  bottom: 0;
  background: linear-gradient(to bottom, transparent, var(--surface) 38%);
  border-radius: 0 0 26px 26px;
  z-index: 2;
}

.poll-foot .spacer {
  flex: 1;
}

.poll-note {
  font-size: 13px;
  color: var(--faint);
  margin-top: 26px;
  line-height: 1.5;
  max-width: 52ch;
}

/* появление вопроса */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.animate-in {
  animation: rise 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.poll-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 34px 34px 26px;
  box-shadow: var(--shadow);
}

.poll-intro {
  padding: 10px 4px 0;
}

.poll-intro h1 {
  font-size: clamp(34px, 6vw, 54px);
  line-height: 1.02;
  letter-spacing: -0.035em;
  margin: 18px 0 14px;
  text-wrap: balance;
}

.poll-intro .lede {
  font-size: 17px;
  color: var(--muted);
  max-width: 46ch;
  line-height: 1.5;
}

.poll-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 26px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
  background: var(--surface);
}

.tag b {
  color: var(--text);
}

.banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin-top: 22px;
  border-radius: 14px;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  font-size: 14px;
}

.banner a {
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ------------------------------- success -------------------------------- */

.success {
  text-align: center;
  padding: 70px 20px;
  margin: auto;
}

#stage {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.success-mark {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  margin: 0 auto 26px;
  animation: pop 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.success h1 {
  font-size: clamp(30px, 5vw, 44px);
  margin: 0 0 10px;
}

.success p {
  color: var(--muted);
  font-size: 17px;
}

@keyframes pop {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }
  60% {
    transform: scale(1.06);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.dots {
  display: inline-flex;
  gap: 5px;
  margin-left: 6px;
}

.dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  animation: blink 1.2s infinite;
}

.dots i:nth-child(2) {
  animation-delay: 0.15s;
}
.dots i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes blink {
  0%,
  100% {
    opacity: 0.25;
  }
  50% {
    opacity: 1;
  }
}

/* ------------------------------- results -------------------------------- */

.hero {
  padding: 10px 0 30px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 40px;
}

.hero h1 {
  font-size: clamp(40px, 7vw, 76px);
  line-height: 0.94;
  letter-spacing: -0.045em;
  margin: 14px 0 16px;
}

.hero .sub {
  color: var(--muted);
  font-size: 15px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: center;
}

.hero .sub b {
  color: var(--text);
}

.hero-side {
  text-align: right;
  flex-shrink: 0;
  padding-bottom: 6px;
}

.big-num {
  font-family: var(--font);
  font-size: clamp(44px, 7vw, 84px);
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
}

.big-num-label {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  margin-top: 8px;
}

.spark {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 34px;
  margin-top: 14px;
  justify-content: flex-end;
}

.spark i {
  width: 4px;
  min-height: 0;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0.55;
  transition: height 0.4s ease;
}

.spark i:last-child {
  opacity: 1;
}

.focusbar {
  position: sticky;
  top: 0;
  z-index: 30;
  margin: 0 0 26px;
  padding: 12px 0;
  background: var(--bg-blur);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

.focusbar[data-stuck='true'] {
  border-bottom-color: var(--line);
}

.focusbar-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: 28px;
}

.focusbar .label {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--muted);
  flex-shrink: 0;
  margin-right: 2px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 2px;
  min-width: 0;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 33px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 400;
  white-space: nowrap;
  transition: background 0.16s, border-color 0.16s, color 0.16s;
  flex-shrink: 0;
}

.chip .chip-count {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.chip:hover {
  border-color: var(--line-strong);
}

.chip[aria-pressed='true'] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}

.chip[aria-pressed='true'] .chip-count {
  color: color-mix(in srgb, var(--accent-ink) 70%, transparent);
}

.focusbar-sub {
  margin-top: 8px;
}

.focus-summary {
  margin-left: auto;
  padding-left: 10px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.focus-summary:empty {
  display: none;
}

.chip-clear {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  padding: 0 10px;
}

.chip-clear:hover {
  color: var(--text);
  background: var(--surface-2);
}

.result-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--faint);
  margin: -8px 0 22px;
}

.result-hint svg {
  flex-shrink: 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding-bottom: 40px;
  align-items: start;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 24px 20px;
  box-shadow: var(--shadow);
  min-width: 0;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.card-wide {
  grid-column: 1 / -1;
}

.card-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 18px;
}

.card-index {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--accent);
  padding-top: 4px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.card-title {
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: 0;
  flex: 1;
  min-width: 0;
  text-wrap: pretty;
}

.card-sub {
  font-size: 12px;
  color: var(--faint);
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}

.card-meta {
  font-size: 12px;
  color: var(--faint);
  white-space: nowrap;
  padding-top: 4px;
  font-variant-numeric: tabular-nums;
}

.opt {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: none;
  padding: 9px 10px;
  margin: 0 -10px;
  border-radius: 10px;
  transition: background 0.15s, opacity 0.25s;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

button.opt:hover {
  background: var(--surface-2);
}

.opt-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 7px;
}

.opt-name {
  font-size: 14.5px;
  line-height: 1.3;
  letter-spacing: -0.005em;
  min-width: 0;
  transition: color 0.2s;
}

.opt-val {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.opt-val b {
  color: var(--text);
  font-size: 14.5px;
  margin-right: 4px;
}

.opt-track {
  display: block;
  height: 7px;
  border-radius: 999px;
  background: var(--track);
  overflow: hidden;
}

.opt-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--ink);
  transition: width 0.55s cubic-bezier(0.22, 1, 0.36, 1), background 0.2s;
  will-change: width;
}

.opt.is-active .opt-name {
  font-weight: 700;
}

.opt.is-active .opt-fill {
  background: var(--accent);
}

.card[data-own-focus='true'] .opt:not(.is-active) {
  opacity: 0.5;
}

.card[data-own-focus='true'] .opt:not(.is-active):hover {
  opacity: 0.75;
}

.opt-empty {
  font-size: 14px;
  color: var(--faint);
  padding: 12px 0;
}

.opt.is-new .opt-val b {
  animation: bump 0.6s ease;
}

@keyframes bump {
  0% {
    color: var(--accent);
    transform: scale(1.18);
  }
  100% {
    transform: scale(1);
  }
}

.opt-fill.is-new {
  animation: flash 0.7s ease;
}

@keyframes flash {
  0% {
    filter: brightness(1.6);
  }
  100% {
    filter: none;
  }
}

.empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 56px 28px;
  text-align: center;
  color: var(--muted);
  margin-bottom: 40px;
}

.empty-state h2 {
  color: var(--text);
  font-size: 22px;
  margin: 0 0 8px;
}

.foot {
  border-top: 1px solid var(--line);
  padding: 22px 0 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--faint);
}

.foot a {
  color: var(--muted);
}

.foot a:hover {
  color: var(--text);
}

/* ------------------------------ вопросы -------------------------------- */

.questions-shell {
  padding-bottom: 40px;
}

.questions-hero {
  padding: 10px 0 24px;
}

.questions-hero h1 {
  font-size: clamp(38px, 6.4vw, 72px);
  line-height: 0.96;
  letter-spacing: -0.045em;
  margin: 14px 0 16px;
}

.questions-shell .banner {
  margin: 0 0 22px;
}

.vote-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 6px 0 40px;
}

.q-card {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  gap: 6px 16px;
  align-items: start;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: border-color 0.18s;
}

.q-card:hover {
  border-color: var(--line-strong);
}

.q-rank {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--accent);
  padding-top: 5px;
  font-variant-numeric: tabular-nums;
}

.q-text {
  margin: 0;
  font-size: 19px;
  line-height: 1.38;
  letter-spacing: -0.005em;
  overflow-wrap: anywhere;
}

.q-card[data-top='true'] .q-text {
  font-size: 23px;
  line-height: 1.3;
  letter-spacing: -0.012em;
}

/* Первая пятёрка — на 50% крупнее топ-10 */
.q-card[data-top5='true'] .q-text {
  font-size: 34.5px;
  line-height: 1.22;
  letter-spacing: -0.02em;
}

.q-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.q-own {
  color: var(--accent-strong);
  font-weight: 700;
}

.vote {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface-2);
}

.vote-btn {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  transition: background 0.15s, color 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.vote-btn svg {
  width: 19px;
  height: 19px;
}

.vote-btn:hover {
  background: var(--surface);
  color: var(--text);
}

.vote-btn:active {
  transform: scale(0.93);
}

.vote-btn[data-vote='1'][aria-pressed='true'] {
  background: var(--accent);
  color: var(--accent-ink);
}

.vote-btn[data-vote='-1'][aria-pressed='true'] {
  background: var(--ink);
  color: var(--bg);
}

.vote-score {
  min-width: 46px;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  transition: color 0.15s;
}

.vote-score[data-sign='pos'] {
  color: var(--accent-strong);
}

.vote-score[data-sign='neg'] {
  color: var(--bad);
}

@media (max-width: 640px) {
  .questions-hero h1 {
    margin: 10px 0 12px;
  }

  .q-card {
    grid-template-columns: 22px minmax(0, 1fr);
    padding: 16px;
    gap: 4px 12px;
  }

  .q-text {
    font-size: 17px;
  }

  .q-card[data-top='true'] .q-text {
    font-size: 20px;
  }

  .q-card[data-top5='true'] .q-text {
    font-size: 30px;
    line-height: 1.18;
  }

  .vote {
    grid-column: 2;
    justify-self: start;
    margin-top: 10px;
  }
}

/* -------------------------------- admin --------------------------------- */

.admin-shell {
  max-width: 1120px;
  margin-inline: auto;
  padding: 0 28px 60px;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 34px;
  box-shadow: var(--shadow);
}

.login-card h1 {
  font-size: 26px;
  margin: 18px 0 6px;
}

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 26px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  border: 0;
  background: none;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}

.tab:hover {
  color: var(--text);
}

.tab[aria-selected='true'] {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.panel[hidden] {
  display: none;
}

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

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

.stats-row {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  margin-bottom: 22px;
}

.stat .k {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 700;
}

.stat .v {
  font-family: var(--font);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.q-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.q-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  padding: 16px 18px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.q-item[data-archived='true'] {
  opacity: 0.6;
}

.q-pos {
  font-size: 12px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  padding-top: 3px;
  width: 18px;
  flex-shrink: 0;
}

.q-body {
  flex: 1;
  min-width: 0;
}

.q-item .q-body h3 {
  font-size: 16px;
  margin: 0 0 4px;
  line-height: 1.3;
}

.q-item .q-body p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}

.q-tools {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-left: 8px;
  vertical-align: 2px;
}

.badge-accent {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.badge-warn {
  background: color-mix(in srgb, var(--bad) 12%, transparent);
  color: var(--bad);
}

.icon-mini {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.icon-mini:hover {
  background: var(--surface-2);
  color: var(--text);
}

.icon-mini[disabled] {
  opacity: 0.3;
  pointer-events: none;
}

.icon-mini svg {
  width: 16px;
  height: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 16px;
}

.field label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.input,
.select {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 15px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus,
.select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

textarea.input {
  height: auto;
  min-height: 92px;
  padding: 12px 14px;
  resize: vertical;
  line-height: 1.45;
}

.field-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.head-actions {
  flex: 0 0 auto;
}

.field-row > * {
  flex: 1;
  min-width: 180px;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}

.check input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
  margin: 0;
}

.hint {
  font-size: 12.5px;
  color: var(--faint);
  line-height: 1.45;
}

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

.dialog {
  border: 1px solid var(--line);
  border-radius: 22px;
  max-height: calc(100dvh - 24px);
  overflow: auto;
  padding: 0;
  background: var(--surface);
  color: var(--text);
  width: min(560px, calc(100vw - 32px));
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.5);
}

.dialog::backdrop {
  background: rgba(10, 8, 6, 0.55);
  backdrop-filter: blur(3px);
}

.dialog form {
  padding: 26px;
}

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

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.data th,
table.data td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  line-height: 1.4;
}

table.data th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: var(--surface);
}

table.data tr:last-child td {
  border-bottom: 0;
}

table.data td.time {
  white-space: nowrap;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.text-answers {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.text-answer {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--surface);
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.text-answer .meta {
  font-size: 11px;
  color: var(--faint);
  margin-top: 6px;
}

.agg {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}

.agg-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 14px;
  align-items: center;
}

.agg-label {
  font-size: 13.5px;
  line-height: 1.3;
}

.agg-val {
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.agg-bar {
  grid-column: 1 / -1;
  height: 6px;
  border-radius: 999px;
  background: var(--track);
  overflow: hidden;
  margin-top: -2px;
}

.agg-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--ink);
}

.panel-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  padding: 22px;
  margin-bottom: 18px;
}

.panel-card h3 {
  font-size: 16px;
  margin: 0 0 4px;
}

.panel-card .sub {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  background: var(--ink);
  color: var(--bg);
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 100;
  max-width: calc(100vw - 32px);
  text-align: center;
}

.toast[data-show='true'] {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast[data-error='true'] {
  background: var(--bad);
  color: #fff;
}

.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, currentColor 25%, transparent);
  border-top-color: currentColor;
  animation: spin 0.7s linear infinite;
  display: inline-block;
  vertical-align: -3px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

[hidden] {
  display: none !important;
}

@media (min-width: 900px) {
  .poll-shell {
    padding-top: 34px;
  }
}

/* ----------------------------- responsive ------------------------------- */

@media (max-width: 900px) {
  .hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 24px;
  }

  .hero-side {
    text-align: left;
  }

  .spark {
    justify-content: flex-start;
  }

  .grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .wrap,
  .admin-shell,
  .focusbar-inner {
    padding-inline: 18px;
  }

  .topbar {
    padding-block: 16px;
    gap: 10px;
  }

  .live {
    display: none;
  }

  .brand-sub,
  .topbar .date,
  .topbar-sep {
    display: none;
  }

  .live span {
    display: none;
  }

  .poll-shell {
    padding: 6px 16px 30px;
  }

  .poll-card {
    padding: 24px 20px 20px;
    border-radius: 22px;
  }

  .poll-foot {
    margin: 14px -20px -20px;
    padding: 14px 20px calc(18px + env(safe-area-inset-bottom));
    border-radius: 0 0 22px 22px;
  }

  .option {
    padding: 13px 14px;
    font-size: 15px;
  }

  .hero {
    padding-bottom: 18px;
  }

  .hero h1 {
    margin: 10px 0 12px;
  }

  .card {
    padding: 20px 18px 16px;
  }

  .card-title {
    font-size: 17px;
  }

  .opt-name {
    font-size: 14px;
  }

  .focusbar {
    margin-bottom: 18px;
    position: static;
  }

  .focusbar .label {
    display: none;
  }

  .focus-summary {
    font-size: 11px;
  }

  .chip {
    white-space: normal;
    height: auto;
    min-height: 33px;
    padding: 7px 12px;
    line-height: 1.25;
    max-width: 100%;
    text-align: left;
  }

  .chip .chip-count {
    flex-shrink: 0;
  }

  .head-actions {
    flex: 1 1 100%;
  }

  .head-actions > * {
    flex: 1;
    min-width: 0;
  }

  .page-admin .topbar .btn-ghost {
    display: none;
  }

  .tab {
    font-size: 12.5px;
    padding: 12px 10px;
  }

  .stats-row {
    gap: 18px;
  }

  .stat .v {
    font-size: 20px;
  }

  .q-item {
    flex-wrap: wrap;
  }

  .q-tools {
    width: 100%;
    justify-content: flex-end;
  }

  .dialog form {
    padding: 20px;
  }
}

/* Большие экраны и проекторы: крупнее цифры и подписи */
@media (min-width: 1500px) {
  :root {
    --max: 1320px;
  }

  .hero h1 {
    font-size: 88px;
  }

  .hero .sub {
    font-size: 17px;
  }

  .big-num {
    font-size: 96px;
  }

  .card {
    padding: 28px 28px 24px;
  }

  .card-title {
    font-size: 21px;
  }

  .card-sub {
    font-size: 13px;
  }

  .opt {
    padding: 11px 12px;
    margin: 0 -12px;
  }

  .opt-name {
    font-size: 17px;
  }

  .opt-val {
    font-size: 15px;
  }

  .opt-val b {
    font-size: 17px;
  }

  .opt-track {
    height: 9px;
  }

  .chip {
    height: 36px;
    font-size: 13px;
    padding: 0 14px;
  }

  .focus-summary,
  .result-hint {
    font-size: 13.5px;
  }

  .q-text {
    font-size: 21px;
  }

  .q-card[data-top='true'] .q-text {
    font-size: 26px;
  }

  .q-card[data-top5='true'] .q-text {
    font-size: 39px;
  }
}

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

  html {
    scroll-behavior: auto;
  }
}

@media print {
  .topbar,
  .focusbar,
  .foot,
  .result-hint {
    display: none;
  }

  body::before {
    display: none;
  }

  .card {
    break-inside: avoid;
    box-shadow: none;
  }
}
