:root {
    --bonn-blue: #003f70;
    --bonn-blue-dark: #002c50;
    --bonn-blue-light: #0c659f;
    --bonn-yellow: #f5c542;

    --background: #edf2f6;
    --surface: #ffffff;
    --surface-muted: #f5f7f9;
    --border: #cad5df;
    --text: #172b3e;
    --text-muted: #5b6b78;

    --primary-green: #168548;
    --primary-red: #bd363b;
    --comparison-blue: #0879bd;
    --comparison-orange: #dd7417;
    --comparison-purple: #7c3aed;

    --shadow:
        0 2px 8px rgba(13, 42, 67, 0.16),
        0 8px 28px rgba(13, 42, 67, 0.10);
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
}

body {
    overflow: hidden;
    color: var(--text);
    background: var(--background);

    font-family:
        Inter,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;
}

button,
select,
input {
    font: inherit;
}

button,
select,
input[type="range"] {
    outline: none;
}

[hidden] {
    display: none !important;
}

.app-shell {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100vh;
    height: 100dvh;
}


/* Top bar */

.topbar {
    position: relative;
    z-index: 1000;
    flex: 0 0 auto;

    color: #ffffff;
    background:
        linear-gradient(
            115deg,
            var(--bonn-blue-dark) 0%,
            var(--bonn-blue) 55%,
            var(--bonn-blue-light) 100%
        );

    box-shadow: 0 3px 14px rgba(0, 31, 58, 0.32);
}

/*
 * Layout modes of the top bar. layoutTopbar() in app.js measures how much
 * space the parts need and sets one of these classes on .topbar:
 *
 *   layout-single-row   brand | selection | view controls | status
 *   layout-two-rows     brand ............................ status
 *                       selection | view controls
 *   layout-three-rows   brand ............................ status
 *                       selection
 *                       view controls (stretched)
 *
 * In very narrow windows, layout-split-selection is added to the
 * three-row layout: the source field then gets a row of its own.
 *
 * "Selection" are the source, algorithm, k, and tau fields; "view
 * controls" are basemap, visibility, and comparison. The rules below
 * without a layout class describe the two- and three-row layouts.
 *
 * All horizontal spacing between controls uses --control-gap, so fields
 * in the comparison panel line up with the fields above them.
 */
.topbar {
    --control-gap: 9px;
    --row-gap: 11px;
}

.topbar-main {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--row-gap) 16px;

    padding:
        max(15px, env(safe-area-inset-top))
        18px
        16px;
}

.brand {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    order: 1;
    min-width: 0;
}

.brand-text {
    min-width: 0;
}

.brand-text h1 {
    overflow: hidden;
    margin: 0;

    font-size: 1.05rem;
    font-weight: 750;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand-text span {
    display: block;
    margin-top: 1px;

    color: rgba(255, 255, 255, 0.75);

    font-size: 0.72rem;
    letter-spacing: 0.025em;
}

.brand-text a {
    color: #ffffff;
    text-decoration-color: rgba(255, 255, 255, 0.55);
    text-underline-offset: 2px;
}

.brand-text a:hover,
.brand-text a:focus-visible {
    color: var(--bonn-yellow);
}


/* Primary controls */

.toolbar {
    display: flex;
    flex: 1 1 100%;
    flex-wrap: wrap;
    align-items: end;
    order: 3;
    gap: var(--row-gap) var(--control-gap);
}

.toolbar-group {
    display: flex;
    align-items: end;
    gap: var(--control-gap);
    min-width: 0;
}

/*
 * The selection takes all free space; the view controls keep their
 * natural size next to it.
 */
.toolbar-group-selection {
    flex: 1 1 0;
}

.toolbar-group-view {
    flex: 0 0 auto;
}

.toolbar-group-view .range-control {
    flex: 1 1 130px;
}

.toolbar-group-view .toolbar-button {
    flex: 1 0 auto;
}

/* Single row: brand, toolbar, and status side by side. */
.layout-single-row .toolbar {
    flex: 1 1 0;
    flex-wrap: nowrap;
    order: 2;
    min-width: 0;
}

.layout-two-rows .toolbar {
    flex-wrap: nowrap;
}

/* Three rows: the view controls fill their own row. */
.layout-three-rows .toolbar-group-selection,
.layout-three-rows .toolbar-group-view {
    flex: 1 1 100%;
}

/*
 * Split selection (very narrow windows, always with three rows): the
 * source field gets its own row, and algorithm, k, and tau move to the
 * next row together. The comparison panel switches at the same time.
 */
.layout-split-selection .toolbar-group-selection {
    flex-wrap: wrap;
    row-gap: var(--row-gap);
}

.layout-split-selection .control-source {
    flex: 1 1 100%;
}

/*
 * The algorithm field takes the remaining space in its row, so the three
 * fields only separate when even their minimum widths no longer fit.
 */
.layout-split-selection .control-algorithm {
    flex-basis: 0;
}

.layout-split-selection .toolbar-group-view {
    flex-wrap: wrap;
}

.control {
    display: flex;
    flex: 1 1 140px;
    flex-direction: column;
    gap: 3px;
    min-width: 110px;
}

.control-source {
    flex-basis: 170px;
}

.control-algorithm {
    flex-basis: 150px;
}

/* Wide enough for values such as "0.49" next to the drop-down arrow. */
.control-small {
    flex: 0 1 88px;
    min-width: 84px;
}

.control-label {
    padding-left: 2px;

    color: rgba(255, 255, 255, 0.86);

    font-size: 0.69rem;
    font-weight: 750;
    letter-spacing: 0.045em;
    line-height: 1;
    text-transform: uppercase;
}

.required-mark {
    color: var(--bonn-yellow);
}

.control select {
    width: 100%;
    height: 32px;
    padding: 0 24px 0 9px;

    color: var(--text);
    background-color: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.46);
    border-radius: 6px;

    cursor: pointer;
    box-shadow: 0 2px 7px rgba(0, 20, 38, 0.18);

    transition:
        border-color 120ms ease,
        box-shadow 120ms ease,
        opacity 120ms ease;
}

