:root {
    color-scheme: dark;
    --bg: #0a0a0c;
    --surface: #121216;
    --surface-2: #17171c;
    --surface-3: #1d1d24;
    --border: rgba(255, 255, 255, .07);
    --border-strong: rgba(255, 255, 255, .14);
    --text: #f4f4f5;
    --muted: #a1a1aa;
    --faint: #6b6b76;
    --accent: #2dd4bf;
    --accent-bright: #7af2e3;
    --accent-deep: #0e9488;
    --accent-soft: rgba(45, 212, 191, .1);
    --accent-border: rgba(45, 212, 191, .32);
    --live: #4ade80;
    --live-soft: rgba(74, 222, 128, .1);
    --live-border: rgba(74, 222, 128, .22);
    --danger: #f87171;
    --danger-soft: rgba(248, 113, 113, .1);
    --danger-border: rgba(248, 113, 113, .3);
    --radius: 16px;
    --radius-sm: 10px;
    --mono: "Cascadia Code", "SF Mono", Consolas, monospace;
    --sans: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    font-family: var(--sans);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 90px;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background: var(--bg);
    font-feature-settings: "cv02", "cv11";
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

body::before {
    position: fixed;
    z-index: -1;
    inset: 0;
    background: radial-gradient(70% 45% at 50% -10%, rgba(45, 212, 191, .06), transparent 70%);
    pointer-events: none;
    content: "";
}

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

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

button {
    cursor: pointer;
}

button, a, input, textarea, select {
    -webkit-tap-highlight-color: transparent;
}

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

h1, h2, h3, p {
    margin-top: 0;
}

h1 {
    font-size: clamp(30px, 5vw, 42px);
    font-weight: 700;
    line-height: 1.12;
    letter-spacing: -.025em;
}

h2 {
    font-size: 21px;
    font-weight: 650;
    letter-spacing: -.02em;
}

h3 {
    font-weight: 650;
    letter-spacing: -.015em;
}

/* ---------- Header ---------- */

.site-header {
    position: sticky;
    z-index: 10;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 68px;
    padding: 0 max(24px, calc((100vw - 1120px) / 2));
    border-bottom: 1px solid var(--border);
    background: rgba(10, 10, 12, .75);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    height: 40px;
    width: auto;
    image-rendering: pixelated;
}

.brand-copy {
    display: grid;
    gap: 0;
    line-height: 1.25;
}

.brand-copy strong {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -.01em;
}

.brand-copy small {
    color: var(--muted);
    font-size: 12px;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--muted);
    background: rgba(255, 255, 255, .03);
    font-size: 13px;
    font-weight: 550;
    transition: color .15s ease, border-color .15s ease, background .15s ease;
}

.nav-link:hover {
    border-color: var(--border-strong);
    color: var(--text);
    background: rgba(255, 255, 255, .06);
}

/* ---------- Layout ---------- */

.page-shell {
    width: min(1120px, calc(100% - 48px));
    margin: 0 auto;
    padding: 56px 0 96px;
}

.page-intro {
    margin-bottom: 48px;
}

.page-intro h1 {
    margin-bottom: 10px;
}

.page-intro p {
    max-width: 520px;
    margin-bottom: 0;
    color: var(--muted);
    font-size: 16px;
    line-height: 1.6;
}

.eyebrow {
    display: inline-block;
    margin-bottom: 14px;
    padding: 4px 12px;
    border: 1px solid var(--accent-border);
    border-radius: 999px;
    color: var(--accent-bright);
    background: var(--accent-soft);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .02em;
}

.section-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 20px;
}

.section-heading h2 {
    margin: 0;
}

.section-heading p {
    margin-bottom: 0;
    color: var(--faint);
    font-size: 13px;
}

.expired-section {
    margin-top: 72px;
}

.site-footer {
    padding: 28px max(24px, calc((100vw - 1120px) / 2)) 36px;
    border-top: 1px solid var(--border);
    color: var(--faint);
    font-size: 13px;
}

