#plan-description h4 {
    margin-top: 0;
}

#message p {
    overflow: hidden;
}


/*

https://github.com/PlanScore/PlanScore/blob/b48188b/_common/jslibs/leaflet-control-partylegend.css

*/

div.planscore-partylegend {
    border: 2px solid rgba(0,0,0,0.2);
    border-radius: 4px;
    background-color: #fff;

    padding: 5px 5px 0 5px;
}

div.planscore-partylegend div.planscore-partylegend-swatch {
    display: inline-block;
    width: 18px;
    height: 18px;
}

div.planscore-partylegend div.planscore-partylegend-swatch-democrat {
    background-color: #0049A8;
    opacity: 0.6;
}

div.planscore-partylegend div.planscore-partylegend-swatch-republican {
    background-color: #C71C36;
    opacity: 0.6;
}

div.planscore-partylegend div.planscore-partylegend-swatch-both {
    background-image: url(/images/mapfill_nodata.png);
    opacity: 0.6;
}

div.planscore-partylegend div.planscore-partylegend-words {
    padding-left: 10px;
    font-size: 14px;
    display: inline-block;
    vertical-align: text-bottom;
}

.table-districts, .table-metrics {
    height: auto;
    padding: 0;
    width: 100%;
    margin-bottom: 15px;
}
.table-districts {
    height: calc(100vh - 400px - 20px); /* fit on screen along with the 400px tall map, and some margin */
    min-height: 300px;
}
.table-metrics {
    margin-top: 15px;
}
@media only print {
    .table-districts { height: auto; }
}
.table-districts td, .table-metrics td, .table-districts th, .table-metrics th { text-align: right; }
.table-districts td.ltxt, .table-metrics td.ltxt, .table-districts th.ltxt, .table-metrics th.ltxt { text-align: left; }
.table-districts tbody td, .table-metrics tbody td {
    white-space: nowrap; /* nowrap => body rows stay single-line => more dense display */
}
.table-districts tbody tr.no-votes td { text-decoration: line-through }
.table-districts table, .table-metrics table {
    margin: 0;
}

/*
    CSS responsive table with fixed column and row headers and scroll snap
    by Scott Jehl
    https://codepen.io/scottjehl/pen/abJrPOP?editors=1100
*/
.table-jehl {
    scroll-snap-type: x mandatory;
    overflow: auto;
    border: 1px solid #ddd;
}
.table-jehl th, .table-jehl td {
    scroll-snap-align: start;
}
.table-jehl thead {
    z-index: 1000;
    position: relative;
}
.table-jehl thead th {
    position: sticky;
    top: 0;
}
.table-jehl thead th:first-child {
    left: 0;
    z-index: 1001;
    border-left: 0;
}
.table-jehl tbody {
    z-index: 10;
    position: relative;
}
.table-jehl tbody th {
    background-clip: padding-box;
    border-left: 0;
    position: sticky;
    left: 0;
}
.table-jehl thead th,
.table-jehl tbody th {
    background-color: #f8f8f8;
}

#message
{
    text-align: center;
    margin: 6em 0 12em;
}

ul.scores-box
{
    padding: 0 !important;
}

    ul.scores-box li
    {
        list-style-type: none !important;
    }

    ul.scores-box li h3
    {
        white-space: nowrap !important;
        font-size: 20px !important;
        color: #858073 !important;
    }

    ul.scores-box li p
    {
        font-size: 14px !important;
        line-height: 24px !important;
        color: #606980 !important;
        margin-bottom: 0 !important;
    }

    ul.scores-box li p a
    {
        white-space: nowrap !important;
    }

    ul.scores-box li p.score
    {
        font-size: 64px !important;
    }

    ul.scores-box li p.score-na
    {
        font-size: 36px !important;
        color: #BBBBBB !important;
        letter-spacing: -5px !important;
    }

#map
{
    width: 100%;
    height: 400px;
    border: 1px solid #93A1A1;
    clear: both;
    margin-top: 40px;
}

#score-sensitivity
{
    height: 200px;
}

table tr.highlighted {
    background-color: #f5f5f5; /* same as bootstrap's hover row style */
}

path.highlight {
    stroke-width: 5;
}

.seatshare-box
{
    display: inline-block;
    overflow: hidden;
    height: 14px;
    margin: 0;
    background-repeat: repeat;
}

