* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, "Microsoft YaHei", sans-serif; background: #f5f7fa; color: #333; min-height: 100vh; display: flex; flex-direction: column; }
a { text-decoration: none; color: inherit; }
header { background: linear-gradient(135deg, #667eea, #764ba2); color: #fff; padding: 40px 20px; text-align: center; }
header h1 { font-size: 2rem; margin-bottom: 8px; }
header p { opacity: 0.9; font-size: 1.05rem; }
nav { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.1); padding: 12px 20px; display: flex; justify-content: center; gap: 30px; }
nav a { text-decoration: none; color: #555; font-weight: 500; padding: 6px 0; border-bottom: 2px solid transparent; transition: all 0.2s; }
nav a:hover, nav a.active { color: #667eea; border-bottom-color: #667eea; }
main { flex: 1; max-width: 1100px; margin: 30px auto; padding: 0 20px; width: 100%; }
.section-title { font-size: 1.4rem; margin-bottom: 20px; padding-left: 12px; border-left: 4px solid #667eea; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; margin-bottom: 40px; }
.card { background: #fff; border-radius: 10px; padding: 24px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); transition: transform 0.2s, box-shadow 0.2s; display: block; }
.card:hover { transform: translateY(-3px); box-shadow: 0 6px 16px rgba(0,0,0,0.1); }
.card h3 { margin-bottom: 10px; color: #444; }
.card p { font-size: 0.92rem; color: #666; line-height: 1.6; }
.tag { display: inline-block; background: #eef0ff; color: #667eea; font-size: 0.75rem; padding: 2px 8px; border-radius: 10px; margin-top: 10px; }
footer { background: #2c3e50; color: #aab; text-align: center; padding: 24px 20px; font-size: 0.85rem; line-height: 1.8; margin-top: auto; }
footer a { color: #7eb8da; text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* Sub-page styles */
.back-link { display: inline-block; margin-bottom: 20px; color: #667eea; font-size: 0.95rem; }
.back-link:hover { text-decoration: underline; }
.topic-section { background: #fff; border-radius: 10px; padding: 28px; margin-bottom: 24px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.topic-section h2 { font-size: 1.2rem; color: #667eea; margin-bottom: 16px; padding-bottom: 10px; border-bottom: 1px solid #eee; }
.topic-section h3 { font-size: 1.05rem; color: #444; margin: 14px 0 8px; }
.topic-section ul { padding-left: 20px; margin-bottom: 10px; }
.topic-section li { font-size: 0.92rem; color: #555; line-height: 1.9; }
.topic-section p { font-size: 0.92rem; color: #555; line-height: 1.8; margin-bottom: 8px; }
.topic-section code { background: #f0f0f5; padding: 1px 6px; border-radius: 4px; font-size: 0.88rem; color: #e74c3c; }
.topic-section pre { background: #2d2d2d; color: #f8f8f2; padding: 16px; border-radius: 8px; overflow-x: auto; margin: 10px 0; font-size: 0.85rem; line-height: 1.6; }

/* Mobile adaptation */
@media (max-width: 768px) {
    header { padding: 24px 16px; }
    header h1 { font-size: 1.5rem; }
    header p { font-size: 0.9rem; }
    nav { flex-wrap: wrap; gap: 12px 20px; padding: 10px 16px; }
    nav a { font-size: 0.9rem; }
    main { margin: 16px auto; padding: 0 12px; }
    .cards { grid-template-columns: 1fr; gap: 14px; margin-bottom: 28px; }
    .card { padding: 18px; }
    .topic-section { padding: 16px; margin-bottom: 16px; }
    .topic-section ul { padding-left: 16px; }
    .topic-section li { font-size: 0.85rem; line-height: 1.8; }
    .topic-section code { font-size: 0.8rem; word-break: break-all; }
    .topic-section pre { padding: 12px; font-size: 0.78rem; }
}
