:root {
    --ink: #111827;
    --muted: #667085;
    --line: #d7deea;
    --paper: #ffffff;
    --soft: #f4f7fb;
    --blue: #1267d6;
    --blue-dark: #084b9b;
    --cyan: #00a9ce;
    --red: #e92d37;
    --magenta: #d92ac5;
    --shadow: 0 12px 30px rgba(14, 31, 53, 0.12);
    --header-height: 68px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-height) + 20px);
}

body {
    margin: 0;
    min-width: 320px;
    color: var(--ink);
    background: #f7f8fb url('/assets/images/ui/paper-bg.jpg') center top / cover fixed;
    font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
    line-height: 1.5;
    letter-spacing: 0;
}

body:has(dialog[open]) {
    overflow: hidden;
}

button,
input,
textarea {
    color: inherit;
    font: inherit;
    letter-spacing: 0;
}

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

button {
    border: 0;
}

a {
    color: inherit;
}

img {
    max-width: 100%;
}

.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;
}

.site-header {
    position: sticky;
    z-index: 50;
    top: 0;
    height: var(--header-height);
    border-bottom: 1px solid rgba(17, 24, 39, 0.12);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(14px);
}

.header-inner,
.section-inner,
.status-inner,
.site-footer {
    width: min(1200px, calc(100% - 40px));
    margin: 0 auto;
}

.header-inner {
    display: flex;
    align-items: center;
    height: 100%;
    gap: 36px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex: none;
    text-decoration: none;
}

.brand-mark {
    position: relative;
    width: 34px;
    height: 34px;
    border: 3px solid var(--red);
    border-radius: 50% 50% 44% 44%;
}

.brand-mark::before,
.brand-mark::after {
    position: absolute;
    top: 11px;
    width: 8px;
    height: 5px;
    content: "";
    background: var(--cyan);
    transform: skewX(-18deg);
}

.brand-mark::before {
    left: 5px;
}

.brand-mark::after {
    right: 5px;
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    font-size: 17px;
    line-height: 1.1;
}

.brand small {
    margin-top: 2px;
    color: var(--blue);
    font-size: 9px;
    font-weight: 800;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 26px;
}

.main-nav a {
    color: #344054;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.main-nav a:hover {
    color: var(--blue);
}

.account-area {
    margin-left: auto;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    gap: 8px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
    transition: transform 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.button:hover:not(.is-disabled) {
    transform: translateY(-1px);
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    transform: none;
}

.button svg {
    width: 18px;
    height: 18px;
    flex: none;
}

.button-primary {
    color: #fff;
    background: var(--blue);
}

.button-primary:hover {
    background: var(--blue-dark);
}

.button-light {
    color: var(--blue-dark);
    background: #fff;
}

.button-outline {
    color: var(--blue-dark);
    border-color: #aac3e5;
    background: #fff;
}

.button-wide {
    width: 100%;
}

.button.is-disabled {
    cursor: not-allowed;
    opacity: 0.48;
}

.device-badge {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    gap: 7px;
    padding: 0 12px;
    border: 1px solid #9bd4b8;
    border-radius: 20px;
    color: #087b42;
    background: #ecf9f2;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.device-badge.is-banned {
    border-color: #e4afb4;
    color: #a9202a;
    background: #fff0f1;
}

.device-badge svg {
    width: 17px;
    height: 17px;
}

.campaign-hero {
    height: min(62vh, 650px);
    min-height: 430px;
    overflow: hidden;
    background: #eaf4f8;
}

.campaign-hero img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center bottom;
}

.vote-status {
    position: relative;
    z-index: 4;
    color: #fff;
    background: #075abf;
    border-top: 5px solid var(--red);
    border-bottom: 5px solid var(--cyan);
}

.status-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    min-height: 142px;
    gap: 28px;
    padding: 22px 0;
}

.status-kicker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #bdeeff;
    font-size: 12px;
    font-weight: 800;
}

.status-kicker svg {
    width: 15px;
    height: 15px;
}

.status-copy h1 {
    margin: 3px 0 2px;
    font-size: 28px;
    line-height: 1.2;
}

.status-copy p {
    margin: 0;
    color: #dbeafe;
    font-size: 14px;
}

.vote-meter {
    display: flex;
    align-items: baseline;
    min-width: 150px;
    gap: 5px;
    white-space: nowrap;
}

.vote-meter span {
    font-size: 13px;
    font-weight: 700;
}

.vote-meter strong {
    color: #ffdc3f;
    font-size: 45px;
    line-height: 1;
}

.vote-section {
    padding: 70px 0 90px;
}

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

.eyebrow {
    display: block;
    margin-bottom: 5px;
    color: var(--red);
    font-size: 11px;
    font-weight: 900;
}

.section-heading h2,
.rules-heading h2 {
    margin: 0;
    font-size: 31px;
    line-height: 1.25;
}

