/* ==========================================================================
   VPS Monitor — StatusShow 设计语言
   深色点阵背景 + 渐变光晕 + 玻璃态卡片
   ========================================================================== */

/* ─── CSS 变量 (浅色) ─── */
:root {
    --bg-page:      #f0f4ff;
    --bg-surface:   #ffffff;
    --bg-surface-2: #f8fafc;
    --bg-nav:       rgba(248,250,252,0.92);
    --border:       #e2e8f0;
    --border-light: #f1f5f9;
    --text-primary:   #0f172a;
    --text-secondary: #475569;
    --text-muted:     #94a3b8;
    --brand:          #2563eb;
    --brand-dark:     #1d4ed8;
    --brand-glow:     rgba(37,99,235,0.25);
    --success:        #16a34a;
    --danger:         #dc2626;
    --shadow-sm:      0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:      0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg:      0 20px 40px rgba(0,0,0,0.12);
    --shadow-glow:    0 0 20px rgba(37,99,235,0.15);
    --radius:         0.75rem;
}

/* ─── CSS 变量 (深色) ─── */
html.dark {
    --bg-page:      #060d1f;
    --bg-surface:   #0e1629;
    --bg-surface-2: #111c35;
    --bg-nav:       rgba(6,13,31,0.92);
    --border:       #1e2d4d;
    --border-light: #0e1629;
    --text-primary:   #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted:     #475569;
    --brand:          #3b82f6;
    --brand-dark:     #2563eb;
    --brand-glow:     rgba(59,130,246,0.3);
    --success:        #22c55e;
    --danger:         #ef4444;
    --shadow-sm:      0 1px 3px rgba(0,0,0,0.3);
    --shadow-md:      0 4px 16px rgba(0,0,0,0.4);
    --shadow-lg:      0 20px 40px rgba(0,0,0,0.6);
    --shadow-glow:    0 0 20px rgba(59,130,246,0.2);
}

/* ==========================================================================
   全局基础
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

body {
    background: var(--bg-page);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    position: relative;
}

/* ─── 浅色：渐变光晕背景 ─── */
body::before {
    content: '';
    position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background:
        radial-gradient(60rem 36rem at 10% -5%, rgba(99,102,241,0.12), transparent 60%),
        radial-gradient(50rem 32rem at 95% 5%,  rgba(56,189,248,0.1),  transparent 60%),
        radial-gradient(44rem 28rem at 80% 90%, rgba(34,197,94,0.08),  transparent 60%);
}

/* ─── 深色：点阵网格背景 ─── */
html.dark body::before {
    background:
        radial-gradient(ellipse 80% 50% at 50% -10%, rgba(59,130,246,0.15), transparent),
        radial-gradient(circle at 80% 80%, rgba(99,102,241,0.08), transparent 50%);
}
html.dark body::after {
    content: '';
    position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background-image: radial-gradient(rgba(59,130,246,0.25) 1px, transparent 1px);
    background-size: 24px 24px;
    -webkit-mask-image: radial-gradient(ellipse 80% 80% at 50% 0%, #000 30%, transparent 90%);
    mask-image: radial-gradient(ellipse 80% 80% at 50% 0%, #000 30%, transparent 90%);
}

/* 平滑主题切换 */
body, nav, .filter-panel, .product-card, .modal-box, .map-sidebar {
    transition: background-color 0.25s ease, border-color 0.25s ease, color 0.2s ease;
}

/* 滚动条 */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ==========================================================================
   商家颜色
   ========================================================================== */
:root {
    --c-racknerd:      #e05c2a; --c-dmit:          #6366f1;
    --c-bandwagonhost: #0ea5e9; --c-cloudcone:     #f59e0b;
    --c-colocrossing:  #10b981; --c-dedirock:      #8b5cf6;
    --c-akkocloud:     #ec4899; --c-bagevm:        #14b8a6;
    --c-lisahost:      #f97316; --c-vps:           #06b6d4;
    --c-netcup:        #84cc16; --c-justg:         #a855f7;
    --c-yinnet:        #ef4444; --c-zgocloud:      #3b82f6;
    --c-greencloudvps: #22c55e; --c-solidvps:      #64748b;
    --c-hostdzire:     #d97706; --c-chicagovps:    #0891b2;
    --c-lightlayer:    #7c3aed;
}

/* ==========================================================================
   导航栏
   ========================================================================== */
.site-nav {
    background: var(--bg-nav);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky; top: 0; z-index: 100;
    height: 54px;
    display: flex; align-items: center;
}
.nav-inner {
    max-width: 1440px; width: 100%; margin: 0 auto; padding: 0 1.5rem;
    display: flex; align-items: center; gap: 1rem;
}
.nav-logo {
    display: flex; align-items: center; gap: 0.6rem; flex-shrink: 0;
}
.nav-logo-icon {
    width: 2rem; height: 2rem; border-radius: 0.5rem;
    background: var(--brand); display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-glow);
}
.nav-logo-text {
    font-weight: 700; font-size: 1.05rem; color: var(--text-primary);
    letter-spacing: -0.01em;
}
.nav-search {
    flex: 1; max-width: 360px; position: relative;
}
.nav-search-icon {
    position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%);
    width: 0.9rem; height: 0.9rem; color: var(--text-muted); pointer-events: none;
}
.nav-search-input {
    width: 100%; height: 2.1rem;
    background: var(--bg-surface-2); border: 1px solid var(--border);
    border-radius: 99px; padding: 0 0.75rem 0 2.2rem;
    font-size: 0.83rem; color: var(--text-primary);
    outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.nav-search-input::placeholder { color: var(--text-muted); }
.nav-search-input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-glow);
}
.nav-right { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; }

/* 视图切换按钮组 */
.view-tabs {
    display: flex; border: 1px solid var(--border);
    border-radius: 0.55rem; overflow: hidden;
    background: var(--bg-surface-2);
}
.view-tab {
    display: flex; align-items: center; gap: 0.35rem;
    padding: 0.35rem 0.75rem; font-size: 0.78rem; font-weight: 500;
    color: var(--text-muted); background: transparent; border: none; cursor: pointer;
    transition: background 0.15s, color 0.15s; white-space: nowrap;
}
.view-tab.active { background: var(--brand); color: #fff; }
.view-tab:not(.active):hover { background: var(--border-light); color: var(--text-primary); }

/* 主题切换按钮 */
.theme-btn {
    width: 2.1rem; height: 2.1rem; border-radius: 0.5rem;
    border: 1px solid var(--border); background: var(--bg-surface-2);
    color: var(--text-secondary); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: border-color 0.15s, color 0.15s;
}
.theme-btn:hover { border-color: var(--brand); color: var(--brand); }

/* ==========================================================================
   Hero 统计条
   ========================================================================== */
.hero-bar {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
}
.hero-inner {
    max-width: 1440px; margin: 0 auto; padding: 0.8rem 1.5rem;
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem;
}
.hero-title { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); }
.hero-sub { font-size: 0.75rem; color: var(--text-muted); }
.hero-stats { display: flex; gap: 1.5rem; margin-left: auto; }
.hero-stat { text-align: center; }
.hero-stat-val { font-size: 1.6rem; font-weight: 800; color: var(--text-primary); line-height: 1; }
.hero-stat-val.green { color: var(--success); }
.hero-stat-label { font-size: 0.65rem; color: var(--text-muted); margin-top: 0.1rem; }

/* ==========================================================================
   筛选面板
   ========================================================================== */
.filter-panel {
    background: var(--bg-surface); border-bottom: 1px solid var(--border);
}
.filter-inner {
    max-width: 1440px; margin: 0 auto; padding: 0.75rem 1.5rem;
}
.filter-row { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: flex-end; }
.filter-row + .filter-row { margin-top: 0.6rem; padding-top: 0.6rem; border-top: 1px solid var(--border-light); }
.filter-field { display: flex; flex-direction: column; min-width: 90px; flex: 1; }
.filter-field--wide  { flex: 2.5; min-width: 200px; }
.filter-field--auto  { flex: 0 0 auto; min-width: unset; }
.filter-label {
    font-size: 0.65rem; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.25rem;
}
.filter-input, .filter-select {
    height: 2rem; border: 1px solid var(--border); border-radius: 0.4rem;
    padding: 0 0.6rem; font-size: 0.8rem; color: var(--text-primary);
    background: var(--bg-surface-2); outline: none; width: 100%; appearance: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.filter-input:focus, .filter-select:focus {
    border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow);
}
.filter-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 0.5rem center; padding-right: 1.7rem;
}
.filter-search-wrap { position: relative; }
.filter-search-icon {
    position: absolute; left: 0.6rem; top: 50%; transform: translateY(-50%);
    width: 0.8rem; height: 0.8rem; color: var(--text-muted); pointer-events: none;
}
.filter-input--search { padding-left: 1.9rem; }
.filter-actions { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; }
.filter-count { font-size: 0.77rem; color: var(--text-secondary); white-space: nowrap; font-weight: 500; }
.filter-btn-clear {
    display: inline-flex; align-items: center; gap: 0.3rem; height: 2rem;
    padding: 0 0.8rem; border-radius: 0.4rem; border: 1px solid var(--border);
    background: var(--bg-surface-2); color: var(--text-secondary);
    font-size: 0.77rem; font-weight: 500; cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}
.filter-btn-clear:hover { border-color: var(--brand); color: var(--brand); }
.filter-btn-clear.has-filters { border-color: rgba(239,68,68,0.4); color: var(--danger); }

/* 高级筛选折叠 */
.filter-advanced-toggle {
    display: inline-flex; align-items: center; gap: 0.3rem;
    font-size: 0.72rem; color: var(--text-muted); cursor: pointer;
    padding: 0.2rem 0.5rem; border-radius: 0.35rem;
    border: 1px solid var(--border-light); background: transparent;
    transition: color 0.15s, border-color 0.15s; margin-top: 0.5rem;
}
.filter-advanced-toggle:hover { color: var(--brand); border-color: var(--brand); }
.filter-advanced-row { overflow: hidden; max-height: 0; transition: max-height 0.3s ease; }
.filter-advanced-row.open { max-height: 200px; margin-top: 0.6rem; }

/* 激活 tag */
.active-filters { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.5rem; padding-top: 0.5rem; border-top: 1px solid var(--border-light); }
.active-filters.hidden { display: none; }
.filter-tag {
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0.15rem 0.5rem 0.15rem 0.6rem;
    background: rgba(59,130,246,0.08); border: 1px solid rgba(59,130,246,0.2);
    border-radius: 99px; font-size: 0.69rem; font-weight: 500; color: var(--brand);
}
.filter-tag button { background: none; border: none; padding: 0; cursor: pointer; color: var(--text-muted); font-size: 0.75rem; display: inline-flex; align-items: center; }
.filter-tag button:hover { color: var(--brand); }

