/* ===== 移动端适配（≤768px） ===== */

@media (max-width: 768px) {
  html {
    -webkit-text-size-adjust: 100%;
  }

  body.has-mobile-nav {
    padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px));
  }

  .container,
  .container-narrow {
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
  }

  /* ----- 顶栏 ----- */
  .header-inner {
    height: 52px;
    gap: 10px;
  }

  .logo {
    font-size: 16px;
    gap: 8px;
  }

  .logo .logo-mark {
    width: 26px;
    height: 26px;
    border-radius: 7px;
  }

  .logo .logo-mark::before {
    inset: 7px;
  }

  .logo .logo-text {
    letter-spacing: 0.08em;
  }

  .header-user {
    gap: 8px;
  }

  .points-badge {
    font-size: 11px;
    padding: 5px 10px;
  }

  .nav-link.profile-link {
    display: none;
  }

  /* ----- Hero ----- */
  .hero {
    padding: 28px 0 22px;
  }

  .hero-blob-orange {
    width: 140px;
    height: 110px;
    top: -50px;
    left: -30px;
  }

  .hero-blob-yellow {
    width: 160px;
    height: 95px;
    bottom: -45px;
    left: -40px;
  }

  .hero-blob-green {
    width: 150px;
    height: 130px;
    bottom: -55px;
    right: -40px;
  }

  .hero h1 {
    font-size: 22px;
    line-height: 1.3;
    letter-spacing: -0.35px;
    margin-bottom: 8px;
  }

  .hero p {
    font-size: 13px;
    line-height: 1.5;
    padding: 0 2px;
    margin-bottom: 14px;
  }

  .hero-online {
    margin-top: 12px;
    font-size: 12px;
    padding: 6px 12px;
    gap: 6px;
  }

  .hero-online b {
    font-size: 13px;
    font-weight: 700;
  }

  /* ----- 分类 / 筛选 ----- */
  .pills-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding-top: 12px;
    overflow: visible;
  }

  .pills-toolbar .pills {
    flex: none;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    flex-wrap: wrap;
    overflow: visible;
    padding-top: 0;
    padding-bottom: 2px;
    gap: 7px;
  }

  .filter-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px 0 2px;
    overflow: visible;
  }

  .filter-row .city-pills,
  .filter-row .region-pills,
  .filter-row .price-pills,
  .city-pills,
  .region-pills,
  .price-pills {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: visible;
    padding-top: 0;
    padding-bottom: 2px;
    margin-inline: 0;
    padding-inline: 0;
  }

  .filter-label {
    padding-top: 0;
    min-width: 0;
    font-size: 12px;
  }

  .pills-scroll {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
    margin: 0 -2px;
    padding-left: 2px;
    padding-right: 2px;
  }

  .pills-scroll::-webkit-scrollbar {
    display: none;
  }

  .pill {
    flex-shrink: 0;
    padding: 5px 10px;
    font-size: 12px;
    min-height: 30px;
    line-height: 1.25;
  }

  .pill.pill-premium-link {
    font-size: 12px;
  }

  .today-new {
    width: 100%;
    justify-content: center;
    margin-top: 0;
    padding: 7px 12px;
    font-size: 12px;
    animation: none;
  }

  .today-new-text b {
    font-size: 14px;
    font-weight: 700;
  }

  /* ----- 列表 ----- */
  .section-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin: 18px 0 12px;
  }

  .section-bar h2 {
    font-size: 20px;
  }

  .company-list.company-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .company-list.company-grid .nl-card-media {
    aspect-ratio: 3 / 4;
  }

  .company-list.company-grid .nl-card-name {
    font-size: 14px;
  }

  .company-list.company-grid .nl-card-no {
    font-size: 14px;
  }

  .company-list.company-grid .nl-card-body {
    padding: 8px 10px 10px;
  }

  .company-list.company-grid .nl-card-price,
  .nl-grid .nl-card-price {
    top: 6px;
    right: 6px;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0;
    line-height: 1.25;
  }

  .pagination {
    padding-bottom: 24px;
  }

  .page-btn {
    min-width: 40px;
    height: 40px;
  }

  /* ----- 详情页 ----- */
  .detail-header {
    padding: 18px 0;
  }

  .detail-body {
    padding: 16px 0 calc(120px + env(safe-area-inset-bottom, 0px));
  }

  .detail-header-inner {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 14px;
  }

  .detail-header-inner > div {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .detail-header .logo-shield {
    width: min(180px, 46vw);
    height: min(180px, 46vw);
    margin: 0 auto;
    flex-shrink: 0;
  }

  .detail-header .logo-shield .company-logo,
  .detail-header .company-logo {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
    font-size: 40px;
    border-radius: 16px;
  }

  .detail-header h1 {
    font-size: 20px;
    margin-bottom: 8px;
    line-height: 1.35;
    padding: 0 2px;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .detail-score {
    justify-content: center;
    gap: 6px 8px;
    row-gap: 6px;
  }

  .detail-score .tp-stars {
    flex-shrink: 0;
  }

  .detail-score .big-score {
    font-size: 18px;
  }

  .back-link {
    margin-top: 12px;
    font-size: 13px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  .info-card,
  .summary-card {
    padding: 16px;
    margin-bottom: 14px;
    border-radius: 10px;
  }

  .info-row {
    flex-direction: column;
    gap: 2px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
  }

  .info-row:last-child {
    border-bottom: none;
  }

  .info-row .k {
    min-width: 0;
    font-size: 12px;
    font-weight: 600;
  }

  .info-row-v,
  .info-row-v--price {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.45;
    color: var(--text-mid);
  }

  .info-row-v--price {
    font-weight: 600;
    color: #c0392b;
  }

  .summary-specs {
    grid-template-columns: 1fr 1fr;
    gap: 10px 12px;
  }

  .summary-contact span {
    width: 100%;
    justify-content: center;
  }

  .lock-contact-card {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    padding: 14px;
  }

  .lock-contact-icon {
    margin: 0 auto;
  }

  .unlock-btn--contact {
    width: 100%;
    min-height: 44px;
  }

  .gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .gallery img,
  .gallery .media-shield img,
  .gallery-video-wrap .gallery-video {
    height: 110px;
  }

  .reviews-header h2 {
    font-size: 18px;
  }

  .review-card {
    padding: 14px;
  }

  .review-imgs img,
  .review-imgs .media-shield--zoom {
    width: 76px;
    height: 76px;
  }

  /* ----- 个人中心 ----- */
  .profile-page {
    padding: 16px 0 calc(100px + env(safe-area-inset-bottom, 0px));
  }

  .profile-hero {
    margin: 12px 0 18px;
  }

  .profile-hero h1 {
    font-size: 22px;
  }

  .profile-stats {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .profile-stat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
    padding: 14px 16px;
  }

  .profile-stat-v {
    margin-bottom: 0;
    font-size: 24px;
  }

  .profile-record {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .profile-record-cost {
    align-self: flex-end;
  }

  /* ----- 验证页 ----- */
  .gate {
    padding: 16px;
    align-items: flex-start;
    padding-top: max(24px, env(safe-area-inset-top));
  }

  .gate-card {
    padding: 28px 20px;
    border-radius: 14px;
  }

  .gate-title {
    font-size: 22px;
  }

  .gate-key {
    font-size: 15px;
    letter-spacing: 0.5px;
    padding: 14px 12px;
  }

  .gate-existing {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .gate-existing input {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    font-size: 13px;
  }

  .gate-existing button {
    width: 100%;
    min-height: 44px;
  }

  .gate-enter {
    min-height: 48px;
  }

  /* ----- Lightbox ----- */
  .lightbox {
    padding: 10px;
    padding-top: max(10px, env(safe-area-inset-top));
  }

  .lightbox-close {
    top: max(10px, env(safe-area-inset-top));
    right: 10px;
  }

  .lightbox-prev {
    left: 6px;
    width: 40px;
    height: 40px;
    font-size: 26px;
  }

  .lightbox-next {
    right: 6px;
    width: 40px;
    height: 40px;
    font-size: 26px;
  }

  /* ----- 在线提示（避开底栏 + 客服按钮） ----- */
  .live-online {
    left: 12px;
    right: auto;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    max-width: min(220px, calc(100vw - 24px));
    font-size: 11px;
    padding: 6px 10px;
    white-space: nowrap;
  }

  .live-toasts {
    left: 10px;
    right: 10px;
    bottom: calc(118px + env(safe-area-inset-bottom, 0px));
    max-width: none;
  }

  .footer {
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    font-size: 12px;
    padding-left: 16px;
    padding-right: 16px;
  }

  body.has-mobile-nav .footer {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }

  /* ----- 底部导航 ----- */
  .mobile-tabbar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 95;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -4px 20px rgba(25, 25, 25, 0.06);
  }

  .mobile-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 52px;
    padding: 6px 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-light);
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-tab-icon {
    font-size: 20px;
    line-height: 1;
  }

  .mobile-tab.active {
    color: var(--green-dark);
  }

  .mobile-tab.active .mobile-tab-icon {
    transform: scale(1.05);
  }

  /* ----- 高端页 ----- */
  body.theme-premium.has-mobile-nav {
    padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px));
  }

  .nl-container {
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
  }

  .nl-nav-inner {
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .nl-brand-name {
    font-size: 15px;
  }

  .nl-brand-tag {
    display: none;
  }

  .nl-nav-links {
    display: none;
  }

  .nl-nav-actions {
    margin-left: auto;
    gap: 8px;
  }

  .nl-btn.nl-btn-ghost {
    display: none;
  }

  .nl-points {
    font-size: 12px;
    padding: 6px 12px;
  }

  .nl-hero {
    padding-top: 28px;
    padding-bottom: 32px;
  }

  .nl-display {
    font-size: 36px;
  }

  .nl-lead {
    font-size: 14px;
  }

  .nl-sidebar {
    display: none;
  }

  .nl-layout {
    display: block;
  }

  .nl-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  body.theme-premium .mobile-tabbar {
    background: rgba(12, 12, 14, 0.94);
    border-top-color: var(--nl-border);
  }

  body.theme-premium .mobile-tab {
    color: var(--nl-text-faint);
  }

  body.theme-premium .mobile-tab.active {
    color: var(--nl-gold-soft);
  }

  /* ----- 客服聊天（移动端全屏 + 防输入框放大） ----- */
  #kaplia-widget .k-input-area input,
  #kaplia-widget .k-name-form input,
  #kaplia-widget .k-offline-form input,
  #kaplia-widget .k-offline-form textarea {
    font-size: 16px !important;
  }

  body.has-mobile-nav #kaplia-widget .kaplia-chat-btn {
    bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    right: 12px;
    width: 50px;
    height: 50px;
    font-size: 24px;
  }

  body.has-mobile-nav #kaplia-widget .kaplia-chat-box {
    bottom: calc(122px + env(safe-area-inset-bottom, 0px));
    right: 10px;
    left: 10px;
    width: auto;
    max-width: none;
    height: min(460px, calc(100dvh - 150px));
  }

  body.has-mobile-nav #kaplia-widget.k-chat-active .kaplia-chat-box {
    inset: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-height: 100dvh;
    border-radius: 0;
  }
}

@media (max-width: 380px) {
  .company-list.company-grid,
  .nl-grid {
    grid-template-columns: 1fr;
  }

  .hero h1 {
    font-size: 20px;
  }

  .summary-specs {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 769px) {
  .mobile-tabbar {
    display: none !important;
  }
}
