* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: #ffffff;
    color: #333;
    min-height: 100vh;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #e8eaed;
    overflow: hidden;
    padding: 20px;
}

/* 头部 */
.header {
    background: #f5f7fa;
    border-bottom: 1px solid #e8eaed;
    color: #333;
    padding: 30px 20px;
    text-align: center;
    border-radius: 8px 8px 0 0;
    margin: -20px -20px 20px -20px;
}

.header h1 {
    font-size: 2.5em;
    font-weight: 700;
    letter-spacing: 2px;
    color: #333;
}

/* 发布区域 */
.publish-section {
    padding: 20px 0;
    border-bottom: 1px solid #e8eaed;
    margin-bottom: 20px;
}

.publish-card {
    max-width: 700px;
    margin: 0 auto;
    background: #f5f7fa;
    padding: 25px;
    border-radius: 8px;
    border: 1px solid #e8eaed;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.publish-card h2 {
    font-size: 1.5em;
    margin-bottom: 20px;
    color: #333;
    text-align: center;
}

#codeInput {
    width: 100%;
    padding: 12px;
    font-size: 1em;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #ffffff;
    color: #333;
    font-family: 'Consolas', monospace;
    resize: vertical;
    margin-bottom: 15px;
}

#codeInput:focus {
    outline: none;
    border-color: #333;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.05);
}

.message {
    margin-top: 10px;
    padding: 10px 15px;
    border-radius: 6px;
    display: none;
    font-size: 0.9em;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

/* 按钮 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease-in-out;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: #333;
    color: #ffffff;
    border: none;
}

.btn-primary:hover {
    background: #555;
}

.btn-secondary {
    background: #f5f7fa;
    color: #333;
    border: 1px solid #ddd;
}

.btn-secondary:hover {
    background: #e8eaed;
}

.btn-danger {
    background: #e74c3c;
    color: white;
    border: none;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-success {
    background: #27ae60;
    color: white;
    border: none;
}

.btn-success:hover {
    background: #229954;
}

/* 搜索区域 */
.search-section {
    padding: 20px 0;
    border-bottom: 1px solid #e8eaed;
    margin-bottom: 20px;
}

.search-bar {
    max-width: 700px;
    margin: 0 auto;
    display: flex;
    gap: 10px;
}

.search-bar input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1em;
    background: #ffffff;
    color: #333;
}

.search-bar input:focus {
    outline: none;
    border-color: #333;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.05);
}

/* 列表区域 */
.list-section {
    padding: 20px 0;
}

.code-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.code-item {
    background: #f5f7fa;
    border: 1px solid #e8eaed;
    border-radius: 8px;
    padding: 18px;
    transition: all 0.3s ease-in-out;
}

.code-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: none;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.code-score {
    background: #e8eaed;
    color: #333;
    padding: 5px 15px;
    border-radius: 12px;
    font-size: 0.9em;
    font-weight: 700;
}

.code-status {
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 600;
}

.code-status.pending {
    background: #fff3cd;
    color: #856404;
}

.code-status.approved {
    background: #d4edda;
    color: #155724;
}

.code-status.rejected {
    background: #f8d7da;
    color: #721c24;
}

.code-content {
    background: #ffffff;
    padding: 12px;
    border-radius: 6px;
    word-break: break-all;
    font-size: 0.95em;
    color: #333;
    margin-bottom: 12px;
    max-height: 70px;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.5;
    border: 1px solid #ddd;
}

.code-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85em;
    color: #999;
}

.code-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.code-actions .btn {
    flex: 1;
    padding: 8px 12px;
    font-size: 0.85em;
}

/* 分页 */
.pagination-section {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 20px 0;
    border-top: 1px solid #e8eaed;
    margin-top: 20px;
}

.pagination-section .btn {
    min-width: 100px;
}

#pageInfo {
    font-size: 1.1em;
    font-weight: 500;
    color: #333;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 1.2em;
}

/* 响应式调整 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    .container {
        border-radius: 0;
        padding: 15px;
    }
    .header {
        margin: -15px -15px 15px -15px;
        padding: 25px 15px;
    }
    .header h1 {
        font-size: 2em;
    }
    .publish-card, .search-bar {
        padding: 15px;
        max-width: 100%;
    }
    .publish-card h2 {
        font-size: 1.3em;
    }
    .search-bar {
        flex-wrap: wrap;
    }
    .search-bar input, .search-bar .btn {
        width: 100%;
        margin-bottom: 8px;
    }
    .code-list {
        grid-template-columns: 1fr;
    }
    .code-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .code-score {
        padding: 4px 10px;
        font-size: 0.85em;
    }
    .code-content {
        max-height: 80px;
        font-size: 0.9em;
    }
    .pagination-section {
        flex-wrap: wrap;
        gap: 10px;
    }
    .pagination-section .btn {
        width: calc(50% - 5px);
        min-width: unset;
    }
    #pageInfo {
        width: 100%;
        text-align: center;
        order: -1;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.8em;
    }
    .publish-card h2 {
        font-size: 1.2em;
    }
    .btn {
        font-size: 0.9em;
        padding: 8px 15px;
    }
}
