:root {
    --color-othd: #2d6a7d;
    --color-othd-secondary: #6e8a92;
    --color-othd-tertiary: #dec092;
    --color-othd-dark: #1f4753;
    --color-othd-light: #f3f8f9;
    --color-othd-accent: #dec092;
    --color-othd-success: #2d6a7d;
    --color-othd-warning: #dec092;
    --color-othd-muted: #6e8a92;
    --color-othd-border: #d8e3e6;
    --color-othd-surface: #ffffff;
}

* {
    box-sizing: border-box;
}

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

body {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--color-othd-light);
    color: var(--color-othd-dark);
}

.othd-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    padding: 0;
    margin: -1px;
}

.othd-skip-link {
    position: fixed;
    z-index: 2000;
    top: 10px;
    left: 10px;
    min-height: 44px;
    border-radius: 10px;
    background: var(--color-othd);
    color: white;
    padding: 12px 16px;
    font-weight: 900;
    text-decoration: none;
    transform: translateY(-140%);
}

.othd-skip-link:focus {
    transform: translateY(0);
}

button:focus-visible,
input:focus-visible,
a:focus-visible,
.leaflet-container:focus-visible {
    outline: 3px solid var(--color-othd-tertiary);
    outline-offset: 3px;
}

.othd-map-page {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background: var(--color-othd-light);
}

.othd-map-stage,
#othd-map-app,
.othd-map-app-shell,
.othd-map-canvas {
    width: 100%;
    height: 100%;
}

.othd-map-stage {
    position: absolute;
    inset: 0;
    background: var(--color-othd-surface);
}

.othd-map-canvas {
    min-height: 100%;
    z-index: 1;
}

.leaflet-container {
    width: 100%;
    height: 100%;
    background: #eef5f6;
    font: inherit;
}

.leaflet-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container,
.leaflet-pane > svg,
.leaflet-pane > canvas,
.leaflet-zoom-box,
.leaflet-image-layer,
.leaflet-layer {
    position: absolute;
    left: 0;
    top: 0;
}