/* 视图切换（筛选面板内） */
.view-toggle-group { display: flex; border: 1px solid var(--border); border-radius: 0.4rem; overflow: hidden; background: var(--bg-surface-2); }
.view-toggle-btn { display: flex; align-items: center; gap: 0.3rem; padding: 0.3rem 0.65rem; font-size: 0.73rem; font-weight: 500; color: var(--text-muted); background: transparent; border: none; cursor: pointer; transition: background 0.15s, color 0.15s; }
.view-toggle-btn.active { background: var(--brand); color: #fff; }
.view-toggle-btn:not(.active):hover { background: var(--border-light); color: var(--text-primary); }

/* 售罄 Toggle */
.toggle-switch { position: relative; display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer; user-select: none; }
.toggle-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track { width: 32px; height: 17px; background: var(--border); border-radius: 99px; position: relative; transition: background 0.2s; flex-shrink: 0; }
.toggle-track::after { content: ''; position: absolute; top: 2.5px; left: 2.5px; width: 12px; height: 12px; background: #fff; border-radius: 50%; transition: transform 0.2s; }
.toggle-switch input:checked + .toggle-track { background: var(--brand); }
.toggle-switch input:checked + .toggle-track::after { transform: translateX(15px); }

/* ==========================================================================
   主内容区
   ========================================================================== */
.main-content { max-width: 1440px; margin: 0 auto; padding: 1.25rem 1.5rem; }

/* ==========================================================================
   卡片视图
   ========================================================================== */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }

.product-card {
    position: relative;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--provider-color, var(--text-muted));
    border-radius: var(--radius);
    padding: 1rem;
    display: flex; flex-direction: column;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.2s, border-color 0.15s;
}
.product-card:hover {
    box-shadow: var(--shadow-md), var(--shadow-glow);
    transform: translateY(-2px);
}
/* F'2: 键盘聚焦时焦点环（仅键盘 Tab，不影响鼠标点击）*/
.product-card:focus { outline: none; }
.product-card:focus-visible {
    outline: 2px solid var(--brand, #3b82f6);
    outline-offset: 2px;
    box-shadow: var(--shadow-md), 0 0 0 4px rgba(59,130,246,0.18);
}
html.dark .product-card {
    background: linear-gradient(135deg, var(--bg-surface) 0%, rgba(14,22,41,0.95) 100%);
}
/* 售罄态完整样式见文件后部 .product-card.out-of-stock 强化版（Stage 1）*/

.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.provider-badge {
    display: inline-block; font-size: 0.66rem; font-weight: 700;
    color: var(--provider-color, var(--text-muted));
    background: var(--bg-surface-2); padding: 0.13rem 0.48rem;
    border-radius: 0.3rem; border: 1px solid var(--border);
}
.stock-badge { display: flex; align-items: center; gap: 0.3rem; font-size: 0.7rem; font-weight: 600; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.status-dot.in-stock   { background: var(--success); box-shadow: 0 0 0 3px rgba(22,163,74,.18); }
.status-dot.out-of-stock { background: var(--border); }
.card-title {
    font-size: 0.83rem; font-weight: 600; color: var(--text-primary); line-height: 1.4; margin-bottom: 0.6rem;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.price-block { display: flex; align-items: baseline; gap: 0.35rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.price-monthly-val { font-size: 1.4rem; font-weight: 800; color: var(--text-primary); line-height: 1; }
.price-monthly-unit { font-size: 0.76rem; color: var(--text-muted); }
.price-origin { font-size: 0.7rem; color: var(--text-muted); margin-left: auto; white-space: nowrap; }
.billing-chips { display: flex; flex-wrap: wrap; gap: 0.28rem; margin-bottom: 0.55rem; }
.billing-chip { font-size: 0.61rem; font-weight: 500; padding: 0.08rem 0.38rem; border-radius: 0.28rem; border: 1px solid var(--border); color: var(--text-muted); background: var(--bg-surface-2); white-space: nowrap; }
.billing-chip.cheapest { border-color: rgba(22,163,74,0.3); background: rgba(22,163,74,0.07); color: var(--success); font-weight: 700; }
.specs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.35rem 0.65rem; margin-bottom: 0.55rem; }
.spec-item { display: flex; align-items: center; gap: 0.28rem; font-size: 0.74rem; color: var(--text-secondary); }
.spec-item i { color: var(--text-muted); flex-shrink: 0; width: 13px; height: 13px; }
.spec-val { font-weight: 600; color: var(--text-primary); }
.location-row { display: flex; align-items: center; gap: 0.3rem; font-size: 0.7rem; color: var(--text-muted); margin-bottom: 0.55rem; flex-wrap: wrap; }
.test-ip { font-family: 'SFMono-Regular',Consolas,monospace; font-size: 0.63rem; color: var(--text-muted); background: var(--bg-surface-2); padding: 0.04rem 0.35rem; border-radius: 0.22rem; border: 1px solid var(--border); }
.card-actions { display: flex; gap: 0.45rem; margin-top: auto; padding-top: 0.7rem; }
.card-btn-detail { display: inline-flex; align-items: center; justify-content: center; gap: 0.28rem; flex: 0 0 auto; padding: 0.42rem 0.68rem; border-radius: 0.4rem; border: 1px solid var(--border); background: var(--bg-surface-2); color: var(--text-secondary); font-size: 0.75rem; font-weight: 600; cursor: pointer; transition: border-color 0.15s, color 0.15s, background 0.15s; }
.card-btn-detail:hover { border-color: var(--brand); color: var(--brand); background: rgba(59,130,246,0.06); }
.card-btn-buy { display: inline-flex; align-items: center; justify-content: center; gap: 0.32rem; flex: 1; padding: 0.45rem; border-radius: 0.4rem; background: var(--brand); color: #fff; font-size: 0.8rem; font-weight: 700; text-decoration: none; transition: background 0.15s; border: none; cursor: pointer; }
.card-btn-buy:hover { background: var(--brand-dark); }
.card-btn-buy--soldout { background: var(--bg-surface-2); color: var(--text-muted); cursor: not-allowed; pointer-events: none; }

/* ==========================================================================
   列表视图
   ========================================================================== */
.list-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.list-table th {
    text-align: left; padding: 0.6rem 0.85rem; font-size: 0.67rem; font-weight: 600;
    color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border); background: var(--bg-surface);
    position: sticky; top: 0; z-index: 5;
}
/* 状态/操作列防文字竖排挤压 */
.list-table th:nth-last-child(2),
.list-table td:nth-last-child(2) { min-width: 56px; width: 56px; white-space: nowrap; }
.list-table th:last-child,
.list-table td:last-child { min-width: 120px; width: 120px; white-space: nowrap; }
.list-detail, .list-buy { white-space: nowrap; }
/* 列表 wrapper 允许水平滚动并提示 */
#view-list > div { overflow-x: auto !important; }
.list-table { min-width: 1100px; }

/* C 响应式：宽屏 4 列饱满 + 中屏列表隐藏次要列 */
@media (min-width: 1600px) {
    .cards-grid { grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); }
}
@media (max-width: 1280px) {
    /* 隐藏 流量/端口/IPv4 之类的次要列 —— nth-child 对应 商家1 套餐2 价3 CPU4 内存5 存储6 流量7 端口8 地区9 状态10 操作11 */
    .list-table th:nth-child(7),
    .list-table td:nth-child(7),
    .list-table th:nth-child(8),
    .list-table td:nth-child(8) { display: none; }
    .list-table { min-width: 880px; }
}
@media (max-width: 980px) {
    /* 进一步隐藏 存储 + 内存 */
    .list-table th:nth-child(5),
    .list-table td:nth-child(5),
    .list-table th:nth-child(6),
    .list-table td:nth-child(6) { display: none; }
    .list-table { min-width: 680px; }
}

/* C-5: 地图高度重算（hero 移除后） */
.map-view-container {
    height: calc(100vh - 200px) !important;
    min-height: 500px;
}
@media (max-width: 768px) {
    .map-view-container { height: calc(100vh - 150px) !important; }
}
.list-table td { padding: 0.65rem 0.85rem; border-bottom: 1px solid var(--border-light); vertical-align: middle; color: var(--text-secondary); }
.list-table tbody tr { transition: background 0.12s; }
.list-table tr:hover td { background: var(--bg-surface-2); }
.list-table tbody tr:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
/* sticky 表头加底部细线阴影，向下滚动时与正文形成分层 */
.list-table th { box-shadow: 0 1px 0 rgba(0,0,0,0.06); }
html.dark .list-table th { box-shadow: 0 1px 0 rgba(255,255,255,0.04); }
.list-table tr.out-of-stock td { opacity: 0.5; }
.list-provider-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 0.4rem; vertical-align: middle; background: var(--provider-color, var(--text-muted)); }
.list-price { font-weight: 700; color: var(--text-primary); white-space: nowrap; }
.list-spec { white-space: nowrap; color: var(--text-secondary); }
.list-buy { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.3rem 0.7rem; border-radius: 0.35rem; background: var(--brand); color: #fff; font-size: 0.73rem; font-weight: 700; text-decoration: none; white-space: nowrap; transition: background 0.15s; }
.list-buy:hover { background: var(--brand-dark); }
.list-buy--soldout { background: var(--bg-surface-2); color: var(--text-muted); cursor: not-allowed; pointer-events: none; }

/* ==========================================================================
   地图视图
   ========================================================================== */
.map-view-container {
    display: flex; gap: 0; height: calc(100vh - 200px); min-height: 500px;
    border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
    box-shadow: var(--shadow-md);
}
.map-sidebar {
    width: 220px; flex-shrink: 0;
    background: var(--bg-surface); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; position: relative;
    transition: width 0.25s ease;
}
.map-sidebar-inner {
    flex: 1; overflow-y: auto; overflow-x: hidden;
    display: flex; flex-direction: column; min-height: 0;
    opacity: 1; transition: opacity 0.18s ease;
}
.map-sidebar.collapsed {
    width: 28px;
}
.map-sidebar.collapsed .map-sidebar-inner {
    opacity: 0; pointer-events: none;
}
/* G-2 + H-2: 折叠按钮——展开时探出，折叠时占据整条窄栏并明显可见 */
.map-sidebar-toggle {
    position: absolute; top: 50%; right: -14px; transform: translateY(-50%);
    width: 28px; height: 56px; border-radius: 0 10px 10px 0;
    border: 1px solid var(--border); border-left: none;
    background: var(--brand);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; z-index: 30;
    box-shadow: 2px 2px 8px rgba(0,0,0,0.18);
    transition: color 0.15s, background 0.15s, right 0.25s, width 0.25s, border-radius 0.25s, height 0.25s;
}
.map-sidebar-toggle:hover { background: var(--brand-dark); }
.map-sidebar-toggle svg { width: 16px; height: 16px; transition: transform 0.25s; }

/* 折叠后按钮覆盖整个窄栏，箭头放大并旋转 180° → 指向右（"点此展开"）。
   修复：之前 .sidebar-toggle-arrow + svg 同时套 180° 双重旋转相互抵消，
   现仅旋转外层 svg 一次，方向才正确。 */
.map-sidebar.collapsed .map-sidebar-toggle {
    right: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
    border: none;
    box-shadow: inset -2px 0 4px rgba(0,0,0,0.05);
}
.map-sidebar.collapsed .map-sidebar-toggle svg {
    width: 18px; height: 18px;
    transform: rotate(180deg);
}
.map-sidebar-header {
    padding: 0.75rem 0.9rem; border-bottom: 1px solid var(--border);
    font-size: 0.75rem; font-weight: 700; color: var(--text-primary);
    display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.map-sidebar-actions { display: flex; gap: 0.4rem; }
.map-sidebar-btn { font-size: 0.65rem; color: var(--text-muted); cursor: pointer; border: none; background: none; padding: 0.1rem 0.3rem; border-radius: 0.25rem; transition: color 0.15s; }
.map-sidebar-btn:hover { color: var(--brand); }
#map-sidebar-providers { padding: 0.5rem 0.6rem; flex: 1; overflow-y: auto; }
.map-provider-item {
    display: flex; align-items: center; gap: 0.45rem;
    padding: 0.4rem 0.5rem; border-radius: 0.4rem; cursor: pointer;
    font-size: 0.77rem; color: var(--text-secondary);
    transition: background 0.12s;
}
.map-provider-item:hover { background: var(--bg-surface-2); }
.map-provider-item input { accent-color: var(--brand); width: 13px; height: 13px; flex-shrink: 0; }
.map-prov-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--provider-color); flex-shrink: 0; }
.map-prov-name { flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-prov-count { font-size: 0.65rem; color: var(--text-muted); background: var(--bg-surface-2); padding: 0.05rem 0.4rem; border-radius: 0.25rem; }

.map-main { flex: 1; display: flex; flex-direction: column; }
#echarts-container { flex: 1; }

/* 地图底部产品弹出面板 */
.map-popup {
    background: var(--bg-surface); border-top: 1px solid var(--border);
    max-height: 220px; overflow-y: auto; transition: max-height 0.3s;
    flex-shrink: 0;
}
.map-popup.hidden { max-height: 0; overflow: hidden; }
.map-popup-header {
    padding: 0.6rem 1rem; border-bottom: 1px solid var(--border-light);
    display: flex; align-items: center; justify-content: space-between;
    font-size: 0.8rem; font-weight: 700; color: var(--text-primary); position: sticky; top: 0; background: var(--bg-surface);
}
.map-popup-close { background: none; border: none; cursor: pointer; color: var(--text-muted); display: flex; align-items: center; }
.map-popup-close:hover { color: var(--text-primary); }
.map-popup-cards { display: flex; gap: 0.75rem; padding: 0.75rem 1rem; flex-wrap: wrap; }
.map-popup-card {
    background: var(--bg-surface-2); border: 1px solid var(--border);
    border-radius: 0.55rem; padding: 0.7rem 0.85rem;
    min-width: 200px; flex: 1; max-width: 300px;
}
.map-popup-provider { font-size: 0.64rem; font-weight: 700; color: var(--brand); margin-bottom: 0.2rem; }
.map-popup-name { font-size: 0.8rem; font-weight: 600; color: var(--text-primary); margin-bottom: 0.35rem; line-height: 1.3; }
.map-popup-price { font-size: 1rem; font-weight: 800; color: var(--text-primary); }
.map-popup-buy { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.3rem 0.65rem; border-radius: 0.35rem; background: var(--brand); color: #fff; font-size: 0.72rem; font-weight: 700; text-decoration: none; margin-top: 0.5rem; }
.map-popup-buy:hover { background: var(--brand-dark); }

/* ==========================================================================
   分页
   ========================================================================== */
.pagination { display: flex; align-items: center; justify-content: center; gap: 0.35rem; margin-top: 1.5rem; flex-wrap: wrap; }
.page-btn { min-width: 1.9rem; height: 1.9rem; padding: 0 0.45rem; border-radius: 0.4rem; border: 1px solid var(--border); background: var(--bg-surface); color: var(--text-secondary); font-size: 0.78rem; font-weight: 500; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: border-color 0.15s, background 0.15s, color 0.15s; }
.page-btn:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.page-btn.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.page-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.page-info { font-size: 0.76rem; color: var(--text-muted); padding: 0 0.2rem; }

/* ==========================================================================
   详情弹窗
   ========================================================================== */
.modal-overlay { position: fixed; inset: 0; background: rgba(6,13,31,0.65); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; z-index: 1000; opacity: 0; pointer-events: none; transition: opacity 0.2s; padding: 1rem; }
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal-box { background: var(--bg-surface); border-radius: 1rem; border: 1px solid var(--border); width: 100%; max-width: 600px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); transform: translateY(10px); transition: transform 0.22s; display: flex; flex-direction: column; }
.modal-overlay.active .modal-box { transform: translateY(0); }
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; padding: 1.1rem 1.4rem 0.9rem; border-bottom: 1px solid var(--border-light); position: sticky; top: 0; background: var(--bg-surface); z-index: 2; border-radius: 1rem 1rem 0 0; }
.modal-merchant { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 0.28rem; }
.modal-title { font-size: 1rem; font-weight: 700; color: var(--text-primary); line-height: 1.35; }
.modal-close-btn { flex-shrink: 0; margin-left: 1rem; width: 1.9rem; height: 1.9rem; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 0.45rem; background: var(--bg-surface-2); color: var(--text-muted); cursor: pointer; }
.modal-close-btn:hover { background: var(--border-light); color: var(--text-primary); }
.modal-body { padding: 1rem 1.4rem; flex: 1; }

/* Stage 2: 详情弹窗 tabs（核心信息 / 历史与优惠） */
.modal-tabs {
    display: flex; gap: 0; padding: 0 1.4rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface);
}
.modal-tab {
    background: none; border: none; cursor: pointer;
    padding: 0.7rem 0.95rem;
    font-size: 0.8rem; font-weight: 600; color: var(--text-muted);
    border-bottom: 2px solid transparent;
    transition: color 0.12s, border-color 0.12s;
    display: inline-flex; align-items: center; gap: 0.35rem;
}
.modal-tab:hover { color: var(--text-primary); }
.modal-tab.active {
    color: var(--brand);
    border-bottom-color: var(--brand);
}
.modal-tab-badge {
    display: inline-block; min-width: 18px; height: 16px; line-height: 16px;
    padding: 0 5px; border-radius: 99px;
    background: var(--bg-surface-2); color: var(--text-muted);
    font-size: 0.62rem; font-weight: 800;
}
.modal-tab.active .modal-tab-badge {
    background: var(--brand); color: #fff;
}
.modal-tab-content.hidden { display: none; }
.modal-section { margin-bottom: 1.1rem; }
.modal-section:last-child { margin-bottom: 0; }
.modal-section-title { display: flex; align-items: center; gap: 0.35rem; font-size: 0.72rem; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.55rem; }
.modal-price-opts { display: flex; flex-wrap: wrap; gap: 0.55rem; }
.price-opt { border: 1px solid var(--border); border-radius: 0.55rem; padding: 0.6rem 0.85rem; background: var(--bg-surface-2); min-width: 130px; flex: 1; }
.price-opt--best { border-color: #f59e0b; background: rgba(245,158,11,0.07); }
.price-opt-main { display: flex; align-items: baseline; gap: 0.28rem; flex-wrap: wrap; }
.price-opt-amount { font-size: 1.05rem; font-weight: 800; color: var(--text-primary); }
.price-opt-label  { font-size: 0.73rem; color: var(--text-muted); }
.price-opt-badge  { font-size: 0.6rem; font-weight: 700; padding: 0.08rem 0.38rem; background: #f59e0b; color: #fff; border-radius: 0.28rem; margin-left: auto; }
.price-opt-sub    { font-size: 0.66rem; color: var(--text-muted); margin-top: 0.18rem; }
.modal-specs-chips { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.spec-chip { display: inline-flex; align-items: center; gap: 0.28rem; padding: 0.28rem 0.65rem; background: var(--bg-surface-2); border: 1px solid var(--border); border-radius: 0.38rem; font-size: 0.76rem; color: var(--text-secondary); }
.modal-locs { display: flex; flex-direction: column; gap: 0.5rem; }
.loc-row { display: flex; align-items: center; justify-content: space-between; padding: 0.5rem 0.85rem; background: var(--bg-surface-2); border: 1px solid var(--border); border-radius: 0.45rem; gap: 0.7rem; }
.loc-info { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }
.loc-name { font-size: 0.8rem; font-weight: 500; color: var(--text-primary); }
.loc-ip   { font-family: 'SFMono-Regular',Consolas,monospace; font-size: 0.67rem; color: var(--text-muted); background: var(--border-light); padding: 0.08rem 0.38rem; border-radius: 0.22rem; border: 1px solid var(--border); }
.loc-actions { display: flex; gap: 0.3rem; flex-shrink: 0; }
.loc-btn { font-size: 0.65rem; font-weight: 700; padding: 0.18rem 0.5rem; border-radius: 0.28rem; border: 1px solid; cursor: pointer; text-decoration: none; }
.loc-btn--ping { border-color: rgba(37,99,235,0.3); background: rgba(37,99,235,0.08); color: var(--brand); }
.loc-btn--ping:hover { background: rgba(37,99,235,0.15); }
.modal-footer { display: flex; gap: 0.7rem; padding: 0.9rem 1.4rem; border-top: 1px solid var(--border-light); position: sticky; bottom: 0; background: var(--bg-surface); z-index: 2; border-radius: 0 0 1rem 1rem; }
.modal-share-btn { display: inline-flex; align-items: center; gap: 0.32rem; padding: 0.5rem 0.9rem; border-radius: 0.45rem; border: 1px solid var(--border); background: var(--bg-surface-2); color: var(--text-secondary); font-size: 0.8rem; font-weight: 600; cursor: pointer; transition: border-color 0.15s; }
.modal-share-btn:hover { border-color: var(--brand); color: var(--brand); }
.modal-buy-btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.38rem; flex: 1; padding: 0.52rem 1rem; border-radius: 0.45rem; background: var(--brand); color: #fff; font-size: 0.85rem; font-weight: 700; text-decoration: none; transition: background 0.15s; }
.modal-buy-btn:hover { background: var(--brand-dark); }
.modal-buy-btn--soldout { background: var(--bg-surface-2); color: var(--text-muted); cursor: not-allowed; }

/* ==========================================================================
   时间线
   ========================================================================== */
.timeline-item { display: flex; align-items: flex-start; gap: 0.7rem; padding: 0.8rem 1rem; }
.timeline-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 0.32rem; flex-shrink: 0; }
.timeline-dot.restock { background: var(--success); box-shadow: 0 0 0 3px rgba(22,163,74,.15); }
.timeline-dot.soldout  { background: var(--danger);  box-shadow: 0 0 0 3px rgba(220,38,38,.12); }
/* F'4: 时间线展开/收起按钮 */
.timeline-more-btn {
    display: block; width: 100%; margin-top: 0.5rem; padding: 0.5rem 1rem;
    background: var(--bg-surface-2); border: 1px dashed var(--border);
    border-radius: 0.4rem; color: var(--text-muted); font-size: 0.78rem;
    cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.timeline-more-btn:hover { background: var(--bg-surface); color: var(--text-primary); border-color: var(--text-muted); }
.timeline-more-btn:focus-visible { outline: 2px solid var(--brand, #3b82f6); outline-offset: 2px; }

/* ==========================================================================
   商家分组标题
   ========================================================================== */
.provider-group-header { display: flex; align-items: center; gap: 0.6rem; padding: 0.45rem 0 0.35rem; margin-top: 0.5rem; border-bottom: 2px solid var(--border); grid-column: 1/-1; }
.provider-group-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--provider-color, var(--text-muted)); flex-shrink: 0; }
.provider-group-name { font-size: 0.88rem; font-weight: 700; color: var(--text-primary); }
.provider-group-count { font-size: 0.68rem; font-weight: 500; color: var(--text-muted); background: var(--bg-surface-2); border: 1px solid var(--border); padding: 0.07rem 0.42rem; border-radius: 0.28rem; }

/* ==========================================================================
   C5: 商家选择进度条
   ========================================================================== */
.map-prov-progress {
    padding: 0.45rem 0.85rem 0.55rem;
    display: flex; align-items: center; gap: 0.5rem;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}
.map-prov-progress-track {
    flex: 1; height: 4px; background: var(--bg-surface-2);
    border-radius: 2px; overflow: hidden;
}
.map-prov-progress-fill {
    height: 100%; background: linear-gradient(90deg, var(--brand), #6366f1);
    width: 0%; transition: width 0.25s ease;
}
.map-prov-progress-text {
    font-size: 0.65rem; color: var(--text-muted); font-weight: 600; white-space: nowrap;
}

/* C5: 未选中商家的灰度 + 边框淡化 */
.map-provider-item:not(.is-selected) .provider-logo-img,
.map-provider-item:not(.is-selected) .provider-logo-fallback {
    filter: grayscale(1); opacity: 0.45;
}
.map-provider-item:not(.is-selected) .map-prov-name {
    color: var(--text-muted); text-decoration: line-through; opacity: 0.7;
}
.map-provider-item.is-selected {
    background: linear-gradient(90deg, rgba(59,130,246,0.06), transparent);
    border-left: 2px solid var(--brand);
    padding-left: calc(0.5rem - 2px);
}
/* D5: 气泡 hover 时侧栏对应商家高亮 */
.map-provider-item.is-hovered {
    background: linear-gradient(90deg, rgba(245,158,11,0.18), rgba(245,158,11,0.06)) !important;
    border-left: 2px solid #f59e0b !important;
    padding-left: calc(0.5rem - 2px);
    transform: translateX(2px);
    transition: transform 0.15s, background 0.15s;
}

/* ==========================================================================
   C4: 地图浮动控件（缩放按钮 + 移动端汉堡）
   ========================================================================== */
.map-main { position: relative; }
.map-zoom-ctrl {
    position: absolute; right: 12px; top: 12px; z-index: 10;
    display: flex; flex-direction: column; gap: 4px;
    background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: 0.5rem; padding: 4px; box-shadow: var(--shadow-md);
}
.map-zoom-ctrl button {
    width: 30px; height: 30px; border: none; background: transparent;
    color: var(--text-primary); font-size: 1rem; font-weight: 700;
    cursor: pointer; border-radius: 0.35rem; line-height: 1;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
}
.map-zoom-ctrl button:hover { background: var(--bg-surface-2); color: var(--brand); }
.map-zoom-ctrl button:active { background: var(--border); }

/* M-1: 快捷键面板 */
.hotkey-panel {
    position: fixed; inset: 0; z-index: 9998;
    background: rgba(6,13,31,0.62); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none;
    transition: opacity 0.18s;
}
.hotkey-panel.active { opacity: 1; pointer-events: auto; }
.hotkey-panel-box {
    background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: 0.8rem;
    width: 100%; max-width: 480px;
    box-shadow: var(--shadow-lg);
    transform: translateY(8px); transition: transform 0.18s;
}
.hotkey-panel.active .hotkey-panel-box { transform: none; }
.hotkey-panel-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.92rem; font-weight: 700; color: var(--text-primary);
}
.hotkey-panel-head button {
    background: none; border: none; cursor: pointer;
    font-size: 1rem; color: var(--text-muted); padding: 0.2rem 0.4rem;
}
.hotkey-panel-head button:hover { color: var(--text-primary); }
.hotkey-list {
    padding: 0.7rem 1.1rem 1rem;
    display: flex; flex-direction: column; gap: 0.42rem;
    font-size: 0.82rem; color: var(--text-secondary);
}
.hotkey-item { display: flex; align-items: center; gap: 0.5rem; }
.hotkey-item span { flex: 1; }
.hotkey-item kbd {
    font-family: SFMono-Regular,Menlo,Consolas,monospace;
    font-size: 0.7rem; font-weight: 700;
    padding: 2px 7px; border-radius: 4px;
    background: var(--bg-surface-2);
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    color: var(--text-primary);
    min-width: 14px; text-align: center;
}
.hotkey-hint {
    margin-top: 0.4rem; padding-top: 0.55rem;
    font-size: 0.7rem; color: var(--text-muted);
    border-top: 1px dashed var(--border-light);
}

/* L-1: 地图搜索框（右上角浮动） */
.map-search {
    position: absolute; top: 12px; left: 12px; z-index: 13;
    width: 240px; max-width: 35vw;
}
.map-search-icon {
    position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
    width: 14px; height: 14px; color: var(--text-muted); pointer-events: none;
}
.map-search input {
    width: 100%; height: 34px;
    padding: 0 12px 0 32px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 0.78rem; color: var(--text-primary);
    box-shadow: var(--shadow-md);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.map-search input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-glow), var(--shadow-md);
}
.map-search-suggest {
    position: absolute; left: 0; right: 0; top: 38px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    max-height: 280px; overflow-y: auto;
    display: none;
}
.map-search-suggest.active { display: block; }
.search-item {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.45rem 0.7rem;
    font-size: 0.76rem; color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
}
.search-item:last-child { border-bottom: none; }
.search-item:hover, .search-item.highlight {
    background: var(--bg-surface-2);
    color: var(--text-primary);
}
.search-item-flag { width: 18px; height: 13px; border-radius: 2px; flex-shrink: 0; box-shadow: 0 0 0 1px rgba(0,0,0,0.08); }
.search-item-iata {
    font-family: SFMono-Regular,Menlo,Consolas,monospace;
    font-size: 0.66rem; font-weight: 700; letter-spacing: 0.5px;
    padding: 1px 5px; border-radius: 3px;
    background: rgba(59,130,246,0.12); color: var(--brand);
    flex-shrink: 0;
}
.search-item-name { flex: 1; font-weight: 500; }
.search-item-count {
    font-size: 0.65rem; color: var(--text-muted);
    background: var(--bg-surface-2); padding: 1px 6px; border-radius: 99px;
}
@media (max-width: 768px) { .map-search { display: none; } }

/* Stage 1: 地图加载失败降级 UI */
.map-fallback {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    width: 100%; height: 100%; min-height: 320px; padding: 2rem; text-align: center;
    color: var(--text-secondary); gap: 0.5rem;
}
.map-fallback-icon { font-size: 3rem; opacity: 0.5; }
.map-fallback-title { font-size: 1.05rem; font-weight: 700; color: var(--text-primary); }
.map-fallback-hint { font-size: 0.82rem; opacity: 0.85; max-width: 28rem; line-height: 1.5; }
.map-fallback-retry {
    margin-top: 0.5rem; padding: 0.45rem 1.1rem;
    background: var(--brand); color: #fff; border: none;
    border-radius: 0.45rem; font-size: 0.82rem; font-weight: 600;
    cursor: pointer; transition: background 0.15s;
}
.map-fallback-retry:hover { background: var(--brand-dark); }

/* K-1: 商家 logo 扇形 orbit（hover 气泡时绕圆显示） */
.map-orbit {
    position: absolute; inset: 0;
    /* 容器始终不接收事件，让点击穿透到下方 ECharts / canvas
       —— 仅 .orbit-logo / .orbit-city / .orbit-more 单独打开 pointer-events，
       这样"点击 orbit logo 之间的间隙"会穿透并触发 outside-close。 */
    pointer-events: none;
    z-index: 14;
}
.map-orbit.active::before {
    /* 中心连接线圆环 */
    content: '';
    position: absolute;
}
.orbit-logo {
    position: absolute;
    /* 42px：比 36px 更易点中，与内部 brand 图 28px 形成清晰边框 */
    width: 42px; height: 42px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 2px solid var(--prov-color, var(--brand));
    box-shadow: 0 4px 16px rgba(0,0,0,0.18), 0 0 0 3px rgba(255,255,255,0.6);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    pointer-events: auto;   /* orbit 容器是 none，子元素显式打开 */
    transition: transform 0.16s ease, box-shadow 0.16s;
    animation: orbit-pop 0.32s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    animation-delay: calc(var(--orbit-i, 0) * 35ms);   /* M-2: stagger 出场 */
}
/* 透明 hit area：把可悬停范围向外延 16px，鼠标稍偏不脱靶；
   inset 负值让 ::before 大于父元素并居中包裹，pointer-events 继承父级 auto */
.orbit-logo::before {
    content: '';
    position: absolute;
    inset: -16px;
    border-radius: 50%;
    /* 透明但接收事件；不进入文档流不影响布局 */
    background: transparent;
}
.orbit-logo:hover {
    transform: scale(1.18);
    box-shadow: 0 6px 20px rgba(0,0,0,0.25), 0 0 0 4px rgba(255,255,255,0.85);
    z-index: 2;
}
.orbit-logo .provider-logo-img,
.orbit-logo .provider-logo-fallback {
    /* 28px：与父 42px 协调，logo 主体更醒目（之前 24px 在 42px 容器内显得空旷） */
    width: 28px !important; height: 28px !important;
    border-radius: 50%; padding: 0;
    border: none; background: #fff;
}
/* L-2: 国家级 orbit 城市 chip */
.orbit-city {
    position: absolute;
    height: 34px; padding: 0 10px;
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 99px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.15), 0 0 0 3px rgba(255,255,255,0.6);
    cursor: pointer;
    pointer-events: auto;   /* orbit 容器是 none，子元素显式打开 */
    animation: orbit-pop 0.32s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    animation-delay: calc(var(--orbit-i, 0) * 35ms);   /* M-2: stagger 出场 */
    transition: transform 0.16s, box-shadow 0.16s, border-color 0.16s;
    white-space: nowrap;
}
/* 透明 hit area：与 .orbit-logo::before 同样作用，鼠标偏 12px 内不脱靶 */
.orbit-city::before {
    content: '';
    position: absolute;
    inset: -12px;
    border-radius: 99px;
    background: transparent;
}
.orbit-city:hover {
    transform: scale(1.06);
    border-color: var(--brand);
    box-shadow: 0 6px 18px rgba(59,130,246,0.3), 0 0 0 3px rgba(255,255,255,0.85);
    z-index: 2;
}
.orbit-city-iata {
    font-family: SFMono-Regular,Menlo,Consolas,monospace;
    font-size: 0.7rem; font-weight: 800; letter-spacing: 0.8px;
    color: var(--brand);
    padding: 2px 6px; border-radius: 3px;
    background: rgba(59,130,246,0.12);
}
.orbit-city-count {
    font-size: 0.7rem; font-weight: 700; color: var(--text-primary);
}

.orbit-count {
    position: absolute; right: -6px; bottom: -6px;
    background: var(--prov-color, var(--brand));
    color: #fff; font-size: 0.6rem; font-weight: 800;
    min-width: 18px; height: 18px; line-height: 18px;
    border-radius: 99px; padding: 0 4px;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.25);
    border: 2px solid var(--bg-surface);
}
.orbit-more {
    position: absolute;
    background: var(--bg-surface); border: 1px dashed var(--border);
    color: var(--text-muted); font-size: 0.62rem; font-weight: 600;
    padding: 2px 8px; border-radius: 99px;
    animation: orbit-pop 0.4s both;
    pointer-events: none;
    white-space: nowrap;
}
.orbit-more-btn {
    background: linear-gradient(135deg, var(--brand), #6366f1);
    color: #fff; border: none;
    padding: 4px 12px; font-size: 0.66rem; font-weight: 700;
    cursor: pointer; pointer-events: auto;
    box-shadow: 0 2px 6px rgba(59,130,246,0.28);
    transition: transform 0.12s, box-shadow 0.12s;
}
/* "查看全部" 按钮的 hit area 外延 10px，避免鼠标对得稍偏就脱靶 */
.orbit-more-btn::before {
    content: '';
    position: absolute;
    inset: -10px;
    border-radius: 99px;
    background: transparent;
}
.orbit-more-btn:hover {
    transform: scale(1.06);
    box-shadow: 0 3px 9px rgba(59,130,246,0.4);
}
@keyframes orbit-pop {
    0%   { opacity: 0; transform: scale(0.3) translateY(8px); }
    60%  { opacity: 1; transform: scale(1.08); }
    100% { opacity: 1; transform: scale(1); }
}

/* M-3: 搜索定位涟漪 */
.map-ripple {
    position: absolute;
    width: 40px; height: 40px;
    border-radius: 50%;
    pointer-events: none;
    animation: map-ripple 1.2s ease-out forwards;
    z-index: 16;
}
@keyframes map-ripple {
    0%   { box-shadow: 0 0 0 0 rgba(59,130,246,0.55), 0 0 0 0 rgba(59,130,246,0.4); opacity: 1; }
    60%  { box-shadow: 0 0 0 36px rgba(59,130,246,0.05), 0 0 0 18px rgba(59,130,246,0.15); opacity: 0.9; }
    100% { box-shadow: 0 0 0 64px rgba(59,130,246,0), 0 0 0 40px rgba(59,130,246,0); opacity: 0; }
}

/* J-2: 地图图例 mini panel（右下角悬浮） */
.map-legend {
    position: absolute; right: 12px; bottom: 12px; z-index: 11;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 0.55rem;
    box-shadow: var(--shadow-md);
    max-width: 290px;
    overflow: hidden;
    transition: max-width 0.25s ease;
}
.map-legend-toggle {
    width: 100%; display: flex; align-items: center; gap: 0.4rem;
    padding: 0.4rem 0.7rem;
    background: var(--bg-surface-2); border: none; border-bottom: 1px solid var(--border);
    color: var(--text-primary); font-size: 0.75rem; font-weight: 700;
    cursor: pointer; text-align: left;
}
.map-legend-toggle:hover { background: var(--border-light); }
.map-legend-icon { font-size: 0.85rem; color: var(--brand); }
.map-legend-body {
    padding: 0.55rem 0.7rem;
    display: flex; flex-direction: column; gap: 0.42rem;
    font-size: 0.7rem; color: var(--text-secondary); line-height: 1.4;
}
.map-legend.collapsed .map-legend-body { display: none; }
.map-legend.collapsed { max-width: 86px; }
.map-legend.collapsed .map-legend-toggle { border-bottom: none; }
.legend-item { display: flex; align-items: center; gap: 0.4rem; }
.legend-dot {
    width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.legend-iata {
    font-family: SFMono-Regular,Menlo,Consolas,monospace;
    font-size: 0.62rem; font-weight: 700; letter-spacing: 0.5px;
    padding: 1px 5px; border-radius: 3px;
    background: rgba(59,130,246,0.12); color: var(--brand);
    flex-shrink: 0;
}
.legend-num {
    font-size: 0.65rem; font-weight: 800; color: #fff;
    padding: 1px 5px; border-radius: 99px;
    background: #22c55e; flex-shrink: 0;
}
/* 移动端不显示图例（地图已隐藏，但保险起见） */
@media (max-width: 768px) {
    .map-legend { display: none; }
}

.map-mobile-menu {
    display: none;   /* PC 隐藏 */
    position: absolute; left: 12px; top: 12px; z-index: 11;
    width: 38px; height: 38px; border-radius: 0.5rem;
    background: var(--bg-surface); border: 1px solid var(--border);
    color: var(--text-primary); font-size: 1.2rem; cursor: pointer;
    box-shadow: var(--shadow-md); line-height: 1;
}
.map-mobile-menu:active { background: var(--bg-surface-2); }

/* D3: 地图视图在移动端无实用价值，直接隐藏入口 */
@media (max-width: 768px) {
    #tab-map { display: none !important; }
}

/* 移动端 */
@media (max-width: 640px) {
    .nav-search { display: none; }
    .filter-field { flex: 1 1 calc(50% - 0.3rem); }
    .filter-field--wide { flex: 1 1 100%; }
    .filter-actions { width: 100%; justify-content: space-between; }
    .hero-stats { gap: 1rem; }

    /* C4: 商家侧栏改为 Drawer（左滑入） */
    .map-mobile-menu { display: flex; align-items: center; justify-content: center; }
    .map-view-container { position: relative; }
    .map-sidebar {
        position: absolute; left: 0; top: 0; bottom: 0; z-index: 20;
        width: 240px; transform: translateX(-100%);
        transition: transform 0.25s ease; box-shadow: 4px 0 16px rgba(0,0,0,0.18);
    }
    .map-view-container.map-mobile-open .map-sidebar { transform: translateX(0); }
    /* Drawer 打开时背景遮罩，点空白处关闭由 JS 处理 */
    .map-view-container.map-mobile-open::before {
        content: ''; position: absolute; inset: 0; z-index: 15;
        background: rgba(0,0,0,0.4); pointer-events: none;
    }

    /* C4: 国家旗帜栏改为水平滚动 */
    .map-country-bar {
        flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden;
        max-height: none; padding: 0.5rem 0.2rem 0.6rem;
    }
    .map-country-bar::-webkit-scrollbar { height: 4px; }
    .country-chip { flex-shrink: 0; }

    /* C4: 底部弹窗改为 bottom-sheet，默认 40vh 上限，拖拽可至 90vh */
    .map-popup {
        position: absolute; left: 0; right: 0; bottom: 0; z-index: 25;
        max-height: 40vh; border-top-left-radius: 1rem; border-top-right-radius: 1rem;
        box-shadow: 0 -8px 24px rgba(0,0,0,0.3);
    }
    .map-popup.hidden { max-height: 0; }
    .map-popup-drag {
        width: 36px; height: 4px; background: var(--border); border-radius: 2px;
        margin: 6px auto 4px; cursor: ns-resize;
    }
    .map-popup-cards { flex-direction: column; padding: 0.6rem 0.8rem 1rem; }
    .map-popup-card { max-width: 100%; min-width: 0; }

    /* 缩放控件移动端略大、靠右上（M'4: 触控目标至少 44px，提升可点性）*/
    .map-zoom-ctrl { top: 12px; right: 12px; }
    .map-zoom-ctrl button { width: 44px; height: 44px; font-size: 1.25rem; }
    .map-mobile-menu { width: 44px; height: 44px; font-size: 1.25rem; }
}

/* ==========================================================================
   商家 Logo + 国旗（第一批新增）
   ========================================================================== */
.card-merchant { display: flex; align-items: center; gap: 0.45rem; min-width: 0; }
.provider-logo-img {
    border-radius: 0.35rem; object-fit: contain; background: #fff;
    border: 1px solid var(--border); flex-shrink: 0; padding: 1px;
}
.provider-logo-fallback {
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 0.35rem; color: #fff; font-weight: 800; flex-shrink: 0;
    font-size: 0.7rem; line-height: 1;
}
.card-header .provider-name {
    font-size: 0.72rem; font-weight: 700; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap;
}

/* 国旗 */
.flag-img {
    width: 16px; height: 12px; border-radius: 2px; object-fit: cover;
    flex-shrink: 0; box-shadow: 0 0 0 1px rgba(0,0,0,0.08); vertical-align: middle;
}
.loc-text { font-weight: 500; }
.loc-more {
    font-size: 0.6rem; color: var(--text-muted); background: var(--bg-surface-2);
    border: 1px solid var(--border); border-radius: 0.25rem; padding: 0 0.3rem; margin-left: 0.1rem;
}
.location-row { display: flex; align-items: center; gap: 0.35rem; }

/* 列表视图商家列 */
.list-merchant { display: inline-flex; align-items: center; gap: 0.4rem; }
.list-merchant .provider-logo-img,
.list-merchant .provider-logo-fallback { width: 18px; height: 18px; font-size: 0.6rem; }
.list-merchant span { font-weight: 600; color: var(--text-primary); }
.list-loc { display: inline-flex; align-items: center; gap: 0.3rem; overflow: hidden; }
.list-loc .flag-img { width: 15px; height: 11px; }
.list-actions { display: inline-flex; gap: 0.35rem; align-items: center; }
.list-detail {
    display: inline-flex; align-items: center; padding: 0.28rem 0.55rem;
    border-radius: 0.35rem; border: 1px solid var(--border); background: var(--bg-surface-2);
    color: var(--text-secondary); font-size: 0.7rem; font-weight: 600; cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}
.list-detail:hover { border-color: var(--brand); color: var(--brand); }

/* 详情弹窗 header 带 logo */
.modal-header-left { display: flex; align-items: flex-start; gap: 0.65rem; min-width: 0; }
.modal-header-left .provider-logo-img,
.modal-header-left .provider-logo-fallback { width: 32px; height: 32px; font-size: 0.9rem; margin-top: 0.15rem; }

/* 详情弹窗地区 logo */
.loc-info .flag-img { width: 18px; height: 13px; }
.loc-btn--copy { border-color: var(--border); background: var(--bg-surface-2); color: var(--text-secondary); }
.loc-btn--copy:hover { border-color: var(--brand); color: var(--brand); }

/* 地图弹窗卡片操作 */
.map-popup-provider { display: flex; align-items: center; gap: 0.35rem; font-size: 0.64rem; font-weight: 700; color: var(--brand); margin-bottom: 0.25rem; }
.map-popup-provider .provider-logo-img,
.map-popup-provider .provider-logo-fallback { width: 16px; height: 16px; font-size: 0.55rem; }
.map-popup-actions { display: flex; gap: 0.4rem; margin-top: 0.5rem; }
.map-popup-detail {
    display: inline-flex; align-items: center; padding: 0.3rem 0.6rem; border-radius: 0.35rem;
    border: 1px solid var(--border); background: var(--bg-surface); color: var(--text-secondary);
    font-size: 0.7rem; font-weight: 700; cursor: pointer; transition: border-color 0.15s, color 0.15s;
}
.map-popup-detail:hover { border-color: var(--brand); color: var(--brand); }
.map-popup-buy { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.3rem 0.65rem; border-radius: 0.35rem; background: var(--brand); color: #fff; font-size: 0.72rem; font-weight: 700; text-decoration: none; }
.map-popup-buy:hover { background: var(--brand-dark); }
.map-popup-buy--soldout { background: var(--bg-surface-2); color: var(--text-muted); cursor: not-allowed; pointer-events: none; }

/* ==========================================================================
   地图视图 — 第二批增强（国家筛选栏 / 商家搜索 / 弹窗拖拽）
   ========================================================================== */

/* 国家旗帜筛选栏（两排自动换行，超出滚动）*/
/* G-1: 国家旗帜栏两排 wrap（无滑轮，PC 直观全览）*/
.map-country-bar {
    display: flex; flex-wrap: wrap; gap: 0.4rem;
    padding: 0.55rem 0.2rem 0.6rem;
    max-height: none; overflow: visible;
    align-content: flex-start;
}
.country-chip { flex-shrink: 0; }
/* 仅移动端单行滚动（PC 一律两排）*/
@media (max-width: 768px) {
    .map-country-bar {
        flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
    }
    .map-country-bar::-webkit-scrollbar { height: 4px; }
}
.country-chip {
    display: inline-flex; align-items: center; gap: 0.35rem;
    padding: 0.32rem 0.6rem; border-radius: 99px;
    border: 1px solid var(--border); background: var(--bg-surface);
    color: var(--text-secondary); font-size: 0.76rem; font-weight: 500;
    cursor: pointer; white-space: nowrap; flex-shrink: 0;
    transition: border-color 0.15s, color 0.15s, background 0.15s, transform 0.1s;
}
.country-chip:hover {
    border-color: var(--brand); color: var(--text-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(59,130,246,0.12);
}
/* M-4: 国家 chip 选中状态强化 —— 品牌色渐变 + 提升阴影 */
.country-chip.active {
    background: linear-gradient(135deg, var(--brand) 0%, #6366f1 100%);
    border-color: var(--brand);
    color: #fff;
    box-shadow: 0 3px 12px rgba(59,130,246,0.35), 0 0 0 3px rgba(59,130,246,0.12);
    transform: translateY(-1px);
    font-weight: 700;
}
.country-chip-flag { width: 18px; height: 13px; border-radius: 2px; object-fit: cover; box-shadow: 0 0 0 1px rgba(0,0,0,0.08); }
.country-chip-icon { font-size: 0.9rem; }
.country-chip-name { font-weight: 600; }
.country-chip-count {
    font-size: 0.65rem; padding: 0.05rem 0.35rem; border-radius: 99px;
    background: var(--bg-surface-2); color: var(--text-muted);
}
.country-chip.active .country-chip-count { background: rgba(255,255,255,0.25); color: #fff; }

/* 商家搜索框 */
.map-sidebar-search { padding: 0.5rem 0.6rem 0.3rem; flex-shrink: 0; }
.map-sidebar-search input {
    width: 100%; height: 1.9rem; border: 1px solid var(--border);
    border-radius: 0.4rem; padding: 0 0.6rem; font-size: 0.78rem;
    background: var(--bg-surface-2); color: var(--text-primary); outline: none;
    transition: border-color 0.15s;
}
.map-sidebar-search input:focus { border-color: var(--brand); }

/* 商家项 logo */
.map-provider-item .provider-logo-img,
.map-provider-item .provider-logo-fallback { width: 18px; height: 18px; font-size: 0.6rem; flex-shrink: 0; }

/* 弹窗拖拽手柄 */
.map-popup { position: relative; }
.map-popup-drag {
    height: 14px; cursor: ns-resize; display: flex; align-items: center; justify-content: center;
    background: var(--bg-surface); border-bottom: 1px solid var(--border-light);
    flex-shrink: 0; user-select: none; touch-action: none;
}
.map-popup-drag::before {
    content: ''; width: 36px; height: 4px; border-radius: 99px;
    background: var(--border); transition: background 0.15s;
}
.map-popup-drag:hover::before { background: var(--brand); }
.map-popup { transition: none; }   /* 拖拽时禁用过渡，避免卡顿 */
.map-popup.animating { transition: max-height 0.25s ease; }

/* ── 弹窗浮动定位（始终在地图底部可见）── */
.map-main { position: relative; overflow: hidden; }
.map-popup {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 20;
    border-top: 1px solid var(--border);
    box-shadow: 0 -10px 30px rgba(0,0,0,0.15);
}
.map-popup.hidden { max-height: 0 !important; box-shadow: none; }
/* 地图容器适配视口（含两排国家栏）*/
.map-view-container { height: calc(100vh - 280px); min-height: 460px; }

/* ==========================================================================
   规格统一显示（标签 + 值）— 卡片/详情/地图一致
   ========================================================================== */
.spec-item { display: flex; align-items: center; gap: 0.3rem; font-size: 0.74rem; color: var(--text-secondary); min-width: 0; }
.spec-item i { color: var(--text-muted); flex-shrink: 0; width: 13px; height: 13px; }
.spec-label { color: var(--text-muted); font-size: 0.68rem; flex-shrink: 0; }
.spec-val { font-weight: 600; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 卡片 test IP → 可点击 Ping */
.test-ip--ping {
    text-decoration: none; cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}
.test-ip--ping:hover { border-color: var(--brand); color: var(--brand); }

/* ==========================================================================
   地图左侧商家栏 — 放大
   ========================================================================== */
.map-sidebar { width: 258px; }
.map-sidebar-header { padding: 0.85rem 1rem; font-size: 0.82rem; }
.map-sidebar-search { padding: 0.55rem 0.7rem 0.35rem; }
.map-sidebar-search input { height: 2.1rem; font-size: 0.82rem; }
#map-sidebar-providers { padding: 0.5rem 0.55rem; }
.map-provider-item {
    gap: 0.55rem; padding: 0.5rem 0.6rem; font-size: 0.84rem; border-radius: 0.5rem;
}
.map-provider-item .provider-logo-img,
.map-provider-item .provider-logo-fallback { width: 22px; height: 22px; font-size: 0.7rem; border-radius: 0.4rem; }
.map-provider-item input { width: 15px; height: 15px; }
.map-prov-name { font-weight: 600; }
.map-prov-count { font-size: 0.68rem; padding: 0.08rem 0.45rem; }

/* ==========================================================================
   地图弹窗卡片 — 加规格 + 状态徽章
   ========================================================================== */
.map-popup-card {
    display: flex; flex-direction: column; gap: 0.3rem;
    background: var(--bg-surface-2); border: 1px solid var(--border);
    border-radius: 0.6rem; padding: 0.7rem 0.8rem;
    min-width: 215px; flex: 1; max-width: 290px;
}
.map-popup-top { display: flex; align-items: center; justify-content: space-between; gap: 0.4rem; }
.map-popup-stock { font-size: 0.62rem; font-weight: 700; padding: 0.08rem 0.4rem; border-radius: 0.3rem; flex-shrink: 0; }
.map-popup-stock.in  { color: var(--success); background: rgba(22,163,74,0.1); }
.map-popup-stock.out { color: var(--text-muted); background: var(--bg-surface); }
.map-popup-name {
    font-size: 0.8rem; font-weight: 600; color: var(--text-primary); line-height: 1.3;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.map-popup-specs {
    font-size: 0.7rem; color: var(--text-secondary);
    background: var(--bg-surface); border: 1px solid var(--border-light);
    border-radius: 0.35rem; padding: 0.25rem 0.45rem; line-height: 1.4;
}
.map-popup-bottom { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-top: 0.15rem; }
.map-popup-price { font-size: 1.05rem; font-weight: 800; color: var(--text-primary); }
.map-popup-price .unit { font-size: 0.68rem; font-weight: 400; color: var(--text-muted); }
.map-popup-actions { display: flex; gap: 0.35rem; }

/* 列表 Ping 链接 */
.list-ping {
    display: inline-flex; align-items: center; justify-content: center;
    width: 18px; height: 18px; border-radius: 0.3rem; flex-shrink: 0;
    border: 1px solid var(--border); background: var(--bg-surface-2);
    color: var(--brand); text-decoration: none; font-size: 0.7rem;
    transition: border-color 0.15s, background 0.15s;
}
.list-ping:hover { border-color: var(--brand); background: rgba(59,130,246,0.1); }
.list-loc { display: inline-flex; align-items: center; gap: 0.3rem; }

/* ==========================================================================
   地图弹窗 — 商家筛选 chip 行
   ========================================================================== */
.map-popup-providers {
    display: flex; gap: 0.4rem; padding: 0.5rem 1rem;
    overflow-x: auto; overflow-y: hidden; flex-shrink: 0;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-surface);
    position: sticky; top: 0; z-index: 3;
    scrollbar-width: thin;
}
.map-popup-providers::-webkit-scrollbar { height: 4px; }
.popup-prov-chip {
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0.25rem 0.6rem; border-radius: 99px; flex-shrink: 0;
    border: 1px solid var(--border); background: var(--bg-surface-2);
    color: var(--text-secondary); font-size: 0.73rem; font-weight: 500;
    cursor: pointer; white-space: nowrap;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.popup-prov-chip:hover { border-color: var(--brand); color: var(--text-primary); }
.popup-prov-chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.popup-prov-chip .provider-logo-img,
.popup-prov-chip .provider-logo-fallback { width: 15px; height: 15px; font-size: 0.55rem; border-radius: 0.25rem; }
.ppc-name { font-weight: 600; }
.ppc-count {
    font-size: 0.62rem; padding: 0.04rem 0.35rem; border-radius: 99px;
    background: var(--bg-surface); color: var(--text-muted); border: 1px solid var(--border-light);
}
.popup-prov-chip.active .ppc-count { background: rgba(255,255,255,0.22); color: #fff; border-color: transparent; }

/* ==========================================================================
   国家栏英文全称 + 缩写
   ========================================================================== */
.country-chip-name { font-weight: 600; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.country-chip-code {
    font-size: 0.58rem; font-weight: 800; letter-spacing: 0.03em;
    color: var(--text-muted); background: var(--bg-surface-2);
    padding: 0.03rem 0.3rem; border-radius: 0.25rem; flex-shrink: 0;
}
.country-chip.active .country-chip-code { background: rgba(255,255,255,0.22); color: #fff; }

/* ==========================================================================
   弹窗商家 chip — 两排显示
   ========================================================================== */
.map-popup-providers {
    flex-wrap: wrap; max-height: 76px; overflow-y: auto; overflow-x: hidden;
    align-content: flex-start;
}
.map-popup-providers::-webkit-scrollbar { width: 4px; height: 4px; }

/* ==========================================================================
   侧边栏滚动框 — 深浅色适配增强
   ========================================================================== */
.map-sidebar { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.map-sidebar::-webkit-scrollbar { width: 6px; }
.map-sidebar::-webkit-scrollbar-track { background: var(--bg-surface); }
.map-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; border: 1px solid var(--bg-surface); }
.map-sidebar::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
#map-sidebar-providers { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
#map-sidebar-providers::-webkit-scrollbar { width: 6px; }
#map-sidebar-providers::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* ==========================================================================
   响应式适配（平板 / 手机 / 实时窗口缩放）
   ========================================================================== */

/* 平板及以下：≤ 1024px */
@media (max-width: 1024px) {
    .nav-search { max-width: 220px; }
    .cards-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
    .hero-stats { gap: 1.2rem; }
    .map-view-container { height: calc(100vh - 300px); }
}

/* Stage 2: 移动端筛选 Drawer（默认 PC 隐藏，≤768px 启用） */
.filter-mobile-toggle,
.filter-mobile-backdrop,
.filter-mobile-header { display: none; }

/* 平板竖屏 / 大手机：≤ 768px */
@media (max-width: 768px) {
    .nav-inner { padding: 0 0.9rem; gap: 0.6rem; }
    .nav-search { display: none; }
    .view-tab { padding: 0.35rem 0.55rem; }
    .hero-inner { flex-direction: column; align-items: flex-start; gap: 0.6rem; }
    .hero-stats { width: 100%; justify-content: space-between; gap: 0.8rem; }
    .filter-inner { padding: 0.6rem 0.9rem; }
    .cards-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0.75rem; }
    .main-content { padding: 1rem 0.9rem; }

    /* Stage 2: 筛选面板 → 底部上滑 Drawer */
    .filter-panel {
        position: fixed; left: 0; right: 0; bottom: 0; top: auto;
        max-height: 82vh; overflow-y: auto;
        border-radius: 1.2rem 1.2rem 0 0;
        box-shadow: 0 -6px 28px rgba(0,0,0,0.25);
        transform: translateY(100%);
        transition: transform 0.28s ease;
        z-index: 90;
    }
    .filter-panel.mobile-open { transform: translateY(0); }
    .filter-panel.hidden { display: block !important; transform: translateY(100%); }
    .filter-mobile-header {
        display: flex; align-items: center; justify-content: space-between;
        padding: 0.85rem 1rem;
        position: sticky; top: 0; background: var(--bg-surface);
        border-bottom: 1px solid var(--border);
        font-weight: 700; z-index: 2;
    }
    .filter-mobile-title { font-size: 0.95rem; }
    .filter-mobile-close-btn {
        background: var(--bg-surface-2); border: 1px solid var(--border);
        width: 30px; height: 30px; border-radius: 50%;
        font-size: 0.9rem; cursor: pointer; line-height: 1;
        color: var(--text-secondary);
    }
    .filter-mobile-close-btn:hover { background: var(--border); color: var(--text-primary); }
    /* 浮动触发按钮 */
    .filter-mobile-toggle {
        display: flex; align-items: center; gap: 0.4rem;
        position: fixed; right: 1rem; bottom: 1rem; z-index: 80;
        padding: 0.7rem 1.1rem; border-radius: 99px;
        background: var(--brand); color: #fff; border: none;
        box-shadow: 0 6px 18px rgba(37,99,235,0.45);
        font-size: 0.86rem; font-weight: 700;
        cursor: pointer;
    }
    .filter-mobile-toggle:hover { background: var(--brand-dark); }
    .filter-mobile-badge {
        background: #f59e0b; color: #fff;
        min-width: 18px; height: 18px; line-height: 18px;
        text-align: center; border-radius: 99px;
        font-size: 0.65rem; font-weight: 800; padding: 0 4px;
    }
    .filter-mobile-badge.hidden { display: none; }
    /* 地图视图时隐藏 toggle（map 视图没有筛选面板） */
    body.view-map .filter-mobile-toggle { display: none; }
    /* 遮罩 */
    .filter-mobile-backdrop {
        display: block;
        position: fixed; inset: 0; background: rgba(0,0,0,0.45);
        z-index: 85; opacity: 0; visibility: hidden;
        transition: opacity 0.2s, visibility 0.2s;
    }
    .filter-mobile-backdrop.active { opacity: 1; visibility: visible; }

    /* 地图：侧栏移到上方，整体纵向堆叠 */
    .map-view-container { flex-direction: column; height: auto; }
    .map-sidebar {
        width: 100%; max-height: 180px; flex-direction: column;
        border-right: none; border-bottom: 1px solid var(--border);
    }
    #map-sidebar-providers { display: grid; grid-template-columns: 1fr 1fr; gap: 0.2rem; }
    #echarts-container { height: 56vh; min-height: 360px; }
    .map-popup { max-height: 50vh !important; }

    /* 列表横向滚动 */
    .list-table { min-width: 760px; }

    /* 弹窗全屏化 */
    .modal-box { max-width: 100%; max-height: 92vh; }
}

/* 手机：≤ 480px */
@media (max-width: 480px) {
    .nav-logo-text { font-size: 0.95rem; }
    .view-tab span { display: none; }      /* 只留图标 */
    .view-tab { padding: 0.4rem 0.5rem; }
    .hero-title { font-size: 1rem; }
    .hero-stat-val { font-size: 1.3rem; }
    .cards-grid { grid-template-columns: 1fr; }
    .filter-field { flex: 1 1 100%; }
    .country-chip-name { max-width: 90px; }
    .map-country-bar { max-height: 110px; }
    #map-sidebar-providers { grid-template-columns: 1fr; }
    .map-popup-card { min-width: 100%; max-width: 100%; }
    .modal-footer { flex-direction: column; }
    .modal-share-btn { width: 100%; justify-content: center; }
}

/* ── 列表视图修正：商家列对齐 + 表格整体感 ── */
.list-merchant { white-space: nowrap; vertical-align: middle; }
.list-merchant .provider-logo-img,
.list-merchant .provider-logo-fallback { vertical-align: middle; }
.list-table thead th:first-child { border-top-left-radius: var(--radius); }
.list-table thead th:last-child { border-top-right-radius: var(--radius); }
#view-list > div { box-shadow: var(--shadow-sm); }
.list-table th { background: var(--bg-surface-2); }

/* ==========================================================================
   E 顶部瘦身：nav 内联 stats + 隐藏 hero-bar + AFF 横幅
   ========================================================================== */
.hero-bar { display: none !important; }

.nav-stats {
    display: flex; align-items: center; gap: 0.85rem;
    padding: 0 0.7rem;
    border-right: 1px solid var(--border);
    margin-right: 0.4rem;
}
.nav-stat {
    display: inline-flex; flex-direction: column; align-items: center; line-height: 1.05;
    min-width: 0;
}
.nav-stat > b {
    font-size: 0.92rem; font-weight: 800; color: var(--text-primary);
    letter-spacing: -0.01em;
}
.nav-stat > b.green { color: var(--success); }
.nav-stat > span:not(.nav-stat-dot) {
    font-size: 0.6rem; color: var(--text-muted); font-weight: 500;
    text-transform: uppercase; letter-spacing: 0.05em;
}
.nav-stat-update { flex-direction: row; gap: 0.32rem; align-items: center; padding-left: 0.25rem; }
.nav-stat-update > span { font-size: 0.72rem !important; color: var(--text-secondary) !important; text-transform: none !important; letter-spacing: 0 !important; font-weight: 500; }
.nav-stat-dot {
    width: 6px; height: 6px; border-radius: 50%; background: var(--success);
    box-shadow: 0 0 0 3px rgba(34,197,94,0.18);
    animation: pulse-dot 2.4s ease-in-out infinite;
    transition: background .2s, box-shadow .2s;
}
/* F⁵1: 数据陈旧时变黄/红，pulse 加快表示告警 */
.nav-stat-dot.warn {
    background: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245,158,11,0.22);
    animation-duration: 1.6s;
}
.nav-stat-dot.danger {
    background: var(--danger, #dc2626);
    box-shadow: 0 0 0 3px rgba(220,38,38,0.22);
    animation-duration: 1s;
}

/* F⁵3: 尊重用户偏好 — 系统设置"减少动效"时关闭所有装饰动画
 * 仍保留 transition（功能性反馈），仅去除 keyframe 动画与 transform 弹跳 */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
    }
    .product-card:hover { transform: none; }
    .nav-stat-dot { animation: none; }
}

@media (max-width: 1024px) {
    .nav-stats { gap: 0.55rem; padding: 0 0.45rem; }
    .nav-stat > b { font-size: 0.82rem; }
    .nav-stat > span:not(.nav-stat-dot) { font-size: 0.55rem; }
}
@media (max-width: 760px) {
    /* F'''4: 移动端折叠次要项，保留最关键的"套餐数 + 更新时间"，避免拥挤又不至完全消失 */
    .nav-stats { gap: 0.4rem; padding: 0 0.3rem; }
    .nav-stat[title="商家数"] { display: none; }
    .nav-stat > b { font-size: 0.78rem; }
    .nav-stat > span:not(.nav-stat-dot) { font-size: 0.5rem; }
    .nav-stat-update > span { font-size: 0.65rem !important; }
}
@media (max-width: 480px) {
    /* 极窄屏（手机竖屏）才完全隐藏，避免与汉堡按钮抢空间 */
    .nav-stats { display: none; }
}

/* ==========================================================================
   A 价格 chips 重做：周期 chip 平铺，每个显示真实总价 + 月均小字
   ========================================================================== */
.billing-chips { display: flex; flex-wrap: wrap; gap: 0.32rem; margin-bottom: 0.55rem; }
.billing-chip {
    display: inline-flex; align-items: baseline; gap: 0.3rem;
    padding: 0.22rem 0.5rem; border-radius: 0.36rem;
    border: 1px solid var(--border); background: var(--bg-surface-2);
    font-size: 0.68rem; line-height: 1.2; white-space: nowrap;
}
.billing-chip .bc-cycle { color: var(--text-muted); font-weight: 600; }
.billing-chip .bc-total { color: var(--text-primary); font-weight: 800; font-size: 0.78rem; }
.billing-chip .bc-monthly { color: var(--text-muted); font-size: 0.62rem; font-weight: 500; }
.billing-chip.best {
    border-color: rgba(245,158,11,0.45);
    background: linear-gradient(135deg, rgba(245,158,11,0.08), rgba(245,158,11,0.02));
}
.billing-chip.best .bc-total { color: #f59e0b; }
.billing-chip .bc-best-tag {
    font-size: 0.55rem; font-weight: 800; letter-spacing: 0.04em;
    padding: 0.05rem 0.3rem; background: #f59e0b; color: #fff;
    border-radius: 99px;
}

/* B1 卡片多机房列表 */
.card-locations {
    display: flex; flex-direction: column; gap: 0.25rem;
    margin-bottom: 0.55rem;
}
.card-loc-row {
    display: flex; align-items: center; gap: 0.35rem;
    font-size: 0.7rem; color: var(--text-secondary);
    padding: 0.1rem 0;
}
.card-loc-ping {
    font-family: 'SFMono-Regular',Consolas,monospace;
    font-size: 0.62rem;
    padding: 0.06rem 0.42rem;
    background: rgba(37,99,235,0.08);
    color: var(--brand);
    border: 1px solid rgba(37,99,235,0.22);
    border-radius: 0.3rem;
    text-decoration: none;
    white-space: nowrap;
    margin-left: auto;
    flex-shrink: 0;
}
.card-loc-ping:hover { background: rgba(37,99,235,0.16); border-color: var(--brand); }
.card-loc-more { font-size: 0.62rem; color: var(--text-muted); padding-left: 0.2rem; }

/* B 列表视图：多机房 + 真实总价 */
.list-loc-cell { max-width: 200px; vertical-align: top !important; padding-top: 0.45rem !important; }
.list-loc-row {
    display: flex; align-items: center; gap: 0.3rem;
    font-size: 0.7rem; padding: 0.1rem 0;
}
.list-loc-row .flag-img { width: 14px; height: 10px; }
.list-loc-more { font-size: 0.6rem; color: var(--text-muted); padding: 0.1rem 0; }
.list-ping {
    font-size: 0.65rem; padding: 0.05rem 0.32rem;
    border-radius: 0.25rem;
    background: rgba(37,99,235,0.1); color: var(--brand);
    border: 1px solid rgba(37,99,235,0.22);
    text-decoration: none;
    margin-left: 0.18rem;
}
.list-ping:hover { background: rgba(37,99,235,0.18); }
.list-price-real { font-size: 0.62rem; color: var(--text-muted); font-weight: 500; margin-top: 0.12rem; line-height: 1.1; }

/* B 地图弹窗：多机房列表 + 真实总价 */
.map-popup-locs {
    display: flex; flex-direction: column; gap: 0.2rem;
    margin: 0.35rem 0;
}
.map-popup-price-real {
    display: block; font-size: 0.62rem; color: var(--text-muted); font-weight: 500;
    margin-top: 0.1rem;
}

/* ==========================================================================
   TG 频道动态展示（tg-news.js）
   ========================================================================== */
.tg-section {
    max-width: 1440px; margin: 1rem auto 2rem; padding: 0 1.5rem;
}
.tg-section-title {
    font-size: 1rem; font-weight: 700; color: var(--text-primary);
    margin-bottom: 0.75rem; display: flex; align-items: center; gap: 0.5rem;
}
.tg-tabs {
    display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.7rem;
    border-bottom: 1px solid var(--border); padding-bottom: 0.5rem;
}
.tg-tab {
    display: inline-flex; align-items: center; gap: 0.35rem;
    padding: 0.42rem 0.8rem; border-radius: 0.5rem;
    border: 1px solid var(--border); background: var(--bg-surface);
    font-size: 0.78rem; color: var(--text-secondary); cursor: pointer;
    transition: all 0.15s;
}
.tg-tab:hover { border-color: var(--brand); color: var(--text-primary); }
.tg-tab.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.tg-tab-icon { font-size: 0.95rem; line-height: 1; }
.tg-tab-name { font-weight: 600; }
.tg-tab-count {
    font-size: 0.65rem; padding: 0.05rem 0.42rem; border-radius: 99px;
    background: var(--bg-surface-2); color: var(--text-muted);
}
.tg-tab.active .tg-tab-count { background: rgba(255,255,255,0.2); color: #fff; }

.tg-stream {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 0.6rem; max-height: 70vh; overflow-y: auto; padding-right: 0.35rem;
}
.tg-stream::-webkit-scrollbar { width: 4px; }
.tg-stream::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.tg-msg {
    background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: 0.55rem; padding: 0.65rem 0.8rem;
    display: flex; flex-direction: column; gap: 0.4rem;
}
.tg-msg-head {
    display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap;
    font-size: 0.65rem;
}
.tg-time { color: var(--text-muted); font-weight: 500; }
.tg-tag {
    display: inline-flex; align-items: center;
    padding: 0.08rem 0.4rem; border-radius: 0.28rem;
    background: var(--brand); color: #fff; font-weight: 700; font-size: 0.6rem;
    letter-spacing: 0.02em;
}
.tg-tag--green  { background: #22c55e; }
.tg-tag--red    { background: #ef4444; }
.tg-tag--blue   { background: #3b82f6; }
.tg-tag--orange { background: #f59e0b; }
.tg-tag--purple { background: #a855f7; }
.tg-tag--gray   { background: var(--text-muted); }

.tg-cat {
    font-size: 0.62rem; color: var(--text-muted); font-weight: 600;
    padding: 0.05rem 0.35rem; background: var(--bg-surface-2);
    border-radius: 0.22rem;
}
.tg-author {
    font-size: 0.64rem; color: var(--text-muted);
    font-family: 'SFMono-Regular',Consolas,monospace;
}
.tg-verify {
    font-size: 0.58rem; font-weight: 700; padding: 0.05rem 0.42rem; border-radius: 0.22rem;
}
.tg-verify--ok      { background: rgba(34,197,94,0.18); color: #16a34a; }
.tg-verify--bad     { background: rgba(239,68,68,0.18); color: #dc2626; }
.tg-verify--pending { background: rgba(245,158,11,0.18); color: #d97706; }

.tg-msg-title {
    font-size: 0.82rem; font-weight: 600; color: var(--text-primary); line-height: 1.35;
    word-break: break-word;
}
.tg-headline-price {
    font-size: 0.68rem; color: #f59e0b; font-weight: 700; margin-left: 0.4rem;
}
.tg-msg-meta {
    display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
    font-size: 0.65rem;
}
.tg-link {
    color: var(--brand); font-weight: 600; text-decoration: none;
    margin-left: auto;
}
.tg-link:hover { text-decoration: underline; }

/* Stage 2: TG 消息中可点击的商家名/域名（联动主筛选） */
.tg-provider-link {
    background: none; border: none; padding: 0;
    color: var(--brand); cursor: pointer;
    font: inherit;
    text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 2px;
    transition: color 0.12s;
}
.tg-provider-link:hover { color: var(--brand-dark); text-decoration-style: solid; }
/* .tg-cat.tg-provider-link 优先用 brand 色覆盖 .tg-cat 的 muted */
.tg-cat.tg-provider-link {
    color: var(--brand); background: rgba(37,99,235,0.1);
}
.tg-cat.tg-provider-link:hover { background: rgba(37,99,235,0.18); }

.tg-domain { font-size: 0.7rem; line-height: 1.6; }
.tg-domain-name { font-weight: 600; color: var(--text-secondary); }
.tg-sku {
    display: block; font-size: 0.7rem; color: var(--text-secondary);
    padding-left: 0.7rem; word-break: break-word;
}
.tg-sku-link, .tg-sku a { color: var(--brand); text-decoration: none; font-weight: 600; }
.tg-sku-more { font-size: 0.62rem; color: var(--text-muted); font-style: italic; }
.tg-rm { font-size: 0.65rem; color: #ef4444; padding-left: 0.7rem; }
.tg-msg-snippet {
    font-size: 0.7rem; color: var(--text-secondary); line-height: 1.45;
    white-space: pre-wrap; word-break: break-word;
}
.tg-empty {
    padding: 1.2rem; text-align: center; color: var(--text-muted);
    font-size: 0.78rem; background: var(--bg-surface); border-radius: var(--radius);
}

/* F2 Preset 快捷筛选 chip 行 */
.filter-presets {
    display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center;
    padding: 0.45rem 0 0.6rem;
    border-bottom: 1px dashed var(--border-light);
    margin-bottom: 0.6rem;
}
.filter-presets-label {
    font-size: 0.7rem; color: var(--text-muted); font-weight: 600;
    margin-right: 0.2rem;
}
.preset-chip {
    display: inline-flex; align-items: baseline; gap: 0.32rem;
    padding: 0.32rem 0.7rem; border-radius: 99px;
    border: 1px solid var(--border); background: var(--bg-surface);
    font-size: 0.74rem; font-weight: 600; color: var(--text-secondary);
    cursor: pointer; transition: all 0.15s;
    white-space: nowrap;
}
.preset-chip small { font-size: 0.6rem; color: var(--text-muted); font-weight: 500; }
.preset-chip:hover {
    border-color: var(--brand); color: var(--brand);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(37,99,235,0.12);
}
.preset-chip.active {
    background: var(--brand); border-color: var(--brand); color: #fff;
    box-shadow: 0 2px 8px rgba(37,99,235,0.32);
}
.preset-chip.active small { color: rgba(255,255,255,0.85); }
@media (max-width: 640px) {
    .filter-presets-label { display: none; }
    .filter-presets { gap: 0.32rem; padding: 0.4rem 0 0.5rem; }
    .preset-chip { font-size: 0.7rem; padding: 0.28rem 0.55rem; }
    .preset-chip small { display: none; }
}

/* F5 Skeleton 占位卡片 + shimmer 动画 */
.skeleton-card {
    background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1rem;
    box-shadow: var(--shadow-sm);
    display: flex; flex-direction: column; gap: 0.55rem;
    min-height: 320px;
}
.skeleton-card .sk-row { display: flex; align-items: center; gap: 0.5rem; }
.skeleton-card .sk-row--chips { gap: 0.35rem; margin: 0.2rem 0; }
.skeleton-card .sk-row--actions { margin-top: auto; gap: 0.6rem; }
.sk-line, .sk-block, .sk-pill, .sk-circle {
    background: linear-gradient(90deg, var(--bg-surface-2) 0%, var(--border) 50%, var(--bg-surface-2) 100%);
    background-size: 200% 100%;
    animation: sk-shimmer 1.4s ease-in-out infinite;
    border-radius: 4px;
}
.sk-line { height: 10px; flex: 1; }
.sk-line--lg { height: 14px; width: 70%; }
.sk-line--w40 { width: 40%; flex: none; }
.sk-line--w20 { width: 20%; flex: none; }
.sk-block { height: 38px; border-radius: 0.5rem; }
.sk-block--price { width: 55%; }
.sk-block--btn { width: 65%; height: 34px; border-radius: 0.4rem; }
.sk-pill { height: 22px; width: 60px; border-radius: 99px; }
.sk-pill--lg { width: 110px; height: 26px; border-radius: 0.36rem; }
.sk-circle { width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; }
.sk-grid {
    display: grid; grid-template-columns: 1fr 1fr 1fr;
    gap: 0.4rem 0.55rem; margin: 0.3rem 0;
}
@keyframes sk-shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

/* F8 AFF 信任标识徽章 */
.card-header-right { display: flex; align-items: center; gap: 0.35rem; flex-shrink: 0; }
.aff-badge {
    display: inline-flex; align-items: center; gap: 0.18rem;
    font-size: 0.55rem; font-weight: 800; letter-spacing: 0.03em;
    padding: 0.1rem 0.4rem; border-radius: 0.28rem;
    line-height: 1; white-space: nowrap;
}
.aff-badge--success {
    background: linear-gradient(135deg, rgba(34,197,94,0.18), rgba(34,197,94,0.08));
    color: #16a34a;
    border: 1px solid rgba(34,197,94,0.32);
}
.aff-badge--warn {
    background: linear-gradient(135deg, rgba(245,158,11,0.18), rgba(245,158,11,0.08));
    color: #f59e0b;
    border: 1px solid rgba(245,158,11,0.32);
}
.aff-badge--plain {
    background: var(--bg-surface-2);
    color: var(--text-muted);
    border: 1px solid var(--border);
}
/* 全局 .aff-badge（不带 modifier，AFF 横幅用）保持原黄色块样式 */
.aff-banner .aff-badge {
    background: #f59e0b; color: #fff;
    border: none; padding: 0.08rem 0.42rem;
    font-size: 0.58rem;
}

/* AFF 横幅（细条 + 可关闭）*/
.aff-banner {
    background: linear-gradient(90deg, rgba(245,158,11,0.10), rgba(245,158,11,0.04));
    border-bottom: 1px solid rgba(245,158,11,0.22);
}
.aff-banner-inner {
    max-width: 1440px; margin: 0 auto; padding: 0.35rem 1.5rem;
    display: flex; align-items: center; gap: 0.6rem;
    font-size: 0.72rem; color: var(--text-secondary);
}
.aff-badge {
    background: #f59e0b; color: #fff;
    padding: 0.08rem 0.42rem; border-radius: 0.28rem;
    font-size: 0.58rem; font-weight: 800; letter-spacing: 0.04em;
    flex-shrink: 0;
}
.aff-text { flex: 1; }
.aff-banner-close {
    background: none; border: none; cursor: pointer; color: var(--text-muted);
    font-size: 0.85rem; padding: 0.1rem 0.35rem; border-radius: 0.25rem;
    line-height: 1;
}
.aff-banner-close:hover { color: var(--text-primary); background: var(--bg-surface-2); }

/* ==========================================================================
   Phase D — 卡片打磨与字段暴露
   ========================================================================== */

/* D1: 价格区块强化 —— 有货态绿色渐变背景 + 加粗大字号 + 节省百分比 */
.price-block {
    display: flex; align-items: baseline; gap: 0.45rem;
    padding: 0.5rem 0.75rem; border-radius: 0.55rem;
    background: linear-gradient(135deg, rgba(34,197,94,0.10), rgba(34,197,94,0.03));
    border: 1px solid rgba(34,197,94,0.18);
    margin-bottom: 0.55rem;
    flex-wrap: wrap;
}
.product-card.out-of-stock .price-block {
    background: transparent; border-color: var(--border);
}
.price-monthly-val {
    font-size: 1.6rem !important; font-weight: 800; line-height: 1;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}
.price-monthly-unit { font-size: 0.78rem; color: var(--text-muted); margin-left: -0.18rem; }
.price-origin {
    font-size: 0.7rem; color: var(--text-muted); margin-left: auto; white-space: nowrap;
    text-decoration: line-through;
}
.price-save {
    font-size: 0.65rem; font-weight: 700; padding: 0.1rem 0.4rem;
    background: #f59e0b; color: #fff; border-radius: 0.28rem;
    margin-left: 0.35rem; white-space: nowrap;
}
/* Stage 1: 等效月付副字 — 让"年付折算"信息清晰但不抢主视觉 */
.price-equiv {
    flex-basis: 100%;
    font-size: 0.66rem; color: var(--text-muted);
    margin-top: 0.15rem; opacity: 0.85;
}
/* Stage 1: 仅有长周期时的注释 chip — 黄色边框警示用户"无月付选项" */
.price-cycle-note {
    font-size: 0.6rem; font-weight: 700; padding: 0.08rem 0.36rem;
    background: rgba(245,158,11,0.14); color: #d97706;
    border: 1px solid rgba(245,158,11,0.35);
    border-radius: 0.25rem;
    margin-left: 0.35rem; white-space: nowrap;
}
html.dark .price-cycle-note { color: #fbbf24; background: rgba(245,158,11,0.18); }

/* D2 (Stage 1 改进): 规格网格响应式 — auto-fit 让浏览器按可用宽度自动选列数
   - 卡片宽度 < 200px：自动单列（极窄移动端）
   - 200~320px：2 列
   - >320px：3 列（最常见的桌面）
   - >480px 单卡：4 列（超宽屏 / 列表视图）
   - minmax(110px, 1fr) 保障每格至少 110px 容下 "200 GB NVMe SSD" */
.product-card .specs-grid {
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)) !important;
    gap: 0.4rem 0.55rem;
}

/* D2 + D6: 规格 icon 强化 + 存储类型变色 */
.spec-item i { width: 14px !important; height: 14px !important; }
/* 规格紧凑布局；允许长字段折回第二行而非截断（用 break-word 而非 keep-all + ellipsis） */
.product-card .spec-item { font-size: 0.71rem; gap: 0.22rem; min-width: 0; align-items: flex-start; line-height: 1.35; }
.product-card .spec-item .spec-label { color: var(--text-muted); font-size: 0.65rem; flex-shrink: 0; }
.product-card .spec-item .spec-val {
    color: var(--text-primary); font-weight: 600; flex: 1; min-width: 0;
    /* 允许在空格 / 标点处换行；不再 ellipsis 截断 "200 GB NVMe SSD" */
    overflow-wrap: anywhere; word-break: normal;
}
.spec-item--storage-nvme i { color: #22c55e !important; }
.spec-item--storage-ssd  i { color: #3b82f6 !important; }
.spec-item--storage-hdd  i { color: var(--text-muted) !important; }

/* D3 强化（Stage 1）: 售罄态视觉
   - 斜纹纹理覆盖（不再仅靠 opacity 弱化，扫一眼就能区分）
   - 顶部红色横幅 "已售罄" 文字加粗放大
   - 价格区块灰化，避免用户被"低价"迷惑后才发现售罄
   不再用 !important opacity；让纹理与色彩主导视觉信号 */
.product-card.out-of-stock {
    opacity: 1 !important;
    position: relative;
    background-image:
        repeating-linear-gradient(
            -45deg,
            rgba(239,68,68,0.045) 0,
            rgba(239,68,68,0.045) 8px,
            transparent 8px,
            transparent 18px
        );
}
.product-card.out-of-stock::before {
    content: '已售罄';
    position: absolute; top: 0; left: 0; right: 0;
    padding: 0.38rem 0.6rem;
    background: linear-gradient(90deg, rgba(220,38,38,0.95), rgba(239,68,68,0.85));
    color: #fff; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.15em;
    border-radius: var(--radius) var(--radius) 0 0;
    text-align: center; z-index: 1;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.product-card.out-of-stock .card-header { padding-top: 1.9rem; }
/* 售罄卡片：价格、规格、机房整体 desaturate，避免"低价"误导 */
.product-card.out-of-stock .price-block,
.product-card.out-of-stock .specs-grid,
.product-card.out-of-stock .card-locations {
    filter: grayscale(0.7);
}
.product-card.out-of-stock .price-monthly-val {
    color: var(--text-muted) !important;
    text-decoration: line-through;
    text-decoration-thickness: 1.5px;
    text-decoration-color: rgba(220,38,38,0.6);
}

/* D3: 有货卡片状态点 + badge 脉冲 */
.status-dot.in-stock {
    animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
    0%, 100% { box-shadow: 0 0 0 3px rgba(34,197,94,0.22); }
    50%      { box-shadow: 0 0 0 6px rgba(34,197,94,0.05); }
}

/* D6: scraped_at 新鲜度角标 */
.card-fresh {
    position: absolute; top: 0.55rem; right: 0.6rem;
    font-size: 0.6rem; color: var(--text-muted); opacity: 0.65;
    pointer-events: none;
}
.card-fresh--stale { color: #f59e0b; opacity: 0.85; font-weight: 600; }
.product-card { position: relative; }

/* D6: AFF fallback 标记（"原始链接，无返利"提示）*/
.card-btn-buy.is-fallback::after {
    content: 'ⓘ'; margin-left: 0.32rem; opacity: 0.85; font-weight: 600;
}
.card-btn-buy.is-fallback {
    background: linear-gradient(135deg, var(--brand), #6b7280);
}

/* D6 (Stage 1): coupons 徽章升级为可点 button，hover 提示可点 */
.card-coupon-badge {
    display: inline-flex; align-items: center; gap: 0.25rem;
    padding: 0.1rem 0.45rem; font-size: 0.6rem; font-weight: 700;
    background: linear-gradient(135deg, #f59e0b, #ef4444); color: #fff;
    border-radius: 99px; margin-left: 0.3rem;
    border: none; cursor: pointer;
    transition: transform 0.12s, box-shadow 0.12s, filter 0.12s;
    line-height: 1.4;
}
.card-coupon-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(245,158,11,0.45);
    filter: brightness(1.08);
}
.card-coupon-badge:active { transform: translateY(0); }
.card-coupon-badge:focus-visible {
    outline: 2px solid #f59e0b; outline-offset: 2px;
}

/* Stage 1: 优惠码 Popover */
.coupon-popover {
    position: absolute; z-index: 9000;
    min-width: 220px; max-width: 320px;
    background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: 0.5rem; box-shadow: var(--shadow-lg);
    padding: 0; opacity: 0; visibility: hidden;
    transform: translateY(-4px) scale(0.97);
    transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
}
.coupon-popover.active {
    opacity: 1; visibility: visible; transform: translateY(0) scale(1);
}
.coupon-popover-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border);
    font-size: 0.7rem; font-weight: 700; color: var(--text-primary);
}
.coupon-popover-close {
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); font-size: 0.9rem;
    padding: 0 0.25rem; line-height: 1;
}
.coupon-popover-close:hover { color: var(--text-primary); }
.coupon-popover-body { padding: 0.4rem 0.5rem; display: flex; flex-direction: column; gap: 0.4rem; }
.coupon-item {
    display: flex; flex-direction: column; gap: 0.25rem;
    padding: 0.4rem 0.5rem;
    background: var(--bg-surface-2); border: 1px solid var(--border-light);
    border-radius: 0.35rem;
}
.coupon-desc { font-size: 0.7rem; color: var(--text-secondary); line-height: 1.35; }
.coupon-code-btn {
    display: flex; align-items: center; justify-content: space-between;
    gap: 0.4rem; background: var(--bg-surface); border: 1px dashed var(--brand);
    border-radius: 0.3rem; padding: 0.3rem 0.5rem;
    font-family: SFMono-Regular,Menlo,Consolas,monospace;
    font-size: 0.78rem; color: var(--brand); font-weight: 700;
    cursor: pointer; transition: background 0.12s, border-color 0.12s;
}
.coupon-code-btn:hover { background: var(--brand); color: #fff; }
.coupon-code-btn code { background: transparent; padding: 0; color: inherit; }
.coupon-copy-hint { font-size: 0.62rem; opacity: 0.75; font-family: inherit; font-weight: 600; }
.coupon-no-code { font-size: 0.68rem; color: var(--text-muted); font-style: italic; }

/* D6: 详情弹窗 mini timeline */
.modal-mini-timeline {
    display: flex; flex-direction: column; gap: 0.35rem;
    max-height: 180px; overflow-y: auto;
}
.modal-mini-timeline-item {
    display: flex; align-items: center; gap: 0.45rem;
    font-size: 0.72rem; padding: 0.3rem 0.55rem;
    background: var(--bg-surface-2); border: 1px solid var(--border);
    border-radius: 0.35rem;
}
.modal-mini-timeline-dot {
    width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;
}
.modal-mini-timeline-dot.restock { background: var(--success); }
.modal-mini-timeline-dot.soldout { background: var(--danger); }
.modal-mini-timeline-time { color: var(--text-muted); font-size: 0.66rem; margin-left: auto; }

/* D5: 容器级懒渲染（产品卡视口外延迟绘制）*/
.product-card { content-visibility: auto; contain-intrinsic-size: 360px; }

/* ==========================================================================
   C4: 移动端覆盖（放在文件末尾确保最高优先级，覆盖之前定义的 .map-country-bar 基线）
   ========================================================================== */
@media (max-width: 640px) {
    /* 移动端仍单行滚动（PC 现在是两排 wrap）*/
    .map-country-bar {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        max-height: 48px !important;
        padding: 0.5rem 0.2rem 0.6rem;
    }
    .country-chip { flex-shrink: 0; }

    /* 底部弹窗改为 bottom-sheet */
    .map-popup {
        max-height: 40vh !important;
        border-top-left-radius: 1rem;
        border-top-right-radius: 1rem;
        box-shadow: 0 -8px 24px rgba(0,0,0,0.3);
    }
    .map-popup-cards { flex-direction: column; padding: 0.6rem 0.8rem 1rem; }
    .map-popup-card { max-width: 100% !important; min-width: 0 !important; }
}

/* ═══════════════════════════════════════════════════════════════
   购买链接专业化 — 显示目标域名 + 外链 icon（卡片/列表/地图/详情共用）
   ═══════════════════════════════════════════════════════════════ */

/* 卡片内"立即购买"按钮：双行排列 主文案 + 域名 + 外链 icon */
.card-btn-buy { gap: 0.36rem; line-height: 1.15; flex-wrap: nowrap; }
.card-btn-buy__label {
    font-weight: 700;
}
.card-btn-buy__host {
    font-size: 0.62rem; font-weight: 500; letter-spacing: 0.01em;
    color: rgba(255, 255, 255, 0.78);
    padding: 0.05rem 0.32rem; border-radius: 0.25rem;
    background: rgba(255, 255, 255, 0.13);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    max-width: 90px;
}
.card-btn-buy__ext {
    flex-shrink: 0;
    opacity: 0.85;
    transition: transform 0.12s ease-out, opacity 0.12s ease-out;
}
.card-btn-buy:hover .card-btn-buy__ext {
    transform: translate(1px, -1px);
    opacity: 1;
}
/* fallback 状态下域名小标签视觉不变（按钮整体已是灰渐变） */
.card-btn-buy.is-fallback .card-btn-buy__host {
    background: rgba(255, 255, 255, 0.18);
}

/* 列表行内"购买"按钮：紧凑模式，仅 icon + 文本 */
.list-buy__ext {
    flex-shrink: 0;
    opacity: 0.8;
    transition: transform 0.12s ease-out;
}
.list-buy:hover .list-buy__ext {
    transform: translate(1px, -1px);
    opacity: 1;
}

/* 详情弹窗底部"前往购买"按钮：主文案 + 域名小标签 + 右侧外链 icon */
.modal-buy-btn__host {
    font-size: 0.7rem; font-weight: 500;
    color: rgba(255, 255, 255, 0.82);
    letter-spacing: 0.01em;
}

/* 暗色主题已经是浅文字，无需额外适配；prefers-reduced-motion 关闭 hover 动画 */
@media (prefers-reduced-motion: reduce) {
    .card-btn-buy__ext,
    .list-buy__ext,
    .card-btn-buy:hover .card-btn-buy__ext,
    .list-buy:hover .list-buy__ext {
        transition: none !important;
        transform: none !important;
    }
}

/* 移动端域名 chip 太窄就收起，只保留 icon */
@media (max-width: 480px) {
    .card-btn-buy__host { display: none; }
}

/* ═══════════════════════════════════════════════════════════════
   一键回到顶部 — 卡片/列表视图右下角浮动按钮
   ═══════════════════════════════════════════════════════════════ */
.back-to-top {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.32), 0 2px 6px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 80;
    opacity: 0;
    transform: translateY(12px) scale(0.92);
    pointer-events: none;
    transition: opacity 0.18s ease-out, transform 0.18s ease-out, background 0.15s;
}
.back-to-top.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}
.back-to-top:hover {
    background: var(--brand-dark);
    transform: translateY(-2px) scale(1.04);
}
.back-to-top:active {
    transform: translateY(0) scale(0.98);
}
.back-to-top:focus-visible {
    outline: 3px solid var(--brand);
    outline-offset: 3px;
}

/* 移动端：按钮稍小、靠右下边距更紧凑 */
@media (max-width: 768px) {
    .back-to-top {
        right: 0.9rem;
        bottom: 0.9rem;
        width: 42px;
        height: 42px;
    }
}

/* reduced-motion：关掉动画，但仍切换可见态 */
@media (prefers-reduced-motion: reduce) {
    .back-to-top {
        transition: opacity 0.01s !important;
        transform: none !important;
    }
    .back-to-top.is-visible,
    .back-to-top:hover,
    .back-to-top:active {
        transform: none !important;
    }
}
