/* 手机端公共样�?*/
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    width: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

body {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Meiryo', 'Yu Gothic', sans-serif;
    background-color: #FFFFFF;
    color: #4A4A4A;
    font-size: 14px;
    line-height: 1.6;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
    height: auto;
}

/* 顶部导航：SENSAI 参考 — 菜单金色、搜索/购物车黑色、展开时为关闭（黑X+金文字） */
.m-header {
    --m-header-gold: #a68945;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    z-index: 1000;
    padding: 0;
    background: transparent;
    pointer-events: none;
}

.m-header-inner {
    pointer-events: auto;
    position: relative;
    z-index: 1001;
    background: #fff;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    border-bottom: 1px solid #e8e8e8;
    min-height: 76px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding-top: env(safe-area-inset-top, 0);
}

/* 圆角在 PC 大屏时不显示 */
@media (min-width: 1024px) {
    .m-header-inner {
        border-radius: 18px 18px 0 0;
        box-shadow: none;
    }
}

/* 搜索层暗色背景 */
.m-search-dim {
    position: fixed;
    inset: 0;
    z-index: 998;
    background: rgba(55, 55, 55, 0.48);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.m-search-dim--visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.m-header-content {
    display: grid;
    /* minmax(0,…) + 中间 1fr 可收缩，避免日文标题 letter-spacing 撑爆窄屏（iPhone 11 显示缩放 / 大字体） */
    grid-template-columns: minmax(0, auto) minmax(0, auto) minmax(0, 1fr) minmax(0, auto);
    align-items: center;
    width: 100%;
    min-width: 0;
    min-height: 76px;
    padding: 10px 12px 12px;
    column-gap: 4px;
}

/* 左：菜单（双横线 + 金铜字） */
.m-header-menu {
    grid-column: 1;
    justify-self: start;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 0;
    max-width: 100%;
    padding: 4px 4px;
    margin: 0;
    border: none;
    background: transparent;
    color: var(--m-header-gold);
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
    font: inherit;
}

.m-header-menu-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 14px;
    color: inherit;
}

.m-header-menu-label {
    font-size: 9px;
    letter-spacing: 0.02em;
    line-height: 1;
    font-weight: 400;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 左二：搜索 / 关闭 同一槽位互斥（hidden 须覆盖 display:flex） */
.m-header-search-slot {
    grid-column: 2;
    justify-self: start;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    max-width: 100%;
    min-height: 48px;
}

.m-header-search[hidden],
.m-header-close-search[hidden] {
    display: none !important;
}

/* 搜索：黑图标 + 黑「搜索」（SENSAI 默认状态） */
.m-header-search {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    padding: 4px 2px;
    margin: 0;
    border: none;
    background: transparent;
    color: #111;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
    font: inherit;
}

.m-header-search-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 20px;
    color: inherit;
}

.m-header-search-label {
    font-size: 9px;
    letter-spacing: 0.02em;
    line-height: 1;
    font-weight: 400;
    color: inherit;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 展开时：关闭 — 黑 X + 金铜小字 */
.m-header-close-search {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    padding: 4px 2px;
    margin: 0;
    border: none;
    background: transparent;
    color: #111;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
    font: inherit;
}

.m-header-close-search-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 20px;
    color: #111;
}