.leaflet-container {
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow {
    user-select: none;
    -webkit-user-drag: none;
}

.leaflet-tile {
    width: 256px;
    height: 256px;
    max-width: none !important;
    max-height: none !important;
    border: 0;
    visibility: hidden;
}

.leaflet-tile-loaded {
    visibility: inherit;
}

.leaflet-tile-container {
    pointer-events: none;
}

.leaflet-pane {
    z-index: 400;
}

.leaflet-tile-pane {
    z-index: 200;
}

.leaflet-overlay-pane {
    z-index: 400;
}

.leaflet-shadow-pane {
    z-index: 500;
}

.leaflet-marker-pane {
    z-index: 600;
}

.leaflet-tooltip-pane {
    z-index: 650;
}

.leaflet-popup-pane {
    z-index: 700;
}

.leaflet-control {
    position: relative;
    z-index: 800;
    pointer-events: visiblePainted;
    pointer-events: auto;
}

.leaflet-top,
.leaflet-bottom {
    position: absolute;
    z-index: 1000;
    pointer-events: none;
}

.leaflet-top {
    top: 0;
}

.leaflet-right {
    right: 0;
}

.leaflet-bottom {
    bottom: 0;
}

.leaflet-left {
    left: 0;
}

.leaflet-control-container .leaflet-top,
.leaflet-control-container .leaflet-bottom {
    transform: translate3d(0, 0, 0);
}

.leaflet-control-zoom {
    border: 1px solid var(--color-othd-border);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 12px 34px rgb(18 49 47 / 12%);
}

.leaflet-control-zoom a {
    display: block;
    width: 34px;
    height: 34px;
    background: white;
    color: var(--color-othd-dark);
    line-height: 34px;
    text-align: center;
    text-decoration: none;
    font-weight: 800;
}

.leaflet-control-attribution {
    padding: 3px 6px;
    background: rgb(255 255 255 / 84%);
    font-size: 0.72rem;
}

.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-image-layer,
.leaflet-pane > svg path {
    pointer-events: none;
}

.leaflet-marker-icon.leaflet-interactive,
.leaflet-image-layer.leaflet-interactive,
.leaflet-pane > svg path.leaflet-interactive {
    pointer-events: auto;
}

.leaflet-interactive {
    cursor: pointer;
}

.leaflet-tooltip {
    position: absolute;
    padding: 6px 8px;
    border: 1px solid var(--color-othd-border);
    border-radius: 8px;
    background: white;
    box-shadow: 0 10px 26px rgb(18 49 47 / 14%);
    color: var(--color-othd-dark);
    white-space: nowrap;
}

.othd-city-polygon {
    cursor: pointer;
}

.othd-topleft {
    position: absolute;
    z-index: 520;
    top: 16px;
    left: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: min(360px, calc(100% - 32px));
    max-height: calc(100% - 32px);
    pointer-events: none;
}

.othd-hero-card,
.othd-side-panel,
.othd-legend-card {
    pointer-events: auto;
}

.othd-hero-card {
    flex: 0 0 auto;
    border: 1px solid var(--color-othd-border);
    border-top: 3px solid var(--color-othd);
    border-radius: 10px;
    padding: 14px 16px;
    background: rgb(255 255 255 / 96%);
    box-shadow: 0 12px 34px rgb(18 49 47 / 14%);
}

.othd-kicker {
    margin: 0 0 6px;
    color: var(--color-othd);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.othd-hero-card h1 {
    margin: 0;
    font-size: clamp(1.2rem, 2vw, 1.7rem);
    line-height: 1.05;
    letter-spacing: 0;
}

.othd-title-lockup {
    display: flex;
    align-items: center;
    gap: 10px;
}

.othd-title-lockup img {
    width: 82px;
    max-height: 34px;
    object-fit: contain;
}

.othd-title-lockup span {
    min-width: 0;
}

.othd-help {
    margin: 10px 0 0;
    color: var(--color-othd-dark);
    font-size: 0.88rem;
    line-height: 1.45;
}

.othd-accessibility-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.othd-action-button,
.othd-action-link,
.othd-search-input-row button,
.othd-modal-actions button,
.othd-modal-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border: 0;
    border-radius: 10px;
    background: var(--color-othd);
    color: white;
    cursor: pointer;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 900;
    text-align: center;
    text-decoration: none;
}

.othd-action-button,
.othd-action-link {
    padding: 8px 12px;
}

.othd-contrast-toggle[aria-pressed="true"] {
    background: var(--color-othd-dark);
    box-shadow: inset 0 0 0 2px var(--color-othd-tertiary);
}

.othd-search-toggle[aria-expanded="true"] {
    background: var(--color-othd-dark);
    box-shadow: inset 0 0 0 2px var(--color-othd-tertiary);
}

.othd-info-toggle {
    background: var(--color-othd-secondary);
}

.othd-main-site-link {
    border: 1px solid var(--color-othd-border);
    background: white;
    color: var(--color-othd);
}

.othd-search-card {
    position: relative;
    flex: 0 0 auto;
    border: 1px solid var(--color-othd-border);
    border-top: 3px solid var(--color-othd-tertiary);
    border-radius: 10px;
    padding: 14px;
    background: rgb(255 255 255 / 97%);
    box-shadow: 0 12px 34px rgb(18 49 47 / 14%);
    pointer-events: auto;
}

.othd-search-card-header,
.othd-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.othd-search-card-header h2,
.othd-modal-header h2 {
    margin: 0;
    color: var(--color-othd-dark);
    font-size: 1rem;
    line-height: 1.2;
    letter-spacing: 0;
}

.othd-card-close {
    flex: 0 0 auto;
    min-height: 34px;
    border: 1px solid var(--color-othd-border);
    border-radius: 8px;
    background: var(--color-othd-light);
    color: var(--color-othd-dark);
    cursor: pointer;
    padding: 7px 10px;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 900;
}

.othd-search-card form {
    display: grid;
    gap: 8px;
}

.othd-search-card label {
    color: var(--color-othd-dark);
    font-size: 0.82rem;
    font-weight: 900;
}

.othd-search-input-row {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.othd-search-input-row input {
    min-width: 0;
    min-height: 44px;
    width: 100%;
    border: 1px solid var(--color-othd-border);
    border-radius: 10px;
    background: white;
    color: var(--color-othd-dark);
    font: inherit;
    padding: 10px 42px 10px 12px;
}

.othd-search-input-row input::placeholder {
    color: var(--color-othd-muted);
}

.othd-search-input-row button {
    padding: 9px 12px;
}

.othd-search-input-row button:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

.othd-search-clear {
    position: absolute;
    right: 104px;
    top: 50%;
    display: grid;
    width: 28px;
    min-height: 28px !important;
    height: 28px;
    place-items: center;
    border-radius: 999px !important;
    padding: 0 !important;
    background: var(--color-othd-light) !important;
    color: var(--color-othd-dark) !important;
    transform: translateY(-50%);
}

.othd-search-help,
.othd-search-status {
    margin: 0;
    color: var(--color-othd-muted);
    font-size: 0.78rem;
    line-height: 1.35;
}

.othd-search-status {
    min-height: 1.1rem;
    font-weight: 800;
}

.othd-address-results {
    position: absolute;
    z-index: 4;
    top: calc(100% - 6px);
    right: 14px;
    left: 14px;
    display: grid;
    gap: 4px;
    max-height: min(42vh, 280px);
    overflow: auto;
    margin: 0;
    padding: 6px;
    border: 1px solid var(--color-othd-border);
    border-radius: 10px;
    background: white;
    box-shadow: 0 18px 44px rgb(18 49 47 / 18%);
    list-style: none;
}

.othd-address-results button {
    display: grid;
    gap: 3px;
    width: 100%;
    min-height: 48px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--color-othd-dark);
    cursor: pointer;
    padding: 8px 10px;
    text-align: left;
    font: inherit;
}

.othd-address-results button:hover,
.othd-address-results button.is-active,
.othd-address-results button[aria-selected="true"] {
    background: var(--color-othd);
    color: white;
}

.othd-address-results span {
    font-size: 0.78rem;
    font-weight: 700;
    opacity: 0.88;
}

.othd-legend-card {
    position: absolute;
    z-index: 520;
    right: 16px;
    bottom: 28px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 190px;
    max-width: min(260px, calc(100% - 32px));
    padding: 12px 14px;
    border: 1px solid var(--color-othd-border);
    border-radius: 10px;
    background: rgb(255 255 255 / 96%);
    box-shadow: 0 12px 34px rgb(18 49 47 / 14%);
}

.othd-legend-card-title {
    color: var(--color-othd-muted);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.othd-legend-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.othd-legend-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.88rem;
    font-weight: 700;
}

.othd-legend-dot {
    width: 0.85rem;
    height: 0.85rem;
    flex: 0 0 auto;
    border: 1.5px solid white;
    border-radius: 999px;
    box-shadow: 0 0 0 1px rgb(18 49 47 / 14%);
    background: var(--color-othd-muted);
}

.othd-side-panel {
    flex: 0 1 auto;
    min-height: 0;
    overflow: auto;
    border: 1px solid var(--color-othd-border);
    border-radius: 10px;
    background: rgb(255 255 255 / 97%);
    box-shadow: 0 18px 50px rgb(18 49 47 / 18%);
}

.othd-panel-toolbar {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--color-othd-border);
    background: var(--color-othd-surface);
    font-weight: 800;
}

