:root {
    --navy: #0F2C59;
    --blue: #1D4ED8;
    --light: #EFF6FF;
    --bg: #F1F5F9;
    --card-bg: #FFFFFF;
    --text: #0F172A;
    --muted: #475569;
    --border: #CBD5E1;
    --opt-bg: #F8FAFC;
    --fs: 17px;
}
body.fs-2 { --fs: 20px; }
body.fs-3 { --fs: 23px; }

body.dark-theme {
    --bg: #0B1120;
    --card-bg: #111827;
    --text: #F1F5F9;
    --muted: #94A3B8;
    --border: #334155;
    --light: #1E293B;
    --opt-bg: #1E293B;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: var(--fs);
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    transition: background-color 0.2s ease, color 0.2s ease;
}
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mb-16 { margin-bottom: 16px; }
.m-0-22 { margin: 0 0 22px; }
.btn-full { width: 100%; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

.top-bar { background: var(--navy); color: #fff; padding: 10px 0; font-size: 0.85em; }
.top-bar .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.top-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.font-switcher { display: inline-flex; gap: 4px; }
.top-btn {
    min-height: 48px; padding: 8px 14px; border-radius: 8px;
    background: rgba(255,255,255,0.14); color: #fff; border: 1px solid rgba(255,255,255,0.3);
    font-weight: 700; font-size: 0.9em; text-decoration: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.top-btn.active, .top-btn:hover { background: #fff; color: var(--navy); }

header { background: var(--card-bg); border-bottom: 2px solid var(--border); padding: 16px 0; }
.head-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; }
.coat-wrap { flex-shrink: 0; display: flex; align-items: center; }
.brand-name { font-size: 1.35em; font-weight: 800; color: var(--navy); }
body.dark-theme .brand-name { color: #60A5FA; }
.brand-sub { font-size: 0.86em; color: var(--muted); }

nav { display: flex; flex-wrap: wrap; gap: 8px; }
nav a {
    min-height: 48px; padding: 10px 16px; border-radius: 10px;
    background: var(--light); color: var(--navy); font-weight: 700;
    text-decoration: none; display: inline-flex; align-items: center;
}
body.dark-theme nav a { color: #E2E8F0; }
nav a:hover { opacity: 0.88; }

.header-auth { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.user-pill {
    display: flex; align-items: center; gap: 12px;
    background: var(--light); padding: 6px 12px; border-radius: 12px; border: 1px solid var(--border);
}
.user-pill-info { display: flex; flex-direction: column; font-size: 0.85em; }
.user-pill-info span { color: var(--muted); }

.btn {
    min-height: 52px; padding: 12px 22px; border-radius: 10px; border: 2px solid transparent;
    font-size: 0.95em; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
}
.btn-compact { min-height: 48px; padding: 8px 16px; font-size: 0.9em; }
.btn-blue { background: var(--blue); color: #fff; }
.btn-blue:hover { background: #1E40AF; }
.btn-esia { background: #0066B3; color: #fff; }
.btn-esia:hover { background: #00508F; }
.btn-line { background: var(--card-bg); color: var(--navy); border-color: var(--navy); }
body.dark-theme .btn-line { color: #93C5FD; border-color: #60A5FA; }

.msg { margin-top: 20px; padding: 18px 22px; border-radius: 12px; font-weight: 700; border-left: 6px solid; }
.msg-ok { background: #ECFDF5; color: #065F46; border-color: #10B981; }
.msg-err { background: #FEF2F2; color: #991B1B; border-color: #EF4444; }
body.dark-theme .msg-ok { background: #064E3B; color: #D1FAE5; }
body.dark-theme .msg-err { background: #7F1D1D; color: #FEE2E2; }

.hero {
    margin: 24px 0;
    background: linear-gradient(135deg, #0F2C59 0%, #1D4ED8 100%);
    color: #fff; border-radius: 18px; padding: 34px;
}
.hero-content { display: flex; align-items: center; gap: 28px; }
@media (max-width: 760px) { .hero-content { flex-direction: column; align-items: flex-start; } }
.hero-emblem-card {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 16px; padding: 18px 20px;
    display: flex; flex-direction: column; align-items: center; gap: 8px; flex-shrink: 0;
}
.hero-emblem-card span { font-size: 0.78em; font-weight: 700; color: #BAE6FD; text-align: center; }
.hero h1 { font-size: 2em; line-height: 1.2; margin-bottom: 12px; }
.hero p { color: #E2E8F0; margin-bottom: 22px; max-width: 780px; }
.stats { display: flex; flex-wrap: wrap; gap: 28px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,0.25); }
.stats strong { display: block; font-size: 1.5em; color: #38BDF8; }

.sec { margin: 36px 0; }
.sec-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 18px; }
.sec-tag { font-size: 0.85em; font-weight: 800; text-transform: uppercase; color: var(--blue); }
body.dark-theme .sec-tag { color: #60A5FA; }
.sec-h { font-size: 1.65em; color: var(--navy); }
body.dark-theme .sec-h { color: #F8FAFC; }
.date-label { font-weight: 700; color: var(--muted); }

.vote-box { background: var(--card-bg); border-radius: 18px; padding: 32px; border: 3px solid var(--blue); }
.survey-switcher {
    background: var(--light); padding: 16px; border-radius: 12px; margin-bottom: 22px;
    display: flex; flex-direction: column; gap: 8px;
}
.survey-switcher label { font-weight: 700; font-size: 0.92em; }
.vote-q { font-size: 1.4em; color: var(--navy); margin-bottom: 10px; }
body.dark-theme .vote-q { color: #F8FAFC; }
.vote-desc { color: var(--muted); margin-bottom: 22px; }

.opt-row {
    display: flex; align-items: center; gap: 14px; min-height: 58px; padding: 14px 18px;
    border: 2px solid var(--border); border-radius: 12px; margin-bottom: 12px; cursor: pointer; font-weight: 700; background: var(--opt-bg);
}
.opt-row:hover { border-color: var(--blue); }
.opt-row input { width: 24px; height: 24px; accent-color: var(--blue); }

.auth-prompt {
    background: var(--light); border: 2px dashed var(--border); border-radius: 14px; padding: 20px; margin-bottom: 22px;
}
.auth-prompt p { font-weight: 700; margin-bottom: 14px; }
.auth-prompt-btns { display: flex; flex-wrap: wrap; gap: 12px; }

.results-block { margin-top: 28px; padding-top: 22px; border-top: 2px solid var(--border); }
.results-title { margin-bottom: 14px; }
.bar-wrap { margin-bottom: 16px; }
.bar-top { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: 6px; }
.bar-bg { width: 100%; height: 22px; background: var(--border); border-radius: 10px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--blue); }

.filter-form { display: flex; gap: 10px; align-items: center; }
.filter-select { min-width: 260px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 20px; }
.card {
    background: var(--card-bg); border-radius: 16px; padding: 24px; border: 2px solid var(--border);
    display: flex; flex-direction: column; justify-content: space-between;
}
.card-selected { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.25); }
.card-top-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.badge { display: inline-block; background: var(--light); color: var(--navy); font-weight: 700; font-size: 0.85em; padding: 5px 12px; border-radius: 8px; }
body.dark-theme .badge { color: #93C5FD; }
.votes-pill { font-size: 0.85em; font-weight: 700; color: var(--muted); }
.card h3 { font-size: 1.15em; margin-bottom: 10px; }
.card p { color: var(--muted); margin-bottom: 16px; }
.card-foot { padding-top: 12px; border-top: 1px solid var(--border); font-size: 0.85em; color: var(--muted); display: flex; justify-content: space-between; }

.box { background: var(--card-bg); border-radius: 18px; padding: 28px; border: 2px solid var(--border); }
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 700; margin-bottom: 6px; }
.input {
    width: 100%; min-height: 52px; padding: 12px 14px; font-size: 1em;
    border: 2px solid var(--border); border-radius: 10px; background: var(--card-bg); color: var(--text); font-family: inherit;
}
.input:focus { outline: none; border-color: var(--blue); }
textarea.input { min-height: 100px; resize: vertical; }
.err-note { color: #DC2626; font-weight: 700; }

footer { background: var(--navy); color: #CBD5E1; padding: 30px 0; margin-top: 50px; font-size: 0.9em; }
.foot-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }
