:root {
    --ink: #111820;
    --ink-soft: #26323d;
    --red: #d91b21;
    --red-dark: #a90f14;
    --gold: #f5ad22;
    --green: #00a65a;
    --paper: #fffaf2;
    --muted: #6d7680;
    --line: #eadfce;
    --white: #ffffff;
    --shadow: 0 24px 70px rgba(17, 24, 32, .2);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Montserrat, Arial, sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at 10% 10%, rgba(245, 173, 34, .24), transparent 30rem),
        linear-gradient(135deg, var(--ink) 0%, #17222c 46%, #f4eee4 46.2%, var(--paper) 100%);
}

a {
    color: inherit;
}

button,
.ghost-link {
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    font: inherit;
    font-weight: 800;
    text-decoration: none;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

button {
    background: var(--red);
    color: var(--white);
    box-shadow: 0 12px 24px rgba(217, 27, 33, .24);
}

button:hover,
.ghost-link:hover,
.campaign-card:hover {
    transform: translateY(-1px);
}

button.secondary {
    background: var(--ink-soft);
    box-shadow: none;
}

button.danger {
    background: #5a2023;
    box-shadow: none;
}

.page-shell,
.admin-shell {
    width: min(1220px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 48px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 34px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--white);
    font-weight: 900;
    letter-spacing: .06em;
    text-decoration: none;
    text-transform: uppercase;
}

.brand img {
    width: 150px;
    height: auto;
    display: block;
    background: var(--white);
}

.ghost-link {
    background: rgba(255, 255, 255, .12);
    color: var(--white);
    border: 1px solid rgba(255, 255, 255, .2);
    text-shadow: 0 2px 8px rgba(0, 0, 0, .3);
}

.hero {
    min-height: calc(100vh - 140px);
    display: grid;
    align-items: center;
    gap: 44px;
}

.vote-hero,
.campaign-list-hero {
    grid-template-columns: minmax(0, .9fr) minmax(380px, 540px);
}

.vote-hero {
    grid-template-columns: minmax(260px, .68fr) minmax(540px, 720px);
}

.hero-copy {
    color: var(--white);
}

.vote-hero .hero-copy {
    transform: translateX(-24px);
}

.eyebrow {
    color: var(--gold);
    font-size: .82rem;
    font-weight: 900;
    letter-spacing: .16em;
    margin: 0 0 16px;
    text-transform: uppercase;
}

h1 {
    font-size: clamp(2.25rem, 4.7vw, 4.6rem);
    line-height: 1;
    margin: 0;
    max-width: 820px;
    text-shadow: 0 3px 14px rgba(0, 0, 0, .35);
}

.intro {
    color: rgba(255, 255, 255, .84);
    font-size: 1.08rem;
    line-height: 1.7;
    max-width: 610px;
    margin: 24px 0 0;
    text-shadow: 0 2px 10px rgba(0, 0, 0, .34);
}

.vote-card,
.panel-card,
.campaign-card,
.empty-card {
    background: rgba(255, 255, 255, .96);
    border: 1px solid rgba(255, 255, 255, .72);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.vote-card,
.panel-card {
    padding: 26px;
}

.vote-card {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 148px);
    overflow: hidden;
}

.campaign-grid {
    display: grid;
    gap: 14px;
}

.campaign-card {
    display: block;
    padding: 22px;
    text-decoration: none;
    transition: transform .18s ease;
}

.campaign-card span,
.item-label,
label > span:not(.choice-content):not(.choice-badge),
legend {
    color: var(--muted);
    display: block;
    font-size: .78rem;
    font-weight: 900;
    letter-spacing: .08em;
    margin: 0 0 8px;
    text-transform: uppercase;
}

.campaign-card strong {
    display: block;
    font-size: 1.35rem;
    margin-bottom: 8px;
}

.campaign-card small {
    color: var(--muted);
    display: block;
    line-height: 1.5;
}

label,
fieldset {
    display: block;
    margin: 0 0 18px;
}

input[type="text"],
textarea,
select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    font: inherit;
    padding: 14px 15px;
    resize: vertical;
    outline: 0;
    background: #fffdf9;
}

select {
    min-height: 50px;
}

input[type="text"]:focus,
textarea:focus,
select:focus {
    border-color: var(--red);
    box-shadow: 0 0 0 4px rgba(217, 27, 33, .12);
}

.mode-choice {
    border: 0;
    padding: 0;
}

.mode-choice label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 10px 8px 0;
    padding: 11px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffdf9;
}

.mode-choice label span,
.check-line span {
    color: var(--ink-soft);
    margin: 0;
    text-transform: none;
}

.check-line {
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert,
.notice {
    border-radius: 8px;
    margin: 0 0 20px;
    padding: 14px 16px;
    font-weight: 800;
}

.alert.success {
    background: rgba(0, 166, 90, .12);
    color: #087140;
}

.alert.error {
    background: rgba(217, 27, 33, .12);
    color: var(--red-dark);
}

.notice {
    background: rgba(245, 173, 34, .16);
    color: #865707;
}

.option-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
    flex: 1 1 auto;
    margin: 0 -4px 18px 0;
    max-height: min(58vh, 560px);
    min-height: 160px;
    overflow: auto;
    overscroll-behavior: contain;
    padding: 2px 4px 8px 2px;
}

