/* css/hunter/mobile-explore-fixes.css */

/* =========================
   Explore memory flow emergency fix
   - previous z-axis panel was absolute inside a heightless explore view and got clipped
   - make the explore view a fixed-height scene when the memory tab is active
   - keep only the minigame shell scrollable, not the whole white page
========================= */
@media (max-width: 768px) {
    .hunter-page .hunter-game-views:has(.hunter-explore-room.active .hunter-subtab-panel[data-hunter-subtab-panel="memory"].active) {
        overflow: hidden;
    }

    .hunter-page .hunter-explore-room.active:has(.hunter-subtab-panel[data-hunter-subtab-panel="memory"].active) {
        height: 100%;
        min-height: 0;
        max-height: 100%;
        overflow: hidden !important;

        display: grid;
        grid-template-rows: auto auto minmax(0, 1fr);
        gap: 8px;
    }

    .hunter-page .hunter-explore-room.active:has(.hunter-subtab-panel[data-hunter-subtab-panel="memory"].active) .hunter-tab-scene-title,
    .hunter-page .hunter-explore-room.active:has(.hunter-subtab-panel[data-hunter-subtab-panel="memory"].active) .hunter-subtab-bar {
        margin-bottom: 0;
    }

    .hunter-page .hunter-explore-room .hunter-subtab-panel[data-hunter-subtab-panel="memory"].active {
        position: relative;
        inset: auto;
        left: auto;
        right: auto;
        top: auto;
        bottom: auto;

        min-height: 0;
        height: 100%;
        width: 100%;
        overflow: hidden;
    }

    .hunter-page .hunter-explore-room .hunter-minigame-shell {
        height: 100%;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    .hunter-page .hunter-explore-room .hunter-memory-game-card {
        min-height: min-content;
    }
}

@media (max-width: 420px) {
    .hunter-page .hunter-explore-room.active:has(.hunter-subtab-panel[data-hunter-subtab-panel="memory"].active) {
        gap: 7px;
    }

    .hunter-page .hunter-explore-room .hunter-subtab-panel[data-hunter-subtab-panel="memory"].active {
        inset: auto;
        left: auto;
        right: auto;
        top: auto;
        bottom: auto;
    }
}

/* =========================
   Explore memory flow v3
   - exploration must scroll normally again
   - memory game stays as a full card in the page, not a clipped absolute panel
   - when playing, the timer HUD sticks near the top while the player scrolls
========================= */
@media (max-width: 768px) {
    .hunter-page .hunter-game-views:has(.hunter-explore-room.active .hunter-subtab-panel[data-hunter-subtab-panel="memory"].active) {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    .hunter-page .hunter-explore-room.active:has(.hunter-subtab-panel[data-hunter-subtab-panel="memory"].active) {
        height: auto !important;
        min-height: 100% !important;
        max-height: none !important;
        overflow: visible !important;
        display: block !important;
        padding-bottom: 18px;
    }

    .hunter-page .hunter-explore-room.active:has(.hunter-subtab-panel[data-hunter-subtab-panel="memory"].active) .hunter-tab-scene-title {
        margin-bottom: 8px;
    }

    .hunter-page .hunter-explore-room.active:has(.hunter-subtab-panel[data-hunter-subtab-panel="memory"].active) .hunter-subtab-bar {
        position: sticky;
        top: 0;
        z-index: 40;
        margin-bottom: 10px;
        backdrop-filter: blur(10px);
    }

    .hunter-page .hunter-explore-room .hunter-subtab-panel[data-hunter-subtab-panel="memory"].active {
        position: static !important;
        inset: auto !important;
        left: auto !important;
        right: auto !important;
        top: auto !important;
        bottom: auto !important;
        z-index: auto !important;

        display: block !important;
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: visible !important;

        border-radius: 0 !important;
        background: transparent !important;
        border: 0 !important;
        box-shadow: none !important;
    }

    .hunter-page .hunter-explore-room .hunter-subtab-panel[data-hunter-subtab-panel="memory"].active::before {
        display: none !important;
    }

    .hunter-page .hunter-explore-room .hunter-minigame-shell {
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: visible !important;
        padding: 0 !important;
    }

    .hunter-page .hunter-explore-room .hunter-memory-game-card {
        position: relative;
        min-height: 0 !important;
        height: auto !important;
        margin: 0 !important;
        padding: 13px !important;
        border-radius: 24px !important;
        background:
            linear-gradient(90deg, rgba(255, 224, 138, .05) 1px, transparent 1px) 0 0 / 24px 24px,
            radial-gradient(circle at 78% 8%, rgba(251, 191, 36, .18), transparent 30%),
            linear-gradient(180deg, rgba(17, 24, 39, .94), rgba(47, 24, 16, .94) 62%, rgba(28, 16, 11, .96));
        border: 1px solid rgba(245, 196, 92, .54) !important;
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, .14),
            0 14px 30px rgba(0, 0, 0, .28);
    }

    .hunter-page .hunter-explore-room .hunter-memory-header {
        position: sticky;
        top: 52px;
        z-index: 35;
        display: grid;
        grid-template-columns: minmax(0, 1fr) 86px;
        align-items: center;
        gap: 8px;
        margin: -4px -4px 10px;
        padding: 8px;
        border-radius: 18px;
        background: rgba(18, 13, 12, .90);
        border: 1px solid rgba(245, 196, 92, .42);
        box-shadow: 0 8px 20px rgba(0, 0, 0, .20);
        backdrop-filter: blur(10px);
    }

    .hunter-page .hunter-explore-room .hunter-memory-header h3 {
        font-size: 15px;
        line-height: 1.18;
    }

    .hunter-page .hunter-explore-room .hunter-memory-desc {
        display: -webkit-box;
        overflow: hidden;
        -webkit-line-clamp: 1;
        -webkit-box-orient: vertical;
        color: rgba(255, 247, 219, .76);
        font-size: 11px;
    }

    .hunter-page .hunter-explore-room .hunter-memory-timer-box {
        width: 86px;
        padding: 7px 6px;
        border-radius: 14px;
        background:
            radial-gradient(circle at 50% 0%, rgba(251, 191, 36, .18), transparent 60%),
            rgba(15, 23, 42, .92);
        border: 1px solid rgba(245, 196, 92, .44);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12);
    }

    .hunter-page .hunter-explore-room .hunter-memory-timer-label {
        color: rgba(255, 247, 219, .72);
        font-size: 10px;
    }

    .hunter-page .hunter-explore-room .hunter-memory-timer-value {
        color: #fff7db;
        font-size: 16px;
        line-height: 1.15;
    }

    .hunter-page .hunter-explore-room .hunter-memory-meta-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 8px;
        align-items: center;
        margin: 8px 0 10px;
    }

    .hunter-page .hunter-explore-room #hunterMemoryGameMeta {
        white-space: normal;
        overflow: visible;
        color: rgba(255, 247, 219, .82);
        font-size: 11px;
        line-height: 1.45;
    }

    .hunter-page .hunter-explore-room .hunter-memory-start-btn {
        min-height: 42px;
        white-space: nowrap;
    }

    .hunter-page .hunter-explore-room .hunter-memory-stage-list {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
        margin-bottom: 10px;
    }

    .hunter-page .hunter-explore-room .hunter-memory-stage-pill {
        min-height: 50px;
        padding: 7px 8px;
        border-radius: 14px;
    }

    .hunter-page .hunter-explore-room .hunter-memory-stage-pill strong {
        font-size: 11px;
    }

    .hunter-page .hunter-explore-room .hunter-memory-stage-pill span,
    .hunter-page .hunter-explore-room .hunter-memory-stage-pill em {
        font-size: 9px;
        line-height: 1.2;
    }

    .hunter-page .hunter-explore-room .hunter-memory-status {
        margin-bottom: 10px;
        color: #fde68a;
        font-size: 12px;
        line-height: 1.45;
    }

    .hunter-page .hunter-explore-room .hunter-memory-board {
        min-height: 280px;
        align-content: center;
        gap: 7px;
        padding-bottom: 8px;
    }

    .hunter-page .hunter-explore-room .hunter-memory-game-card.is-playing .hunter-memory-header {
        top: 52px;
    }

    .hunter-page .hunter-explore-room .hunter-memory-game-card.is-playing .hunter-memory-desc,
    .hunter-page .hunter-explore-room .hunter-memory-game-card.is-playing .hunter-memory-stage-pill em {
        display: none;
    }

    .hunter-page .hunter-explore-room .hunter-memory-game-card.is-playing .hunter-memory-stage-pill {
        min-height: 38px;
        padding: 6px;
    }

    .hunter-page .hunter-explore-room .hunter-memory-game-card.is-playing .hunter-memory-board {
        min-height: min(72svh, 520px);
    }
}

