
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; line-height: 1.6; background: #FFF5F8; }
.container { max-width: 1200px; margin: 0 auto; padding: 20px; }
header { background: #fff; padding: 20px; margin-bottom: 20px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
header h1 { color: #333; }
h1 { font-size: 1.15em; }
header p { color: #666; }
.category-nav { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.category-nav a { padding: 8px 16px; background: #FF6B9D; color: white; text-decoration: none; border-radius: 4px; font-size: 0.9em; }
.category-nav a:hover { background: #e35a8b; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.card { background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 4px rgba(0,0,0,0.1); transition: transform 0.2s; }
.card:hover { transform: translateY(-4px); }
.card img { width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; }
.card-content { padding: 16px; }
.card-title { font-size: 1.1em; font-weight: 600; margin-bottom: 8px; color: #333; }
.card-title a { color: inherit; text-decoration: none; }
.card-title a:hover { color: #FF6B9D; }
.card-overview { font-size: 0.9em; color: #666; margin-bottom: 12px; overflow: hidden; text-overflow: ellipsis; display: -webkit; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { padding: 4px 8px; background: #e0e0e0; border-radius: 3px; font-size: 0.8em; color: #555; }
.article-page { background: #fff; padding: 30px; border-radius: 8px; }
.article-title { font-size: 1.5em; margin-bottom: 16px; color: #333; text-align: center; }

/* 概述+主图并排布局 */
.article-hero { display: flex; gap: 30px; margin-bottom: 24px; align-items: stretch; }
.article-hero-text { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 20px 10%; }
.article-hero-text .article-overview { width: 100%; margin-bottom: 20px; }
.article-hero-text .view-instructions-btn { margin-top: auto; padding-bottom: 12px; }
.article-hero-image { flex: 0 0 45%; max-width: 45%; }
.article-hero-image img { width: 100%; height: auto; max-height: 400px; object-fit: contain; border-radius: 8px; }
.article-overview { font-size: 1.1em; color: #444; line-height: 1.7; }

/* 查看说明书按钮 */
.view-instructions-btn { display: inline-block; padding: 10px 20px; background: #FF6B9D; color: white; text-decoration: none; border-radius: 6px; font-size: 0.95em; font-weight: 500; transition: background 0.2s; }
.view-instructions-btn:hover { background: #e35a8b; }

/* 图片画廊 */
.article-gallery { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; justify-content: flex-end; }
.gallery-thumb { width: 150px; height: 150px; object-fit: cover; border-radius: 6px; cursor: pointer; transition: transform 0.2s; }
.gallery-thumb:hover { transform: scale(1.05); }

/* 图案查看按钮 */
.article-patterns { margin-bottom: 24px; }
.pattern-btn { display: inline-block; padding: 10px 20px; background: #FF6B9D; color: white; text-decoration: none; border-radius: 6px; font-size: 0.95em; font-weight: 500; transition: background 0.2s; }
.pattern-btn:hover { background: #e35a8b; }

/* 制作说明 */
.article-content { margin-top: 30px; padding: 24px; background: #f9f9f9; border-radius: 8px; border: 1px solid #e0e0e0; }
.article-content h2 { margin-bottom: 16px; color: #333; font-size: 1.3em; }
.article-content pre { white-space: pre-wrap; word-wrap: break-word; font-family: inherit; font-size: 0.95em; line-height: 1.8; color: #444; }

/* 响应式：小屏幕改为上下布局 */
@media (max-width: 768px) {
    .article-hero { flex-direction: column; }
    .article-hero-image { flex: none; max-width: 100%; }
}

.pdf-btn { display: inline-block; padding: 8px 16px; background: #FF6B9D; color: white; text-decoration: none; border-radius: 4px; font-size: 0.9em; margin-left: 10px; }
.pdf-btn:hover { background: #e35a8b; }
.section { margin: 30px 0; }
.section h2 { margin-bottom: 16px; color: #333; padding-bottom: 8px; border-bottom: 2px solid #FF6B9D; }
.thumbnail-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; margin: 20px 0; }
.thumbnail-gallery img { width: 100%; height: 120px; object-fit: cover; border-radius: 4px; cursor: pointer; transition: transform 0.2s; }
.thumbnail-gallery img:hover { transform: scale(1.05); }
.gallery img:hover { transform: scale(1.05); }
.webp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 16px; }
.webp-grid img { width: 100%; border-radius: 4px; }
.back-link { display: inline-block; margin-bottom: 20px; color: #FF6B9D; text-decoration: none; font-weight: 500; }
.back-link:hover { text-decoration: underline; }
.empty-state { text-align: center; padding: 60px 20px; color: #999; }
.stats { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 12px; align-items: baseline; }
.stat-item { display: flex; align-items: baseline; gap: 5px; }
.stat-value { font-size: 1.05em; font-weight: 700; color: #FF6B9D; }
.stat-label { font-size: 0.85em; color: #999; }

/* PDF 查看器样式 */
.pdf-viewer { max-width: 1000px; margin: 0 auto; padding: 20px; }
.pdf-header { text-align: center; margin-bottom: 20px; }
.pdf-content { position: relative; display: flex; align-items: center; justify-content: center; min-height: 600px; }
.pdf-page { display: none; text-align: center; }
.pdf-page.active { display: block; }
.pdf-page img { max-width: 100%; max-height: 70vh; border: 1px solid #ddd; border-radius: 4px; }
.nav-btn { position: absolute; top: 50%; transform: translateY(-50%); padding: 15px 20px; font-size: 1.2em; cursor: pointer; border: none; border-radius: 50%; background: rgba(255, 107, 157, 0.9); color: white; z-index: 10; transition: all 0.2s; }
.nav-btn:hover { background: rgba(255, 107, 157, 1); transform: translateY(-50%) scale(1.1); }
.nav-btn:disabled { background: rgba(200, 200, 200, 0.5); cursor: not-allowed; }
.nav-btn.prev { left: 20px; }
.nav-btn.next { right: 20px; }
.page-indicator { text-align: center; margin: 20px 0; color: #666; font-size: 1.1em; }
.close-btn { display: block; text-align: center; margin: 20px 0; color: #FF6B9D; text-decoration: none; font-weight: 500; }
.close-btn:hover { text-decoration: underline; }
.info-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; padding: 10px 15px; background: #f5f5f5; border-radius: 8px; }
.info-bar p { margin: 0; color: #666; }
.keyboard-hint { font-size: 0.9em; color: #999; }

/* 站内搜索 */
.site-search { display: flex; gap: 8px; margin: 20px 0; max-width: 480px; }
.site-search input[type="search"] { flex: 1; padding: 9px 14px; border: 1px solid #ddd; border-radius: 6px; font-size: 0.95em; }
.site-search button { padding: 9px 18px; background: #FF6B9D; color: #fff; border: none; border-radius: 6px; cursor: pointer; font-size: 0.95em; transition: background 0.2s; white-space: nowrap; }
.site-search button:hover { background: #e35a8b; }
.search-meta { color: #666; margin: 12px 0; }
.search-results { display: flex; flex-direction: column; gap: 14px; margin: 20px 0; }
.search-result { display: flex; gap: 14px; background: #fff; border-radius: 8px; padding: 12px; box-shadow: 0 2px 4px rgba(0,0,0,0.06); }
.search-result-thumb { flex: 0 0 96px; }
.search-result-thumb img { width: 96px; height: 96px; object-fit: cover; border-radius: 6px; display: block; }
.search-result-body { flex: 1; min-width: 0; }
.search-snippet { color: #666; font-size: 0.9em; line-height: 1.6; margin-top: 6px; word-break: break-all; }
.search-snippet mark, mark { background: #fff3a3; color: inherit; padding: 0 2px; border-radius: 2px; }

/* 分页 */
.pagination { display: flex; justify-content: center; align-items: center; gap: 16px; margin: 28px 0; flex-wrap: wrap; }
.pagination .page-link { padding: 8px 16px; background: #FF6B9D; color: #fff; text-decoration: none; border-radius: 6px; font-size: 0.9em; transition: background 0.2s; }
.pagination .page-link:hover { background: #e35a8b; }
.pagination .page-info { color: #666; font-size: 0.9em; }


/* ========== 站点导航与品牌（不亦乐拼豆） ========== */
.site-nav { background: rgba(255,255,255,0.94); backdrop-filter: blur(8px); border-bottom: 1px solid rgba(255,107,157,0.15); position: sticky; top: 0; z-index: 100; }
.site-nav-inner { max-width: 1200px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.site-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.bead-logo { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 5px; background: #fff; border-radius: 9px; box-shadow: 0 3px 10px rgba(255,107,157,0.16); }
.bead-logo .bead { width: 8px; height: 8px; border-radius: 50%; position: relative; }
.bead-logo .bead::after { content: ''; position: absolute; left: 50%; top: 50%; width: 3px; height: 3px; border-radius: 50%; background: rgba(255,255,255,0.6); transform: translate(-50%,-50%); }
.b1 { background: #FF6B9D; } .b2 { background: #FFB84C; } .b3 { background: #4ECDC4; }
.b4 { background: #FFD93D; } .b5 { background: #FF8FB1; } .b6 { background: #95E1D3; }
.b7 { background: #A8E6CF; } .b8 { background: #FF6B6B; } .b9 { background: #F9A825; }
.brand-text { display: flex; flex-direction: column; }
.brand-name { font-size: 1.15em; font-weight: 800; color: #2D2D2D; letter-spacing: 1px; line-height: 1.25; }
.brand-tag { font-size: 0.72em; color: #C48BA0; letter-spacing: 1px; }
.site-nav-links { display: flex; gap: 6px; }
.site-nav-links a { padding: 8px 14px; border-radius: 8px; text-decoration: none; color: #666; font-size: 0.95em; transition: all 0.2s; white-space: nowrap; }
.site-nav-links a:hover { background: rgba(255,107,157,0.1); color: #FF6B9D; }
.site-nav-links a.active { background: linear-gradient(135deg,#FF6B9D,#FF8E53); color: #fff; }
.page-subtitle { color: #C48BA0; margin-top: 4px; }

/* ========== 页脚 ========== */
.site-footer { text-align: center; padding: 30px 20px 36px; margin-top: 30px; }
.footer-dots { display: flex; justify-content: center; gap: 8px; margin-bottom: 12px; }
.footer-dots .fd { width: 8px; height: 8px; border-radius: 50%; }
.fd1 { background: #FF6B9D; } .fd2 { background: #FFB84C; } .fd3 { background: #4ECDC4; } .fd4 { background: #FFD93D; } .fd5 { background: #A8E6CF; }
.footer-text { color: #FF6B9D; font-weight: 700; letter-spacing: 4px; margin-bottom: 6px; }
.footer-sub { color: #C48BA0; font-size: 0.85em; }
.footer-icp { color: #C48BA0; font-size: 0.8em; margin-top: 10px; }
.footer-icp a { color: inherit; text-decoration: none; }
.footer-icp a:hover { color: #FF6B9D; text-decoration: underline; }
.footer-police img { width: 16px; height: auto; vertical-align: -4px; margin-right: 4px; }

/* ========== 手机版底部 Tab 栏 ========== */
.tab-bar { display: none; }
@media (max-width: 768px) {
  body { padding-bottom: 64px; }
  .site-nav-links { display: none; }
  .brand-tag { display: none; }
  .site-nav-inner { padding: 8px 14px; }
  .tab-bar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 100; background: rgba(255,255,255,0.96); backdrop-filter: blur(8px); border-top: 1px solid rgba(255,107,157,0.18); padding: 6px 0 calc(6px + env(safe-area-inset-bottom)); }
  .tab-bar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none; color: #999; font-size: 0.72em; padding: 4px 0; }
  .tab-bar .tab-icon { font-size: 1.7em; line-height: 1; }
  .tab-bar a.active { color: #FF6B9D; font-weight: 700; }
}

/* ========== 首页工具主卡 ========== */
.tool-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 20px 0; }
.tool-card { display: block; background: #fff; border-radius: 14px; padding: 22px; text-decoration: none; box-shadow: 0 3px 14px rgba(255,107,157,0.1); transition: transform 0.2s, box-shadow 0.2s; border: 1px solid rgba(255,107,157,0.08); }
.tool-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(255,107,157,0.18); }
.tool-card .tool-icon { font-size: 2em; margin-bottom: 8px; }
.tool-card .tool-name { font-size: 1.15em; font-weight: 700; color: #2D2D2D; margin-bottom: 4px; }
.tool-card .tool-desc { color: #999; font-size: 0.9em; }
.tool-card.tool-gen { background: linear-gradient(135deg, rgba(255,107,157,0.12), rgba(255,142,83,0.12)); }
.tool-card.tool-app { background: linear-gradient(135deg, rgba(78,205,196,0.12), rgba(168,230,207,0.16)); }

/* ========== 手机版全局适配 ========== */
@media (max-width: 768px) {
  .container { padding: 12px; }
  header { padding: 14px; margin-bottom: 14px; }
  header h1 { font-size: 1.05em; }
  .tool-cards { grid-template-columns: 1fr; gap: 12px; }
  .tool-card { padding: 16px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .card-content { padding: 10px; }
  .card-title { font-size: 0.95em; }
  .card-overview { font-size: 0.8em; }
  .stats { gap: 12px; margin-top: 8px; }
  .category-nav { gap: 6px; }
  .category-nav a { padding: 8px 12px; font-size: 0.85em; }
  .site-search { max-width: none; }
  .article-page { padding: 18px 14px; }
  .article-title { font-size: 1.4em; }
  .article-hero-image img { max-height: none; }
  .view-instructions-btn { width: 100%; text-align: center; display: block; }
  .thumbnail-gallery { grid-template-columns: repeat(3, 1fr); }
  .article-content pre { font-size: 0.85em; white-space: pre-wrap; word-break: break-all; }
  .empty-state { padding: 40px 16px; }
  .pagination .page-link { padding: 10px 16px; }
  table { display: block; overflow-x: auto; }
}

/* ========== 图案查看器手机版 ========== */
@media (max-width: 768px) {
  .keyboard-hint { display: none; }
  .pdf-viewer { padding: 10px; }
  .info-bar { flex-direction: column; gap: 4px; text-align: center; }
  .pdf-content { flex-wrap: wrap; min-height: 0; }
  .pdf-pages { order: 1; width: 100%; }
  .pdf-page img { max-height: 60vh; }
  .nav-btn { position: static; transform: none; margin: 14px 10px 0; padding: 12px 20px; }
  .nav-btn.prev { order: 2; }
  .nav-btn.next { order: 3; }
  .nav-btn:hover { transform: none; }
}


/* ========== 图纸生成器 ========== */
.gen-layout { display: grid; grid-template-columns: minmax(0, 560px) minmax(300px, 1fr); gap: 20px; align-items: start; }
.gen-canvas-wrap { background: #fff; border-radius: 12px; padding: 16px; box-shadow: 0 2px 10px rgba(255,107,157,0.08); }
.gen-canvas-box { display: flex; justify-content: center; align-items: center; min-height: 280px; }
#pixelCanvas { max-width: 100%; touch-action: none; border-radius: 4px; background: #fff; }
.gen-empty { color: #C48BA0; text-align: center; padding: 40px 20px; line-height: 2; }
.gen-panel { background: #fff; border-radius: 12px; padding: 18px; box-shadow: 0 2px 10px rgba(255,107,157,0.08); display: flex; flex-direction: column; gap: 14px; }
.gen-section { border-bottom: 1px dashed #f0e0e6; padding-bottom: 12px; }
.gen-section:last-child { border-bottom: none; padding-bottom: 0; }
.gen-section-title { font-weight: 700; color: #2D2D2D; font-size: 0.95em; margin-bottom: 8px; }
.gen-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.gen-chip { padding: 8px 14px; border-radius: 8px; background: #FFF0F5; color: #666; border: 1px solid transparent; cursor: pointer; font-size: 0.9em; min-height: 36px; user-select: none; }
.gen-chip.active { background: linear-gradient(135deg,#FF6B9D,#FF8E53); color: #fff; }
.gen-slider { width: 100%; accent-color: #FF6B9D; height: 32px; }
.gen-slider-val { color: #FF6B9D; font-weight: 700; font-size: 0.9em; min-width: 52px; text-align: right; }
.gen-switch-row { display: flex; justify-content: space-between; align-items: center; min-height: 40px; color: #444; }
.gen-switch-row input[type=checkbox] { width: 20px; height: 20px; accent-color: #FF6B9D; }
.gen-btn { padding: 12px 18px; border: none; border-radius: 10px; cursor: pointer; font-size: 1em; min-height: 44px; }
.gen-btn-primary { background: linear-gradient(135deg,#FF6B9D,#FF8E53); color: #fff; }
.gen-btn-primary:hover { opacity: 0.9; }
.gen-btn-ghost { background: #FFF0F5; color: #FF6B9D; }
.gen-btn-block { width: 100%; }
.gen-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.gen-current-color { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 6px 0; }
.gen-color-swatch { width: 34px; height: 34px; border-radius: 8px; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.2); flex: none; }
.gen-color-info { font-size: 0.9em; color: #444; }
.gen-file-label { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 12px 18px; background: linear-gradient(135deg,#FF6B9D,#FF8E53); color: #fff; border-radius: 10px; cursor: pointer; font-size: 1em; min-height: 44px; user-select: none; }
.gen-file-label:hover { opacity: 0.9; }
.gen-file-input { display: none; }
.gen-material { max-height: 320px; overflow-y: auto; }
.gen-material table { width: 100%; border-collapse: collapse; font-size: 0.88em; }
.gen-material th, .gen-material td { padding: 6px 8px; text-align: left; border-bottom: 1px solid #f5f5f5; white-space: nowrap; }
.gen-material th { position: sticky; top: 0; background: #fff; color: #C48BA0; font-weight: 600; }
.gen-swatch { display: inline-block; width: 16px; height: 16px; border-radius: 4px; vertical-align: middle; margin-right: 6px; border: 1px solid rgba(0,0,0,0.08); }
.gen-summary { color: #666; font-size: 0.9em; margin-bottom: 8px; }
.gen-summary b { color: #FF6B9D; }

/* 色板弹层 */
.palette-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 200; display: none; align-items: center; justify-content: center; }
.palette-overlay.show { display: flex; }
.palette-panel { background: #fff; border-radius: 16px; padding: 18px; width: min(560px, 92vw); max-height: 80vh; overflow-y: auto; }
.palette-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.palette-head h3 { color: #2D2D2D; font-size: 1.05em; }
.palette-close { border: none; background: #FFF0F5; color: #FF6B9D; border-radius: 8px; padding: 6px 14px; cursor: pointer; min-height: 36px; }
.palette-group-title { font-size: 0.9em; color: #C48BA0; margin: 10px 0 6px; }
.palette-colors { display: flex; flex-wrap: wrap; gap: 8px; }
.palette-color { width: 40px; height: 40px; border-radius: 8px; cursor: pointer; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.15); position: relative; flex: none; }
.palette-color.selected { outline: 3px solid #FF6B9D; }
.palette-color .pc-code { position: absolute; bottom: -1px; right: 2px; font-size: 8px; color: rgba(0,0,0,0.55); }

/* 轻提示 */
.gen-toast { position: fixed; left: 50%; top: 18%; transform: translateX(-50%); background: rgba(0,0,0,0.75); color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 300; font-size: 0.92em; display: none; }
.gen-toast.show { display: block; }

@media (max-width: 900px) {
  .gen-layout { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .palette-overlay { align-items: flex-end; }
  .palette-panel { width: 100vw; max-height: 70vh; border-radius: 16px 16px 0 0; }
  .gen-canvas-box { min-height: 200px; }
}

/* ========== 小程序介绍页 ========== */
.app-hero { text-align: center; padding: 30px 0 10px; }
.app-hero h1 { font-size: 1.5em; color: #2D2D2D; margin-bottom: 6px; }
.app-hero p { color: #C48BA0; }
.app-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 20px 0; }
.app-card { background: #fff; border-radius: 14px; padding: 22px; box-shadow: 0 3px 14px rgba(255,107,157,0.1); }
.app-card h2 { font-size: 1.1em; margin-bottom: 8px; color: #2D2D2D; }
.app-card ul { padding-left: 18px; color: #666; font-size: 0.92em; line-height: 1.9; }
.app-steps { background: #fff; border-radius: 14px; padding: 22px; margin: 16px 0; box-shadow: 0 3px 14px rgba(255,107,157,0.1); }
.app-steps h2 { font-size: 1.1em; margin-bottom: 10px; color: #2D2D2D; }
.app-steps ol { padding-left: 20px; line-height: 2.1; color: #444; }
.app-qrcode { text-align: center; margin: 24px 0; }
.app-qrcode img { width: 220px; height: 220px; border-radius: 12px; border: 1px solid #f0e0e6; }
.app-qrcode-placeholder { display: inline-block; width: 220px; height: 220px; border: 2px dashed rgba(255,107,157,0.4); border-radius: 12px; color: #C48BA0; font-size: 0.9em; line-height: 1.9; padding: 60px 20px 0; }
.app-tip { text-align: center; color: #C48BA0; font-size: 0.88em; margin: 10px 0 30px; }
@media (max-width: 768px) {
  .app-cards { grid-template-columns: 1fr; }
  .app-hero h1 { font-size: 1.15em; }
}


/* ========== P6 首页改版：左右分栏 + 右栏搜索与工具 + 分类折叠 ========== */
.home-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px 24px; }
.home-layout > *:not(.home-side) { grid-column: 1; min-width: 0; }
.home-layout > header { margin-bottom: 0; }
.home-side { grid-column: 2; grid-row: 1 / span 5; position: sticky; top: 72px; align-self: start; }
.home-side .site-search { margin: 0 0 14px; max-width: none; }
.home-side .tool-cards { grid-template-columns: 1fr; gap: 12px; margin: 0; }
.home-side .tool-card { padding: 14px 16px; border-radius: 12px; }
.home-side .tool-icon { font-size: 1.5em; margin-bottom: 4px; }
.home-side .tool-name { font-size: 1em; margin-bottom: 2px; }
.home-side .tool-desc { font-size: 0.82em; }

/* 分类折叠按钮（对齐小程序样式） */
.category-toggle { padding: 8px 16px; border-radius: 16px; font-size: 0.9em; color: #FF6B9D; background: #FFE0EB; border: none; cursor: pointer; line-height: 1.4; transition: opacity 0.15s, transform 0.15s; }
.category-toggle:hover { opacity: 0.85; }
.category-toggle:active { transform: scale(0.96); }

/* 手机版：单列，标题下依次 搜索 → 双卡并排 → 分类 → 卡片流 */
@media (max-width: 768px) {
  .home-layout { display: block; }
  .home-side { position: static; }
  .home-side .site-search { margin: 0 0 12px; }
  .home-side .tool-cards { grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 16px; }
  .home-side .tool-card { padding: 12px; }
  .home-side .tool-icon { font-size: 1.3em; margin-bottom: 2px; }
  .home-side .tool-name { font-size: 0.95em; margin-bottom: 2px; }
  .home-side .tool-desc { font-size: 0.75em; }
  .category-toggle { padding: 8px 12px; font-size: 0.85em; }
}


/* ========== P6.1 首页微调：数据条紧凑 + 桌面一行三图 ========== */
.home-layout .grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
@media (max-width: 768px) {
  .home-layout .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
}

/* ===== P7 tool-mat card + hot widget ===== */
.tool-card.tool-mat { background: linear-gradient(135deg, rgba(156,136,255,0.16), rgba(255,107,157,0.10)); }
.hot-widget { margin-top: 16px; background: #fff; border-radius: 12px; padding: 14px 16px; border: 1px solid rgba(255,107,157,0.08); box-shadow: 0 3px 14px rgba(255,107,157,0.10); }
.hot-title { font-weight: 700; font-size: 1em; color: #2D2D2D; margin-bottom: 6px; }
.hot-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; text-decoration: none; border-top: 1px dashed rgba(255,107,157,0.18); }
.hot-item:first-of-type { border-top: none; }
.hot-item img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; flex-shrink: 0; background: #FFE0EB; }
.hot-name { color: #555; font-size: 0.88em; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hot-item:hover .hot-name { color: #FF6B9D; }
.materials-note { margin-top: 18px; }

@media (max-width: 768px) {
    .hot-widget { display: none; }
    .home-side .tool-card.tool-mat { grid-column: 1 / -1; }
}

/* ===== P7.1 title-row stats ===== */
.home-title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; }
.home-title-row .stats { margin-top: 0; }

/* ===== P7.2 mobile: compact categories / mat in tab bar / horizontal tool cards ===== */
@media (max-width: 768px) {
    .category-nav { gap: 5px; }
    .category-nav a { padding: 5px 9px; font-size: 0.78em; }
    .category-toggle { padding: 6px 12px; font-size: 0.8em; }
    .home-side .tool-card.tool-mat { display: none; }
    .home-side .tool-card { display: flex; align-items: center; gap: 8px; padding: 10px 12px; }
    .home-side .tool-icon { margin-bottom: 0; }
    .home-side .tool-desc { display: none; }
}

/* ===== P8 subtitle link ===== */
.page-subtitle a { color: #FF6B9D; text-decoration: none; }
.page-subtitle a:hover { text-decoration: underline; }

/* ===== P9 source-tabs + gallery ===== */
.source-tabs { display: flex; gap: 10px; margin-bottom: 16px; }
.source-tabs a { flex: 1; text-align: center; padding: 9px 0; border-radius: 20px; background: #FFE0EB; color: #FF6B9D; text-decoration: none; font-size: 0.92em; transition: opacity 0.15s; }
.source-tabs a.active { background: linear-gradient(135deg, #FF6B9D, #FF8E53); color: #fff; font-weight: 700; }
.source-tabs a:not(.active):hover { opacity: 0.8; }
.category-nav a.active { background: #e35a8b; box-shadow: inset 0 0 0 2px rgba(255,255,255,0.6); }

/* 图库小分类筛选条（继承 .category-nav，轻量配色区分层级） */
.subcategory-nav { margin-top: -12px; }
.subcategory-nav a { background: #FFE0EB; color: #e35a8b; }
.subcategory-nav a:hover { background: #ffd0e0; }
.resource-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin: 18px 0; }
.resource-gallery a { display: block; }
.resource-gallery img { width: 100%; border-radius: 12px; display: block; box-shadow: 0 3px 14px rgba(255,107,157,0.12); }
@media (max-width: 768px) {
    .resource-gallery { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
}

/* ===== P9.1 contain thumbs + lightbox ===== */
.card.card-fit-contain img { object-fit: contain; background: #FFF5F8; }
.resource-gallery img { cursor: zoom-in; }
.lightbox { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,0.82); display: flex; align-items: center; justify-content: center; padding: 20px; }
.lightbox[hidden] { display: none; }
.lightbox-inner { position: relative; max-width: 92vw; text-align: center; }
.lightbox img { max-width: 92vw; max-height: 74vh; border-radius: 10px; background: #fff; display: inline-block; }
.lightbox-close { position: absolute; top: -14px; right: -14px; width: 36px; height: 36px; border-radius: 50%; border: none; background: #fff; color: #333; font-size: 20px; cursor: pointer; z-index: 2; }
.lightbox-actions { margin-top: 14px; display: flex; gap: 12px; justify-content: center; }
.lightbox-actions button { padding: 10px 24px; border: none; border-radius: 20px; background: linear-gradient(135deg, #FF6B9D, #FF8E53); color: #fff; font-size: 0.95em; cursor: pointer; }
.lightbox-actions button:active { opacity: 0.85; }

/* === P13 SEO：详情页同分类内链 === */
.related-section { margin-top: 40px; }
.related-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; border-bottom: 2px solid #FF6B9D; padding-bottom: 8px; }
.related-head h2 { margin: 0; color: #333; font-size: 1.3em; border: none; padding: 0; }
.related-more { color: #FF6B9D; text-decoration: none; font-size: 0.95em; white-space: nowrap; }
.related-more:hover { color: #e35a8b; text-decoration: underline; }

/* === P13 SEO：友好 404（像素豆卡片版，与 COS 404 同款视觉） === */
.nf-wrap { display: flex; align-items: center; justify-content: center; padding: 40px 0 20px; }
.nf-card { background: #fff; border-radius: 16px; box-shadow: 0 10px 34px rgba(255, 107, 157, 0.13); padding: 42px 40px 36px; max-width: 540px; width: 100%; text-align: center; }
.px404 { display: grid; grid-template-columns: repeat(11, 1fr); gap: 5px; width: 280px; max-width: 72%; margin: 0 auto 26px; }
.px404 .cell { aspect-ratio: 1 / 1; border-radius: 50%; position: relative; }
.px404 .cell.on::after { content: ''; position: absolute; left: 50%; top: 50%; width: 30%; height: 30%; border-radius: 50%; background: rgba(255, 255, 255, 0.55); transform: translate(-50%, -50%); }
.nf-card h1 { font-size: 1.35em; color: #333; margin-bottom: 10px; }
.nf-sub { color: #888; font-size: 0.95em; line-height: 1.7; margin-bottom: 20px; }
.spill { display: flex; justify-content: center; align-items: center; gap: 9px; margin-bottom: 22px; }
.spill i { border-radius: 50%; display: block; }
.nf-search { margin: 0 auto 18px; max-width: 400px; }
.nf-links { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.nf-links a { flex: 1 1 40%; padding: 10px 14px; background: #FFF0F5; color: #FF6B9D; border: 1px solid rgba(255, 107, 157, 0.28); border-radius: 8px; text-decoration: none; font-size: 0.95em; transition: all 0.2s; }
.nf-links a:hover { background: #FFE4EE; transform: translateY(-2px); }
@media (max-width: 480px) {
    .nf-card { padding: 32px 20px 28px; }
    .nf-card h1 { font-size: 1.2em; }
    .nf-links { flex-direction: column; }
    .nf-links a { flex: 1 1 auto; }
}
@media (max-width: 768px) {
    .related-head h2 { font-size: 1.15em; }
}

/* === 物料清单（P17b） === */
.materials-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin: 20px 0; }
.material-card { background: #fff; border-radius: 12px; padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); display: flex; flex-direction: column; gap: 10px; }
.material-name { font-size: 1.05em; font-weight: 600; color: #333; }
.material-note { color: #888; font-size: 0.9em; line-height: 1.6; flex: 1; }
.material-card .copy-btn { align-self: flex-start; background: linear-gradient(135deg, #FF6B9D, #FF8E53); color: #fff; border: none; padding: 8px 18px; border-radius: 20px; cursor: pointer; font-size: 0.9em; transition: opacity 0.2s; }
.material-card .copy-btn:hover { opacity: 0.88; }
@media (max-width: 768px) {
    .materials-list { grid-template-columns: 1fr; }
    .material-card .copy-btn { align-self: stretch; padding: 12px 18px; }
}

/* 扫码体验双码卡片（/app） */
.app-qr-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; max-width: 620px; margin: 0 auto; }
.app-qr-card { background: #fff; border-radius: 12px; box-shadow: 0 2px 6px rgba(0,0,0,0.08); border: 1px solid #f0e0e6; padding: 20px 16px; }
.app-qrcode .app-qr-card img { width: 160px; height: 160px; border-radius: 10px; }
.app-qr-name { margin: 12px 0 4px; font-weight: 600; color: #333; }
.app-qr-desc { margin: 0; font-size: 0.85em; color: #999; }
.app-qr-card .app-qrcode-placeholder { width: 160px; height: 160px; padding: 32px 12px 0; line-height: 1.6; font-size: 0.85em; }
@media (max-width: 640px) {
    .app-qr-grid { grid-template-columns: 1fr; }
    .app-qrcode .app-qr-card img { width: 180px; height: 180px; }
}