/* ---------- Poll cards ---------- */

.poll-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.poll-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 26px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(180deg, var(--surface-2), var(--surface));
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.poll-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-strong);
    box-shadow: 0 12px 32px rgba(0, 0, 0, .35);
}

.poll-card h3 {
    margin: 16px 0 8px;
    font-size: 19px;
    line-height: 1.3;
}

.poll-card p {
    display: -webkit-box;
    margin-bottom: 18px;
    overflow: hidden;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.card-meta, .poll-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    color: var(--faint);
    font-size: 13px;
}

.card-meta span + span::before, .poll-meta span + span::before {
    margin-right: 10px;
    color: var(--faint);
    content: "·";
}

.card-open {
    margin-top: 18px;
    color: var(--accent-bright);
    font-size: 13px;
    font-weight: 600;
}

.card-open::after {
    display: inline-block;
    margin-left: 6px;
    content: "→";
    transition: transform .16s ease;
}

.poll-card:hover .card-open::after {
    transform: translateX(4px);
}

/* ---------- Status pill ---------- */

.status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    width: fit-content;
    padding: 4px 11px;
    border: 1px solid var(--live-border);
    border-radius: 999px;
    color: var(--live);
    background: var(--live-soft);
    font-size: 12px;
    font-weight: 600;
}

.status::before {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 8px var(--live);
    animation: pulse 2s ease-in-out infinite;
    content: "";
}

.status.expired {
    border-color: var(--border-strong);
    color: var(--muted);
    background: rgba(255, 255, 255, .05);
}

.status.expired::before {
    box-shadow: none;
    animation: none;
}

/* ---------- Loading / empty ---------- */

.loading-card {
    grid-column: 1 / -1;
    padding: 44px 24px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    color: var(--faint);
    font-size: 14px;
    text-align: center;
}

/* ---------- Poll detail page ---------- */

.poll-page {
    max-width: 760px;
}

.poll-back {
    display: flex;
    align-items: center;
    width: fit-content;
    margin-bottom: 28px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 550;
    transition: color .15s ease;
}

.poll-back::before {
    margin-right: 7px;
    content: "←";
    transition: transform .16s ease;
}

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

.poll-back:hover::before {
    transform: translateX(-3px);
}

.poll-intro {
    margin-bottom: 36px;
}

.poll-intro h1 {
    margin: 16px 0 12px;
}

.poll-intro p {
    max-width: 620px;
    margin-bottom: 0;
    color: var(--muted);
    font-size: 16px;
    line-height: 1.65;
}

.poll-meta {
    margin-top: 18px;
}

/* ---------- Questions / voting ---------- */

.question-stack, .results-stack {
    display: grid;
    gap: 16px;
}

.question-card, .results-card, .panel {
    padding: 26px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.question-number {
    color: var(--faint);
    font-size: 12px;
    font-weight: 650;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.question-card h2, .results-card h2 {
    margin: 8px 0 18px;
    font-size: 19px;
}

.option-list {
    display: grid;
    gap: 10px;
}

.vote-option {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--muted);
    background: var(--surface-2);
    font-size: 15px;
    line-height: 1.4;
    transition: border-color .15s ease, background .15s ease, color .15s ease;
    cursor: pointer;
}

.vote-option:hover {
    border-color: var(--border-strong);
    color: var(--text);
    background: var(--surface-3);
}

.vote-option:has(input:checked) {
    border-color: var(--accent-border);
    color: var(--text);
    background: var(--accent-soft);
}

.vote-option input {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    margin: 0;
    appearance: none;
    border: 2px solid var(--border-strong);
    border-radius: 50%;
    background: transparent;
    transition: border-color .15s ease, background .15s ease;
    cursor: pointer;
}

.vote-option input[type="checkbox"] {
    border-radius: 6px;
}

.vote-option input[type="radio"]:checked {
    border: 6px solid var(--accent);
}

.vote-option input[type="checkbox"]:checked {
    border-color: var(--accent);
    background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%2304211e' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round' d='M3.5 8.5l3 3 6-7'/%3E%3C/svg%3E") center / 12px no-repeat;
}

.form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 24px;
}

