/* Global Mobile Resets */
body, html {
    margin: 0;
    padding: 0;
}

/* Hide desktop header navigation on mobile, keep logo */
@media (max-width: 768px) {
    body {
        height: 100vh;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }
    .pw-header nav {
        display: none !important;
    }
    
    /* Make left and right split into a column or drawer */
    .deck-split-container {
        flex-direction: column !important;
        height: calc(100vh - 120px) !important; 
    }
    .deck-split-main {
        flex: 1 1 auto !important;
        width: 100% !important;
        padding-right: 0px !important;
        margin-bottom: 50px;
    }
    .deck-split-side {
        width: 100% !important;
        height: 60px !important;
        position: fixed;
        bottom: 50px; /* above tab bar */
        left: 0;
        z-index: 1000;
        background: #fff;
        border-top: 2px solid #ccc;
        border-radius: 12px 12px 0 0;
        transition: height 0.3s ease;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    }
    .deck-split-side.expanded {
        height: 60vh !important;
    }
    .deck-inspector-header {
        cursor: pointer;
    }

    /* Tab Bar */
    .mobile-tab-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 50px;
        background: #fff;
        border-top: 1px solid #ddd;
        z-index: 9999;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    }
    .mobile-tab-bar a {
        flex: 1;
        text-align: center;
        line-height: 50px;
        color: #333;
        text-decoration: none;
        font-weight: bold;
        font-size: 14px;
    }
    .mobile-tab-bar a.active {
        color: #e1bee7; /* theme color */
        border-top: 3px solid #e1bee7;
    }

    /* Modal Details */
    .mobile-card-modal {
        position: fixed;
        top: 0; left: 0; width: 100vw; height: 100vh;
        background: rgba(0,0,0,0.8);
        z-index: 10000;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 20px;
        box-sizing: border-box;
    }
    .mobile-card-modal.hidden {
        display: none !important;
    }
    .mobile-card-modal-content {
        background: #fff;
        border-radius: 12px;
        width: 100%;
        max-width: 400px;
        max-height: 80vh;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
        padding: 15px;
    }
    .mobile-card-modal img {
        width: 100%;
        border-radius: 8px;
        margin-bottom: 15px;
    }
    .mobile-modal-actions {
        display: flex;
        gap: 10px;
        margin-top: 15px;
    }
    .mobile-modal-actions button {
        flex: 1;
        padding: 10px;
        border: none;
        border-radius: 8px;
        font-size: 16px;
        font-weight: bold;
        cursor: pointer;
    }
}
@media (min-width: 769px) {
    .mobile-tab-bar { display: none !important; }
    .mobile-card-modal { display: none !important; }
}
@media (max-width: 768px) {
    /* Filter Drawer (Off-canvas) */
    #quick-filters {
        position: fixed !important;
        top: 0;
        left: -100%;
        width: 80% !important;
        height: 100vh !important;
        background: rgba(255, 255, 255, 0.98) !important;
        z-index: 9998;
        overflow-y: auto;
        border-radius: 0 !important;
        transition: left 0.3s ease;
        margin: 0 !important;
        padding: 60px 20px 20px !important; /* pad top for close button */
        box-shadow: 2px 0 10px rgba(0,0,0,0.2);
    }
    #quick-filters.open {
        left: 0;
    }

    #mobile-filter-btn {
        display: flex !important;
        position: fixed;
        bottom: 120px;
        right: 20px;
        width: 50px;
        height: 50px;
        border-radius: 25px;
        background: #dbac25;
        color: white;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 10px rgba(0,0,0,0.3);
        z-index: 1000;
        cursor: pointer;
        font-size: 24px;
        border: none;
    }

    #mobile-filter-close {
        display: block !important;
        position: absolute;
        top: 15px;
        right: 20px;
        font-size: 24px;
        background: transparent;
        border: none;
        cursor: pointer;
        padding: 5px;
    }

    /* Deck Lobby Feed */
    .deck-lobby-item {
        width: 100% !important;
        margin: 0 0 20px 0 !important;
    }
}
@media (min-width: 769px) {
    #mobile-filter-btn {
        display: none !important;
    }
    #mobile-filter-close {
        display: none !important;
    }
}

            .custom-specs-container { font-family: 'Noto Sans SC', sans-serif; display: flex; flex-direction: column; gap: 8px; padding: 0; margin-top: 15px; }
            .spec-row { display: grid; gap: 8px 15px; }
            .spec-row.half { grid-template-columns: 80px 1fr 80px 1fr; }
            .spec-row.full { grid-template-columns: 80px 1fr; }
            .spec-label { background-color: #ebdccc; color: #111; font-weight: 700; text-align: center; padding: 8px 4px; border-radius: 2px; display: flex; align-items: center; justify-content: center; font-size: 13px; }
            .spec-value { align-self: center; display: block; font-size: 14px; line-height: 1.5; padding: 5px 0; word-break: break-word; }


/* ========================================================
   RULES APP-STYLE MOBILE BOTTOM SHEET (APP风格上拉菜单)
   ======================================================== */
.rules-sheet-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000000;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    opacity: 1;
    transition: opacity 0.25s ease;
}
.rules-sheet-overlay.hidden {
    display: none !important;
    opacity: 0;
    pointer-events: none;
}
.rules-sheet-content {
    background: #f8fafc;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    padding: 12px 16px calc(24px + env(safe-area-inset-bottom, 0px)) 16px;
    box-shadow: 0 -10px 35px rgba(0, 0, 0, 0.18);
    transform: translateY(0);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
}
.rules-sheet-handle {
    width: 36px;
    height: 4px;
    background: #cbd5e1;
    border-radius: 2px;
    margin: 4px auto 12px auto;
}
.rules-sheet-title {
    font-size: 13px;
    font-weight: 700;
    color: #64748b;
    text-align: center;
    margin-bottom: 14px;
    letter-spacing: 0.5px;
}
.rules-sheet-menu {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}
.rules-app-card {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}
.rules-app-card:active {
    background: #f1f5f9;
    transform: scale(0.985);
}
.rules-app-card-icon {
    font-size: 24px;
    margin-right: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #f8fafc;
    border-radius: 10px;
}
.rules-app-card-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.rules-app-card-name {
    font-size: 16px;
    font-weight: 800;
    color: #0f172a;
}
.rules-app-card-desc {
    font-size: 12px;
    color: #64748b;
}
.rules-app-card-arrow {
    font-size: 14px;
    color: #94a3b8;
    font-weight: 800;
    margin-left: 8px;
}
.rules-sheet-cancel {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 15px;
    text-align: center;
    font-size: 16px;
    font-weight: 800;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}
