:root {
    color-scheme: light;
    --bg: #e8edf0;
    --ink: #17212b;
    --muted: #5c6975;
    --line: #c7d0d8;
    --screen: #f5f7ef;
    --panel: #ffffff;
    --dark: #22272d;
    --green: #22945b;
    --orange: #d58a20;
    --red: #b3261e;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
}

img {
    max-width: 100%;
}

button {
    font: inherit;
    touch-action: manipulation;
}

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

.intro {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 22px;
}

.eyebrow {
    margin: 0 0 8px;
    color: #0d6b5f;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    max-width: 760px;
    margin-bottom: 14px;
    font-size: clamp(30px, 5vw, 56px);
    line-height: 1;
    letter-spacing: 0;
}

h2 {
    margin-bottom: 16px;
    font-size: 22px;
}

.notice {
    max-width: 820px;
    margin-bottom: 0;
    color: var(--muted);
    font-size: 17px;
    line-height: 1.45;
}

.stats {
    min-width: 180px;
    padding: 20px;
    border: 1px solid var(--line);
    background: var(--panel);
    border-radius: 8px;
}

.stats span {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 14px;
}

.stats strong {
    font-size: 42px;
}

.alert {
    margin: 0 0 18px;
    padding: 14px 16px;
    border-radius: 8px;
    font-weight: 700;
}

.alert.error {
    background: #fde8e7;
    color: var(--red);
}

.alert.success {
    background: #dff5e9;
    color: #10623a;
}

.ad-slot {
    min-height: 90px;
    margin: 0 0 22px;
    overflow: hidden;
}

.voting-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr);
    gap: 22px;
    align-items: start;
}

.urna {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(250px, 320px);
    gap: 20px;
    padding: 22px;
    border: 1px solid #b9c2ca;
    border-radius: 8px;
    background: #d4d8d9;
    box-shadow: 0 16px 38px rgba(17, 28, 38, .14);
}

.screen {
    min-height: 370px;
    display: flex;
    flex-direction: column;
    padding: 24px;
    border: 3px solid #a8b0aa;
    background: var(--screen);
}

.screen-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    color: var(--muted);
    font-size: 15px;
    text-transform: uppercase;
}

.screen-header strong {
    color: var(--ink);
}

.digits {
    display: flex;
    gap: 10px;
    margin: 42px 0 28px;
}

.digits span {
    width: 58px;
    height: 72px;
    display: grid;
    place-items: center;
    border: 2px solid var(--ink);
    background: rgba(255, 255, 255, .35);
    font-size: 42px;
    font-weight: 700;
}

.candidate-preview {
    min-height: 110px;
    display: grid;
    grid-template-columns: 1fr 120px;
    gap: 18px;
    align-items: start;
    padding-top: 8px;
    border-top: 1px solid #c9cfc5;
}

.candidate-preview strong {
    display: block;
    margin-bottom: 8px;
    font-size: 30px;
}

.candidate-preview span,
.candidate-preview small {
    display: block;
    color: var(--muted);
    font-size: 17px;
}

.candidate-photo {
    width: 120px;
    height: 150px;
    border: 2px solid #222;
    background: #fff;
    object-fit: cover;
    object-position: center top;
}

.muted {
    color: var(--muted);
}

.screen-footer {
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid #c9cfc5;
    color: var(--muted);
    font-size: 14px;
}

.keyboard {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    align-content: start;
    padding: 18px;
    border-radius: 8px;
    background: var(--dark);
}

.key {
    height: 58px;
    border: 0;
    border-radius: 6px;
    background: #111417;
    color: #fff;
    font-size: 26px;
    font-weight: 700;
    box-shadow: inset 0 -4px 0 rgba(255, 255, 255, .08), 0 3px 0 #000;
    cursor: pointer;
}

.key:active,
.candidate-card:active,
.control:active {
    transform: translateY(1px);
}

.actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.control {
    min-height: 56px;
    border: 0;
    border-radius: 6px;
    color: #111;
    font-weight: 800;
    cursor: pointer;
}

