:root {
    --bg: #0b1220;
    --panel: #111a2e;
    --panel-2: #0f172a;
    --text: #e5eefc;
    --muted: #9db0ce;
    --yes: #22c55e;
    --yes-2: #16a34a;
    --turnout: #38bdf8;
    --turnout-2: #0284c7;
    --no: #f59e0b;
    --danger: #f43f5e;
    --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
}

body {
    margin: 0;
    min-height: 100dvh;
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
    background: radial-gradient(circle at top right, #1a2440, var(--bg) 50%);
    color: var(--text);
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.08);
}

.page-conversion {
    padding-bottom: 0;
}

@media (max-width: 768px) {
    body.has-sticky-vote {
        padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
    }
}

.page {
    width: min(1120px, calc(100% - 32px));
    margin: 32px auto;
}

.hero {
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
    border: 1px solid rgba(157, 176, 206, 0.2);
    border-radius: 18px;
    padding: 24px 22px 28px;
    box-shadow: var(--shadow);
}

.below-fold {
    margin-top: 18px;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
    border: 1px solid rgba(157, 176, 206, 0.16);
    border-radius: 18px;
    padding: 20px 20px 24px;
}

.vote-hint {
    margin: 18px 0 0;
    max-width: 520px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid rgba(157, 176, 206, 0.2);
    font-size: 0.95rem;
    line-height: 1.55;
    color: #cbd5e1;
}

.vote-hint strong {
    color: #f1f5f9;
}

.vote-hint-yes {
    color: #4ade80;
    font-weight: 700;
}

.vote-hint-no {
    color: #fbbf24;
    font-weight: 700;
}

.emotion-banner {
    margin: 14px 0 0;
    min-height: 1.4em;
    font-size: 1rem;
    font-weight: 700;
    color: #93c5fd;
}

.emotion-banner.emotion-hot {
    color: #fde047;
}

.vote-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 18px;
}

.btn-vote {
    min-height: 52px;
    padding: 16px 24px;
    font-size: 1.05rem;
}

.hero-vote {
    justify-content: center;
}

.vote-sticky {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    padding-top: 12px;
    padding-left: max(12px, env(safe-area-inset-left, 0px));
    padding-right: max(12px, env(safe-area-inset-right, 0px));
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
    gap: 12px;
    justify-content: stretch;
    align-items: stretch;
    background: linear-gradient(180deg, transparent, rgba(11, 18, 32, 0.98) 25%);
    border-top: 1px solid rgba(157, 176, 206, 0.22);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.35);
    touch-action: manipulation;
}

.vote-sticky .btn-vote {
    flex: 1 1 0;
    min-width: 0;
    max-width: none;
    min-height: 56px;
}

@media (max-width: 768px) {
    .hero-vote {
        display: none;
    }

    .vote-sticky {
        display: flex;
    }
}

@media (min-width: 769px) {
    .vote-sticky {
        display: none !important;
    }
}

.auth-panel-compact {
    flex-direction: column;
    align-items: flex-start;
}

.auth-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.privacy-note {
    margin: 10px 0 0;
    font-size: 0.82rem;
    color: #94a3b8;
    font-style: italic;
}

.value-turnout {
    font-size: clamp(1.1rem, 2.8vw, 1.45rem) !important;
    line-height: 1.25;
}

/* Modale */
.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal[hidden] {
    display: none !important;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
}

.modal-box {
    position: relative;
    width: min(420px, 100%);
    padding: 24px;
    border-radius: 16px;
    background: var(--panel);
    border: 1px solid rgba(157, 176, 206, 0.25);
    box-shadow: var(--shadow);
}

.modal-box-success {
    text-align: center;
}

.modal-box-rodo {
    max-height: min(90vh, 560px);
    overflow-y: auto;
}

.modal-scope {
    margin: 12px 0 16px;
    padding-left: 1.2em;
    color: #cbd5e1;
    font-size: 0.92rem;
    line-height: 1.5;
}

.modal-scope li {
    margin: 6px 0;
}

.auth-consent-hint {
    margin: 10px 0 0;
    font-size: 0.88rem;
    line-height: 1.45;
    color: #94a3b8;
}

.btn-link {
    margin-top: 12px;
    padding: 0;
    border: 0;
    background: none;
    color: #93c5fd;
    font-size: 0.88rem;
    text-decoration: underline;
    cursor: pointer;
    font-family: inherit;
}

.btn-link:hover {
    color: #bfdbfe;
}

.btn-link:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.modal-lead {
    margin: 10px 0 0;
    color: var(--muted);
    line-height: 1.5;
}

