/** * 公共组件 - CSS样式和HTML结构 * 直接通过 引用 */ // 公共CSS样式 const commonCSS = ` :root { --neon-cyan: #00f5ff; --neon-pink: #ff00ff; --neon-purple: #9d00ff; --neon-blue: #0066ff; --neon-green: #00ff80; --china-red: #ff4757; --china-gold: #ffd700; --china-orange: #ff6b35; --dark-bg: #0a0a0f; --darker-bg: #050508; --card-bg: rgba(20, 20, 35, 0.8); --text-primary: #ffffff; --text-secondary: #a0a0b0; --text-muted: #6a6a7a; --border-glow: rgba(0, 245, 255, 0.3); --gradient-china: linear-gradient(135deg, #ff4757 0%, #ff6b35 50%, #ffd700 100%); --font-size-xs: 12px; --font-size-sm: 13px; --font-size-base: 14px; --font-size-lg: 15px; --font-size-xl: 16px; --font-size-2xl: 18px; --font-size-3xl: 20px; --line-height: 1.8; } * { margin: 0; padding: 0; box-sizing: border-box; } html { scroll-behavior: smooth; } body { font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif; background: var(--dark-bg); color: var(--text-primary); overflow-x: hidden; max-width: 100vw; line-height: var(--line-height); font-size: var(--font-size-base); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } html, body { position: relative; width: 100%; } .bg-animation { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; background: var(--darker-bg); } .bg-animation::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: radial-gradient(ellipse at 20% 20%, rgba(255, 71, 87, 0.05) 0%, transparent 50%), radial-gradient(ellipse at 80% 80%, rgba(255, 215, 0, 0.05) 0%, transparent 50%), radial-gradient(ellipse at 50% 50%, rgba(0, 245, 255, 0.03) 0%, transparent 70%); animation: bgPulse 10s ease-in-out infinite; } @keyframes bgPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } } .navbar { position: sticky; top: 0; left: 0; width: 100%; z-index: 1000; padding: 0.6rem 5%; display: flex; justify-content: space-between; align-items: center; background: rgba(10, 10, 15, 0.95); backdrop-filter: blur(20px); border-bottom: 1px solid var(--border-glow); } .logo { font-size: var(--font-size-xl); font-weight: 700; background: var(--gradient-china); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; text-decoration: none; letter-spacing: 1px; } .nav-links { display: flex; gap: 1.5rem; list-style: none; } .nav-links a { color: var(--text-secondary); text-decoration: none; font-weight: 500; font-size: var(--font-size-sm); transition: color 0.3s ease; } .nav-links a:hover, .nav-links a.active { color: var(--china-red); } .nav-search { display: flex; align-items: center; gap: 0.5rem; background: rgba(255, 255, 255, 0.05); padding: 0.4rem 0.8rem; border-radius: 15px; border: 1px solid var(--border-glow); } .nav-search input { background: transparent; border: none; color: var(--text-primary); outline: none; width: 120px; font-size: var(--font-size-xs); } .nav-search input::placeholder { color: var(--text-muted); } .btn-group { display: flex; gap: 0.8rem; flex-wrap: wrap; margin: 1rem 0; } .btn { padding: 0.5rem 1.2rem; border-radius: 5px; font-weight: 600; cursor: pointer; transition: all 0.3s ease; text-decoration: none; display: inline-block; font-size: var(--font-size-sm); } .btn-primary { background: var(--gradient-china); border: none; color: var(--dark-bg); } .btn-secondary { background: transparent; border: 1px solid var(--china-red); color: var(--china-red); } .btn-success { background: var(--neon-green); border: none; color: var(--dark-bg); } .btn-danger { background: var(--neon-pink); border: none; color: var(--dark-bg); } .btn:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(255, 71, 87, 0.3); } .alert { padding: 0.8rem 1.2rem; border-radius: 6px; margin: 1rem 0; border-left: 3px solid; position: relative; } .alert-info { background: rgba(0, 245, 255, 0.1); border-color: var(--neon-cyan); } .alert-success { background: rgba(0, 255, 128, 0.1); border-color: var(--neon-green); } .alert-warning { background: rgba(255, 215, 0, 0.1); border-color: var(--china-gold); } .alert-danger { background: rgba(255, 71, 87, 0.1); border-color: var(--china-red); } .alert p { margin: 0; text-indent: 0; font-size: var(--font-size-sm); } .module { background: var(--card-bg); border: 1px solid var(--border-glow); border-radius: 12px; padding: 1.5rem; backdrop-filter: blur(10px); margin-bottom: 1.5rem; } .module-title { font-size: var(--font-size-base); color: var(--china-red); margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid rgba(255, 71, 87, 0.3); position: relative; } .module-title::before { content: ''; position: absolute; bottom: -1px; left: 0; width: 50px; height: 1px; background: var(--gradient-china); } .tag-cloud { display: flex; flex-wrap: wrap; gap: 0.4rem; } .tag { padding: 0.2rem 0.6rem; background: rgba(255, 71, 87, 0.1); border: 1px solid rgba(255, 71, 87, 0.3); border-radius: 12px; color: var(--text-secondary); font-size: var(--font-size-xs); text-decoration: none; transition: all 0.3s ease; } .tag:hover { background: var(--china-red); color: var(--dark-bg); border-color: var(--china-red); } .footer { margin-top: 3rem; padding: 1.5rem 5%; background: rgba(5, 5, 8, 0.9); border-top: 1px solid var(--border-glow); text-align: center; } .footer-text { color: var(--text-muted); font-size: var(--font-size-xs); } .back-to-top { position: fixed; bottom: 30px; right: 30px; width: 40px; height: 40px; background: transparent; border: 2px solid var(--china-red); border-radius: 50%; color: var(--china-red); font-size: 16px; cursor: pointer; opacity: 0; visibility: hidden; transition: all 0.3s ease; z-index: 999; display: flex; align-items: center; justify-content: center; overflow: hidden; } .back-to-top::before { content: ''; position: absolute; top: 50%; left: 50%; width: 0; height: 0; background: var(--china-red); border-radius: 50%; transform: translate(-50%, -50%); transition: all 0.3s ease; z-index: -1; } .back-to-top.show { opacity: 1; visibility: visible; } .back-to-top:hover { color: white; } .back-to-top:hover::before { width: 100%; height: 100%; } .back-to-top-icon { position: relative; z-index: 1; width: 16px; height: 16px; } .reading-progress { position: fixed; top: 0; left: 0; width: 0%; height: 3px; background: var(--gradient-china); z-index: 1001; transition: width 0.1s ease; } .lightbox { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.95); z-index: 10000; justify-content: center; align-items: center; flex-direction: column; } .lightbox.active { display: flex; } .lightbox-image { max-width: 90%; max-height: 85%; object-fit: contain; border-radius: 8px; box-shadow: 0 0 30px rgba(255, 71, 87, 0.5); } .lightbox-caption { color: var(--text-primary); margin-top: 1rem; font-size: var(--font-size-sm); text-align: center; } .lightbox-close { position: absolute; top: 20px; right: 30px; color: var(--text-primary); font-size: 2rem; cursor: pointer; transition: color 0.3s ease; } .lightbox-close:hover { color: var(--china-red); } .lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); color: var(--text-primary); font-size: 2rem; cursor: pointer; padding: 1rem; transition: color 0.3s ease; user-select: none; } .lightbox-nav:hover { color: var(--china-red); } .lightbox-prev { left: 20px; } .lightbox-next { right: 20px; } ::-webkit-scrollbar { width: 6px; height: 6px; } ::-webkit-scrollbar-track { background: var(--darker-bg); } ::-webkit-scrollbar-thumb { background: var(--china-red); border-radius: 3px; } ::-webkit-scrollbar-thumb:hover { background: var(--china-gold); } @media (max-width: 768px) { html, body { overflow-x: hidden !important; max-width: 100vw !important; } .nav-links { display: none; } .back-to-top { bottom: 20px; right: 20px; width: 45px; height: 45px; font-size: 18px; } } @media (max-width: 480px) { .nav-search { display: none; } .navbar { padding: 0.5rem 4%; } .logo { font-size: var(--font-size-base); } .footer { padding: 1rem 4%; } .footer-text { font-size: 10px; } .back-to-top { bottom: 15px; right: 15px; width: 40px; height: 40px; font-size: 16px; } } `; // 公共基础HTML结构(不含导航栏) const commonBaseHTML = `