.form-actions .muted {
    font-size: 13px;
}

.vote-locked .vote-option {
    cursor: default;
    opacity: .68;
}

.vote-locked .vote-option:hover {
    border-color: var(--border);
    color: var(--muted);
    background: var(--surface-2);
}

.vote-locked .vote-option:has(input:checked),
.vote-locked .vote-option:has(input:checked):hover {
    border-color: var(--accent-border);
    color: var(--text);
    background: var(--accent-soft);
}

.vote-locked #captcha {
    pointer-events: none;
    opacity: .55;
}

.vote-state-message.confirmed {
    color: var(--accent-bright);
}

.vote-state-message.rejected {
    color: var(--danger);
}

/* ---------- Buttons ---------- */

.primary-button, .secondary-button, .danger-button {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    transition: transform .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.primary-button {
    color: #04211e;
    background: linear-gradient(180deg, #5ceada, var(--accent));
    box-shadow: 0 2px 12px rgba(45, 212, 191, .22), inset 0 1px 0 rgba(255, 255, 255, .35);
}

.primary-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 18px rgba(45, 212, 191, .32), inset 0 1px 0 rgba(255, 255, 255, .35);
}

.secondary-button {
    border-color: var(--border-strong);
    color: var(--text);
    background: var(--surface-2);
}

.secondary-button:hover {
    border-color: rgba(255, 255, 255, .25);
    background: var(--surface-3);
}

.danger-button {
    border-color: var(--danger-border);
    color: var(--danger);
    background: var(--danger-soft);
}

.danger-button:hover {
    background: rgba(248, 113, 113, .16);
}

button:disabled {
    cursor: wait;
    opacity: .5;
    transform: none !important;
}

.small-button {
    min-height: 32px;
    padding: 0 12px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    color: var(--muted);
    background: var(--surface-2);
    font-size: 12.5px;
    font-weight: 550;
    transition: color .15s ease, border-color .15s ease, background .15s ease;
}

.small-button:hover {
    border-color: rgba(255, 255, 255, .25);
    color: var(--text);
    background: var(--surface-3);
}

.small-button.danger {
    border-color: var(--danger-border);
    color: var(--danger);
    background: transparent;
}

.small-button.danger:hover {
    background: var(--danger-soft);
}

/* ---------- Results ---------- */

.results-section {
    margin-top: 56px;
}

.result-row {
    margin-top: 18px;
}

.result-row:first-of-type {
    margin-top: 4px;
}

.result-label {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 8px;
    color: var(--text);
    font-size: 14px;
}

.result-label span:last-child {
    flex: 0 0 auto;
    color: var(--faint);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.result-row.leading .result-label span:last-child {
    color: var(--accent-bright);
    font-weight: 600;
}

.result-track {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, .06);
}

.result-fill {
    height: 100%;
    border-radius: 999px;
    background: rgba(255, 255, 255, .22);
    transition: width .6s cubic-bezier(.22, 1, .36, 1);
}

.result-row.leading .result-fill {
    background: linear-gradient(90deg, var(--accent-deep), var(--accent-bright));
}

/* ---------- Modal ---------- */

.modal-backdrop {
    position: fixed;
    z-index: 30;
    inset: 0;
    display: grid;
    padding: 20px;
    place-items: center;
    background: rgba(5, 5, 7, .7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal {
    width: min(480px, 100%);
    padding: 36px 32px;
    border: 1px solid var(--border-strong);
    border-radius: 20px;
    background: var(--surface-2);
    box-shadow: 0 24px 80px rgba(0, 0, 0, .6);
    text-align: center;
    animation: modal-in .25s cubic-bezier(.22, 1, .36, 1);
}

.modal h2 {
    margin: 4px 0 10px;
}

.modal .muted {
    font-size: 14px;
    line-height: 1.6;
}

.auth-modal {
    position: relative;
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    width: 36px;
    height: 36px;
    border: 0;
    color: var(--muted);
    background: transparent;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

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

.auth-content .primary-button, .account-logout {
    width: 100%;
}

.auth-status {
    margin: 0;
    color: var(--accent-bright);
    font-size: 13px;
}

.auth-status.error {
    margin-bottom: 18px;
    color: var(--danger);
}

.auth-spinner {
    display: inline-block;
    width: 28px;
    height: 28px;
    border: 3px solid var(--border-strong);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

.account-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 22px 0;
}

.account-summary span {
    display: grid;
    gap: 4px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
}

.account-summary small {
    color: var(--faint);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
}

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

.command {
    display: block;
    margin: 22px 0 18px;
    padding: 16px;
    border: 1px dashed var(--accent-border);
    border-radius: 12px;
    color: var(--accent-bright);
    background: var(--bg);
    font-family: var(--mono);
    font-size: clamp(17px, 4.5vw, 22px);
    font-weight: 700;
    transition: background .15s ease, border-color .15s ease;
    cursor: copy;
}

.command:hover {
    border-color: var(--accent);
    background: rgba(245, 158, 11, .06);
}

.command-hint {
    display: block;
    margin: -8px 0 16px;
    color: var(--faint);
    font-size: 12px;
}

/* ---------- Forms ---------- */

.field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.field, .check-field {
    display: grid;
    gap: 7px;
}

.field.full {
    grid-column: 1 / -1;
}

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

.field input, .field textarea, .field select, .option-editor input {
    width: 100%;
    min-height: 42px;
    padding: 10px 13px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    outline: none;
    color: var(--text);
    background: var(--bg);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.field textarea {
    min-height: 100px;
    resize: vertical;
}

.field input:focus, .field textarea:focus, .field select:focus, .option-editor input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.check-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 16px;
}

.check-field {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 10px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--muted);
    background: var(--bg);
    font-size: 13.5px;
    transition: border-color .15s ease, background .15s ease, color .15s ease;
    cursor: pointer;
}

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

.check-field:has(input:checked) {
    border-color: var(--accent-border);
    color: var(--text);
    background: var(--accent-soft);
}

.check-field input {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin: 0;
    appearance: none;
    border: 2px solid var(--border-strong);
    border-radius: 6px;
    transition: border-color .15s ease, background .15s ease;
    cursor: pointer;
}

.check-field input:checked {
    border-color: var(--accent);
    background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%2304211e' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round' d='M3.5 8.5l3 3 6-7'/%3E%3C/svg%3E") center / 11px no-repeat;
}

/* ---------- Admin ---------- */

.admin-site .page-shell {
    width: min(1280px, calc(100% - 48px));
}

.login-card {
    width: min(420px, 100%);
    margin: 48px auto 0;
    padding: 40px 36px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: linear-gradient(180deg, var(--surface-2), var(--surface));
    box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}

.login-head {
    margin-bottom: 28px;
    text-align: center;
}

.login-head .brand-logo {
    display: block;
    height: 64px;
    margin: 0 auto 18px;
}

.login-head h1 {
    margin-bottom: 6px;
    font-size: 24px;
}

.login-head p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 14px;
}

.login-card .primary-button {
    width: 100%;
    margin-top: 6px;
}

.admin-toolbar, .inline-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.admin-toolbar {
    justify-content: space-between;
    margin-bottom: 28px;
}

.admin-toolbar h1 {
    margin: 0;
    font-size: clamp(26px, 4vw, 32px);
}

.admin-toolbar .toolbar-sub {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.editor-toolbar {
    margin: 32px 0 14px;
    padding-top: 26px;
    border-top: 1px solid var(--border);
}

.editor-toolbar h2 {
    margin: 0;
    font-size: 18px;
}

.admin-layout {
    display: grid;
    grid-template-columns: minmax(300px, .68fr) minmax(520px, 1.32fr);
    gap: 16px;
    align-items: start;
}

.panel-heading {
    margin: -26px -26px 22px;
    padding: 16px 26px;
    border-bottom: 1px solid var(--border);
}

.panel-heading h2 {
    margin: 0;
    font-size: 16px;
}

.poll-index-panel {
    position: sticky;
    top: 86px;
    max-height: calc(100vh - 108px);
    overflow: auto;
}

.admin-polls, .question-editor-list {
    display: grid;
    gap: 10px;
}

.admin-poll-card {
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-2);
    transition: border-color .15s ease;
}

.admin-poll-card:hover {
    border-color: var(--border-strong);
}

.admin-poll-card h3 {
    margin: 12px 0 8px;
    font-size: 15.5px;
}

.admin-poll-card .card-meta {
    font-size: 12.5px;
}

.admin-poll-card .inline-actions {
    margin-top: 14px;
    padding-top: 13px;
    border-top: 1px solid var(--border);
}

.admin-rank-summary {
    margin: 10px 0 0;
    color: var(--faint);
    font-size: 12px;
    line-height: 1.5;
}

.question-editor {
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-2);
}

.question-editor-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 14px;
}