.section-heading p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.section-heading p strong {
    color: var(--blue);
}

.vote-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    padding: 12px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.64);
}

.security-notice {
    display: flex;
    align-items: center;
    min-height: 64px;
    gap: 12px;
    margin-bottom: 18px;
    padding: 12px 16px;
    border: 1px solid #e5c46c;
    border-left: 4px solid #d79612;
    border-radius: 5px;
    color: #69470c;
    background: #fff8df;
}

.security-notice.is-danger {
    border-color: #e4afb4;
    border-left-color: var(--red);
    color: #8b2730;
    background: #fff0f1;
}

.security-notice > svg {
    width: 22px;
    height: 22px;
    flex: none;
}

.security-notice strong,
.security-notice span {
    display: block;
}

.security-notice strong {
    font-size: 13px;
}

.security-notice span {
    margin-top: 2px;
    font-size: 12px;
}

.search-box {
    display: flex;
    align-items: center;
    width: min(100%, 360px);
    height: 44px;
    gap: 10px;
    padding: 0 12px;
    border: 1px solid #b8c4d5;
    border-radius: 5px;
    background: #fff;
}

.search-box > svg {
    width: 18px;
    height: 18px;
    color: #667085;
}

.search-box input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 14px;
}

.search-box button {
    display: grid;
    width: 28px;
    height: 28px;
    flex: none;
    place-items: center;
    border-radius: 50%;
    background: #eef2f6;
    cursor: pointer;
}

.search-box button svg {
    width: 15px;
    height: 15px;
}

.segmented {
    display: inline-grid;
    grid-template-columns: repeat(2, 72px);
    height: 38px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: #edf1f6;
}

.segmented button {
    border-radius: 3px;
    background: transparent;
    cursor: pointer;
    color: #667085;
    font-size: 13px;
    font-weight: 800;
}

.segmented button.is-active {
    color: var(--blue-dark);
    background: #fff;
    box-shadow: 0 1px 5px rgba(16, 24, 40, 0.12);
}

.candidate-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 18px;
}

.candidate-card {
    position: relative;
    display: grid;
    grid-template-rows: auto minmax(76px, auto) 48px;
    min-width: 0;
    overflow: hidden;
    border: 1px solid #cfd8e6;
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 5px 14px rgba(20, 38, 65, 0.07);
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.candidate-card:hover {
    z-index: 1;
    border-color: #8fb4e7;
    box-shadow: var(--shadow);
    transform: translateY(-3px);
}

.candidate-image {
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-bottom: 1px solid #dce3ed;
    background: #eaf7fb;
}

.candidate-card:nth-child(4n + 2) .candidate-image {
    background: #f8ecf7;
}

.candidate-card:nth-child(4n + 3) .candidate-image {
    background: #fff0f0;
}

.candidate-card:nth-child(4n) .candidate-image {
    background: #eef1f5;
}

.candidate-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 220ms ease;
}

.candidate-card:hover .candidate-image img {
    transform: scale(1.035);
}

.candidate-rank {
    position: absolute;
    z-index: 2;
    top: 9px;
    left: 9px;
    min-width: 34px;
    height: 25px;
    padding: 0 7px;
    border: 1px solid rgba(255, 255, 255, 0.75);
    border-radius: 3px;
    color: #fff;
    background: rgba(17, 24, 39, 0.76);
    font-size: 11px;
    font-weight: 900;
    line-height: 23px;
    text-align: center;
}

.candidate-info {
    min-width: 0;
    padding: 13px 14px 11px;
}

.candidate-info h3 {
    display: -webkit-box;
    min-height: 44px;
    overflow: hidden;
    margin: 0;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: 15px;
    line-height: 22px;
    white-space: normal;
}

.candidate-info p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.candidate-info p strong {
    color: var(--red);
    font-size: 16px;
}

.vote-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 48px;
    gap: 7px;
    border-top: 1px solid #dce3ed;
    color: #fff;
    background: var(--blue);
    cursor: pointer;
    font-size: 13px;
    font-weight: 900;
}

.vote-button:hover:not(:disabled) {
    background: var(--blue-dark);
}

.vote-button:disabled {
    cursor: not-allowed;
    color: #738094;
    background: #e5eaf1;
}

.vote-button.is-voted {
    color: #087b42;
    background: #dcf8e9;
}

.vote-button svg {
    width: 16px;
    height: 16px;
}

.empty-state {
    padding: 72px 20px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    text-align: center;
}

.empty-state svg {
    width: 38px;
    height: 38px;
    color: #98a2b3;
}

.empty-state h3 {
    margin: 12px 0 5px;
}

.empty-state p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.rules-section {
    padding: 78px 0 84px;
    color: #fff;
    background: #121b2c;
    border-top: 8px solid var(--magenta);
}