@media (max-width: 420px) {
    .hunter-page .hunter-explore-room .hunter-memory-game-card {
        padding: 11px !important;
        border-radius: 21px !important;
    }

    .hunter-page .hunter-explore-room .hunter-memory-header {
        top: 48px;
        grid-template-columns: minmax(0, 1fr) 74px;
        gap: 7px;
        padding: 7px;
        border-radius: 16px;
    }

    .hunter-page .hunter-explore-room .hunter-memory-header h3 {
        font-size: 13px;
    }

    .hunter-page .hunter-explore-room .hunter-memory-timer-box {
        width: 74px;
        padding: 6px 5px;
    }

    .hunter-page .hunter-explore-room .hunter-memory-timer-value {
        font-size: 13px;
    }

    .hunter-page .hunter-explore-room .hunter-memory-meta-row {
        grid-template-columns: 1fr;
    }

    .hunter-page .hunter-explore-room .hunter-memory-start-btn {
        width: 100%;
    }

    .hunter-page .hunter-explore-room .hunter-memory-stage-list {
        gap: 5px;
    }

    .hunter-page .hunter-explore-room .hunter-memory-stage-pill {
        min-height: 46px;
        padding: 6px;
    }

    .hunter-page .hunter-explore-room .hunter-memory-board {
        min-height: 260px;
        gap: 6px;
    }

    .hunter-page .hunter-explore-room .hunter-memory-game-card.is-playing .hunter-memory-header {
        top: 48px;
    }

    .hunter-page .hunter-explore-room .hunter-memory-game-card.is-playing .hunter-memory-board {
        min-height: min(70svh, 480px);
    }
}