.control select:hover:not(:disabled) {
    border-color: var(--bonn-yellow);
}

.control select:focus-visible {
    border-color: var(--bonn-yellow);

    box-shadow:
        0 0 0 3px rgba(245, 197, 66, 0.28),
        0 2px 7px rgba(0, 20, 38, 0.18);
}

.control select:disabled {
    color: #87939d;
    background: #e4e8eb;
    cursor: not-allowed;
    opacity: 0.72;
}

.toolbar-button {
    height: 32px;
    min-width: 104px;
    padding: 0 11px;

    white-space: nowrap;

    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.46);
    border-radius: 6px;

    font-size: 0.80rem;
    font-weight: 750;

    cursor: pointer;

    transition:
        background-color 120ms ease,
        border-color 120ms ease,
        color 120ms ease,
        opacity 120ms ease;
}

.toolbar-button:hover:not(:disabled),
.toolbar-button:focus-visible:not(:disabled) {
    background: rgba(255, 255, 255, 0.22);
    border-color: var(--bonn-yellow);
}

.toolbar-button.active {
    color: var(--bonn-blue-dark);
    background: var(--bonn-yellow);
    border-color: var(--bonn-yellow);
}

.comparison-button.active {
    color: #ffffff;
    background: var(--comparison-purple);
    border-color: #d7c5ff;
}

.toolbar-button:disabled {
    cursor: not-allowed;
    opacity: 0.44;
}


/* Range controls */

.range-control {
    display: flex;
    flex: 0 1 130px;
    flex-direction: column;
    justify-content: end;
    gap: 3px;
    min-width: 110px;
}

/* Same text style as .control-label. */
.range-control-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-left: 2px;

    color: rgba(255, 255, 255, 0.86);

    font-size: 0.69rem;
    font-weight: 750;
    letter-spacing: 0.045em;
    line-height: 1;
    text-transform: uppercase;
    white-space: nowrap;
}

.range-control output {
    color: var(--bonn-yellow);
    font-size: 0.70rem;
    font-weight: 800;
}

input[type="range"] {
    width: 100%;
    height: 18px;
    margin: 0;

    background: transparent;
    cursor: pointer;
    accent-color: var(--bonn-yellow);
}

input[type="range"]:focus-visible {
    filter:
        drop-shadow(
            0 0 4px rgba(245, 197, 66, 0.9)
        );
}


/* Status */

/*
 * The status shows up to two lines. Its height is fixed (two lines of
 * text plus even space above and below), so the message never changes
 * the height of the top bar.
 * Longer messages can be scrolled; a scrollbar and a fading last line show
 * that more text follows. The full text is also available as a tooltip.
 */
.status {
    display: flex;
    align-items: center;
    gap: 7px;

    flex: 1 1 220px;
    order: 2;
    min-width: 150px;
    max-width: 520px;
    height: 42px;
    margin-left: auto;
    padding: 4px 6px 4px 11px;

    overflow: hidden;

    color: #ffffff;
    background: rgba(0, 20, 38, 0.24);
    border: 1px solid rgba(255, 255, 255, 0.20);
    border-radius: 12px;

    font-size: 0.75rem;
    line-height: 16px;

    /* Clicking the status copies its message. */
    cursor: copy;
}

