html, body, form {
    width: 100%;
    height: 100%;
    margin: 0;
}

body {
    overflow: hidden;
    color: #1f2937;
    background: #f3f4f6;
    font: 14px/1.45 "Segoe UI", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

.map-page {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    min-height: 420px;
    display: grid;
}

.map-page--simple { grid-template-rows: auto minmax(0, 1fr); }
.map-page--trainer { grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); }

.map-toolbar,
.map-sidebar {
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 2px 12px rgba(15, 23, 42, .10);
    position: relative;
    z-index: 1000;
}

.map-toolbar {
    min-height: 56px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.map-sidebar {
    padding: 18px;
    overflow: auto;
}

.map-sidebar h1 {
    margin: 0 0 14px;
    font-size: x-large;
}

.map-canvas {
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    background: #dbe3ea;
}

.map-select,
.map-input,
.map-button {
    min-height: 38px;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    background: #fff;
    padding: 7px 10px;
    font: inherit;
}

.map-input { width: 100%; margin: 6px 0 10px; }
.map-button { cursor: pointer; background: #2563eb; color: #fff; border-color: #2563eb; }
.map-button:hover { background: #1d4ed8; }
.map-search-row { display: flex; flex-wrap: nowrap; align-items: center; gap: 8px; width: 100%; }
.map-search-row .map-input { flex: 1 1 auto; width: auto; min-width: 0; margin: 0; }
.map-search-row .map-button { flex: 0 0 auto; white-space: nowrap; }
.map-summary { color: #475569; }
.map-top { margin-top: 18px; overflow-wrap: anywhere; }
.map-status { display: none; }
.map-top h2 { margin: 0 0 10px; font-size: 16px; }
.map-ranking { margin: 0; padding-left: 24px; }
.map-ranking li { padding: 7px 0; border-bottom: 1px solid #e5e7eb; }
.map-ranking li span, .map-ranking li a { margin-right: 8px; }
.map-ranking li strong { float: right; color: #0f766e; }
.map-ranking li small { display: block; margin-top: 2px; color: #64748b; }

/* Keep Google Maps' generated info window compact and close to the other providers. */
#map_canvas .gm-style-iw-c {
    padding: 8px 30px 8px 12px !important;
    border-radius: 10px !important;
}
#map_canvas .gm-style-iw-d {
    overflow: hidden !important;
    padding: 0 !important;
}
#map_canvas .gm-style-iw-chr {
    position: absolute !important;
    top: 4px !important;
    right: 4px !important;
    height: 22px !important;
    min-height: 22px !important;
}
#map_canvas .gm-style-iw-chr .gm-ui-hover-effect {
    width: 22px !important;
    height: 22px !important;
    margin: 0 !important;
}
#map_canvas .gm-style-iw-chr .gm-ui-hover-effect > span {
    width: 14px !important;
    height: 14px !important;
    margin: 4px !important;
}

@media (max-width: 800px) {
    body { overflow: auto; }
    .map-page--trainer {
        height: auto;
        min-height: 100dvh;
        grid-template-columns: 1fr;
        grid-template-rows: minmax(55vh, 1fr) auto;
    }
    .map-page--trainer .map-canvas { min-height: 55vh; }
    .map-sidebar { max-height: none; }
}