/* Scenario adjustments form - fixed position bottom-right on mobile, upper-right on desktop */
#scenario-adjustments {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #f4f5f5; /* Light gray background */
    border: 1px solid #dfdfdf;
    padding: 15px 15px 0 15px;
    z-index: 1100;
    width: 180px;
    font-size: 14px;
    line-height: 1.2;
}

/* Desktop: position below navbar to avoid overlap */
@media (min-width: 769px) {
    #scenario-adjustments {
        top: 110px; /* Observed top of H1 element */
        bottom: auto;
    }
}

@media only print {
    /* Make scenario adjustments form flow in document for print */
    #scenario-adjustments {
        position: static !important;
        width: auto !important;
        margin: 20px 0 !important;
        border: 1px solid #dfdfdf;
        page-break-inside: avoid;
    }

    /* Hide grow/shrink UI control in print */
    #scenario-adjustments #grow-shrink-ui {
        display: none !important;
    }

    /* Hide margin slider in print (value is shown as text) */
    #scenario-adjustments input#margin-swing-range {
        display: none !important;
    }
}

#scenario-adjustments.scenario-adjustments-hidden {
    display: none !important;
}

#scenario-adjustments.scenario-adjustments-disabled #margin-swing-range,
#scenario-adjustments.scenario-adjustments-disabled #model-year {
    pointer-events: none;
}

    #scenario-adjustments #grow-shrink-ui {
        position: absolute;
        top: 0px;
        text-align: right;
        width: 180px;
        margin: 0 -15px;
        pointer-events: none;
    }

    #scenario-adjustments #grow-shrink-ui input[type="checkbox"] {
        width: 0;
        height: 0;
        position: absolute;
        left: -9999px;
    }

    #scenario-adjustments #grow-shrink-ui label {
        cursor: pointer;
        padding: 4px 4px;
        color: #b3c6d2;
        pointer-events: auto;
    }

    #scenario-adjustments.scenario-adjustments-shrunken .grown-shrunken {
        display: none;
    }

#scenario-adjustments p {
    margin-bottom: 1em;
    color: #4d566c;
    font-size: 14px; /* Match ul.scores-box li p */
    line-height: 24px; /* Match ul.scores-box li p */
}

#scenario-adjustments p label {
    font-size: 16px;
}