.othd-panel-toolbar button,
.othd-panel-actions button {
    min-height: 36px;
    border: 0;
    border-radius: 8px;
    padding: 8px 12px;
    background: var(--color-othd);
    color: white;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.othd-panel-actions {
    display: flex;
    gap: 8px;
    padding: 16px;
    border-top: 1px solid var(--color-othd-border);
}

.othd-panel-actions button {
    width: 100%;
}

.othd-housing-detail,
.othd-city-detail,
.othd-panel-empty,
.othd-map-error,
.othd-operator-list {
    padding: 16px;
}

.othd-map-error {
    margin: 16px;
    border-radius: 8px;
    background: #fee2e2;
    color: #991b1b;
    font-weight: 700;
}

.othd-housing-detail h2,
.othd-city-detail h2 {
    margin: 0 0 14px;
    font-size: 1.25rem;
    line-height: 1.25;
    letter-spacing: 0;
}

.othd-housing-detail dl,
.othd-city-detail dl {
    display: grid;
    gap: 10px;
    margin: 0;
}

.othd-housing-detail dl div,
.othd-city-detail dl div {
    display: grid;
    gap: 4px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--color-othd-border);
}

.othd-housing-detail dt,
.othd-city-detail dt {
    color: var(--color-othd-muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.othd-housing-detail dd,
.othd-city-detail dd {
    margin: 0;
    overflow-wrap: anywhere;
    font-weight: 700;
}

.othd-operator-list {
    border-top: 1px solid var(--color-othd-border);
}

.othd-operator-list h3 {
    margin: 0 0 10px;
    font-size: 1rem;
}

.othd-operator-list ul {
    display: grid;
    gap: 10px;
    padding: 0;
    margin: 0;
    list-style: none;
}

.othd-operator-list li {
    min-width: 0;
}

.othd-operator-card {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    width: 100%;
    min-height: 64px;
    border: 1px solid var(--color-othd-border);
    border-radius: 8px;
    background: var(--color-othd-surface);
    padding: 10px;
    color: var(--color-othd-dark);
    text-decoration: none;
}

.othd-operator-card:hover {
    border-color: var(--color-othd);
}

.othd-operator-logo {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    overflow: hidden;
    border: 1px solid var(--color-othd-border);
    border-radius: 8px;
    background: var(--color-othd-light);
    color: var(--color-othd);
    font-size: 0.82rem;
    font-weight: 900;
}

.othd-operator-logo img {
    max-width: 40px;
    max-height: 34px;
    object-fit: contain;
}

.othd-operator-body {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.othd-operator-body strong {
    overflow-wrap: anywhere;
    font-size: 0.95rem;
}

.othd-operator-speeds {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    color: var(--color-othd-muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.othd-operator-speeds span,
.othd-operator-muted {
    border-radius: 999px;
    background: var(--color-othd-light);
    padding: 3px 7px;
}

.othd-operator-muted {
    width: fit-content;
    color: var(--color-othd-muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.othd-operator-list a {
    text-decoration: none;
}


.leaflet-tile {
    filter: grayscale(100%);
    -webkit-filter: grayscale(100%);
}

.leaflet-popup {
    max-width: 50vh;
}

.leaflet-popup-content-wrapper {
    max-height: 50vh;
    overflow-y: auto;
}


.othd-map-loading {
    position: absolute;
    z-index: 530;
    top: 16px;
    left: 50%;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border: 1px solid var(--color-othd-border);
    border-radius: 999px;
    background: rgb(255 255 255 / 96%);
    box-shadow: 0 12px 34px rgb(18 49 47 / 16%);
    color: var(--color-othd-dark);
    font-size: 0.85rem;
    font-weight: 700;
    transform: translateX(-50%);
    pointer-events: none;
}

.othd-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--color-othd-border);
    border-top-color: var(--color-othd);
    border-radius: 999px;
    animation: othd-spin 0.7s linear infinite;
}

@keyframes othd-spin {
    to {
        transform: rotate(360deg);
    }
}

.othd-map-hint {
    position: absolute;
    z-index: 520;
    bottom: 24px;
    left: 50%;
    padding: 8px 14px;
    border: 1px solid var(--color-othd-border);
    border-radius: 999px;
    background: rgb(18 49 47 / 92%);
    box-shadow: 0 12px 34px rgb(18 49 47 / 20%);
    color: white;
    font-size: 0.85rem;
    font-weight: 700;
    transform: translateX(-50%);
    pointer-events: none;
}

.othd-modal-backdrop {
    position: absolute;
    z-index: 900;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgb(15 23 42 / 58%);
    pointer-events: auto;
}

.othd-info-modal {
    width: min(520px, 100%);
    max-height: min(80vh, 620px);
    overflow: auto;
    border: 1px solid var(--color-othd-border);
    border-top: 4px solid var(--color-othd);
    border-radius: 12px;
    background: white;
    box-shadow: 0 28px 80px rgb(0 0 0 / 34%);
    color: var(--color-othd-dark);
    padding: 18px;
}

.othd-modal-body {
    display: grid;
    gap: 10px;
    color: var(--color-othd-dark);
    line-height: 1.5;
}

.othd-modal-body p {
    margin: 0;
}

.othd-modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.othd-modal-actions a {
    background: var(--color-othd);
}

.othd-modal-actions button {
    background: var(--color-othd-dark);
}

.othd-map-app-shell.is-high-contrast {
    --color-othd: #004f63;
    --color-othd-dark: #000000;
    --color-othd-light: #ffffff;
    --color-othd-accent: #f5b400;
    --color-othd-success: #005f78;
    --color-othd-warning: #8a5c00;
    --color-othd-muted: #1f2933;
    --color-othd-border: #111827;
}

.othd-map-app-shell.is-high-contrast .leaflet-tile {
    filter: grayscale(100%) contrast(145%) brightness(92%);
    -webkit-filter: grayscale(100%) contrast(145%) brightness(92%);
}

.othd-map-app-shell.is-high-contrast .othd-hero-card,
.othd-map-app-shell.is-high-contrast .othd-search-card,
.othd-map-app-shell.is-high-contrast .othd-info-modal,
.othd-map-app-shell.is-high-contrast .othd-side-panel,
.othd-map-app-shell.is-high-contrast .othd-legend-card,
.othd-map-app-shell.is-high-contrast .othd-map-loading {
    border-color: #111827;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgb(0 0 0 / 12%), 0 18px 50px rgb(0 0 0 / 24%);
    color: #000000;
}

.othd-map-app-shell.is-high-contrast .othd-help,
.othd-map-app-shell.is-high-contrast .othd-search-help,
.othd-map-app-shell.is-high-contrast .othd-search-status,
.othd-map-app-shell.is-high-contrast .othd-modal-body,
.othd-map-app-shell.is-high-contrast .othd-legend-card-title,
.othd-map-app-shell.is-high-contrast .othd-housing-detail dt,
.othd-map-app-shell.is-high-contrast .othd-city-detail dt {
    color: #000000;
}

.othd-map-app-shell.is-high-contrast .othd-card-close,
.othd-map-app-shell.is-high-contrast .othd-main-site-link {
    border-color: #000000;
    background: #ffffff;
    color: #000000;
}

.othd-map-app-shell.is-high-contrast .othd-legend-dot {
    border-color: #000000;
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #000000;
}

.othd-map-app-shell.is-high-contrast .othd-address-results {
    border-color: #000000;
    background: #ffffff;
}

.othd-map-app-shell.is-high-contrast .othd-address-results button:hover,
.othd-map-app-shell.is-high-contrast .othd-address-results button.is-active,
.othd-map-app-shell.is-high-contrast .othd-address-results button[aria-selected="true"] {
    background: #000000;
    color: #ffffff;
}

.othd-map-app-shell.is-high-contrast .leaflet-control-zoom,
.othd-map-app-shell.is-high-contrast .leaflet-tooltip {
    border-color: #000000;
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #000000;
}

@media (prefers-reduced-motion: reduce) {
    .othd-spinner {
        animation: none;
    }
}


@media (max-width: 820px) {
    .othd-topleft {
        top: 10px;
        left: 10px;
        right: 10px;
        width: auto;
        max-height: calc(100% - 20px);
    }

    .othd-help {
        display: none;
    }

    .othd-search-card {
        padding: 12px;
    }

    .othd-search-input-row {
        grid-template-columns: 1fr;
    }

    .othd-search-clear {
        top: 22px;
        right: 10px;
    }

    .othd-side-panel {
        max-height: 55vh;
    }

    .othd-legend-card {
        right: 10px;
        bottom: 14px;
        min-width: 0;
        padding: 10px 12px;
        font-size: 0.82rem;
    }

    .othd-map-hint {
        bottom: 12px;
        font-size: 0.78rem;
    }
}