.rules-sheet-cancel:active {
    background: #f1f5f9;
}


/* ========================================================
   MOBILE CHAPTER QUICK-JUMP SHEET & BUTTON
   ======================================================== */
.mobile-chapter-float-btn {
    display: none; /* Hidden on PC */
}
@media (max-width: 768px) {
    .mobile-chapter-float-btn {
        position: fixed;
        bottom: 64px;
        right: 16px;
        z-index: 99999;
        background: #0f172a;
        color: #dbac25;
        border: 2px solid #dbac25;
        border-radius: 28px;
        padding: 11px 18px;
        font-size: 14px;
        font-weight: 800;
        box-shadow: 0 6px 20px rgba(0,0,0,0.3);
        display: flex;
        align-items: center;
        gap: 6px;
        cursor: pointer;
        transition: all 0.2s ease;
    }
    .mobile-chapter-float-btn.hidden {
        display: none !important;
    }
    .mobile-chapter-float-btn:active {
        transform: scale(0.95);
    }
}
.chapter-app-row {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 13px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}
.chapter-app-row:active {
    background: #f1f5f9;
    transform: scale(0.985);
}
.chapter-num {
    font-size: 13px;
    font-weight: 800;
    color: #dbac25;
    background: #0f172a;
    padding: 4px 10px;
    border-radius: 8px;
    margin-right: 12px;
    flex-shrink: 0;
}
.chapter-name {
    font-size: 15px;
    font-weight: 800;
    color: #0f172a;
    flex: 1;
    text-align: left;
}
.chapter-arrow {
    font-size: 14px;
    color: #94a3b8;
    font-weight: 800;
    margin-left: 8px;
}
