* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.navbar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.75rem 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.navbar-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 3rem;
}

.logo {
    font-size: 1.25rem;
    font-weight: 600;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-link {
    color: white;
    text-decoration: none;
    transition: opacity 0.3s;
    font-size: 0.95rem;
}

.nav-link:hover {
    opacity: 0.8;
}

header {
    background: #2c3e50;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

nav {
    display: flex;
    gap: 2rem;
}

nav a {
    color: white;
    text-decoration: none;
    transition: opacity 0.3s;
}

nav a:hover {
    opacity: 0.8;
}

/* Main Content */
main {
    padding: 2rem 0;
}

section {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

section h2 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 0.5rem;
}

/* Tutorials - 紧凑两列布局 */
.tutorial-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.tutorial-item {
    background: white;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    transition: background 0.2s;
}

.tutorial-item:hover {
    background: #f8f9fa;
}

.tutorial-item h3 {
    font-size: 1rem;
    margin: 0;
    display: inline;
    line-height: 1.6;
}

.tutorial-item h3 a {
    color: #2c3e50;
    text-decoration: none;
}

.tutorial-item h3 a:hover {
    color: #3498db;
}

.meta {
    display: inline;
    margin-left: 0.75rem;
    font-size: 0.8rem;
    color: #999;
}

.meta span {
    margin-right: 0.75rem;
}

.category {
    background: #3498db;
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    font-size: 0.85rem;
}

/* Examples */
.example-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.example-card {
    background: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
}

.example-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.example-card a {
    text-decoration: none;
    color: inherit;
}

.example-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.example-card h3 {
    padding: 1rem;
    font-size: 1rem;
    text-align: center;
}

/* Links */
.links-section h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

.links-notice {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.links-list {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.links-list a {
    color: #3498db;
    text-decoration: none;
}

.links-list a:hover {
    text-decoration: underline;
}

/* More Link */
.more-link {
    display: inline-block;
    margin-top: 1rem;
    color: #3498db;
    text-decoration: none;
    font-weight: 500;
}

.more-link:hover {
    text-decoration: underline;
}

/* Footer */
.footer {
    background: #2c3e50;
    color: white;
    padding: 1rem 2rem;
    text-align: center;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
}

.footer p {
    margin: 0.25rem 0;
    font-size: 0.85rem;
}

.footer a {
    color: #667eea;
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* 中间内容区 */
.content-area {
    flex: 1;
    display: flex;
    gap: 1rem;
    padding: 1rem;
    overflow: hidden;
    width: 100%;
    margin: 0 auto;
    min-height: 800px;
}

/* 左侧代码编辑区 */
.editor-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.section-header {
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-header h2 {
    font-size: 1.1rem;
    color: #333;
    font-weight: 600;
}

.code-editor {
    flex: 1;
    padding: 1.5rem;
    border: none;
    outline: none;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: none;
    background: #f8f9fa;
}

/* 右侧预览区 */
.preview-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.toolbar {
    display: flex;
    gap: 0.5rem;
}

.toolbar-btn {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: #495057;
}

.toolbar-btn:hover {
    background: #f8f9fa;
    border-color: #667eea;
    color: #667eea;
}

.toolbar-btn:active {
    transform: scale(0.95);
}

.preview-container {
    flex: 1;
    overflow: auto;
    padding: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fafbfc;
}

.preview-content {
    transition: transform 0.3s;
    transform-origin: center;
}

footer {
    background: #2c3e50;
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: 2rem;
}

/* Ads */
.ad-container {
    background: #f8f9fa;
    padding: 1rem;
    text-align: center;
    margin-bottom: 1rem;
}

/* Ad Container */
.ad-container {
    background: #f8f9fa;
    padding: 1rem;
    text-align: center;
    margin: 1.5rem 0;
    border-radius: 4px;
}

/* Pagination */
.category-filter {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.category-filter a {
    padding: 8px 16px;
    background: #f0f0f0;
    color: #333;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s;
}

.category-filter a:hover {
    background: #e0e0e0;
}

.category-filter a.active {
    background: #2c5aa0;
    color: white;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.pagination a,
.pagination span {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
}

.pagination a:hover {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.pagination .current {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

/* Detail Page */
.detail-content {
    line-height: 1.8;
}

.detail-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1rem auto;
}

.detail-content pre {
    background: #f4f4f4;
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
}

.detail-content code {
    font-family: 'Courier New', monospace;
    background: #f4f4f4;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
}

/* Responsive */
@media (max-width: 768px) {
    .tutorial-list {
        grid-template-columns: 1fr;
    }
    
    nav {
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .example-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .meta {
        flex-direction: column;
        gap: 0.3rem;
    }
}