.status:focus-visible {
    outline: 2px solid var(--bonn-yellow);
    outline-offset: 1px;
}

/*
 * After copying, the status dot briefly turns into a confirmation. The
 * extra [data-state] makes this win over the per-state dot rules below.
 */
.status.is-copied[data-state]::before {
    width: auto;
    height: auto;
    padding: 0 6px;

    color: #0b2a17;
    background: #6ee39b;
    border-radius: 4px;

    font-weight: 800;
    line-height: 16px;

    content: "Copied";
}

/* Single row: the status sits at the right end, after the toolbar. */
.layout-single-row .status {
    flex: 0 1 300px;
    order: 3;
    max-width: 360px;
    margin-left: 0;
}

.status-text {
    flex: 1 1 auto;
    min-width: 0;
    max-height: 32px;
    padding-right: 4px;

    overflow-x: hidden;
    overflow-y: auto;

    overflow-wrap: anywhere;

    scrollbar-color: rgba(255, 255, 255, 0.55) transparent;
    scrollbar-width: thin;
}

/* Set by the script while text below the visible lines remains. */
.status-text.has-more {
    -webkit-mask-image: linear-gradient(
        to bottom,
        #000000 0,
        #000000 calc(100% - 9px),
        rgba(0, 0, 0, 0.25) 100%
    );
    mask-image: linear-gradient(
        to bottom,
        #000000 0,
        #000000 calc(100% - 9px),
        rgba(0, 0, 0, 0.25) 100%
    );
}

.status[data-state="loading"]::before,
.status[data-state="ready"]::before,
.status[data-state="warning"]::before,
.status[data-state="error"]::before {
    flex: 0 0 auto;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    content: "";
}

.status[data-state="loading"]::before {
    background: var(--bonn-yellow);
}

.status[data-state="ready"]::before {
    background: #6ee39b;
}

/* Loaded, with a warning (for example several runs of a solution). */
.status[data-state="warning"] {
    color: #fff4d6;
    background: rgba(120, 78, 0, 0.55);
    border-color: rgba(255, 214, 120, 0.55);
}

.status[data-state="warning"]::before {
    background: #ffb02e;
}

.status[data-state="warning"] .status-text {
    scrollbar-color: rgba(255, 228, 170, 0.6) transparent;
}

.status[data-state="error"] {
    padding-left: 13px;

    color: #ffe7e8;
    background: rgba(125, 10, 16, 0.55);
    border-color: rgba(255, 194, 197, 0.5);
}

.status[data-state="error"]::before {
    background: #ff7479;
}

.status[data-state="error"] .status-text {
    scrollbar-color: rgba(255, 220, 222, 0.55) transparent;
}


/* Comparison panel */

/*
 * By default (very narrow windows) the panel is a simple wrapping row.
 * Otherwise the script switches it to the aligned grid below.
 */
.overlay-panel {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: var(--row-gap) var(--control-gap);

    width: 100%;
    padding: 13px 18px 14px;

    background:
        linear-gradient(
            90deg,
            rgba(35, 20, 73, 0.97),
            rgba(76, 35, 121, 0.95)
        );

    border-top: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: inset 0 5px 14px rgba(0, 0, 0, 0.12);
}

.overlay-panel-title {
    display: flex;
    align-items: center;
    align-self: center;
    flex: 1 1 100%;
    gap: 10px;
    min-width: 0;

    white-space: nowrap;
}

.overlay-panel-title strong {
    display: block;
    font-size: 0.86rem;
}

.overlay-panel-title span:not(.comparison-swatch) {
    display: block;
    margin-top: 2px;

    color: rgba(255, 255, 255, 0.68);

    font-size: 0.70rem;
    line-height: 1.25;
}

