body {
    color: #222;
    font-family: Arial, sans-serif;
    line-height: 1.45;
    margin: 2rem auto;
    max-width: 74rem;
    padding: 0 1rem;
}

h1 {
    margin-bottom: 0.25rem;
}

.instructions {
    margin-top: 0;
}

.worksheet {
    align-items: start;
    display: grid;
    gap: 1.5rem;
    grid-template-columns: minmax(0, 1.5fr) minmax(16rem, 0.8fr);
}

figure {
    margin: 0;
}

.map-container {
    position: relative;
}

.map,
#map-labels {
    display: block;
    height: auto;
    width: 100%;
}

#map-labels {
    height: 100%;
    inset: 0;
    pointer-events: none;
    position: absolute;
}

figcaption {
    color: #555;
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

h2 {
    font-size: 1.2rem;
    margin: 0 0 0.75rem;
}

#question-headings,
#questions li {
    display: grid;
    gap: 0.5rem;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.5fr) minmax(3rem, 0.45fr);
}

#question-headings.letter-mode,
#questions li.letter-mode {
    grid-template-columns: 1.5rem minmax(0, 1fr) minmax(0, 1fr);
}

#question-headings {
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

#questions {
    display: grid;
    gap: 0.65rem;
    grid-template-columns: minmax(0, 1fr);
    list-style: none;
    margin: 0;
    padding: 0;
}

#questions li {
    align-items: end;
}

.answer-space {
    border-bottom: 1px solid #777;
    display: block;
    height: 1.3rem;
}

footer {
    font-size: 0.75rem;
    margin-top: 1rem;
}

.actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.regenerate-button {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    position: fixed;
    right: 0.75rem;
    top: 0.75rem;
    z-index: 1;
}

button {
    cursor: pointer;
    font: inherit;
    padding: 0.5rem 1rem;
}

.reference-page {
    max-width: 74rem;
}

.country-list {
    border-collapse: collapse;
    width: 100%;
}

.country-list th,
.country-list td {
    border-bottom: 1px solid #bbb;
    padding: 0.3rem 0.5rem;
    text-align: left;
}

.country-list th:first-child,
.country-list td:first-child {
    text-align: right;
    width: 3rem;
}

.full-map-page {
    max-width: none;
}

.full-map-container {
    position: relative;
}

.full-map {
    display: block;
    height: auto;
    margin: 0 auto;
    width: 100%;
}

.full-map-figure {
    margin: 0;
}

.full-map-figure figcaption {
    margin-top: 0.5rem;
}

@media (max-width: 48rem) {
    .worksheet {
        grid-template-columns: 1fr;
    }
}

@media print {
    .province-reference-list {
        page: province-reference-list;
    }

    .country-reference-list {
        page: country-reference-list;
    }

    @page {
        size: A4 portrait;
        margin: 10mm;
    }

    @page province-reference-list {
        size: A4 portrait;
    }

    @page country-reference-list {
        size: A4 portrait;
    }

    body {
        color: #000;
        font-size: 10pt;
        margin: 0;
        max-width: none;
        padding: 0;
    }

    h1 {
        font-size: 18pt;
    }

    .worksheet {
        gap: 1rem;
        grid-template-columns: minmax(0, 1.5fr) minmax(0, 0.8fr);
    }

    .map-container {
        margin: 0 auto;
        width: 90%;
    }

    .province-reference-map .map-container {
        width: 82.9%;
    }

    .country-reference-map .full-map-container {
        margin: 0 auto;
        width: 82.9%;
    }

    .country-reference-map .full-map {
        max-height: 166mm;
    }

    #questions {
        gap: 0.35rem;
    }

    #question-headings {
        margin-bottom: 0.3rem;
    }

    #questions li {
        break-inside: avoid;
    }

    .actions,
    .regenerate-button,
    .index-link,
    .full-list-link,
    .map-link {
        display: none;
    }

    .full-map-page {
        padding: 0;
    }

    .full-map {
        max-height: 180mm;
        max-width: 100%;
        width: auto;
    }

    .country-list th,
    .country-list td {
        padding: 1mm 2mm;
    }

    footer {
        font-size: 7pt;
        margin-top: 0.5rem;
    }

    figcaption {
        font-size: 7pt;
    }
}
