:root {
    --bg: #160f0d;
    --panel: rgba(28, 22, 19, 0.84);
    --panel-strong: #251917;
    --paper: #fff6df;
    --paper-dim: rgba(255, 246, 223, 0.76);
    --gold: #ffd54f;
    --red: #b71c1c;
    --green: #2f6b4f;
    --blue: #7fb7c9;
    --line: rgba(255, 246, 223, 0.16);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    min-height: 100%;
    margin: 0;
    color: var(--paper);
    font-family: 'Inter', system-ui, sans-serif;
    background:
        linear-gradient(rgba(22, 15, 13, 0.82), rgba(22, 15, 13, 0.94)),
        url("icon.svg") center 8vh / min(540px, 86vw) no-repeat,
        radial-gradient(circle at 22% 8%, rgba(183, 28, 28, 0.22), transparent 34%),
        linear-gradient(135deg, #231611, #0c1011 58%, #15201b);
}

a {
    color: inherit;
}

button,
input {
    font: inherit;
}

.vote-shell {
    width: min(1180px, calc(100% - 32px));
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 22px;
    align-items: start;
    margin: 0 auto;
    padding: 32px 0;
}

.vote-panel,
.license-note {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.32);
    backdrop-filter: blur(16px);
}

.vote-panel {
    min-width: 0;
    padding: clamp(20px, 4vw, 42px);
}

.vote-header {
    max-width: 780px;
}

.brand-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 32px;
    color: var(--paper-dim);
    text-decoration: none;
}

.brand-mark {
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--gold);
    border-radius: 50%;
    color: var(--gold);
    font-family: 'Abril Fatface', serif;
    font-size: 1.25rem;
}

.vote-kicker {
    width: fit-content;
    margin-bottom: 12px;
    padding: 6px 10px;
    border-left: 3px solid var(--red);
    color: var(--gold);
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-size: 0.78rem;
}

h1,
h2,
h3 {
    margin: 0;
}

h1 {
    max-width: 760px;
    font-family: 'Abril Fatface', Georgia, serif;
    font-size: clamp(2.35rem, 6vw, 5rem);
    line-height: 0.98;
    font-weight: 400;
}

.vote-lead {
    max-width: 700px;
    margin: 22px 0 0;
    color: var(--paper-dim);
    font-size: 1.05rem;
    line-height: 1.65;
}

.vote-form {
    margin-top: 30px;
}

.password-row,
.ballot-summary,
.candidate-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.18);
}

.password-row {
    padding: 16px;
}

.password-row label {
    display: block;
    margin-bottom: 8px;
    color: var(--paper-dim);
    font-size: 0.9rem;
}

.password-control {
    display: flex;
    gap: 10px;
}

.password-control input {
    flex: 1;
    min-width: 0;
    padding: 13px 14px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.38);
    color: var(--paper);
}

.password-control input:focus {
    outline: 2px solid rgba(255, 213, 79, 0.32);
    border-color: var(--gold);
}

.submit-button,
.quiet-button,
.score-button {
    border-radius: 6px;
    cursor: pointer;
}

.submit-button {
    min-width: 150px;
    border: 0;
    background: var(--gold);
    color: #1f160f;
    font-weight: 800;
    padding: 0 18px;
}

.submit-button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.ballot-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 0.9fr);
    gap: 16px;
    align-items: start;
    margin-top: 14px;
    padding: 16px;
}

.ballot-summary h2,
.section-heading h2,
.license-note h2 {
    color: var(--gold);
    font-family: 'Abril Fatface', Georgia, serif;
    font-weight: 400;
}

.ballot-summary p,
.section-heading p,
.license-note p {
    color: var(--paper-dim);
    line-height: 1.55;
}

.ballot-summary p {
    margin: 6px 0 0;
}

.selected-list {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.selected-list li {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: rgba(255, 246, 223, 0.05);
}

.selected-list span {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--green);
    color: #fff;
    font-weight: 800;
}

.selected-list strong {
    min-width: 0;
    color: var(--paper);
    overflow-wrap: anywhere;
}

.quiet-button {
    width: fit-content;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--paper-dim);
    padding: 9px 12px;
}

.quiet-button:hover,
.score-button:hover {
    border-color: var(--gold);
}

.vote-status {
    min-height: 24px;
    margin: 16px 0;
    color: var(--paper-dim);
    font-weight: 600;
}

.vote-status.success {
    color: #9de0b6;
}

.vote-status.error {
    color: #ffb1a8;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 16px;
    margin: 28px 0 16px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 10px;
}

.section-heading p {
    margin: 0;
}

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

.candidate-card {
    display: flex;
    min-width: 0;
    flex-direction: column;
    justify-content: space-between;
    gap: 18px;
    padding: 18px;
}

.candidate-card.is-selected {
    border-color: rgba(255, 213, 79, 0.72);
    background: rgba(255, 213, 79, 0.08);
}

.candidate-topline {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.candidate-title {
    font-size: 1.35rem;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.candidate-meta {
    margin: 8px 0 0;
    color: var(--blue);
    font-size: 0.9rem;
}

.candidate-description {
    margin: 14px 0 0;
    color: var(--paper-dim);
    line-height: 1.55;
}

.selected-badge {
    flex: 0 0 auto;
    min-width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    color: var(--paper-dim);
    font-weight: 800;
}

.candidate-card.is-selected .selected-badge {
    border-color: var(--gold);
    background: var(--gold);
    color: #1f160f;
}

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

.score-button {
    min-height: 42px;
    border: 1px solid var(--line);
    background: rgba(255, 246, 223, 0.05);
    color: var(--paper);
    font-weight: 800;
}

.score-button[aria-pressed="true"] {
    background: var(--gold);
    border-color: var(--gold);
    color: #1f160f;
}

.candidate-license {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 14px;
    color: rgba(255, 246, 223, 0.58);
    font-size: 0.8rem;
}

.candidate-license a,
.license-note a {
    color: var(--gold);
    text-decoration: none;
}

.candidate-license a:hover,
.license-note a:hover,
.brand-link:hover {
    text-decoration: underline;
}

.license-note {
    position: sticky;
    top: 24px;
    padding: 22px;
}

.license-note h2 {
    font-size: 1.65rem;
}

.license-note p {
    margin: 12px 0 18px;
}

.loading-card {
    grid-column: 1 / -1;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--paper-dim);
}

@media (max-width: 920px) {
    .vote-shell {
        grid-template-columns: 1fr;
    }

    .license-note {
        position: static;
    }
}

@media (max-width: 720px) {
    .vote-shell {
        width: min(100% - 20px, 1180px);
        padding: 10px 0 26px;
    }

    .vote-panel {
        padding: 18px;
    }

    .password-control,
    .ballot-summary,
    .section-heading {
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }

    .submit-button {
        min-height: 48px;
    }

    .candidate-grid {
        grid-template-columns: 1fr;
    }
}
