/* ==========================================================================
   mebeautylabs · 移动端设计层 v1  (2026-10-30)
   仅作用于宽度 <= 767px；桌面端样式完全不变。
   设计基线：390 x 844pt / 8pt 网格 / 触控 >= 40pt / 正文字号 >= 11px
   ========================================================================== */

@media (max-width: 767px) {
  :root {
    --m-tab: 54px;
    --m-gutter: 14px;
  }

  html { -webkit-text-size-adjust: 100%; }
  body {
    font-size: 14px;
    padding-bottom: calc(var(--m-tab) + env(safe-area-inset-bottom, 0px) + 8px);
  }

  /* 外壳改为通栏，去掉桌面端的卡片边框 */
  .site-shell {
    width: 100%;
    max-width: none;
    margin: 0;
    border: 0;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    overflow: visible;
    background: var(--cream);
  }

  /* ---------- 头部：logo + 图标 / 搜索 两行栅格 ---------- */
  .announcement {
    margin: 0;
    padding: 7px 14px;
    font-size: 10.5px;
    letter-spacing: .4px;
    border-radius: 0;
  }
  .site-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 4px;
    row-gap: 9px;
    padding: 9px var(--m-gutter) 12px;
    border-radius: 0 0 20px 20px;
    min-height: 0;
    position: sticky;
    top: 0;
    z-index: 60;
  }
  .site-header > .logo {
    position: static;
    grid-column: 1;
    grid-row: 1;
    width: auto;
    height: auto;
    display: flex;
    align-items: center;
  }
  .site-header > .logo img {
    width: auto;
    max-width: 134px;
    max-height: 38px;
    height: auto;
  }
  .header-body { display: contents; }
  .header-top { display: contents; }

  .header-actions {
    grid-column: 2;
    grid-row: 1;
    margin: 0;
    min-height: 40px;
    gap: 0;
    justify-content: flex-end;
    align-items: center;
  }
  .header-actions .icon-button {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 0;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
  }
  .header-actions .icon-button svg { width: 20px; height: 20px; }
  .header-actions .account-label { display: none; }
  .header-actions .mobile-toggle { width: 40px; height: 40px; min-width: 40px; }

  .search-bar {
    grid-column: 1 / -1;
    grid-row: 2;
    order: 0;
    width: 100%;
    height: 38px;
    border-radius: 19px;
    padding-left: 4px;
  }
  .search-bar input { font-size: 12.5px; padding-left: 12px; }
  .search-bar button { width: 32px; height: 32px; min-width: 32px; border-radius: 50%; }
  .search-bar svg { width: 16px; height: 16px; }

  .nav-row { grid-column: 1 / -1; grid-row: 3; margin: 0; }
  .main-nav { display: none; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
  .site-header.nav-open .main-nav { display: grid; }
  .nav-item { display: block; }
  .nav-pill {
    font-size: 12px;
    padding: 11px 14px;
    min-height: 44px;
    border-radius: 22px;
    justify-content: space-between;
  }
  .nav-dropdown { display: none !important; }

  /* ---------- 首页 hero ---------- */
  .hero {
    margin: 12px var(--m-gutter) 0;
    border-radius: 16px;
    overflow: hidden;
  }
  /* 首页 hero 素材是带文案的宽幅横幅，裁切会切断标题文字，因此整幅完整显示 */
  .hero-slide {
    aspect-ratio: 2;
    object-fit: contain;
    object-position: center;
    background: #f2ece6;
    border-radius: 16px;
  }
  .hero-controls {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 8px;
    justify-content: center;
    gap: 5px;
    padding: 0;
    background: none;
    overflow: visible;
  }
  .hero-controls .hero-dot {
    width: 6px !important;
    height: 6px !important;
    margin: 0 !important;
    border-radius: 50% !important;
    background: #ffffffc4 !important;
    box-shadow: 0 0 0 1.5px #00000022;
    flex: 0 0 auto;
  }
  .hero-controls .hero-dot.active {
    width: 16px !important;
    border-radius: 3px !important;
    background: var(--rust) !important;
    box-shadow: none;
  }
  .hero-controls .hero-dot:nth-child(n + 7) { display: none; }
  .hero-arrow { display: none; }

  /* ---------- 区块节奏 ---------- */
  .section { padding: 26px var(--m-gutter); }
  .section-head { display: block; margin-bottom: 16px; }
  .section-head h2 { font-size: 24px; line-height: 1.26; margin-bottom: 6px; }
  .section-head p { font-size: 12px; line-height: 1.6; margin-bottom: 10px; }
  .eyebrow { font-size: 9.5px; letter-spacing: 1.8px; }
  .text-link { font-size: 11px; padding: 6px 0; }

  /* ---------- 产品卡 ---------- */
  .product-grid { grid-template-columns: 1fr 1fr; gap: 20px 12px; }
  .product-image {
    border-radius: 12px;
    background: #f6f2ee;
    overflow: hidden;
  }
  .product-image img { object-fit: contain; padding: 8px; }
  .product-image .wishlist-button {
    width: 34px;
    height: 34px;
    top: 7px;
    right: 7px;
    background: #fff;
    box-shadow: 0 2px 8px #0000001a;
  }
  .wishlist-button svg { width: 15px; height: 15px; }
  .product-quick {
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 8px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transform: none;
    opacity: 1;
    border-radius: 19px;
    background: #fff;
    color: var(--rust);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .3px;
    border: 0;
    box-shadow: 0 4px 14px #3b2a1c26;
  }
  .product-quick:hover,
  .product-quick:active { background: var(--rust); color: #fff; }
  .product-quick:disabled { opacity: .6; }
  .product-brand { font-size: 9.5px; letter-spacing: 1.1px; text-transform: uppercase; color: #9a938c; margin-top: 9px; }
  .product-name {
    font-size: 12.5px;
    line-height: 1.42;
    height: auto;
    min-height: 36px;
    max-height: 36px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .product-price { font-size: 13.5px; font-weight: 600; margin-top: 6px; }
  .product-price small { font-size: 9px; }
  .product-price del { font-size: 10.5px; }
  .product-badge { font-size: 9px; top: 8px; left: 8px; padding: 3px 7px; border-radius: 10px; }

  /* ---------- 列表页工具条 ---------- */
  .page-heading { padding: 12px var(--m-gutter) 12px; margin-bottom: 0; }
  .page-heading h1 { font-size: 22px; line-height: 1.25; margin-bottom: 4px; }
  .page-heading p {
    font-size: 11.5px;
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .breadcrumb { padding: 9px var(--m-gutter); font-size: 9.5px; }
  .shop-wrap { padding: 0 var(--m-gutter) 40px; }
  .shop-toolbar { gap: 8px; margin-bottom: 12px; align-items: center; flex-wrap: wrap; }
  .mobile-filter {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 38px;
    padding: 0 14px;
    border-radius: 19px;
    background: #fff;
    border: 1px solid var(--line);
    font-size: 11.5px;
    font-weight: 500;
    color: #4a4642;
  }
  .shop-toolbar select {
    height: 38px;
    border-radius: 19px;
    font-size: 11.5px;
    padding: 0 26px 0 13px;
    max-width: 190px;
    border: 1px solid var(--line);
    background: #fff;
  }
  .shop-toolbar p { order: 3; width: 100%; font-size: 10.5px; color: #8d8781; margin: 2px 0 0; }
  .shop-products .product-grid { gap: 20px 12px; }
  .filter-chips { gap: 6px; margin-bottom: 12px; }
  .filter-chip { font-size: 10px; padding: 5px 10px; border-radius: 12px; }

  /* ---------- 详情页 ---------- */
  .detail-wrap { padding: 0 var(--m-gutter) calc(96px + env(safe-area-inset-bottom, 0px)); }
  .product-detail { display: block; }
  .detail-image { border-radius: 16px; background: #f6f2ee; }
  .detail-image img { object-fit: contain; padding: 14px; }
  .image-thumbnails { display: flex; gap: 7px; margin-top: 8px; overflow-x: auto; }
  .image-thumbnails button { width: 46px; height: 46px; border-radius: 10px; flex: 0 0 auto; }
  .detail-info { padding-top: 14px; }
  .detail-info .product-brand { font-size: 10px; margin-bottom: 6px; }
  .detail-info h1 { font-size: 21px; line-height: 1.3; margin-bottom: 8px; }
  .detail-price { font-size: 20px; font-weight: 600; }
  .detail-short { font-size: 11.5px; line-height: 1.65; }
  .stock { font-size: 10.5px; margin: 12px 0; }
  .detail-promise { font-size: 10px; gap: 12px; flex-wrap: wrap; }
  .detail-meta { font-size: 10px; margin: 14px 0; }
  .product-accordions { margin-top: 26px; }
  .product-accordions summary { padding: 15px 0; font-size: 13px; }
  .related-products h2 { font-size: 22px; margin-bottom: 16px; }

  /* 详情页吸底购买条 */
  .purchase-row {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(var(--m-tab) + env(safe-area-inset-bottom, 0px));
    z-index: 65;
    margin: 0;
    gap: 9px;
    padding: 9px var(--m-gutter);
    background: #fff;
    border-top: 1px solid var(--line);
    box-shadow: 0 -8px 24px #3b2a1c14;
    flex-wrap: nowrap;
  }
  .purchase-row .quantity-control { height: 42px; min-width: 96px; flex: 0 0 auto; border-radius: 21px; }
  .purchase-row .quantity-control button { width: 30px; font-size: 15px; }
  .purchase-row .quantity-control input { width: 30px; font-size: 13px; }
  .purchase-row .btn { flex: 1; height: 44px; font-size: 12.5px; border-radius: 22px; padding: 0 16px; }
  body:has(.purchase-row) { padding-bottom: calc(var(--m-tab) + 132px); }

  /* ---------- 购物车 / 结算 / 账户 ---------- */
  .cart-page, .checkout-wrap, .account-wrap, .order-wrap, .content-wrap, .contact-grid,
  .brand-index, .school-page, .quiz-wrap { padding-left: var(--m-gutter); padding-right: var(--m-gutter); }
  .cart-table th { font-size: 10px; letter-spacing: .6px; }
  .cart-product h3 { font-size: 12px; line-height: 1.45; max-width: 170px; }
  .cart-product p { font-size: 10.5px; }
  .summary-box { padding: 18px; border-radius: 14px; }
  .summary-box h2 { font-size: 20px; margin-bottom: 12px; }
  .summary-row { font-size: 12.5px; }
  .checkout-layout { gap: 18px; }
  .form-section h2 { font-size: 20px; margin-bottom: 14px; }
  .form-grid { grid-template-columns: 1fr; gap: 12px; }
  .field { font-size: 11.5px; gap: 5px; }
  .field input, .field select, .field textarea { height: 46px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
  .field textarea { height: auto; padding: 11px 12px; }
  .payment-option { padding: 13px; border-radius: 12px; }
  .payment-option strong { font-size: 13px; }
  .payment-option small { font-size: 10.5px; }
  .notice { font-size: 11px; padding: 12px 14px; border-radius: 10px; }
  .auth-box { padding: 20px; border-radius: 14px; }
  .order-list th, .order-list td { font-size: 10.5px; padding: 12px 6px; }
  .account-greeting h2 { font-size: 22px; }

  /* ---------- 页脚 ---------- */
  .newsletter {
    display: block;
    padding: 22px 18px;
    border-radius: 0;
    text-align: left;
  }
  .newsletter h2 { font-size: 15px; line-height: 1.45; margin: 0 0 12px; text-align: left; max-width: none; }
  .newsletter form { display: flex; gap: 8px; max-width: none; margin: 0; }
  .newsletter input { flex: 1; height: 44px; font-size: 12px; border-radius: 22px; padding: 0 14px; }
  .newsletter .btn { flex: 0 0 auto; height: 44px; font-size: 11px; padding: 0 16px; border-radius: 22px; letter-spacing: .6px; }

  .footer-main { grid-template-columns: 1fr 1fr; gap: 20px 12px; padding: 22px 18px 10px; }
  .footer-main > .logo { grid-column: 1 / -1; margin: 0 0 2px; }
  .footer-main .logo img { width: 108px; height: auto; }
  .footer-main h3 { font-size: 11px; letter-spacing: 1.6px; text-transform: uppercase; margin: 0 0 8px; }
  .footer-main a:not(.logo) {
    display: block;
    font-size: 11.5px;
    line-height: 1.5;
    margin: 0;
    padding: 5px 0;
    color: #ffffffd6;
  }
  .footer-bottom {
    display: block;
    padding: 14px 18px 18px;
    margin-top: 6px;
    border-top: 1px solid #ffffff26;
    border-radius: 0;
    font-size: 10px;
  }
  .footer-bottom p { font-size: 10px; line-height: 1.7; margin: 0 0 6px; color: #ffffffc4; }
  .footer-bottom p:last-child { margin-bottom: 0; }
  .footer-payments { margin-top: 10px; display: flex; gap: 8px; }
  .footer-payments span {
    height: 26px;
    padding: 0 11px;
    border: 1px solid #ffffff3d;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    font-size: 10px;
    letter-spacing: .3px;
  }

  /* ---------- Cookie 条：紧凑单行 ---------- */
  .cookie-banner {
    left: 10px;
    right: 10px;
    bottom: calc(var(--m-tab) + env(safe-area-inset-bottom, 0px) + 8px);
    width: auto;
    max-width: none;
    padding: 10px 10px 10px 12px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    max-height: none;
    overflow: visible;
    box-shadow: 0 10px 30px #3b2a1c26;
  }
  .cookie-banner p { flex: 1; margin: 0; font-size: 10px; line-height: 1.5; }
  body:has(.purchase-row) .cookie-banner {
    bottom: calc(var(--m-tab) + 76px + env(safe-area-inset-bottom, 0px));
  }
  .cookie-actions { display: flex; align-items: center; gap: 4px; margin: 0; flex: 0 0 auto; }
  .cookie-actions .btn { height: 34px; padding: 0 12px; font-size: 10.5px; border-radius: 17px; white-space: nowrap; }
  .cookie-actions > a { display: none; }

  /* ---------- 全局小控件兜底 ---------- */
  .btn { min-height: 40px; }
  .pagination a, .pagination span { width: 34px; height: 34px; font-size: 12px; }
  #toast { font-size: 12px; left: 14px; right: 14px; }
}

/* ---------- Cookie 关闭按钮（桌面与移动端通用） ---------- */
.cookie-close {
  width: 28px;
  height: 28px;
  min-width: 28px;
  margin-left: 6px;
  border: 0;
  border-radius: 50%;
  background: #f3efeb;
  color: #8a847e;
  display: inline-grid;
  place-items: center;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.cookie-close:hover { background: #e9e3dd; color: #5d5854; }

/* ---------- 底部 Tab 导航（仅移动端渲染） ---------- */
.mobile-tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 70;
  display: none;
  grid-template-columns: repeat(5, 1fr);
  background: #fff;
  border-top: 1px solid #ece7e2;
  padding: 5px 2px calc(5px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -6px 20px #3b2a1c0f;
}
.mobile-tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 44px;
  color: #9a938c;
  font-size: 9px;
  letter-spacing: .2px;
  text-decoration: none;
  position: relative;
}
.mobile-tabbar a.is-active { color: var(--rust); font-weight: 600; }
.mobile-tabbar svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.mobile-tabbar a.is-active svg { stroke-width: 1.85; }
.mobile-tabbar .tab-count[hidden] { display: none !important; }
.mobile-tabbar .tab-count {
  position: absolute;
  top: 1px;
  right: calc(50% - 20px);
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 8px;
  background: var(--rust);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  display: grid;
  place-items: center;
}
@media (max-width: 767px) {
  .mobile-tabbar { display: grid; }
}