.comparison-swatch {
    flex: 0 0 auto;
    width: 14px;
    height: 34px;

    background:
        linear-gradient(
            to bottom,
            var(--comparison-blue) 0 33%,
            var(--comparison-orange) 33% 66%,
            var(--comparison-purple) 66% 100%
        );

    border: 2px solid #ffffff;
    border-radius: 999px;

    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.overlay-control {
    flex: 1 1 150px;
}

.overlay-k-control {
    flex: 1 1 84px;
}

.overlay-fade-group {
    display: flex;
    flex: 1 1 100%;
    align-items: end;
    gap: var(--control-gap);
    min-width: 0;
}

.fade-control {
    flex: 1 1 auto;
    min-width: 0;
}

/*
 * Aligned layout, set up by alignComparisonPanel() in app.js. The script
 * sets the grid columns to the measured widths of the primary fields:
 *
 *   title | algorithm | k | tau | view-control width | ...
 *
 * With the same gap as the toolbar, each comparison field sits exactly
 * below its primary field, and the fade slider sits below the view
 * controls. Where the fade slider and Close button go depends on the top
 * bar layout:
 *   two rows:    both share the view controls' width, right of tau
 *   three rows:  both fill a second row, like the view controls
 *   single row:  the slider takes the view controls' width; Close sits at
 *                the right end, below the status
 */
.overlay-panel.is-aligned {
    display: grid;
    align-items: end;
}

.overlay-panel.is-aligned .overlay-panel-title {
    width: max-content;
}

.overlay-panel.is-aligned .overlay-control {
    min-width: 0;
}

.layout-three-rows .overlay-panel.is-aligned .overlay-fade-group {
    grid-column: 1 / -1;
}

/* Split selection: the title takes its own row, like the source field. */
.layout-split-selection .overlay-panel.is-aligned .overlay-panel-title {
    grid-column: 1 / -1;
}

.layout-single-row .overlay-panel.is-aligned .overlay-fade-group {
    display: contents;
}

.layout-single-row .overlay-panel.is-aligned .overlay-close-button {
    grid-column: -2 / -1;
}

/* Same text style as .control-label. */
.fade-heading {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 3px;
    padding-left: 2px;

    color: rgba(255, 255, 255, 0.86);

    font-size: 0.69rem;
    font-weight: 750;
    letter-spacing: 0.045em;
    line-height: 1;
    text-transform: uppercase;
    white-space: nowrap;
}

/* The heading stays one line; the percentages shorten if needed. */
.fade-heading output {
    min-width: 0;
    overflow: hidden;

    color: #e5d8ff;
    font-size: 0.70rem;
    font-weight: 800;
    letter-spacing: normal;
    text-overflow: ellipsis;
    text-transform: none;
}

.fade-slider-row {
    display: grid;
    grid-template-columns:
        auto minmax(60px, 1fr) auto;
    align-items: center;
    gap: 9px;

    min-height: 32px;
    padding: 2px 10px;

    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 6px;
}

.fade-slider-row input {
    accent-color: #bf85ff;
}

.fade-side {
    font-size: 0.70rem;
    font-weight: 800;
}

.fade-side-primary {
    color: #81e3a9;
}

.fade-side-comparison {
    color: #d8b7ff;
}

.overlay-close-button {
    flex: 0 0 auto;
    height: 32px;
    padding: 0 14px;

    color: #ffffff;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.42);
    border-radius: 6px;

    font-size: 0.77rem;
    font-weight: 750;
    cursor: pointer;
}

.overlay-close-button:hover,
.overlay-close-button:focus-visible {
    background: rgba(255, 255, 255, 0.14);
    border-color: #ffffff;
}


/* Map */

.map-shell {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
}

#map {
    position: absolute;
    inset: 0;

    width: 100%;
    height: 100%;

    background: #dce5ec;
}

.loading-indicator {
    position: absolute;
    top: 16px;
    left: 50%;
    z-index: 900;

    display: flex;
    align-items: center;
    gap: 9px;

    padding: 9px 13px;

    color: var(--text);
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--border);
    border-radius: 7px;

    font-size: 0.78rem;
    font-weight: 650;

    opacity: 0;
    pointer-events: none;
    box-shadow: var(--shadow);
    transform: translate(-50%, -8px);

    transition:
        opacity 140ms ease,
        transform 140ms ease;
}

.map-shell.is-loading .loading-indicator {
    opacity: 1;
    transform: translate(-50%, 0);
}

.spinner {
    width: 17px;
    height: 17px;

    border: 2px solid #c4d2dd;
    border-top-color: var(--bonn-blue);
    border-radius: 50%;

    animation: spinner-rotation 700ms linear infinite;
}

@keyframes spinner-rotation {
    to {
        transform: rotate(360deg);
    }
}


/* Antennas */

/*
 * The shell must keep the negative margins Leaflet sets from iconAnchor;
 * otherwise every antenna is drawn half an icon right of and below its
 * position, and the offset in metres changes with the zoom level.
 */
.antenna-icon-shell {
    width: 30px !important;
    height: 30px !important;

    border: 0;
    background: transparent;
}

