/* Globe Heat (/globe-heat): the globe and, beside it, the field, the status, the scale and the guesses nearest first.
   Tiles and buttons come from the app kit; the canvas and its zoom buttons from css/apps/atlas-map.css. */

.globe-heat-play {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(250px, 0.75fr);
    gap: var(--ak-space-3);
    width: 100%;
    min-height: 460px;
}

/* The globe floats in its own night sky (drawn by the script), not on the map's sea blue. */
.globe-heat-globe-wrap .atlas-map.globe-heat-globe {
    background: #070b16;
    cursor: grab;
}

.globe-heat-globe-wrap .atlas-map.globe-heat-globe:active {
    cursor: grabbing;
}

.globe-heat-side {
    display: flex;
    flex-direction: column;
    gap: var(--ak-space-2);
    min-width: 0;
    min-height: 0;
    padding: var(--ak-space-3);
    border-radius: 12px;
    background: var(--ak-panel);
    border: 1px solid var(--ak-border);
}

.globe-heat-entry {
    display: flex;
    gap: var(--ak-space-2);
}

.globe-heat-entry .ak-field {
    flex: 1 1 auto;
    min-width: 0;
}

.globe-heat-entry .ak-btn {
    flex: none;
}

.globe-heat-status {
    margin: 0;
    min-height: 1.4em;
    color: var(--ak-text);
    font-weight: 600;
    font-size: var(--ak-fs-sm);
    overflow-wrap: anywhere;
}

.globe-heat-status[data-tone="good"] {
    color: var(--ak-success);
    font-weight: 800;
    font-size: var(--ak-fs-md, 1rem);
}

.globe-heat-status[data-tone="bad"] {
    color: var(--ak-danger);
}

.globe-heat-hints {
    margin: 0;
    padding: 6px 10px;
    list-style: none;
    border-radius: 8px;
    background: color-mix(in srgb, var(--ak-accent) 12%, transparent);
    font-size: var(--ak-fs-sm);
    font-weight: 600;
}

/* The scale: far (pale) to near (deep red), the same stops as GlobeHeatCore.STOPS. */
.globe-heat-scale {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--ak-muted);
    font-size: var(--ak-fs-xs, 0.75rem);
    font-weight: 600;
}

.globe-heat-scale-bar {
    flex: 1 1 auto;
    height: 10px;
    border-radius: 5px;
    background: linear-gradient(90deg, #fdf3d8 0%, #fdd77a 43.75%, #fb9c3d 69.75%, #f0542a 87.75%, #c1121f 97.75%, #6b0012 100%);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.globe-heat-list {
    flex: 1 1 0;
    min-height: 0;
    margin: 0;
    padding: 0;
    list-style: none;
    overflow-y: auto;
}

.globe-heat-row-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 6px 4px;
    border: 0;
    border-bottom: 1px solid var(--ak-border);
    background: transparent;
    color: var(--ak-text);
    font: inherit;
    font-size: var(--ak-fs-sm);
    text-align: start;
    cursor: pointer;
}

.globe-heat-row:last-child .globe-heat-row-btn {
    border-bottom: 0;
}

.globe-heat-row-btn:hover {
    background: color-mix(in srgb, var(--ak-accent) 8%, transparent);
}

.globe-heat-row-btn:focus-visible {
    outline: 2px solid var(--ak-accent);
    outline-offset: -2px;
}

.globe-heat-swatch {
    flex: none;
    width: 18px;
    height: 18px;
    border-radius: 5px;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
}

.globe-heat-row-name {
    flex: 1 1 auto;
    min-width: 0;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.globe-heat-row-km {
    flex: none;
    color: var(--ak-muted);
    font-variant-numeric: tabular-nums;
}

.globe-heat-row.is-latest .globe-heat-row-name {
    text-decoration: underline;
    text-decoration-color: var(--ak-accent);
    text-underline-offset: 3px;
}

.globe-heat-row.is-found .globe-heat-row-km {
    color: var(--ak-success);
    font-weight: 800;
}

/* On a phone the globe goes first, square, and the panel under it. */
@media (max-width: 800px) {
    .globe-heat-play {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .globe-heat-globe-wrap {
        aspect-ratio: 1 / 1;
        max-height: 70vh;
    }

    .globe-heat-side {
        padding: var(--ak-space-2);
    }

    .globe-heat-list {
        flex: none;
        max-height: 240px;
    }
}

/* In the app layout on a computer the globe and the panel take the stage's whole height under the tiles. */
@media (min-width: 801px) {
    body.filter-app-mode .ak-app > .filter-landing-stage.globe-heat-stage > .game-board-panel {
        flex: 1 1 0;
        min-height: 0;
    }

    body.filter-app-mode .globe-heat-stage .globe-heat-play {
        flex: 1 1 0;
        height: 100%;
        min-height: 420px;
    }
}

/* In the app layout on a phone the globe takes the height the panel under it leaves: no empty band above or below. */
@media (max-width: 800px) {
    body.filter-app-mode .ak-app > .filter-landing-stage.globe-heat-stage > .game-board-panel {
        flex: 1 1 0;
        min-height: 0;
    }

    body.filter-app-mode .globe-heat-stage .globe-heat-play {
        flex: 1 1 0;
        height: 100%;
        grid-template-rows: minmax(260px, 1fr) auto;
    }

    body.filter-app-mode .globe-heat-stage .globe-heat-globe-wrap {
        aspect-ratio: auto;
        max-height: none;
        min-height: 260px;
    }
}

/* With the controls shown on a phone or tablet the stage's height follows its content (the shared phone layout), so
   the rules above that let the globe take the stage's height left it 0 pixels tall there. Then the globe keeps its own shape and the stage scrolls; with the controls hidden the stage fills the screen and the rules above apply. */
@media (max-width: 960px) {
    body.filter-app-mode .ak-app:not(.is-panel-collapsed) > .filter-landing-stage.globe-heat-stage > .game-board-panel {
        flex: none;
    }

    body.filter-app-mode .ak-app:not(.is-panel-collapsed) > .globe-heat-stage .globe-heat-play {
        flex: none;
        height: auto;
    }
}

@media (max-width: 800px) {
    body.filter-app-mode .ak-app:not(.is-panel-collapsed) > .globe-heat-stage .globe-heat-play {
        grid-template-rows: none;
    }

    body.filter-app-mode .ak-app:not(.is-panel-collapsed) > .globe-heat-stage .globe-heat-globe-wrap {
        aspect-ratio: 1 / 1;
        max-height: 70vh;
        min-height: 0;
    }
}
