/* Keep the weather dialog opener separate from the nested location-menu button. */
body.unified-page #weatherCard.weather-card {
    cursor: default;
}

body.unified-page #weatherCardOpen.weather-card-open {
    display: flex;
    align-self: stretch;
    align-items: center;
    gap: 6px;
    flex: 1 1 auto;
    min-width: 0;
    cursor: pointer;
}

body.unified-page #weatherCardOpen.weather-card-open:focus-visible {
    outline: 3px solid #1565c0;
    outline-offset: -3px;
    border-radius: 10px;
}

/* The visible forecast row stays unchanged while a real button owns expansion. */
body.unified-page .weather-week-main {
    position: relative;
}

body.unified-page .weather-week-main.is-static {
    cursor: default;
}

body.unified-page .weather-week-toggle {
    position: absolute;
    inset: 0;
    z-index: 1;
    box-sizing: border-box;
    width: 100%;
    min-width: 44px;
    height: 100%;
    min-height: 44px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

body.unified-page .weather-week-toggle:focus-visible {
    outline: 3px solid #1565c0;
    outline-offset: -3px;
}

body.unified-page #weatherLocationPickerOverlay .weather-location-map-error {
    box-sizing: border-box;
    flex-direction: column;
    gap: 10px;
}

body.unified-page #weatherLocationPickerOverlay #weatherLocationMapRetryBtn {
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0 14px;
    border: 0;
    border-radius: 9px;
    background: #1565c0;
    color: #fff;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

/* Preserve the compact weather badge while exposing a reliable mobile target. */
@media (max-width: 767px) {
    body.unified-page #weatherRefreshLocationBtn.weather-refresh-location-btn {
        isolation: isolate;
        width: 44px !important;
        min-width: 44px !important;
        height: 44px !important;
        min-height: 44px !important;
        align-items: flex-start !important;
        justify-content: flex-start !important;
        gap: 1px !important;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    body.unified-page #weatherRefreshLocationBtn.weather-refresh-location-btn::before {
        content: "";
        position: absolute;
        inset: 0 auto auto 0;
        z-index: -1;
        width: 36px;
        height: 18px;
        border-right: 1px solid rgba(21, 101, 192, 0.25);
        border-bottom: 1px solid rgba(21, 101, 192, 0.25);
        border-radius: 0 0 7px 0;
        background: rgba(255, 255, 255, 0.86);
        box-shadow: 0 1px 4px rgba(21, 101, 192, 0.12);
        pointer-events: none;
    }

    body.unified-page #weatherRefreshLocationBtn.weather-refresh-location-btn:active::before {
        background: #e3f2fd;
    }

    body.unified-page #weatherRefreshLocationBtn.weather-refresh-location-btn > span {
        position: relative;
        z-index: 1;
        display: inline-flex;
        align-items: center;
        height: 18px;
        line-height: 1;
    }

    body.unified-page #weatherRefreshLocationBtn.weather-refresh-location-btn > span:first-child {
        margin-left: 4px;
    }

    body.unified-page .weather-location-menu button[role="menuitem"] {
        min-height: 44px;
    }

    body.unified-page #weatherLocationPickerOverlay :is(
        #weatherLocationPickerClose,
        #weatherLocationSearchBtn,
        #weatherLocationCancelBtn,
        #weatherLocationConfirmBtn
    ) {
        min-width: 44px;
        height: 44px;
        min-height: 44px;
    }

    body.unified-page #weatherLocationPickerOverlay #weatherLocationSearchInput {
        height: 44px;
        min-height: 44px;
    }
}

@media (max-width: 767px) and (max-height: 480px) {
    body.unified-page #weatherLocationPickerOverlay .weather-location-picker {
        overflow-y: auto !important;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    body.unified-page #weatherLocationPickerOverlay .weather-location-map {
        height: 160px;
        min-height: 160px;
        flex: 0 0 160px;
    }
}