.modal-consent {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-top: 16px;
    font-weight: 600;
    color: #dbe8fd;
}

.modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.success-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 12px;
    line-height: 56px;
    text-align: center;
    font-size: 28px;
    font-weight: 800;
    color: #fff;
    border-radius: 50%;
    background: linear-gradient(135deg, #16a34a, #22c55e);
}

.vote-section {
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
    border: 1px solid rgba(157, 176, 206, 0.2);
    border-radius: 18px;
    padding: 28px;
    box-shadow: var(--shadow);
}

.countdown {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}

.countdown-item {
    background: var(--panel);
    border: 1px solid rgba(157, 176, 206, 0.18);
    border-radius: 12px;
    padding: 12px;
    text-align: center;
}

.countdown-value {
    margin: 0;
    font-size: clamp(1.3rem, 3vw, 1.9rem);
    font-weight: 800;
}

.countdown-label {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.countdown-expired {
    margin: 6px 0 16px;
    text-align: center;
    color: #fda4af;
    font-weight: 700;
}

.section-header h1 {
    margin: 0;
    font-size: clamp(1.5rem, 2.8vw, 2.2rem);
    max-width: 920px;
    line-height: 1.2;
}

.section-header p {
    margin: 10px 0 0;
    color: var(--muted);
    line-height: 1.5;
}

.message-callout {
    position: relative;
    overflow: hidden;
    margin-top: 22px;
    max-width: 860px;
    padding: 22px 24px 26px;
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    background:
        linear-gradient(135deg, rgba(220, 38, 38, 0.18) 0%, transparent 45%),
        linear-gradient(225deg, rgba(250, 204, 21, 0.12) 0%, transparent 42%),
        linear-gradient(180deg, #111c33 0%, #0a1220 100%);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.06) inset,
        0 22px 55px rgba(0, 0, 0, 0.5),
        0 0 80px rgba(220, 38, 38, 0.08);
}

.message-callout::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, #b91c1c, #f8fafc, #b91c1c);
    opacity: 0.95;
}

.message-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #fecaca;
    background: rgba(185, 28, 28, 0.35);
    border: 1px solid rgba(248, 113, 113, 0.55);
    padding: 7px 14px;
    border-radius: 999px;
    margin-bottom: 0;
}

.message-list {
    display: grid;
    gap: 16px;
    margin-top: 14px;
}

.message-list p {
    margin: 0;
    line-height: 1.3;
}

.message-lead {
    font-size: clamp(1.15rem, 3.2vw, 1.6rem);
    font-weight: 800;
    color: #f8fafc;
    letter-spacing: 0.01em;
    text-shadow: 0 2px 24px rgba(0, 0, 0, 0.35);
}

.message-cta {
    margin: 0;
}

.message-cta-inner {
    display: inline-block;
    font-size: clamp(0.95rem, 2.4vw, 1.15rem);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #fff;
    padding: 14px 22px;
    border-radius: 999px;
    background: linear-gradient(90deg, #14532d, #16a34a, #22c55e);
    box-shadow: 0 6px 28px rgba(34, 197, 94, 0.45);
    border: 1px solid rgba(187, 247, 208, 0.35);
}

.message-motto {
    font-size: clamp(1.15rem, 3.2vw, 1.6rem);
    font-weight: 800;
    font-style: italic;
    color: #fef08a;
    text-shadow: 0 0 32px rgba(250, 204, 21, 0.35);
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.auth-panel {
    margin-top: 18px;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid rgba(157, 176, 206, 0.2);
    background: rgba(255, 255, 255, 0.02);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
}

.auth-status {
    margin: 0;
    font-weight: 600;
    color: #dbe8fd;
}

.privacy-panel {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(157, 176, 206, 0.2);
    background: rgba(255, 255, 255, 0.02);
}

.privacy-consent {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-weight: 600;
    color: #dbe8fd;
}

.privacy-consent input {
    margin-top: 2px;
}

.privacy-text {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.45;
}

.privacy-panel input[type="password"] {
    margin-top: 8px;
    width: 100%;
    max-width: 420px;
    background: #0b1324;
    border: 1px solid rgba(157, 176, 206, 0.35);
    color: var(--text);
    border-radius: 10px;
    padding: 11px 12px;
}

.privacy-panel input[type="password"]:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    filter: none;
}

.actions {
    margin-top: 22px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.btn {
    border: 0;
    border-radius: 12px;
    padding: 14px 20px;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    transition: transform 0.16s ease, filter 0.16s ease, box-shadow 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.08);
}

.btn:active {
    transform: translateY(0);
}

.btn:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
}