.m-header-close-search-label {
    font-size: 9px;
    letter-spacing: 0.02em;
    line-height: 1;
    color: var(--m-header-gold);
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 顶部展开搜索区（分类 + 下划线输入 + HOT ワード） */
.m-search-panel {
    overflow: hidden;
    animation: m-search-panel-in 0.22s ease;
}

@keyframes m-search-panel-in {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.m-search-panel-divider {
    height: 1px;
    background: #e0e0e0;
    margin: 0 14px;
}

.m-search-panel-body {
    padding: 14px 16px 22px;
}

.m-search-cat-row {
    margin-bottom: 14px;
}

.m-search-cat-select-wrap {
    position: relative;
    border: 1px solid #4a4a4a;
    border-radius: 2px;
    background: #fff;
}

.m-search-cat-select-wrap::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    width: 6px;
    height: 6px;
    margin-top: -5px;
    border-right: 1px solid #333;
    border-bottom: 1px solid #333;
    transform: rotate(45deg);
    pointer-events: none;
}

.m-search-cat-select {
    display: block;
    width: 100%;
    padding: 12px 36px 12px 12px;
    font-size: 13px;
    color: #111;
    border: none;
    background: transparent;
    appearance: none;
    -webkit-appearance: none;
    outline: none;
    cursor: pointer;
    font-family: inherit;
}

.m-search-line-form {
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid #b8b8b8;
    padding-bottom: 4px;
    margin-bottom: 18px;
}

.m-search-line-input {
    flex: 1;
    min-width: 0;
    border: none;
    padding: 10px 4px 8px 2px;
    font-size: 14px;
    color: #111;
    background: transparent;
    outline: none;
    font-family: inherit;
}

.m-search-line-input::placeholder {
    color: #b0b0b0;
}

.m-search-line-submit {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 4px;
    border: none;
    background: transparent;
    color: #111;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.m-search-hot-title {
    font-size: 12px;
    letter-spacing: 0.12em;
    color: var(--m-header-gold, #a68945);
    margin: 0 0 10px;
    font-weight: 400;
}

.m-search-hot-list {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.m-search-hot-list a {
    font-size: 14px;
    color: #111;
    text-decoration: underline;
    text-underline-offset: 3px;
    padding: 5px 0;
    line-height: 1.4;
}

.m-search-hot-list a:active {
    opacity: 0.65;
}

/* 中：品牌 — 与 PC 顶栏 .nav-pc-brand 同款文字 */
.m-logo {
    grid-column: 3;
    justify-self: center;
    align-self: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    -webkit-tap-highlight-color: transparent;
    text-decoration: none;
    color: #111;
    line-height: 1.05;
    min-width: 0;
    width: 100%;
    max-width: min(48vw, 200px);
    overflow: hidden;
}

.m-brand-title {
    font-family: "Times New Roman", "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;
    font-size: clamp(12px, 3.6vw, 18px);
    font-weight: 300;
    letter-spacing: 0.12em;
    text-indent: 0.12em;
    width: 100%;
    min-width: 0;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.m-brand-sub {
    font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", -apple-system, BlinkMacSystemFont, "Yu Gothic", Meiryo, sans-serif;
    font-size: 8px;
    font-weight: 400;
    letter-spacing: 0.2em;
    text-indent: 0.2em;
    margin-top: 0;
    color: #111;
    width: 100%;
    min-width: 0;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 右：购物车 — 线与「购物车」为黑色（SENSAI 默认状态） */
.m-header-cart {
    grid-column: 4;
    justify-self: end;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 0;
    max-width: 100%;
    padding: 4px 4px;
    color: #111;
    -webkit-tap-highlight-color: transparent;
}

.m-header-cart-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 22px;
    color: inherit;
}

.m-header-cart-label {
    font-size: 9px;
    letter-spacing: 0.02em;
    line-height: 1;
    font-weight: 400;
    color: inherit;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 侧滑菜单 */
.m-drawer {
    position: fixed;
    inset: 0;
    z-index: 1100;
    pointer-events: none;
    visibility: hidden;
}

.m-drawer.m-drawer--open {
    pointer-events: auto;
    visibility: visible;
}

.m-drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.m-drawer--open .m-drawer-backdrop {
    opacity: 1;
}

.m-drawer-panel {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(86vw, 300px);
    max-width: 100%;
    background: #fff;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.08);
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 0.28s cubic-bezier(0.25, 0.1, 0.25, 1), visibility 0.28s step-end;
    display: flex;
    flex-direction: column;
    padding-top: env(safe-area-inset-top, 0);
    overflow-y: auto;
}

.m-drawer--open .m-drawer-panel {
    transform: translateX(0);
    visibility: visible;
    transition: transform 0.28s cubic-bezier(0.25, 0.1, 0.25, 1), visibility 0s step-start;
}

.m-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px 12px;
    border-bottom: 1px solid #eee;
}

.m-drawer-title {
    font-size: 15px;
    font-weight: 600;
    color: #111;
    letter-spacing: 0.04em;
}

.m-drawer-close {
    border: none;
    background: transparent;
    font-size: 28px;
    line-height: 1;
    color: #666;
    padding: 0 4px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.m-drawer-search {
    display: flex;
    gap: 8px;
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f0;
}

.m-drawer-search input {
    flex: 1;
    height: 38px;
    border: 1px solid #ddd;
    border-radius: 19px;
    padding: 0 14px;
    font-size: 14px;
    outline: none;
}

.m-drawer-search input:focus {
    border-color: #c9a86c;
}

.m-drawer-search button {
    height: 38px;
    padding: 0 16px;
    background: #c9a86c;
    color: #fff;
    border: none;
    border-radius: 19px;
    font-size: 13px;
    white-space: nowrap;
}

.m-drawer-nav {
    display: flex;
    flex-direction: column;
    padding: 8px 0 24px;
}

.m-drawer-nav a {
    padding: 14px 20px;
    font-size: 14px;
    color: #333;
    border-bottom: 1px solid #f5f5f5;
}

.m-drawer-nav a:active {
    background: #fafafa;
}

/* 底部 Tab ナビ：全モバイルページで非表示（ドロワー・ヘッダーから遷移） */
.m-footer-nav {
    display: none !important;
}

.m-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 10px;
    position: relative;
}

.m-nav-item svg {
    margin-bottom: 2px;
}

.m-nav-item.active {
    color: #C9A86C;
}

.m-cart-badge {
    position: absolute;
    top: -5px;
    right: -8px;
    background: #C9A86C;
    color: #fff;
    font-size: 10px;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* 主内容区 */
.m-main {
    width: 100%;
    min-width: 0;
    padding-top: calc(76px + env(safe-area-inset-top, 0px));
}

/* 大屏（与 PC 设计稿一致）：顶栏加高 */
@media (min-width: 1024px) {
    .m-header-inner {
        min-height: 92px;
        border-radius: 18px 18px 0 0;
    }

    .m-header-content {
        min-height: 92px;
        padding: 14px 24px 16px;
    }

    .m-brand-title {
        font-size: clamp(18px, 1.6vw, 24px);
        letter-spacing: 0.26em;
        text-indent: 0.26em;
    }

    .m-brand-sub {
        font-size: 10px;
        letter-spacing: 0.4em;
        text-indent: 0.4em;
        margin-top: 3px;
    }

    .m-header-menu-label,
    .m-header-cart-label,
    .m-header-search-label,
    .m-header-close-search-label {
        font-size: 11px;
    }

    .m-main {
        padding-top: calc(92px + env(safe-area-inset-top, 0px));
    }
}

/* 通用section样式 - 日本风格 */
.m-section {
    background: #FFFFFF;
    margin-bottom: 8px;
    padding: 20px 16px;
}

.m-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.m-section-header h2 {
    font-size: 17px;
    font-weight: 500;
    color: #3A3A3A;
    position: relative;
    padding-left: 12px;
    letter-spacing: 0.5px;
}

.m-section-header h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 14px;
    background: linear-gradient(180deg, #D4C5A9 0%, #C9A86C 100%);
    border-radius: 1px;
}

.m-more {
    font-size: 11px;
    color: #8B8B8B;
    letter-spacing: 0.3px;
}

/* 商品卡片 - 日本风格 */
.m-goods-card {
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.m-goods-card:active {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.m-goods-img {
    position: relative;
    width: 100%;
    padding-top: 100%;
    overflow: hidden;
    background: #FFFFFF;
}

.m-goods-img img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
    background: #FFFFFF;
}

.m-goods-card:active .m-goods-img img {
    transform: scale(1.02);
}

.m-discount-tag {
    position: absolute;
    top: 6px;
    left: 6px;
    background: #D4C09A;
    color: #fff;
    font-size: 9px;
    padding: 3px 6px;
    border-radius: 4px;
    font-weight: 500;
    backdrop-filter: blur(4px);
}

.m-goods-info {
    padding: 10px 8px;
}

.m-goods-name {
    font-size: 12px;
    color: #4A4A4A;
    line-height: 1.5;
    height: 36px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-bottom: 6px;
    letter-spacing: 0.2px;
}

.m-goods-intro {
    font-size: 10px;
    color: #9B9B9B;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 6px;
    letter-spacing: 0.1px;
}

.m-price-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.m-goods-price {
    font-size: 14px;
    color: #8B7355;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.m-original-price {
    font-size: 10px;
    color: #B8B8B8;
    text-decoration: line-through;
    letter-spacing: 0.1px;
}

/* 商品网格 */
.m-goods-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

/* 查看全部 - 日本风格 */
.m-view-all {
    text-align: center;
    padding: 18px 0 12px;
    margin-top: 12px;
}

.m-view-all a {
    color: #8B8B8B;
    font-size: 12px;
    letter-spacing: 0.5px;
    transition: color 0.2s ease;
}

.m-view-all a:active {
    color: #6B6B6B;
}

/* 空状�?*/
.m-empty {
    text-align: center;
    padding: 50px 20px;
    color: #999;
}

.m-empty svg {
    margin-bottom: 15px;
    opacity: 0.5;
}

/* 加载�?*/
.m-loading {
    text-align: center;
    padding: 20px;
    color: #999;
}

/* 按钮 */
.m-btn {
    display: inline-block;
    height: 40px;
    line-height: 40px;
    padding: 0 20px;
    border-radius: 20px;
    font-size: 14px;
    text-align: center;
    border: none;
    cursor: pointer;
}

.m-btn-primary {
    background: #C9A86C;
    color: #fff;
}

.m-btn-outline {
    background: transparent;
    border: 1px solid #C9A86C;
    color: #C9A86C;
}

/* 分类标签 - 日本风格 */
.m-category-tabs {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 12px;
    margin-bottom: 16px;
    -webkit-overflow-scrolling: touch;
}

.m-category-tabs::-webkit-scrollbar {
    display: none;
}

.m-tab {
    flex-shrink: 0;
    padding: 7px 14px;
    background: #F5F5F0;
    border-radius: 12px;
    font-size: 12px;
    color: #6B6B6B;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    letter-spacing: 0.3px;
    display: inline-block;
    text-decoration: none;
}

.m-tab:active {
    transform: scale(0.96);
}

.m-tab.active {
    background: #E8DCC8;
    color: #5C5C5C;
    border-color: #D4C5A9;
    font-weight: 500;
}

.m-tab:hover {
    color: #5C5C5C;
}

/* Toast提示 */
.m-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 9999;
}

/* =========================================
   TikTok WebView 兼容性修复
   visibility + opacity + transform 组合在部分 WebView 中表现异常
   使用更明确的 !important 和 -webkit- 前缀
   ========================================= */

/* 抽屉层：确保隐藏状态 */
.m-drawer {
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    -webkit-backface-visibility: hidden !important;
    backface-visibility: hidden !important;
}

/* 抽屉打开状态 */
.m-drawer.m-drawer--open {
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* 抽屉遮罩 */
.m-drawer-backdrop {
    opacity: 0 !important;
    -webkit-transition: opacity 0.25s ease !important;
    transition: opacity 0.25s ease !important;
}

.m-drawer--open .m-drawer-backdrop {
    opacity: 1 !important;
}

/* 抽屉面板 */
.m-drawer-panel {
    visibility: hidden !important;
    -webkit-transform: translateX(-100%) !important;
    transform: translateX(-100%) !important;
    -webkit-transition: -webkit-transform 0.28s cubic-bezier(0.25, 0.1, 0.25, 1), visibility 0.28s step-end !important;
    transition: transform 0.28s cubic-bezier(0.25, 0.1, 0.25, 1), visibility 0.28s step-end !important;
}

.m-drawer--open .m-drawer-panel {
    visibility: visible !important;
    -webkit-transform: translateX(0) !important;
    transform: translateX(0) !important;
    -webkit-transition: -webkit-transform 0.28s cubic-bezier(0.25, 0.1, 0.25, 1), visibility 0s step-start !important;
    transition: transform 0.28s cubic-bezier(0.25, 0.1, 0.25, 1), visibility 0s step-start !important;
}

/* 搜索遮罩层 WebView 修复 */
.m-search-dim {
    -webkit-backface-visibility: hidden !important;
    backface-visibility: hidden !important;
}

/* 底部 Tab 导航：确保不显示（移动端全部用抽屉菜单） */
.m-footer-nav {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
}