.antenna-marker {
    position: absolute;
    top: 50%;
    left: 50%;

    display: grid;
    place-items: center;

    width: 24px;
    height: 24px;

    border: 3px solid #ffffff;
    border-radius: 50%;

    transform: translate(-50%, -50%);

    box-shadow:
        0 0 0 2px #172b45,
        0 2px 9px rgba(0, 0, 0, 0.65),
        0 0 13px rgba(255, 255, 255, 0.9);
}

.antenna-marker-primary {
    background: #ffd33d;
}

.antenna-marker-comparison {
    background: #d946ef;

    box-shadow:
        0 0 0 2px #48105c,
        0 2px 9px rgba(0, 0, 0, 0.65),
        0 0 13px rgba(226, 130, 255, 0.95);
}

.antenna-marker-centre {
    width: 7px;
    height: 7px;

    background: #172b45;
    border: 1px solid #ffffff;
    border-radius: 50%;
}

.antenna-marker-comparison
.antenna-marker-centre {
    background: #ffffff;
    border-color: #48105c;
}

/*
 * An antenna that the primary and the comparison solution share: one
 * circle with the comparison colour on the left and the primary colour on
 * the right. The border between them follows the fade slider's thumb:
 * --antenna-split is the comparison share (the slider value), set on the
 * map by updateBlend() in app.js. Moving the slider to the right moves the
 * border to the right. At either end of the slider the circle has a single
 * colour, like a normal antenna.
 */
.antenna-marker-shared {
    background: linear-gradient(
        to right,
        #d946ef 0,
        #d946ef var(--antenna-split, 50%),
        #ffd33d var(--antenna-split, 50%),
        #ffd33d 100%
    );

    /*
     * Ring, glow, and centre dot shift from the primary to the comparison
     * style with the same split, so that at either end of the slider the
     * marker looks exactly like that solution's normal antenna.
     */
    box-shadow:
        0 0 0 2px color-mix(
            in srgb,
            #48105c var(--antenna-split, 50%),
            #172b45
        ),
        0 2px 9px rgba(0, 0, 0, 0.65),
        0 0 13px color-mix(
            in srgb,
            rgba(226, 130, 255, 0.95) var(--antenna-split, 50%),
            rgba(255, 255, 255, 0.9)
        );
}

.antenna-marker-shared
.antenna-marker-centre {
    background: color-mix(
        in srgb,
        #ffffff var(--antenna-split, 50%),
        #172b45
    );
    border-color: color-mix(
        in srgb,
        #48105c var(--antenna-split, 50%),
        #ffffff
    );
}


/* Coverage labels */

.coverage-marker-shell {
    width: 0 !important;
    height: 0 !important;

    border: 0;
    background: none;
}

.coverage-marker {
    position: absolute;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 32px;
    min-height: 24px;
    padding: 3px 7px;

    color: #ffffff;
    border: 2px solid #ffffff;
    border-radius: 999px;

    font-size: 0.72rem;
    font-weight: 850;
    line-height: 1;
    white-space: nowrap;

    box-shadow:
        0 1px 4px rgba(0, 0, 0, 0.42),
        0 0 0 1px rgba(0, 0, 0, 0.13);
}

/*
 * Labels are centred on their point. While labels of both solutions are
 * shown, primary labels move up and comparison labels move down so that
 * labels at the same point stay readable.
 */
.coverage-marker-primary,
.coverage-marker-comparison {
    transform: translate(-50%, -50%);
}

.coverage-marker-comparison {
    border-radius: 5px;
}

.labels-separated .coverage-marker-primary {
    transform:
        translate(-50%, calc(-50% - 13px));
}

.labels-separated .coverage-marker-comparison {
    transform:
        translate(-50%, calc(-50% + 13px));
}

.coverage-marker-primary-covered {
    background: var(--primary-green);
}

.coverage-marker-primary-uncovered {
    background: var(--primary-red);
}

.coverage-marker-comparison-covered {
    background: var(--comparison-blue);
}

.coverage-marker-comparison-uncovered {
    background: var(--comparison-orange);
}


/* Legend */

.map-legend {
    min-width: 160px;
    padding: 10px 12px;

    color: var(--text);
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(121, 143, 161, 0.42);
    border-radius: 7px;

    font-size: 0.73rem;
    line-height: 1.25;

    box-shadow:
        0 3px 12px rgba(22, 49, 71, 0.18);

    backdrop-filter: blur(4px);
}

.legend-title {
    margin-bottom: 7px;

    color: var(--bonn-blue-dark);

    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
}

