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

body {
    background: #f4f6f8;
    color: #20252b;
    font-family: Arial, Helvetica, sans-serif;
}

.bus-page {
    box-sizing: border-box;
    margin: 0 auto;
    max-width: 1400px;
    padding: 24px;
}

.bus-header {
    align-items: flex-end;
    display: flex;
    gap: 24px;
    justify-content: space-between;
    margin-bottom: 18px;
}

.bus-header h1 {
    font-size: clamp(1.8rem, 4vw, 2.7rem);
    line-height: 1.1;
    margin: 0 0 8px;
}

.bus-header p {
    line-height: 1.5;
    margin: 0;
}

.bus-status {
    font-size: 0.9rem;
    line-height: 1.5;
    text-align: right;
}

.bus-status span {
    display: block;
}

#lastRefresh {
    color: #59636e;
}

.bus-controls {
    align-items: center;
    background: #ffffff;
    border: 1px solid #d7dce1;
    border-radius: 8px 8px 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 14px;
}

.bus-controls label {
    font-weight: 600;
}

.bus-controls select,
.bus-controls button {
    border: 1px solid #aeb7c0;
    border-radius: 5px;
    box-sizing: border-box;
    font: inherit;
    min-height: 38px;
    padding: 7px 10px;
}

.bus-controls select {
    background: #ffffff;
    min-width: 130px;
}

.bus-controls button {
    background: #ffffff;
    cursor: pointer;
    margin-left: auto;
}

.bus-controls button:hover {
    background: #eef2f5;
}

.bus-controls button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.checkbox-label {
    align-items: center;
    display: inline-flex;
    gap: 7px;
}

.checkbox-label input {
    height: 18px;
    margin: 0;
    width: 18px;
}

.bus-map {
    background: #dce6eb;
    border: 1px solid #bfc7ce;
    border-top: 0;
    box-sizing: border-box;
    height: min(72vh, 760px);
    min-height: 480px;
    width: 100%;
}

.bus-marker-wrapper {
    background: transparent;
    border: 0;
}

.bus-marker {
    align-items: center;
    background: #ffffff;
    border: 3px solid #1f6f8b;
    border-radius: 50%;
    box-shadow: 0 2px 7px rgba(0, 0, 0, 0.32);
    box-sizing: border-box;
    display: flex;
    height: 40px;
    justify-content: center;
    position: relative;
    width: 40px;
}

.bus-marker--outbound {
    border-color: #a94f2c;
}

.bus-marker--school {
    border-style: dashed;
}

.bus-marker__route {
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1;
}

.bus-marker__arrow {
    color: #20252b;
    font-size: 0.7rem;
    left: 50%;
    line-height: 1;
    position: absolute;
    top: -12px;
    transform: translateX(-50%) rotate(var(--bus-bearing));
    transform-origin: center 18px;
}

.bus-popup {
    min-width: 210px;
}

.bus-popup__heading {
    display: block;
    font-size: 1.05rem;
    margin-bottom: 8px;
}

.bus-popup__row {
    display: grid;
    gap: 8px;
    grid-template-columns: 102px 1fr;
    line-height: 1.45;
}

.bus-popup__label {
    font-weight: 600;
}

.bus-footer {
    color: #59636e;
    font-size: 0.82rem;
    line-height: 1.5;
    padding-top: 10px;
}

.bus-footer p {
    margin: 0;
}

.bus-message {
    background: #ffffff;
    border: 1px solid #d7dce1;
    padding: 16px;
}

@media (max-width: 700px) {
    .bus-page {
        padding: 12px;
    }

    .bus-header {
        align-items: flex-start;
        display: block;
    }

    .bus-status {
        margin-top: 12px;
        text-align: left;
    }

    .bus-controls {
        align-items: stretch;
    }

    .bus-controls select {
        flex: 1;
    }

    .bus-controls button {
        margin-left: 0;
        width: 100%;
    }

    .bus-map {
        height: 68vh;
        min-height: 420px;
    }
}


.bus-stop-message {
    background: #fff8dd;
    border: 1px solid #d9c979;
    border-top: 0;
    margin: 0;
    padding: 10px 14px;
}

.bus-stop-marker-wrapper {
    background: transparent;
    border: 0;
}

.bus-stop-marker {
    background: #ffffff;
    border: 3px solid #343a40;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
    box-sizing: border-box;
    height: 14px;
    width: 14px;
}

.bus-stop-marker--shelter {
    background: #343a40;
    border-color: #ffffff;
    outline: 2px solid #343a40;
}

.bus-stop-popup {
    min-width: 270px;
}

.bus-stop-popup__message {
    margin: 10px 0 0;
}

.bus-departures {
    border-collapse: collapse;
    margin-top: 10px;
    width: 100%;
}

.bus-departures th,
.bus-departures td {
    border-bottom: 1px solid #d7dce1;
    padding: 6px 5px;
    text-align: left;
    vertical-align: top;
}

.bus-departures th {
    font-size: 0.78rem;
    text-transform: uppercase;
}

.bus-departures__service {
    font-weight: 700;
    white-space: nowrap;
}

.bus-departures__time {
    text-align: right;
    white-space: nowrap;
}