.rules-layout {
    display: grid;
    grid-template-columns: 0.75fr 1.25fr;
    gap: 80px;
}

.rules-heading {
    align-self: start;
    position: sticky;
    top: calc(var(--header-height) + 36px);
}

.rules-heading .eyebrow {
    color: #70def3;
}

.rules-heading p {
    margin: 20px 0 0;
    color: #bdc7d6;
    font-size: 14px;
    line-height: 1.9;
}

.rule-steps {
    display: grid;
    margin: 0;
    padding: 0;
    list-style: none;
}

.rule-steps li {
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: 20px;
    padding: 24px 0;
    border-bottom: 1px solid #384357;
}

.rule-steps li:first-child {
    padding-top: 0;
}

.rule-steps li > span {
    color: #55d3ed;
    font-size: 28px;
    font-weight: 900;
}

.rule-steps strong {
    font-size: 17px;
}

.rule-steps p {
    margin: 5px 0 0;
    color: #abb7c9;
    font-size: 13px;
    line-height: 1.75;
}

.site-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 102px;
    color: #596579;
    font-size: 12px;
}

.site-footer div {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.site-footer strong {
    color: var(--red);
    font-size: 17px;
}

.app-dialog {
    width: min(92vw, 460px);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding: 32px;
    border: 1px solid #cdd7e5;
    border-radius: 8px;
    color: var(--ink);
    background: #fff;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
}

.app-dialog::backdrop {
    background: rgba(10, 19, 33, 0.72);
    backdrop-filter: blur(3px);
}

.dialog-close {
    position: absolute;
    top: 14px;
    right: 14px;
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 50%;
    background: #edf1f6;
    cursor: pointer;
}

.dialog-close svg {
    width: 18px;
    height: 18px;
}

.dialog-icon {
    display: grid;
    width: 54px;
    height: 54px;
    margin-bottom: 18px;
    place-items: center;
    border-radius: 50%;
}

.dialog-icon svg {
    width: 28px;
    height: 28px;
}

.verify-icon {
    color: #fff;
    background: var(--blue);
}

.turnstile-slot {
    display: grid;
    width: 100%;
    min-height: 70px;
    overflow: hidden;
    place-items: center;
}

.verification-status {
    min-height: 24px;
    margin-top: 8px;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

.form-verification {
    display: grid;
    gap: 7px;
    margin-bottom: 16px;
}

.form-verification > span {
    font-size: 13px;
    font-weight: 800;
}

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

.app-dialog > p {
    margin: 8px 0 24px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.7;
}

.dialog-label {
    display: block;
    margin-bottom: 5px;
    color: var(--blue);
    font-size: 11px;
    font-weight: 900;
}

.form-field {
    display: grid;
    gap: 7px;
    margin-bottom: 16px;
}

.form-field > span {
    font-size: 13px;
    font-weight: 800;
}

.form-field small {
    color: var(--muted);
    font-weight: 500;
}

.form-field input,
.form-field textarea {
    width: 100%;
    border: 1px solid #b8c4d5;
    border-radius: 5px;
    outline: 0;
    background: #fff;
    font-size: 14px;
}

.form-field input {
    height: 44px;
    padding: 0 12px;
}

.form-field textarea {
    min-height: 86px;
    padding: 10px 12px;
    resize: vertical;
}

.form-field input:focus,
.form-field textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(18, 103, 214, 0.12);
}

.image-upload {
    position: relative;
    display: grid;
    aspect-ratio: 16 / 8;
    margin-bottom: 16px;
    overflow: hidden;
    place-items: center;
    border: 1px dashed #8aa7cc;
    border-radius: 5px;
    background: #f5f8fc;
    cursor: pointer;
}

.image-upload input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.upload-placeholder {
    display: grid;
    place-items: center;
    color: var(--muted);
}

.upload-placeholder svg {
    width: 28px;
    height: 28px;
    margin-bottom: 8px;
    color: var(--blue);
}

.upload-placeholder strong {
    color: var(--ink);
    font-size: 13px;
}

.upload-placeholder small {
    margin-top: 3px;
    font-size: 11px;
}

.image-upload > img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.account-profile {
    display: flex;
    align-items: center;
    gap: 13px;
    margin: 10px 0 24px;
}

.account-profile img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
}

.account-profile span,
.account-profile strong {
    display: block;
}

.account-profile span {
    color: var(--muted);
    font-size: 12px;
}