.legend-section-title {
    margin: 9px 0 4px;
    padding-top: 6px;

    color: var(--text-muted);
    border-top: 1px solid #dce4ea;

    font-size: 0.67rem;
    font-weight: 800;
    text-transform: uppercase;
}

.legend-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 5px 0;
}

.legend-symbol {
    display: inline-block;
    flex: 0 0 auto;
    width: 20px;
    height: 10px;
}

.legend-building {
    background: rgba(125, 168, 206, 0.25);
    border: 2px solid #173f68;
}

.legend-primary-antenna,
.legend-comparison-antenna,
.legend-shared-antenna {
    width: 13px;
    height: 13px;
    margin: 0 3px;

    border: 2px solid #ffffff;
    border-radius: 50%;

    box-shadow: 0 0 0 1px #172b45;
}

.legend-primary-antenna {
    background: #ffd33d;
}

.legend-comparison-antenna {
    background: #d946ef;
}

.legend-shared-antenna {
    background: linear-gradient(
        to right,
        #d946ef 0 50%,
        #ffd33d 50% 100%
    );
}

.legend-primary-covered {
    background: #d9f2e3;
    border: 2px solid var(--primary-green);
}

.legend-primary-uncovered {
    background: #f8dfe0;
    border: 2px solid var(--primary-red);
}

.legend-comparison-covered {
    background: #d8effa;
    border: 2px solid var(--comparison-blue);
}

.legend-comparison-uncovered {
    background: #fce8d2;
    border: 2px solid var(--comparison-orange);
}

.legend-primary-edge,
.legend-comparison-edge {
    height: 0;
}

.legend-primary-edge {
    border-top: 3px solid var(--primary-green);
}

.legend-comparison-edge {
    border-top: 3px solid var(--comparison-purple);
}

.comparison-legend-section {
    display: none;
}

.comparison-legend-section.is-visible {
    display: block;
}


/* Leaflet overrides */

.leaflet-control-zoom a {
    color: var(--bonn-blue-dark);
}

.leaflet-tooltip {
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 5px;

    box-shadow:
        0 2px 8px rgba(20, 48, 70, 0.18);
}


/* Instance statistics */

.instance-information {
    position: absolute;
    bottom: 38px;
    left: 12px;
    z-index: 850;

    width: min(540px, calc(100vw - 24px));
    max-height: min(46vh, 410px);

    color: var(--text);
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(121, 143, 161, 0.55);
    border-radius: 8px;

    overflow: hidden;

    box-shadow: var(--shadow);
    backdrop-filter: blur(5px);
}

.instance-information-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;

    width: 100%;
    min-height: 46px;
    padding: 7px 11px;

    color: #ffffff;
    background: var(--bonn-blue);
    border: 0;

    text-align: left;
    cursor: pointer;
}

.instance-information-header:hover,
.instance-information-header:focus-visible {
    background: var(--bonn-blue-light);
}

.instance-information-header strong,
.instance-information-header small {
    display: block;
}

.instance-information-header strong {
    max-width: 475px;
    overflow: hidden;

    font-size: 0.81rem;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.instance-information-header small {
    margin-top: 2px;

    color: rgba(255, 255, 255, 0.76);

    font-size: 0.67rem;
}

.instance-information:not(.is-collapsed)
.instance-information-summary {
    display: none;
}

.instance-information-chevron {
    flex: 0 0 auto;

    transition: transform 150ms ease;
}

.instance-information.is-collapsed
.instance-information-chevron {
    transform: rotate(-90deg);
}

.instance-information-content {
    max-height: calc(min(46vh, 410px) - 46px);
    padding: 9px;
    overflow: auto;
}

.instance-information.is-collapsed {
    width: min(360px, calc(100vw - 24px));
}

.instance-information.is-collapsed
.instance-information-content {
    display: none;
}

.instance-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;

    margin-bottom: 8px;
    padding: 6px 8px;

    background: #eef4f8;
    border: 1px solid #d5e0e8;
    border-radius: 5px;

    font-size: 0.74rem;
}

.instance-total strong {
    color: var(--bonn-blue);
    font-size: 0.91rem;
}

