/* ============================================
   PsyLearn Mobile Styles (Phase 1A)
   Target: window.innerWidth < 600px
   ============================================ */

/* ── Base defaults (outside media queries) ──
   These ensure mobile/desktop isolation regardless of viewport.
   Mobile content is hidden by default; shown only on small screens.
   Desktop content shows by default; hidden only on small screens. */
.mobile-only {
    display: none;
}

/* Hide desktop elements on mobile */
@media (max-width: 599px) {
    /* Reset body for mobile — remove desktop padding/background */
    body {
        padding: 0 !important;
        background: var(--pl-bg-page, #f7f7f5) !important;
    }

    /* Adjust container — remove desktop card styling on mobile,
       allow natural scrolling. !important needed to beat style.css
       .container { display:flex; min-height:calc(100vh-40px) } */
    .container {
        padding: 0 0 calc(80px + env(safe-area-inset-bottom, 0px)) 0 !important;
        max-width: 100% !important;
        background: transparent !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        display: block !important;
        min-height: auto !important;
        flex-direction: unset !important;
    }

    /* Hide desktop-specific sections — MUST come after .container rule
       so that cascade wins over .container { display:block!important }
       on elements like <div class="container desktop-only"> (lab page). */
    .desktop-only,
    nav.desktop-only,
    .top-nav.desktop-only {
        display: none !important;
    }

    /* Show mobile-specific sections */
    .mobile-only {
        display: block !important;
    }

    /* ============================================
       Mobile Top Bar
       ============================================ */
    .mobile-top-bar {
        position: sticky;
        top: 0;
        z-index: 100;
        background: white;
        padding: 10px 14px;
        display: flex !important;
        flex-wrap: nowrap;
        justify-content: space-between;
        align-items: center;
        height: 56px;
        box-sizing: border-box;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    }

    .mobile-top-bar-brand {
        display: flex;
        align-items: center;
        gap: 7px;
        min-width: 0;
    }

    .mobile-top-bar-brand i {
        font-size: 20px;
        color: var(--pl-brand-pink);
        flex-shrink: 0;
    }

    .mobile-top-bar-brand-text h1 {
        font-size: 16px;
        font-weight: 700;
        color: var(--pl-text-main);
        margin: 0;
        line-height: 1.2;
        white-space: nowrap;
    }

    .mobile-top-bar-brand-text p {
        font-size: 10px;
        color: var(--pl-text-muted);
        margin: 0;
        line-height: 1.2;
        white-space: nowrap;
    }

    .mobile-top-bar-actions {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-shrink: 0;
        margin-left: auto;
    }

    .mobile-top-bar-actions button {
        background: none;
        border: none;
        font-size: 18px;
        color: var(--pl-text-muted);
        cursor: pointer;
        padding: 6px;
        line-height: 1;
    }

    /* Auth avatar in top bar */
    .mobile-auth-avatar {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        background: linear-gradient(135deg, var(--pl-brand-pink-2), var(--pl-brand-pink));
        color: white;
        font-size: 14px;
        font-weight: 700;
        display: flex;
        align-items: center;
        justify-content: center;
        border: none;
        cursor: pointer;
        padding: 0;
    }

    .mobile-auth-login-btn {
        padding: 6px 14px;
        background: linear-gradient(135deg, var(--pl-brand-pink-2), var(--pl-brand-pink));
        color: white;
        border: none;
        border-radius: 8px;
        font-size: 13px;
        font-weight: 600;
        text-decoration: none;
        cursor: pointer;
    }

    /* ============================================
       Mobile Content Area
       ============================================ */
    .mobile-content {
        padding: 10px 14px;
    }

    /* ============================================
       Today Continue Card (Primary)
       ============================================ */
    .mobile-today-continue {
        background: linear-gradient(135deg, #fff5f7 0%, #fff 100%);
        border: 1.5px solid rgba(245, 87, 108, 0.25);
        border-radius: 14px;
        padding: 14px 16px;
        margin-bottom: 14px;
    }

    .mobile-today-continue-title {
        font-size: 14px;
        font-weight: 700;
        color: var(--pl-text-main);
        margin-bottom: 8px;
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .mobile-today-continue-title i {
        color: var(--pl-brand-pink);
        font-size: 14px;
    }

    .mobile-today-continue-content {
        margin-bottom: 10px;
    }

    .mobile-today-continue-subject {
        font-size: 12px;
        color: var(--pl-text-muted);
        margin-bottom: 2px;
    }

    .mobile-today-continue-topic {
        font-size: 14px;
        font-weight: 600;
        color: var(--pl-text-main);
        margin-bottom: 6px;
        line-height: 1.35;
    }

    .mobile-today-continue-progress {
        font-size: 11px;
        color: var(--pl-text-light);
    }

    .mobile-today-continue-btn {
        display: block;
        width: 100%;
        padding: 11px;
        background: linear-gradient(135deg, var(--pl-brand-pink-2), var(--pl-brand-pink));
        color: white;
        border: none;
        border-radius: 10px;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        text-align: center;
        text-decoration: none;
        transition: all 0.3s ease;
    }

    .mobile-today-continue-btn:hover {
        transform: scale(1.02);
        box-shadow: 0 4px 16px rgba(255, 95, 143, 0.3);
    }

    /* ============================================
       Today Tasks & Recent Learning
       ============================================ */
    .mobile-section {
        margin-bottom: 14px;
    }

    .mobile-section-title {
        font-size: 14px;
        font-weight: 700;
        color: var(--pl-text-main);
        margin-bottom: 8px;
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .mobile-section-title i {
        color: var(--pl-brand-pink);
        font-size: 13px;
    }

    .mobile-task-list {
        display: flex;
        gap: 10px;
    }

    .mobile-task-item {
        flex: 1;
        background: white;
        border-radius: 10px;
        padding: 10px;
        box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
        text-align: center;
    }

    .mobile-task-item-label {
        font-size: 11px;
        color: var(--pl-text-muted);
        margin-bottom: 4px;
    }

    .mobile-task-item-value {
        font-size: 15px;
        font-weight: 600;
        color: var(--pl-brand-pink);
    }

    .mobile-recent-list {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .mobile-recent-item {
        background: white;
        border-radius: 10px;
        padding: 12px 14px;
        box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .mobile-recent-item-icon {
        width: 36px;
        height: 36px;
        border-radius: 9px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 16px;
        background: linear-gradient(135deg, var(--pl-brand-pink-2), var(--pl-brand-pink));
        color: white;
        flex-shrink: 0;
    }

    .mobile-recent-item-text {
        flex: 1;
        font-size: 14px;
        font-weight: 600;
        color: var(--pl-text-main);
    }

    .mobile-recent-item-arrow {
        color: var(--pl-text-light);
        font-size: 12px;
    }

    /* ============================================
       More Capabilities Section
       ============================================ */
    .mobile-more-section {
        margin-bottom: 14px;
    }

    .mobile-more-card {
        background: white;
        border-radius: 10px;
        padding: 13px 14px;
        box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
        display: flex;
        align-items: center;
        gap: 12px;
        text-decoration: none;
        transition: all 0.3s ease;
    }

    .mobile-more-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }

    .mobile-more-card-icon {
        width: 48px;
        height: 48px;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 22px;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        flex-shrink: 0;
    }

    .mobile-more-card-content {
        flex: 1;
    }

    .mobile-more-card-title {
        font-size: 15px;
        font-weight: 700;
        color: var(--pl-text-main);
        margin-bottom: 4px;
    }

    .mobile-more-card-desc {
        font-size: 12px;
        color: var(--pl-text-muted);
        margin-bottom: 4px;
        line-height: 1.4;
    }

    .mobile-more-card-hint {
        font-size: 11px;
        color: var(--pl-text-light);
    }

    .mobile-more-card-arrow {
        color: var(--pl-text-light);
        font-size: 14px;
    }

    /* ============================================
       Bottom Navigation
       ============================================ */
    .mobile-bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 64px;
        background: white;
        border-top: 1px solid var(--pl-border);
        display: flex;
        justify-content: space-around;
        align-items: center;
        z-index: 1000;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    }

    .mobile-bottom-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        padding: 8px 0;
        background: none;
        border: none;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .mobile-bottom-nav-item i {
        font-size: 20px;
        color: var(--pl-text-light);
        transition: color 0.2s ease;
    }

    .mobile-bottom-nav-item span {
        font-size: 11px;
        color: var(--pl-text-light);
        font-weight: 500;
        transition: color 0.2s ease;
    }

    .mobile-bottom-nav-item.active i,
    .mobile-bottom-nav-item.active span {
        color: var(--pl-brand-pink);
    }

    .mobile-bottom-nav-item:hover i,
    .mobile-bottom-nav-item:hover span {
        color: var(--pl-brand-pink);
    }

    /* ============================================
       Tab Content Areas
       ============================================ */
    .mobile-tab-content {
        display: none;
    }

    .mobile-tab-content.active {
        display: block;
    }

    /* Recite Tab */
    .mobile-recite-card {
        background: white;
        border-radius: 12px;
        padding: 20px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
        margin-bottom: 12px;
        text-align: center;
    }

    .mobile-recite-card-icon {
        width: 60px;
        height: 60px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 28px;
        background: linear-gradient(135deg, var(--pl-brand-pink-2), var(--pl-brand-pink));
        color: white;
        margin: 0 auto 16px;
    }

    .mobile-recite-card-title {
        font-size: 16px;
        font-weight: 700;
        color: var(--pl-text-main);
        margin-bottom: 8px;
    }

    .mobile-recite-card-desc {
        font-size: 13px;
        color: var(--pl-text-muted);
        margin-bottom: 16px;
    }

    .mobile-recite-card-btn {
        display: inline-block;
        padding: 12px 24px;
        background: linear-gradient(135deg, var(--pl-brand-pink-2), var(--pl-brand-pink));
        color: white;
        border: none;
        border-radius: 10px;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        text-decoration: none;
        transition: all 0.3s ease;
    }

    .mobile-recite-card-btn:hover {
        transform: scale(1.05);
        box-shadow: 0 6px 20px rgba(255, 95, 143, 0.3);
    }

    /* Course Tab */
    .mobile-course-item {
        background: white;
        border-radius: 12px;
        padding: 16px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
        margin-bottom: 12px;
        display: flex;
        align-items: center;
        gap: 14px;
    }

    .mobile-course-item-icon {
        width: 48px;
        height: 48px;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 22px;
        flex-shrink: 0;
    }

    .mobile-course-item-icon--general {
        background: linear-gradient(135deg, var(--pl-brand-pink-2), var(--pl-brand-pink));
        color: white;
    }

    .mobile-course-item-icon--experimental {
        background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
        color: var(--pl-brand-pink);
    }

    .mobile-course-item-icon--statistics {
        background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
        color: var(--pl-brand-pink);
    }

    .mobile-course-item-icon--measurement {
        background: linear-gradient(135deg, #d299c2 0%, #fef9d7 100%);
        color: var(--pl-brand-pink);
    }

    .mobile-course-item-content {
        flex: 1;
    }

    .mobile-course-item-title {
        font-size: 15px;
        font-weight: 700;
        color: var(--pl-text-main);
        margin-bottom: 4px;
    }

    .mobile-course-item-status {
        font-size: 12px;
        padding: 2px 8px;
        border-radius: 6px;
        display: inline-block;
    }

    .mobile-course-item-status--active {
        background: #e8f5e9;
        color: #2e7d32;
    }

    .mobile-course-item-status--planned {
        background: #f5f5f5;
        color: var(--pl-text-light);
    }

    /* Profile Tab */
    .mobile-profile-item {
        background: white;
        border-radius: 12px;
        padding: 16px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
        margin-bottom: 12px;
        display: flex;
        align-items: center;
        gap: 14px;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .mobile-profile-item:hover {
        transform: translateX(4px);
    }

    .mobile-profile-item-icon {
        width: 40px;
        height: 40px;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 18px;
        background: var(--pl-bg-soft);
        color: var(--pl-brand-pink);
        flex-shrink: 0;
    }

    .mobile-profile-item-text {
        flex: 1;
        font-size: 15px;
        font-weight: 600;
        color: var(--pl-text-main);
    }

    .mobile-profile-item-arrow {
        color: var(--pl-text-light);
        font-size: 12px;
    }

    /* Profile tab — auth states */
    .mobile-profile-auth-card {
        background: white;
        border-radius: 12px;
        padding: 16px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
        margin-bottom: 12px;
        display: flex;
        align-items: center;
        gap: 14px;
    }

    .mobile-profile-avatar {
        width: 48px;
        height: 48px;
        border-radius: 50%;
        background: linear-gradient(135deg, var(--pl-brand-pink-2), var(--pl-brand-pink));
        color: white;
        font-size: 22px;
        font-weight: 700;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    .mobile-profile-username {
        font-size: 16px;
        font-weight: 700;
        color: var(--pl-text-main);
        margin-bottom: 2px;
    }

    .mobile-profile-plan {
        font-size: 12px;
        color: var(--pl-text-muted);
    }

    .mobile-profile-logout-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 12px;
        background: white;
        border: 1px solid var(--pl-border);
        border-radius: 10px;
        color: #e74c3c;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        margin-top: 12px;
        transition: all 0.2s ease;
    }

    .mobile-profile-logout-btn:active {
        background: #fef2f2;
    }

    .mobile-profile-login-card {
        background: white;
        border-radius: 14px;
        padding: 28px 20px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
        text-align: center;
    }

    .mobile-profile-login-icon {
        font-size: 40px;
        color: var(--pl-text-light);
        margin-bottom: 12px;
    }

    .mobile-profile-login-title {
        font-size: 16px;
        font-weight: 700;
        color: var(--pl-text-main);
        margin-bottom: 8px;
    }

    .mobile-profile-login-desc {
        font-size: 13px;
        color: var(--pl-text-muted);
        line-height: 1.5;
        margin-bottom: 20px;
    }

    .mobile-profile-login-actions {
        display: flex;
        gap: 10px;
    }

    .mobile-profile-btn {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        padding: 12px;
        border-radius: 10px;
        font-size: 14px;
        font-weight: 600;
        text-decoration: none;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .mobile-profile-btn--login {
        background: linear-gradient(135deg, var(--pl-brand-pink-2), var(--pl-brand-pink));
        color: white;
    }

    .mobile-profile-btn--register {
        background: white;
        color: var(--pl-brand-pink);
        border: 1.5px solid var(--pl-brand-pink);
    }

    /* ============================================
       Mobile Login Prompt (未登录 home tab 提示卡片)
       ============================================ */

    .mobile-login-prompt {
        background: white;
        border-radius: 16px;
        padding: 48px 24px;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
        text-align: center;
        margin-top: 24px;
    }

    .mobile-login-prompt-icon {
        font-size: 56px;
        color: var(--pl-text-light, #d1d5db);
        margin-bottom: 20px;
    }

    .mobile-login-prompt-title {
        font-size: 20px;
        font-weight: 700;
        color: var(--pl-text-main, #17172f);
        margin-bottom: 10px;
    }

    .mobile-login-prompt-desc {
        font-size: 14px;
        color: var(--pl-text-muted, #6b7280);
        line-height: 1.6;
        margin-bottom: 28px;
    }

    .mobile-login-prompt-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 14px 36px;
        background: linear-gradient(135deg, var(--pl-brand-pink-2, #ec6bd9), var(--pl-brand-pink, #ff5f8f));
        color: white;
        border-radius: 12px;
        font-size: 15px;
        font-weight: 600;
        text-decoration: none;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .mobile-login-prompt-btn:hover {
        transform: scale(1.04);
        box-shadow: 0 6px 18px rgba(255, 95, 143, 0.3);
    }

    /* ============================================
       Recitation Home (背诵岛主页) — Review + Library
       ============================================ */

    /* Review section — compact on mobile */
    .review-section {
        padding: 16px !important;
        border-radius: 14px !important;
        margin-bottom: 16px !important;
        box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06) !important;
    }

    .review-header {
        gap: 8px !important;
        margin-bottom: 6px !important;
    }

    .review-header-icon {
        font-size: 18px !important;
    }

    .review-header-title {
        font-size: 16px !important;
    }

    .review-desc {
        font-size: 12px !important;
        margin-bottom: 12px !important;
    }

    .review-stats {
        gap: 10px !important;
        margin-bottom: 14px !important;
    }

    .review-stat {
        padding: 10px 12px !important;
        border-radius: 8px !important;
    }

    .review-stat-label {
        font-size: 12px !important;
    }

    .review-stat-value {
        font-size: 16px !important;
    }

    .review-btn {
        width: 100% !important;
        padding: 12px !important;
        font-size: 14px !important;
        border-radius: 10px !important;
    }

    /* Library section header */
    .library-section-header {
        margin-bottom: 12px !important;
        gap: 8px !important;
    }

    .library-section-header i {
        font-size: 15px !important;
    }

    .library-section-header h2 {
        font-size: 16px !important;
    }

    /* ============================================
       Subjects Page (考点库) — Compact Layout
       ============================================ */

    /* Compact page header (replaces big hero banner) */
    .page-header {
        margin-bottom: 14px !important;
    }

    .page-header-title {
        font-size: 20px !important;
        margin-bottom: 2px !important;
    }

    .page-header-subtitle {
        font-size: 12px !important;
    }

    /* Legacy hero section compression (for other pages still using it) */
    .hero-section {
        padding: 20px 16px !important;
        border-radius: 14px !important;
        margin-bottom: 16px !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06) !important;
    }

    .hero-icon {
        width: 44px !important;
        height: 44px !important;
        font-size: 20px !important;
        margin-bottom: 12px !important;
    }

    .hero-title {
        font-size: 20px !important;
        margin-bottom: 4px !important;
    }

    .hero-subtitle {
        font-size: 13px !important;
        line-height: 1.4 !important;
    }

    .hero-label {
        padding: 4px 10px !important;
        font-size: 11px !important;
        margin-bottom: 10px !important;
    }

    .hero-meta {
        gap: 10px !important;
        margin-top: 12px !important;
    }

    .hero-meta-item {
        font-size: 12px !important;
        padding: 6px 10px !important;
    }

    /* Back nav compression */
    .back-nav {
        padding: 8px 14px !important;
        font-size: 13px !important;
        margin-bottom: 12px !important;
        border-radius: 8px !important;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06) !important;
    }

    /* Subject grid → compact list */
    .subject-grid {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
        margin-bottom: 16px !important;
    }

    /* Subject card → row item */
    .subject-card {
        flex-direction: row !important;
        padding: 14px 16px !important;
        border-radius: 12px !important;
        align-items: center !important;
        gap: 12px !important;
        box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06) !important;
    }

    .subject-card:hover {
        transform: none !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    }

    .subject-card-icon {
        width: 40px !important;
        height: 40px !important;
        font-size: 18px !important;
        margin-bottom: 0 !important;
        border-radius: 10px !important;
        flex-shrink: 0 !important;
    }

    .subject-card-title {
        font-size: 15px !important;
        margin-bottom: 2px !important;
    }

    .subject-card-count {
        font-size: 12px !important;
        margin-bottom: 0 !important;
    }

    .subject-card-desc {
        display: none !important;
    }

    .subject-card-btn {
        padding: 6px 12px !important;
        font-size: 12px !important;
        border-radius: 8px !important;
        margin-left: auto !important;
        flex-shrink: 0 !important;
        white-space: nowrap !important;
    }

    .subject-card-btn:hover {
        transform: none !important;
    }

    /* Building status card — compact */
    .subject-card-btn--building {
        padding: 6px 10px !important;
        font-size: 11px !important;
    }

    /* ============================================
       Chapter List (学科详情) — Compact Layout
       ============================================ */

    /* Chapter grid → single column list */
    .chapter-grid {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
        margin-bottom: 16px !important;
    }

    /* Chapter card → compact row */
    .chapter-card {
        flex-direction: row !important;
        padding: 14px 16px !important;
        border-radius: 12px !important;
        align-items: center !important;
        box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06) !important;
        text-decoration: none !important;
    }

    .chapter-card:hover {
        transform: none !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    }

    .chapter-card-header {
        margin-bottom: 0 !important;
        flex: 1 !important;
        min-width: 0 !important;
        gap: 10px !important;
    }

    .chapter-card-icon {
        width: 36px !important;
        height: 36px !important;
        font-size: 15px !important;
        border-radius: 9px !important;
        flex-shrink: 0 !important;
    }

    .chapter-card-body {
        min-width: 0 !important;
    }

    .chapter-card-title {
        font-size: 14px !important;
        margin-bottom: 2px !important;
        line-height: 1.3 !important;
    }

    .chapter-card-count {
        font-size: 12px !important;
        margin-bottom: 0 !important;
    }

    /* Hide big stat blocks on mobile */
    .chapter-card-stats {
        display: none !important;
    }

    /* Chapter button → compact arrow */
    .chapter-card-btn {
        width: auto !important;
        padding: 8px 12px !important;
        font-size: 12px !important;
        border-radius: 8px !important;
        flex-shrink: 0 !important;
        margin-left: auto !important;
    }

    .chapter-card-btn:hover {
        transform: none !important;
    }

    /* Mobile chapter card as clickable link */
    .chapter-card--mobile-link {
        cursor: pointer !important;
        display: flex !important;
    }

    .chapter-card--mobile-link:active {
        background: #f9f9f9 !important;
    }

    /* Footer compression */
    .page-footer {
        padding: 20px 16px 80px !important;
        font-size: 12px !important;
    }

    /* Container padding for sub-pages */
    .container {
        padding: 12px 14px 80px !important;
    }

    /* Loading overlay on mobile */
    #loading {
        padding: 40px 20px !important;
    }

    /* ============================================
       Experimental Psychology (实验心理学) — Compact Mobile
       ============================================ */

    /* Body gradient is fine, but reduce container padding */
    .container {
        padding: 12px 14px 80px !important;
        max-width: 100% !important;
    }

    /* Back nav — compact */
    .back-nav {
        padding: 8px 14px !important;
        font-size: 13px !important;
        margin-bottom: 12px !important;
        border-radius: 8px !important;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1) !important;
    }

    /* Header card — compact but keep white background for readability */
    .header-card {
        padding: 16px !important;
        margin-bottom: 12px !important;
        border-radius: 14px !important;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1) !important;
    }

    .header-brand {
        margin-bottom: 6px !important;
        gap: 10px !important;
    }

    .header-brand i {
        font-size: 22px !important;
    }

    .header-title {
        font-size: 20px !important;
    }

    .header-subtitle {
        font-size: 12px !important;
        line-height: 1.4 !important;
        margin-bottom: 10px !important;
    }

    /* Stats row → inline chips */
    .stats-row {
        display: flex !important;
        gap: 6px !important;
        margin-top: 8px !important;
        flex-wrap: nowrap !important;
    }

    .stat-card {
        border-radius: 8px !important;
        padding: 8px 10px !important;
        flex: 1 !important;
        text-align: center !important;
    }

    .stat-icon {
        display: none !important;
    }

    .stat-label {
        font-size: 10px !important;
        margin-bottom: 2px !important;
    }

    .stat-value {
        font-size: 15px !important;
    }

    /* Textbook badge — compact */
    .textbook-badge {
        padding: 6px 12px !important;
        font-size: 11px !important;
        border-radius: 8px !important;
        margin-top: 8px !important;
    }

    .textbook-badge i {
        font-size: 12px !important;
    }

    /* Hero card — compact, stack layout */
    .hero-card {
        padding: 14px 16px !important;
        border-radius: 12px !important;
        margin-bottom: 12px !important;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15) !important;
    }

    .hero-card::before {
        display: none !important;
    }

    .hero-card-content {
        gap: 10px !important;
        flex-wrap: nowrap !important;
    }

    .hero-left {
        gap: 10px !important;
        min-width: 0 !important;
        flex: 1 !important;
    }

    .hero-icon {
        width: 36px !important;
        height: 36px !important;
        font-size: 16px !important;
        border-radius: 9px !important;
        flex-shrink: 0 !important;
    }

    .hero-title {
        font-size: 15px !important;
        margin-bottom: 2px !important;
    }

    .hero-subtitle {
        font-size: 11px !important;
    }

    /* Hide the detailed lesson preview on mobile */
    .hero-middle {
        display: none !important;
    }

    .hero-btn {
        padding: 10px 14px !important;
        font-size: 13px !important;
        border-radius: 8px !important;
        flex-shrink: 0 !important;
    }

    /* Chapter tabs — compact horizontal scroll */
    .chapter-tabs {
        padding: 10px 12px !important;
        border-radius: 12px !important;
        margin-bottom: 12px !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06) !important;
    }

    .section-header {
        padding: 6px 0 !important;
        margin-bottom: 6px !important;
    }

    .section-title {
        font-size: 13px !important;
    }

    .section-lesson-count {
        font-size: 11px !important;
        padding: 3px 8px !important;
    }

    .tab-btn {
        padding: 8px 14px !important;
        font-size: 12px !important;
        border-radius: 8px !important;
    }

    /* Lessons grid → single column */
    .lessons-grid {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }

    /* Lesson card → compact COLUMN layout (not row!) */
    .lesson-card {
        flex-direction: column !important;
        padding: 14px !important;
        border-radius: 10px !important;
        align-items: flex-start !important;
        gap: 6px !important;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06) !important;
        border: none !important;
    }

    .lesson-card:hover {
        transform: none !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    }

    .lesson-number {
        padding: 3px 8px !important;
        font-size: 10px !important;
        border-radius: 5px !important;
        margin-bottom: 0 !important;
    }

    .lesson-title {
        font-size: 15px !important;
        margin-bottom: 0 !important;
        line-height: 1.4 !important;
        width: 100% !important;
    }

    .lesson-chapter {
        font-size: 11px !important;
        margin-bottom: 4px !important;
    }

    .lesson-btn {
        padding: 8px 14px !important;
        font-size: 12px !important;
        border-radius: 6px !important;
        align-self: flex-end !important;
    }

    /* Footer — compact */
    .page-footer {
        padding: 20px 16px 80px !important;
        font-size: 11px !important;
    }
}

/* ============================================
   PsyLab Mobile Home — wrapped in its own media query
   to avoid leaking styles to desktop viewports.
   ============================================ */
@media (max-width: 599px) {
    .psylab-mobile-home {
        padding: 0 14px 100px;
        min-height: 100vh;
        background: #f7f8fa;
        overflow-x: hidden;
    }

    /* Top bar */
    .psylab-mobile-topbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 12px 0;
        position: sticky;
        top: 0;
        z-index: 100;
        background: #f7f8fa;
    }

    .psylab-mobile-brand {
        font-size: 16px;
        font-weight: 700;
        color: #374151;
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .psylab-mobile-brand i {
        color: #667eea;
        font-size: 16px;
    }

    .psylab-mobile-cross-link-bar {
        padding: 0 0 8px;
        background: #f7f8fa;
    }

    .psylab-mobile-cross-link {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        font-size: 12px;
        color: #9ca3af;
        text-decoration: none;
        padding: 4px 8px;
        border-radius: 4px;
    }

    .psylab-mobile-cross-link i {
        font-size: 10px;
    }

    .psylab-mobile-cross-link:active {
        color: #667eea;
    }

    .psylab-mobile-auth {
        flex-shrink: 0;
    }

    .psylab-mobile-login-link {
        font-size: 13px;
        color: #3498db;
        text-decoration: none;
        font-weight: 600;
        padding: 6px 12px;
        border: 1.5px solid #3498db;
        border-radius: 6px;
    }

    .psylab-mobile-user-pill {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        font-size: 12px;
        color: #555;
        text-decoration: none;
        padding: 5px 10px;
        background: white;
        border-radius: 16px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    }

    /* Intro card */
    .psylab-mobile-intro {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        border-radius: 14px;
        padding: 20px 18px;
        margin-bottom: 14px;
        color: white;
        text-align: center;
    }

    .psylab-mobile-intro-icon {
        font-size: 28px;
        margin-bottom: 8px;
        opacity: 0.9;
    }

    .psylab-mobile-intro-title {
        font-size: 20px;
        font-weight: 700;
        margin-bottom: 6px;
    }

    .psylab-mobile-intro-desc {
        font-size: 13px;
        opacity: 0.92;
        line-height: 1.5;
        margin-bottom: 4px;
    }

    .psylab-mobile-intro-hint {
        font-size: 11px;
        opacity: 0.7;
    }

    /* Entry cards */
    .psylab-mobile-card {
        display: flex;
        align-items: center;
        gap: 12px;
        background: white;
        border-radius: 12px;
        padding: 16px 14px;
        margin-bottom: 10px;
        text-decoration: none;
        color: inherit;
        box-shadow: 0 1px 4px rgba(0,0,0,0.06);
        transition: box-shadow 0.2s;
        flex-wrap: wrap;
    }

    .psylab-mobile-card:active {
        box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    }

    .psylab-mobile-card--primary {
        border-left: 4px solid #3498db;
    }

    .psylab-mobile-card--secondary {
        border-left: 4px solid #667eea;
    }

    .psylab-mobile-card--topics {
        border-left: 4px solid #9b59b6;
        position: relative;
    }

    .psylab-mobile-card--topics .psylab-mobile-card-arrow {
        display: none;
    }

    .psylab-mobile-card-icon {
        width: 40px;
        height: 40px;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 18px;
        flex-shrink: 0;
        color: white;
    }

    .psylab-mobile-card-icon--scales {
        background: linear-gradient(135deg, #3498db, #2980b9);
    }

    .psylab-mobile-card-icon--experiments {
        background: linear-gradient(135deg, #667eea, #764ba2);
    }

    .psylab-mobile-card-icon--topics {
        background: linear-gradient(135deg, #9b59b6, #8e44ad);
    }

    .psylab-mobile-card-text {
        flex: 1;
        min-width: 0;
    }

    .psylab-mobile-card-text h2 {
        font-size: 15px;
        font-weight: 700;
        color: #17172f;
        margin-bottom: 3px;
    }

    .psylab-mobile-card-text p {
        font-size: 12px;
        color: #6b7280;
        line-height: 1.4;
        margin: 0;
    }

    .psylab-mobile-card-arrow {
        font-size: 12px;
        color: #9ca3af;
        flex-shrink: 0;
    }

    /* Topic sub-links */
    .psylab-mobile-topic-links {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 0;
        margin-top: 10px;
        border-top: 1px solid #f0f0f0;
        padding-top: 8px;
    }

    .psylab-mobile-topic-link {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 10px 8px;
        font-size: 13px;
        color: #374151;
        text-decoration: none;
        border-bottom: 1px solid #f8f8f8;
    }

    .psylab-mobile-topic-link:last-child {
        border-bottom: none;
    }

    .psylab-mobile-topic-link i:first-child {
        width: 18px;
        text-align: center;
        color: #9b59b6;
        font-size: 12px;
    }

    .psylab-mobile-topic-link .fa-chevron-right {
        margin-left: auto;
        font-size: 10px;
        color: #9ca3af;
    }

    /* Workspace hint */
    .psylab-mobile-workspace-hint {
        background: #f0f2f5;
        border-radius: 10px;
        padding: 16px 14px;
        margin-top: 16px;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 10px;
    }

    .psylab-mobile-workspace-icon {
        width: 36px;
        height: 36px;
        border-radius: 8px;
        background: #ddd;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 16px;
        color: #888;
        flex-shrink: 0;
    }

    .psylab-mobile-workspace-text {
        flex: 1;
        min-width: 0;
    }

    .psylab-mobile-workspace-text h3 {
        font-size: 13px;
        font-weight: 600;
        color: #555;
        margin-bottom: 2px;
    }

    .psylab-mobile-workspace-text p {
        font-size: 11px;
        color: #888;
        margin: 0;
        line-height: 1.4;
    }

    .psylab-mobile-workspace-btn {
        display: block;
        width: 100%;
        text-align: center;
        padding: 10px;
        background: white;
        color: #667eea;
        border: 1.5px solid #667eea;
        border-radius: 8px;
        font-size: 13px;
        font-weight: 600;
        text-decoration: none;
        margin-top: 4px;
        cursor: pointer;
    }

    /* Workspace guide modal */
    .psylab-ws-modal {
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        z-index: 9999;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 20px;
    }

    .psylab-ws-modal-overlay {
        position: absolute;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0, 0, 0, 0.5);
    }

    .psylab-ws-modal-card {
        position: relative;
        background: white;
        border-radius: 16px;
        padding: 28px 24px;
        max-width: 360px;
        width: 100%;
        text-align: center;
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    }

    .psylab-ws-modal-icon {
        width: 52px;
        height: 52px;
        border-radius: 50%;
        background: #f0f2f5;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 22px;
        color: #667eea;
        margin: 0 auto 14px;
    }

    .psylab-ws-modal-title {
        font-size: 17px;
        font-weight: 700;
        color: #17172f;
        margin-bottom: 8px;
    }

    .psylab-ws-modal-desc {
        font-size: 13px;
        color: #6b7280;
        line-height: 1.6;
        margin-bottom: 10px;
    }

    .psylab-ws-modal-hint {
        font-size: 12px;
        color: #9ca3af;
        margin-bottom: 20px;
    }

    .psylab-ws-modal-hint i {
        color: #f59e0b;
        margin-right: 4px;
    }

    .psylab-ws-modal-actions {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .psylab-ws-modal-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        padding: 12px;
        border-radius: 10px;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        border: none;
        transition: all 0.2s;
    }

    .psylab-ws-modal-btn--copy {
        background: linear-gradient(135deg, #667eea, #764ba2);
        color: white;
    }

    .psylab-ws-modal-btn--copy:active {
        opacity: 0.85;
    }

    .psylab-ws-modal-btn--back {
        background: #f0f2f5;
        color: #555;
    }

    .psylab-ws-modal-btn--back:active {
        background: #e5e7eb;
    }

    /* ============================================
       Workspace Mobile Intercept
       Visibility controlled by JS (html.ws-is-mobile),
       not by media query — avoids CSS cascade issues.
       ============================================ */

    .ws-mobile-intercept {
        min-height: 100vh;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 32px 24px;
        text-align: center;
        background: #f7f8fa;
    }

    .ws-mobile-intercept-icon {
        width: 64px;
        height: 64px;
        border-radius: 50%;
        background: linear-gradient(135deg, #667eea, #764ba2);
        color: white;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 28px;
        margin-bottom: 20px;
    }

    .ws-mobile-intercept-title {
        font-size: 18px;
        font-weight: 700;
        color: #17172f;
        margin-bottom: 10px;
        line-height: 1.4;
    }

    .ws-mobile-intercept-desc {
        font-size: 13px;
        color: #6b7280;
        line-height: 1.6;
        margin-bottom: 28px;
        max-width: 320px;
    }

    .ws-mobile-intercept-actions {
        display: flex;
        flex-direction: column;
        gap: 10px;
        width: 100%;
        max-width: 300px;
    }

    .ws-mobile-intercept-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 14px 20px;
        border-radius: 10px;
        font-size: 14px;
        font-weight: 600;
        text-decoration: none;
        cursor: pointer;
        border: none;
        transition: all 0.2s;
    }

    .ws-mobile-intercept-btn--primary {
        background: linear-gradient(135deg, #667eea, #764ba2);
        color: white;
    }

    .ws-mobile-intercept-btn--secondary {
        background: white;
        color: #667eea;
        border: 1.5px solid #667eea;
    }

    .ws-mobile-intercept-btn:active {
        opacity: 0.85;
    }
}

/* Hide mobile elements on desktop/tablet */
@media (min-width: 600px) {
    .mobile-only {
        display: none !important;
    }

    /* Show desktop-only elements — block by default */
    .desktop-only {
        display: block !important;
    }
    /* nav elements need flex, not block */
    nav.desktop-only {
        display: flex !important;
    }
}

/* ============================================
   Lab Page Mobile/Desktop Root Isolation
   Two root containers: .lab-mobile-root and .lab-desktop-root.
   Only one is visible at any viewport width — never both.
   ============================================ */

/* Base: hide mobile root outside any media query (desktop-first default) */
.lab-mobile-root {
    display: none !important;
}

/* Mobile viewport (< 600px): show mobile root, hide desktop root */
@media (max-width: 599px) {
    .lab-mobile-root {
        display: block !important;
    }
    .lab-desktop-root {
        display: none !important;
    }
}

/* Desktop viewport (≥ 600px): hide mobile root, show desktop root */
@media (min-width: 600px) {
    .lab-mobile-root {
        display: none !important;
    }
    .lab-desktop-root {
        display: block !important;
    }
}

/* ============================================
   Module Pages — Mobile Compact Layout
   Applies to: scales, classic-experiments, future module index pages.
   Namespace: .psylab-module-*
   ============================================ */

/* Base: hide mobile module header on all viewports by default */
.psylab-module-mobile-header {
    display: none;
}

@media (max-width: 599px) {
    /* ── Show mobile header, hide PC hero ── */
    .psylab-module-mobile-header {
        display: block !important;
        position: sticky;
        top: 0;
        z-index: 200;
        background: linear-gradient(180deg, #f0f1ff 0%, #f7f8fc 100%);
        padding: 10px 14px 0;
        border-bottom: 1px solid #e4e7f0;
    }

    .hero-shell--catalog,
    .list-page-header {
        display: none !important;
    }

    /* Hide desktop hero on scale detail pages (uses .hero-shell without --catalog) */
    .psylab-detail-mobile-header ~ .container .hero-shell {
        display: none !important;
    }
    .psylab-detail-mobile-header ~ .container .hero-sticky-bar {
        display: none !important;
    }

    /* Hide platform nav inside module pages on mobile */
    .platform-nav-container {
        display: none !important;
    }

    /* Hide desktop-rendered category sections when mobile header is active
       (mobile JS renders compact lists instead, inside #measurementScalesContent) */
    .psylab-module-mobile-header ~ .container .category-section {
        display: none !important;
    }

    /* ── Back link ── */
    .psylab-module-back {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        font-size: 13px;
        color: #667eea;
        text-decoration: none;
        font-weight: 500;
        padding: 2px 0 6px;
    }
    .psylab-module-back:active { opacity: 0.6; }

    /* ── Title + desc ── */
    .psylab-module-title {
        font-size: 18px;
        font-weight: 700;
        color: #1f2937;
        margin: 0 0 2px;
        line-height: 1.3;
    }
    .psylab-module-title i {
        font-size: 16px;
        color: #667eea;
        margin-right: 4px;
    }
    .psylab-module-desc {
        font-size: 12px;
        color: #9ca3af;
        margin: 0 0 10px;
        line-height: 1.4;
    }

    /* ── Search box ── */
    .psylab-module-search-wrap {
        position: relative;
        margin-bottom: 10px;
    }
    .psylab-module-search-icon {
        position: absolute;
        left: 10px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 12px;
        color: #adb5bd;
        pointer-events: none;
    }
    .psylab-module-search {
        display: block;
        width: 100%;
        height: 36px;
        padding: 0 12px 0 30px;
        font-size: 13px;
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        background: #f9fafb;
        color: #374151;
        outline: none;
        box-sizing: border-box;
        -webkit-appearance: none;
    }
    .psylab-module-search:focus {
        border-color: #667eea;
        background: #fff;
    }
    .psylab-module-search::placeholder {
        color: #adb5bd;
    }

    /* ── Tab bar ── */
    .psylab-module-tabs {
        display: flex;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 6px;
        padding: 0 0 10px;
        scrollbar-width: none;
    }
    .psylab-module-tabs::-webkit-scrollbar {
        display: none;
    }
    .psylab-module-tab {
        flex-shrink: 0;
        padding: 6px 14px;
        font-size: 13px;
        font-weight: 500;
        color: #6b7280;
        background: #f3f4f6;
        border: none;
        border-radius: 18px;
        cursor: pointer;
        white-space: nowrap;
        transition: all 0.15s ease;
        -webkit-tap-highlight-color: transparent;
    }
    .psylab-module-tab.active {
        color: #fff;
        background: #667eea;
    }
    .psylab-module-tab:active {
        opacity: 0.8;
    }

    /* ── Module page body background ── */
    body:has(.psylab-module-mobile-header) {
        background: #f4f5f9 !important;
    }
    /* Fallback for browsers without :has() */
    .psylab-module-mobile-header ~ .container {
        background: #f4f5f9 !important;
    }

    /* ── Content area ── */
    .psylab-module-mobile-header ~ .container .main-content {
        padding: 0 14px;
    }
    .psylab-module-mobile-header ~ .container .category-section {
        margin-bottom: 16px;
    }
    .psylab-module-mobile-header ~ .container .category-header-line {
        padding: 10px 0 8px;
        margin-bottom: 8px;
        border-bottom: 1px solid #f0f0f0;
    }
    .psylab-module-mobile-header ~ .container .category-header-icon {
        width: 28px;
        height: 28px;
        border-radius: 6px;
    }
    .psylab-module-mobile-header ~ .container .category-header-icon i {
        font-size: 0.85rem;
    }
    .psylab-module-mobile-header ~ .container .category-header-title {
        font-size: 1rem;
    }
    .psylab-module-mobile-header ~ .container .category-header-desc {
        display: none;
    }
    .psylab-module-mobile-header ~ .container .category-header-count {
        font-size: 0.75rem;
        padding: 3px 8px;
    }

    /* ── Compact card list ── */
    .psylab-module-mobile-header ~ .container .scales-grid {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }
    .psylab-module-mobile-header ~ .container .scale-card {
        height: auto !important;
        min-height: 64px;
        padding: 12px 14px !important;
        border-radius: 10px;
        flex-direction: row !important;
        align-items: center;
        gap: 8px;
    }
    .psylab-module-mobile-header ~ .container .scale-card:hover {
        transform: none;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
    }
    .psylab-module-mobile-header ~ .container .scale-card-content {
        flex: 1;
        min-width: 0;
    }
    .psylab-module-mobile-header ~ .container .scale-card-title {
        font-size: 14px;
        font-weight: 600;
        margin-bottom: 4px;
        -webkit-line-clamp: 1;
    }
    .psylab-module-mobile-header ~ .container .scale-card-description {
        display: none;
    }
    .psylab-module-mobile-header ~ .container .scale-card-footer {
        border-top: none;
        padding-top: 0;
        margin-top: 0;
        flex-direction: column;
        align-items: flex-end;
        gap: 4px;
        flex-shrink: 0;
    }
    .psylab-module-mobile-header ~ .container .scale-status {
        font-size: 0.7rem;
        padding: 2px 8px;
    }
    .psylab-module-mobile-header ~ .container .scale-card-action {
        font-size: 0.8rem;
    }

    /* ── Compact list variant (rendered by mobile JS) ── */
    .psylab-compact-list {
        display: flex;
        flex-direction: column;
        gap: 8px;
        padding: 6px 0;
    }
    .psylab-compact-item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 12px 14px;
        background: #fff;
        border-radius: 10px;
        border: 1px solid #e8eaf0;
        box-shadow: 0 1px 3px rgba(102, 126, 234, 0.06);
        text-decoration: none;
        color: inherit;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        transition: border-color 0.15s, box-shadow 0.15s;
    }
    .psylab-compact-item:active {
        border-color: #667eea;
        box-shadow: 0 2px 8px rgba(102, 126, 234, 0.12);
    }
    .psylab-compact-item-main {
        flex: 1;
        min-width: 0;
        padding-right: 10px;
    }
    .psylab-compact-item-title {
        font-size: 14px;
        font-weight: 600;
        color: #1f2937;
        margin-bottom: 4px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .psylab-compact-item-meta {
        font-size: 11px;
        color: #9ca3af;
        display: flex;
        align-items: center;
        gap: 4px;
        flex-wrap: wrap;
    }
    .psylab-compact-item-meta .dot {
        width: 3px;
        height: 3px;
        border-radius: 50%;
        background: #d1d5db;
    }
    .psylab-compact-item-status {
        font-size: 11px;
        padding: 2px 7px;
        border-radius: 4px;
        font-weight: 500;
    }
    .psylab-compact-item-status.runnable {
        color: #059669;
        background: #ecfdf5;
    }
    .psylab-compact-item-status.planned {
        color: #9ca3af;
        background: #f5f5f5;
    }
    .psylab-compact-item-arrow {
        font-size: 12px;
        color: #d1d5db;
        flex-shrink: 0;
    }
    .psylab-compact-item.disabled {
        opacity: 0.6;
        cursor: default;
    }
    .psylab-compact-item.disabled:active {
        border-color: #f0f0f0;
    }

    /* ── Section label for compact list ── */
    .psylab-compact-section-label {
        font-size: 12px;
        font-weight: 600;
        color: #8b8fa8;
        padding: 14px 4px 6px;
        display: flex;
        align-items: center;
        gap: 6px;
        letter-spacing: 0.3px;
    }
    .psylab-compact-section-label i {
        font-size: 12px;
        color: #9ca3af;
    }

    /* ── Empty state ── */
    .psylab-compact-empty {
        text-align: center;
        padding: 40px 20px;
        color: #9ca3af;
        font-size: 13px;
    }
    .psylab-compact-empty i {
        font-size: 24px;
        display: block;
        margin-bottom: 8px;
        opacity: 0.5;
    }

    /* ── Footer compact ── */
    .psylab-module-mobile-header ~ .container .list-page-footer,
    .psylab-module-mobile-header ~ .container .footer {
        padding: 16px 14px !important;
        font-size: 11px !important;
        margin-top: 16px !important;
    }

    /* ============================================
       Scale Detail Pages — Mobile Compact
       (EPQ, BDI, STAI, etc.)
       ============================================ */

    /* Detail header: white bg (not gradient), blends with cards */
    .psylab-detail-mobile-header {
        background: #fff !important;
        border-bottom: none !important;
        padding: 10px 16px 14px !important;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    }

    /* Action buttons row */
    .psylab-detail-mobile-actions {
        display: flex;
        gap: 8px;
        margin-top: 10px;
    }

    .psylab-detail-mobile-btn {
        flex: 1;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        padding: 10px 14px;
        border-radius: 8px;
        font-size: 13px;
        font-weight: 600;
        text-decoration: none;
        border: none;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        transition: opacity 0.15s;
    }
    .psylab-detail-mobile-btn:active {
        opacity: 0.8;
    }

    .psylab-detail-mobile-btn--primary {
        background: #667eea;
        color: #fff;
    }

    .psylab-detail-mobile-btn--secondary {
        background: #f3f4f6;
        color: #374151;
        border: 1px solid #e5e7eb;
    }

    /* ── Tightened content cards ── */
    .psylab-detail-mobile-header ~ .container .scale-template {
        padding: 12px 14px !important;
    }

    .psylab-detail-mobile-header ~ .container .template-info,
    .psylab-detail-mobile-header ~ .container .section {
        padding: 16px 14px !important;
        margin-bottom: 12px !important;
        border-radius: 10px !important;
        border-left-width: 4px !important;
    }

    .psylab-detail-mobile-header ~ .container .section-title {
        font-size: 1.1rem !important;
        margin-bottom: 12px !important;
        gap: 6px !important;
    }

    .psylab-detail-mobile-header ~ .container .info-grid {
        gap: 10px !important;
        margin-top: 10px !important;
    }

    .psylab-detail-mobile-header ~ .container .info-card {
        padding: 14px 12px !important;
        border-radius: 8px !important;
    }

    .psylab-detail-mobile-header ~ .container .info-card-title {
        font-size: 1rem !important;
        margin-bottom: 8px !important;
    }

    .psylab-detail-mobile-header ~ .container .info-content {
        font-size: 0.9rem !important;
    }

    .psylab-detail-mobile-header ~ .container .info-content ul,
    .psylab-detail-mobile-header ~ .container .info-content ol {
        padding-left: 18px !important;
    }

    .psylab-detail-mobile-header ~ .container .info-content li {
        margin-bottom: 4px !important;
    }

    .psylab-detail-mobile-header ~ .container .feature-tags {
        gap: 6px !important;
        margin-top: 10px !important;
    }

    .psylab-detail-mobile-header ~ .container .feature-tag {
        padding: 5px 10px !important;
        font-size: 0.78rem !important;
    }

    /* Usage steps tightened */
    .psylab-detail-mobile-header ~ .container .usage-step {
        padding: 12px 12px 12px 46px !important;
        margin-bottom: 8px !important;
        border-radius: 8px !important;
    }

    .psylab-detail-mobile-header ~ .container .usage-step:before {
        left: 12px !important;
        top: 12px !important;
        width: 24px !important;
        height: 24px !important;
        font-size: 0.8rem !important;
    }

    .psylab-detail-mobile-header ~ .container .step-title {
        font-size: 0.95rem !important;
        margin-bottom: 4px !important;
    }

    .psylab-detail-mobile-header ~ .container .step-detail {
        font-size: 0.85rem !important;
    }

    /* Footer tightened */
    .psylab-detail-mobile-header ~ .container .footer {
        padding: 16px 14px !important;
        font-size: 11px !important;
    }

    /* ============================================
       Desktop Workspace Modal (mobile-triggered)
       ============================================ */
    .psylab-desktop-modal {
        position: fixed;
        inset: 0;
        z-index: 9999;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 20px;
    }

    .psylab-desktop-modal-overlay {
        position: absolute;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
    }

    .psylab-desktop-modal-card {
        position: relative;
        background: #fff;
        border-radius: 14px;
        padding: 28px 22px 22px;
        max-width: 340px;
        width: 100%;
        text-align: center;
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
        animation: psylabModalIn 0.2s ease;
    }

    @keyframes psylabModalIn {
        from { opacity: 0; transform: translateY(20px); }
        to   { opacity: 1; transform: translateY(0); }
    }

    .psylab-desktop-modal-icon {
        width: 48px;
        height: 48px;
        border-radius: 12px;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        display: flex;
        align-items: center;
        justify-content: center;
        margin: 0 auto 14px;
    }
    .psylab-desktop-modal-icon i {
        font-size: 20px;
        color: #fff;
    }

    .psylab-desktop-modal-title {
        font-size: 17px;
        font-weight: 700;
        color: #1f2937;
        margin: 0 0 8px;
    }

    .psylab-desktop-modal-desc {
        font-size: 13px;
        color: #6b7280;
        line-height: 1.55;
        margin: 0 0 10px;
    }

    .psylab-desktop-modal-hint {
        font-size: 12px;
        color: #9ca3af;
        line-height: 1.5;
        margin: 0 0 18px;
        display: flex;
        align-items: flex-start;
        gap: 5px;
        text-align: left;
    }
    .psylab-desktop-modal-hint i {
        color: #f59e0b;
        margin-top: 2px;
        flex-shrink: 0;
    }

    .psylab-desktop-modal-actions {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .psylab-desktop-modal-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        padding: 11px 16px;
        border-radius: 8px;
        font-size: 13px;
        font-weight: 600;
        border: none;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    .psylab-desktop-modal-btn:active {
        opacity: 0.8;
    }

    .psylab-desktop-modal-btn--copy {
        background: #667eea;
        color: #fff;
    }

    .psylab-desktop-modal-btn--back {
        background: #f3f4f6;
        color: #374151;
    }
}