.question-editor-head strong {
    font-size: 13px;
    font-weight: 650;
}

.option-editor-list {
    display: grid;
    gap: 8px;
}

.option-field {
    margin-top: 14px;
}

.add-option {
    margin-top: 10px;
}

.option-editor {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
}

/* ---------- Admin metrics ---------- */

.metrics-panel {
    min-width: 0;
}

.metrics-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.metrics-heading p {
    margin: 5px 0 0;
    color: var(--faint);
    font-size: 12.5px;
}

.metric-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.metric-summary {
    display: grid;
    gap: 8px;
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-2);
}

.metric-summary span {
    color: var(--faint);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.metric-summary strong {
    color: var(--accent-bright);
    font-size: 24px;
    font-variant-numeric: tabular-nums;
}

.metric-summary .metric-summary-text {
    overflow: hidden;
    color: var(--text);
    font-size: 14px;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.metrics-section {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

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

.metrics-section-head h3 {
    margin: 0;
    font-size: 15px;
}

.metrics-section-head span {
    color: var(--faint);
    font-size: 12px;
}

.metric-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 12px;
}

.metric-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border: 1px solid var(--accent-border);
    border-radius: 999px;
    color: var(--accent-bright);
    background: var(--accent-soft);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.metric-chip strong {
    color: var(--text);
    font-weight: 600;
}

.metric-filter {
    appearance: none;
    transition: color .15s ease, border-color .15s ease, background .15s ease;
}

.metric-filter:hover {
    border-color: var(--accent);
    background: rgba(45, 212, 191, .18);
}

.metric-filter.active {
    border-color: var(--accent-bright);
    color: var(--bg);
    background: var(--accent-bright);
}

.metric-filter.active strong {
    color: var(--bg);
}

.metric-chip.compact {
    padding: 4px 8px;
    border-color: var(--border-strong);
    color: var(--muted);
    background: rgba(255, 255, 255, .04);
    font-size: 11px;
}

.metrics-question-list, .rank-options {
    display: grid;
    gap: 12px;
}

.metrics-question {
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-2);
}

.metrics-question h3 {
    margin: 6px 0 16px;
    font-size: 15px;
}

.rank-option {
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
}

.rank-option-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 9px;
    font-size: 13px;
}