.statistics-table-heading {
    margin: 4px 0 6px;

    color: var(--text-muted);

    font-size: 0.67rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.statistics-table-wrapper {
    max-width: 100%;
    overflow: auto;

    border: 1px solid #d5dee6;
    border-radius: 5px;
}

.solution-statistics-table {
    width: max-content;
    min-width: 0;

    border-spacing: 0;
    border-collapse: separate;

    font-size: 0.69rem;
    white-space: nowrap;
}

.solution-statistics-table th,
.solution-statistics-table td {
    height: 29px;
    padding: 4px 6px;

    border-right: 1px solid #dce4ea;
    border-bottom: 1px solid #dce4ea;

    text-align: right;
}

.solution-statistics-table th {
    position: sticky;
    top: 0;
    z-index: 2;

    color: #ffffff;
    background: var(--bonn-blue);

    font-weight: 750;
}

.solution-statistics-table
.statistics-parameter-heading {
    min-width: 45px;
    max-width: 58px;
}

.solution-statistics-table
.statistics-algorithm-heading {
    min-width: 68px;
    max-width: 125px;

    overflow: hidden;
    text-overflow: ellipsis;
}

.solution-statistics-table th:first-child,
.solution-statistics-table th:nth-child(2),
.solution-statistics-table td:first-child,
.solution-statistics-table td:nth-child(2) {
    text-align: left;
}

.solution-statistics-table
.statistics-parameter-cell {
    min-width: 45px;
}

.solution-statistics-table
tbody tr:nth-child(even) td {
    background: #f3f6f8;
}

.solution-statistics-table
tbody tr:hover td {
    background: #e7f0f7;
}

.solution-statistics-table tr:last-child td {
    border-bottom: 0;
}

.solution-statistics-table th:last-child,
.solution-statistics-table td:last-child {
    border-right: 0;
}

.statistics-empty-cell {
    color: #8b969f;
    text-align: center !important;
}

.statistics-incomplete-cell {
    color: var(--primary-red);
    font-weight: 750;
}

.statistics-solution-cell {
    min-width: 68px;
    padding: 0 !important;

    transition:
        background-color 120ms ease,
        box-shadow 120ms ease;
}

.statistics-solution-button {
    display: block;
    width: 100%;
    min-width: 68px;
    height: 28px;
    padding: 3px 7px;

    color: var(--text);
    background: transparent;
    border: 0;

    font-size: 0.69rem;
    text-align: right;

    cursor: pointer;

    transition:
        color 120ms ease,
        background-color 120ms ease,
        box-shadow 120ms ease;
}

.statistics-solution-button:hover,
.statistics-solution-button:focus-visible {
    color: var(--bonn-blue-dark);
    background: rgba(12, 101, 159, 0.15);

    box-shadow:
        inset 0 0 0 2px rgba(12, 101, 159, 0.48);
}

.statistics-solution-cell.is-primary-solution
.statistics-solution-button {
    color: #ffffff;
    background: var(--bonn-blue-light);

    font-weight: 800;

    box-shadow:
        inset 4px 0 0 var(--bonn-yellow);
}

.statistics-solution-cell.is-comparison-solution
.statistics-solution-button {
    color: #ffffff;
    background: var(--comparison-purple);

    font-weight: 800;

    box-shadow:
        inset -4px 0 0 #d8b7ff;
}

.statistics-solution-cell.is-primary-solution
.statistics-solution-button[data-display-state*="comparison"] {
    background:
        linear-gradient(
            110deg,
            var(--bonn-blue-light) 0 50%,
            var(--comparison-purple) 50% 100%
        );

    box-shadow:
        inset 4px 0 0 var(--bonn-yellow),
        inset -4px 0 0 #d8b7ff;
}

.statistics-footnote {
    margin: 6px 1px 0;

    color: var(--text-muted);

    font-size: 0.65rem;
}


/* No JavaScript */

.noscript-message {
    position: fixed;
    inset: 0;
    z-index: 10000;

    display: grid;
    place-items: center;
    padding: 30px;

    color: #ffffff;
    background: var(--bonn-blue-dark);

    font-size: 1.1rem;
    text-align: center;
}


/* Responsive layout */

@media (max-width: 820px) {
    /*
     * The space for the scrollbar is always reserved, so the widths (and
     * the alignment of the comparison fields) do not change when the
     * scrollbar appears.
     */
    .topbar {
        max-height: 55vh;
        overflow-y: auto;
        scrollbar-gutter: stable;
    }

    .topbar-main {
        column-gap: 12px;
        padding-right: 12px;
        padding-left: 12px;
    }

    .brand-text h1 {
        font-size: 1rem;
    }

    .brand-text span {
        display: none;
    }

    .status {
        min-width: 0;
    }

    .overlay-panel {
        padding-right: 12px;
        padding-left: 12px;
    }

    .map-legend {
        min-width: 140px;
        padding: 8px 9px;
    }

    .instance-information {
        width: min(500px, calc(100vw - 24px));
    }
}

@media (max-width: 600px) {
    .instance-information {
        bottom: 28px;
        left: 7px;

        width: calc(100vw - 14px);
        max-height: 38vh;
    }

    .instance-information-content {
        max-height: calc(38vh - 46px);
    }

    .instance-information.is-collapsed {
        width: min(360px, calc(100vw - 14px));
    }
}

@media (max-width: 470px) {
    .fade-slider-row {
        grid-template-columns: 1fr;
        gap: 3px;
    }

    .fade-side {
        display: none;
    }

    .fade-heading {
        flex-direction: column;
        gap: 3px;
    }

    .instance-information-header strong {
        max-width: calc(100vw - 80px);
    }
}

/*
 * Compact, content-sized statistics panel.
 *
 * The panel itself never scrolls. Its dimensions are determined by
 * the heading and table instead of using the previous fixed width and
 * viewport-relative height.
 */

.instance-information {
    width: fit-content;
    min-width: 0;
    max-width: calc(100vw - 24px);
    max-height: none;

    overflow: hidden;
}

.instance-information-header {
    width: 100%;
    min-width: 0;
    min-height: 42px;
    padding: 6px 9px;
}

.instance-information-header > span:first-child {
    min-width: 0;
}

.instance-information-header strong {
    max-width: 360px;

    overflow: visible;

    font-size: 0.78rem;
    line-height: 1.2;
    overflow-wrap: anywhere;
    text-overflow: clip;
    white-space: normal;
}

.instance-information-header small {
    font-size: 0.64rem;
}

.instance-information-content {
    width: fit-content;
    max-width: 100%;
    max-height: none;
    padding: 7px;

    overflow: visible;
}

.instance-information.is-collapsed {
    width: fit-content;
    min-width: 0;
    max-width: calc(100vw - 24px);
}

.instance-total {
    min-width: 0;
    margin-bottom: 6px;
    padding: 5px 7px;

    font-size: 0.70rem;
}

.instance-total strong {
    font-size: 0.84rem;
}

.statistics-table-heading {
    margin: 3px 0 5px;

    font-size: 0.64rem;
}

.statistics-table-wrapper {
    width: fit-content;
    max-width: 100%;

    overflow: visible;
}

.solution-statistics-table {
    width: auto;
    min-width: 0;

    table-layout: auto;

    font-size: 0.66rem;
}

.solution-statistics-table th,
.solution-statistics-table td {
    height: 26px;
    padding: 3px 5px;
}

.solution-statistics-table
.statistics-parameter-heading,
.solution-statistics-table
.statistics-parameter-cell {
    width: 1%;
    min-width: 38px;
    max-width: 48px;
}

.solution-statistics-table
.statistics-algorithm-heading {
    width: 1%;
    min-width: 58px;
    max-width: 105px;

    overflow: hidden;
    text-overflow: ellipsis;
}

.statistics-solution-cell {
    width: 1%;
    min-width: 58px;
}

.statistics-solution-button {
    width: 100%;
    min-width: 58px;
    height: 25px;
    padding: 2px 5px;

    font-size: 0.66rem;
}

.statistics-footnote {
    margin-top: 5px;
    font-size: 0.62rem;
}

@media (max-width: 600px) {
    .instance-information {
        left: 7px;

        width: fit-content;
        max-width: calc(100vw - 14px);
        max-height: none;
    }

    .instance-information-content {
        max-height: none;
    }

    .instance-information.is-collapsed {
        width: fit-content;
        max-width: calc(100vw - 14px);
    }

    .instance-information-header strong {
        max-width: calc(100vw - 72px);
    }
}

.instance-source-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;

    margin-bottom: 5px;
    padding: 5px 7px;

    background: #f7f3ff;
    border: 1px solid #ded4f2;
    border-radius: 5px;

    font-size: 0.70rem;
}

.instance-source-row strong {
    max-width: 260px;
    overflow: hidden;

    color: var(--comparison-purple);

    font-size: 0.72rem;
    font-weight: 750;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.instance-source-row strong:hover {
    overflow: visible;
    white-space: normal;
}

/* Slightly wider statistics-table columns */

.solution-statistics-table
.statistics-parameter-heading,
.solution-statistics-table
.statistics-parameter-cell {
    min-width: 56px;
    max-width: 66px;
}

.solution-statistics-table
.statistics-algorithm-heading {
    min-width: 97px;
    max-width: 120px;
}

.statistics-solution-cell,
.statistics-solution-button {
    min-width: 97px;
}

.antenna-marker {
    transform:
        translate(-50%, -50%)
        scale(var(--antenna-scale, 1));

    transform-origin: center;
}