#scenario-adjustments input#margin-swing-range[type=range]
{
    height: 20px;
    -webkit-appearance: none;
    width: 100%;
    background-color: #f4f5f5; /* Light gray background */
}

    #scenario-adjustments input#margin-swing-range[type=range]::-webkit-slider-runnable-track
    {
        width: 100%;
        height: 18px;
        cursor: pointer;
        animate: 0.2s;
        box-shadow: none;
        background: #0f2c3a; /* Track background */
        border-radius: 10px;
        border: 0px solid #0f2c3a; /* Track background */
    }

    #scenario-adjustments input#margin-swing-range[type=range]:focus::-webkit-slider-runnable-track { background: #0f2c3a; /* Track background */ }

    #scenario-adjustments input#margin-swing-range[type=range]::-moz-range-track
    {
        width: 100%;
        height: 18px;
        cursor: pointer;
        animate: 0.2s;
        box-shadow: none;
        background: #0f2c3a; /* Track background */
        border-radius: 10px;
        border: 0px solid #0f2c3a; /* Track background */
    }

    #scenario-adjustments input#margin-swing-range[type=range]::-webkit-slider-thumb
    {
        box-shadow: none;
        border: 2px solid #0f2c3a; /* Track background */
        height: 18px;
        width: 18px;
        border-radius: 10px;
        background: #fff; /* Thumb color */
        cursor: pointer;
        -webkit-appearance: none;
    }

    #scenario-adjustments input#margin-swing-range[type=range]::-moz-range-thumb
    {
        box-shadow: none;
        border: 2px solid #0f2c3a; /* Track background */
        height: 14px;
        width: 14px;
        border-radius: 10px;
        background: #fff; /* Thumb color */
        cursor: pointer;
    }

    #scenario-adjustments input#margin-swing-range[type=range]::-ms-track
    {
        width: 100%;
        height: 18px;
        cursor: pointer;
        animate: 0.2s;
        background: transparent;
        border-color: transparent;
        color: transparent;
    }

    #scenario-adjustments input#margin-swing-range[type=range]::-ms-fill-lower
    {
        background: #0f2c3a; /* Track background */
        border: 0px solid #0f2c3a; /* Track background */
        border-radius: 18px;
        box-shadow: none;
    }

    #scenario-adjustments input#margin-swing-range[type=range]::-ms-fill-upper
    {
        background: #0f2c3a; /* Track background */
        border: 0px solid #0f2c3a; /* Track background */
        border-radius: 18px;
        box-shadow: none;
    }

    #scenario-adjustments input#margin-swing-range[type=range]::-ms-thumb
    {
        margin-top: 1px;
        box-shadow: none;
        border: 2px solid #0f2c3a; /* Track background */
        height: 18px;
        width: 18px;
        border-radius: 10px;
        background: #fff; /* Thumb color */
        cursor: pointer;
    }

    #scenario-adjustments input#margin-swing-range[type=range]:focus::-ms-fill-lower { background: #0f2c3a; /* Track background */ }

    #scenario-adjustments input#margin-swing-range[type=range]:focus::-ms-fill-upper { background: #0f2c3a; /* Track background */ }

    @media (-ms-high-contrast:none),(-ms-high-contrast:active)
    {
        #scenario-adjustments input#margin-swing-range[type=range] { height: 70px; }
    }

    /* Dull appearance when the #scenario-adjustments form is disabled */

    #scenario-adjustments.scenario-adjustments-disabled input#margin-swing-range[type=range]::-webkit-slider-runnable-track
    {
        background: #b3c6d2; /* Disabled track background */
        border: 0px solid #b3c6d2; /* Disabled track background */
    }

    #scenario-adjustments.scenario-adjustments-disabled input#margin-swing-range[type=range]:focus::-webkit-slider-runnable-track { background: #b3c6d2; /* Disabled track background */ }

    #scenario-adjustments.scenario-adjustments-disabled input#margin-swing-range[type=range]::-moz-range-track
    {
        background: #b3c6d2; /* Disabled track background */
        border: 0px solid #b3c6d2; /* Disabled track background */
    }

    #scenario-adjustments.scenario-adjustments-disabled input#margin-swing-range[type=range]::-webkit-slider-thumb { border: 2px solid #b3c6d2; /* Disabled track background */ }
    #scenario-adjustments.scenario-adjustments-disabled input#margin-swing-range[type=range]::-moz-range-thumb { border: 2px solid #b3c6d2; /* Disabled track background */ }

    #scenario-adjustments.scenario-adjustments-disabled input#margin-swing-range[type=range]::-ms-fill-lower
    {
        background: #b3c6d2; /* Disabled track background */
        border: 0px solid #b3c6d2; /* Disabled track background */
    }

    #scenario-adjustments.scenario-adjustments-disabled input#margin-swing-range[type=range]::-ms-fill-upper {
        background: #b3c6d2; /* Disabled track background */
        border: 0px solid #b3c6d2; /* Disabled track background */
    }

    #scenario-adjustments.scenario-adjustments-disabled input#margin-swing-range[type=range]::-ms-thumb { border: 2px solid #b3c6d2; /* Disabled track background */ }
    #scenario-adjustments.scenario-adjustments-disabled input#margin-swing-range[type=range]:focus::-ms-fill-lower { background: #b3c6d2; /* Disabled track background */ }
    #scenario-adjustments.scenario-adjustments-disabled input#margin-swing-range[type=range]:focus::-ms-fill-upper { background: #b3c6d2; /* Disabled track background */ }

    #scenario-adjustments.scenario-adjustments-disabled { color: #606980; }


#scenario-adjustments.scenario-adjustments-disabled input[type="range"] {
    cursor: not-allowed;
}

#margin-swing-range {
    width: 100%;
    direction: rtl; /* Reverse slider so D+ values are on the left */
}

/* Candidate scenario and model year pill-style forms */
form.candidate-scenario,
#scenario-adjustments #model-year {
    margin: 0;
    padding: 0;
    display: inline-flex;
    flex-flow: row nowrap;
    justify-content: flex-start;
    align-items: stretch;
    border-radius: 9px;
    overflow: hidden;
}

