:root {
    color-scheme: light;

    --background: #ffffff;
    --background-subtle: #f8f9fa;
    --background-progressive: #eaf3ff;

    --border: #a2a9b1;
    --border-subtle: #c8ccd1;

    --text: #202122;
    --text-subtle: #54595d;

    --link: #3366cc;
    --link-hover: #2a4b8d;

    --button: #3366cc;
    --button-hover: #2a4b8d;

    --error-background: #fee7e6;
    --error-border: #b32424;

    --mark: #fff3cd;
}


* {
    box-sizing: border-box;
}


html {
    background: var(--background);
}


body {
    margin: 0;

    background: var(--background);

    color: var(--text);

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        "Helvetica Neue",
        Arial,
        sans-serif;

    font-size: 14px;
    line-height: 1.6;
}


a {
    color: var(--link);
    text-decoration: none;
}


a:hover,
a:focus {
    color: var(--link-hover);
    text-decoration: underline;
}


.site-header {
    border-bottom: 1px solid var(--border-subtle);
    background: #ffffff;
}


.site-header-inner {
    width: min(960px, calc(100% - 32px));
    margin: 0 auto;
    min-height: 64px;

    display: flex;
    align-items: center;
}


.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;

    color: var(--text);
    text-decoration: none;
}


.brand:hover {
    color: var(--text);
    text-decoration: none;
}


.brand img {
    width: 38px;
    height: 38px;
}


.brand span {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}


.brand strong {
    font-family:
        Georgia,
        "Times New Roman",
        serif;

    font-size: 19px;
    font-weight: 400;
}


.brand small {
    margin-top: 2px;

    color: var(--text-subtle);

    font-size: 11px;
    letter-spacing: .03em;
}


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


.page-heading h1 {
    margin: 0;

    color: #000;

    font-family:
        Georgia,
        "Times New Roman",
        serif;

    font-size: 30px;
    font-weight: 400;
    line-height: 1.25;
}


.page-heading p {
    max-width: 720px;

    margin: 8px 0 0;

    color: var(--text-subtle);

    font-size: 14px;
}


.result-heading h1 {
    font-size: 28px;
}


.divider {
    margin: 13px 0 24px;
    border-top: 1px solid var(--border);
}


.tool-panel {
    max-width: 760px;
}


.field {
    margin-bottom: 22px;
}


.field > label,
.option-field > label {
    display: block;

    margin-bottom: 5px;

    font-size: 14px;
    font-weight: 600;
}


input[type="text"],
input[type="number"] {
    width: 100%;

    border: 1px solid var(--border);
    border-radius: 2px;

    background: #ffffff;
    color: var(--text);

    font: inherit;

    padding: 7px 8px;

    min-height: 34px;
}


input[type="text"]:focus,
input[type="number"]:focus {
    outline: 2px solid #36c;
    outline-offset: -1px;
    border-color: #36c;
}


.field-help {
    margin-top: 5px;

    color: var(--text-subtle);

    font-size: 12px;
    line-height: 1.45;
}


code {
    padding: 1px 4px;

    border: 1px solid #eaecf0;

    background: var(--background-subtle);

    font-family:
        "SFMono-Regular",
        Consolas,
        "Liberation Mono",
        monospace;

    font-size: 11px;
}


.options {
    max-width: 620px;

    margin: 28px 0 20px;

    padding: 16px;

    border: 1px solid var(--border-subtle);
    border-radius: 2px;
}


.options legend {
    padding: 0 6px;

    font-weight: 600;
}


.option-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}


.option-field input {
    max-width: 160px;
}


.checkbox-row {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;

    margin-top: 14px;
}


.checkbox-row label {
    display: inline-flex;
    align-items: center;
    gap: 6px;

    cursor: pointer;
}


.checkbox-row input {
    margin: 0;
}


.form-actions {
    margin-top: 18px;
}


.button-primary {
    display: inline-block;

    min-height: 34px;

    padding: 6px 14px;

    border: 1px solid #36c;
    border-radius: 2px;

    background: var(--button);

    color: #ffffff;

    font-family: inherit;
    font-size: 14px;
    font-weight: 600;

    cursor: pointer;
}