/* =========================
   Mine log collapsible fix v10
   - keep black market screen compact; logs expand only when needed
========================= */
@media (max-width: 768px) {
    .hunter-page .hunter-explore-room .hunter-mine-log-details {
        padding: 0 !important;
        overflow: hidden;
    }

    .hunter-page .hunter-explore-room .hunter-mine-log-details > summary.hunter-mine-log-head {
        list-style: none;
        cursor: pointer;
        min-height: 56px;
        margin: 0;
        padding: 12px 14px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
    }

    .hunter-page .hunter-explore-room .hunter-mine-log-details > summary.hunter-mine-log-head::-webkit-details-marker {
        display: none;
    }

    .hunter-page .hunter-explore-room .hunter-mine-log-title {
        display: block;
        color: #fff7db;
        font-size: 16px;
        font-weight: 950;
        line-height: 1.25;
    }

    .hunter-page .hunter-explore-room .hunter-mine-log-meta {
        flex: 0 0 auto;
        display: flex;
        align-items: center;
        gap: 6px;
        min-width: 0;
    }

    .hunter-page .hunter-explore-room .hunter-mine-log-toggle {
        padding: 5px 9px;
        border-radius: 999px;
        background: rgba(255, 246, 196, .95);
        color: #7c2d12;
        font-size: 11px;
        font-weight: 950;
        white-space: nowrap;
    }

    .hunter-page .hunter-explore-room .hunter-mine-log-details[open] .hunter-mine-log-toggle {
        color: #92400e;
    }

    .hunter-page .hunter-explore-room .hunter-mine-log-details[open] .hunter-mine-log-toggle::before {
        content: "收合";
    }

    .hunter-page .hunter-explore-room .hunter-mine-log-details[open] .hunter-mine-log-toggle {
        font-size: 0;
    }

    .hunter-page .hunter-explore-room .hunter-mine-log-details[open] .hunter-mine-log-toggle::before {
        font-size: 11px;
    }

    .hunter-page .hunter-explore-room .hunter-mine-log-details .hunter-mine-log-list {
        margin: 0;
        padding: 0 12px 12px;
        max-height: none !important;
        overflow: visible !important;
    }

    .hunter-page .hunter-explore-room .hunter-mine-log-details:not([open]) .hunter-mine-log-list {
        display: none;
    }
}

@media (max-width: 420px) {
    .hunter-page .hunter-explore-room .hunter-mine-log-details > summary.hunter-mine-log-head {
        min-height: 52px;
        padding: 10px 12px;
    }

    .hunter-page .hunter-explore-room .hunter-mine-log-title {
        font-size: 14px;
    }

    .hunter-page .hunter-explore-room .hunter-mine-log-count {
        max-width: 92px;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }

    .hunter-page .hunter-explore-room .hunter-mine-log-toggle {
        padding: 4px 8px;
        font-size: 10px;
    }
}

