/* HOME-01: the existing shelter stays visible between the title and keepsakes. */
.menu-overlay.menu-overlay-homecoming {
    justify-content: flex-end;
    padding: 28px;
    background: linear-gradient(180deg, #253b326b, transparent 28%, transparent 57%, #233b3240);
    backdrop-filter: none;
}

.homecoming-panel {
    width: min(900px, 100%);
    max-height: 43svh;
    overflow: visible;
    min-height: 0;
    padding: 20px 26px;
    gap: 17px;
    border: 1px solid #b99265;
    border-radius: 14px;
    background: #fff5df;
    color: #352f26;
    box-shadow: 0 12px 32px #25332442, inset 0 0 0 3px #fff9ed;
}

.homecoming-content { display: contents; }
.homecoming-arrival {
    position: fixed;
    top: 36px;
    left: 50%;
    transform: translateX(-50%);
    width: min(640px, calc(100% - 32px));
    text-align: center;
    color: #fff8e4;
    text-shadow: 0 2px 6px #172319, 0 0 2px #172319;
}
.homecoming-arrival .menu-title {
    margin: 8px 0 12px;
    font-size: clamp(28px, 3.6vw, 48px);
    line-height: 1.1;
    color: inherit;
    text-shadow: inherit;
}
.homecoming-map {
    margin: 0;
    font: 600 12px/1.4 system-ui, sans-serif;
    letter-spacing: .12em;
    text-transform: uppercase;
}
.homecoming-score { margin: 0 0 5px; font-size: 24px; font-variant-numeric: tabular-nums; }
.homecoming-remaining { margin: 0; font-size: 15px; line-height: 1.4; }
.homecoming-details {
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #a78c66 #fff5df;
    overscroll-behavior: contain;
}
.homecoming-details:focus-visible { outline: 2px solid #806340; outline-offset: -2px; }
.homecoming-scroll-hint { margin: -8px 0; text-align: center; font: 12px/1.4 system-ui, sans-serif; color: #675540; }
.homecoming-collection { display: flex; gap: 24px; align-items: flex-start; }
.homecoming-finds { min-width: 0; flex: 1; }
.homecoming-section-title {
    margin: 0 0 10px;
    color: #675540;
    font: 600 12px/1.4 system-ui, sans-serif;
    letter-spacing: .035em;
}
.homecoming-find-list { display: flex; flex-wrap: wrap; gap: 10px 18px; list-style: none; margin: 0; padding: 0; }
.homecoming-find { display: flex; gap: 8px; align-items: center; min-width: 0; }
.homecoming-find-image { display: block; width: 56px; height: 56px; object-fit: contain; flex-shrink: 0; }
.homecoming-find-name { font-size: 15px; line-height: 1.4; }
.homecoming-kept { border-left: 1px solid #d7c7a5; padding-left: 24px; }
.homecoming-kept:only-child { border: 0; padding-left: 0; }
.homecoming-kept .homecoming-find-image { width: 32px; height: 32px; }
.homecoming-kept .homecoming-find-name { font-size: 13px; color: #62584b; }
.homecoming-empty, .homecoming-message { margin: 0; font-size: 16px; line-height: 1.5; flex: 1; }
.homecoming-notice {
    color: #76401f;
    font: 14px/1.5 system-ui, sans-serif;
    padding: 10px 12px;
    margin: 0 0 14px;
    background: #fae6cb;
    border-left: 3px solid #9e6436;
}
.homecoming-panel .menu-buttons {
    display: flex;
    flex-direction: row;
    gap: 8px;
    flex-shrink: 0;
}
.homecoming-panel .menu-btn {
    flex: 1;
    min-width: 0;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid #a78c66;
    border-radius: 8px;
    background: #f5e8ca;
    color: #493e2f;
    box-shadow: none;
    font-size: 16px;
    font-weight: normal;
    transition: background-color .15s ease;
}
.homecoming-panel .menu-btn:first-child { flex: 1.6; background: #3a553d; color: #fff6df; border-color: #3a553d; }
.homecoming-panel .menu-btn:last-child { background: transparent; border-color: transparent; text-decoration: underline; text-underline-offset: 4px; }
.homecoming-panel .menu-btn.is-focused, .homecoming-panel .menu-btn:focus-visible {
    outline: 2px solid #fff5df;
    outline-offset: -4px;
    box-shadow: 0 0 0 2px #3a553d;
    border-color: #3a553d;
    transform: none;
}
.showing-homecoming #info, .showing-homecoming #goal-card,
.showing-homecoming #menu-btn, .showing-homecoming #sound-btn,
.showing-homecoming #restart-btn, .showing-homecoming #stop-btn,
.showing-homecoming #stamina-container { visibility: hidden; }

@media (max-width: 640px) {
    .menu-overlay.menu-overlay-homecoming { padding: 12px; }
    .homecoming-panel { padding: 16px; gap: 14px; }
    .homecoming-arrival { top: 32px; }
    .homecoming-arrival .menu-title { font-size: 30px; }
    .homecoming-score { font-size: 22px; }
    .homecoming-collection { gap: 14px; }
    .homecoming-find-list { gap: 8px; }
    .homecoming-find { gap: 5px; }
    .homecoming-find-image { width: 44px; height: 44px; }
    .homecoming-find-name { font-size: 14px; }
    .homecoming-kept { padding-left: 14px; }
    .homecoming-kept .homecoming-find-image { width: 25px; height: 25px; }
    .homecoming-panel .menu-buttons { display: grid; grid-template-columns: 1fr 1fr; }
    .homecoming-panel .menu-btn:first-child { grid-column: 1 / -1; }
    .homecoming-panel .menu-btn { font-size: 15px; padding: 9px; }
    .homecoming-panel .menu-btn:last-child:nth-child(2) { grid-column: 1 / -1; }
    .homecoming-notice { font-size: 13px; }
}

@media (max-height: 700px) {
    .menu-overlay.menu-overlay-homecoming { padding: 10px; }
    .homecoming-panel { max-height: 42svh; padding: 14px; gap: 12px; }
    .homecoming-arrival { top: 18px; }
    .homecoming-arrival .menu-title { font-size: 28px; margin: 5px 0 8px; }
    .homecoming-score { font-size: 20px; }
    .homecoming-remaining { font-size: 14px; }
}

@media (max-width: 640px) and (max-height: 500px) {
    /* Two stacked actions leave less than one readable line for the summary in a short window. */
    .homecoming-panel .menu-btn:first-child:nth-last-child(2),
    .homecoming-panel .menu-btn:last-child:nth-child(2) { grid-column: auto; }

    /* Replay, next walk and catalog need two rows while the finds stay readable. */
    .homecoming-panel:has(.menu-btn:first-child:nth-last-child(3)) {
        max-height: 52svh;
        padding-top: 8px;
        padding-bottom: 8px;
        gap: 8px;
    }
}

@media (max-width: 360px) and (max-height: 500px) {
    /* The longer primary label needs more width to leave room for a whole find card. */
    .homecoming-panel .menu-buttons:has(> .menu-btn:first-child:nth-last-child(2)) {
        grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    }
}

/* CONNECT-01: keep the optional next walk inside the scrollable result details. */
.homecoming-next-journey { margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid #d7c7a5; }
.homecoming-next-journey .homecoming-section-title { margin-bottom: 5px; }
.homecoming-next-journey .homecoming-message { font-size: 14px; }
