* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.language-filter {
    background: white;
    padding: 1.5rem;
    margin: 2rem auto;
    max-width: 1400px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.language-filter h3 {
    margin-bottom: 1rem;
    color: #667eea;
}

.language-filter h3 .hint {
    font-size: 0.85rem;
    color: #999;
    font-weight: normal;
    margin-left: 0.5rem;
}

.language-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

/* 语言按钮项（可拖拽） */
.language-item {
    cursor: move;
    padding: 0.75rem 1.5rem;
    background: #ccc;
    color: #666;
    border-radius: 12px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    user-select: none;
    font-size: 1rem;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 选中状态 */
.language-item.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.language-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.3);
}

.language-item.selected:hover {
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

/* 语言名称 */
.language-name {
    pointer-events: none;
    white-space: nowrap;
}

/* 正在拖拽的元素 */
.language-item.dragging {
    opacity: 0.6;
    transform: scale(0.95) rotate(2deg);
    cursor: grabbing;
}

/* 拖拽目标元素 */
.language-item.drag-over {
    transform: scale(1.08);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.6);
}

.language-item.selected.drag-over {
    box-shadow: 0 8px 28px rgba(102, 126, 234, 0.7);
}

main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.example-section {
    background: white;
    margin-bottom: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
}

.example-header {
    background: #667eea;
    color: white;
    padding: 1.5rem;
}

.example-header h2 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.example-header p {
    opacity: 0.9;
    font-size: 1rem;
}

.code-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1px;
    background: #e0e0e0;
}

.code-block {
    background: white;
    padding: 1.5rem;
    min-width: 0;  /* 允许子元素缩小 */
}

.code-block.hidden {
    display: none;
}

.language-label {
    font-weight: bold;
    color: #667eea;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.language-label::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #667eea;
}

pre {
    background: #2d2d2d !important;
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
    border-left: 3px solid #667eea;
    margin: 0;
    white-space: pre;       /* 代码不换行 */
}

pre[class*="language-"] {
    background: #2d2d2d !important;
    overflow-x: auto !important;
}

code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre;       /* 代码不换行 */
}

code[class*="language-"] {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
}

footer {
    background: #333;
    color: white;
    text-align: center;
    padding: 2rem;
    margin-top: 3rem;
}

/* Responsive design */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    .code-grid {
        grid-template-columns: 1fr;
    }
    
    .language-checkboxes {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* Syntax highlighting colors */
.keyword { color: #0000ff; }
.string { color: #a31515; }
.comment { color: #008000; font-style: italic; }
.function { color: #795e26; }
.number { color: #098658; }
