body {
    margin: 0;
    background: #e8ecf2;
    color: #111;
    font-family: Tahoma, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

header {
    background: #1d3b6e;
    color: #fff;
    border-bottom: 4px solid #f0a020;
    padding: 8px 16px;
}

header h1 {
    max-width: 800px;
    margin: 0 auto;
    font-size: 1.5em;
}

header a {
    color: #fff;
    text-decoration: none;
}

nav {
    background: #c9d6ea;
    border-bottom: 1px solid #7a8aa6;
    padding: 0 16px;
}

nav ul {
    display: flex;
    flex-wrap: wrap;
    max-width: 800px;
    margin: 0 auto;
    padding: 0;
    list-style: none;
}

nav a {
    display: block;
    padding: 6px 12px;
    color: #1d3b6e;
    font-weight: bold;
    text-decoration: none;
    border-left: 1px solid #7a8aa6;
}

nav li:first-child a {
    border-right: 1px solid #7a8aa6;
}

nav a:hover {
    background: #e8ecf2;
    text-decoration: underline;
}

nav a.active {
    background: #e8ecf2;
}

a {
    color: #0033cc;
}

h2 {
    font-size: 1.25em;
    color: #1d3b6e;
}

main {
    max-width: 800px;
    margin: 16px auto;
    padding: 0 16px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid #7a8aa6;
    margin-bottom: 16px;
}

caption {
    text-align: right;
    font-weight: bold;
    padding: 4px 0;
}

th, td {
    padding: 6px 8px;
    text-align: right;
    border: 1px solid #b4bfd1;
}

th {
    background: #c9d6ea;
}

figure {
    margin: 0 0 16px;
}

figure img {
    display: block;
    box-sizing: border-box;
    width: 100%;
    height: auto;
    border: 1px solid #7a8aa6;
}

figcaption {
    font-weight: bold;
    padding: 4px 0;
}

tbody tr:nth-child(even) {
    background: #f2f5fa;
}

tfoot th, tfoot td {
    background: #c9d6ea;
    font-weight: bold;
    border-top: 2px solid #7a8aa6;
}

summary {
    font-weight: bold;
    padding: 4px 0;
    cursor: pointer;
}

fieldset {
    min-width: 0;
    margin: 0 0 16px;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #7a8aa6;
}

legend {
    font-weight: bold;
    padding: 0 4px;
}

fieldset p,
.pane p {
    margin: 4px 0;
}

fieldset p label,
.pane p label {
    display: inline-block;
    min-width: 10em;
}

input[type="number"] {
    width: 8em;
    font: inherit;
    padding: 2px 4px;
}

button {
    font: inherit;
    padding: 4px 12px;
    background: #c9d6ea;
    border: 2px outset #b4bfd1;
    cursor: pointer;
}

button:active {
    border-style: inset;
}

input:user-invalid {
    border: 2px solid #b22222;
    background: #fdecec;
}

#pct-total.over {
    color: #b22222;
    font-weight: bold;
}

.errors {
    color: #b22222;
    background: #fdecec;
    border: 1px solid #b22222;
    padding: 4px 12px;
    margin-bottom: 16px;
}

td.seats {
    width: 3em;
    text-align: center;
    font-weight: bold;
}

.stale td.seats {
    color: #9aa3b1;
}

.hemicycle svg {
    display: block;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
}

.hemicycle.stale svg {
    opacity: 0.35;
}

.blocs {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px 12px;
    margin: 8px auto 0;
    padding: 0;
    list-style: none;
}

.swatch {
    display: inline-block;
    width: 0.8em;
    height: 0.8em;
    margin-inline-end: 6px;
    border: 1px solid #555;
    vertical-align: -1px;
}

#seats-parties {
    padding: 8px 4px;
}

#seats-parties th,
#seats-parties td {
    padding: 4px;
}

#seats-parties input[type="number"] {
    width: 3.75em;
}

.hemicycle .slice {
    cursor: pointer;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.hemicycle .slice .info {
    visibility: hidden;
}

.hemicycle .slice:hover path,
.hemicycle .slice:focus path {
    filter: brightness(0.75);
}

.hemicycle .slice:hover .info,
.hemicycle .slice:focus .info {
    visibility: visible;
}

.pane {
    margin: 0 0 16px;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #7a8aa6;
}

.pane[open] summary {
    margin-bottom: 4px;
}

.derived {
    display: grid;
    grid-template-columns: max-content auto;
    gap: 2px 12px;
    margin: 8px 0 0;
    padding-top: 8px;
    border-top: 1px dashed #b4bfd1;
}

.derived:empty {
    display: none;
}

.derived dt {
    min-width: 10em;
}

.derived dd {
    margin: 0;
    font-weight: bold;
}

.derived.stale dd {
    color: #9aa3b1;
}

td.seats {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

td.seats .count {
    display: inline-block;
    min-width: 3ch;
    text-align: center;
}

td.seats .gain {
    display: inline-block;
    width: 4.5ch;
    text-align: start;
    font-weight: normal;
    color: #444;
}

.note {
    margin: 4px 0 0;
    font-size: 0.875em;
    color: #444;
}

.scenarios h4 {
    margin: 24px 0 4px;
    color: #1d3b6e;
}

.explain {
    font-size: 0.75rem;
    font-weight: normal;
    margin-inline-start: 6px;
}

.scroll {
    overflow-x: auto;
    margin-bottom: 16px;
}

.scroll table {
    margin-bottom: 0;
}

.trends fieldset {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
}

.trends label {
    white-space: nowrap;
}

.trends input {
    margin-inline-end: 6px;
}

.trends svg {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid #7a8aa6;
}

.trends .trends-800 {
    display: none;
}

@media (min-width: 700px) {
    .trends .trends-400 {
        display: none;
    }

    .trends .trends-800 {
        display: block;
    }
}

.effects td {
    text-align: center;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.effects td.beyond {
    font-weight: bold;
}

.effects td.up {
    background: #cde2fb;
}

.effects td.down {
    background: #fbd9c9;
}

.majorities td {
    min-width: 5em;
    vertical-align: middle;
}

.odds {
    display: flex;
    height: 18px;
    margin: 3px 0;
    border: 1px solid #7a8aa6;
    background: #fff;
}

.majorities th[scope="row"] {
    white-space: nowrap;
}
