/* 引入自定义字体 OPPOSans */
@font-face {
    font-family: 'OPPOSans';
    /* 下面这里的名字，必须和你在 fonts 文件夹里的文件名字一模一样！ */
    src: url('../fonts/OSans4.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

:root {
    --img-display-size: 200px;
    --cell-max-width: 350px;
    --cell-padding: 16px 20px;
    --img-margin: 8px 0;
    --cell-min-width: 140px;
}

body { font-family: "OPPOSans", "Segoe UI", "Microsoft YaHei", sans-serif; background-color: #f3f4f6; transition: background-color 0.3s; }
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

#resultArea { width: 100%; overflow-x: auto; text-align: center; display: flex; flex-direction: column; align-items: center; padding-bottom: 40px;}
#resultArea.hidden { display: none !important; }

#captureContainer {
    display: inline-block; text-align: left; transition: all 0.5s ease; box-sizing: border-box;
    padding: 40px; min-height: 100%;
}

#tableContent {
    display: inline-block;
    overflow: hidden;
    transition: all 0.3s;

    /* 🌟 终极修复：强制解决 html-to-image 圆角溢出与直角伪影 Bug */
    transform: translateZ(0);
    background-clip: padding-box;
    -webkit-mask-image: -webkit-radial-gradient(white, black);
}

table {
    width: max-content; margin: 0; border-spacing: 0;
    border-collapse: collapse !important; border: none !important;
    border-radius: 0 !important; box-shadow: none !important; background: transparent !important;
}

th, td {
    padding: var(--cell-padding); vertical-align: middle !important; text-align: center !important;
    transition: all 0.2s ease-out;
    min-width: var(--cell-min-width); /* 👈 这里换成了变量 */
    max-width: var(--cell-max-width);
    word-wrap: break-word; white-space: pre-wrap;
    position: relative;
    overflow: hidden;
}

td img, th img {
    height: var(--img-display-size);
    width: auto;
    max-width: 100%;
    object-fit: contain;
    border-radius: 0;
    margin: var(--img-margin);
    display: inline-block;
    vertical-align: middle;
    /* pointer-events: none;  <-- 🛑 把这一行删掉或注释掉，解开封印 */
    transition: height 0.1s ease-out, outline 0.1s;
    cursor: pointer; /* 🌟 新增：鼠标放上去变成小手 */
    position: relative;
    z-index: 1;
}

/* 🌟 新增：单张图片被选中时的猛男粉高亮 */
.selected-img {
    outline: 3px solid #ff00aa !important;
    outline-offset: 2px;
    box-shadow: 0 4px 15px rgba(255, 0, 170, 0.4);
}

input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: none; border-radius: 4px; box-shadow: 0 0 0 1px rgba(255,255,255,0.2); }
input[type=range] { -webkit-appearance: none; background: transparent; width: 60px; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; height: 14px; width: 14px; border-radius: 50%; background: #3b82f6; cursor: pointer; margin-top: -5px; box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
input[type=range]::-webkit-slider-runnable-track { width: 100%; height: 4px; cursor: pointer; background: #4b5563; border-radius: 2px; }

/* 1. 苹果毛玻璃 */
.theme-glass { background: radial-gradient(circle at 15% 50%, #fbcfe8, transparent 30%), radial-gradient(circle at 85% 30%, #c7d2fe, transparent 30%), radial-gradient(circle at 50% 80%, #bfdbfe, transparent 30%), linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%); }
.theme-glass #tableContent { background: rgba(255, 255, 255, 0.4); backdrop-filter: blur(24px) saturate(160%); border-radius: 20px; border: 1px solid rgba(255, 255, 255, 0.8); box-shadow: 0 10px 40px rgba(0,0,0,0.06); }
.theme-glass th, .theme-glass td { border-right: 1px solid rgba(255, 255, 255, 0.5) !important; border-bottom: 1px solid rgba(255, 255, 255, 0.5) !important; color: #1f2937; }
.theme-glass tr:last-child td, .theme-glass tr:last-child th { border-bottom: none !important; }
.theme-glass th:last-child, .theme-glass td:last-child { border-right: none !important; }
.theme-glass th.header-col { background: rgba(255, 255, 255, 0.25); font-weight: 700; color: #111827; }
.theme-glass th.product-col { background: rgba(255, 255, 255, 0.15); font-size: 1.05em; font-weight: 800; }
.theme-glass .diff-cell { background: rgba(239, 68, 68, 0.12); color: #b91c1c; font-weight: 700; }

/* 2. 经典商务 */
.theme-default { background: white; }
.theme-default #tableContent { border-radius: 12px; border: 1px solid #e5e7eb; background: white;}
.theme-default th, .theme-default td { border-bottom: 1px solid #e5e7eb !important; border-right: 1px solid #e5e7eb !important; }
.theme-default tr:last-child td, .theme-default tr:last-child th { border-bottom: none !important; }
.theme-default th:last-child, .theme-default td:last-child { border-right: none !important; }
.theme-default th.header-col { background-color: #f9fafb; font-weight: bold; color: #374151; }
.theme-default th.product-col { background-color: white; font-weight: bold; }
.theme-default .diff-cell { color: #b91c1c; background-color: #fef2f2; font-weight: 600; }

/* 3. ThinkPad 小黑商务 */
.theme-thinkpad { background: radial-gradient(circle at 85% 15%, rgba(226, 35, 26, 0.15), transparent 40%), linear-gradient(135deg, #1a1a1a 0%, #050505 100%); }
.theme-thinkpad #tableContent { background: rgba(30, 30, 30, 0.55); backdrop-filter: blur(24px) saturate(180%); border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.08); box-shadow: 0 10px 40px rgba(0,0,0,0.5); }
.theme-thinkpad th, .theme-thinkpad td { border-right: 1px solid rgba(255, 255, 255, 0.08) !important; border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important; color: #e5e7eb; }
.theme-thinkpad tr:last-child td, .theme-thinkpad tr:last-child th { border-bottom: none !important; }
.theme-thinkpad th:last-child, .theme-thinkpad td:last-child { border-right: none !important; }
.theme-thinkpad th.header-col { background: rgba(0, 0, 0, 0.4); font-weight: 700; color: #f9fafb; }
.theme-thinkpad th.product-col { background: rgba(0, 0, 0, 0.2); font-size: 1.05em; font-weight: 800; color: #f9fafb; }
.theme-thinkpad .diff-cell { background: rgba(226, 35, 26, 0.15); color: #ff6b6b; font-weight: 700; }

/* 4. ThinkBook 锐智青年 */
.theme-thinkbook { background: radial-gradient(circle at 10% 90%, rgba(14, 165, 233, 0.12), transparent 40%), linear-gradient(135deg, #f3f4f6 0%, #cbd5e1 100%); }
.theme-thinkbook #tableContent { background: rgba(255, 255, 255, 0.45); backdrop-filter: blur(20px) saturate(140%); border-radius: 16px; border: 1px solid rgba(255, 255, 255, 0.6); box-shadow: 0 10px 30px rgba(0,0,0,0.05); }
.theme-thinkbook th, .theme-thinkbook td { border-right: 1px solid rgba(255, 255, 255, 0.5) !important; border-bottom: 1px solid rgba(255, 255, 255, 0.5) !important; color: #334155; }
.theme-thinkbook tr:last-child td, .theme-thinkbook tr:last-child th { border-bottom: none !important; }
.theme-thinkbook th:last-child, .theme-thinkbook td:last-child { border-right: none !important; }
.theme-thinkbook th.header-col { background: rgba(255, 255, 255, 0.35); font-weight: 700; color: #0f172a; }
.theme-thinkbook th.product-col { background: rgba(255, 255, 255, 0.2); font-size: 1.05em; font-weight: 800; color: #0f172a; }
.theme-thinkbook .diff-cell { background: rgba(14, 165, 233, 0.15); color: #0284c7; font-weight: 700; }

/* 5. 小新 活力 */
.theme-xiaoxin { background: radial-gradient(circle at 10% 20%, rgba(255, 182, 193, 0.25), transparent 40%), radial-gradient(circle at 90% 80%, rgba(135, 206, 235, 0.25), transparent 40%), linear-gradient(135deg, #ffffff 0%, #f4f6f9 100%); }
.theme-xiaoxin #tableContent { background: rgba(255, 255, 255, 0.6); backdrop-filter: blur(16px) saturate(140%); border-radius: 20px; border: 2px solid rgba(255, 255, 255, 1); box-shadow: 0 10px 30px rgba(135, 206, 235, 0.1); }
.theme-xiaoxin th, .theme-xiaoxin td { border-right: 1px solid rgba(255, 255, 255, 0.7) !important; border-bottom: 1px solid rgba(255, 255, 255, 0.7) !important; color: #374151; }
.theme-xiaoxin tr:last-child td, .theme-xiaoxin tr:last-child th { border-bottom: none !important; }
.theme-xiaoxin th:last-child, .theme-xiaoxin td:last-child { border-right: none !important; }
.theme-xiaoxin th.header-col { background: rgba(255, 255, 255, 0.5); font-weight: 700; color: #1f2937; }
.theme-xiaoxin th.product-col { background: rgba(255, 255, 255, 0.3); font-size: 1.05em; font-weight: 800; color: #4f46e5; }
.theme-xiaoxin .diff-cell { background: rgba(99, 102, 241, 0.1); color: #4f46e5; font-weight: 700; }

/* 6. YOGA (轻奢温润金) */
.theme-yoga { background: radial-gradient(circle at 20% 80%, rgba(184, 151, 126, 0.15), transparent 50%), linear-gradient(135deg, #fdfbf7 0%, #e9e6df 100%); }
.theme-yoga #tableContent { background: rgba(255, 255, 255, 0.4); backdrop-filter: blur(30px) saturate(120%); border-radius: 24px; border: 1px solid rgba(255, 255, 255, 0.9); box-shadow: 0 20px 50px rgba(0,0,0,0.03); }
.theme-yoga th, .theme-yoga td { border-right: 1px solid rgba(0, 0, 0, 0.04) !important; border-bottom: 1px solid rgba(0, 0, 0, 0.04) !important; color: #524f4c; }
.theme-yoga tr:last-child td, .theme-yoga tr:last-child th { border-bottom: none !important; }
.theme-yoga th:last-child, .theme-yoga td:last-child { border-right: none !important; }
.theme-yoga th.header-col { background: rgba(255, 255, 255, 0.5); font-weight: 700; color: #2c2a29; }
.theme-yoga th.product-col { background: rgba(184, 151, 126, 0.05); font-size: 1.05em; font-weight: 800; color: #8b6d55; }
.theme-yoga .diff-cell { background: rgba(184, 151, 126, 0.1); color: #8b6d55; font-weight: 700; }

/* 7. 拯救者重制版 */
.theme-legion { background: repeating-linear-gradient(45deg, rgba(0,0,0,0.02), rgba(0,0,0,0.02) 2px, transparent 2px, transparent 6px), radial-gradient(circle at 80% 20%, rgba(0, 229, 255, 0.12), transparent 50%), linear-gradient(135deg, #0f111a 0%, #050608 100%); }
.theme-legion #tableContent { background: rgba(15, 17, 26, 0.7); backdrop-filter: blur(12px) saturate(150%); border-radius: 4px; border: 1px solid #2a2d3d; border-top: 3px solid #00e5ff; box-shadow: 0 10px 40px rgba(0, 229, 255, 0.05); }
.theme-legion th, .theme-legion td { border-right: 1px solid rgba(255, 255, 255, 0.05) !important; border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important; color: #9ca3af; }
.theme-legion tr:last-child td, .theme-legion tr:last-child th { border-bottom: none !important; }
.theme-legion th:last-child, .theme-legion td:last-child { border-right: none !important; }
.theme-legion th.header-col { background: rgba(0, 0, 0, 0.5); font-weight: 700; color: #e5e7eb; letter-spacing: 1px; }
.theme-legion th.product-col { background: rgba(0, 229, 255, 0.05); font-size: 1.05em; font-weight: 800; color: #00e5ff; text-transform: uppercase; }
.theme-legion .diff-cell { background: transparent; color: #00e5ff; font-weight: 800; text-shadow: 0 0 12px rgba(0, 229, 255, 0.5); }

/* 8. 华硕天选 */
.theme-tuf { background: radial-gradient(circle at 10% 10%, rgba(0, 200, 182, 0.15), transparent 40%), radial-gradient(circle at 90% 90%, rgba(200, 160, 255, 0.1), transparent 40%), linear-gradient(135deg, #f8f9fa 0%, #e2e8f0 100%); }
.theme-tuf #tableContent { background: rgba(255, 255, 255, 0.5); backdrop-filter: blur(16px); border-radius: 0px 16px 0px 16px; border: 2px solid rgba(255, 255, 255, 0.9); box-shadow: 0 10px 30px rgba(0, 200, 182, 0.08); }
.theme-tuf th, .theme-tuf td { border-right: 1px solid rgba(255, 255, 255, 0.6) !important; border-bottom: 1px solid rgba(255, 255, 255, 0.6) !important; color: #475569; }
.theme-tuf tr:last-child td, .theme-tuf tr:last-child th { border-bottom: none !important; }
.theme-tuf th:last-child, .theme-tuf td:last-child { border-right: none !important; }
.theme-tuf th.header-col { background: rgba(255, 255, 255, 0.4); font-weight: 700; color: #1e293b; }
.theme-tuf th.product-col { background: rgba(0, 200, 182, 0.1); font-size: 1.05em; font-weight: 800; color: #0f766e; }
.theme-tuf .diff-cell { background: rgba(0, 200, 182, 0.1); color: #0d9488; font-weight: 800; border-left: 3px solid #00c8b6; }

/* 9. 华硕灵耀 */
.theme-zenbook { background: linear-gradient(135deg, #0b1221 0%, #040812 100%); }
.theme-zenbook #tableContent { background: rgba(11, 18, 33, 0.7); backdrop-filter: blur(24px) saturate(120%); border-radius: 0px; border: 1px solid rgba(197, 160, 89, 0.2); box-shadow: 0 20px 50px rgba(0,0,0,0.5); }
.theme-zenbook th, .theme-zenbook td { border-right: 1px solid rgba(255, 255, 255, 0.05) !important; border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important; color: #94a3b8; }
.theme-zenbook tr:last-child td, .theme-zenbook tr:last-child th { border-bottom: none !important; }
.theme-zenbook th:last-child, .theme-zenbook td:last-child { border-right: none !important; }
.theme-zenbook th.header-col { background: rgba(0, 0, 0, 0.3); font-weight: 400; color: #cbd5e1; }
.theme-zenbook th.product-col { background: transparent; font-size: 1.05em; font-weight: 400; color: #c5a059; letter-spacing: 2px; text-transform: uppercase; }
.theme-zenbook .diff-cell { color: #dfb88e; font-weight: 600; background: rgba(197, 160, 89, 0.05); }

/* 10. ROG 枪神 */
.theme-strix { background: radial-gradient(ellipse at 30% 100%, rgba(255, 0, 60, 0.2), transparent 50%), radial-gradient(ellipse at 70% 100%, rgba(0, 229, 255, 0.15), transparent 50%), linear-gradient(180deg, #080808 0%, #000000 100%); }
.theme-strix #tableContent { background: rgba(15, 15, 15, 0.85); backdrop-filter: blur(10px); border-radius: 8px; border: 1px solid #222; border-bottom: 2px solid #ff003c; box-shadow: 0 15px 30px rgba(255, 0, 60, 0.1); }
.theme-strix th, .theme-strix td { border-right: 1px solid #1a1a1a !important; border-bottom: 1px solid #1a1a1a !important; color: #a1a1aa; }
.theme-strix tr:last-child td, .theme-strix tr:last-child th { border-bottom: none !important; }
.theme-strix th:last-child, .theme-strix td:last-child { border-right: none !important; }
.theme-strix th.header-col { background: #0a0a0a; font-weight: 800; color: #fff; }
.theme-strix th.product-col { background: #000; font-size: 1.1em; font-weight: 900; color: #fff; font-style: italic; }
.theme-strix .diff-cell { color: #ff003c; font-weight: 900; background: rgba(255, 0, 60, 0.05); text-shadow: 0 0 8px rgba(255, 0, 60, 0.6); }

/* 11. ROG 幻系列 */
.theme-zephyrus { background: linear-gradient(110deg, #f4f5f7 45%, #e2e6eb 45.2%, #e2e6eb 45.8%, #f4f5f7 46%); }
.theme-zephyrus #tableContent { background: rgba(255, 255, 255, 0.7); backdrop-filter: blur(20px); border-radius: 0px; border: 1px solid #fff; box-shadow: 0 10px 40px rgba(0,0,0,0.08); }
.theme-zephyrus th, .theme-zephyrus td { border-right: 1px solid #e5e7eb !important; border-bottom: 1px solid #e5e7eb !important; color: #4b5563; }
.theme-zephyrus tr:last-child td, .theme-zephyrus tr:last-child th { border-bottom: none !important; }
.theme-zephyrus th:last-child, .theme-zephyrus td:last-child { border-right: none !important; }
.theme-zephyrus th.header-col { background: rgba(249, 250, 251, 0.8); font-weight: 600; color: #111827; }
.theme-zephyrus th.product-col { background: transparent; font-size: 1.05em; font-weight: 800; color: #000; letter-spacing: 1px; }
.theme-zephyrus .diff-cell { background: #111827; color: #ffffff; font-weight: 700; text-shadow: 0 0 4px #fff, 0 0 8px rgba(255,255,255,0.8); font-family: monospace; letter-spacing: 1px; }

/* 编辑模式 CSS */
.edit-mode { user-select: none; }
.edit-mode td, .edit-mode th { cursor: text; }

.selected-cell { position: relative; }
.selected-cell::after {
    content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(26, 115, 232, 0.15) !important;
    box-shadow: inset 0 0 0 2px #1a73e8; pointer-events: none; z-index: 10;
}
td[contenteditable="true"], th[contenteditable="true"] {
    user-select: text; cursor: text; background-color: #fff !important; color: #000 !important; text-shadow: none !important;
    box-shadow: inset 0 0 0 2px #34a853; outline: none; z-index: 20; position: relative;
}

/* 🌟 修复一：正在打字的单元格，隐藏掉碍事的蓝色半透明蒙版，只保留绿色的外框 */
td[contenteditable="true"]::after, th[contenteditable="true"]::after {
    display: none !important;
}

/* 🌟 修复二：强制修改文字选中的颜色，采用极度显眼的“猛男粉”，让你绝不可能看漏 */
td[contenteditable="true"]::selection, th[contenteditable="true"]::selection,
td[contenteditable="true"] *::selection, th[contenteditable="true"] *::selection {
    background-color: #ff00aa !important; /* 高亮粉色背景 */
    color: #ffffff !important;            /* 纯白文字 */
}

.upload-layer { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }

/* 🌟 新增：底层半透明 Logo 装饰形态 (智能边距联动版) */
.logo-img {
    position: absolute !important;
    /* 👇 核心：让 bottom 和 left 直接读取我们即将加入的 CSS 变量 */
    bottom: var(--logo-gap, 16px) !important;
    left: var(--logo-gap, 16px) !important;
    width: auto !important;
    max-width: none !important;
    opacity: 0.12 !important;
    z-index: 0 !important;
    pointer-events: none !important;
    margin: 0 !important;
    /* 取消强制的偏移，让它的位置彻底由边距变量来决定 */
    transform: none !important;
    transform-origin: bottom left;
}