/* Mobile navigation and categories; preserve the production Vue application. */
.workspace .miniapp-nav, .workspace .welcome-toggle { display: none; }

@media (max-width: 1180px), (max-width: 1366px) and (pointer: coarse) {
  :root body .workspace { --workspace-bottom-space: calc(82px + env(safe-area-inset-bottom, 0px)); }
  :root body .workspace .workspace-body { display: block; min-height: calc(100dvh - 60px); }
  :root body .workspace .sidebar,
  :root body .workspace .sidebar.collapsed { display: none; }
  :root body .workspace .content {
    width: 100%; max-width: 100%; min-width: 0; overflow: visible;
    padding-bottom: calc(var(--workspace-bottom-space) + 24px);
  }
  :root body .workspace .agents-page .welcome,
  :root body .workspace .welcome-toggle { display: none; }
  :root body .workspace .filter-bar {
    display: flex; flex-direction: column; align-items: stretch; gap: 10px;
    border: 0; border-radius: 0; background: none; box-shadow: none;
    padding: 0; margin-bottom: 18px;
  }
  :root body .workspace .cat-scroll {
    display: flex; flex: none; width: 100%; min-width: 0; flex-wrap: wrap;
    gap: 2px 10px; overflow: visible; padding: 0; scrollbar-width: none;
  }
  :root body .workspace .cat-chip,
  :root body .workspace .cat-chip:hover,
  :root body .workspace .cat-chip.active {
    display: inline-flex; flex: 0 0 auto; align-items: center; gap: 3px;
    min-height: 40px; max-width: 100%; padding: 4px 0; border: 0; border-radius: 0;
    background: transparent; box-shadow: none; transform: none; filter: none; transition: color .15s ease;
    font-size: 12px; line-height: 1.5; white-space: normal; text-align: left;
    color: var(--text-secondary);
  }
  :root body .workspace .cat-chip svg { flex-shrink: 0; }
  :root body .workspace .cat-chip.active,
  :root body .workspace .cat-chip:hover { color: var(--color-primary); }
  :root body .workspace .cat-chip.active { font-weight: 700; }
  :root body .workspace .cat-chip:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
  :root body .workspace .cat-count { display: none; }
  :root body .workspace .search-input { width: 100%; min-width: 0; margin-top: 0; }
  :root body .workspace .miniapp-nav {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: end;
    position: fixed; inset: auto 0 0; z-index: 480; height: var(--workspace-bottom-space);
    padding: 8px max(6px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
    border-top: 1px solid var(--border); background: var(--bg-base);
    box-shadow: 0 -5px 24px rgba(0, 0, 0, .12); overflow: visible;
  }
  :root body .workspace .miniapp-link {
    display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
    gap: 5px; min-width: 0; min-height: 60px; padding: 3px 0;
    color: var(--text-secondary); text-decoration: none; font-size: 11px; line-height: 1.4;
    -webkit-tap-highlight-color: transparent;
  }
  :root body .workspace .miniapp-icon { display: grid; place-items: center; width: 28px; height: 28px; }
  :root body .workspace .miniapp-icon svg { width: 23px; height: 23px; }
  :root body .workspace .miniapp-label { white-space: nowrap; }
  :root body .workspace .miniapp-link.active { color: var(--color-primary); font-weight: 700; }
  :root body .workspace .miniapp-link:focus-visible { outline: 2px solid var(--color-primary); outline-offset: -2px; border-radius: 10px; }
  :root body .workspace .miniapp-ai .miniapp-icon {
    width: 44px; height: 44px; border-radius: 16px;
    background: linear-gradient(140deg, #23efba, #36bde3);
    color: #053b40; box-shadow: 0 3px 14px rgba(0, 229, 160, .24);
  }
  :root body .workspace .miniapp-ai .miniapp-icon svg { width: 29px; height: 29px; }
  :root body .workspace .miniapp-ai { gap: 4px; color: var(--text-primary); }
  :root body .workspace .miniapp-ai.active { color: var(--color-primary); }
  :root body .workspace .profile-drawer,
  :root body .workspace.side-collapsed .profile-drawer {
    left: max(12px, env(safe-area-inset-left)); top: max(12px, env(safe-area-inset-top));
    bottom: max(12px, env(safe-area-inset-bottom)); width: min(520px, calc(100vw - 24px));
  }
  :root body .workspace .sw-tab { bottom: calc(var(--workspace-bottom-space) + 20px); }
  :root body .workspace .sw-panel { bottom: calc(var(--workspace-bottom-space) + 12px); max-height: calc(100dvh - var(--workspace-bottom-space) - 96px); }
}

@media (max-width: 700px) {
  :root body .workspace .agents-page .grid,
  :root body .workspace .channel-page .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  :root body .workspace .agent-card { min-width: 0; padding: 12px 10px; }
  :root body .workspace .agent-card .card-top { gap: 4px; flex-wrap: wrap; min-height: 40px; }
  :root body .workspace .agent-card .agent-icon-tile { width: 40px !important; height: 40px !important; }
  :root body .workspace .agent-card .agent-icon-tile svg { width: 23px; height: 23px; }
  :root body .workspace .agent-card .badge { font-size: 10px; padding: 3px 6px; }
  :root body .workspace .agent-card .agent-cat { font-size: 11px; margin-top: 12px; overflow-wrap: anywhere; }
  :root body .workspace .agent-card .agent-name { font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
  :root body .workspace .agent-card .agent-desc { font-size: 11px; min-height: 35px; overflow-wrap: anywhere; }
  :root body .workspace .agent-card .agent-tags { gap: 4px; margin-top: 8px; }
  :root body .workspace .agent-card .tag { font-size: 10px; padding: 3px 6px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  :root body .workspace .agent-card .card-bottom { gap: 5px; flex-wrap: wrap; margin-top: auto; padding-top: 10px; }
  :root body .workspace .agent-card .price,
  :root body .workspace .agent-card .open-link { font-size: 11px; }
  :root body .workspace .agent-card .quality-line { flex-wrap: wrap; gap: 3px; }
  :root body .workspace .agent-card .quality-stars { font-size: 11px; letter-spacing: 0; }
}

/* Refinements for the landing page, academy, gallery and full personal center. */
@media (max-width: 1180px), (max-width: 1366px) and (pointer: coarse) {
  :root body .home .nav-inner { padding: 12px 24px; gap: 12px; }
  :root body .home .brand { gap: 9px; min-width: 0; }
  :root body .home .brand-name { flex-direction: column; align-items: flex-start; gap: 2px; }
  :root body .home .brand-word { font-size: 20px !important; line-height: 1.15; }
  :root body .home .brand-cn { font-size: 13px !important; line-height: 1.3; }
  :root body .home .brand .n-logo { width: 44px; height: 44px; flex-shrink: 0; }
  :root body .home .nav-actions { gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
  :root body .home .hero { width: 100%; max-width: 900px; padding: 56px 24px 36px; }
  :root body .home .hero-title { font-size: clamp(36px, 6vw, 64px); line-height: 1.15; margin-bottom: 14px; }
  :root body .home .t1, :root body .home .t2 { display: block; margin-left: 0; }
  :root body .home .t1 { font-weight: 900; }
  :root body .home .t2 { font-weight: 800; }
  :root body .home .hero-sub { font-size: clamp(23px, 3.6vw, 32px); line-height: 1.4; margin: 0 0 18px; }
  :root body .home .hero-desc { width: 100%; max-width: 560px; margin: 0 auto 8px; font-size: 14px; line-height: 1.8; text-wrap: balance; }
  :root body .home .hero-slogan { margin-bottom: 24px; font-size: 13px; letter-spacing: .04em; }
  :root body .home .hero-buttons { gap: 12px; }
  :root body .home .hero-buttons .btn { min-height: 48px; padding: 12px 26px; font-size: 15px; }
  :root body .home .hero-orbit { display: none; }
  :root body .home .features { gap: 14px; grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 1080px; padding: 12px 24px 40px; }
  :root body .home .feature-card { min-width: 0; padding: 22px 18px; }
  :root body .home .feature-card h3 { font-size: 17px; margin-bottom: 8px; }
  :root body .home .feature-card p { font-size: 13px; line-height: 1.8; overflow-wrap: anywhere; }
  :root body .home .footer { padding: 22px 16px; font-size: 12px; }

  :root body .workspace[data-mobile-page="classes"] .page-head { margin-bottom: 16px; }
  :root body .workspace[data-mobile-page="classes"] .page-head .row { align-items: flex-start; }
  :root body .workspace[data-mobile-page="classes"] .page-head .row > svg { flex-shrink: 0; margin-top: 3px; }
  :root body .workspace[data-mobile-page="classes"] .page-head h2 { font-size: 22px; }
  :root body .workspace[data-mobile-page="classes"] .page-head p { font-size: 13px; line-height: 1.7; margin-top: 6px; }
  :root body .workspace[data-mobile-page="classes"] .filter-bar {
    flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 18px;
    padding: 0; margin-bottom: 18px;
  }
  :root body .workspace[data-mobile-page="classes"] .filter-bar .cat-chip { min-height: 44px; font-size: 13px; -webkit-tap-highlight-color: transparent; }
  :root body .workspace[data-mobile-page="classes"] .filter-bar .input {
    flex: 0 0 100%; width: 100% !important; margin: 6px 0 0 !important; min-height: 44px;
  }
  :root body .workspace[data-mobile-page="classes"] .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  :root body .workspace[data-mobile-page="classes"] .lesson-card { min-width: 0; }
  :root body .workspace[data-mobile-page="classes"] .lesson-body { padding: 16px; }

  :root body .workspace .inspiration-page .gallery-head { margin-bottom: 16px; }
  :root body .workspace .inspiration-page .gallery-head h1 { font-size: 22px; }
  :root body .workspace .inspiration-page .gallery-head p { line-height: 1.7; margin-top: 6px; }
  :root body .workspace .inspiration-page .gallery-toolbar {
    display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 12px;
  }
  :root body .workspace .inspiration-page .gallery-filters {
    display: flex; flex: none; min-width: 0; flex-wrap: wrap; gap: 8px; overflow: visible;
  }
  :root body .workspace .inspiration-page .gallery-filters button,
  :root body .workspace .inspiration-page .upload-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 44px; min-height: 44px; padding: 0 14px; border-radius: 12px;
    font-size: 13px; line-height: 1.3; font-weight: 600; white-space: nowrap;
  }
  :root body .workspace .inspiration-page .upload-btn { box-shadow: none; }
  :root body .workspace .inspiration-page .head-actions { justify-content: space-between; gap: 12px; flex-wrap: nowrap; }
  :root body .workspace .inspiration-page .gallery-search { width: 100%; min-width: 0; min-height: 44px; }
  :root body .workspace .profile-page:not(.profile-embedded) .profile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  :root body .workspace .profile-page .sec { min-width: 0; }
  :root body .workspace .profile-page .avatar-row { flex-wrap: wrap; gap: 12px; }
  :root body .workspace .profile-page .avatar-choices { min-width: 0; }
  :root body .workspace .profile-page .between { flex-wrap: wrap; gap: 10px; }
  :root body .workspace .profile-page .ledger-item { gap: 10px; }
  :root body .workspace .profile-page .ledger-item > div { min-width: 0; overflow-wrap: anywhere; }
}

@media (max-width: 700px) {
  :root body .home .nav-inner { padding: 10px 14px; flex-wrap: wrap; gap: 8px; }
  :root body .home .brand { gap: 7px; }
  :root body .home .brand .n-logo { width: 38px; height: 38px; }
  :root body .home .brand-word { font-size: 16px !important; }
  :root body .home .brand-cn { font-size: 11px !important; }
  :root body .home .nav-actions { gap: 6px; }
  :root body .home .nav-actions .icon-btn { width: 36px; height: 36px; display: grid; place-items: center; }
  :root body .home .nav-actions .btn { min-height: 40px; padding: 8px 12px; font-size: 12px; }
  :root body .home .nav-actions .nav-link { font-size: 12px; padding: 10px 2px; }
  :root body .home .hero { padding: 38px 20px 28px; }
  :root body .home .hero-title { font-size: clamp(34px, 9vw, 44px); }
  :root body .home .hero-sub { font-size: clamp(22px, 5.8vw, 27px); margin-bottom: 14px; }
  :root body .home .hero-desc { font-size: 13px; }
  :root body .home .hero-slogan { font-size: 12px; margin-bottom: 22px; }
  :root body .home .hero-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; width: 100%; max-width: 380px; margin: 0 auto; }
  :root body .home .hero-buttons .btn { min-width: 0; min-height: 46px; padding: 10px 8px; font-size: 14px; }
  :root body .home .features { grid-template-columns: minmax(0, 1fr); padding: 8px 14px 28px; gap: 10px; }
  :root body .home .feature-card { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 5px 12px; padding: 18px; }
  :root body .home .feature-tag { grid-column: 2; margin: 0; font-size: 10px; }
  :root body .home .feature-icon { grid-column: 1; grid-row: 1 / 4; margin: 0; align-self: center; }
  :root body .home .feature-card h3 { grid-column: 2; font-size: 16px; margin: 0; }
  :root body .home .feature-card p { grid-column: 2; font-size: 12px; line-height: 1.7; }
  :root body .workspace[data-mobile-page="classes"] .filter-bar { gap: 2px 16px; }
  :root body .workspace[data-mobile-page="classes"] .grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  :root body .workspace .profile-page:not(.profile-embedded) .profile-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  :root body .workspace .profile-page .col { gap: 14px; }
  :root body .workspace .profile-page .recharge-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