.account-profile strong {
    max-width: 280px;
    overflow: hidden;
    font-size: 18px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-votes {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 16px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    font-size: 13px;
}

.account-votes strong {
    color: var(--blue);
    font-size: 18px;
}

.toast-region {
    position: fixed;
    z-index: 100;
    top: calc(var(--header-height) + 16px);
    left: 50%;
    display: grid;
    width: min(92vw, 390px);
    gap: 8px;
    pointer-events: none;
    transform: translateX(-50%);
}

.toast {
    display: flex;
    align-items: center;
    min-height: 48px;
    gap: 9px;
    padding: 11px 14px;
    border: 1px solid #c9d6e7;
    border-radius: 5px;
    color: #fff;
    background: #17243a;
    box-shadow: var(--shadow);
    font-size: 13px;
    font-weight: 700;
    animation: toast-in 180ms ease-out;
}

.toast.is-error {
    background: #a9202a;
}

.toast.is-success {
    background: #087b42;
}

.toast svg {
    width: 18px;
    height: 18px;
    flex: none;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.back-top {
    position: fixed;
    z-index: 30;
    right: 22px;
    bottom: 22px;
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border: 1px solid #c5d0df;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 8px 20px rgba(14, 31, 53, 0.14);
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 160ms ease;
}

.back-top.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.back-top svg {
    width: 19px;
    height: 19px;
}

@media (max-width: 1040px) {
    .candidate-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

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

    .status-action {
        display: none;
    }
}

@media (max-width: 800px) {
    :root {
        --header-height: 60px;
    }

    .header-inner,
    .section-inner,
    .status-inner,
    .site-footer {
        width: min(100% - 28px, 680px);
    }

    .main-nav {
        display: none;
    }

    .campaign-hero {
        height: auto;
        min-height: 0;
        aspect-ratio: 16 / 9;
    }

    .campaign-hero img {
        object-fit: contain;
        object-position: center;
    }

    .status-inner {
        min-height: 128px;
        gap: 14px;
    }

    .status-copy h1 {
        font-size: 22px;
    }

    .status-copy p {
        display: none;
    }

    .vote-meter {
        min-width: 112px;
    }

    .vote-meter > span:first-child {
        display: none;
    }

    .vote-meter strong {
        font-size: 38px;
    }

    .candidate-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 14px;
    }

    .rules-layout {
        grid-template-columns: 1fr;
        gap: 42px;
    }

    .rules-heading {
        position: static;
    }
}

@media (max-width: 560px) {
    .header-inner,
    .section-inner,
    .status-inner,
    .site-footer {
        width: calc(100% - 24px);
    }

    .brand strong {
        font-size: 15px;
    }

    .brand small {
        font-size: 8px;
    }

    .brand-mark {
        width: 31px;
        height: 31px;
    }

    .device-badge {
        width: 40px;
        min-height: 40px;
        justify-content: center;
        padding: 0;
        border-radius: 50%;
    }

    .device-badge span {
        display: none;
    }

    .status-inner {
        grid-template-columns: minmax(0, 1fr) auto;
        min-height: 116px;
        padding: 18px 0;
    }

    .status-kicker {
        font-size: 10px;
    }

    .status-copy h1 {
        font-size: 19px;
    }

    .vote-meter {
        min-width: 84px;
        justify-content: flex-end;
    }

    .vote-meter strong {
        font-size: 34px;
    }

    .vote-meter span:last-child {
        font-size: 11px;
    }

    .vote-section {
        padding: 48px 0 64px;
    }

    .section-heading {
        align-items: flex-start;
        margin-bottom: 22px;
    }

    .section-heading h2,
    .rules-heading h2 {
        font-size: 25px;
    }

    .section-heading .button {
        width: 42px;
        min-height: 42px;
        padding: 0;
        flex: none;
    }

    .section-heading .button:not(.status-action) {
        font-size: 0;
    }

    .vote-tools {
        align-items: stretch;
        flex-direction: column;
        padding: 10px 0;
        background: transparent;
    }

    .search-box {
        width: 100%;
    }

    .segmented {
        width: 100%;
        grid-template-columns: 1fr 1fr;
    }

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

    .candidate-card {
        grid-template-rows: auto minmax(72px, auto) 44px;
    }

    .candidate-info {
        padding: 10px 9px 8px;
    }

    .candidate-info h3 {
        min-height: 40px;
        font-size: 13px;
        line-height: 20px;
    }

    .candidate-info p {
        margin-top: 3px;
    }

    .candidate-info p strong {
        font-size: 15px;
    }

    .vote-button {
        height: 44px;
        font-size: 12px;
    }

    .rules-section {
        padding: 58px 0 64px;
    }

    .rule-steps li {
        grid-template-columns: 44px 1fr;
        gap: 12px;
    }

    .rule-steps li > span {
        font-size: 22px;
    }

    .site-footer {
        align-items: flex-start;
        flex-direction: column;
        justify-content: center;
        gap: 7px;
        min-height: 120px;
    }

    .site-footer p {
        margin: 0;
    }

    .app-dialog {
        width: calc(100% - 20px);
        max-height: calc(100dvh - 20px);
        padding: 28px 20px 22px;
    }

    .back-top {
        right: 14px;
        bottom: 14px;
    }
}

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

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