/* 全局基礎與框架配置 */
body { background-color: #f1f5f9; color: #0f172a; font-family: ui-sans-serif, system-ui, sans-serif; margin: 0; padding: 0; }
.site-container { max-width: 1024px; margin: 0 auto; width: 100%; box-sizing: border-box; }

/* 雙層固定置頂懸浮層（廣告 + 導覽列） */
.sticky-wrapper { position: sticky; top: 0; z-index: 100; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); }
.ad-slot { background-color: #e2e8f0; text-align: center; padding: 12px 16px; border-radius: 12px 12px 0 0; margin-top: 16px; box-sizing: border-box; width: 100%; display: flex; justify-content: center; align-items: center; }
.ad-box { width: 100%; max-width: 728px; height: 90px; background-color: #cbd5e1; display: flex; align-items: center; justify-content: center; border-radius: 6px; border: 1px dashed #94a3b8; box-sizing: border-box; }
.ad-box p { color: #64748b; font-family: monospace; margin: 0; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }

header { background-color: #1e1b4b; color: #ffffff; border-bottom: 1px solid #312e81; }
.header-container { padding: 16px 24px; display: flex; justify-content: space-between; align-items: center; box-sizing: border-box; }
.logo { font-size: 1.25rem; font-weight: 900; color: #818cf8; text-decoration: none; letter-spacing: -0.025em; text-transform: lowercase; }

/* 導覽列按鈕 */
.btn-top, .btn-back { font-size: 0.75rem; background-color: #312e81; color: #a5b4fc; padding: 6px 14px; border-radius: 9999px; font-weight: 700; text-decoration: none; border: 1px solid #4338ca; transition: all 0.2s; }
.btn-top:hover, .btn-back:hover { background-color: #4f46e5; color: #ffffff; }

/* Hero 橫幅大區塊頂部強力等高切齊 */
.hero, .hero-inner { background-color: #1e1b4b; background-image: linear-gradient(to bottom, #1e1b4b, #0f172a); color: #ffffff; height: 200px; display: flex; flex-direction: column; justify-content: flex-start; padding-top: 52px; border-bottom: 1px solid #1e293b; box-sizing: border-box; }
.hero-content { max-width: 1024px; margin: 0 auto; width: 100%; padding: 0 24px; box-sizing: border-box; text-align: left; }

.hero h1, .hero-inner h1 { font-size: 2rem; font-weight: 900; margin: 0 0 8px 0; letter-spacing: -0.025em; line-height: 1.2; color: #ffffff; }
@media (min-width: 768px) { .hero h1, .hero-inner h1 { font-size: 2.25rem; } }

.hero p { color: #94a3b8; font-size: 0.95rem; max-width: 44rem; margin: 0; line-height: 1.5; }

/* 麵包屑優化樣式表 */
.bread { font-size: 0.95rem; color: #818cf8; margin: 0; line-height: 1.5; font-weight: 600; }
.bread span:first-child { color: #64748b; }
.bread .sep { color: #4338ca; margin: 0 4px; }
.bread a { color: #818cf8; text-decoration: none; transition: color 0.15s; }
.bread a:hover { color: #ffffff; }
.bread #bread { color: #a5b4fc; font-weight: 700; }

/* 主布局配置 */
.main-wrapper { padding: 24px 12px; box-sizing: border-box; }
.main-flex { display: flex; flex-direction: column; gap: 32px; width: 100%; }
.content-area { width: 100%; box-sizing: border-box; }
.sidebar-area { width: 100%; box-sizing: border-box; }

/* 🚀 平板與電腦大螢幕（大於 768px）：一秒彈性橫向炸開，回歸 66% 對齊與右側懸浮跟隨 */
@media (min-width: 768px) {
    .main-wrapper { padding: 40px 0; }
    .main-flex { flex-direction: row; justify-content: space-between; align-items: flex-start; gap: 0; }
    .content-area { flex: 0 0 66%; max-width: 66%; }
    .sidebar-area { flex: 0 0 calc(34% - 32px); max-width: calc(34% - 32px); position: sticky; top: 180px; }
}
/* 🚀 專為 768px 以下的手機螢幕進行字體與間距瘦身 */
@media (max-width: 767px) {
    /* 1. 縮小首頁與內頁大卡片的四周留白，釋放手機空間 */
    .card, .article-card { padding: 16px !important; }
    
    /* 2. 縮小藍色/黃色核心數據框的字體與間距，防止 HTS 碼太長換行擠壓 */
    .box-blue, .box-amber { padding: 16px !important; }
    .box-label { font-size: 0.7rem !important; margin-bottom: 4px !important; }
    .box-val { font-size: 1.25rem !important; }
    .box-copy-tag { margin-left: 4px !important; padding: 1px 4px !important; font-size: 0.6rem !important; }
    
    /* 3. 調降手機版的標題字級 */
    .card h2, h2 { font-size: 1.2rem !important; margin: 24px 0 12px 0 !important; }
    .card p.sub { font-size: 0.8rem !important; }
    
    /* 4. 👑 史詩級移動端表格 2D 交叉鎖定：標題行置頂吸附 + 品名欄左側凍結 */
    .table-container { overflow-x: auto !important; width: 100% !important; display: block !important; -webkit-overflow-scrolling: touch; }
    
    table { 
        width: 580px !important; 
        min-width: 580px !important; 
        max-width: 580px !important;
        table-layout: auto !important; 
        display: table !important; 
        font-size: 0.85rem !important; 
        flex-shrink: 0 !important;
    }
    
    th, td { padding: 14px 8px !important; }

    /* 🚀 核心優化一：強制讓整個 th 標題行在網頁往下滾動時，100% 強行「縱向置頂懸浮 (Sticky Top)」 */
    table th {
        position: sticky !important;
        top: 0 !important;               /* 緊緊吸附在最頂端 */
        z-index: 20 !important;          /* 權重設為 20，確保它永遠蓋在下方滾動的 100 行商品數據之上 */
        background-color: #f8fafc !important; /* 賦予乾淨底色，遮擋下方滾上去的文字 */
    }

    /* 🚀 核心優化二：維持商品品名 td 格子在橫向滑動時，死死「橫向凍結釘在最左邊 (Sticky Left)」 */
    #htstable td:first-child { 
        position: sticky !important;
        left: 0 !important;
        z-index: 10 !important;          /* 權重設為 10，低於 th 標題層，確保上下滾動時能被標題完美遮擋 */
        width: 160px !important; 
        min-width: 160px !important; 
        max-width: 180px !important; 
        text-align: left; 
        white-space: normal !important; 
        word-break: break-word !important;
        background-color: #ffffff !important; 
        box-shadow: 4px 0 8px -4px rgba(0,0,0,0.15) !important; /* 精美右側立體微陰影 */
    }

    /* 🚀 核心優化三：黃金交叉點死鎖！最左上角的第一個 th 欄位標頭（Product Category），強制命令它同時「Sticky Top + Left」 */
    table th:first-child {
        position: sticky !important;
        top: 0 !important;
        left: 0 !important;
        z-index: 30 !important;          /* 最高權限 30！不管是上下滾還是左右滑，這一格死死卡在左上角動彈不得！ */
        background-color: #f8fafc !important;
        box-shadow: 4px 0 8px -4px rgba(0,0,0,0.15) !important;
    }

    /* 當表格背景高亮時，保持對齊色調 */
    #htstable tr:hover td:first-child { background-color: #f8fafc !important; }
    
    /* 右側其餘 3 欄像素級硬性卡位 */
    table th:nth-child(2), table td:nth-child(2) { width: 140px !important; min-width: 140px !important; text-align: left; white-space: nowrap !important; }
    table th:nth-child(3), table td:nth-child(3) { width: 130px !important; min-width: 130px !important; text-align: left; white-space: normal !important; word-break: break-word !important; }
    table th:nth-child(4), table td:nth-child(4) { width: 110px !important; min-width: 110px !important; text-align: center; white-space: nowrap !important; }
    
    .btn-view { padding: 6px 10px !important; width: 84px !important; font-size: 0.7rem !important; }
    
    /* 5. 縮小置頂廣告框的高度 */
    .ad-box { height: 60px !important; }
    .ad-box p { font-size: 9px !important; }
    
    /* 6. 麵包屑優化 */
    .bread { font-size: 0.8rem !important; }
}

/* 卡片與數據大框框樣式 */
.card { background-color: #ffffff; padding: 32px; border-radius: 16px; border: 1px solid #e2e8f0; box-sizing: border-box; }
.card h2 { font-size: 1.5rem; font-weight: 800; margin: 0 0 8px 0; }
.card p.sub { color: #64748b; font-size: 0.875rem; margin: 0 0 24px 0; }
.article-card { background-color: #ffffff; padding: 32px; border-radius: 16px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.02); border: 1px solid #e2e8f0; box-sizing: border-box; min-height: 620px; }

.grid-data { display: grid; grid-template-cols: 1fr; gap: 20px; margin-bottom: 32px; }
@media (min-width: 768px) { .grid-data { grid-template-cols: 1fr 1fr; } }
.box-blue { background-color: #eff6ff; padding: 24px; border-radius: 12px; border: 1px solid #bfdbfe; text-align: center; cursor: pointer; transition: all 0.15s ease; position: relative; }
.box-blue:hover { background-color: #dbeafe; border-color: #3b82f6; transform: translateY(-1px); }
.box-amber { background-color: #fffbeb; padding: 24px; border-radius: 12px; border: 1px solid #fef3c7; text-align: center; }
.box-label { font-size: 0.75rem; font-weight: 700; color: #2563eb; text-transform: uppercase; letter-spacing: 0.05em; display: block; margin-bottom: 6px; }
.box-label.amber { color: #d97706; }
.box-val { font-size: 1.75rem; font-family: ui-monospace, SFMono-Regular, monospace; color: #1d4ed8; font-weight: 900; }
.box-val.amber { color: #ca8a04; font-family: inherit; }
.box-copy-tag { font-size: 0.65rem; color: #3b82f6; background-color: #ffffff; padding: 2px 6px; border-radius: 4px; border: 1px solid #bfdbfe; font-weight: bold; margin-left: 8px; vertical-align: middle; display: inline-block; transition: all 0.15s; }
.box-blue:hover .box-copy-tag { color: #ffffff; background-color: #2563eb; border-color: #2563eb; }

h2 { font-size: 1.35rem; font-weight: 800; color: #0f172a; margin: 40px 0 16px 0; letter-spacing: -0.02em; }
.compliance-container { background-color: #f8fafc; padding: 24px; border-radius: 12px; border: 1px solid #e2e8f0; font-size: 0.95rem; color: #334155; line-height: 1.6; }

/* 總表資料表格佈局 */
.table-container { overflow-x: auto; border-radius: 12px; border: 1px solid #e2e8f0; }
table { width: 100%; text-align: left; border-collapse: collapse; font-size: 0.9rem; table-layout: fixed; }
th, td { padding: 18px 16px; box-sizing: border-box; vertical-align: middle; white-space: nowrap; }
th { background-color: #f8fafc; border-bottom: 2px solid #e2e8f0; color: #475569; font-weight: 700; text-transform: uppercase; font-size: 0.75rem; }
td { border-bottom: 1px solid #f1f5f9; color: #334155; }

th:nth-child(1), td:nth-child(1) { width: 38%; text-align: left; }
th:nth-child(2), td:nth-child(2) { width: 27%; text-align: left; }
th:nth-child(3), td:nth-child(3) { width: 17%; text-align: left; }
th:nth-child(4), td:nth-child(4) { width: 18%; text-align: center; }

/* 強制第三欄寬度鎖死，允許複雜文字自動折行，絕不推擠右側按鈕 */
table td:nth-child(3) { white-space: normal !important; word-break: break-word; font-size: 0.8rem; line-height: 1.3; max-width: 140px; }

/* 強制第四欄 Action 按鈕的外殼穩如泰山，在任何 4K 螢幕下都 100% 水平中軸線切齊 */
table th:nth-child(4), table td:nth-child(4) { text-align: center; width: 110px !important; flex-shrink: 0; }

.prod-name { color: #0f172a; font-weight: 700; white-space: normal; }
.code-container { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; padding: 4px 8px; border-radius: 6px; transition: background 0.15s; }
.code-container:hover { background-color: #e0e7ff; }
.code-mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; color: #4f46e5; font-weight: 700; }
.copy-icon { font-size: 0.7rem; color: #a5b4fc; background: #f1f5f9; padding: 2px 5px; border-radius: 4px; border: 1px solid #e2e8f0; }
.code-container:hover .copy-icon { color: #4f46e5; background: #ffffff; border-color: #c7d2fe; }
.duty-amber { color: #ca8a04; font-weight: 700; }

/* 動作與廣告按鈕 */
.btn-view { font-size: 0.75rem; background-color: #eff6ff; color: #2563eb; padding: 8px 14px; border-radius: 8px; border: 1px solid #bfdbfe; font-weight: 700; text-decoration: none; display: inline-block; width: 84px; text-align: center; box-sizing: border-box; }
.btn-view:hover { background-color: #2563eb; color: #ffffff; }
.btn-aff { display: block; text-align: center; background-color: #f59e0b; color: #0f172a; font-weight: 800; font-size: 0.875rem; padding: 14px; border-radius: 10px; text-decoration: none; font-weight: 900; }
.btn-aff:hover { background-color: #d97706; }

/* 🚀 核心優化：全新設計的細分亞馬遜商品按鈕樣式 */
.btn-amazon-item { display: block; text-align: center; background-color: #0f172a; color: #ffffff; font-weight: 700; font-size: 0.8rem; padding: 10px; border-radius: 8px; text-decoration: none; border: 1px solid #1f2937; transition: all 0.2s ease; margin-bottom: 10px; }
.btn-amazon-item:hover { background-color: #232f3e; color: #ff9900; border-color: #ff9900; }
.btn-amazon-item:last-child { margin-bottom: 0; }

/* 側邊欄卡片 */
.sidebar-card { padding: 32px; background-color: #0f172a; background-image: linear-gradient(to bottom right, #1e293b, #0f172a); color: #ffffff; border-radius: 16px; margin-bottom: 24px; box-sizing: border-box; }
.sidebar-card h3 { font-size: 1.25rem; font-weight: 800; margin: 0 0 12px 0; color: #ffffff; }
.sidebar-card p { color: #94a3b8; font-size: 0.85rem; line-height: 1.6; margin: 0 0 24px 0; }
.sidebar-card-secondary { padding: 32px; background-color: #ffffff; color: #334155; border-radius: 16px; border: 1px solid #e2e8f0; box-sizing: border-box; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.02); }
.sidebar-card-secondary h3 { font-size: 1.15rem; font-weight: 800; margin: 0 0 12px 0; color: #0f172a; }
.sidebar-card-secondary p { color: #64748b; font-size: 0.85rem; line-height: 1.6; margin: 0 0 16px 0; }

.banner-indigo { margin-top: 48px; padding: 36px; background-color: #0f172a; background-image: linear-gradient(to bottom right, #1e293b, #0f172a); color: #ffffff; border-radius: 16px; border: 1px solid #1e293b; position: relative; overflow: hidden; }
.banner-indigo h3 { font-size: 1.35rem; font-weight: 800; color: #f59e0b; margin: 0 0 12px 0; }
.banner-indigo p { color: #94a3b8; font-size: 0.85rem; line-height: 1.6; margin: 0 0 24px 0; max-width: 44rem; }
.btn-banner { display: inline-block; background-color: #f59e0b; color: #0f172a; font-weight: 800; font-size: 0.875rem; padding: 12px 28px; border-radius: 10px; text-decoration: none; font-weight: 900; transition: all 0.2s ease; }
.btn-banner:hover { background-color: #d97706; }

footer { background-color: #0f172a; color: #64748b; text-align: center; padding: 48px 24px; font-size: 0.75rem; border-radius: 0 0 12px 12px; margin-bottom: 32px; border-top: 1px solid #1e293b; }
footer a { color: #64748b; text-decoration: none; margin: 0 8px; transition: color 0.15s; }
footer a:hover { color: #818cf8; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background-color: #0f172a; color: #ffffff; padding: 10px 20px; border-radius: 8px; font-size: 0.8rem; font-weight: 700; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.3); z-index: 1000; display: none; border: 1px solid #1e2937; }

/* 🚀 搜尋欄極致抽離：把首頁搜尋欄的外框、圓角、打字高亮特效大一統移至此處 */
.card-header-flex { display: flex; flex-direction: column; gap: 16px; margin-bottom: 24px; }
@media (min-width: 768px) {
    .card-header-flex { flex-direction: row; justify-content: space-between; align-items: flex-start; }
    .card-title-group { max-width: 65%; }
}
.search-wrapper { position: relative; width: 100%; max-width: 200px; }
.search-input { width: 100%; padding: 10px 14px; font-size: 0.875rem; border: 1px solid #cbd5e1; border-radius: 8px; background-color: #f8fafc; color: #0f172a; box-sizing: border-box; transition: all 0.15s ease; font-family: inherit; }
.search-input:focus { outline: none; border-color: #4f46e5; background-color: #ffffff; box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15); }

/* 🚀 手機與桌面大拇指救星：整行表格都能點選，並有超高級的行高亮特效 */
#htstable tr { cursor: pointer; transition: background-color 0.1s ease; }
#htstable tr:hover { background-color: #f8fafc; }

/* 🚀 搜尋無結果原生防禦列：100% 抽離行內樣式 */
#no-match-row { display: none; cursor: default; background-color: #f8fafc; }
#no-match-row td { text-align: center; padding: 32px; color: #64748b; white-space: normal !important; }
#no-match-row p { margin: 0 0 12px 0; }
#no-match-row p.no-match-title { font-weight: 700; color: #1e1b4b; }
#no-match-row p.no-match-sub { margin: 0 0 16px 0; font-size: 13px; }
#no-match-row .btn-aff { display: inline-block; padding: 8px 20px; font-size: 12px; }