.rank-option-head span {
    flex: 0 0 auto;
    color: var(--faint);
    font-size: 11.5px;
    font-variant-numeric: tabular-nums;
}

.metrics-table-wrap {
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.metrics-table {
    width: 100%;
    min-width: 850px;
    border-collapse: collapse;
    background: var(--surface-2);
    font-size: 12px;
    text-align: left;
}

.metrics-table th, .metrics-table td {
    padding: 12px 13px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.metrics-table th {
    color: var(--faint);
    background: var(--surface);
    font-size: 10.5px;
    font-weight: 650;
    letter-spacing: .04em;
    text-transform: uppercase;
}

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

.metrics-table code {
    color: var(--muted);
    font-family: var(--mono);
    font-size: 11px;
}

.vote-answer {
    display: grid;
    gap: 3px;
    min-width: 220px;
    line-height: 1.4;
}

.vote-answer + .vote-answer {
    margin-top: 9px;
    padding-top: 9px;
    border-top: 1px solid var(--border);
}

.vote-answer strong {
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 600;
}

/* ---------- Misc ---------- */

.hidden {
    display: none !important;
}

.captcha-panel {
    margin-top: 16px;
    overflow: auto;
}

.captcha-panel:empty {
    display: none;
}

.muted, .field-help {
    color: var(--muted);
}

.subtle-link {
    display: inline-block;
    margin-top: 12px;
    color: var(--accent-bright);
    font-size: 14px;
    font-weight: 550;
}

.subtle-link:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.toast {
    position: fixed;
    z-index: 50;
    right: 20px;
    bottom: 20px;
    max-width: min(420px, calc(100vw - 40px));
    padding: 13px 18px;
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    color: var(--text);
    background: var(--surface-3);
    box-shadow: 0 12px 40px rgba(0, 0, 0, .45);
    font-size: 14px;
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
}

.toast.visible {
    opacity: 1;
    transform: translateY(0);
}

.toast.error {
    border-color: var(--danger-border);
    background: #231417;
}

@keyframes pulse {
    50% { opacity: .4; }
}

@keyframes modal-in {
    from {
        opacity: 0;
        transform: translateY(12px) scale(.98);
    }
}

/* ---------- Responsive ---------- */

@media (max-width: 980px) {
    .admin-layout {
        grid-template-columns: 1fr;
    }

    .poll-index-panel {
        position: static;
        max-height: none;
    }

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

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

@media (max-width: 760px) {
    html {
        scroll-padding-top: 76px;
    }

    .site-header {
        min-height: 60px;
        padding: 0 18px;
    }

    .brand-copy small {
        display: none;
    }

    .page-shell, .admin-site .page-shell {
        width: calc(100% - 36px);
        padding: 36px 0 72px;
    }

    .page-intro {
        margin-bottom: 36px;
    }

    .section-heading p {
        display: none;
    }

    .poll-grid, .admin-polls, .field-grid, .check-row {
        grid-template-columns: 1fr;
    }

    .poll-card {
        padding: 22px;
    }

    .expired-section {
        margin-top: 52px;
    }

    .results-section {
        margin-top: 44px;
    }

    .question-card, .results-card, .panel {
        padding: 20px;
    }

    .panel-heading {
        margin: -20px -20px 18px;
        padding: 14px 20px;
    }

    .form-actions {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    .form-actions .primary-button, .form-actions .secondary-button {
        width: 100%;
    }

    .login-card {
        margin-top: 16px;
        padding: 30px 24px;
    }

    .admin-toolbar > .inline-actions {
        width: 100%;
    }

    .admin-toolbar > .inline-actions button {
        flex: 1;
    }

    .metrics-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .metrics-heading .inline-actions {
        width: 100%;
    }

    .metrics-heading .small-button {
        flex: 1;
    }

    .rank-option-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }

    .modal {
        padding: 28px 22px;
    }

    .site-footer {
        padding: 24px 18px 32px;
    }
}

@media (max-width: 430px) {
    .question-editor {
        padding: 14px;
    }

    .option-editor {
        grid-template-columns: 1fr;
    }

    .option-editor .small-button {
        justify-self: end;
    }

    .admin-poll-card .inline-actions {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }

    .metric-summary-grid {
        grid-template-columns: 1fr;
    }

    .toast {
        right: 14px;
        bottom: 14px;
        max-width: calc(100vw - 28px);
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
