

:root {
    --ink: #16202c;
    --paper: #f7f5ef;
    --line: #cfc8b8;
    --navy: #1f3a5f;
    --navy-soft: #e7edf5;
    --warn: #8a5a00;
    --warn-soft: #fff6e3;
    --good: #1c5f3a;
    --good-soft: #e6f2ea;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    padding: 1rem 1rem calc(3rem + env(safe-area-inset-bottom));
    font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--ink);
    background: var(--paper);
    max-width: 44rem;
    margin-inline: auto;
}

h1 { font-size: 1.5rem; margin: .2rem 0 .4rem; }
h2 { font-size: 1.1rem; margin: 0 0 .5rem; }
.lede { margin: 0 0 1rem; font-size: 1.05rem; }
.hint { color: #5a5347; font-size: .9rem; margin: .4rem 0 0; }

.screen[hidden] { display: none !important; }   

.card {
    background: #fff;
    border: 2px solid var(--line);
    border-radius: 12px;
    padding: .9rem;
    margin: 0 0 1rem;
}

.card[hidden] { display: none !important; }
.card.quiet { background: #fbfaf6; }
.card.warn  { background: var(--warn-soft); border-color: #e0b663; }
.card.warn h2 { color: var(--warn); }
.card.land  { background: var(--good-soft); border-color: #9ec7ae; }
.card.land h2 { color: var(--good); }

button {
    font: inherit;
    color: inherit;
    cursor: pointer;
    border-radius: 10px;
    border: 2px solid var(--line);
    background: #fff;
    min-height: 44px;
}
button:focus-visible { outline: 4px solid var(--navy); outline-offset: 2px; }

.big {
    display: flex;
    align-items: center;
    gap: .7rem;
    width: 100%;
    text-align: left;
    padding: .7rem .8rem;
    margin: 0 0 .5rem;
}
.big.primary { background: var(--navy); color: #fff; border-color: var(--navy); font-weight: 600; }
.big .rnum {
    flex: 0 0 2rem; height: 2rem; line-height: 2rem; text-align: center;
    border-radius: 50%; background: var(--navy-soft); color: var(--navy); font-weight: 700;
}
.big .rtext { display: block; }
.big .rtext small { display: block; color: #5a5347; font-weight: 400; }
.big.primary .rtext small { color: #dbe6f3; }
.star { color: var(--warn); font-size: .85em; }

.back { background: none; border: none; padding: .4rem 0; color: var(--navy); font-weight: 600; }

.fld { display: block; font-weight: 600; margin: 0 0 .3rem; }
select {
    font: inherit; width: 100%; min-height: 44px; padding: .4rem;
    border: 2px solid var(--line); border-radius: 10px; background: #fff;
}



.pool { display: flex; flex-direction: column; gap: .4rem; }


.opt {
    display: flex; align-items: center; gap: .6rem;
    width: 100%; text-align: left; padding: .55rem .7rem;
}
.opt .badge {
    flex: 0 0 2rem; height: 2rem; line-height: 1.9rem; text-align: center;
    font-weight: 700; border: 2px solid var(--ink); background: #fff;
}

.opt[data-shape="0"] .badge { border-radius: 50%; }
.opt[data-shape="1"] .badge { border-radius: 2px; }
.opt[data-shape="2"] .badge { border-radius: 2px; transform: rotate(45deg); }
.opt[data-shape="3"] .badge { border-radius: 50% 2px 50% 2px; }

.badge .glyph, .slip-badge .glyph { display: inline-block; }
.opt[data-shape="2"] .badge .glyph { transform: rotate(-45deg); }

.opt[aria-pressed="true"] { border-color: var(--navy); background: var(--navy-soft); font-weight: 600; }
.opt[aria-pressed="true"] .badge { background: var(--navy); color: #fff; border-color: var(--navy); }

.opt[aria-pressed="true"]::after { content: "✓"; margin-left: auto; font-weight: 700; }
.opt[disabled] { opacity: .5; cursor: default; }

ol.ranked { margin: .7rem 0 0; padding-left: 1.4rem; }
ol.ranked li { margin: .25rem 0; }
ol.ranked .pos { font-weight: 700; }



.method { border-top: 2px solid var(--line); padding-top: .7rem; margin-top: .7rem; }
.method:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.method h3 { margin: 0 0 .2rem; font-size: 1rem; }
.method .how { color: #5a5347; font-size: .9rem; margin: 0 0 .5rem; }


.bar { display: flex; align-items: center; gap: .5rem; margin: .25rem 0; }
.bar .name { flex: 0 0 7.5rem; }
.bar .track { flex: 1 1 auto; height: 1.1rem; background: #eee7d8; border: 1px solid var(--line); }
.bar .fill { height: 100%; background: var(--navy); }
.bar .n { flex: 0 0 3.6rem; text-align: right; font-variant-numeric: tabular-nums; }

.verdict { margin: .5rem 0 0; font-weight: 600; }
.verdict.tie { color: var(--warn); }

.passes { margin: .5rem 0 0; padding-left: 1.2rem; font-size: .93rem; color: #3d3730; }
.passes li { margin: .2rem 0; }


.step { display: flex; gap: .7rem; padding: .6rem 0; border-top: 1px dashed var(--line); }
.step:first-child { border-top: none; }
.step .num {
    flex: 0 0 1.8rem; height: 1.8rem; line-height: 1.7rem; text-align: center;
    border: 2px solid var(--navy); border-radius: 50%; font-weight: 700; color: var(--navy);
}
.step .who { font-weight: 600; }
.step .stop { color: var(--warn); }


.notice {
    position: fixed; left: 50%; transform: translateX(-50%);
    bottom: calc(1rem + env(safe-area-inset-bottom));
    max-width: 26rem; width: calc(100% - 2rem);
    padding: .7rem .9rem; border-radius: 10px;
    background: var(--ink); color: #fff; font-weight: 600;
    box-shadow: 0 6px 20px rgba(0,0,0,.25);
    z-index: 50;
}
.notice[hidden] { display: none !important; }
.notice.bad  { background: #7a2318; }
.notice.good { background: var(--good); }

@media (min-width: 30rem) {
    .bar .name { flex-basis: 10rem; }
}


#printSheet { display: none; }

@media print {
    
    body > *:not(#printSheet) { display: none !important; }
    #printSheet { display: block !important; }

    body {
        margin: 0;
        padding: 0;
        max-width: none;
        background: #fff;
        color: #000;
        font: 12pt/1.35 Georgia, "Times New Roman", serif;
    }

    .ballot-slip {
        
        min-height: 45vh;
        box-sizing: border-box;
        border: 2pt solid #000;
        padding: 10pt 12pt;
        margin: 0 0 3vh;
        page-break-inside: avoid;
        break-inside: avoid;
        
        display: flex;
        flex-direction: column;
    }
    .ballot-slip:nth-child(2n) { margin-bottom: 0; page-break-after: always; }

    .slip-head { border-bottom: 1.5pt solid #000; padding-bottom: 4pt; margin-bottom: 6pt; }
    .slip-title { font-size: 9pt; letter-spacing: .08em; text-transform: uppercase; }
    .slip-q { font-size: 14pt; font-weight: bold; margin: 2pt 0 0; }

    .slip-instr { font-size: 9.5pt; font-style: italic; margin: 0 0 6pt; }

    table.slip-grid { width: 100%; border-collapse: collapse; }
    table.slip-grid th {
        font-size: 8.5pt; text-transform: uppercase; letter-spacing: .04em;
        border-bottom: 1pt solid #000; padding: 2pt 3pt; text-align: left;
    }
    table.slip-grid th.num, table.slip-grid th.check { text-align: center; width: 15%; }
    table.slip-grid td { padding: 5pt 3pt; border-bottom: .5pt dotted #666; vertical-align: middle; }

    
    .slip-badge {
        display: inline-block; width: 16pt; height: 16pt; line-height: 15pt;
        text-align: center; font-weight: bold; border: 1.2pt solid #000; margin-right: 6pt;
    }
    .slip-badge.s0 { border-radius: 50%; }
    .slip-badge.s1 { border-radius: 1pt; }
    .slip-badge.s2 { border-radius: 1pt; transform: rotate(45deg); }
    .slip-badge.s3 { border-radius: 50% 1pt 50% 1pt; }
    
    .slip-badge.s2 .glyph { display: inline-block; transform: rotate(-45deg); }

    
    .slip-box {
        display: block; width: 20pt; height: 20pt;
        border: 1.2pt solid #000; margin: 0 auto;
    }

    
    .slip-foot { font-size: 8.5pt; margin-top: auto; border-top: .5pt solid #000; padding-top: 6pt; }
}