.button-primary:hover,
.button-primary:focus {
    border-color: var(--button-hover);
    background: var(--button-hover);
}


.help-section {
    max-width: 760px;

    margin-top: 42px;
    padding-top: 18px;

    border-top: 1px solid var(--border-subtle);
}


.help-section h2,
.summary-box h2,
.match-list > h2,
.message h2 {
    margin: 0 0 10px;

    font-family:
        Georgia,
        "Times New Roman",
        serif;

    font-size: 20px;
    font-weight: 400;
}


.help-section p {
    margin: 8px 0;
}


.back-nav {
    margin-bottom: 18px;

    font-size: 13px;
}


.summary-box {
    margin-bottom: 32px;
}


.source-row {
    display: grid;
    grid-template-columns: 90px 1fr;

    padding: 10px 0;

    border-bottom: 1px solid #eaecf0;
}


.source-label {
    font-weight: 600;
}


.source-content {
    min-width: 0;
}


.source-content > a {
    overflow-wrap: anywhere;
}


.source-meta {
    margin-top: 3px;

    color: var(--text-subtle);

    font-size: 12px;
}


.result-count {
    margin-top: 18px;

    display: flex;
    align-items: baseline;
    gap: 7px;
}


.result-count strong {
    font-size: 26px;
    font-weight: 500;
}


.result-count span {
    color: var(--text-subtle);
}


.match-list {
    margin-top: 25px;
}


.match {
    margin-bottom: 22px;

    border: 1px solid var(--border-subtle);
    border-radius: 2px;

    background: #ffffff;
}


.match-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 15px;

    padding: 8px 12px;

    border-bottom: 1px solid var(--border-subtle);

    background: var(--background-subtle);
}


.match-header strong {
    font-size: 13px;
}


.match-header span {
    color: var(--text-subtle);

    font-size: 12px;
}


.match-document {
    padding: 12px 14px;
}


.match-document + .match-document {
    border-top: 1px solid #eaecf0;
}


.match-label {
    margin-bottom: 5px;

    color: var(--text-subtle);

    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}


.match-document p {
    margin: 0;

    line-height: 1.7;
}


.context {
    color: #54595d;
}


mark {
    padding: 1px 2px;

    background: var(--mark);
    color: #202122;
}


.message {
    max-width: 760px;

    margin: 20px 0;

    padding: 14px 16px;

    border: 1px solid var(--border-subtle);
    border-left-width: 4px;

    background: var(--background-subtle);
}


.message-error {
    border-left-color: var(--error-border);
    background: var(--error-background);
}


.message-neutral {
    border-left-color: #72777d;
}


.message p:last-child {
    margin-bottom: 0;
}


.site-footer {
    margin-top: 52px;
    padding-top: 15px;

    border-top: 1px solid var(--border-subtle);

    color: var(--text-subtle);

    font-size: 11px;
    line-height: 1.7;
}


.footer-line {
    margin: 2px 0;
}


.footer-runtime {
    margin-top: 7px;
}


@media (max-width: 700px) {

    .page {
        padding-top: 24px;
    }

    .page-heading h1 {
        font-size: 26px;
    }

    .option-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .option-field input {
        max-width: 100%;
    }

    .source-row {
        grid-template-columns: 1fr;
        gap: 3px;
    }

    .match-header {
        display: block;
    }

    .match-header span {
        display: block;
        margin-top: 2px;
    }

}

.footer-inline {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    overflow-x: auto;
}

.footer-separator {
    color: #72777d;
}


/* ========================================
   Compact Wikimedia-style layout
   ======================================== */

.site-header-inner {
    width: min(920px, calc(100% - 28px));
    min-height: 52px;
}

.brand {
    gap: 8px;
}

.brand img {
    width: 30px;
    height: 30px;
}

.brand strong {
    font-size: 17px;
}

.brand small {
    margin-top: 1px;
    font-size: 10px;
}


.page {
    width: min(920px, calc(100% - 28px));
    padding: 20px 0 28px;
}


.page-heading h1 {
    font-size: 26px;
}

.result-heading h1 {
    font-size: 24px;
}

.page-heading p {
    margin-top: 4px;
    font-size: 13px;
    line-height: 1.5;
}