.btn-yes {
    background: linear-gradient(90deg, var(--yes-2), var(--yes));
}

.btn-no {
    background: linear-gradient(90deg, #b45309, var(--no));
}

.btn-reset {
    background: linear-gradient(90deg, #6b7280, #475569);
}

.btn-logout {
    background: linear-gradient(90deg, #475569, #334155);
}

.btn-google-fallback {
    background: linear-gradient(90deg, #1f2937, #111827);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.hidden {
    display: none !important;
}

.stats-grid {
    display: grid;
    gap: 14px;
    margin-top: 22px;
}

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

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

.card {
    background: var(--panel);
    border: 1px solid rgba(157, 176, 206, 0.18);
    border-radius: 14px;
    padding: 16px;
}

.card h2 {
    margin: 0;
    font-size: 0.95rem;
    color: var(--muted);
}

.value {
    margin: 10px 0 0;
    font-size: clamp(1.5rem, 3.4vw, 2rem);
    font-weight: 800;
    letter-spacing: 0.3px;
}

.value-strong {
    color: #f8fafc;
}

.card-yes {
    border-color: rgba(34, 197, 94, 0.45);
    background: linear-gradient(145deg, rgba(34, 197, 94, 0.15), rgba(17, 26, 46, 1));
}

.card-turnout {
    border-color: rgba(56, 189, 248, 0.45);
    background: linear-gradient(145deg, rgba(56, 189, 248, 0.14), rgba(17, 26, 46, 1));
}

.card-no {
    border-color: rgba(245, 158, 11, 0.5);
    background: linear-gradient(145deg, rgba(245, 158, 11, 0.14), rgba(17, 26, 46, 1));
}

.card-missing {
    border-color: rgba(244, 63, 94, 0.45);
    background: linear-gradient(145deg, rgba(244, 63, 94, 0.15), rgba(17, 26, 46, 1));
}

.progress-group {
    margin-top: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.progress-card {
    background: var(--panel-2);
    border: 1px solid rgba(157, 176, 206, 0.16);
    border-radius: 14px;
    padding: 14px;
}

.progress-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.progress-head h3 {
    margin: 0;
    font-size: 0.95rem;
}

.progress-head span {
    color: var(--muted);
    font-weight: 700;
}

.progress-track {
    width: 100%;
    height: 14px;
    background: rgba(157, 176, 206, 0.2);
    border-radius: 999px;
    overflow: hidden;
    margin-top: 10px;
}

.progress-fill {
    width: 0%;
    height: 100%;
    transition: width 260ms ease;
}

.progress-fill-yes {
    background: linear-gradient(90deg, var(--yes-2), var(--yes));
}

.progress-fill-turnout {
    background: linear-gradient(90deg, var(--turnout-2), var(--turnout));
}

.threshold-help {
    margin: 8px 0 0;
    color: #b6c6df;
    font-size: 0.85rem;
    line-height: 1.45;
}

.threshold-info {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.threshold-info.ok {
    color: var(--yes);
    font-weight: 700;
}

.disclaimer {
    margin: 14px 2px 0;
    color: #c5d4eb;
    font-size: 0.9rem;
}

@media (max-width: 900px) {
    .countdown {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stats-grid.primary,
    .stats-grid.secondary {
        grid-template-columns: 1fr 1fr;
    }

    .progress-group {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .page {
        width: calc(100% - 20px);
        margin: 18px auto;
    }

    .vote-section {
        padding: 18px;
    }

    .stats-grid.primary,
    .stats-grid.secondary {
        grid-template-columns: 1fr;
    }

    .btn {
        width: 100%;
    }

    .message-callout {
        padding: 18px 16px 22px;
    }

    .message-cta-inner {
        display: block;
        text-align: center;
        width: 100%;
    }
}

/* === Ankieta — minimal UI === */
.page-survey {
    max-width: 640px;
}

.survey-hero {
    background: linear-gradient(165deg, rgba(34, 197, 94, 0.08), rgba(15, 23, 42, 0.92));
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 20px;
    padding: clamp(20px, 4vw, 32px);
    box-shadow: var(--shadow);
}

.survey-countdown {
    margin-bottom: 14px;
}

.survey-countdown-expired {
    margin: 0 0 16px;
    text-align: center;
}

.survey-countdown-intro {
    margin: 0 0 18px;
    text-align: center;
    font-size: clamp(0.95rem, 2.4vw, 1.05rem);
    font-weight: 600;
    color: #cbd5e1;
    line-height: 1.4;
}

.survey-headlines {
    margin-bottom: 4px;
    text-align: center;
}

.survey-hero h1,
.survey-headlines h1 {
    margin: 0;
    font-size: clamp(1.45rem, 4.2vw, 1.85rem);
    font-weight: 800;
    line-height: 1.25;
    color: #f8fafc;
    letter-spacing: -0.02em;
    text-align: center;
}

.survey-messages {
    margin-top: 14px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(15, 23, 42, 0.55);
    text-align: center;
}

.survey-messages p {
    margin: 0;
    font-size: clamp(0.92rem, 2.3vw, 1rem);
    line-height: 1.5;
    color: #e2e8f0;
    text-align: center;
}

.survey-messages p + p {
    margin-top: 10px;
}

.survey-actions {
    margin-top: 22px;
    justify-content: stretch;
    gap: 14px;
}

.survey-actions .btn-vote {
    flex: 1;
    min-height: 54px;
    font-size: clamp(0.95rem, 2.8vw, 1.05rem);
    letter-spacing: 0.02em;
}

.btn-survey-yes {
    background: linear-gradient(135deg, #15803d, #22c55e);
    box-shadow: 0 4px 24px rgba(34, 197, 94, 0.35);
}

.btn-survey-no {
    background: linear-gradient(135deg, #9a3412, #ea580c);
    box-shadow: 0 4px 24px rgba(234, 88, 12, 0.25);
}

.survey-status {
    margin: 20px 0 0;
    min-height: 3em;
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.45;
    color: #bae6fd;
}

.survey-yes-total {
    margin: 10px 0 0;
    text-align: center;
    font-size: clamp(1.15rem, 3.5vw, 1.45rem);
    font-weight: 700;
    color: #86efac;
}

.survey-yes-total strong {
    font-size: 1.15em;
    color: #4ade80;
}

.survey-yes-total-max {
    font-size: 0.75em;
    font-weight: 600;
    color: #94a3b8;
}

.survey-progress-block {
    margin-top: 18px;
    /* Współrzędna progu 1613 / 4935 — ta sama co kreska i etykieta „1613” */
    --progress-threshold-x: calc(100% * 1613 / 4935);
}

.survey-progress-rail {
    position: relative;
    height: 26px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(148, 163, 184, 0.25);
    overflow: hidden;
    direction: ltr;
    unicode-bidi: isolate;
}

/* Wypełnienie pierwsze w DOM — rośnie od lewej (0 → 4935) */
.survey-progress-fill {
    position: absolute;
    inset-inline-start: 0;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0%;
    max-width: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #166534, #4ade80);
    box-shadow: 0 0 16px rgba(74, 222, 128, 0.3);
    z-index: 2;
    transform-origin: left center;
    pointer-events: none;
    transition: width 0.45s cubic-bezier(0.33, 1, 0.68, 1);
}

/* Jeden znacznik progu 1613 — koniec paska = 4935 bez dodatkowej kreski (nie mylić z wypełnieniem) */
#mark1613 {
    left: var(--progress-threshold-x);
}

.survey-marker {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 3px;
    margin-left: 0;
    border-radius: 2px;
    background: rgba(248, 250, 252, 0.5);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
    z-index: 3;
    transform: translateX(-50%);
    pointer-events: none;
}

.survey-progress-labels {
    position: relative;
    margin-top: 10px;
    min-height: 1.35em;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #94a3b8;
    text-transform: uppercase;
}

/* Te same pozycje co pasek: 0 — lewo, 1613 — dokładnie pod kreską progu, 4935 — prawo */
.survey-progress-label {
    position: absolute;
    top: 0;
    line-height: 1.2;
    white-space: nowrap;
}

.survey-progress-label--start {
    left: 0;
    transform: translateX(0);
}

.survey-progress-label--threshold {
    left: var(--progress-threshold-x);
    transform: translateX(-50%);
}

.survey-progress-label--end {
    right: 0;
    left: auto;
    transform: translateX(0);
}

.survey-no-info {
    margin: 18px 0 0;
    font-size: 0.88rem;
    color: #94a3b8;
}

.survey-no-info strong {
    color: #cbd5e1;
    font-weight: 700;
}

.survey-meta {
    margin-top: 16px;
}

.survey-disclaimer {
    margin-top: 16px;
    text-align: center;
    font-size: 0.82rem;
    color: #64748b;
}

.survey-sticky .btn-vote {
    font-size: 0.95rem;
    min-height: 50px;
}