/* =========================
   Memory game mobile frame fix v11
   - keep Snack Memory frame inside narrow phones
   - avoid title/timer overlap and cramped stage chips
========================= */
@media (max-width: 768px) {
    .hunter-page .hunter-explore-room .hunter-subtab-panel[data-hunter-subtab-panel="memory"].active,
    .hunter-page .hunter-explore-room .hunter-minigame-shell,
    .hunter-page .hunter-explore-room .hunter-memory-game-card {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    .hunter-page .hunter-explore-room .hunter-memory-game-card {
        overflow: hidden !important;
    }

    .hunter-page .hunter-explore-room .hunter-memory-header,
    .hunter-page .hunter-explore-room .hunter-memory-meta-row,
    .hunter-page .hunter-explore-room .hunter-memory-stage-list,
    .hunter-page .hunter-explore-room .hunter-memory-board {
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    .hunter-page .hunter-explore-room .hunter-memory-header > div:first-child,
    .hunter-page .hunter-explore-room .hunter-memory-header h3,
    .hunter-page .hunter-explore-room .hunter-memory-desc,
    .hunter-page .hunter-explore-room #hunterMemoryGameMeta {
        min-width: 0 !important;
        max-width: 100% !important;
        overflow-wrap: anywhere;
    }

    .hunter-page .hunter-explore-room .hunter-memory-stage-pill {
        min-width: 0 !important;
        box-sizing: border-box !important;
        overflow: hidden;
    }

    .hunter-page .hunter-explore-room .hunter-memory-stage-pill strong,
    .hunter-page .hunter-explore-room .hunter-memory-stage-pill span,
    .hunter-page .hunter-explore-room .hunter-memory-stage-pill em {
        display: block;
        min-width: 0;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

@media (max-width: 480px) {
    .hunter-page .hunter-explore-room .hunter-memory-game-card {
        padding: 10px !important;
        border-radius: 20px !important;
    }

    .hunter-page .hunter-explore-room .hunter-memory-header {
        position: relative !important;
        top: auto !important;
        grid-template-columns: 1fr !important;
        gap: 8px !important;
        margin: -2px -2px 10px !important;
        padding: 10px !important;
        overflow: visible !important;
    }

    .hunter-page .hunter-explore-room .hunter-memory-header h3 {
        font-size: 16px !important;
        line-height: 1.25 !important;
        white-space: normal !important;
    }

    .hunter-page .hunter-explore-room .hunter-memory-desc {
        -webkit-line-clamp: 2 !important;
        font-size: 11px !important;
        line-height: 1.35 !important;
    }

    .hunter-page .hunter-explore-room .hunter-memory-timer-box {
        width: 100% !important;
        max-width: none !important;
        justify-self: stretch !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 8px !important;
        padding: 7px 10px !important;
        border-radius: 14px !important;
    }

    .hunter-page .hunter-explore-room .hunter-memory-timer-label,
    .hunter-page .hunter-explore-room .hunter-memory-timer-value {
        margin: 0 !important;
        line-height: 1.1 !important;
    }

    .hunter-page .hunter-explore-room .hunter-memory-timer-value {
        font-size: 18px !important;
        letter-spacing: -0.02em !important;
    }

    .hunter-page .hunter-explore-room .hunter-memory-meta-row {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    .hunter-page .hunter-explore-room .hunter-memory-start-btn {
        width: 100% !important;
        min-height: 44px !important;
    }

    .hunter-page .hunter-explore-room .hunter-memory-stage-list {
        grid-template-columns: 1fr !important;
        gap: 7px !important;
    }

    .hunter-page .hunter-explore-room .hunter-memory-stage-pill {
        min-height: 0 !important;
        padding: 8px 10px !important;
    }

    .hunter-page .hunter-explore-room .hunter-memory-stage-pill strong,
    .hunter-page .hunter-explore-room .hunter-memory-stage-pill span,
    .hunter-page .hunter-explore-room .hunter-memory-stage-pill em {
        white-space: normal !important;
    }

    .hunter-page .hunter-explore-room .hunter-memory-board {
        min-height: 240px !important;
        gap: 6px !important;
    }

    .hunter-page .hunter-explore-room .hunter-memory-game-card.is-playing .hunter-memory-header {
        top: auto !important;
    }
}