.option-list--single {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.vote-option {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    min-height: 96px;
    padding: 14px;
    background: #fffdf9;
}

.vote-option--choice {
    cursor: pointer;
    margin: 0;
    position: relative;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.vote-option--choice:hover {
    border-color: rgba(217, 27, 33, .38);
    transform: translateY(-1px);
}

.vote-option--choice:focus-within {
    border-color: var(--red);
    box-shadow: 0 0 0 4px rgba(217, 27, 33, .12);
}

.choice-input {
    height: 1px;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    width: 1px;
}

.choice-content {
    color: inherit;
    display: block;
    font-size: inherit;
    font-weight: inherit;
    letter-spacing: 0;
    margin: 0;
    min-width: 0;
    text-transform: none;
}

.vote-option strong {
    display: block;
    font-size: 1.08rem;
}

.choice-content small,
.vote-option p {
    color: var(--muted);
    display: block;
    line-height: 1.45;
    margin: 8px 0 0;
}

.score-control,
.choice-control {
    margin: 0;
    min-width: 96px;
}

.choice-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 14px;
}

.choice-control span {
    color: var(--ink);
    margin: 0;
    text-transform: none;
}

.choice-badge {
    align-items: center;
    align-self: center;
    background: rgba(109, 118, 128, .12);
    border-radius: 999px;
    color: var(--muted);
    display: inline-flex;
    font-size: .72rem;
    font-weight: 900;
    justify-content: center;
    letter-spacing: 0;
    margin: 0;
    min-height: 34px;
    padding: 0 11px;
    text-transform: uppercase;
    white-space: nowrap;
}

.choice-input:checked ~ .choice-badge {
    background: var(--red);
    color: var(--white);
}

.choice-input:checked ~ .choice-content strong {
    color: var(--red-dark);
}

.vote-option--choice:has(.choice-input:checked) {
    border-color: var(--red);
    box-shadow: 0 0 0 4px rgba(217, 27, 33, .1);
}

.vote-actions {
    background: linear-gradient(180deg, rgba(255, 255, 255, .78), rgba(255, 255, 255, .98) 34%);
    margin: auto -26px -26px;
    padding: 18px 26px 26px;
}

.vote-actions button {
    width: 100%;
}

.admin-grid {
    display: grid;
    grid-template-columns: minmax(330px, 430px) minmax(0, 1fr);
    align-items: start;
    gap: 22px;
}

.create-card h1 {
    color: var(--ink);
    font-size: 2rem;
    text-shadow: none;
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.campaign-admin-list {
    display: grid;
    gap: 18px;
}

.campaign-admin-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 16px;
}

.campaign-admin-head h2 {
    font-size: 1.55rem;
    margin: 12px 0 8px;
}

.campaign-admin-head p {
    color: var(--muted);
    line-height: 1.55;
    margin: 0;
}

.vote-count {
    color: var(--red);
    display: block;
    font-size: 2.2rem;
    line-height: .95;
    text-align: right;
}

.vote-count span {
    color: var(--muted);
    display: block;
    font-size: .78rem;
    margin-top: 8px;
    text-transform: uppercase;
}

.pill {
    border-radius: 999px;
    display: inline-block;
    font-size: .75rem;
    font-weight: 900;
    padding: 5px 9px;
}

.pill.open {
    background: rgba(0, 166, 90, .14);
    color: #087140;
}

.pill.closed {
    background: rgba(109, 118, 128, .14);
    color: var(--muted);
}

.meta-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 18px;
}

.meta-grid div {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
}

.meta-grid span {
    color: var(--muted);
    display: block;
    font-size: .72rem;
    font-weight: 900;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.meta-grid a {
    color: var(--red-dark);
    font-weight: 800;
}

.results-table {
    overflow-x: auto;
}

table {
    border-collapse: collapse;
    width: 100%;
    min-width: 560px;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 13px 10px;
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: .76rem;
    text-transform: uppercase;
}

td small {
    color: var(--muted);
    display: block;
    margin-top: 4px;
}

.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.empty-card {
    color: var(--muted);
    padding: 28px;
}

@media (max-width: 960px) {
    body {
        background: linear-gradient(180deg, var(--ink) 0 34rem, var(--paper) 34rem);
    }

    .vote-hero,
    .campaign-list-hero,
    .admin-grid,
    .form-row,
    .meta-grid {
        grid-template-columns: 1fr;
    }

    .hero {
        align-items: start;
    }

    .vote-hero .hero-copy {
        transform: none;
    }

    .vote-option,
    .campaign-admin-head {
        grid-template-columns: 1fr;
    }

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

    .campaign-admin-head {
        display: grid;
    }

    .vote-count {
        text-align: left;
    }
}

@media (max-width: 620px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

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

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

    .vote-actions {
        margin: auto -20px -20px;
        padding: 16px 20px 20px;
    }

    h1 {
        font-size: 2.2rem;
    }
}