@media only print {
    /* Style model year radio buttons for print - use underline instead of background color */
    #scenario-adjustments #model-year input[type="radio"] + label {
        background-color: transparent !important;
        color: #000 !important;
    }

    #scenario-adjustments #model-year input[type="radio"]:checked + label {
        background-color: transparent !important;
        color: #000 !important;
        font-weight: bold;
        text-decoration: underline;
    }

    /* For candidate scenarios, only show the selected option */
    form.candidate-scenario input[type="radio"] + label {
        display: none !important;
    }

    form.candidate-scenario input[type="radio"]:checked + label {
        display: inline-block !important;
        background-color: transparent !important;
        color: #000 !important;
        font-weight: bold;
    }
}

    /* Make the radio buttons disappear and only interact with labels */
    form.candidate-scenario input[type="radio"],
    #scenario-adjustments #model-year input[type="radio"] {
        width: 0;
        height: 0;
        position: absolute;
        left: -9999px;
    }

    form.candidate-scenario label,
    #scenario-adjustments #model-year label {
        margin: 0;
        display: inline-block;
        height: 18px;
        font-size: 0.7rem;
        line-height: 1.0;
        text-align: center;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;  /* Disable iOS tap highlight delay */
        touch-action: manipulation;  /* Disable double-tap zoom delay */
    }

    form.candidate-scenario label {
        padding: 4px 8px 1px 8px;
    }

    #scenario-adjustments #model-year label {
        padding: 4px 10px 1px 10px;
    }

    /* Colors defined in http://chromatron.s3-website-us-east-1.amazonaws.com/#eNp108FqwzAMBuB38a45WLYs2XmVsYMTO6OsrNAx2Ch99zWxTYLq1adCPn7Jf3JT8+V8uX6p8fWmTkmNelDL6XxWo3qZkw3OqEH9qNGzG9SvGgFpUNfHf30fCoAd6IhLnAowFjdgNGyAXANmB5knnGMBhAUAhw0gN2B3kJb1FODQFOBZANxBmGJKcwHYErwTwO3AGc4zFmAbCDKBDiNFJp8L4DYSGQF4BzGsp+7gS4IFCXz/WjHYClCA0C+OmArQJAAcqk6Y8sItQm8CSW4Nh64Z1lO3oDIUOlkdHMpe0hyyrlNZruIp49B2DutpGWUqwieB/alaBuHT5q6fwdpWIdsA6t9ugLoHghTcf2u9pSq8FL7fBxPUu9JShH++PShvFXrZh9H9PmzLYHm7Bvp7GO9rhm3ibVBTnD/er5fvz7QlbL/H86fPlFdj7n9D9x86 */

    /* Text colors */
    form.candidate-scenario input[type="radio"] + label { color: #999 }
    form.candidate-scenario input[type="radio"]:checked + label { color: #fff }

    /* Default background colors */
    form.candidate-scenario input[type="radio"] + label.D { background-color: #d4def7 }
    form.candidate-scenario input[type="radio"] + label.O { background-color: #dfdfdf }
    form.candidate-scenario input[type="radio"] + label.R { background-color: #fdc9e0 }

    /* Selected background colors */
    form.candidate-scenario input[type="radio"]:checked + label.D { background-color: #0a4fab }
    form.candidate-scenario input[type="radio"]:checked + label.O { background-color: #717171 }
    form.candidate-scenario input[type="radio"]:checked + label.R { background-color: #cd3952 }

    /* Duller all-open background colors */
    .all-open-seats form.candidate-scenario input[type="radio"] + label { background-color: #e9e9e9 }
    .all-open-seats form.candidate-scenario input[type="radio"]:checked + label { background-color: #717171 }

    /* Text colors */
    #scenario-adjustments #model-year input[type="radio"] + label,
    #scenario-adjustments.scenario-adjustments-disabled #model-year input[type="radio"]:checked + label { color: #999 }
    #scenario-adjustments #model-year input[type="radio"]:checked + label { color: #fff }

    /* Default background colors */
    #scenario-adjustments #model-year input[type="radio"] + label { background-color: #dfdfdf }

    /* Selected background colors */
    #scenario-adjustments #model-year input[type="radio"]:checked + label { background-color: #0f2c3a; /* Track background */ }

    /* Disabled model year buttons (when scenarios exist but no model years available) */
    #scenario-adjustments.scenario-adjustments-disabled #model-year input[type="radio"] + label,
    #scenario-adjustments #model-year.model-year-disabled input[type="radio"] + label {
        background-color: #dfeaf0;
        cursor: not-allowed;
    }