.control.white {
    background: #fff;
}

.control.orange {
    background: var(--orange);
}

.control.green {
    background: var(--green);
    color: #fff;
}

.control:disabled {
    cursor: not-allowed;
    filter: grayscale(.5);
    opacity: .55;
}

.panel,
.results {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    padding: 20px;
}

.candidate-list {
    display: grid;
    gap: 10px;
}

.candidate-card {
    width: 100%;
    display: grid;
    grid-template-columns: 58px 1fr;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f9fbfc;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.candidate-card:hover {
    border-color: #7f99ad;
}

.number {
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 6px;
    background: #17212b;
    color: #fff;
    font-size: 22px;
    font-weight: 800;
}

.candidate-card strong,
.candidate-card small {
    display: block;
}

.candidate-card small {
    margin-top: 4px;
    color: var(--muted);
}

.results {
    margin-top: 22px;
}

.result-list {
    display: grid;
    gap: 14px;
}

.result-row {
    display: grid;
    grid-template-columns: minmax(180px, .7fr) minmax(180px, 1fr) minmax(110px, .35fr);
    gap: 14px;
    align-items: center;
}

.result-label strong,
.result-label span,
.result-value strong {
    display: block;
}

.result-label span,
.result-value {
    color: var(--muted);
    font-size: 14px;
}

.result-value {
    text-align: right;
}

.result-value strong {
    margin-top: 4px;
    color: var(--ink);
    font-size: 18px;
}

.bar {
    height: 14px;
    overflow: hidden;
    border-radius: 999px;
    background: #dfe5ea;
}

.bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: #0d6b5f;
}

@media (max-width: 920px) {
    .intro,
    .voting-layout,
    .urna,
    .result-row {
        grid-template-columns: 1fr;
    }

    .intro {
        display: grid;
    }

    .stats {
        min-width: 0;
    }
}

@media (max-width: 560px) {
    .page-shell {
        width: min(100% - 20px, 1180px);
        padding: 14px 0 32px;
    }

    h1 {
        font-size: 28px;
        line-height: 1.05;
    }

    h2 {
        font-size: 19px;
    }

    .notice {
        font-size: 15px;
    }

    .stats {
        padding: 14px;
    }

    .stats strong {
        font-size: 34px;
    }

    .urna,
    .panel,
    .results {
        padding: 12px;
    }

    .urna {
        gap: 12px;
    }

    .screen {
        min-height: 285px;
        padding: 12px;
        border-width: 2px;
    }

    .screen-header {
        font-size: 12px;
    }

    .digits {
        gap: 8px;
        margin: 24px 0 16px;
    }

    .digits span {
        width: 48px;
        height: 58px;
        font-size: 34px;
    }

    .candidate-preview {
        min-height: 102px;
        grid-template-columns: minmax(0, 1fr) 78px;
        gap: 10px;
    }

    .candidate-preview strong {
        margin-bottom: 5px;
        font-size: 21px;
        line-height: 1.05;
    }

    .candidate-preview span,
    .candidate-preview small,
    .screen-footer {
        font-size: 13px;
    }

    .candidate-photo {
        width: 78px;
        height: 98px;
        border-width: 1px;
    }

    .keyboard {
        gap: 8px;
        padding: 12px;
    }

    .key {
        height: 52px;
        font-size: 24px;
    }

    .actions {
        grid-template-columns: .9fr .95fr 1.15fr;
        gap: 8px;
    }

    .control {
        min-height: 50px;
        padding: 0 6px;
        font-size: 13px;
    }

    .candidate-card {
        grid-template-columns: 50px 1fr;
        padding: 10px;
    }

    .number {
        height: 42px;
        font-size: 20px;
    }

    .result-row {
        gap: 8px;
    }

    .result-value {
        text-align: left;
    }
}

@media (max-width: 380px) {
    .candidate-preview {
        grid-template-columns: 1fr;
    }

    .candidate-photo {
        width: 72px;
        height: 90px;
    }

    .control {
        font-size: 12px;
    }
}