.divider {
    margin: 9px 0 17px;
}


.tool-panel {
    max-width: 720px;
}


.field {
    margin-bottom: 14px;
}

.field > label,
.option-field > label {
    margin-bottom: 3px;
    font-size: 13px;
}


input[type="text"],
input[type="number"] {
    min-height: 31px;
    padding: 5px 7px;
    font-size: 13px;
}


.field-help {
    margin-top: 3px;
    font-size: 11px;
    line-height: 1.35;
}


code {
    padding: 0 3px;
    font-size: 10px;
}


.options {
    max-width: 580px;
    margin: 18px 0 14px;
    padding: 11px 12px;
}

.options legend {
    padding: 0 4px;
    font-size: 13px;
}


.option-grid {
    gap: 14px;
}

.option-field input {
    max-width: 130px;
}


.checkbox-row {
    gap: 18px;
    margin-top: 9px;
    font-size: 12px;
}


.form-actions {
    margin-top: 13px;
}


.button-primary {
    min-height: 31px;
    padding: 4px 12px;
    font-size: 13px;
}


.help-section {
    max-width: 720px;
    margin-top: 28px;
    padding-top: 13px;
}

.help-section h2,
.summary-box h2,
.match-list > h2,
.message h2 {
    margin-bottom: 7px;
    font-size: 18px;
}

.help-section p {
    margin: 5px 0;
    font-size: 13px;
    line-height: 1.5;
}


.back-nav {
    margin-bottom: 12px;
    font-size: 12px;
}


.summary-box {
    margin-bottom: 22px;
}

.source-row {
    grid-template-columns: 75px 1fr;
    padding: 7px 0;
    font-size: 13px;
}

.source-meta {
    margin-top: 1px;
    font-size: 11px;
}


.result-count {
    margin-top: 12px;
    gap: 5px;
}

.result-count strong {
    font-size: 22px;
}

.result-count span {
    font-size: 12px;
}


.match-list {
    margin-top: 18px;
}

.match {
    margin-bottom: 14px;
}

.match-header {
    padding: 6px 9px;
}

.match-header strong {
    font-size: 12px;
}

.match-header span {
    font-size: 11px;
}

.match-document {
    padding: 8px 10px;
}

.match-label {
    margin-bottom: 3px;
    font-size: 10px;
}

.match-document p {
    font-size: 12px;
    line-height: 1.55;
}


.message {
    max-width: 720px;
    margin: 14px 0;
    padding: 10px 12px;
}


.site-footer {
    margin-top: 30px;
    padding-top: 10px;
    font-size: 10px;
    line-height: 1.5;
}


@media (max-width: 700px) {

    .site-header-inner,
    .page {
        width: calc(100% - 22px);
    }

    .page {
        padding-top: 16px;
    }

    .page-heading h1 {
        font-size: 23px;
    }

    .brand strong {
        font-size: 16px;
    }

    .options {
        padding: 9px 10px;
    }

}


/* Justapedia OAuth login */

.site-header-inner {
    justify-content: space-between;
    gap: 14px;
}

.header-auth {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.auth-user {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #202122;
    font-size: 12px;
    font-weight: 500;
}

.auth-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 28px;
    padding: 3px 9px;

    border: 1px solid #a2a9b1;
    border-radius: 2px;

    background: #f8f9fa;
    color: #202122;

    font-size: 12px;
    font-weight: 600;

    text-decoration: none;
}

.auth-button:hover,
.auth-button:focus {
    border-color: #72777d;
    background: #ffffff;
    color: #202122;
    text-decoration: none;
}

.auth-login {
    border-color: #3366cc;
    background: #3366cc;
    color: #ffffff;
}

.auth-login:hover,
.auth-login:focus {
    border-color: #2a4b8d;
    background: #2a4b8d;
    color: #ffffff;
}

@media (max-width: 700px) {
    .auth-user {
        max-width: 95px;
    }
}

.form-error {
    margin: 0 0 16px;
    padding: 10px 12px;
    border: 1px solid #d73333;
    border-radius: 2px;
    background: #fff4f4;
    color: #202122;
    font-size: 13px;
}
